@bino-bi/bn-template-engine 1.0.0-alpha.9 → 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 +4 -2
- 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 +125 -42
- 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 +160 -43
- 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/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 +4 -2
- 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-3141c4a2.entry.js +0 -1
- package/dist/bn-template-engine/p-67538176.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-c86395b8.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 -23547
- 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 -23526
- 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
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Area-true bubble sizing: bubble **area** is proportional to the data
|
|
3
|
+
* value (IBCS), so radius grows with the square root.
|
|
4
|
+
*
|
|
5
|
+
* Two modes:
|
|
6
|
+
* - **Local** (default): radii are normalized to the chart's own maximum
|
|
7
|
+
* value — `r = rMax · √(v / vMax)` with a minimum visible radius.
|
|
8
|
+
* `vMax` must be the max across all panels and both scenario sets of the
|
|
9
|
+
* chart instance (shared size scale, mandatory for comparability).
|
|
10
|
+
* - **Grouped** (`bn-scaling-group`): the group value is interpreted as
|
|
11
|
+
* **area px² per data unit** — `r = √(area · v / π)` with no
|
|
12
|
+
* normalization and no radius caps, so identical values render at
|
|
13
|
+
* identical sizes across every chart referencing the group.
|
|
14
|
+
*/
|
|
15
|
+
export class RadiusScale {
|
|
16
|
+
constructor(mode, vMax, rMaxPx, rMinPx, areaPerUnitPx2) {
|
|
17
|
+
this.mode = mode;
|
|
18
|
+
this.vMax = vMax;
|
|
19
|
+
this.rMaxPx = rMaxPx;
|
|
20
|
+
this.rMinPx = rMinPx;
|
|
21
|
+
this.areaPerUnitPx2 = areaPerUnitPx2;
|
|
22
|
+
}
|
|
23
|
+
static local(vMax, rMaxPx, rMinPx) {
|
|
24
|
+
return new RadiusScale("local", vMax, rMaxPx, rMinPx, 0);
|
|
25
|
+
}
|
|
26
|
+
static grouped(areaPerUnitPx2) {
|
|
27
|
+
return new RadiusScale("grouped", 0, 0, 0, areaPerUnitPx2);
|
|
28
|
+
}
|
|
29
|
+
/** Radius in pixels for a size value (values must be >= 0). */
|
|
30
|
+
radius(value) {
|
|
31
|
+
if (this.mode === "grouped") {
|
|
32
|
+
if (value <= 0) {
|
|
33
|
+
return 0;
|
|
34
|
+
}
|
|
35
|
+
return Math.sqrt((this.areaPerUnitPx2 * value) / Math.PI);
|
|
36
|
+
}
|
|
37
|
+
if (this.vMax <= 0 || value <= 0) {
|
|
38
|
+
return this.rMinPx;
|
|
39
|
+
}
|
|
40
|
+
return Math.max(this.rMinPx, this.rMaxPx * Math.sqrt(value / this.vMax));
|
|
41
|
+
}
|
|
42
|
+
}
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Series color palette and IBCS mark treatments for the XY charts
|
|
3
|
+
* (bn-chart-scatter, bn-chart-bubble).
|
|
4
|
+
*
|
|
5
|
+
* XY charts compose two orthogonal encodings: the **series hue** (which
|
|
6
|
+
* product line / group a point belongs to) and the **scenario treatment**
|
|
7
|
+
* (solid / tinted / hatched / outlined, selected through the rule-set
|
|
8
|
+
* `colorIndex`). Tints and shades are computed colors, never opacity —
|
|
9
|
+
* opacity creates blend artifacts where marks overlap.
|
|
10
|
+
*/
|
|
11
|
+
/**
|
|
12
|
+
* Default series palette, assigned by series `*Index` order. The first
|
|
13
|
+
* series uses the near-black IBCS base color.
|
|
14
|
+
*/
|
|
15
|
+
export const XY_SERIES_PALETTE = ["#404040", "#F2C14E", "#F07D00", "#4E8FE0", "#7FD6C2", "#D97C7C"];
|
|
16
|
+
/**
|
|
17
|
+
* Mixes two hex colors per channel in sRGB space.
|
|
18
|
+
*
|
|
19
|
+
* @param hexA - Base color, `#rrggbb`
|
|
20
|
+
* @param hexB - Mix-in color, `#rrggbb`
|
|
21
|
+
* @param ratioOfB - Portion of `hexB` in the result, 0..1
|
|
22
|
+
*/
|
|
23
|
+
export function mixHex(hexA, hexB, ratioOfB) {
|
|
24
|
+
const channel = (offset) => {
|
|
25
|
+
const a = parseInt(hexA.slice(offset, offset + 2), 16);
|
|
26
|
+
const b = parseInt(hexB.slice(offset, offset + 2), 16);
|
|
27
|
+
const mixed = Math.round(a + (b - a) * ratioOfB);
|
|
28
|
+
return mixed.toString(16).padStart(2, "0");
|
|
29
|
+
};
|
|
30
|
+
return `#${channel(1)}${channel(3)}${channel(5)}`;
|
|
31
|
+
}
|
|
32
|
+
/** Light variant of a series hue (60% white) — the PP/PY treatment. */
|
|
33
|
+
export function tint(hex) {
|
|
34
|
+
return mixHex(hex, "#ffffff", 0.6);
|
|
35
|
+
}
|
|
36
|
+
/** Dark variant of a series hue (25% black) — used for pie-share slices. */
|
|
37
|
+
export function shade(hex) {
|
|
38
|
+
return mixHex(hex, "#000000", 0.25);
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* Resolves the color for a series by its order index. Indices beyond the
|
|
42
|
+
* palette cycle through it with a tint step per cycle; `overflowed` signals
|
|
43
|
+
* that the chart should raise the `xy-series-overflow` warning.
|
|
44
|
+
*/
|
|
45
|
+
export function resolveSeriesColor(index, seriesColors) {
|
|
46
|
+
const colors = seriesColors.length > 0 ? seriesColors : XY_SERIES_PALETTE;
|
|
47
|
+
const cycle = Math.floor(index / colors.length);
|
|
48
|
+
let color = colors[index % colors.length];
|
|
49
|
+
for (let i = 0; i < cycle; i++) {
|
|
50
|
+
color = tint(color);
|
|
51
|
+
}
|
|
52
|
+
return { color, overflowed: cycle > 0 };
|
|
53
|
+
}
|
|
54
|
+
/**
|
|
55
|
+
* Maps a rule-set `colorIndex` and a series hue to the IBCS mark treatment.
|
|
56
|
+
*
|
|
57
|
+
* | colorIndex | IBCS meaning | Bubble | Dot |
|
|
58
|
+
* | ---------- | ------------------- | ------------------------------- | ---------------------------- |
|
|
59
|
+
* | 10 (ac) | solid dark | solid hue | solid hue |
|
|
60
|
+
* | 20 (pp/py) | light | tinted hue | tinted hue |
|
|
61
|
+
* | 30 (fc) | hatched | white + hue hatch + hue stroke | white + dashed hue ring |
|
|
62
|
+
* | 50 (pl/bu) | outlined | white + solid hue stroke | white + solid hue ring |
|
|
63
|
+
*/
|
|
64
|
+
export function markTreatment(colorIndex, hue, kind) {
|
|
65
|
+
const strokeWidth = kind === "dot" ? 0.75 : 1;
|
|
66
|
+
switch (colorIndex) {
|
|
67
|
+
case 20:
|
|
68
|
+
return { fill: tint(hue), stroke: "#ffffff", strokeWidth };
|
|
69
|
+
case 30:
|
|
70
|
+
if (kind === "bubble") {
|
|
71
|
+
return { fill: "#ffffff", stroke: hue, strokeWidth, hatch: true };
|
|
72
|
+
}
|
|
73
|
+
return { fill: "#ffffff", stroke: hue, strokeWidth, dasharray: "2,1.5" };
|
|
74
|
+
case 50:
|
|
75
|
+
return { fill: "#ffffff", stroke: hue, strokeWidth };
|
|
76
|
+
case 10:
|
|
77
|
+
default:
|
|
78
|
+
return { fill: hue, stroke: "#ffffff", strokeWidth };
|
|
79
|
+
}
|
|
80
|
+
}
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
import { Scenarios } from "../constants";
|
|
2
|
+
/**
|
|
3
|
+
* Variance-token parser for XY chart axis measures.
|
|
4
|
+
*
|
|
5
|
+
* Reuses the engine's variance grammar (`d{base}_{delta}_{sentiment}` /
|
|
6
|
+
* `dr{base}_{delta}_{sentiment}`) with one deviation from
|
|
7
|
+
* {@link VarianceScenario}: on axes the trailing sentiment segment is
|
|
8
|
+
* **optional and ignored** — position encodes the value, there is no
|
|
9
|
+
* pos/neg coloring. The regex is anchored, so partial matches inside a
|
|
10
|
+
* longer token are rejected.
|
|
11
|
+
*/
|
|
12
|
+
const VARIANCE_MEASURE_REGEX = /^(dr|d)((?:ac|pp|fc|pl)[1-4])_((?:ac|pp|fc|pl)[1-4])(?:_(pos|neg|neu))?$/;
|
|
13
|
+
export class VarianceMeasure {
|
|
14
|
+
constructor(
|
|
15
|
+
/** `"d"` = absolute, `"dr"` = relative (fraction of delta). */
|
|
16
|
+
type,
|
|
17
|
+
/** Minuend scenario slot, e.g. `"ac1"`. */
|
|
18
|
+
base,
|
|
19
|
+
/** Subtrahend scenario slot, e.g. `"pp1"`. */
|
|
20
|
+
delta) {
|
|
21
|
+
this.type = type;
|
|
22
|
+
this.base = base;
|
|
23
|
+
this.delta = delta;
|
|
24
|
+
}
|
|
25
|
+
/** Parses a variance token; returns `null` when the token doesn't match the grammar. */
|
|
26
|
+
static parse(token) {
|
|
27
|
+
const match = VARIANCE_MEASURE_REGEX.exec(token);
|
|
28
|
+
if (match === null) {
|
|
29
|
+
return null;
|
|
30
|
+
}
|
|
31
|
+
return new VarianceMeasure(match[1], match[2], match[3]);
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* Computes the variance value, mirroring the null-safe math of the
|
|
35
|
+
* existing charts: absolute = `base - delta`, relative =
|
|
36
|
+
* `(base - delta) / delta`. Returns `null` when either operand is
|
|
37
|
+
* missing or a relative variance would divide by zero.
|
|
38
|
+
*/
|
|
39
|
+
compute(base, delta) {
|
|
40
|
+
if (base == null || delta == null) {
|
|
41
|
+
return null;
|
|
42
|
+
}
|
|
43
|
+
if (this.type === "dr") {
|
|
44
|
+
if (delta === 0) {
|
|
45
|
+
return null;
|
|
46
|
+
}
|
|
47
|
+
return (base - delta) / delta;
|
|
48
|
+
}
|
|
49
|
+
return base - delta;
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
/**
|
|
53
|
+
* Resolves a measure token to a scenario slot or a variance measure.
|
|
54
|
+
* Returns `null` for tokens matching neither vocabulary.
|
|
55
|
+
*/
|
|
56
|
+
export function resolveMeasure(token) {
|
|
57
|
+
const trimmed = token.trim();
|
|
58
|
+
if (Object.values(Scenarios).includes(trimmed)) {
|
|
59
|
+
return { kind: "scenario", slot: trimmed };
|
|
60
|
+
}
|
|
61
|
+
const variance = VarianceMeasure.parse(trimmed);
|
|
62
|
+
if (variance !== null) {
|
|
63
|
+
return { kind: "variance", measure: variance };
|
|
64
|
+
}
|
|
65
|
+
return null;
|
|
66
|
+
}
|
|
67
|
+
/**
|
|
68
|
+
* Scenario family (`ac` | `pp` | `fc` | `pl`) of a plain scenario slot.
|
|
69
|
+
*/
|
|
70
|
+
export function scenarioFamily(slot) {
|
|
71
|
+
return slot.replace(/\d+$/, "");
|
|
72
|
+
}
|
|
73
|
+
/** Slot number (`1`–`4`) of a plain scenario slot. */
|
|
74
|
+
export function scenarioSlotNumber(slot) {
|
|
75
|
+
return slot.replace(/^[a-z]+/, "");
|
|
76
|
+
}
|
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
import { Formatter } from "../formatter";
|
|
2
|
+
/**
|
|
3
|
+
* Per-panel plot frame for the XY charts: highlight bands, gridlines,
|
|
4
|
+
* reference lines, the frame rectangle, tick labels, and the panel title.
|
|
5
|
+
*
|
|
6
|
+
* Style roles are taken from the `axisStyles` scenario group:
|
|
7
|
+
* `ac` = frame + tick labels, `pp` = gridlines, `fc` = reference lines
|
|
8
|
+
* and iso-curves, `pl` = highlight band fill.
|
|
9
|
+
*/
|
|
10
|
+
export class XYFrame {
|
|
11
|
+
constructor(xScale, yScale, rect, styles) {
|
|
12
|
+
this.xScale = xScale;
|
|
13
|
+
this.yScale = yScale;
|
|
14
|
+
this.rect = rect;
|
|
15
|
+
this.styles = styles;
|
|
16
|
+
}
|
|
17
|
+
get em() {
|
|
18
|
+
return this.styles.fontStyles.size;
|
|
19
|
+
}
|
|
20
|
+
fontFamily() {
|
|
21
|
+
return this.styles.fontStyles.font.replace(/^[\d.]+px\s*/, "");
|
|
22
|
+
}
|
|
23
|
+
/** Shaded bands behind everything; open ends run to the domain edge. */
|
|
24
|
+
drawBands(group, xHighlight, yHighlight) {
|
|
25
|
+
var _a, _b, _c, _d;
|
|
26
|
+
const fill = this.styles.axisStyles.pl.fill;
|
|
27
|
+
if (xHighlight !== undefined && (xHighlight.from !== undefined || xHighlight.to !== undefined)) {
|
|
28
|
+
const from = this.xScale.scale((_a = xHighlight.from) !== null && _a !== void 0 ? _a : this.xScale.domainMin);
|
|
29
|
+
const to = this.xScale.scale((_b = xHighlight.to) !== null && _b !== void 0 ? _b : this.xScale.domainMax);
|
|
30
|
+
group
|
|
31
|
+
.rect(Math.abs(to - from), this.rect.height)
|
|
32
|
+
.move(Math.min(from, to), this.rect.y)
|
|
33
|
+
.fill(fill);
|
|
34
|
+
}
|
|
35
|
+
if (yHighlight !== undefined && (yHighlight.from !== undefined || yHighlight.to !== undefined)) {
|
|
36
|
+
const from = this.yScale.scale((_c = yHighlight.from) !== null && _c !== void 0 ? _c : this.yScale.domainMin);
|
|
37
|
+
const to = this.yScale.scale((_d = yHighlight.to) !== null && _d !== void 0 ? _d : this.yScale.domainMax);
|
|
38
|
+
group
|
|
39
|
+
.rect(this.rect.width, Math.abs(from - to))
|
|
40
|
+
.move(this.rect.x, Math.min(from, to))
|
|
41
|
+
.fill(fill);
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
/** Horizontal gridlines at the y ticks; vertical ones only when `ticksX` is given. */
|
|
45
|
+
drawGrid(group, ticksY, ticksX) {
|
|
46
|
+
const stroke = { color: this.styles.axisStyles.pp.stroke, width: this.styles.scaleFactors.gridLineWidth };
|
|
47
|
+
for (const tick of ticksY) {
|
|
48
|
+
const y = this.yScale.scale(tick);
|
|
49
|
+
group.line(this.rect.x, y, this.rect.x + this.rect.width, y).stroke(stroke);
|
|
50
|
+
}
|
|
51
|
+
if (ticksX !== undefined) {
|
|
52
|
+
for (const tick of ticksX) {
|
|
53
|
+
const x = this.xScale.scale(tick);
|
|
54
|
+
group.line(x, this.rect.y, x, this.rect.y + this.rect.height).stroke(stroke);
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
/** Thin reference lines at the given axis values (10A quadrant crosshair). */
|
|
59
|
+
drawRefLines(group, xRef, yRef) {
|
|
60
|
+
const stroke = { color: this.styles.axisStyles.fc.stroke, width: this.styles.scaleFactors.refLineWidth };
|
|
61
|
+
if (xRef !== undefined) {
|
|
62
|
+
const x = this.xScale.scale(xRef);
|
|
63
|
+
group.line(x, this.rect.y, x, this.rect.y + this.rect.height).stroke(stroke);
|
|
64
|
+
}
|
|
65
|
+
if (yRef !== undefined) {
|
|
66
|
+
const y = this.yScale.scale(yRef);
|
|
67
|
+
group.line(this.rect.x, y, this.rect.x + this.rect.width, y).stroke(stroke);
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
/** The four-sided thin plot frame (as in the IBCS template images). */
|
|
71
|
+
drawFrame(group) {
|
|
72
|
+
group
|
|
73
|
+
.rect(this.rect.width, this.rect.height)
|
|
74
|
+
.move(this.rect.x, this.rect.y)
|
|
75
|
+
.fill("none")
|
|
76
|
+
.stroke({ color: this.styles.axisStyles.ac.stroke, width: this.styles.scaleFactors.gridLineWidth });
|
|
77
|
+
}
|
|
78
|
+
/** Tick labels along the outer edges (no tick marks — template style). */
|
|
79
|
+
drawTickLabels(group, config) {
|
|
80
|
+
const gap = this.styles.scaleFactors.axisTickLength * this.em;
|
|
81
|
+
const font = { size: this.styles.fontStyles.size, anchor: "start" };
|
|
82
|
+
const family = this.fontFamily();
|
|
83
|
+
const color = this.styles.fontStyles.color;
|
|
84
|
+
if (config.showXLabels) {
|
|
85
|
+
for (const tick of config.ticksX) {
|
|
86
|
+
const x = this.xScale.scale(tick);
|
|
87
|
+
group
|
|
88
|
+
.text(Formatter.number(tick, "decimal", config.xDecimals, config.xDecimals))
|
|
89
|
+
.font(Object.assign(Object.assign({}, font), { anchor: "middle" }))
|
|
90
|
+
.fill(color)
|
|
91
|
+
.attr({ x, y: this.rect.y + this.rect.height + gap + this.em * 0.8, "font-family": family });
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
if (config.showYLabels) {
|
|
95
|
+
for (const tick of config.ticksY) {
|
|
96
|
+
const y = this.yScale.scale(tick);
|
|
97
|
+
group
|
|
98
|
+
.text(Formatter.number(tick, "decimal", config.yDecimals, config.yDecimals))
|
|
99
|
+
.font(Object.assign(Object.assign({}, font), { anchor: "end" }))
|
|
100
|
+
.fill(color)
|
|
101
|
+
.attr({ x: this.rect.x - gap, y: y + this.em * 0.35, "font-family": family });
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
/** Facet panel title, top-left inside the panel, bold (10F "Europe"/"RoW"). */
|
|
106
|
+
drawPanelTitle(group, title) {
|
|
107
|
+
if (title === "") {
|
|
108
|
+
return;
|
|
109
|
+
}
|
|
110
|
+
group
|
|
111
|
+
.text(title)
|
|
112
|
+
.font({ size: this.styles.fontStyles.size, weight: "bold", anchor: "start" })
|
|
113
|
+
.fill(this.styles.fontStyles.color)
|
|
114
|
+
.attr({
|
|
115
|
+
x: this.rect.x + 0.5 * this.em,
|
|
116
|
+
y: this.rect.y + 1.2 * this.em,
|
|
117
|
+
"font-family": this.fontFamily(),
|
|
118
|
+
});
|
|
119
|
+
}
|
|
120
|
+
}
|
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
import CalculateSize from "calculate-size";
|
|
2
|
+
/**
|
|
3
|
+
* Series-color legend + bubble-size caption for the XY charts
|
|
4
|
+
* (IBCS requires a legend explaining colors — and, for bubbles, size).
|
|
5
|
+
* Positioned by the orchestrator: right column (default) or bottom row.
|
|
6
|
+
*/
|
|
7
|
+
export class XYLegend {
|
|
8
|
+
constructor(styles) {
|
|
9
|
+
this.styles = styles;
|
|
10
|
+
}
|
|
11
|
+
get em() {
|
|
12
|
+
return this.styles.fontStyles.size;
|
|
13
|
+
}
|
|
14
|
+
get rowHeight() {
|
|
15
|
+
return this.em * 1.5;
|
|
16
|
+
}
|
|
17
|
+
get swatchSize() {
|
|
18
|
+
return this.styles.scaleFactors.legendSwatch * this.em;
|
|
19
|
+
}
|
|
20
|
+
textWidth(text, bold = false) {
|
|
21
|
+
const width = CalculateSize(text, {
|
|
22
|
+
font: this.styles.fontStyles.font,
|
|
23
|
+
fontSize: this.styles.fontStyles.size + "px",
|
|
24
|
+
fontWeight: bold ? "bold" : "normal",
|
|
25
|
+
}).width;
|
|
26
|
+
// calculate-size needs a live DOM; fall back to an estimate in test environments.
|
|
27
|
+
return Number.isFinite(width) && width > 0 ? width : text.length * 0.6 * this.em;
|
|
28
|
+
}
|
|
29
|
+
rows(model) {
|
|
30
|
+
const rows = [];
|
|
31
|
+
model.sizeCaption.forEach((line, index) => {
|
|
32
|
+
rows.push({ text: line, bold: index === 0, treatment: null });
|
|
33
|
+
});
|
|
34
|
+
if (model.title !== null && model.title !== "") {
|
|
35
|
+
rows.push({ text: model.title, bold: true, treatment: null });
|
|
36
|
+
}
|
|
37
|
+
for (const entry of model.compareEntries) {
|
|
38
|
+
rows.push({ text: entry.label, bold: false, treatment: entry.treatment });
|
|
39
|
+
}
|
|
40
|
+
for (const entry of model.entries) {
|
|
41
|
+
rows.push({ text: entry.label, bold: false, treatment: entry.treatment });
|
|
42
|
+
}
|
|
43
|
+
return rows;
|
|
44
|
+
}
|
|
45
|
+
/** Footprint of the legend for layout reservation. */
|
|
46
|
+
measure(model, position) {
|
|
47
|
+
const rows = this.rows(model);
|
|
48
|
+
if (rows.length === 0) {
|
|
49
|
+
return { width: 0, height: 0 };
|
|
50
|
+
}
|
|
51
|
+
const swatchSpan = this.swatchSize + 0.4 * this.em;
|
|
52
|
+
if (position === "bottom") {
|
|
53
|
+
let width = 0;
|
|
54
|
+
for (const row of rows) {
|
|
55
|
+
width += (row.treatment !== null ? swatchSpan : 0) + this.textWidth(row.text, row.bold) + 1.5 * this.em;
|
|
56
|
+
}
|
|
57
|
+
return { width, height: this.rowHeight };
|
|
58
|
+
}
|
|
59
|
+
let width = 0;
|
|
60
|
+
for (const row of rows) {
|
|
61
|
+
width = Math.max(width, (row.treatment !== null ? swatchSpan : 0) + this.textWidth(row.text, row.bold));
|
|
62
|
+
}
|
|
63
|
+
return { width, height: rows.length * this.rowHeight };
|
|
64
|
+
}
|
|
65
|
+
/** Draws the legend with its top-left corner at `x`/`y`. */
|
|
66
|
+
draw(group, model, x, y, position) {
|
|
67
|
+
const rows = this.rows(model);
|
|
68
|
+
const swatchSpan = this.swatchSize + 0.4 * this.em;
|
|
69
|
+
let cursorX = x;
|
|
70
|
+
let cursorY = y;
|
|
71
|
+
for (const row of rows) {
|
|
72
|
+
let textX = cursorX;
|
|
73
|
+
if (row.treatment !== null) {
|
|
74
|
+
const swatch = group
|
|
75
|
+
.circle(this.swatchSize)
|
|
76
|
+
.move(cursorX, cursorY + (this.rowHeight - this.swatchSize) / 2)
|
|
77
|
+
.fill(row.treatment.hatch ? "#ffffff" : row.treatment.fill)
|
|
78
|
+
.stroke({
|
|
79
|
+
color: row.treatment.stroke === "#ffffff" ? row.treatment.fill : row.treatment.stroke,
|
|
80
|
+
width: row.treatment.strokeWidth,
|
|
81
|
+
});
|
|
82
|
+
if (row.treatment.dasharray !== undefined) {
|
|
83
|
+
swatch.attr("stroke-dasharray", row.treatment.dasharray);
|
|
84
|
+
}
|
|
85
|
+
textX += swatchSpan;
|
|
86
|
+
}
|
|
87
|
+
group
|
|
88
|
+
.text(row.text)
|
|
89
|
+
.font({
|
|
90
|
+
size: this.styles.fontStyles.size,
|
|
91
|
+
weight: row.bold ? "bold" : "normal",
|
|
92
|
+
anchor: "start",
|
|
93
|
+
})
|
|
94
|
+
.fill(this.styles.fontStyles.color)
|
|
95
|
+
.attr({ x: textX, y: cursorY + this.rowHeight / 2 + this.em * 0.35, "font-family": this.fontFamily() });
|
|
96
|
+
if (position === "bottom") {
|
|
97
|
+
cursorX = textX + this.textWidth(row.text, row.bold) + 1.5 * this.em;
|
|
98
|
+
}
|
|
99
|
+
else {
|
|
100
|
+
cursorY += this.rowHeight;
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
fontFamily() {
|
|
105
|
+
return this.styles.fontStyles.font.replace(/^[\d.]+px\s*/, "");
|
|
106
|
+
}
|
|
107
|
+
}
|
|
@@ -0,0 +1,221 @@
|
|
|
1
|
+
import { CompareUtil } from "../../helper/CompareUtil";
|
|
2
|
+
/**
|
|
3
|
+
* Parses a raw object-prop attribute value. A blank value yields `data: null`
|
|
4
|
+
* without error. A value starting with `{` must be valid JSON describing an
|
|
5
|
+
* object. Any other bare string is treated as shorthand for
|
|
6
|
+
* `{ [shorthandKey]: value }` when a shorthand key is allowed, otherwise it
|
|
7
|
+
* is a parse error.
|
|
8
|
+
*/
|
|
9
|
+
export function parseSpec(raw, shorthandKey) {
|
|
10
|
+
var _a;
|
|
11
|
+
const trimmed = (_a = raw === null || raw === void 0 ? void 0 : raw.trim()) !== null && _a !== void 0 ? _a : "";
|
|
12
|
+
if (trimmed === "" || trimmed === "null") {
|
|
13
|
+
return { data: null, parseError: false };
|
|
14
|
+
}
|
|
15
|
+
if (trimmed.startsWith("{") || trimmed.startsWith("[")) {
|
|
16
|
+
try {
|
|
17
|
+
const parsed = JSON.parse(trimmed);
|
|
18
|
+
if (typeof parsed !== "object" || parsed === null || Array.isArray(parsed)) {
|
|
19
|
+
return { data: null, parseError: true };
|
|
20
|
+
}
|
|
21
|
+
return { data: parsed, parseError: false };
|
|
22
|
+
}
|
|
23
|
+
catch (_b) {
|
|
24
|
+
return { data: null, parseError: true };
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
if (shorthandKey !== null) {
|
|
28
|
+
return { data: { [shorthandKey]: trimmed }, parseError: false };
|
|
29
|
+
}
|
|
30
|
+
return { data: null, parseError: true };
|
|
31
|
+
}
|
|
32
|
+
function collectUnknownKeys(data, knownKeys) {
|
|
33
|
+
return Object.keys(data).filter((key) => !knownKeys.includes(key));
|
|
34
|
+
}
|
|
35
|
+
function readString(data, key, invalid) {
|
|
36
|
+
if (!CompareUtil.isExisting(data[key])) {
|
|
37
|
+
return undefined;
|
|
38
|
+
}
|
|
39
|
+
if (CompareUtil.isString(data[key])) {
|
|
40
|
+
return data[key];
|
|
41
|
+
}
|
|
42
|
+
invalid.push(key);
|
|
43
|
+
return undefined;
|
|
44
|
+
}
|
|
45
|
+
function readNumber(data, key, invalid) {
|
|
46
|
+
if (!CompareUtil.isExisting(data[key])) {
|
|
47
|
+
return undefined;
|
|
48
|
+
}
|
|
49
|
+
if (CompareUtil.isNumber(data[key])) {
|
|
50
|
+
return data[key];
|
|
51
|
+
}
|
|
52
|
+
invalid.push(key);
|
|
53
|
+
return undefined;
|
|
54
|
+
}
|
|
55
|
+
function readHighlight(data, invalid) {
|
|
56
|
+
if (!CompareUtil.isExisting(data.highlight)) {
|
|
57
|
+
return undefined;
|
|
58
|
+
}
|
|
59
|
+
if (!CompareUtil.isObject(data.highlight) || Array.isArray(data.highlight)) {
|
|
60
|
+
invalid.push("highlight");
|
|
61
|
+
return undefined;
|
|
62
|
+
}
|
|
63
|
+
const range = data.highlight;
|
|
64
|
+
const result = {};
|
|
65
|
+
const from = readNumber(range, "from", invalid);
|
|
66
|
+
const to = readNumber(range, "to", invalid);
|
|
67
|
+
if (from !== undefined) {
|
|
68
|
+
result.from = from;
|
|
69
|
+
}
|
|
70
|
+
if (to !== undefined) {
|
|
71
|
+
result.to = to;
|
|
72
|
+
}
|
|
73
|
+
return result;
|
|
74
|
+
}
|
|
75
|
+
const AXIS_KEYS = ["measure", "label", "unit", "min", "max", "refLine", "highlight"];
|
|
76
|
+
export function toAxisConfig(data) {
|
|
77
|
+
const invalidFields = [];
|
|
78
|
+
const measure = readString(data, "measure", invalidFields);
|
|
79
|
+
if (measure === undefined || measure.trim() === "") {
|
|
80
|
+
invalidFields.push("measure");
|
|
81
|
+
return { config: null, unknownKeys: collectUnknownKeys(data, AXIS_KEYS), invalidFields };
|
|
82
|
+
}
|
|
83
|
+
const config = { measure: measure.trim() };
|
|
84
|
+
config.label = readString(data, "label", invalidFields);
|
|
85
|
+
config.unit = readString(data, "unit", invalidFields);
|
|
86
|
+
config.min = readNumber(data, "min", invalidFields);
|
|
87
|
+
config.max = readNumber(data, "max", invalidFields);
|
|
88
|
+
config.refLine = readNumber(data, "refLine", invalidFields);
|
|
89
|
+
config.highlight = readHighlight(data, invalidFields);
|
|
90
|
+
return { config, unknownKeys: collectUnknownKeys(data, AXIS_KEYS), invalidFields };
|
|
91
|
+
}
|
|
92
|
+
const SIZE_KEYS = ["measure", "label", "unit", "group"];
|
|
93
|
+
export function toSizeConfig(data) {
|
|
94
|
+
const invalidFields = [];
|
|
95
|
+
const measure = readString(data, "measure", invalidFields);
|
|
96
|
+
if (measure === undefined || measure.trim() === "") {
|
|
97
|
+
invalidFields.push("measure");
|
|
98
|
+
return { config: null, unknownKeys: collectUnknownKeys(data, SIZE_KEYS), invalidFields };
|
|
99
|
+
}
|
|
100
|
+
const config = { measure: measure.trim() };
|
|
101
|
+
config.label = readString(data, "label", invalidFields);
|
|
102
|
+
config.unit = readString(data, "unit", invalidFields);
|
|
103
|
+
config.group = readString(data, "group", invalidFields);
|
|
104
|
+
return { config, unknownKeys: collectUnknownKeys(data, SIZE_KEYS), invalidFields };
|
|
105
|
+
}
|
|
106
|
+
const SHARE_KEYS = ["measure"];
|
|
107
|
+
export function toShareConfig(data) {
|
|
108
|
+
const invalidFields = [];
|
|
109
|
+
const measure = readString(data, "measure", invalidFields);
|
|
110
|
+
if (measure === undefined || measure.trim() === "") {
|
|
111
|
+
invalidFields.push("measure");
|
|
112
|
+
return { config: null, unknownKeys: collectUnknownKeys(data, SHARE_KEYS), invalidFields };
|
|
113
|
+
}
|
|
114
|
+
return { config: { measure: measure.trim() }, unknownKeys: collectUnknownKeys(data, SHARE_KEYS), invalidFields };
|
|
115
|
+
}
|
|
116
|
+
const ISO_KEYS = ["values", "label", "unit", "highlight"];
|
|
117
|
+
export function toIsoConfig(data) {
|
|
118
|
+
const invalidFields = [];
|
|
119
|
+
let values = null;
|
|
120
|
+
if (data.values === "auto") {
|
|
121
|
+
values = "auto";
|
|
122
|
+
}
|
|
123
|
+
else if (CompareUtil.isArray(data.values) && data.values.every((v) => CompareUtil.isNumber(v))) {
|
|
124
|
+
values = data.values;
|
|
125
|
+
}
|
|
126
|
+
else {
|
|
127
|
+
invalidFields.push("values");
|
|
128
|
+
}
|
|
129
|
+
if (values === null) {
|
|
130
|
+
return { config: null, unknownKeys: collectUnknownKeys(data, ISO_KEYS), invalidFields };
|
|
131
|
+
}
|
|
132
|
+
const config = { values };
|
|
133
|
+
config.label = readString(data, "label", invalidFields);
|
|
134
|
+
config.unit = readString(data, "unit", invalidFields);
|
|
135
|
+
if (CompareUtil.isExisting(data.highlight)) {
|
|
136
|
+
if (CompareUtil.isObject(data.highlight) && !Array.isArray(data.highlight)) {
|
|
137
|
+
const from = readNumber(data.highlight, "from", invalidFields);
|
|
138
|
+
if (from !== undefined) {
|
|
139
|
+
config.highlight = { from };
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
else {
|
|
143
|
+
invalidFields.push("highlight");
|
|
144
|
+
}
|
|
145
|
+
}
|
|
146
|
+
return { config, unknownKeys: collectUnknownKeys(data, ISO_KEYS), invalidFields };
|
|
147
|
+
}
|
|
148
|
+
const LABEL_KEYS = ["points", "values", "max"];
|
|
149
|
+
export function toLabelConfig(data, defaults) {
|
|
150
|
+
const invalidFields = [];
|
|
151
|
+
const config = { points: defaults.points, values: defaults.values, max: defaults.max };
|
|
152
|
+
if (CompareUtil.isExisting(data.points)) {
|
|
153
|
+
if (data.points === "auto" || data.points === "none" || data.points === "all") {
|
|
154
|
+
config.points = data.points;
|
|
155
|
+
}
|
|
156
|
+
else if (CompareUtil.isArray(data.points) && data.points.every((p) => CompareUtil.isString(p))) {
|
|
157
|
+
config.points = data.points;
|
|
158
|
+
}
|
|
159
|
+
else {
|
|
160
|
+
invalidFields.push("points");
|
|
161
|
+
}
|
|
162
|
+
}
|
|
163
|
+
if (CompareUtil.isExisting(data.values)) {
|
|
164
|
+
if (CompareUtil.isBoolean(data.values)) {
|
|
165
|
+
config.values = data.values;
|
|
166
|
+
}
|
|
167
|
+
else {
|
|
168
|
+
invalidFields.push("values");
|
|
169
|
+
}
|
|
170
|
+
}
|
|
171
|
+
if (CompareUtil.isExisting(data.max)) {
|
|
172
|
+
if (CompareUtil.isNumber(data.max) && data.max > 0) {
|
|
173
|
+
config.max = Math.floor(data.max);
|
|
174
|
+
}
|
|
175
|
+
else {
|
|
176
|
+
invalidFields.push("max");
|
|
177
|
+
}
|
|
178
|
+
}
|
|
179
|
+
return { config, unknownKeys: collectUnknownKeys(data, LABEL_KEYS), invalidFields };
|
|
180
|
+
}
|
|
181
|
+
const FACET_KEYS = ["level", "columns"];
|
|
182
|
+
export function toFacetConfig(data) {
|
|
183
|
+
const invalidFields = [];
|
|
184
|
+
const level = CompareUtil.isString(data.level) ? data.level.toLowerCase() : null;
|
|
185
|
+
if (level !== "rowgroup" && level !== "category") {
|
|
186
|
+
invalidFields.push("level");
|
|
187
|
+
return { config: null, unknownKeys: collectUnknownKeys(data, FACET_KEYS), invalidFields };
|
|
188
|
+
}
|
|
189
|
+
const config = { level };
|
|
190
|
+
if (CompareUtil.isExisting(data.columns)) {
|
|
191
|
+
if (CompareUtil.isNumber(data.columns) && data.columns >= 1) {
|
|
192
|
+
config.columns = Math.floor(data.columns);
|
|
193
|
+
}
|
|
194
|
+
else {
|
|
195
|
+
invalidFields.push("columns");
|
|
196
|
+
}
|
|
197
|
+
}
|
|
198
|
+
return { config, unknownKeys: collectUnknownKeys(data, FACET_KEYS), invalidFields };
|
|
199
|
+
}
|
|
200
|
+
const LEGEND_KEYS = ["show", "position"];
|
|
201
|
+
export function toLegendConfig(data) {
|
|
202
|
+
const invalidFields = [];
|
|
203
|
+
const config = { show: true, position: "right" };
|
|
204
|
+
if (CompareUtil.isExisting(data.show)) {
|
|
205
|
+
if (CompareUtil.isBoolean(data.show)) {
|
|
206
|
+
config.show = data.show;
|
|
207
|
+
}
|
|
208
|
+
else {
|
|
209
|
+
invalidFields.push("show");
|
|
210
|
+
}
|
|
211
|
+
}
|
|
212
|
+
if (CompareUtil.isExisting(data.position)) {
|
|
213
|
+
if (data.position === "right" || data.position === "bottom") {
|
|
214
|
+
config.position = data.position;
|
|
215
|
+
}
|
|
216
|
+
else {
|
|
217
|
+
invalidFields.push("position");
|
|
218
|
+
}
|
|
219
|
+
}
|
|
220
|
+
return { config, unknownKeys: collectUnknownKeys(data, LEGEND_KEYS), invalidFields };
|
|
221
|
+
}
|