@bino-bi/bn-template-engine 1.0.0-next.26 → 1.0.0-next.28
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/bn-template-engine/bn-template-engine.esm.js +1 -1
- package/dist/bn-template-engine/p-5075771a.entry.js +1 -0
- package/dist/bn-template-engine/p-5d516435.entry.js +1 -0
- package/dist/bn-template-engine/p-5e90e728.entry.js +1 -0
- package/dist/bn-template-engine/p-9ef7e132.entry.js +1 -0
- package/dist/bn-template-engine/{p-f06c3703.entry.js → p-9f7a1980.entry.js} +1 -1
- package/dist/bn-template-engine/p-BeXgxHkW.js +1 -0
- package/dist/bn-template-engine/p-CH0bpt_k.js +1 -0
- package/dist/bn-template-engine/p-ClruFZD_.js +1 -0
- package/dist/bn-template-engine/{p-CTrNbSXN.js → p-DFmSrSnf.js} +1 -1
- package/dist/bn-template-engine/{p-BcLsoDrW.js → p-DI3efDSV.js} +1 -1
- package/dist/bn-template-engine/p-DXLTTILG.js +1 -0
- package/dist/bn-template-engine/p-DtP4jqG5.js +1 -0
- package/dist/bn-template-engine/p-a8281b71.entry.js +1 -0
- package/dist/bn-template-engine/p-b31277e7.entry.js +1 -0
- package/dist/bn-template-engine/p-b396ac84.entry.js +1 -0
- package/dist/cjs/{bn-asset_21.cjs.entry.js → bn-asset_28.cjs.entry.js} +21358 -6528
- package/dist/cjs/bn-grid.cjs.entry.js +4 -6
- package/dist/cjs/bn-image.cjs.entry.js +3 -5
- package/dist/cjs/bn-internationalization.cjs.entry.js +17 -6
- package/dist/cjs/bn-ruleset.cjs.entry.js +5 -5
- package/dist/cjs/bn-template-engine.cjs.js +1 -1
- package/dist/cjs/bn-template.cjs.entry.js +2 -2
- package/dist/cjs/bn-text.cjs.entry.js +115 -43
- package/dist/cjs/{context-protocol-DcTEh1rq.js → context-protocol-C0rKepqu.js} +108 -22
- package/dist/cjs/{diagnostics-CTgbq_Gc.js → diagnostics-Cq-qDtXq.js} +1 -1
- package/dist/cjs/editor-companion.cjs.entry.js +2 -2
- package/dist/cjs/loader.cjs.js +1 -1
- package/dist/cjs/queryError-BZjnIW_w.js +16 -0
- package/dist/cjs/{scaling-Dsb5_NXy.js → sanitizeHtml-Yx1xn6i_.js} +467 -287
- package/dist/cjs/{withBodyObserver-DJO98AJ-.js → withBodyObserver-CaPUjuC5.js} +1 -1
- package/dist/cjs/withHasError-qGW_yqIv.js +426 -0
- package/dist/cjs/{withStyled-D0jLwCib.js → withStyled-vSfogp9J.js} +543 -42
- package/dist/collection/components/bn-chart-bubble/bn-chart-bubble.css +37 -0
- package/dist/collection/components/bn-chart-bubble/bn-chart-bubble.js +53 -28
- package/dist/collection/components/bn-chart-bubble/ibcs-chart-bubble.css +37 -5
- package/dist/collection/components/bn-chart-bubble/ibcs-chart-bubble.js +16 -7
- package/dist/collection/components/bn-chart-bubble/utils/BubbleChart.js +67 -30
- package/dist/collection/components/bn-chart-bullet/bn-chart-bullet.css +37 -0
- package/dist/collection/components/bn-chart-bullet/bn-chart-bullet.js +49 -29
- package/dist/collection/components/bn-chart-bullet/ibcs-chart-bullet.css +37 -5
- package/dist/collection/components/bn-chart-bullet/ibcs-chart-bullet.js +17 -7
- package/dist/collection/components/bn-chart-bullet/utils/BulletChart.js +34 -18
- package/dist/collection/components/bn-chart-bullet/utils/model/BulletChartStyle.js +2 -0
- package/dist/collection/components/bn-chart-bullet/utils/model/BulletConfig.js +1 -1
- package/dist/collection/components/bn-chart-scatter/bn-chart-scatter.css +37 -0
- package/dist/collection/components/bn-chart-scatter/bn-chart-scatter.js +52 -27
- package/dist/collection/components/bn-chart-scatter/ibcs-chart-scatter.css +37 -5
- package/dist/collection/components/bn-chart-scatter/ibcs-chart-scatter.js +16 -7
- package/dist/collection/components/bn-chart-scatter/utils/ScatterChart.js +52 -18
- package/dist/collection/components/bn-chart-structure/bn-chart-structure.css +37 -5
- package/dist/collection/components/bn-chart-structure/bn-chart-structure.js +74 -44
- package/dist/collection/components/bn-chart-structure/ibcs-chart-structure.js +60 -19
- package/dist/collection/components/bn-chart-structure/utils/StructureChart.js +218 -262
- package/dist/collection/components/bn-chart-structure/utils/elements/Label.js +1 -1
- package/dist/collection/components/bn-chart-structure/utils/elements/Needle.js +11 -4
- package/dist/collection/components/bn-chart-structure/utils/elements/StackedBar.js +16 -25
- package/dist/collection/components/bn-chart-structure/utils/model/StructureChartComponentConfig.js +3 -2
- package/dist/collection/components/bn-chart-structure/utils/model/styles/StructureChartStyle.js +2 -0
- package/dist/collection/components/bn-chart-time/bn-chart-time.css +37 -0
- package/dist/collection/components/bn-chart-time/bn-chart-time.js +122 -52
- package/dist/collection/components/bn-chart-time/ibcs-chart-time.css +37 -0
- package/dist/collection/components/bn-chart-time/ibcs-chart-time.js +60 -19
- package/dist/collection/components/bn-chart-time/utils/TimeChart.js +245 -250
- package/dist/collection/components/bn-chart-time/utils/elements/AreaFill.js +1 -1
- package/dist/collection/components/bn-chart-time/utils/elements/Label.js +1 -1
- package/dist/collection/components/bn-chart-time/utils/elements/LineSeries.js +1 -1
- package/dist/collection/components/bn-chart-time/utils/elements/Needle.js +11 -4
- package/dist/collection/components/bn-chart-time/utils/elements/StackedColumn.js +22 -34
- package/dist/collection/components/bn-chart-time/utils/helper/LabelCollisionManager.js +3 -3
- package/dist/collection/components/bn-chart-time/utils/model/TimeChartComponentConfig.js +4 -3
- package/dist/collection/components/bn-chart-time/utils/model/TimeChartDataRow.js +2 -2
- package/dist/collection/components/bn-chart-time/utils/model/styles/TimeChartStyle.js +2 -0
- package/dist/collection/components/bn-component-style/bn-component-style.js +14 -2
- package/dist/collection/components/bn-context/bn-context.js +92 -22
- package/dist/collection/components/bn-dataset/bn-dataset.js +246 -90
- package/dist/collection/components/bn-datasource/bn-datasource.js +169 -77
- package/dist/collection/components/bn-footer/bn-footer.js +6 -6
- package/dist/collection/components/bn-internationalization/bn-internationalization.js +14 -3
- package/dist/collection/components/bn-layout-card/bn-layout-card.js +25 -74
- package/dist/collection/components/bn-layout-page/bn-layout-page.js +59 -71
- package/dist/collection/components/bn-message/bn-message.js +2 -2
- package/dist/collection/components/bn-page/bn-page.css +0 -240
- package/dist/collection/components/bn-page/bn-page.js +14 -4
- package/dist/collection/components/bn-page/pageFormats.js +69 -0
- package/dist/collection/components/bn-ruleset/bn-ruleset.js +2 -2
- package/dist/collection/components/bn-scaling-group/bn-scaling-group.js +7 -7
- package/dist/collection/components/bn-table/bn-table.css +38 -1
- package/dist/collection/components/bn-table/bn-table.js +96 -59
- package/dist/collection/components/bn-table/ibcs-table.css +39 -1
- package/dist/collection/components/bn-table/ibcs-table.js +89 -30
- package/dist/collection/components/bn-table/utils/Table.js +12 -13
- package/dist/collection/components/bn-table/utils/elements/Cell.js +9 -3
- package/dist/collection/components/bn-table/utils/elements/CellBarChart.js +38 -34
- package/dist/collection/components/bn-table/utils/elements/TableRow.js +2 -1
- package/dist/collection/components/bn-table/utils/elements/WaterfallBar.js +4 -4
- package/dist/collection/components/bn-table/utils/factories/tableDataSetFactory.js +17 -4
- package/dist/collection/components/bn-table/utils/helper/DataQuery.js +128 -98
- package/dist/collection/components/bn-table/utils/helper/IntervalColumns.js +6 -20
- package/dist/collection/components/bn-table/utils/helper/QueryGroup.js +9 -2
- package/dist/collection/components/bn-table/utils/helper/barColumnGeometry.js +2 -2
- package/dist/collection/components/bn-table/utils/model/TableAttribute.js +2 -2
- package/dist/collection/components/bn-table/utils/model/TableComponentConfig.js +3 -2
- package/dist/collection/components/bn-template/bn-template.js +1 -1
- package/dist/collection/components/bn-text/bn-text.js +36 -39
- package/dist/collection/components/bn-text/utils/template.js +79 -0
- package/dist/collection/components/bn-title/bn-title.js +10 -4
- package/dist/collection/components/bn-title/ibcs-title/ibcs-title.js +3 -1
- package/dist/collection/components/bn-tree/bn-tree.js +119 -23
- package/dist/collection/components/bn-tree/utils/EdgeRenderer.js +59 -51
- package/dist/collection/components/bn-tree/utils/TreeLayout.js +30 -5
- package/dist/collection/components/bn-tree/utils/TreeParser.js +35 -0
- package/dist/collection/components/editor-companion/editor-companion.js +1 -1
- package/dist/collection/context/context-protocol.js +1 -1
- package/dist/collection/context/scopedDb.js +47 -4
- package/dist/collection/stores/componentStyles.js +39 -0
- package/dist/collection/stores/internationalization.js +15 -13
- package/dist/collection/utils/DateStringFactory.js +17 -15
- package/dist/collection/utils/autoFit.js +2 -2
- package/dist/collection/utils/componentRegister.js +60 -16
- package/dist/collection/utils/constants.js +2 -2
- package/dist/collection/utils/dataAnalyzer.js +9 -12
- package/dist/collection/utils/emptyState.js +21 -0
- package/dist/collection/utils/formatter.js +29 -20
- package/dist/collection/utils/layoutObserver.js +1 -1
- package/dist/collection/utils/layoutState/generic.js +1 -1
- package/dist/collection/utils/layoutState/svgChartElements.js +2 -2
- package/dist/collection/utils/layoutTemplate.js +81 -0
- package/dist/collection/utils/measurementHost.js +2 -2
- package/dist/collection/utils/model/Order.js +1 -1
- package/dist/collection/utils/model/styles/SVGStyle.js +12 -4
- package/dist/collection/utils/parentDimensions.js +35 -3
- package/dist/collection/utils/queryError.js +11 -0
- package/dist/collection/utils/relativeVariance.js +14 -0
- package/dist/collection/utils/sanitizeHtml.js +30 -16
- package/dist/collection/utils/scaling.js +2 -2
- package/dist/collection/utils/stackColors.js +27 -5
- package/dist/collection/utils/stackLayout.js +71 -0
- package/dist/collection/utils/styled/attributes.js +16 -3
- package/dist/collection/utils/styled/style-sheet.js +1 -1
- package/dist/collection/utils/styled/withStyled.js +1 -1
- package/dist/collection/utils/testing/fakeGroup.js +21 -0
- package/dist/collection/utils/testing/mutationObserver.js +44 -0
- package/dist/collection/utils/testing/structureChart.js +26 -0
- package/dist/collection/utils/testing/timeChart.js +28 -0
- package/dist/collection/utils/validate.js +1 -1
- package/dist/collection/utils/withComponentStatus.js +137 -12
- package/dist/collection/utils/withInheritedProps.js +113 -64
- package/dist/collection/utils/withRuleSet.js +10 -7
- package/dist/collection/utils/withTranslation.js +3 -3
- package/dist/collection/utils/xy/FacetGrid.js +1 -1
- package/dist/collection/utils/xy/IsoCurves.js +1 -1
- package/dist/collection/utils/xy/NumericScale.js +46 -15
- package/dist/collection/utils/xy/PointLabeler.js +2 -2
- package/dist/collection/utils/xy/RadiusScale.js +2 -2
- package/dist/collection/utils/xy/SeriesPalette.js +3 -3
- package/dist/collection/utils/xy/VarianceMeasure.js +22 -4
- package/dist/collection/utils/xy/XYFrame.js +4 -4
- package/dist/collection/utils/xy/XYLegend.js +5 -7
- package/dist/collection/utils/xy/checkXYOverflow.js +32 -0
- package/dist/collection/utils/xy/formatXYValue.js +13 -0
- package/dist/collection/utils/xy/model/XYChartDataRow.js +0 -0
- package/dist/collection/utils/xy/model/XYChartStyle.js +2 -0
- package/dist/components/DataFormatDigits.js +1 -1
- package/dist/components/DateStringFactory.js +1 -1
- package/dist/components/LabelCollisionManager.js +1 -1
- package/dist/components/NumericScale.js +1 -1
- package/dist/components/Order.js +1 -1
- package/dist/components/SVGStyle.js +1 -0
- package/dist/components/TableAttribute.js +1 -0
- package/dist/components/VarianceMeasure.js +1 -1
- package/dist/components/XYChartDataRow.js +1 -1
- package/dist/components/bn-asset.js +1 -1
- package/dist/components/bn-body2.js +1 -1
- package/dist/components/bn-card2.js +1 -1
- package/dist/components/bn-chart-bubble.js +1 -1
- package/dist/components/bn-chart-bullet.js +1 -1
- package/dist/components/bn-chart-scatter.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-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.js +1 -1
- package/dist/components/bn-scaling-group.js +1 -1
- 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/checkXYOverflow.js +1 -0
- package/dist/components/context-protocol.js +1 -1
- package/dist/components/editor-companion.js +1 -1
- package/dist/components/emptyState.js +1 -0
- package/dist/components/formatter.js +1 -1
- package/dist/components/ibcs-chart-bubble2.js +1 -1
- package/dist/components/ibcs-chart-bullet2.js +1 -1
- package/dist/components/ibcs-chart-scatter2.js +1 -1
- package/dist/components/ibcs-chart-structure2.js +1 -1
- package/dist/components/ibcs-chart-time2.js +1 -1
- package/dist/components/ibcs-table2.js +1 -1
- package/dist/components/ibcs-title2.js +1 -1
- package/dist/components/layoutTemplate.js +1 -0
- package/dist/components/pageFormats.js +1 -0
- package/dist/components/parentDimensions.js +1 -0
- package/dist/components/queryError.js +1 -0
- package/dist/components/relativeVariance.js +1 -0
- package/dist/components/sanitizeHtml.js +1 -1
- package/dist/components/stackColors.js +1 -1
- package/dist/components/stackLayout.js +1 -0
- package/dist/components/svg.esm.js +1 -0
- package/dist/components/validate.js +1 -1
- package/dist/components/withBodyObserver.js +1 -1
- package/dist/components/withComponentStatus.js +1 -0
- package/dist/components/withComponentStyle.js +1 -1
- package/dist/components/withDataset.js +1 -1
- package/dist/components/withHasError.js +1 -1
- package/dist/components/withRuleSet.js +1 -1
- package/dist/components/withScalingGroup.js +1 -1
- package/dist/components/withStyled.js +1 -1
- package/dist/components/withTranslation.js +1 -1
- package/dist/esm/{bn-asset_21.entry.js → bn-asset_28.entry.js} +20948 -6125
- package/dist/esm/bn-grid.entry.js +4 -6
- package/dist/esm/bn-image.entry.js +3 -5
- package/dist/esm/bn-internationalization.entry.js +17 -6
- package/dist/esm/bn-ruleset.entry.js +5 -5
- package/dist/esm/bn-template-engine.js +1 -1
- package/dist/esm/bn-template.entry.js +2 -2
- package/dist/esm/bn-text.entry.js +111 -39
- package/dist/esm/{context-protocol-B-vdGKeG.js → context-protocol-CdTp19uA.js} +106 -22
- package/dist/esm/{diagnostics-CiquIw8B.js → diagnostics-vw6TKMiT.js} +1 -1
- package/dist/esm/editor-companion.entry.js +2 -2
- package/dist/esm/loader.js +1 -1
- package/dist/esm/queryError-ClruFZD_.js +13 -0
- package/dist/esm/{scaling-Dggyeqts.js → sanitizeHtml-C5bFtARM.js} +464 -287
- package/dist/esm/{withBodyObserver-Cb9ZC5_J.js → withBodyObserver-DD_-r04o.js} +1 -1
- package/dist/esm/withHasError-73WV2SP5.js +422 -0
- package/dist/esm/{withStyled-DoNsbwS3.js → withStyled-BDEyKd_H.js} +513 -27
- package/dist/types/components/bn-chart-bubble/bn-chart-bubble.d.ts +8 -4
- package/dist/types/components/bn-chart-bubble/ibcs-chart-bubble.d.ts +2 -1
- package/dist/types/components/bn-chart-bubble/utils/BubbleChart.d.ts +14 -2
- package/dist/types/components/bn-chart-bullet/bn-chart-bullet.d.ts +12 -11
- package/dist/types/components/bn-chart-bullet/ibcs-chart-bullet.d.ts +2 -1
- package/dist/types/components/bn-chart-bullet/utils/BulletChart.d.ts +8 -5
- package/dist/types/components/bn-chart-bullet/utils/model/BulletChartStyle.d.ts +2 -0
- package/dist/types/components/bn-chart-bullet/utils/model/BulletConfig.d.ts +1 -1
- package/dist/types/components/bn-chart-scatter/bn-chart-scatter.d.ts +8 -4
- package/dist/types/components/bn-chart-scatter/ibcs-chart-scatter.d.ts +2 -1
- package/dist/types/components/bn-chart-scatter/utils/ScatterChart.d.ts +11 -1
- package/dist/types/components/bn-chart-structure/bn-chart-structure.d.ts +13 -12
- package/dist/types/components/bn-chart-structure/ibcs-chart-structure.d.ts +8 -1
- package/dist/types/components/bn-chart-structure/utils/StructureChart.d.ts +29 -6
- package/dist/types/components/bn-chart-structure/utils/elements/StackedBar.d.ts +4 -3
- package/dist/types/components/bn-chart-structure/utils/model/DataPoint.d.ts +3 -2
- package/dist/types/components/bn-chart-structure/utils/model/StructureChartComponentConfig.d.ts +2 -1
- package/dist/types/components/bn-chart-structure/utils/model/styles/StructureChartStyle.d.ts +2 -0
- package/dist/types/components/bn-chart-time/bn-chart-time.d.ts +19 -15
- package/dist/types/components/bn-chart-time/ibcs-chart-time.d.ts +8 -1
- package/dist/types/components/bn-chart-time/utils/TimeChart.d.ts +63 -5
- package/dist/types/components/bn-chart-time/utils/elements/AreaFill.d.ts +1 -1
- package/dist/types/components/bn-chart-time/utils/elements/StackedColumn.d.ts +9 -8
- package/dist/types/components/bn-chart-time/utils/model/DataPoint.d.ts +3 -2
- package/dist/types/components/bn-chart-time/utils/model/TimeChartComponentConfig.d.ts +3 -2
- package/dist/types/components/bn-chart-time/utils/model/styles/TimeChartStyle.d.ts +2 -0
- package/dist/types/components/bn-context/bn-context.d.ts +15 -3
- package/dist/types/components/bn-dataset/bn-dataset.d.ts +41 -20
- package/dist/types/components/bn-datasource/bn-datasource.d.ts +34 -18
- package/dist/types/components/bn-footer/bn-footer.d.ts +2 -2
- package/dist/types/components/bn-layout-card/bn-layout-card.d.ts +3 -10
- package/dist/types/components/bn-layout-page/bn-layout-page.d.ts +13 -6
- package/dist/types/components/bn-message/bn-message.d.ts +2 -1
- package/dist/types/components/bn-page/bn-page.d.ts +2 -1
- package/dist/types/components/bn-page/pageFormats.d.ts +40 -0
- package/dist/types/components/bn-scaling-group/bn-scaling-group.d.ts +2 -2
- package/dist/types/components/bn-table/bn-table.d.ts +11 -10
- package/dist/types/components/bn-table/ibcs-table.d.ts +8 -5
- package/dist/types/components/bn-table/utils/Table.d.ts +3 -1
- package/dist/types/components/bn-table/utils/elements/Cell.d.ts +2 -2
- package/dist/types/components/bn-table/utils/elements/CellBarChart.d.ts +6 -4
- package/dist/types/components/bn-table/utils/elements/WaterfallBar.d.ts +1 -1
- package/dist/types/components/bn-table/utils/factories/tableDataSetFactory.d.ts +2 -0
- package/dist/types/components/bn-table/utils/helper/DataQuery.d.ts +14 -5
- package/dist/types/components/bn-table/utils/helper/IntervalColumns.d.ts +2 -2
- package/dist/types/components/bn-table/utils/helper/QueryGroup.d.ts +6 -1
- package/dist/types/components/bn-table/utils/helper/barColumnGeometry.d.ts +2 -2
- package/dist/types/components/bn-table/utils/model/TableAttribute.d.ts +2 -0
- package/dist/types/components/bn-table/utils/model/TableComponentConfig.d.ts +2 -1
- package/dist/types/components/bn-text/bn-text.d.ts +20 -13
- package/dist/types/components/bn-text/utils/template.d.ts +10 -0
- package/dist/types/components/bn-title/ibcs-title/ibcs-title.d.ts +1 -0
- package/dist/types/components/bn-tree/bn-tree.d.ts +8 -1
- package/dist/types/components/bn-tree/utils/EdgeRenderer.d.ts +18 -5
- package/dist/types/components/bn-tree/utils/TreeLayout.d.ts +5 -0
- package/dist/types/components.d.ts +226 -184
- package/dist/types/context/scopedDb.d.ts +20 -0
- package/dist/types/stores/componentStyles.d.ts +6 -0
- package/dist/types/utils/DateStringFactory.d.ts +3 -2
- package/dist/types/utils/autoFit.d.ts +2 -2
- package/dist/types/utils/componentRegister.d.ts +21 -5
- package/dist/types/utils/constants.d.ts +2 -2
- package/dist/types/utils/dataAnalyzer.d.ts +1 -1
- package/dist/types/utils/emptyState.d.ts +10 -0
- package/dist/types/utils/formatter.d.ts +7 -9
- package/dist/types/utils/layoutState/generic.d.ts +1 -1
- package/dist/types/utils/layoutState/svgChartElements.d.ts +2 -2
- package/dist/types/utils/layoutTemplate.d.ts +16 -0
- package/dist/types/utils/model/ChartStyles.d.ts +1 -1
- package/dist/types/utils/model/DataQueryResultRow.d.ts +2 -2
- package/dist/types/utils/model/Order.d.ts +1 -1
- package/dist/types/utils/model/styles/SVGStyle.d.ts +5 -1
- package/dist/types/utils/parentDimensions.d.ts +9 -0
- package/dist/types/utils/queryError.d.ts +5 -0
- package/dist/types/utils/relativeVariance.d.ts +9 -0
- package/dist/types/utils/sanitizeHtml.d.ts +2 -2
- package/dist/types/utils/scaling.d.ts +1 -1
- package/dist/types/utils/stackColors.d.ts +3 -2
- package/dist/types/utils/stackLayout.d.ts +49 -0
- package/dist/types/utils/testing/fakeGroup.d.ts +8 -0
- package/dist/types/utils/testing/mutationObserver.d.ts +5 -0
- package/dist/types/utils/testing/structureChart.d.ts +5 -0
- package/dist/types/utils/testing/timeChart.d.ts +5 -0
- package/dist/types/utils/validate.d.ts +1 -1
- package/dist/types/utils/withComponentStatus.d.ts +11 -3
- package/dist/types/utils/withInheritedProps.d.ts +42 -15
- package/dist/types/utils/withRuleSet.d.ts +2 -1
- package/dist/types/utils/withTranslation.d.ts +2 -2
- package/dist/types/utils/xy/FacetGrid.d.ts +1 -1
- package/dist/types/utils/xy/IsoCurves.d.ts +1 -1
- package/dist/types/utils/xy/NumericScale.d.ts +9 -4
- package/dist/types/utils/xy/PointLabeler.d.ts +2 -2
- package/dist/types/utils/xy/RadiusScale.d.ts +2 -2
- package/dist/types/utils/xy/SeriesPalette.d.ts +3 -3
- package/dist/types/utils/xy/VarianceMeasure.d.ts +10 -2
- package/dist/types/utils/xy/XYFrame.d.ts +4 -1
- package/dist/types/utils/xy/XYLegend.d.ts +3 -1
- package/dist/types/utils/xy/checkXYOverflow.d.ts +8 -0
- package/dist/types/utils/xy/formatXYValue.d.ts +7 -0
- package/dist/types/utils/xy/model/AxisConfig.d.ts +1 -1
- package/dist/types/utils/xy/model/XYChartStyle.d.ts +2 -0
- package/package.json +4 -2
- package/readme.md +11 -11
- package/dist/bn-template-engine/p-03304284.entry.js +0 -1
- package/dist/bn-template-engine/p-0fb02c57.entry.js +0 -1
- package/dist/bn-template-engine/p-4419db8f.entry.js +0 -1
- package/dist/bn-template-engine/p-45508f1b.entry.js +0 -1
- package/dist/bn-template-engine/p-461fdffa.entry.js +0 -1
- package/dist/bn-template-engine/p-5d7a3a77.entry.js +0 -1
- package/dist/bn-template-engine/p-62cc95b7.entry.js +0 -1
- package/dist/bn-template-engine/p-686d8e44.entry.js +0 -1
- package/dist/bn-template-engine/p-829212c3.entry.js +0 -1
- package/dist/bn-template-engine/p-B5Jd_eCX.js +0 -1
- package/dist/bn-template-engine/p-BA48JiHe.js +0 -1
- package/dist/bn-template-engine/p-BbmobTg0.js +0 -1
- package/dist/bn-template-engine/p-BcaI745G.js +0 -1
- package/dist/bn-template-engine/p-CG_Bcm6V.js +0 -1
- package/dist/bn-template-engine/p-CWWWM-XC.js +0 -1
- package/dist/bn-template-engine/p-CsJ84YRk.js +0 -1
- package/dist/bn-template-engine/p-D5e8I9Qe.js +0 -1
- package/dist/bn-template-engine/p-DVrDYxlh.js +0 -1
- package/dist/bn-template-engine/p-DjPXefnq.js +0 -1
- package/dist/bn-template-engine/p-DsTzlzxQ.js +0 -1
- package/dist/bn-template-engine/p-DtLI_CzV.js +0 -1
- package/dist/bn-template-engine/p-EtT29btN.js +0 -1
- package/dist/bn-template-engine/p-TuLpbB5O.js +0 -1
- package/dist/bn-template-engine/p-a5867a4c.entry.js +0 -1
- package/dist/bn-template-engine/p-b27009eb.entry.js +0 -1
- package/dist/bn-template-engine/p-bfa87b07.entry.js +0 -1
- package/dist/bn-template-engine/p-ceb80db3.entry.js +0 -1
- package/dist/bn-template-engine/p-fcfbb329.entry.js +0 -1
- package/dist/bn-template-engine/p-qRZrT-U3.js +0 -1
- package/dist/cjs/AxisConfig-DwiNUyYG.js +0 -233
- package/dist/cjs/LabelCollisionManager-Bv-xkeXw.js +0 -415
- package/dist/cjs/NumericScale-BAyYXpKL.js +0 -107
- package/dist/cjs/Order-2wRydarc.js +0 -87
- package/dist/cjs/SVGStyle-DoxylrEQ.js +0 -8219
- package/dist/cjs/SVGVariancesStyleGroup-CiI4GeWe.js +0 -50
- package/dist/cjs/VarianceMeasure-CQlSRzlp.js +0 -372
- package/dist/cjs/XYChartDataRow-C2FdL58s.js +0 -829
- package/dist/cjs/bn-chart-bubble.cjs.entry.js +0 -792
- package/dist/cjs/bn-chart-bullet.cjs.entry.js +0 -805
- package/dist/cjs/bn-chart-scatter.cjs.entry.js +0 -678
- package/dist/cjs/bn-tree.cjs.entry.js +0 -1042
- package/dist/cjs/ibcs-chart-bubble.cjs.entry.js +0 -624
- package/dist/cjs/ibcs-chart-bullet.cjs.entry.js +0 -673
- package/dist/cjs/ibcs-chart-scatter.cjs.entry.js +0 -667
- package/dist/cjs/sanitizeHtml-LuZr1IMd.js +0 -85
- package/dist/cjs/svgChartElements-tDA43aYj.js +0 -400
- package/dist/cjs/withHasError-BdDmiOXM.js +0 -258
- package/dist/cjs/withScalingGroup-CFIc5-6s.js +0 -73
- package/dist/components/autoFit.js +0 -1
- package/dist/components/main.js +0 -1
- package/dist/components/utils.js +0 -1
- package/dist/esm/AxisConfig-KqzWQbML.js +0 -224
- package/dist/esm/LabelCollisionManager-585bQMtP.js +0 -407
- package/dist/esm/NumericScale-DsTzlzxQ.js +0 -105
- package/dist/esm/Order-DZVWjEL_.js +0 -83
- package/dist/esm/SVGStyle-OrPkzjcb.js +0 -8209
- package/dist/esm/SVGVariancesStyleGroup-DO5QJfRQ.js +0 -48
- package/dist/esm/VarianceMeasure-DDjChp8C.js +0 -364
- package/dist/esm/XYChartDataRow-Dn83Tqh9.js +0 -820
- package/dist/esm/bn-chart-bubble.entry.js +0 -790
- package/dist/esm/bn-chart-bullet.entry.js +0 -803
- package/dist/esm/bn-chart-scatter.entry.js +0 -676
- package/dist/esm/bn-tree.entry.js +0 -1040
- package/dist/esm/ibcs-chart-bubble.entry.js +0 -622
- package/dist/esm/ibcs-chart-bullet.entry.js +0 -671
- package/dist/esm/ibcs-chart-scatter.entry.js +0 -665
- package/dist/esm/sanitizeHtml-BA48JiHe.js +0 -83
- package/dist/esm/svgChartElements-B3YClivG.js +0 -395
- package/dist/esm/withHasError-Bh1Viz52.js +0 -254
- package/dist/esm/withScalingGroup-DNBSqRC0.js +0 -71
|
@@ -1,7 +1,10 @@
|
|
|
1
1
|
import { OrderDirection, TableType } from "../model";
|
|
2
|
-
import { QueryGroups } from "./QueryGroup";
|
|
3
|
-
import { coerceBucketKey, INTERVAL_NONE, intervalBucketSQL } from "./IntervalColumns";
|
|
2
|
+
import { BLANK_SAFE_ROWGROUP, QueryGroups } from "./QueryGroup";
|
|
3
|
+
import { BLANK_BUCKET_LABEL, coerceBucketKey, INTERVAL_NONE, intervalBucketSQL } from "./IntervalColumns";
|
|
4
|
+
import { FIELD_IDENTIFIER_REGEX } from "../model/TableAttribute";
|
|
5
|
+
import { Scenarios } from "../../../../utils/constants";
|
|
4
6
|
import { QueryColumnNames, VarianceScenario } from "../../../../utils/model";
|
|
7
|
+
import { NOT_AVAILABLE, relativeVariance } from "../../../../utils/relativeVariance";
|
|
5
8
|
/**
|
|
6
9
|
* AlaSQL-based query builder that produces the complete table result set for bn-table.
|
|
7
10
|
*
|
|
@@ -13,6 +16,10 @@ import { QueryColumnNames, VarianceScenario } from "../../../../utils/model";
|
|
|
13
16
|
export class DataQuery {
|
|
14
17
|
constructor(config, i18n) {
|
|
15
18
|
this.hasPartOf = false;
|
|
19
|
+
/** Values bound as AlaSQL parameters ($0, $1, ...): row values and free-text config never become SQL text. */
|
|
20
|
+
this.params = [];
|
|
21
|
+
/** Set by execute: the grouped table has rows with a blank rowGroup (null, '' or missing). */
|
|
22
|
+
this.hasBlankRowGroup = false;
|
|
16
23
|
this.config = config;
|
|
17
24
|
this.i18n = i18n;
|
|
18
25
|
}
|
|
@@ -38,6 +45,12 @@ export class DataQuery {
|
|
|
38
45
|
var _a;
|
|
39
46
|
this.db = db;
|
|
40
47
|
this.fromExpr = fromExpr;
|
|
48
|
+
// these names are written into the SQL text as column names
|
|
49
|
+
for (const name of [...this.config.scenarios, ...this.config.categoryThereOf.keys()]) {
|
|
50
|
+
if (!FIELD_IDENTIFIER_REGEX.test(name)) {
|
|
51
|
+
throw new Error(`invalid identifier "${name}"`);
|
|
52
|
+
}
|
|
53
|
+
}
|
|
41
54
|
const queries = [];
|
|
42
55
|
const sumGroupQueries = [];
|
|
43
56
|
const res = [];
|
|
@@ -50,7 +63,6 @@ export class DataQuery {
|
|
|
50
63
|
const relativeScenarios = this.getRelativeScenarios();
|
|
51
64
|
const attributesSQL = this.config.attributes.map((attribute) => this.translateAttributeSQL(attribute)).toString();
|
|
52
65
|
const groups = new QueryGroups(this.config);
|
|
53
|
-
const groupsAggregated = this.config.grouped ? [QueryColumnNames.ROWGROUP, QueryColumnNames.ROWGROUPINDEX] : [];
|
|
54
66
|
let order = ["", ""];
|
|
55
67
|
if (this.config.sortOrder.hierarchy.length > 0) {
|
|
56
68
|
order = this.createOrderString(this.config.sortOrder);
|
|
@@ -58,27 +70,34 @@ export class DataQuery {
|
|
|
58
70
|
this.hasPartOf = this.checkConfigForPartOf();
|
|
59
71
|
// meta defines groups and the number detail rows in each group
|
|
60
72
|
// Bsp: 0: Object { totalrowcnt: 7, rowgroup: "Umsatz" }
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
73
|
+
// groups follow the order entries that exist per group (rowGroup, rowGroupIndex, scenario sum), else rowGroupIndex
|
|
74
|
+
const { hierarchy, direction } = this.config.sortOrder;
|
|
75
|
+
const groupOrderColumns = hierarchy.filter((column) => column === QueryColumnNames.ROWGROUP ||
|
|
76
|
+
column === QueryColumnNames.ROWGROUPINDEX ||
|
|
77
|
+
column.toUpperCase() in Scenarios);
|
|
78
|
+
const groupSums = groupOrderColumns
|
|
79
|
+
.filter((column) => column.toUpperCase() in Scenarios)
|
|
80
|
+
.map((column) => `, SUM(${column} * transformOperator(operation)) as ${column}`)
|
|
81
|
+
.join("");
|
|
82
|
+
const groupOrder = groupOrderColumns.length > 0
|
|
83
|
+
? groupOrderColumns.map((column) => `${column} ${direction}`).toString()
|
|
84
|
+
: `${QueryColumnNames.ROWGROUPINDEX} asc`;
|
|
85
|
+
const meta = db.exec(`SELECT COUNT(DISTINCT ${QueryColumnNames.CATEGORY}) as ${QueryColumnNames.TOTALROWCOUNT} ${this.config.grouped ? `, ${BLANK_SAFE_ROWGROUP} as ${QueryColumnNames.ROWGROUP}, FIRST(${QueryColumnNames.ROWGROUPINDEX}) as ${QueryColumnNames.ROWGROUPINDEX}${groupSums}` : ""}
|
|
86
|
+
FROM ${fromExpr} ${this.config.grouped ? `GROUP BY ${BLANK_SAFE_ROWGROUP} ORDER BY ${groupOrder}` : ""}`);
|
|
71
87
|
if (meta.length === 0 ||
|
|
72
|
-
(meta.length === 1 && ((_a = meta[0][QueryColumnNames.TOTALROWCOUNT]) !== null && _a !== void 0 ? _a : 0) === 0 &&
|
|
88
|
+
(meta.length === 1 && ((_a = meta[0][QueryColumnNames.TOTALROWCOUNT]) !== null && _a !== void 0 ? _a : 0) === 0 && !this.config.grouped)) {
|
|
73
89
|
return [];
|
|
74
90
|
}
|
|
91
|
+
this.hasBlankRowGroup = this.config.grouped && meta.some((row) => row.rowGroup === "");
|
|
75
92
|
// Creates DataSelection for LIST
|
|
76
93
|
meta.forEach((rowGroupEntry) => {
|
|
77
94
|
// the following variables are 'helper sections' which are used to constuct dynamicly the sql statement depending of the given config
|
|
78
95
|
// is grouping active?
|
|
79
|
-
const queryWhereSection =
|
|
80
|
-
?
|
|
81
|
-
:
|
|
96
|
+
const queryWhereSection = !this.config.grouped
|
|
97
|
+
? ``
|
|
98
|
+
: rowGroupEntry.rowGroup === ""
|
|
99
|
+
? `WHERE (${QueryColumnNames.ROWGROUP} IS NULL OR ${QueryColumnNames.ROWGROUP} = '')`
|
|
100
|
+
: `WHERE ${QueryColumnNames.ROWGROUP} = ${this.bind(rowGroupEntry.rowGroup)}`;
|
|
82
101
|
// is limit active?
|
|
83
102
|
let queryLimitSection = "";
|
|
84
103
|
if (this.config.limit) {
|
|
@@ -87,18 +106,11 @@ export class DataQuery {
|
|
|
87
106
|
this.createGroupHeaderRow(rowGroupEntry, queries);
|
|
88
107
|
this.createDataRow(queries, rowGroupEntry, groups, scenarios, attributesSQL, queryWhereSection, order, queryLimitSection);
|
|
89
108
|
this.createRestRow(rowGroupEntry, queries, groups, scenarios, queryWhereSection, order);
|
|
90
|
-
this.createGroupSumRow(queries, sumGroupQueries, rowGroupEntry, scenariosSUMQuery, order);
|
|
109
|
+
this.createGroupSumRow(queries, sumGroupQueries, rowGroupEntry, scenariosSUMQuery, queryWhereSection, order);
|
|
91
110
|
});
|
|
92
111
|
this.createTotalSumRow(queries, sumGroupQueries, scenariosSUMQuery);
|
|
93
112
|
// executes main queries
|
|
94
|
-
queries.forEach((query) =>
|
|
95
|
-
try {
|
|
96
|
-
res.push(db.exec(query));
|
|
97
|
-
}
|
|
98
|
-
catch (err) {
|
|
99
|
-
console.error("DataQuery: SQL query execution failed", query, err);
|
|
100
|
-
}
|
|
101
|
-
});
|
|
113
|
+
queries.forEach((query) => res.push(this.exec(query)));
|
|
102
114
|
this.detectNaNCells(this.config.scenarios, res);
|
|
103
115
|
this.createThereOfDrillRows(scenarios, attributesSQL, order, res);
|
|
104
116
|
this.createPartOfDrillRows(scenarios, order, sumGroupQueries, res);
|
|
@@ -149,13 +161,14 @@ export class DataQuery {
|
|
|
149
161
|
const drillQueries = this.createPartOfQuery(scenarios, order);
|
|
150
162
|
let resDrill = []; // set of drill (subquery result injected into resultset)
|
|
151
163
|
const db = this.db;
|
|
152
|
-
|
|
153
|
-
|
|
164
|
+
const params = this.params;
|
|
165
|
+
drillQueries.forEach((query) => {
|
|
166
|
+
resDrill.push(...this.exec(query));
|
|
154
167
|
});
|
|
155
168
|
const scenarioNames = this.exctractScenarioNames(scenarios);
|
|
156
169
|
const rowGroupSumResultRows = [];
|
|
157
170
|
sumGroupQueries.forEach(function (query) {
|
|
158
|
-
rowGroupSumResultRows.push(...db.exec(query));
|
|
171
|
+
rowGroupSumResultRows.push(...db.exec(query, params));
|
|
159
172
|
});
|
|
160
173
|
const rowGroupSumResultMap = new Map();
|
|
161
174
|
rowGroupSumResultRows.forEach((row) => rowGroupSumResultMap.set(row[QueryColumnNames.ROWGROUP], row));
|
|
@@ -187,7 +200,7 @@ export class DataQuery {
|
|
|
187
200
|
.map((name) => `SUM(${name}) as ${name}`)
|
|
188
201
|
.join(", ");
|
|
189
202
|
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},
|
|
203
|
+
` (SELECT ROWNUM() AS ${QueryColumnNames.ROWNR}, ${querys.length} as ${QueryColumnNames.ROWGROUPINDEX} , 'ENTRY' as ${QueryColumnNames.TYPE}, ${this.bind(String(rowGroupEntry.rowGroup || "NO_GROUP"))} as ${QueryColumnNames.ROWGROUP}, ${groups.select()} ${scenarios.length > 0 ? ",".concat(scenarios) : ""} FROM ${this.fromExpr} ${queryWhereSection} GROUP BY ${groups} ORDER BY ${order[0]})` +
|
|
191
204
|
` t WHERE t.rowNr > ${this.config.limit}`);
|
|
192
205
|
}
|
|
193
206
|
}
|
|
@@ -197,9 +210,9 @@ export class DataQuery {
|
|
|
197
210
|
querys.push(`SELECT ROWNUM() AS ${QueryColumnNames.ROWNR},
|
|
198
211
|
${querys.length} as ${QueryColumnNames.ROWGROUPINDEX},
|
|
199
212
|
'ENTRY' as ${QueryColumnNames.TYPE},
|
|
200
|
-
|
|
213
|
+
${this.bind(String(rowGroupEntry.rowGroup || "NO_GROUP"))} as ${QueryColumnNames.ROWGROUP},
|
|
201
214
|
'${QueryColumnNames.CATEGORYINDEX}',
|
|
202
|
-
${groups}
|
|
215
|
+
${groups.select()} ${scenarios.length > 0 ? ",".concat(scenarios) : ""} ${attributes.length > 0 ? ",".concat(attributes) : ""}
|
|
203
216
|
FROM ${this.fromExpr} ${queryWhereSection}
|
|
204
217
|
GROUP BY ${groups}
|
|
205
218
|
ORDER BY ${order[0]} ${queryLimitSection}`);
|
|
@@ -208,40 +221,39 @@ export class DataQuery {
|
|
|
208
221
|
createGroupHeaderRow(rowGroupEntry, querys) {
|
|
209
222
|
// Generates GroupHeader Row
|
|
210
223
|
if (true === this.config.grouped) {
|
|
211
|
-
const
|
|
212
|
-
|
|
213
|
-
|
|
224
|
+
const rowGroup = this.bind(String(rowGroupEntry.rowGroup));
|
|
225
|
+
const title = rowGroupEntry.rowGroup === "" ? this.bind(BLANK_BUCKET_LABEL) : rowGroup;
|
|
226
|
+
const groupTitle = this.config.showGroupTitle ? `,${title} as ${QueryColumnNames.CATEGORY}` : "";
|
|
214
227
|
querys.push(`SELECT ROWNUM() AS ${QueryColumnNames.ROWNR},
|
|
215
228
|
${querys.length} as ${QueryColumnNames.ROWGROUPINDEX},
|
|
216
229
|
'GROUPHEAD' as ${QueryColumnNames.TYPE},
|
|
217
|
-
|
|
230
|
+
${rowGroup} as ${QueryColumnNames.ROWGROUP} ${groupTitle}
|
|
218
231
|
FROM ${this.fromExpr}
|
|
219
232
|
GROUP BY '1'`);
|
|
220
233
|
}
|
|
221
234
|
}
|
|
222
235
|
/** Generates a GROUP_SUM row that aggregates all entries within a single row group. */
|
|
223
|
-
createGroupSumRow(querys, groupSumQuery, rowGroupEntry, scenariosSUMQuery, order) {
|
|
236
|
+
createGroupSumRow(querys, groupSumQuery, rowGroupEntry, scenariosSUMQuery, queryWhereSection, order) {
|
|
224
237
|
// Generates SUM Row; sumsup all rows of group
|
|
225
238
|
if (true === this.config.grouped &&
|
|
226
239
|
(TableType.SUM === this.config.type ||
|
|
227
240
|
TableType.SUMNOTOTAL === this.config.type ||
|
|
228
241
|
TableType.OPT === this.config.type ||
|
|
229
242
|
TableType.OPTNOTOTAL === this.config.type)) {
|
|
243
|
+
const rowGroup = this.bind(String(rowGroupEntry.rowGroup));
|
|
230
244
|
querys.push(`SELECT ${querys.length} as ${QueryColumnNames.ROWGROUPINDEX},
|
|
231
245
|
'=' as ${QueryColumnNames.OPERATION},
|
|
232
|
-
|
|
246
|
+
${rowGroup} as ${QueryColumnNames.ROWGROUP},
|
|
233
247
|
ROWNUM() AS ${QueryColumnNames.ROWNR},
|
|
234
248
|
'GROUP_SUM' as ${QueryColumnNames.TYPE} ${scenariosSUMQuery.length > 0 ? ",".concat(scenariosSUMQuery) : ""}
|
|
235
|
-
FROM ${this.fromExpr}
|
|
236
|
-
WHERE ${QueryColumnNames.ROWGROUP} = '${rowGroupEntry.rowGroup}'
|
|
249
|
+
FROM ${this.fromExpr} ${queryWhereSection}
|
|
237
250
|
ORDER BY ${order[0]} `);
|
|
238
251
|
groupSumQuery.push(`SELECT ${querys.length} as ${QueryColumnNames.ROWGROUPINDEX},
|
|
239
252
|
'=' as ${QueryColumnNames.OPERATION},
|
|
240
|
-
|
|
253
|
+
${rowGroup} as ${QueryColumnNames.ROWGROUP},
|
|
241
254
|
ROWNUM() AS ${QueryColumnNames.ROWNR},
|
|
242
255
|
'GROUP_SUM' as ${QueryColumnNames.TYPE} ${scenariosSUMQuery.length > 0 ? ",".concat(scenariosSUMQuery) : ""}
|
|
243
|
-
FROM ${this.fromExpr}
|
|
244
|
-
WHERE ${QueryColumnNames.ROWGROUP} = '${rowGroupEntry.rowGroup}'
|
|
256
|
+
FROM ${this.fromExpr} ${queryWhereSection}
|
|
245
257
|
ORDER BY ${order[0]} `);
|
|
246
258
|
}
|
|
247
259
|
}
|
|
@@ -254,12 +266,12 @@ export class DataQuery {
|
|
|
254
266
|
const label = ((_a = this.config.title) === null || _a === void 0 ? void 0 : _a.trim()) || "SUM_TOTAL";
|
|
255
267
|
// In an ungrouped partof table the total row is what the "in % of ❖" rows
|
|
256
268
|
// refer to, so a custom label gets the symbol prepended. The default label
|
|
257
|
-
// already IS that symbol
|
|
269
|
+
// already IS that symbol - prefixing it would yield the literal
|
|
258
270
|
// "❖ SUM_TOTAL", which no longer matches the key and stays untranslated.
|
|
259
271
|
const prefixSymbol = this.hasPartOf && this.config.grouped === false && label !== "SUM_TOTAL";
|
|
260
272
|
const title = prefixSymbol ? `${this.i18n.get("SUM_TOTAL") || "SUM_TOTAL"} ${label}` : label;
|
|
261
273
|
querys.push(`SELECT ${querys.length} as ${QueryColumnNames.ROWGROUPINDEX},
|
|
262
|
-
|
|
274
|
+
${this.bind(title)} as ${QueryColumnNames.ROWGROUP},
|
|
263
275
|
'=' as ${QueryColumnNames.OPERATION},
|
|
264
276
|
'SUM' as ${QueryColumnNames.TYPE} ${scenariosSUMQuery.length > 0 ? ",".concat(scenariosSUMQuery) : ""}
|
|
265
277
|
FROM ${this.fromExpr} `);
|
|
@@ -337,10 +349,10 @@ export class DataQuery {
|
|
|
337
349
|
else {
|
|
338
350
|
numberOfElement.set(`${drillItem.category}`, 1);
|
|
339
351
|
}
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
352
|
+
// the rowGroup only tells duplicate names under one parent apart, and a blank rowGroup tells nothing
|
|
353
|
+
if (drillItem.rowGroup != null &&
|
|
354
|
+
drillItem.rowGroup !== "" &&
|
|
355
|
+
duplicateSubCategoriesList.includes(`${drillItem.category}##${drillItem.subCategory}`)) {
|
|
344
356
|
drillItem.subCategory = `${drillItem.subCategory} (${drillItem.rowGroup})`;
|
|
345
357
|
}
|
|
346
358
|
resSegment.splice(index + drillItem[QueryColumnNames.ROWNR], 0, drillItem);
|
|
@@ -370,17 +382,17 @@ export class DataQuery {
|
|
|
370
382
|
let fromString = "1 <> 1 OR ( "; // helper for strin concat 1<>1 OR ... OR ...
|
|
371
383
|
if (!(null == element.category || 0 === element.category.length || !element.category.trim())) {
|
|
372
384
|
// if not empty
|
|
373
|
-
fromString += ` ${QueryColumnNames.CATEGORY} =
|
|
385
|
+
fromString += ` ${QueryColumnNames.CATEGORY} = ${this.bind(element.category)}`;
|
|
374
386
|
isFirst = false;
|
|
375
387
|
}
|
|
376
388
|
if (!(null == element.rowGroup || 0 === element.rowGroup.length || !element.rowGroup.trim())) {
|
|
377
389
|
// if not empty
|
|
378
|
-
fromString += ` ${isFirst ? "" : "AND"} ${QueryColumnNames.ROWGROUP} =
|
|
390
|
+
fromString += ` ${isFirst ? "" : "AND"} ${QueryColumnNames.ROWGROUP} = ${this.bind(element.rowGroup)}`;
|
|
379
391
|
isFirst = false;
|
|
380
392
|
}
|
|
381
393
|
if (!(null == element.subCategory || 0 === element.subCategory.length || !element.subCategory.trim())) {
|
|
382
394
|
// if not empty
|
|
383
|
-
fromString += ` ${isFirst ? "" : "AND"} ${QueryColumnNames.SUBCATEGORY} =
|
|
395
|
+
fromString += ` ${isFirst ? "" : "AND"} ${QueryColumnNames.SUBCATEGORY} = ${this.bind(element.subCategory)}`;
|
|
384
396
|
}
|
|
385
397
|
fromString += `)`;
|
|
386
398
|
drillQueries.push(`SELECT ROWNUM() AS ${QueryColumnNames.ROWNR},
|
|
@@ -388,29 +400,30 @@ export class DataQuery {
|
|
|
388
400
|
'DRILLELEMENT' as ${QueryColumnNames.TYPE},
|
|
389
401
|
${QueryColumnNames.CATEGORY},
|
|
390
402
|
${QueryColumnNames.SUBCATEGORY},
|
|
391
|
-
${
|
|
403
|
+
${this.drillRowGroup} as ${QueryColumnNames.ROWGROUP},
|
|
392
404
|
${scenarios} ${attributes.length > 0 ? ",".concat(attributes) : ""}
|
|
393
405
|
FROM ${this.fromExpr}
|
|
394
406
|
WHERE ${fromString}
|
|
395
|
-
GROUP BY ${
|
|
407
|
+
GROUP BY ${this.drillRowGroup}, ${QueryColumnNames.CATEGORY}, ${QueryColumnNames.SUBCATEGORY}
|
|
396
408
|
ORDER BY ${order[1]}`);
|
|
397
409
|
});
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
resDrill.push(...db.exec(query));
|
|
410
|
+
drillQueries.forEach((query) => {
|
|
411
|
+
resDrill.push(...this.exec(query));
|
|
401
412
|
});
|
|
402
413
|
this.injectDrillRowsToResultRows(resDrill, res);
|
|
403
414
|
}
|
|
404
415
|
/**
|
|
405
416
|
* Converts absolute variance columns into relative (percentage) variances by dividing
|
|
406
|
-
* each `dr_*` cell by its denominator column (the delta scenario's
|
|
417
|
+
* each `dr_*` cell by the absolute value of its denominator column (the delta scenario's
|
|
418
|
+
* aggregated value). A denominator of 0 gives NOT_AVAILABLE.
|
|
407
419
|
*/
|
|
408
420
|
calculateRelativeVariances(res, relativeScenarios) {
|
|
409
421
|
res.forEach((group) => {
|
|
410
422
|
group.forEach((row) => {
|
|
411
423
|
if (row[QueryColumnNames.TYPE] !== "GROUPHEAD") {
|
|
412
424
|
relativeScenarios.forEach((value, key) => {
|
|
413
|
-
|
|
425
|
+
var _a;
|
|
426
|
+
row[key] = (_a = relativeVariance(row[key], row[value])) !== null && _a !== void 0 ? _a : NOT_AVAILABLE;
|
|
414
427
|
});
|
|
415
428
|
}
|
|
416
429
|
});
|
|
@@ -471,7 +484,7 @@ export class DataQuery {
|
|
|
471
484
|
* bucket (`normalizeDate(date, …)` for date intervals, setname otherwise) at
|
|
472
485
|
* every row level (ENTRY, GROUP_SUM, SUM, DRILLELEMENT, PARTELEMENT) and the
|
|
473
486
|
* results are stored on the existing rows as composite keys
|
|
474
|
-
* `<scenario>##<bucketKey>`
|
|
487
|
+
* `<scenario>##<bucketKey>` - the same convention as the columnthereof drill
|
|
475
488
|
* columns (which are mutually exclusive with interval).
|
|
476
489
|
*
|
|
477
490
|
* Row selection (ORDER BY / LIMIT) stays anchored on the un-bucketed base
|
|
@@ -494,7 +507,8 @@ export class DataQuery {
|
|
|
494
507
|
const scenariosSUMQuery = this.config.scenarios
|
|
495
508
|
.map((s) => this.translateScenarioSQL(s, true, this.config.type))
|
|
496
509
|
.toString();
|
|
497
|
-
|
|
510
|
+
// two relative variances on one reference name its dr_* alias twice, it must be summed once
|
|
511
|
+
const entryAliases = [...new Set(this.exctractScenarioNames(scenarios))];
|
|
498
512
|
const relativeScenarios = this.getRelativeScenarios();
|
|
499
513
|
const groups = new QueryGroups(this.config);
|
|
500
514
|
const isOpt = TableType.OPT === this.config.type || TableType.OPTNOTOTAL === this.config.type;
|
|
@@ -504,15 +518,7 @@ export class DataQuery {
|
|
|
504
518
|
TableType.OPT === this.config.type ||
|
|
505
519
|
TableType.OPTNOTOTAL === this.config.type);
|
|
506
520
|
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
|
-
};
|
|
521
|
+
const exec = (query) => this.exec(query);
|
|
516
522
|
// mirrors detectNaNCells + calculateRelativeVariances for a single bucket row
|
|
517
523
|
const finalizeBucketRow = (row) => {
|
|
518
524
|
this.config.scenarios.forEach((scenario) => {
|
|
@@ -527,7 +533,8 @@ export class DataQuery {
|
|
|
527
533
|
}
|
|
528
534
|
});
|
|
529
535
|
relativeScenarios.forEach((value, key) => {
|
|
530
|
-
|
|
536
|
+
var _a;
|
|
537
|
+
row[key] = (_a = relativeVariance(row[key], row[value])) !== null && _a !== void 0 ? _a : NOT_AVAILABLE;
|
|
531
538
|
});
|
|
532
539
|
return row;
|
|
533
540
|
};
|
|
@@ -536,7 +543,7 @@ export class DataQuery {
|
|
|
536
543
|
target[scenario + separator + bucketKey] = source[scenario];
|
|
537
544
|
}
|
|
538
545
|
};
|
|
539
|
-
const entryRowsRaw = exec(`SELECT ${groups}, __interval ${scenarios.length > 0 ? ",".concat(scenarios) : ""}
|
|
546
|
+
const entryRowsRaw = exec(`SELECT ${groups.select()}, __interval ${scenarios.length > 0 ? ",".concat(scenarios) : ""}
|
|
540
547
|
FROM ${bucketSource}
|
|
541
548
|
GROUP BY ${groups}, __interval`);
|
|
542
549
|
// REST rows first: the math needs the raw (not yet finalized) entry aliases
|
|
@@ -601,9 +608,9 @@ export class DataQuery {
|
|
|
601
608
|
}
|
|
602
609
|
}
|
|
603
610
|
const groupTotalRowsRaw = isSumTypeGrouped || (hasPartOfActive && this.config.grouped)
|
|
604
|
-
? exec(`SELECT ${QueryColumnNames.ROWGROUP}, __interval ${scenariosSUMQuery.length > 0 ? ",".concat(scenariosSUMQuery) : ""}
|
|
611
|
+
? exec(`SELECT ${BLANK_SAFE_ROWGROUP} as ${QueryColumnNames.ROWGROUP}, __interval ${scenariosSUMQuery.length > 0 ? ",".concat(scenariosSUMQuery) : ""}
|
|
605
612
|
FROM ${bucketSource}
|
|
606
|
-
GROUP BY ${
|
|
613
|
+
GROUP BY ${BLANK_SAFE_ROWGROUP}, __interval`)
|
|
607
614
|
: [];
|
|
608
615
|
const groupTotalsByKey = new Map();
|
|
609
616
|
groupTotalRowsRaw.forEach((row) => groupTotalsByKey.set(`${row.rowGroup}${separator}${coerceBucketKey(row.__interval)}`, row));
|
|
@@ -644,17 +651,19 @@ export class DataQuery {
|
|
|
644
651
|
if (this.config.thereOf != null && this.config.thereOf.length > 0) {
|
|
645
652
|
const drillRows = [];
|
|
646
653
|
this.config.thereOf.forEach((element) => {
|
|
647
|
-
drillRows.push(...exec(`SELECT ${QueryColumnNames.ROWGROUP}, ${QueryColumnNames.CATEGORY}, ${QueryColumnNames.SUBCATEGORY}, __interval ${scenarios.length > 0 ? ",".concat(scenarios) : ""}
|
|
654
|
+
drillRows.push(...exec(`SELECT ${this.drillRowGroup} as ${QueryColumnNames.ROWGROUP}, ${QueryColumnNames.CATEGORY}, ${QueryColumnNames.SUBCATEGORY}, __interval ${scenarios.length > 0 ? ",".concat(scenarios) : ""}
|
|
648
655
|
FROM ${bucketSource}
|
|
649
656
|
WHERE ${this.createThereOfWhereClause(element)}
|
|
650
|
-
GROUP BY ${
|
|
657
|
+
GROUP BY ${this.drillRowGroup}, ${QueryColumnNames.CATEGORY}, ${QueryColumnNames.SUBCATEGORY}, __interval`));
|
|
651
658
|
});
|
|
652
659
|
for (const drillRow of drillRows) {
|
|
653
660
|
const bucketKey = coerceBucketKey(drillRow.__interval);
|
|
654
661
|
finalizeBucketRow(drillRow);
|
|
655
662
|
for (const segment of res) {
|
|
656
663
|
for (const row of segment) {
|
|
657
|
-
if (row.type !== "DRILLELEMENT" ||
|
|
664
|
+
if (row.type !== "DRILLELEMENT" ||
|
|
665
|
+
row.category !== drillRow.category ||
|
|
666
|
+
row.rowGroup !== drillRow.rowGroup) {
|
|
658
667
|
continue;
|
|
659
668
|
}
|
|
660
669
|
if (row.subCategory !== drillRow.subCategory &&
|
|
@@ -669,9 +678,9 @@ export class DataQuery {
|
|
|
669
678
|
if (hasPartOfActive) {
|
|
670
679
|
let partWhere = "1 <> 1 ";
|
|
671
680
|
(_c = this.config.partOf) === null || _c === void 0 ? void 0 : _c.forEach((element) => {
|
|
672
|
-
partWhere += `OR (${QueryColumnNames.CATEGORY} =
|
|
681
|
+
partWhere += `OR (${QueryColumnNames.CATEGORY} = ${this.bind(element.category)}`;
|
|
673
682
|
if (!(null == element.rowGroup || 0 === element.rowGroup.length || !element.rowGroup.trim())) {
|
|
674
|
-
partWhere += `and ${QueryColumnNames.ROWGROUP} =
|
|
683
|
+
partWhere += `and ${QueryColumnNames.ROWGROUP} = ${this.bind(element.rowGroup)}`;
|
|
675
684
|
}
|
|
676
685
|
partWhere += `)`;
|
|
677
686
|
});
|
|
@@ -682,7 +691,7 @@ export class DataQuery {
|
|
|
682
691
|
FROM ${bucketSource}
|
|
683
692
|
WHERE ${partWhere}
|
|
684
693
|
GROUP BY ${QueryColumnNames.ROWGROUP}, ${QueryColumnNames.CATEGORY}, __interval`);
|
|
685
|
-
// merge rows sharing (rowGroup, category, bucket)
|
|
694
|
+
// merge rows sharing (rowGroup, category, bucket) - mirrors reduceResDrillByCategoryGroups
|
|
686
695
|
const partByKey = new Map();
|
|
687
696
|
for (const partRow of partRowsRaw) {
|
|
688
697
|
const key = `${partRow.rowGroup}${separator}${partRow.category}${separator}${coerceBucketKey(partRow.__interval)}`;
|
|
@@ -720,15 +729,15 @@ export class DataQuery {
|
|
|
720
729
|
let isFirst = true;
|
|
721
730
|
let whereClause = "1 <> 1 OR ( ";
|
|
722
731
|
if (!(null == element.category || 0 === element.category.length || !element.category.trim())) {
|
|
723
|
-
whereClause += ` ${QueryColumnNames.CATEGORY} =
|
|
732
|
+
whereClause += ` ${QueryColumnNames.CATEGORY} = ${this.bind(element.category)}`;
|
|
724
733
|
isFirst = false;
|
|
725
734
|
}
|
|
726
735
|
if (!(null == element.rowGroup || 0 === element.rowGroup.length || !element.rowGroup.trim())) {
|
|
727
|
-
whereClause += ` ${isFirst ? "" : "AND"} ${QueryColumnNames.ROWGROUP} =
|
|
736
|
+
whereClause += ` ${isFirst ? "" : "AND"} ${QueryColumnNames.ROWGROUP} = ${this.bind(element.rowGroup)}`;
|
|
728
737
|
isFirst = false;
|
|
729
738
|
}
|
|
730
739
|
if (!(null == element.subCategory || 0 === element.subCategory.length || !element.subCategory.trim())) {
|
|
731
|
-
whereClause += ` ${isFirst ? "" : "AND"} ${QueryColumnNames.SUBCATEGORY} =
|
|
740
|
+
whereClause += ` ${isFirst ? "" : "AND"} ${QueryColumnNames.SUBCATEGORY} = ${this.bind(element.subCategory)}`;
|
|
732
741
|
}
|
|
733
742
|
return whereClause + `)`;
|
|
734
743
|
}
|
|
@@ -813,13 +822,29 @@ export class DataQuery {
|
|
|
813
822
|
return useOperator
|
|
814
823
|
? `SUM(${field} * transformOperator(operation)) as ${attribute.alias}`
|
|
815
824
|
: `SUM(${field}) as ${attribute.alias}`;
|
|
816
|
-
case "lit":
|
|
817
|
-
|
|
825
|
+
case "lit": {
|
|
826
|
+
// numeric when parseable, string otherwise
|
|
827
|
+
const arg = attribute.arg;
|
|
828
|
+
return `${this.bind(arg !== "" && !Number.isNaN(Number(arg)) ? Number(arg) : arg)} as ${attribute.alias}`;
|
|
829
|
+
}
|
|
818
830
|
}
|
|
819
831
|
}
|
|
820
|
-
/**
|
|
821
|
-
|
|
822
|
-
return
|
|
832
|
+
/** rowGroup of the drill queries: a grouped table merges the blank variants, an ungrouped one keeps them apart. */
|
|
833
|
+
get drillRowGroup() {
|
|
834
|
+
return this.config.grouped ? BLANK_SAFE_ROWGROUP : QueryColumnNames.ROWGROUP;
|
|
835
|
+
}
|
|
836
|
+
/** Grouped result rows carry the rowGroup as text, like the GROUPHEAD and GROUP_SUM rows: '' for null and a missing one. */
|
|
837
|
+
exec(query) {
|
|
838
|
+
const rows = this.db.exec(query, this.params);
|
|
839
|
+
if (this.config.grouped) {
|
|
840
|
+
rows.forEach((row) => (row.rowGroup = row.rowGroup == null ? "" : String(row.rowGroup)));
|
|
841
|
+
}
|
|
842
|
+
return rows;
|
|
843
|
+
}
|
|
844
|
+
/** Binds a value as an AlaSQL parameter and returns its placeholder. */
|
|
845
|
+
bind(value) {
|
|
846
|
+
// trailing space: "$4and" does not parse
|
|
847
|
+
return `$${this.params.push(value) - 1} `;
|
|
823
848
|
}
|
|
824
849
|
/**
|
|
825
850
|
* generates Tuple
|
|
@@ -828,8 +853,9 @@ export class DataQuery {
|
|
|
828
853
|
* @param orderComponent
|
|
829
854
|
*/
|
|
830
855
|
createOrderString(orderComponent) {
|
|
831
|
-
const
|
|
832
|
-
const
|
|
856
|
+
const inverse = OrderDirection.ASC === orderComponent.direction ? OrderDirection.DESC : OrderDirection.ASC;
|
|
857
|
+
const base = orderComponent.hierarchy.map((column) => `${column} ${orderComponent.direction}`).toString();
|
|
858
|
+
const inverted = orderComponent.hierarchy.map((column) => `${column} ${inverse}`).toString();
|
|
833
859
|
return [base, inverted];
|
|
834
860
|
}
|
|
835
861
|
/** Returns a key/value pair mapping a relative variance column to its denominator, or null for non-relative scenarios. */
|
|
@@ -846,13 +872,13 @@ export class DataQuery {
|
|
|
846
872
|
scenarios.split(",").forEach((item) => (item.length >= 2 ? scenarioNames.push(item.split("as")[1].trim()) : null));
|
|
847
873
|
return scenarioNames;
|
|
848
874
|
}
|
|
849
|
-
/**
|
|
875
|
+
/** Returns the `category##subCategory` keys of subCategory values that appear more than once under one parent category. */
|
|
850
876
|
findDuplicateSubCategories(resDrill) {
|
|
851
877
|
const uniq = resDrill
|
|
852
878
|
.map((element) => {
|
|
853
879
|
return {
|
|
854
880
|
count: 1,
|
|
855
|
-
subCategory: element.subCategory
|
|
881
|
+
subCategory: `${element.category}##${element.subCategory}`,
|
|
856
882
|
};
|
|
857
883
|
})
|
|
858
884
|
.reduce((a, b) => {
|
|
@@ -866,13 +892,13 @@ export class DataQuery {
|
|
|
866
892
|
var _a;
|
|
867
893
|
const drillQueries = [];
|
|
868
894
|
let fromString = "1 <> 1 "; // helper for strin concat 1<>1 OR ... OR ...
|
|
869
|
-
let groupName = ` ${QueryColumnNames.ROWGROUP}`;
|
|
895
|
+
let groupName = ` ${this.drillRowGroup} as ${QueryColumnNames.ROWGROUP}`;
|
|
870
896
|
let rowNum = "ROWNUM()";
|
|
871
897
|
(_a = this.config.partOf) === null || _a === void 0 ? void 0 : _a.forEach((element) => {
|
|
872
|
-
fromString += `OR (${QueryColumnNames.CATEGORY} =
|
|
898
|
+
fromString += `OR (${QueryColumnNames.CATEGORY} = ${this.bind(element.category)}`;
|
|
873
899
|
if (!(null == element.rowGroup || 0 === element.rowGroup.length || !element.rowGroup.trim())) {
|
|
874
900
|
// if not empty
|
|
875
|
-
fromString += `and ${QueryColumnNames.ROWGROUP} =
|
|
901
|
+
fromString += `and ${QueryColumnNames.ROWGROUP} = ${this.bind(element.rowGroup)}`;
|
|
876
902
|
}
|
|
877
903
|
if (this.config.grouped === false) {
|
|
878
904
|
groupName = ` 'SUM_TOTAL' as ${QueryColumnNames.ROWGROUP} `;
|
|
@@ -889,7 +915,7 @@ export class DataQuery {
|
|
|
889
915
|
${scenarios}
|
|
890
916
|
FROM ${this.fromExpr}
|
|
891
917
|
WHERE ${fromString}
|
|
892
|
-
GROUP BY ${
|
|
918
|
+
GROUP BY ${this.drillRowGroup}, ${QueryColumnNames.CATEGORY}, ${QueryColumnNames.TYPE}
|
|
893
919
|
ORDER BY ${order[1]}`);
|
|
894
920
|
return drillQueries;
|
|
895
921
|
}
|
|
@@ -918,7 +944,7 @@ export class DataQuery {
|
|
|
918
944
|
categoryThereOf.forEach((value, key) => {
|
|
919
945
|
let whereClause = "1 <> 1 ";
|
|
920
946
|
value.forEach((drillColumn) => {
|
|
921
|
-
whereClause += ` or columnGroup =
|
|
947
|
+
whereClause += ` or columnGroup = ${this.bind(String(drillColumn.name))} `;
|
|
922
948
|
});
|
|
923
949
|
drillQueries.push(`SELECT 'ENTRY' as rowlevel,
|
|
924
950
|
'COLUMNGROUP' as columnlevel,
|
|
@@ -1002,7 +1028,7 @@ export class DataQuery {
|
|
|
1002
1028
|
GROUP BY rowlevel, columnGroup, columnSubGroup, scenario`);
|
|
1003
1029
|
});
|
|
1004
1030
|
for (const query of drillQueries) {
|
|
1005
|
-
resDrill.push(...this.db.exec(query));
|
|
1031
|
+
resDrill.push(...this.db.exec(query, this.params));
|
|
1006
1032
|
}
|
|
1007
1033
|
this.injectDrillColumnsToResultRows(resDrill, res);
|
|
1008
1034
|
}
|
|
@@ -1028,6 +1054,10 @@ export class DataQuery {
|
|
|
1028
1054
|
}
|
|
1029
1055
|
}
|
|
1030
1056
|
else if ("DRILLELEMENT" === drillElement.rowlevel) {
|
|
1057
|
+
// ungrouped thereof rows keep their rowGroup, the same name can exist in another one
|
|
1058
|
+
if (!this.config.grouped && row.rowGroup !== drillElement.rowGroup) {
|
|
1059
|
+
continue;
|
|
1060
|
+
}
|
|
1031
1061
|
if (drillElement.columnlevel === "COLUMNGROUP" &&
|
|
1032
1062
|
row.category === drillElement.category &&
|
|
1033
1063
|
row.subCategory === drillElement.subCategory) {
|
|
@@ -5,7 +5,7 @@ export const INTERVAL_NONE = "none";
|
|
|
5
5
|
/** `interval` value grouping by the dataset's `setname` column. */
|
|
6
6
|
export const INTERVAL_SETNAME = "setname";
|
|
7
7
|
/** Label rendered for the bucket collecting rows with a blank setname. */
|
|
8
|
-
export const BLANK_BUCKET_LABEL = "
|
|
8
|
+
export const BLANK_BUCKET_LABEL = "-";
|
|
9
9
|
/** True for all date-based interval values (everything except none/setname). */
|
|
10
10
|
export function isDateInterval(interval) {
|
|
11
11
|
return interval !== INTERVAL_NONE && interval !== INTERVAL_SETNAME;
|
|
@@ -47,14 +47,7 @@ export function resolveIntervalGranularity(db, fromExpr, interval) {
|
|
|
47
47
|
if (interval !== DateDistance.AUTO) {
|
|
48
48
|
return interval;
|
|
49
49
|
}
|
|
50
|
-
|
|
51
|
-
try {
|
|
52
|
-
rows = db.exec(`SELECT [date] as d FROM ${fromExpr}`);
|
|
53
|
-
}
|
|
54
|
-
catch (e) {
|
|
55
|
-
console.error("IntervalColumns: date query failed", e);
|
|
56
|
-
return DateDistance.DAY;
|
|
57
|
-
}
|
|
50
|
+
const rows = db.exec(`SELECT [date] as d FROM ${fromExpr}`);
|
|
58
51
|
let min;
|
|
59
52
|
let max;
|
|
60
53
|
for (const row of rows) {
|
|
@@ -74,17 +67,10 @@ export function resolveIntervalGranularity(db, fromExpr, interval) {
|
|
|
74
67
|
* Queries the distinct interval buckets of the source data.
|
|
75
68
|
* Date buckets are sorted chronologically ascending and labeled locale-aware;
|
|
76
69
|
* setname buckets keep their order of first appearance in the data, blank
|
|
77
|
-
* setnames are collected in a trailing-position "
|
|
70
|
+
* setnames are collected in a trailing-position "-" bucket where they occur.
|
|
78
71
|
*/
|
|
79
72
|
export function queryIntervalBuckets(db, fromExpr, interval, locale) {
|
|
80
|
-
|
|
81
|
-
try {
|
|
82
|
-
rows = db.exec(`SELECT ${intervalBucketSQL(interval)} as __interval FROM ${fromExpr}`);
|
|
83
|
-
}
|
|
84
|
-
catch (e) {
|
|
85
|
-
console.error("IntervalColumns: bucket query failed", e);
|
|
86
|
-
return [];
|
|
87
|
-
}
|
|
73
|
+
const rows = db.exec(`SELECT ${intervalBucketSQL(interval)} as __interval FROM ${fromExpr}`);
|
|
88
74
|
if (interval === INTERVAL_SETNAME) {
|
|
89
75
|
const seen = new Set();
|
|
90
76
|
const buckets = [];
|
|
@@ -125,11 +111,11 @@ function toDateTime(value) {
|
|
|
125
111
|
return undefined;
|
|
126
112
|
}
|
|
127
113
|
if (typeof value === "string") {
|
|
128
|
-
const dt = DateTime.fromISO(value);
|
|
114
|
+
const dt = DateTime.fromISO(value, { zone: "utc" });
|
|
129
115
|
return dt.isValid ? dt : undefined;
|
|
130
116
|
}
|
|
131
117
|
if (typeof value === "number") {
|
|
132
|
-
const dt = DateTime.fromMillis(value);
|
|
118
|
+
const dt = DateTime.fromMillis(value, { zone: "utc" });
|
|
133
119
|
return dt.isValid ? dt : undefined;
|
|
134
120
|
}
|
|
135
121
|
if (typeof value.isValid === "boolean") {
|
|
@@ -1,11 +1,13 @@
|
|
|
1
1
|
import { TableType } from "../model";
|
|
2
2
|
import { QueryColumnNames } from "../../../../utils/model";
|
|
3
|
+
/** '', null and a missing rowGroup are one group. */
|
|
4
|
+
export const BLANK_SAFE_ROWGROUP = `IFNULL(${QueryColumnNames.ROWGROUP}, '')`;
|
|
3
5
|
/**
|
|
4
6
|
* Manages the GROUP BY column list for DataQuery's SQL statements.
|
|
5
7
|
*
|
|
6
8
|
* The `transformOperator` AlaSQL UDF (which maps `"+"`/`"-"` to +1/-1 for
|
|
7
9
|
* sign-aware SUMs) is registered globally by `scopedDb.ts` when the shared
|
|
8
|
-
* database is created
|
|
10
|
+
* database is created - no per-component registration is needed here.
|
|
9
11
|
*
|
|
10
12
|
* The GROUP BY columns are composed dynamically: always category + categoryIndex,
|
|
11
13
|
* plus operation for OPT types, plus rowGroup/rowGroupIndex when grouping is active.
|
|
@@ -21,8 +23,13 @@ export class QueryGroups {
|
|
|
21
23
|
this.groups.push(QueryColumnNames.ROWGROUPINDEX);
|
|
22
24
|
}
|
|
23
25
|
}
|
|
26
|
+
/** GROUP BY list. */
|
|
24
27
|
toString() {
|
|
25
|
-
return this.groups.map((s) =>
|
|
28
|
+
return this.groups.map((s) => (s === QueryColumnNames.ROWGROUP ? BLANK_SAFE_ROWGROUP : s)).toString();
|
|
29
|
+
}
|
|
30
|
+
/** SELECT list for the GROUP BY columns. */
|
|
31
|
+
select() {
|
|
32
|
+
return this.groups.map((s) => (s === QueryColumnNames.ROWGROUP ? `${BLANK_SAFE_ROWGROUP} as ${s}` : s)).toString();
|
|
26
33
|
}
|
|
27
34
|
noCategory() {
|
|
28
35
|
return this.groups.filter((element) => element !== QueryColumnNames.CATEGORY);
|