@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
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { Formatter } from "../formatter";
|
|
2
|
+
import { NumericScale } from "./NumericScale";
|
|
3
|
+
/**
|
|
4
|
+
* Prints a number of an XY chart (axis tick, iso line, bubble value) with a fixed number
|
|
5
|
+
* of decimals. `percent` is for relative variances: the value is a fraction and prints as 20%.
|
|
6
|
+
*/
|
|
7
|
+
export function formatXYValue(value, decimals, locale, percent = false) {
|
|
8
|
+
return Formatter.number(value, percent ? "percent" : "decimal", decimals, decimals, 1, locale);
|
|
9
|
+
}
|
|
10
|
+
/** Decimals for the ticks of an axis. The ticks of a percent axis are fractions and print times 100. */
|
|
11
|
+
export function xyTickDecimals(ticks, percent) {
|
|
12
|
+
return NumericScale.tickDecimals(percent ? ticks.map((tick) => tick * 100) : ticks);
|
|
13
|
+
}
|
|
Binary file
|
|
@@ -15,6 +15,8 @@ export class XYChartStyle {
|
|
|
15
15
|
this.axisStyles = axisStyles;
|
|
16
16
|
this.padding = padding;
|
|
17
17
|
this.seriesColors = [...XY_SERIES_PALETTE];
|
|
18
|
+
/** Locale for number labels. */
|
|
19
|
+
this.locale = "de";
|
|
18
20
|
}
|
|
19
21
|
}
|
|
20
22
|
/** Adapts raw componentStyle JSON into an XYChartStyle, falling back to defaults for missing properties. */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{S as e}from"./SiPrefix.js";import{C as t}from"./CompareUtil.js";var r;!function(e){e[e.Y=1e24]="Y",e[e.Z=1e21]="Z",e[e.E=1e18]="E",e[e.P=1e15]="P",e[e.T=1e12]="T",e[e.G=1e9]="G",e[e.M=1e6]="M",e[e.k=1e3]="k",e[e.h=100]="h",e[e.da=10]="da",e[e.d=.1]="d",e[e.c=.01]="c",e[e.m=.001]="m",e[e.my=1e-6]="my",e[e.n=1e-9]="n",e[e.p=1e-12]="p",e[e.f=1e-15]="f",e[e.a=1e-18]="a",e[e.z=1e-21]="z",e[e.y=1e-24]="y"}(r||(r={}));class
|
|
1
|
+
import{S as e}from"./SiPrefix.js";import{C as t}from"./CompareUtil.js";var r;!function(e){e[e.Y=1e24]="Y",e[e.Z=1e21]="Z",e[e.E=1e18]="E",e[e.P=1e15]="P",e[e.T=1e12]="T",e[e.G=1e9]="G",e[e.M=1e6]="M",e[e.k=1e3]="k",e[e.h=100]="h",e[e.da=10]="da",e[e.d=.1]="d",e[e.c=.01]="c",e[e.m=.001]="m",e[e.my=1e-6]="my",e[e.n=1e-9]="n",e[e.p=1e-12]="p",e[e.f=1e-15]="f",e[e.a=1e-18]="a",e[e.z=1e-21]="z",e[e.y=1e-24]="y"}(r||(r={}));class n{static calculateMeasureScale(t,r,n,a,s){var i,u;if("_"===a)return new e;if("μ"===a&&(a="my"),null!=a&&[...this.unitsLeast,...this.unitsGreat].includes(a))return this.lookupPrefix(a);const l=n.filter((e=>3===e.length));if(0===l.length||!r)return new e;const h=`SELECT MAX(GREATEST(${l.map((e=>"ABS("+e+")")).toString()})) as prefixvalue\n FROM ${r}`,c=`SELECT MIN(LEAST(${l.map((e=>"ABS("+e+")")).toString()})) as prefixvalue\n FROM ${r}`;let o,f=h;"LEAST"===(null==a?void 0:a.toUpperCase())&&(f=c);try{o=null!==(u=null===(i=t.exec(f)[0])||void 0===i?void 0:i.prefixvalue)&&void 0!==u?u:0}catch(t){return null==s||s(t),new e}return this.determinePrefix(Math.abs(o))}static determinePrefix(t){if(!Number.isFinite(t)||t<=0)return new e;if(t>=1e3){const r=Math.min(Math.floor(Math.log10(t)/3),this.unitsGreat.length)-1;return new e(this.unitsGreat[r],Math.pow(1e3,r+1))}if(t<=.001){const r=Math.min(-Math.floor(Math.log10(t)/3),this.unitsLeast.length)-1;return new e(this.unitsLeast[r],Math.pow(1e3,-(r+1)))}return new e}static lookupPrefix(t){return new e(t,r[t])}}n.unitsGreat=["k","M","G","T","P","E","Z","Y"],n.unitsLeast=["m","my","n","p","f","a","z","y"];class a{constructor(e=2,t=1){this.percent=e,this.decimal=t}}class s{adapt(e){const r=new a;return t.isNumber(e.percent)&&(r.percent=e.percent),t.isNumber(e.decimal)&&(r.decimal=e.decimal),r}default(){return new a}}export{n as D,a,s as b}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{D as t}from"./luxon.js";var e,s;!function(t){t.YEAR="year",t.QUARTER="quarter",t.MONTH="month",t.WEEK="week",t.DAY="day",t.HOUR="hour",t.MINUTE="minute",t.SECOND="second",t.MILLISECOND="millisecond",t.NONE="fallback",t.AUTO="auto"}(e||(e={})),function(t){t.AVG="avg",t.INTERVAL="interval",t.START="start",t.END="end",t.YTD="ytd",t.YTG="ytg",t.CUM="cum",t.MAT="mat",t.NONE="none",t.AUTO="auto"}(s||(s={}));class r{constructor(){this._dateFormat={year:"yyyy",quarter:"q'Q' yyyy",month:"LLL yyyy",week:"'KW'WW
|
|
1
|
+
import{D as t}from"./luxon.js";var e,s;!function(t){t.YEAR="year",t.QUARTER="quarter",t.MONTH="month",t.WEEK="week",t.DAY="day",t.HOUR="hour",t.MINUTE="minute",t.SECOND="second",t.MILLISECOND="millisecond",t.NONE="fallback",t.AUTO="auto"}(e||(e={})),function(t){t.AVG="avg",t.INTERVAL="interval",t.START="start",t.END="end",t.YTD="ytd",t.YTG="ytg",t.CUM="cum",t.MAT="mat",t.NONE="none",t.AUTO="auto"}(s||(s={}));class r{constructor(){this._dateFormat={year:"yyyy",quarter:"q'Q' yyyy",month:"LLL yyyy",week:"'KW'WW kkkk",day:"dd.MM.yyyy",hour:"TT",minute:"TT",second:"TT",millisecond:"TT:SSS",fallback:"dd.MM.yyyy"},this._dateFormatShort={year:"yy",quarter:"q'Q'",month:"LLL",week:"'KW'WW",day:"dd",hour:"hh'h'",minute:"mm'm'",second:"ss's'",millisecond:"SSS'ms'",fallback:"dd.MM.yyyy"},this._dateLinkFormat={avg:"Ø[LINK]",interval:"[DATE]..[DATE2]",start:".[DATE]",end:"[DATE].",ytd:"_[DATE]",ytg:"[DATE]_",cum:"[DATE]_[DATE2]",mat:"~[DATE]",none:"[DATE]"},this.locale="de",this.dateFormatPinned=!1,this.dateFormatShortPinned=!1,this.dateFormat=this._dateFormat,this.dateLinkFormat=this._dateLinkFormat,this.dateFormatShort=this._dateFormatShort}setDateLinkFormat(t){this.dateLinkFormat=t}setDateFormat(t){this.dateFormat=t,this.dateFormatPinned=!0}setDateFormatShort(t){this.dateFormatShort=t,this.dateFormatShortPinned=!0}setLocale(t){this.locale=t,this.dateFormatPinned||(this.dateFormat=Object.assign(Object.assign({},this._dateFormat),r.LOCALE_DATE_FORMAT[t]||{})),this.dateFormatShortPinned||(this.dateFormatShort=Object.assign(Object.assign({},this._dateFormatShort),r.LOCALE_DATE_FORMAT_SHORT[t]||{}))}getDateString(t,e){return t.setLocale(this.locale).toFormat(this.dateFormat[e]||this.dateFormat.fallback)}getSmartDateString(t,s){switch(s){case e.DAY:return this.getFormatedDayDate(t);case e.MONTH:return this.getFormatedMonthDate(t);case e.QUARTER:return this.getFormatedQuarterDate(t);case e.WEEK:return this.getFormatedWeekDate(t);case e.HOUR:return this.getFormatedHourDate(t);case e.MINUTE:return this.getFormatedMinuteDate(t);case e.SECOND:return this.getFormatedSecondDate(t);case e.MILLISECOND:return this.getFormatedMilliSecondDate(t);default:return this.getDateString(t,s)}}calculateDistanceType(s,r,i=32){if(null==r)return e.DAY;const a="number"==typeof s?t.fromMillis(s):s,n="number"==typeof r?t.fromMillis(r):r;return 0===n.diff(a).as("milliseconds")?e.DAY:n.diff(a).as("milliseconds")<i?e.MILLISECOND:n.diff(a).as("seconds")<i?e.SECOND:n.diff(a).as("minutes")<i?e.MINUTE:n.diff(a).as("hours")<i?e.HOUR:n.diff(a).as("days")<i?e.DAY:n.diff(a).as("weeks")<i?e.WEEK:n.diff(a).as("months")<i?e.MONTH:n.diff(a).as("quarters")<i?e.QUARTER:e.YEAR}datesBetween(t,e,s){const r=this.convertDateDistanceToMomentunitOfTime(s),i=t.startOf(r),a=e.endOf(r),n=[];let h=i;do{n.push(h),h=h.plus(this.createDiratonLike(r,1))}while(h<=a);return n}countBetween(t,e,s){const r=this.convertDateDistanceToMomentunitOfTime(s);return Math.floor(e.startOf(r).diff(t.startOf(r),r).as(r))+1}getDateLinkString(r,i,a,n,h){if(null==r&&null==i)return"";if(null==r&&a!==s.END&&a!==s.YTD)return"";if(null==i&&(s.INTERVAL===a||s.CUM===a||s.END===a||s.YTD===a))return"";const u=r||t.now(),c=i;n===e.AUTO&&(n=this.calculateDistanceType(u,c,h));let o=this.getDateString(u,n),l="",y=s.NONE;return null!=c&&(l=this.getDateString(c,n),y=s.INTERVAL,o===l&&a===s.INTERVAL&&(a=s.NONE),o===l&&a===s.AVG&&(y=s.NONE),s.END!==a&&s.YTD!==a||(o=l),a!==s.INTERVAL&&a!==s.CUM&&a!==s.AVG||(n===e.QUARTER?u.quarter===c.quarter&&u.year===c.year?l=l.replace(" "+c.year,""):u.year===c.year&&(o=o.replace(" "+u.year,"")):n===e.MONTH?u.month===c.month&&u.year===c.year?l=l.replace(" "+c.year,""):u.year===c.year&&(o=o.replace(" "+u.year,"")):n===e.WEEK&&(u.weekNumber===c.weekNumber&&u.weekYear===c.weekYear?l=l.replace(" "+c.weekYear,""):u.weekYear===c.weekYear&&(o=o.replace(" "+u.weekYear,""))))),this.dateLinkFormat[a].replace("[LINK]",this.dateLinkFormat[y]).replace("[DATE]",o).replace("[DATE2]",l)}getShortDateString(t,e){return t.setLocale(this.locale).toFormat(this.dateFormatShort[e]||this.dateFormatShort.fallback)}getFormatedDayDate(t){let e=this.dateFormatShort.day;return this.isFirstInMonth(t)&&(e+=" "+this.dateFormatShort.month),this.isJanuary(t)&&(e+=" "+this.dateFormatShort.year),t.setLocale(this.locale).toFormat(e)}getFormatedMonthDate(t){let e=this.dateFormatShort.month;return this.isJanuary(t)&&(e+=" "+this.dateFormatShort.year),t.setLocale(this.locale).toFormat(e)}getFormatedQuarterDate(t){let e=this.dateFormatShort.quarter;return this.isFirstQuarter(t)&&(e+=" "+this.dateFormatShort.year),t.setLocale(this.locale).toFormat(e)}getFormatedWeekDate(t){let e=this.dateFormatShort.week;return this.isFirstWeek(t)&&(e+=" kk"),t.setLocale(this.locale).toFormat(e)}getFormatedHourDate(t){let e=this.dateFormatShort.hour;return this.isFirstHour(t)&&(e+=" "+this.dateFormatShort.day),t.setLocale(this.locale).toFormat(e)}getFormatedMinuteDate(t){let e=this.dateFormatShort.minute;return this.isFirstMinute(t)&&(e=this.dateFormatShort.hour+":"+e),t.setLocale(this.locale).toFormat(e)}getFormatedSecondDate(t){let e=this.dateFormatShort.second;return this.isFirstSecond(t)&&(e=this.dateFormatShort.minute+":"+e),t.setLocale(this.locale).toFormat(e)}getFormatedMilliSecondDate(t){let e=this.dateFormatShort.millisecond;return this.isFirstMilliSecond(t)&&(e=this.dateFormatShort.second+":"+e),t.setLocale(this.locale).toFormat(e)}isFirstInMonth(t){return 1===t.day}isJanuary(t){return 1===t.month}isFirstQuarter(t){return 1===t.quarter}isFirstWeek(t){return 1===t.weekNumber}isFirstHour(t){return 0===t.hour}isFirstMinute(t){return 0===t.minute}isFirstSecond(t){return 0===t.second}isFirstMilliSecond(t){return 0===t.millisecond}convertDateDistanceToMomentunitOfTime(t){let s;switch(t){case e.YEAR:s="year";break;case e.MONTH:s="month";break;case e.QUARTER:s="quarter";break;case e.WEEK:s="week";break;case e.DAY:s="day";break;case e.HOUR:s="hour";break;case e.MINUTE:s="minute";break;case e.SECOND:s="second";break;case e.MILLISECOND:s="millisecond";break;default:s="day"}return s}createDiratonLike(t,e){switch(t){case"year":return{years:e};case"month":return{months:e};case"quarter":return{quarters:e};case"week":return{weeks:e};case"day":default:return{days:e};case"hour":return{hours:e};case"minute":return{minutes:e};case"second":return{seconds:e};case"millisecond":return{milliseconds:e}}}}r.LOCALE_DATE_FORMAT={en:{week:"'W'WW kkkk",day:"MM/dd/yyyy",fallback:"MM/dd/yyyy"}},r.LOCALE_DATE_FORMAT_SHORT={en:{week:"'W'WW",fallback:"MM/dd/yyyy"}};export{e as D,s as a,r as b}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{S as t}from"./SiPrefix.js";import{F as s}from"./formatter.js";import"./CompareUtil.js";import{g as i}from"./stackColors.js";var e;!function(t){t[t.Left=0]="Left",t[t.Center=1]="Center",t[t.Right=2]="Right",t[t.Top=3]="Top",t[t.Bottom=4]="Bottom"}(e||(e={}));class r{constructor(t,s,i,r,h,n,o,a){this.ID_SCENARIOLABEL="Label",this.CSS_CATEGORIES="categories",this.isRelativeLabel=!1,this.segmentFillColor=null,this.x=s,this.y=i,this.value=h,this.group=t.group().id(this.createElementID(t.toString(),r)),this.styles=n,this.isVarianceLabel=!1,this.verticalHookLocation=o||e.Top,this.horizontalHookLocation=a||e.Left}setToVarianceLabel(){return this.isVarianceLabel=!0,this}setToRelativeVarianceLabel(){return this.isVarianceLabel=!0,this.isRelativeLabel=!0,this}setSegmentFill(t){return this.segmentFillColor=t,this}updateGroup(t){return this.group=t,this}draw(i=!0,e={percent:2,decimal:1},r=new t){if(this.isEmpty())return this;const h=this.group;let n,o="";if(!1===Number.isNaN(Number(this.value))){let t="percent",i=e.percent,h=e.percent,a=1;!1===this.isRelativeLabel&&(i=e.decimal,h=e.decimal,a=r.value,t="decimal"),n=s.number(Number(this.value),t,i,h,a),this.isVarianceLabel&&Number(this.value)>=0&&(o="+")}else n=""+this.value;const a=this.drawLabel(h,o+n);return!1===i&&(a.addClass("hide"),h.addClass("hide")),this}isEmpty(){return null==this.value||""===this.value}setPos(t,s){return this.x=t,this.y=s,this}forceStringTypeDraw(){return this.drawLabel(this.group,""+this.value),this}drawLabel(t,s){const r=this.styles.fontStyles.background||"#ffffff";let h="start";const n=t.text(s);n.move(this.x,this.y);const o=n.bbox(),a=o.w,l=o.h;let c=0,u=0;const f=n.x();let m=n.y();return this.horizontalHookLocation===e.Left?(h="left",c=n.x()):this.horizontalHookLocation===e.Center?(h="middle",c=n.x()-(a+2)/2):this.horizontalHookLocation===e.Right&&(h="end",c=n.x()-a),this.verticalHookLocation===e.Center?(m=n.y()-1.2*l/2,u=m+.2*l):this.verticalHookLocation===e.Top?(m-=l/4,u=m+.2*l):this.verticalHookLocation===e.Bottom&&(m-=l,u=m+.2*l),n.move(f,m),n.font({anchor:h}),null!=this.segmentFillColor?n.fill(i(this.segmentFillColor)):t.rect(a+2,.8*l).stroke(r).fill(r).opacity(.9).move(c-1,u).insertBefore(n),n}createElementID(t,s){return t+"_"+s+"_"+this.ID_SCENARIOLABEL}}const h={ac:1,pp:2,fc:3,pl:4};var n;!function(t){t[t.Above=0]="Above",t[t.Below=1]="Below",t[t.Left=2]="Left",t[t.Right=3]="Right"}(n||(n={}));class o{constructor(){this.labels=[],this.scenarioLabels=[]}clear(){this.labels=[],this.scenarioLabels=[]}register(t){this.labels.push(t)}hasCollision(t){return this.labels.some((s=>this.intersects(t,s)))}getOptimalPlacement(t,s,i,e,r,n,o,a){const l=h[o]||99,c=n/2;for(const h of a){const n=this.calculatePlacementForDirection(t,s,i,e,r,c,8,h);if(!this.hasCollision(n.bounds))return n}for(const h of a){const n=this.calculatePlacementForDirection(t,s,i,e,r,c,8,h);if(!this.collidesWithHigherPriority(n.bounds,l))return n}return null}calculatePlacementForDirection(t,s,i,r,h,o,a,l){let c,u,f,m,p,b;switch(l){case n.Above:c=t,u=s-o-a,f=e.Bottom,m=e.Center,p=t-i/2,b=s-o-a-r;break;case n.Below:c=t,u=s+o+a,f=e.Top,m=e.Center,p=t-i/2,b=s+o+a-r/4;break;case n.Left:c=t-o-a,u=s,f=e.Center,m=e.Right,p=t-o-a-i,b=s-.6*r;break;case n.Right:c=t+o+a,u=s,f=e.Center,m=e.Left,p=t+o+a,b=s-.6*r}return{labelX:c,labelY:u,verticalHook:f,horizontalHook:m,bounds:{x:p,y:b,width:i,height:r,pointIndex:h,preferredHook:f}}}collidesWithHigherPriority(t,s){return this.labels.some((i=>!!i.scenarioType&&((h[i.scenarioType]||99)<s&&this.intersects(t,i))))}shouldHideScenarioLabel(t,s,i,e=20){const r=h[i]||99;return!(r<=1)&&this.scenarioLabels.some((i=>{if((h[i.scenarioType]||99)>=r)return!1;const n=Math.abs(s-i.y),o=Math.abs(t-i.x);return n<e&&o<e}))}registerScenarioLabel(t,s,i){this.scenarioLabels.push({x:t,y:s,scenarioType:i})}intersects(t,s){return!(t.x+t.width<s.x||s.x+s.width<t.x||t.y+t.height<s.y||s.y+s.height<t.y)}getLabelCount(){return this.labels.length}}export{e as H,o as L,h as S,r as a,n as b}
|
|
1
|
+
import{S as t}from"./SiPrefix.js";import{F as s}from"./formatter.js";import"./CompareUtil.js";import{g as i}from"./stackColors.js";var e;!function(t){t[t.Left=0]="Left",t[t.Center=1]="Center",t[t.Right=2]="Right",t[t.Top=3]="Top",t[t.Bottom=4]="Bottom"}(e||(e={}));class r{constructor(t,s,i,r,h,n,o,a){this.ID_SCENARIOLABEL="Label",this.CSS_CATEGORIES="categories",this.isRelativeLabel=!1,this.segmentFillColor=null,this.x=s,this.y=i,this.value=h,this.group=t.group().id(this.createElementID(t.toString(),r)),this.styles=n,this.isVarianceLabel=!1,this.verticalHookLocation=o||e.Top,this.horizontalHookLocation=a||e.Left}setToVarianceLabel(){return this.isVarianceLabel=!0,this}setToRelativeVarianceLabel(){return this.isVarianceLabel=!0,this.isRelativeLabel=!0,this}setSegmentFill(t){return this.segmentFillColor=t,this}updateGroup(t){return this.group=t,this}draw(i=!0,e={percent:2,decimal:1},r=new t){if(this.isEmpty())return this;const h=this.group;let n,o="";if(!1===Number.isNaN(Number(this.value))){let t="percent",i=e.percent,h=e.percent,a=1;!1===this.isRelativeLabel&&(i=e.decimal,h=e.decimal,a=r.value,t="decimal"),n=s.number(Number(this.value),t,i,h,a,this.styles.locale),this.isVarianceLabel&&Number(this.value)>=0&&(o="+")}else n=""+this.value;const a=this.drawLabel(h,o+n);return!1===i&&(a.addClass("hide"),h.addClass("hide")),this}isEmpty(){return null==this.value||""===this.value}setPos(t,s){return this.x=t,this.y=s,this}forceStringTypeDraw(){return this.drawLabel(this.group,""+this.value),this}drawLabel(t,s){const r=this.styles.fontStyles.background||"#ffffff";let h="start";const n=t.text(s);n.move(this.x,this.y);const o=n.bbox(),a=o.w,l=o.h;let c=0,u=0;const f=n.x();let m=n.y();return this.horizontalHookLocation===e.Left?(h="left",c=n.x()):this.horizontalHookLocation===e.Center?(h="middle",c=n.x()-(a+2)/2):this.horizontalHookLocation===e.Right&&(h="end",c=n.x()-a),this.verticalHookLocation===e.Center?(m=n.y()-1.2*l/2,u=m+.2*l):this.verticalHookLocation===e.Top?(m-=l/4,u=m+.2*l):this.verticalHookLocation===e.Bottom&&(m-=l,u=m+.2*l),n.move(f,m),n.font({anchor:h}),null!=this.segmentFillColor?n.fill(i(this.segmentFillColor)):t.rect(a+2,.8*l).stroke(r).fill(r).opacity(.9).move(c-1,u).insertBefore(n),n}createElementID(t,s){return t+"_"+s+"_"+this.ID_SCENARIOLABEL}}const h={ac:1,pp:2,fc:3,pl:4};var n;!function(t){t[t.Above=0]="Above",t[t.Below=1]="Below",t[t.Left=2]="Left",t[t.Right=3]="Right"}(n||(n={}));class o{constructor(){this.labels=[],this.scenarioLabels=[]}clear(){this.labels=[],this.scenarioLabels=[]}register(t){this.labels.push(t)}hasCollision(t){return this.labels.some((s=>this.intersects(t,s)))}getOptimalPlacement(t,s,i,e,r,n,o,a){const l=h[o]||99,c=n/2;for(const h of a){const n=this.calculatePlacementForDirection(t,s,i,e,r,c,8,h);if(!this.hasCollision(n.bounds))return n}for(const h of a){const n=this.calculatePlacementForDirection(t,s,i,e,r,c,8,h);if(!this.collidesWithHigherPriority(n.bounds,l))return n}return null}calculatePlacementForDirection(t,s,i,r,h,o,a,l){let c,u,f,m,p,b;switch(l){case n.Above:c=t,u=s-o-a,f=e.Bottom,m=e.Center,p=t-i/2,b=s-o-a-r;break;case n.Below:c=t,u=s+o+a,f=e.Top,m=e.Center,p=t-i/2,b=s+o+a-r/4;break;case n.Left:c=t-o-a,u=s,f=e.Center,m=e.Right,p=t-o-a-i,b=s-.6*r;break;case n.Right:c=t+o+a,u=s,f=e.Center,m=e.Left,p=t+o+a,b=s-.6*r}return{labelX:c,labelY:u,verticalHook:f,horizontalHook:m,bounds:{x:p,y:b,width:i,height:r,pointIndex:h,preferredHook:f}}}collidesWithHigherPriority(t,s){return this.labels.some((i=>!!i.scenarioType&&((h[i.scenarioType]||99)<s&&this.intersects(t,i))))}shouldHideScenarioLabel(t,s,i,e=20){const r=h[i]||99;return!(r<=1)&&this.scenarioLabels.some((i=>{if((h[i.scenarioType]||99)>=r)return!1;const n=Math.abs(s-i.y),o=Math.abs(t-i.x);return n<e&&o<e}))}registerScenarioLabel(t,s,i){this.scenarioLabels.push({x:t,y:s,scenarioType:i})}intersects(t,s){return!(t.x+t.width<s.x||s.x+s.width<t.x||t.y+t.height<s.y||s.y+s.height<t.y)}getLabelCount(){return this.labels.length}}export{e as H,o as L,h as S,r as a,n as b}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
class t{constructor(t,s,i,h){this.domainMin=t,this.domainMax=s,this.rangeMin=i,this.rangeMax=h}scale(t){const s=this.domainMax-this.domainMin;return 0===s?(this.rangeMin+this.rangeMax)/2:this.rangeMin+(t-this.domainMin)/s*(this.rangeMax-this.rangeMin)}static domain(t,s,i,h=.04){let
|
|
1
|
+
class t{constructor(t,s,i,h){this.domainMin=t,this.domainMax=s,this.rangeMin=i,this.rangeMax=h}scale(t){const s=this.domainMax-this.domainMin;return 0===s?(this.rangeMin+this.rangeMax)/2:this.rangeMin+(t-this.domainMin)/s*(this.rangeMax-this.rangeMin)}static domain(t,s,i,h=.04){let r=s-t;if(0===r){const i=0===t?1:.1*Math.abs(t);r=(s+=i)-(t-=i)}return[void 0!==(null==i?void 0:i.min)?i.min:t-r*h,void 0!==(null==i?void 0:i.max)?i.max:s+r*h]}static niceStep(t,s){if(t<=0||s<=0)return 1;const i=t/s,h=Math.pow(10,Math.floor(Math.log10(i))),r=i/h;let e;return e=r<=1?1:r<=2?2:r<=2.5?2.5:r<=5?5:10,e*h}ticks(s){const i=this.domainMax-this.domainMin;if(i<=0)return[this.domainMin];const h=t.niceStep(i,s),r=Math.ceil(this.domainMin/h)*h;if(r+h===r||h<Math.pow(10,-15))return[this.domainMin];const e=t.stepDecimals(h),n=Math.floor((this.domainMax+1e-9*h-r)/h)+1,a=[];for(let t=0;t<n;t++){const s=Number((r+t*h).toFixed(e)),i=0===s?0:s;0!==a.length&&i===a[a.length-1]||a.push(i)}return a}static stepDecimals(t){if(!Number.isFinite(t)||t<=0)return 0;for(let s=0;s<15;s++){const i=t*Math.pow(10,s),h=Math.round(i);if(h>=1&&Math.abs(i-h)<1e-9*h)return s}return 15}static tickDecimals(s){return 0===s.length?0:t.stepDecimals(1===s.length?Math.abs(s[0]):(s[s.length-1]-s[0])/(s.length-1))}}export{t as N}
|
package/dist/components/Order.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{C as a}from"./CompareUtil.js";class t{static adaptDefaultString(t){return a.isString(t)?t.trim():""}static adaptArray(t,r){const c=[];return a.isArray(t)&&t.forEach((a=>{c.push(r.adapt(a))})),c}}var r,c;!function(a){a.ASC="asc",a.DESC="desc"}(r||(r={})),function(a){a.ROWGROUP="rowGroup",a.ROWGROUPINDEX="rowGroupIndex",a.CATEGORY="category",a.CATEGORYINDEX="categoryIndex",a.SUBCATEGORY="subCategory",a.SUBCATEGORYINDEX="subCategoryIndex",a.AC1="ac1",a.AC2="ac2",a.AC3="ac3",a.AC4="ac4",a.PP1="pp1",a.PP2="pp2",a.PP3="pp3",a.PP4="pp4",a.FC1="fc1",a.FC2="fc2",a.FC3="fc3",a.FC4="fc4",a.PL1="pl1",a.PL2="pl2",a.PL3="pl3",a.PL4="pl4"}(c||(c={}));class s{constructor(a=["category"],t=r.ASC){this.hierarchy=a,this.direction=t}}class o{constructor(a){this.stringAdapter=a}adapt(a){var o;const e=t.adaptArray(a.hierarchy,this.stringAdapter),p=r[null===(o=a.direction)||void 0===o?void 0:o.toUpperCase()]||r.ASC;return new s(e.map((a=>c[a.toUpperCase()]||c.CATEGORY)),p)}default(){return new s(["category"],r.ASC)}}export{t as A,
|
|
1
|
+
import{C as a}from"./CompareUtil.js";class t{static adaptDefaultString(t){return a.isString(t)?t.trim():""}static adaptArray(t,r){const c=[];return a.isArray(t)&&t.forEach((a=>{c.push(r.adapt(a))})),c}}var r,c;!function(a){a.ASC="asc",a.DESC="desc"}(r||(r={})),function(a){a.ROWGROUP="rowGroup",a.ROWGROUPINDEX="rowGroupIndex",a.CATEGORY="category",a.CATEGORYINDEX="categoryIndex",a.SUBCATEGORY="subCategory",a.SUBCATEGORYINDEX="subCategoryIndex",a.AC1="ac1",a.AC2="ac2",a.AC3="ac3",a.AC4="ac4",a.PP1="pp1",a.PP2="pp2",a.PP3="pp3",a.PP4="pp4",a.FC1="fc1",a.FC2="fc2",a.FC3="fc3",a.FC4="fc4",a.PL1="pl1",a.PL2="pl2",a.PL3="pl3",a.PL4="pl4"}(c||(c={}));class s{constructor(a=["category"],t=r.ASC){this.hierarchy=a,this.direction=t}}class o{constructor(a){this.stringAdapter=a}adapt(a){var o;const e=t.adaptArray(a.hierarchy,this.stringAdapter),p=r[null===(o=a.direction)||void 0===o?void 0:o.toUpperCase()]||r.ASC;return new s(e.map((a=>c[a.toUpperCase()]||c.CATEGORY)),p)}default(){return new s(["category"],r.ASC)}}export{t as A,c as O,r as a,s as b,o as c}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{C as e}from"./CompareUtil.js";function t(e){return"fc"===e||"hatched"===e?"hatched":"solid"===e||"outlined"===e?e:void 0}class n{constructor(e="#000000",t="#000000",n=.1){this.stroke=e,this.fill=t,this.width=n}}class r{adapt(r){const f=new n(r.stroke,r.fill,r.width);return f.fillpattern=t(r.fillpattern),"outlined"===f.fillpattern&&(f.fill="transparent"),e.isString(r.dasharray)&&(f.dasharray=r.dasharray),f}default(){return new n("#000000","#000000",.3)}defaultAC(){return new n("#000000","#000000",.3)}defaultFC(){const e=new n("#000000","#000000",.3);return e.dasharray="10 5 5 5",e.fillpattern="hatched",e}defaultPP(){return new n("#999999","#999999",.3)}defaultPL(){return new n("#000000","#ffffff",.3)}defaultPos(){return new n("#00ff00","#00ff00",.3)}defaultNeg(){return new n("#ff0000","#ff0000",.3)}defaultNeu(){return new n("#999999","#999999",.3)}}export{r as S,t as n}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
const t=/^\s*(set|first|last|min|max|avg|sum|lit)\(\s*(.*?)\s*\)\s*$/,s=/^[A-Za-z_][A-Za-z0-9_]*$/,n=["min","max","avg","sum"];class i{constructor(t,s,n,i){this.label=t,this.alias=s,this.fn=n,this.arg=i}get isNumeric(){return n.includes(this.fn)}}function r(n){if("string"!=typeof n)return!1;const i=t.exec(n);if(!i)return!1;const[,r,u]=i;return"lit"===r?u.length>0:s.test(u)}function u(s,n,u){if(!r(u))return null;const[,e,a]=t.exec(u);return new i(s,n,e,a)}export{s as F,r as i,u as p}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{S as n}from"./CompareUtil.js";const t=/^(dr|d)((?:ac|pp|fc|pl)[1-4])_((?:ac|pp|fc|pl)[1-4])(?:_(pos|neg|neu))?$/;class
|
|
1
|
+
import{S as n}from"./CompareUtil.js";import{r}from"./relativeVariance.js";const t=/^(dr|d)((?:ac|pp|fc|pl)[1-4])_((?:ac|pp|fc|pl)[1-4])(?:_(pos|neg|neu))?$/;class i{constructor(n,r,t){this.type=n,this.base=r,this.delta=t}static parse(n){const r=t.exec(n);return null===r?null:new i(r[1],r[2],r[3])}compute(n,t){var i;return null==n||null==t?null:"dr"===this.type?0===t?null:null!==(i=r(n-t,t))&&void 0!==i?i:null:n-t}}function l(r){const t=r.trim();if(Object.values(n).includes(t))return{kind:"scenario",slot:t};const l=i.parse(t);return null!==l?{kind:"variance",measure:l}:null}function o(n){return n.replace(/\d+$/,"")}function u(n){return n.replace(/^[a-z]+/,"")}function e(n){var r;return"dr"===(null===(r=i.parse(n.trim()))||void 0===r?void 0:r.type)}function s(n){if(!e(n.measure))return n;const r=n=>void 0===n?void 0:n/100;return Object.assign(Object.assign({},n),{min:r(n.min),max:r(n.max),refLine:r(n.refLine),highlight:n.highlight&&{from:r(n.highlight.from),to:r(n.highlight.to)}})}export{s as a,u as b,e as i,l as r,o as s}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{C as t}from"./CompareUtil.js";import{X as s}from"./context-protocol.js";import{L as i,H as n}from"./LabelCollisionManager.js";import{F as o,C as e}from"./formatter.js";import{D as r}from"./luxon.js";import{a as h}from"./VarianceMeasure.js";class l{constructor(t,i,n,o){this.scaleFactors=t,this.fontStyles=i,this.axisStyles=n,this.padding=o,this.seriesColors=[...s]}}class a{constructor(t,s,i,n){this.scaleFactorsXYChartAdapter=t,this.fontStyleAdapter=s,this.svgStyleGroupAdapter=i,this.paddingAdapter=n}adapt(s){const i=this.default();return t.isExisting(s)&&(t.isExisting(s.scaleFactors)&&(i.scaleFactors=this.scaleFactorsXYChartAdapter.adapt(s.scaleFactors)),t.isExisting(s.fontStyles)&&(i.fontStyles=this.fontStyleAdapter.adapt(s.fontStyles)),t.isExisting(s.axisStyles)&&(i.axisStyles=this.svgStyleGroupAdapter.adapt(s.axisStyles)),t.isExisting(s.padding)&&(i.padding=this.paddingAdapter.adapt(s.padding)),Array.isArray(s.seriesColors)&&s.seriesColors.length>0&&(i.seriesColors=s.seriesColors)),i}default(){return new l(this.scaleFactorsXYChartAdapter.default(),this.fontStyleAdapter.default(),this.svgStyleGroupAdapter.default(),this.paddingAdapter.default())}}class c{constructor(){this.pointRadius=.4,this.bubbleMaxRadius=3.2,this.bubbleMinRadius=.35,this.axisTickLength=.35,this.labelToMark=.3,this.legendSwatch=.9,this.panelGap=1.6,this.refLineWidth=1,this.gridLineWidth=1}}class u{adapt(s){const i=new c;return t.isNumber(s.pointRadius)&&(i.pointRadius=s.pointRadius),t.isNumber(s.bubbleMaxRadius)&&(i.bubbleMaxRadius=s.bubbleMaxRadius),t.isNumber(s.bubbleMinRadius)&&(i.bubbleMinRadius=s.bubbleMinRadius),t.isNumber(s.axisTickLength)&&(i.axisTickLength=s.axisTickLength),t.isNumber(s.labelToMark)&&(i.labelToMark=s.labelToMark),t.isNumber(s.legendSwatch)&&(i.legendSwatch=s.legendSwatch),t.isNumber(s.panelGap)&&(i.panelGap=s.panelGap),t.isNumber(s.refLineWidth)&&(i.refLineWidth=s.refLineWidth),t.isNumber(s.gridLineWidth)&&(i.gridLineWidth=s.gridLineWidth),i}default(){return new c}}class f{constructor(t,s,i,n){this.count=t,this.drawingRect=i,this.panelGapPx=n,this.columns=Math.max(1,Math.min(null!=s?s:t,t)),this.rows=Math.max(1,Math.ceil(t/this.columns))}panelRect(t){const s=t%this.columns,i=Math.floor(t/this.columns),n=(this.drawingRect.width-(this.columns-1)*this.panelGapPx)/this.columns,o=(this.drawingRect.height-(this.rows-1)*this.panelGapPx)/this.rows;return{x:this.drawingRect.x+s*(n+this.panelGapPx),y:this.drawingRect.y+i*(o+this.panelGapPx),width:n,height:o}}isOuterLeft(t){return t%this.columns==0}isOuterBottom(t){return t+this.columns>=this.count}}const d=["n","ne","e","se","s","sw","w","nw"],v=Math.SQRT1_2;class m{constructor(t,s,n=new i){this.frame=t,this.gapPx=s,this.manager=n}registerMark(t,s,i){this.manager.register(this.bounds(t-i,s-i,2*i,2*i))}selectCandidates(t,s,i,n){if("none"===s)return{selected:[],unknownNames:[]};if("all"===s)return{selected:[...t],unknownNames:[]};if("auto"===s)return{selected:t.slice(0,i),unknownNames:[]};const o=new Set(s),e=t.filter((t=>o.has(n(t)))),r=new Set(e.map((t=>n(t))));return{selected:e,unknownNames:s.filter((t=>!r.has(t)))}}place(t){const s=[];for(const i of t)for(const t of d){const n=this.anchorBox(i,t);if(!this.insideFrame(n.x,n.y,i.width,i.height))continue;const o=this.bounds(n.x,n.y,i.width,i.height);if(!this.manager.hasCollision(o)){this.manager.register(o),s.push({candidate:i,x:n.x,y:n.y,anchor:t});break}}return s}anchorBox(t,s){const i=t.r+this.gapPx,n=t.r*v+.5*this.gapPx;switch(s){case"n":return{x:t.cx-t.width/2,y:t.cy-i-t.height};case"ne":return{x:t.cx+n,y:t.cy-n-t.height};case"e":return{x:t.cx+i,y:t.cy-t.height/2};case"se":return{x:t.cx+n,y:t.cy+n};case"s":return{x:t.cx-t.width/2,y:t.cy+i};case"sw":return{x:t.cx-n-t.width,y:t.cy+n};case"w":return{x:t.cx-i-t.width,y:t.cy-t.height/2};case"nw":return{x:t.cx-n-t.width,y:t.cy-n-t.height}}}insideFrame(t,s,i,n){return t>=this.frame.x&&s>=this.frame.y&&t+i<=this.frame.x+this.frame.width&&s+n<=this.frame.y+this.frame.height}bounds(t,s,i,o){return{x:t,y:s,width:i,height:o,pointIndex:0,preferredHook:n.Center}}}class w{constructor(t,s,i,n){this.xScale=t,this.yScale=s,this.rect=i,this.styles=n}get em(){return this.styles.fontStyles.size}fontFamily(){return this.styles.fontStyles.font.replace(/^[\d.]+px\s*/,"")}drawBands(t,s,i){var n,o,e,r;const h=this.styles.axisStyles.pl.fill;if(void 0!==s&&(void 0!==s.from||void 0!==s.to)){const i=this.xScale.scale(null!==(n=s.from)&&void 0!==n?n:this.xScale.domainMin),e=this.xScale.scale(null!==(o=s.to)&&void 0!==o?o:this.xScale.domainMax);t.rect(Math.abs(e-i),this.rect.height).move(Math.min(i,e),this.rect.y).fill(h)}if(void 0!==i&&(void 0!==i.from||void 0!==i.to)){const s=this.yScale.scale(null!==(e=i.from)&&void 0!==e?e:this.yScale.domainMin),n=this.yScale.scale(null!==(r=i.to)&&void 0!==r?r:this.yScale.domainMax);t.rect(this.rect.width,Math.abs(s-n)).move(this.rect.x,Math.min(s,n)).fill(h)}}drawGrid(t,s,i){const n={color:this.styles.axisStyles.pp.stroke,width:this.styles.scaleFactors.gridLineWidth};for(const i of s){const s=this.yScale.scale(i);t.line(this.rect.x,s,this.rect.x+this.rect.width,s).stroke(n)}if(void 0!==i)for(const s of i){const i=this.xScale.scale(s);t.line(i,this.rect.y,i,this.rect.y+this.rect.height).stroke(n)}}drawRefLines(t,s,i){const n={color:this.styles.axisStyles.fc.stroke,width:this.styles.scaleFactors.refLineWidth};if(void 0!==s){const i=this.xScale.scale(s);t.line(i,this.rect.y,i,this.rect.y+this.rect.height).stroke(n)}if(void 0!==i){const s=this.yScale.scale(i);t.line(this.rect.x,s,this.rect.x+this.rect.width,s).stroke(n)}}drawFrame(t){t.rect(this.rect.width,this.rect.height).move(this.rect.x,this.rect.y).fill("none").stroke({color:this.styles.axisStyles.ac.stroke,width:this.styles.scaleFactors.gridLineWidth})}drawTickLabels(t,s){const i=this.styles.scaleFactors.axisTickLength*this.em,n={size:this.styles.fontStyles.size,anchor:"start"},e=this.fontFamily(),r=this.styles.fontStyles.color;if(s.showXLabels)for(const h of s.ticksX){const l=this.xScale.scale(h);t.text(o.number(h,"decimal",s.xDecimals,s.xDecimals)).font(Object.assign(Object.assign({},n),{anchor:"middle"})).fill(r).attr({x:l,y:this.rect.y+this.rect.height+i+.8*this.em,"font-family":e})}if(s.showYLabels)for(const h of s.ticksY){const l=this.yScale.scale(h);t.text(o.number(h,"decimal",s.yDecimals,s.yDecimals)).font(Object.assign(Object.assign({},n),{anchor:"end"})).fill(r).attr({x:this.rect.x-i,y:l+.35*this.em,"font-family":e})}}drawPanelTitle(t,s){""!==s&&t.text(s).font({size:this.styles.fontStyles.size,weight:"bold",anchor:"start"}).fill(this.styles.fontStyles.color).attr({x:this.rect.x+.5*this.em,y:this.rect.y+1.2*this.em,"font-family":this.fontFamily()})}}class x{constructor(t){this.styles=t}get em(){return this.styles.fontStyles.size}get rowHeight(){return 1.5*this.em}get swatchSize(){return this.styles.scaleFactors.legendSwatch*this.em}textWidth(t,s=!1){const i=e(t,{font:this.styles.fontStyles.font,fontSize:this.styles.fontStyles.size+"px",fontWeight:s?"bold":"normal"}).width;return Number.isFinite(i)&&i>0?i:.6*t.length*this.em}rows(t){const s=[];t.sizeCaption.forEach(((t,i)=>{s.push({text:t,bold:0===i,treatment:null})})),null!==t.title&&""!==t.title&&s.push({text:t.title,bold:!0,treatment:null});for(const i of t.compareEntries)s.push({text:i.label,bold:!1,treatment:i.treatment});for(const i of t.entries)s.push({text:i.label,bold:!1,treatment:i.treatment});return s}measure(t,s){const i=this.rows(t);if(0===i.length)return{width:0,height:0};const n=this.swatchSize+.4*this.em;if("bottom"===s){let t=0;for(const s of i)t+=(null!==s.treatment?n:0)+this.textWidth(s.text,s.bold)+1.5*this.em;return{width:t,height:this.rowHeight}}let o=0;for(const t of i)o=Math.max(o,(null!==t.treatment?n:0)+this.textWidth(t.text,t.bold));return{width:o,height:i.length*this.rowHeight}}draw(t,s,i,n,o){const e=this.rows(s),r=this.swatchSize+.4*this.em;let h=i,l=n;for(const s of e){let i=h;if(null!==s.treatment){const n=t.circle(this.swatchSize).move(h,l+(this.rowHeight-this.swatchSize)/2).fill(s.treatment.hatch?"#ffffff":s.treatment.fill).stroke({color:"#ffffff"===s.treatment.stroke?s.treatment.fill:s.treatment.stroke,width:s.treatment.strokeWidth});void 0!==s.treatment.dasharray&&n.attr("stroke-dasharray",s.treatment.dasharray),i+=r}t.text(s.text).font({size:this.styles.fontStyles.size,weight:s.bold?"bold":"normal",anchor:"start"}).fill(this.styles.fontStyles.color).attr({x:i,y:l+this.rowHeight/2+.35*this.em,"font-family":this.fontFamily()}),"bottom"===o?h=i+this.textWidth(s.text,s.bold)+1.5*this.em:l+=this.rowHeight}}fontFamily(){return this.styles.fontStyles.font.replace(/^[\d.]+px\s*/,"")}}class p{constructor(){this.operation="+",this.custom={},this.counts={}}slotValue(s){const i=this[s];return t.isNumber(i)?i:null}slotHasNoData(t){return 0===this.counts[t]}}const y=["ac1","ac2","ac3","ac4","pp1","pp2","pp3","pp4","fc1","fc2","fc3","fc4","pl1","pl2","pl3","pl4"];class b{adapt(s){const i=new p;if(t.isOperator(s.operation)&&(i.operation=s.operation),t.isString(s.date)){const t=r.fromISO(s.date);i.date=t.isValid?t:void 0}t.isString(s.rowGroup)&&t.isNumber(s.rowGroupIndex)&&(i.rowGroup=s.rowGroup,i.rowGroupIndex=s.rowGroupIndex),t.isString(s.category)&&t.isNumber(s.categoryIndex)&&(i.category=s.category,i.categoryIndex=s.categoryIndex),t.isString(s.subCategory)&&t.isNumber(s.subCategoryIndex)&&(i.subCategory=s.subCategory,i.subCategoryIndex=s.subCategoryIndex),t.isString(s.columnGroup)&&t.isNumber(s.columnGroupIndex)&&(i.columnGroup=s.columnGroup,i.columnGroupIndex=s.columnGroupIndex),t.isString(s.columnSubGroup)&&t.isNumber(s.columnSubGroupIndex)&&(i.columnSubGroup=s.columnSubGroup,i.columnSubGroupIndex=s.columnSubGroupIndex);for(const n of y){t.isNumber(s[n])&&(i[n]=s[n]);const o=s[`${n}_cnt`];t.isNumber(o)&&(i.counts[n]=o)}for(const t of Object.keys(s))t.startsWith("_")&&(i.custom[t]=s[t]);return i}default(){return new p}}const g={rowGroup:"rowGroupIndex",category:"categoryIndex",subCategory:"subCategoryIndex"};function M(t,s){if("scenario"===s.kind)return{value:t.slotValue(s.slot),varianceNoData:!1};if(t.slotHasNoData(s.measure.base)||t.slotHasNoData(s.measure.delta))return{value:null,varianceNoData:!0};const i=s.measure.compute(t.slotValue(s.measure.base),t.slotValue(s.measure.delta));return{value:i,varianceNoData:null===i}}function N(t,s){return void 0!==s&&(void 0!==s.min&&t<s.min||void 0!==s.max&&t>s.max)}function S(t,s){return"scenario"!==t.kind?null:s+h(t.slot)}function j(t,s){var i,n,o,e,r,h,l,a,c;const u=[],f=new Set,d=[];let v=0,m=0,w=0,x=0,p=0;const y=new Map,b=new Map,j=new Map,k=null!==(i=s.compareFamily)&&void 0!==i?i:null,z=null!==k?S(s.measures.x,k):null,C=null!==k?S(s.measures.y,k):null,O=null!==k&&void 0!==s.measures.size?S(s.measures.size,k):null;for(const i of t){const t=i[s.pointLevel];if(null==t||""===t)continue;const u=null!==(n=null!==s.facetLevel?i[s.facetLevel]:"")&&void 0!==n?n:"",S=null!==(o=null!==s.seriesLevel?i[s.seriesLevel]:"")&&void 0!==o?o:"",k=`${u}\0${t}`;if(f.has(k)){v++,d.length<5&&!d.includes(t)&&d.push(t);continue}const F=M(i,s.measures.x),D=M(i,s.measures.y);if(null===F.value||null===D.value){(F.varianceNoData||D.varianceNoData)&&m++;continue}if(N(F.value,null===(e=s.domains)||void 0===e?void 0:e.x)||N(D.value,null===(r=s.domains)||void 0===r?void 0:r.y)){w++;continue}const L={name:t,seriesKey:S,facetKey:u,x:F.value,y:D.value,row:i};if(void 0!==s.measures.size){const t=M(i,s.measures.size).value;if(null===t)continue;if(t<0){x++;continue}L.size=t}if(void 0!==s.measures.share){const t=M(i,s.measures.share).value;null!==t&&(t<0||t>1?(p++,L.share=Math.min(1,Math.max(0,t))):L.share=t)}if(null!==z&&null!==C){const t=i.slotValue(z),n=i.slotValue(C),o=null!==O?i.slotValue(O):null;null===t||null===n||null!==O&&null===o?L.compare=null:N(t,null===(h=s.domains)||void 0===h?void 0:h.x)||N(n,null===(l=s.domains)||void 0===l?void 0:l.y)?(w++,L.compare=null):(L.compare={x:t,y:n},null!==o&&(L.compare.size=o))}if(f.add(k),j.has(u)||j.set(u,[]),j.get(u).push(L),null!==s.facetLevel){const t=i[g[s.facetLevel]];null!=t&&t<(null!==(a=y.get(u))&&void 0!==a?a:Number.POSITIVE_INFINITY)&&y.set(u,t)}if(null!==s.seriesLevel){const t=i[g[s.seriesLevel]];null!=t&&t<(null!==(c=b.get(S))&&void 0!==c?c:Number.POSITIVE_INFINITY)&&b.set(S,t)}}const F=[...j.keys()].sort(((t,s)=>{var i,n;return(null!==(i=y.get(t))&&void 0!==i?i:Number.MAX_SAFE_INTEGER)-(null!==(n=y.get(s))&&void 0!==n?n:Number.MAX_SAFE_INTEGER)})),D=F.map((t=>{let i=j.get(t);return s.limit>0&&i.length>s.limit&&(i="size"===s.limitBy?[...i].sort(((t,s)=>{var i,n;return(null!==(i=s.size)&&void 0!==i?i:0)-(null!==(n=t.size)&&void 0!==n?n:0)})).slice(0,s.limit):i.slice(0,s.limit)),{key:t,points:i}})),L=new Set;for(const t of D)for(const s of t.points)L.add(s.seriesKey);const H=[...L].sort(((t,s)=>{var i,n;return(null!==(i=b.get(t))&&void 0!==i?i:Number.MAX_SAFE_INTEGER)-(null!==(n=b.get(s))&&void 0!==n?n:Number.MAX_SAFE_INTEGER)})).map(((t,s)=>({key:t,index:s})));let I=null,B=0;for(const t of D)for(const s of t.points){B++;const t=[s.x],i=[s.y],n=void 0!==s.size?[s.size]:[];null!=s.compare&&(t.push(s.compare.x),i.push(s.compare.y),void 0!==s.compare.size&&n.push(s.compare.size)),null===I&&(I={xMin:t[0],xMax:t[0],yMin:i[0],yMax:i[0],sizeMax:0});for(const s of t)I.xMin=Math.min(I.xMin,s),I.xMax=Math.max(I.xMax,s);for(const t of i)I.yMin=Math.min(I.yMin,t),I.yMax=Math.max(I.yMax,t);for(const t of n)I.sizeMax=Math.max(I.sizeMax,t)}return v>0&&u.push({code:"xy-duplicate-point",data:{count:String(v),names:d.join(", ")}}),m>0&&u.push({code:"xy-variance-nodata",data:{count:String(m)}}),w>0&&u.push({code:"xy-point-clipped",data:{count:String(w)}}),x>0&&u.push({code:"bubble-size-negative",data:{count:String(x)}}),p>0&&u.push({code:"bubble-share-range",data:{count:String(p)}}),B>5e3&&u.push({code:"xy-point-budget",data:{count:String(B)}}),{facets:D,series:H,extents:I,warnings:u,totalPoints:B}}export{f as F,m as P,u as S,b as X,x as a,w as b,a as c,j as r}
|
|
1
|
+
import{C as t}from"./CompareUtil.js";import{X as s}from"./context-protocol.js";import{L as i,H as n}from"./LabelCollisionManager.js";import{F as o,C as e}from"./formatter.js";import{N as r}from"./NumericScale.js";import{D as h}from"./luxon.js";import{b as l}from"./VarianceMeasure.js";class a{constructor(t,i,n,o){this.scaleFactors=t,this.fontStyles=i,this.axisStyles=n,this.padding=o,this.seriesColors=[...s],this.locale="de"}}class c{constructor(t,s,i,n){this.scaleFactorsXYChartAdapter=t,this.fontStyleAdapter=s,this.svgStyleGroupAdapter=i,this.paddingAdapter=n}adapt(s){const i=this.default();return t.isExisting(s)&&(t.isExisting(s.scaleFactors)&&(i.scaleFactors=this.scaleFactorsXYChartAdapter.adapt(s.scaleFactors)),t.isExisting(s.fontStyles)&&(i.fontStyles=this.fontStyleAdapter.adapt(s.fontStyles)),t.isExisting(s.axisStyles)&&(i.axisStyles=this.svgStyleGroupAdapter.adapt(s.axisStyles)),t.isExisting(s.padding)&&(i.padding=this.paddingAdapter.adapt(s.padding)),Array.isArray(s.seriesColors)&&s.seriesColors.length>0&&(i.seriesColors=s.seriesColors)),i}default(){return new a(this.scaleFactorsXYChartAdapter.default(),this.fontStyleAdapter.default(),this.svgStyleGroupAdapter.default(),this.paddingAdapter.default())}}class u{constructor(){this.pointRadius=.4,this.bubbleMaxRadius=3.2,this.bubbleMinRadius=.35,this.axisTickLength=.35,this.labelToMark=.3,this.legendSwatch=.9,this.panelGap=1.6,this.refLineWidth=1,this.gridLineWidth=1}}class f{adapt(s){const i=new u;return t.isNumber(s.pointRadius)&&(i.pointRadius=s.pointRadius),t.isNumber(s.bubbleMaxRadius)&&(i.bubbleMaxRadius=s.bubbleMaxRadius),t.isNumber(s.bubbleMinRadius)&&(i.bubbleMinRadius=s.bubbleMinRadius),t.isNumber(s.axisTickLength)&&(i.axisTickLength=s.axisTickLength),t.isNumber(s.labelToMark)&&(i.labelToMark=s.labelToMark),t.isNumber(s.legendSwatch)&&(i.legendSwatch=s.legendSwatch),t.isNumber(s.panelGap)&&(i.panelGap=s.panelGap),t.isNumber(s.refLineWidth)&&(i.refLineWidth=s.refLineWidth),t.isNumber(s.gridLineWidth)&&(i.gridLineWidth=s.gridLineWidth),i}default(){return new u}}class d{constructor(t,s,i,n){this.count=t,this.drawingRect=i,this.panelGapPx=n,this.columns=Math.max(1,Math.min(null!=s?s:t,t)),this.rows=Math.max(1,Math.ceil(t/this.columns))}panelRect(t){const s=t%this.columns,i=Math.floor(t/this.columns),n=(this.drawingRect.width-(this.columns-1)*this.panelGapPx)/this.columns,o=(this.drawingRect.height-(this.rows-1)*this.panelGapPx)/this.rows;return{x:this.drawingRect.x+s*(n+this.panelGapPx),y:this.drawingRect.y+i*(o+this.panelGapPx),width:n,height:o}}isOuterLeft(t){return t%this.columns==0}isOuterBottom(t){return t+this.columns>=this.count}}function v(t,s,i,n=!1){return o.number(t,n?"percent":"decimal",s,s,1,i)}function m(t,s){return r.tickDecimals(s?t.map((t=>100*t)):t)}const w=["n","ne","e","se","s","sw","w","nw"],p=Math.SQRT1_2;class x{constructor(t,s,n=new i){this.frame=t,this.gapPx=s,this.manager=n}registerMark(t,s,i){this.manager.register(this.bounds(t-i,s-i,2*i,2*i))}selectCandidates(t,s,i,n){if("none"===s)return{selected:[],unknownNames:[]};if("all"===s)return{selected:[...t],unknownNames:[]};if("auto"===s)return{selected:t.slice(0,i),unknownNames:[]};const o=new Set(s),e=t.filter((t=>o.has(n(t)))),r=new Set(e.map((t=>n(t))));return{selected:e,unknownNames:s.filter((t=>!r.has(t)))}}place(t){const s=[];for(const i of t)for(const t of w){const n=this.anchorBox(i,t);if(!this.insideFrame(n.x,n.y,i.width,i.height))continue;const o=this.bounds(n.x,n.y,i.width,i.height);if(!this.manager.hasCollision(o)){this.manager.register(o),s.push({candidate:i,x:n.x,y:n.y,anchor:t});break}}return s}anchorBox(t,s){const i=t.r+this.gapPx,n=t.r*p+.5*this.gapPx;switch(s){case"n":return{x:t.cx-t.width/2,y:t.cy-i-t.height};case"ne":return{x:t.cx+n,y:t.cy-n-t.height};case"e":return{x:t.cx+i,y:t.cy-t.height/2};case"se":return{x:t.cx+n,y:t.cy+n};case"s":return{x:t.cx-t.width/2,y:t.cy+i};case"sw":return{x:t.cx-n-t.width,y:t.cy+n};case"w":return{x:t.cx-i-t.width,y:t.cy-t.height/2};case"nw":return{x:t.cx-n-t.width,y:t.cy-n-t.height}}}insideFrame(t,s,i,n){return t>=this.frame.x&&s>=this.frame.y&&t+i<=this.frame.x+this.frame.width&&s+n<=this.frame.y+this.frame.height}bounds(t,s,i,o){return{x:t,y:s,width:i,height:o,pointIndex:0,preferredHook:n.Center}}}class y{constructor(t,s,i,n){this.xScale=t,this.yScale=s,this.rect=i,this.styles=n}get em(){return this.styles.fontStyles.size}fontFamily(){return this.styles.fontStyles.font.replace(/^[\d.]+px\s*/,"")}drawBands(t,s,i){var n,o,e,r;const h=this.styles.axisStyles.pl.fill;if(void 0!==s&&(void 0!==s.from||void 0!==s.to)){const i=this.xScale.scale(null!==(n=s.from)&&void 0!==n?n:this.xScale.domainMin),e=this.xScale.scale(null!==(o=s.to)&&void 0!==o?o:this.xScale.domainMax);t.rect(Math.abs(e-i),this.rect.height).move(Math.min(i,e),this.rect.y).fill(h)}if(void 0!==i&&(void 0!==i.from||void 0!==i.to)){const s=this.yScale.scale(null!==(e=i.from)&&void 0!==e?e:this.yScale.domainMin),n=this.yScale.scale(null!==(r=i.to)&&void 0!==r?r:this.yScale.domainMax);t.rect(this.rect.width,Math.abs(s-n)).move(this.rect.x,Math.min(s,n)).fill(h)}}drawGrid(t,s,i){const n={color:this.styles.axisStyles.pp.stroke,width:this.styles.scaleFactors.gridLineWidth};for(const i of s){const s=this.yScale.scale(i);t.line(this.rect.x,s,this.rect.x+this.rect.width,s).stroke(n)}if(void 0!==i)for(const s of i){const i=this.xScale.scale(s);t.line(i,this.rect.y,i,this.rect.y+this.rect.height).stroke(n)}}drawRefLines(t,s,i){const n={color:this.styles.axisStyles.fc.stroke,width:this.styles.scaleFactors.refLineWidth};if(void 0!==s){const i=this.xScale.scale(s);t.line(i,this.rect.y,i,this.rect.y+this.rect.height).stroke(n)}if(void 0!==i){const s=this.yScale.scale(i);t.line(this.rect.x,s,this.rect.x+this.rect.width,s).stroke(n)}}drawFrame(t){t.rect(this.rect.width,this.rect.height).move(this.rect.x,this.rect.y).fill("none").stroke({color:this.styles.axisStyles.ac.stroke,width:this.styles.scaleFactors.gridLineWidth})}drawTickLabels(t,s){const i=this.styles.scaleFactors.axisTickLength*this.em,n={size:this.styles.fontStyles.size,anchor:"start"},o=this.fontFamily(),e=this.styles.fontStyles.color;if(s.showXLabels)for(const r of s.ticksX){const h=this.xScale.scale(r);t.text(v(r,s.xDecimals,this.styles.locale,s.xPercent)).font(Object.assign(Object.assign({},n),{anchor:"middle"})).fill(e).attr({x:h,y:this.rect.y+this.rect.height+i+.8*this.em,"font-family":o})}if(s.showYLabels)for(const r of s.ticksY){const h=this.yScale.scale(r);t.text(v(r,s.yDecimals,this.styles.locale,s.yPercent)).font(Object.assign(Object.assign({},n),{anchor:"end"})).fill(e).attr({x:this.rect.x-i,y:h+.35*this.em,"font-family":o})}}drawPanelTitle(t,s){""!==s&&t.text(s).font({size:this.styles.fontStyles.size,weight:"bold",anchor:"start"}).fill(this.styles.fontStyles.color).attr({x:this.rect.x+.5*this.em,y:this.rect.y+1.2*this.em,"font-family":this.fontFamily()})}}class b{constructor(t){this.styles=t}get em(){return this.styles.fontStyles.size}get rowHeight(){return 1.5*this.em}get swatchSize(){return this.styles.scaleFactors.legendSwatch*this.em}textWidth(t,s=!1){const i=e(t,{font:this.styles.fontStyles.font,fontSize:this.styles.fontStyles.size+"px",fontWeight:s?"bold":"normal"}).width;return Number.isFinite(i)&&i>0?i:.6*t.length*this.em}rows(t){const s=[];t.sizeCaption.forEach(((t,i)=>{s.push({text:t,bold:0===i,treatment:null})})),null!==t.title&&""!==t.title&&s.push({text:t.title,bold:!0,treatment:null});for(const i of[...t.compareEntries,...t.entries])s.push({text:i.label,bold:!1,treatment:i.treatment,fill:i.fill});return s}measure(t,s){const i=this.rows(t);if(0===i.length)return{width:0,height:0};const n=this.swatchSize+.4*this.em;if("bottom"===s){let t=0;for(const s of i)t+=(null!==s.treatment?n:0)+this.textWidth(s.text,s.bold)+1.5*this.em;return{width:t,height:this.rowHeight}}let o=0;for(const t of i)o=Math.max(o,(null!==t.treatment?n:0)+this.textWidth(t.text,t.bold));return{width:o,height:i.length*this.rowHeight}}draw(t,s,i,n,o){var e;const r=this.rows(s),h=this.swatchSize+.4*this.em;let l=i,a=n;for(const s of r){let i=l;if(null!==s.treatment){const n=t.circle(this.swatchSize).move(l,a+(this.rowHeight-this.swatchSize)/2).fill(null!==(e=s.fill)&&void 0!==e?e:s.treatment.hatch?"#ffffff":s.treatment.fill).stroke({color:"#ffffff"===s.treatment.stroke?s.treatment.fill:s.treatment.stroke,width:s.treatment.strokeWidth});void 0!==s.treatment.dasharray&&n.attr("stroke-dasharray",s.treatment.dasharray),i+=h}t.text(s.text).font({size:this.styles.fontStyles.size,weight:s.bold?"bold":"normal",anchor:"start"}).fill(this.styles.fontStyles.color).attr({x:i,y:a+this.rowHeight/2+.35*this.em,"font-family":this.fontFamily()}),"bottom"===o?l=i+this.textWidth(s.text,s.bold)+1.5*this.em:a+=this.rowHeight}}fontFamily(){return this.styles.fontStyles.font.replace(/^[\d.]+px\s*/,"")}}class g{constructor(){this.operation="+",this.custom={},this.counts={}}slotValue(s){const i=this[s];return t.isNumber(i)?i:null}slotHasNoData(t){return 0===this.counts[t]}}const M=["ac1","ac2","ac3","ac4","pp1","pp2","pp3","pp4","fc1","fc2","fc3","fc4","pl1","pl2","pl3","pl4"];class N{adapt(s){const i=new g;if(t.isOperator(s.operation)&&(i.operation=s.operation),t.isString(s.date)){const t=h.fromISO(s.date);i.date=t.isValid?t:void 0}t.isString(s.rowGroup)&&t.isNumber(s.rowGroupIndex)&&(i.rowGroup=s.rowGroup,i.rowGroupIndex=s.rowGroupIndex),t.isString(s.category)&&t.isNumber(s.categoryIndex)&&(i.category=s.category,i.categoryIndex=s.categoryIndex),t.isString(s.subCategory)&&t.isNumber(s.subCategoryIndex)&&(i.subCategory=s.subCategory,i.subCategoryIndex=s.subCategoryIndex),t.isString(s.columnGroup)&&t.isNumber(s.columnGroupIndex)&&(i.columnGroup=s.columnGroup,i.columnGroupIndex=s.columnGroupIndex),t.isString(s.columnSubGroup)&&t.isNumber(s.columnSubGroupIndex)&&(i.columnSubGroup=s.columnSubGroup,i.columnSubGroupIndex=s.columnSubGroupIndex);for(const n of M){t.isNumber(s[n])&&(i[n]=s[n]);const o=s[`${n}_cnt`];t.isNumber(o)&&(i.counts[n]=o)}for(const t of Object.keys(s))t.startsWith("_")&&(i.custom[t]=s[t]);return i}default(){return new g}}const S={rowGroup:"rowGroupIndex",category:"categoryIndex",subCategory:"subCategoryIndex"};function j(t,s){if("scenario"===s.kind)return{value:t.slotValue(s.slot),varianceNoData:!1};if(t.slotHasNoData(s.measure.base)||t.slotHasNoData(s.measure.delta))return{value:null,varianceNoData:!0};const i=s.measure.compute(t.slotValue(s.measure.base),t.slotValue(s.measure.delta));return{value:i,varianceNoData:null===i}}function k(t,s){return void 0!==s&&(void 0!==s.min&&t<s.min||void 0!==s.max&&t>s.max)}function z(t,s){return"scenario"!==t.kind?null:s+l(t.slot)}function C(t,s){var i,n,o,e,r,h,l,a,c;const u=[],f=new Set,d=[];let v=0,m=0,w=0,p=0,x=0;const y=new Map,b=new Map,g=new Map,M=null!==(i=s.compareFamily)&&void 0!==i?i:null,N=null!==M?z(s.measures.x,M):null,C=null!==M?z(s.measures.y,M):null,O=null!==M&&void 0!==s.measures.size?z(s.measures.size,M):null;for(const i of t){const t=i[s.pointLevel];if(null==t||""===t)continue;const u=null!==(n=null!==s.facetLevel?i[s.facetLevel]:"")&&void 0!==n?n:"",M=null!==(o=null!==s.seriesLevel?i[s.seriesLevel]:"")&&void 0!==o?o:"",z=`${u}\0${M}\0${t}`;if(f.has(z)){v++,d.length<5&&!d.includes(t)&&d.push(t);continue}const F=j(i,s.measures.x),D=j(i,s.measures.y);if(null===F.value||null===D.value){(F.varianceNoData||D.varianceNoData)&&m++;continue}if(k(F.value,null===(e=s.domains)||void 0===e?void 0:e.x)||k(D.value,null===(r=s.domains)||void 0===r?void 0:r.y)){w++;continue}const L={name:t,seriesKey:M,facetKey:u,x:F.value,y:D.value,row:i};if(void 0!==s.measures.size){const t=j(i,s.measures.size).value;if(null===t)continue;if(t<0){p++;continue}L.size=t}if(void 0!==s.measures.share){const t=j(i,s.measures.share).value;null!==t&&(t<0||t>1?(x++,L.share=Math.min(1,Math.max(0,t))):L.share=t)}if(null!==N&&null!==C){const t=i.slotValue(N),n=i.slotValue(C),o=null!==O?i.slotValue(O):null;null===t||null===n||null!==O&&null===o?L.compare=null:k(t,null===(h=s.domains)||void 0===h?void 0:h.x)||k(n,null===(l=s.domains)||void 0===l?void 0:l.y)?(w++,L.compare=null):(L.compare={x:t,y:n},null!==o&&(L.compare.size=o))}if(f.add(z),g.has(u)||g.set(u,[]),g.get(u).push(L),null!==s.facetLevel){const t=i[S[s.facetLevel]];null!=t&&t<(null!==(a=y.get(u))&&void 0!==a?a:Number.POSITIVE_INFINITY)&&y.set(u,t)}if(null!==s.seriesLevel){const t=i[S[s.seriesLevel]];null!=t&&t<(null!==(c=b.get(M))&&void 0!==c?c:Number.POSITIVE_INFINITY)&&b.set(M,t)}}const F=[...g.keys()].sort(((t,s)=>{var i,n;return(null!==(i=y.get(t))&&void 0!==i?i:Number.MAX_SAFE_INTEGER)-(null!==(n=y.get(s))&&void 0!==n?n:Number.MAX_SAFE_INTEGER)})),D=F.map((t=>{let i=g.get(t);return s.limit>0&&i.length>s.limit&&(i="size"===s.limitBy?[...i].sort(((t,s)=>{var i,n;return(null!==(i=s.size)&&void 0!==i?i:0)-(null!==(n=t.size)&&void 0!==n?n:0)})).slice(0,s.limit):i.slice(0,s.limit)),{key:t,points:i}})),L=new Set;for(const t of D)for(const s of t.points)L.add(s.seriesKey);const H=[...L].sort(((t,s)=>{var i,n;return(null!==(i=b.get(t))&&void 0!==i?i:Number.MAX_SAFE_INTEGER)-(null!==(n=b.get(s))&&void 0!==n?n:Number.MAX_SAFE_INTEGER)})).map(((t,s)=>({key:t,index:s})));let I=null,$=0;for(const t of D)for(const s of t.points){$++;const t=[s.x],i=[s.y],n=void 0!==s.size?[s.size]:[];null!=s.compare&&(t.push(s.compare.x),i.push(s.compare.y),void 0!==s.compare.size&&n.push(s.compare.size)),null===I&&(I={xMin:t[0],xMax:t[0],yMin:i[0],yMax:i[0],sizeMax:0});for(const s of t)I.xMin=Math.min(I.xMin,s),I.xMax=Math.max(I.xMax,s);for(const t of i)I.yMin=Math.min(I.yMin,t),I.yMax=Math.max(I.yMax,t);for(const t of n)I.sizeMax=Math.max(I.sizeMax,t)}return v>0&&u.push({code:"xy-duplicate-point",data:{count:String(v),names:d.join(", ")}}),m>0&&u.push({code:"xy-variance-nodata",data:{count:String(m)}}),w>0&&u.push({code:"xy-point-clipped",data:{count:String(w)}}),p>0&&u.push({code:"bubble-size-negative",data:{count:String(p)}}),x>0&&u.push({code:"bubble-share-range",data:{count:String(x)}}),$>5e3&&u.push({code:"xy-point-budget",data:{count:String($)}}),{facets:D,series:H,extents:I,warnings:u,totalPoints:$}}export{d as F,x as P,f as S,N as X,b as a,y as b,c,v as f,C as r,m as x}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{proxyCustomElement as t,HTMLElement as s,h as e,Host as
|
|
1
|
+
import{proxyCustomElement as t,HTMLElement as s,h as e,Host as o,transformTag as r}from"@stencil/core/internal/client";import{w as i}from"./withComponentStatus.js";import{g as n}from"./context-protocol.js";import{w as a}from"./withBodyObserver.js";import{w as c}from"./withHasError.js";const h=t(class extends s{constructor(t){super(),!1!==t&&this.__registerHost(),this.__attachShadow(),i(this),this.errors=c(this),a(this,(t=>{this.stores||(this.stores=n(this.element));try{const s=t.replace(/\s/g,"");this.stores.assets.set(this.name,s)}catch(s){console.error("Error parsing asset",s,t),this.stores.assets.set(this.name,void 0)}}))}render(){return e(o,{key:"dfec9f90136278bddab194479301aa3fa5bc1e72"})}get element(){return this}static get style(){return":host{display:none}"}},[1,"bn-asset",{name:[1]}]),m=h,l=function(){"undefined"!=typeof customElements&&["bn-asset"].forEach((t=>{"bn-asset"===t&&(customElements.get(r(t))||customElements.define(r(t),h))}))};export{m as BnAsset,l as defineCustomElement}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{proxyCustomElement as t,HTMLElement as o,h as n,Host as e,transformTag as s}from"@stencil/core/internal/client";import{w as i
|
|
1
|
+
import{proxyCustomElement as t,HTMLElement as o,h as n,Host as e,transformTag as s}from"@stencil/core/internal/client";import{w as i}from"./withComponentStatus.js";import{w as r}from"./withComponentStyle.js";import{w as f}from"./withHasError.js";const l=t(class extends o{constructor(t){super(),!1!==t&&this.__registerHost(),this.__attachShadow(),i(this),this.errors=f(this),this.componentStyle=r(this)}getFontStyles(){return this.componentStyle((t=>{var o,n,e,s;return{"--bn-font-family":(null===(o=t.global)||void 0===o?void 0:o.fontFamily)||"'Noto Sans', sans-serif","--bn-font-size":`${(null===(n=t.global)||void 0===n?void 0:n.fontSizePx)||13.3333}px`,"--bn-font-color":(null===(e=t.global)||void 0===e?void 0:e.fontColor)||"#000000","--bn-font-background":(null===(s=t.global)||void 0===s?void 0:s.fontBackgroundColor)||"#ffffff"}}))}render(){return n(e,{key:"f43978af1c6658c6fa165093c3ada6b5f3b5986d",style:this.getFontStyles()},n("slot",{key:"b9c97432089676fc373b1d5ee59573ef5681a5c5"}))}get element(){return this}static get style(){return':host{flex:1;min-height:0;position:relative;overflow:hidden;display:block;font-family:var(--bn-font-family, "Noto Sans", sans-serif);font-size:var(--bn-font-size, 13.3333px);color:var(--bn-font-color, #000000)}'}},[257,"bn-body"]);function a(){"undefined"!=typeof customElements&&["bn-body"].forEach((t=>{"bn-body"===t&&(customElements.get(s(t))||customElements.define(s(t),l))}))}export{l as B,a as d}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{proxyCustomElement as t,HTMLElement as
|
|
1
|
+
import{proxyCustomElement as t,HTMLElement as o,h as e,Host as n,transformTag as s}from"@stencil/core/internal/client";import{w as r}from"./withComponentStatus.js";import{w as i}from"./withComponentStyle.js";import{w as a}from"./withHasError.js";const f=t(class extends o{constructor(t){super(),!1!==t&&this.__registerHost(),this.__attachShadow(),r(this),this.errors=a(this),this.componentStyle=i(this)}render(){return e(n,{key:"92bcbc010336d3a542c86e182831bbfddda2aa9b",style:this.prepareStyle()},e("slot",{key:"d836aa5443283df158dcb50345aee0df97f74a6e"}))}prepareStyle(){return{"font-family":this.componentStyle((t=>t.global.fontFamily)),"font-size":`${this.componentStyle((t=>t.global.fontSizePx))}px`,"--bn-font-family":this.componentStyle((t=>t.global.fontFamily))||"'Noto Sans', sans-serif","--bn-font-size":`${this.componentStyle((t=>t.global.fontSizePx))||13.3333}px`,"--bn-font-color":this.componentStyle((t=>t.global.fontColor))||"#000000","--bn-font-background":this.componentStyle((t=>t.global.fontBackgroundColor))||"#ffffff"}}get element(){return this}static get style(){return':host{display:flex;flex-direction:column;justify-content:space-between;flex:1;min-height:0;padding:0.25em;margin:0.5em;background-origin:content-box;font-family:var(--bn-font-family, "Noto Sans", sans-serif);font-size:var(--bn-font-size, 13.3333px);color:var(--bn-font-color, #000000)}:host(.border){box-sizing:border-box;-webkit-box-sizing:border-box;border:0.1em solid #ddd}div{color:var(--bn-font-color, black)}'}},[257,"bn-card"]);function c(){"undefined"!=typeof customElements&&["bn-card"].forEach((t=>{"bn-card"===t&&(customElements.get(s(t))||customElements.define(s(t),f))}))}export{f as C,c as d}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{proxyCustomElement as t,HTMLElement as e,writeTask as i,forceUpdate as s,h as a,Host as r,transformTag as n}from"@stencil/core/internal/client";import{o as l}from"./geometry.js";import{c as o}from"./svgChartElements.js";import{a as h}from"./context-protocol.js";import{w as c,g as u}from"./withDataset.js";import{o as d}from"./layoutObserver.js";import{p}from"./scaling.js";import{i as v,h as m,j as f}from"./validate.js";import{w as y,a as g}from"./withHasError.js";import{w as b}from"./withComponentStyle.js";import{w}from"./withRuleSet.js";import{w as x}from"./withScalingGroup.js";import{w as _}from"./withTranslation.js";import{w as S}from"./withStyled.js";import{r as R,s as E}from"./VarianceMeasure.js";import{t as L,a as $,b as j,c as z,d as A,e as C,p as O}from"./AxisConfig.js";import{d as N}from"./ibcs-chart-bubble2.js";const W={rowGroup:0,category:1,subCategory:2},F=["ac","pp","fc","pl"],k=t(class extends e{validateX(t){this.validateMeasureSpec("x",t,!0,(t=>L(t)))}validateY(t){this.validateMeasureSpec("y",t,!0,(t=>L(t)))}validateSize(t){this.validateMeasureSpec("size",t,!0,(t=>$(t))),this.validateSizeScaling()}validateShare(t){this.validateMeasureSpec("share",t,!1,(t=>j(t)))}validateCompareWith(t){const e="ERR_compareWith";v(t)||F.includes(t.trim().toLowerCase())?this.errors.remove(e):this.errors.addOrReplace({id:e,type:"warning",message:`compare-with: invalid value '${t}' — expected ${F.join("/")}; ignored.`})}validateLevel(t){const e="ERR_level",i=["auto","category","subcategory"];v(t)||i.includes(t.trim().toLowerCase())?this.errors.remove(e):this.errors.addOrReplace({id:e,type:"warning",message:`level: invalid value '${t}' — expected ${i.join("/")}; using 'auto'.`})}validateSeriesLevel(t){const e="ERR_seriesLevel",i=["auto","rowgroup","category","none"];v(t)||i.includes(t.trim().toLowerCase())?this.errors.remove(e):this.errors.addOrReplace({id:e,type:"warning",message:`series-level: invalid value '${t}' — expected ${i.join("/")}; using 'auto'.`})}validateFacet(t){this.validateObjectSpec("facet",t,(t=>z(t)))}validateLabels(t){this.validateObjectSpec("labels",t,(t=>A(t,this.labelDefaults())))}validateLegend(t){this.validateObjectSpec("legend",t,(t=>C(t)))}validateAspect(t){const e="ERR_aspect";v(t)||null!==this.parseAspect(t)?this.errors.remove(e):this.errors.addOrReplace({id:e,type:"warning",message:`aspect: invalid value '${t}' — expected "w:h" (e.g. "16:9"); using the default.`})}validateLimit(t){const e="ERR_limit";m(t)&&Number(t)>=0?this.errors.remove(e):this.errors.addOrReplace({id:e,type:"warning",message:`limit: invalid value '${t}' — expected a non-negative integer; using 0.`})}validateScale(t){const e="ERR_scale";if(v(t))return void this.errors.remove(e);const{mode:i,factor:s}=p(t);"factor"===i&&(void 0===s||s<=0)?this.errors.addOrReplace({id:e,type:"warning",message:`scale: invalid value '${t}' — expected none/auto or a positive number.`}):this.errors.remove(e)}constructor(t){super(),!1!==t&&this.__registerHost(),this.__attachShadow(),this.datasetName="",this.dataVersion=0,this.datasetMeta=null,this.appliedScaleFactor=1,this.layoutObserver=null,this.activeErrors=new Set,this.pixelPerUnitGroupMap=new Map,this.chartTitle="",this.filter="",this.share="",this.compareWith="",this.level="auto",this.seriesLevel="auto",this.facet="",this.labels="",this.legend="",this.aspect="16:9",this.limit=0,this._autoScaleGuard=!1,this._lastObservedWidth=0,this.translateForInner=(t,e)=>this.t(t,e),S(this),y(this),c(this,(t=>{this.datasetName=(null==t?void 0:t.startsWith("$"))?t.substring(1):t||"",this.dataVersion=this.dataVersion+1}),((t,e)=>{this.datasetMeta=e})),this.errors=g(this),x(this),this.componentStyle=b(this),this.ruleSetConfig=w(this),this.t=_(this).t}componentWillLoad(){this.validateX(this.x),this.validateY(this.y),this.validateSize(this.size),this.validateShare(this.share),this.validateCompareWith(this.compareWith),this.validateLevel(this.level),this.validateSeriesLevel(this.seriesLevel),this.validateFacet(this.facet),this.validateLabels(this.labels),this.validateLegend(this.legend),this.validateAspect(this.aspect),this.validateLimit(this.limit),this.validateScale(this.scale)}componentDidRender(){const{mode:t}=p(this.scale);if("auto"!==t&&"empty"!==t){this._autoScaleGuard=!1;const t=u(this.element),e="WARN_overflow";return void(t.width>0&&this.element.scrollWidth>t.width+1?this.errors.addOrReplace({id:e,type:"warning",message:"Chart exceeds available space and will be cut off. Check the scale value."}):this.errors.remove(e))}if(this._autoScaleGuard)return void(this._autoScaleGuard=!1);const e=this.element,{width:s}=u(e);if(s<=0)return;this._lastObservedWidth=s;const a=this.componentStyle((t=>{var e;return(null===(e=t.global)||void 0===e?void 0:e.fontSizePx)||13.3333})),r=e.scrollWidth,n=this.appliedScaleFactor;if(!Number.isFinite(r)||r<=s+1)return void this.errors.remove("AUTO_scale");const l=Math.max(.3,n*(s-1)/r);Math.abs(l-n)<.01||(e.style.setProperty("--bn-font-size",a*l+"px"),"empty"===t?this.errors.addOrReplace({id:"AUTO_scale",type:"warning",message:"Auto-scaled chart by factor "+l.toFixed(3)}):this.errors.remove("AUTO_scale"),this._autoScaleGuard=!0,i((()=>{this.appliedScaleFactor=l})))}componentDidLoad(){this.layoutObserver=d(this.element,(()=>{if(this._autoScaleGuard)return;const{width:t}=u(this.element);t>0&&Math.abs(t-this._lastObservedWidth)>2&&(this._lastObservedWidth=t,s(this))})),requestAnimationFrame((()=>{requestAnimationFrame((()=>{if(this._autoScaleGuard)return;const{width:t}=u(this.element);this._lastObservedWidth=t,s(this)}))}))}disconnectedCallback(){var t;null===(t=this.layoutObserver)||void 0===t||t.disconnect(),this.layoutObserver=null}labelDefaults(){return{points:"all",values:!0,max:12}}setBlockingError(t,e){null===e?(this.errors.remove(t),this.activeErrors.delete(t)):(this.errors.addOrReplace({id:t,type:"error",message:e}),this.activeErrors.add(t))}hasBlockingErrors(){return this.activeErrors.size>0}validateSizeScaling(){var t;const e=null===(t=this.prepareSize())||void 0===t?void 0:t.group;this.setBlockingError("ERR_xy_scale_group",void 0===e||this.pixelPerUnitGroupMap.has(e)?null:this.t(".bubble-scale-group-unknown",{group:e}))}validateMeasureSpec(t,e,i,s){var a;const r="ERR_xy_json_"+t,n="ERR_xy_measure_"+t,l="WARN_xy_fields_"+t,{data:o,parseError:h}=O(e,"measure");if(h)return this.setBlockingError(r,this.t(".xy-prop-json",{prop:t})),this.setBlockingError(n,null),void this.errors.remove(l);if(this.setBlockingError(r,null),null===o)return this.setBlockingError(n,i?this.t(".xy-measure-invalid",{prop:t,measure:""}):null),void this.errors.remove(l);const c=null!==(a=o.measure)&&void 0!==a?a:"";f(c)?this.setBlockingError(n,null):this.setBlockingError(n,this.t(".xy-measure-invalid",{prop:t,measure:c})),this.reportSpecIssues(l,t,s(o))}validateObjectSpec(t,e,i){const s="ERR_xy_json_"+t,a="WARN_xy_fields_"+t,{data:r,parseError:n}=O(e,null);if(n)return this.setBlockingError(s,this.t(".xy-prop-json",{prop:t})),void this.errors.remove(a);this.setBlockingError(s,null),null!==r?this.reportSpecIssues(a,t,i(r)):this.errors.remove(a)}reportSpecIssues(t,e,i){const s=[];null!==i&&i.invalidFields.length>0&&s.push("invalid: "+i.invalidFields.join(", ")),null!==i&&i.unknownKeys.length>0&&s.push("unknown: "+i.unknownKeys.join(", ")),s.length>0?this.errors.addOrReplace({id:t,type:"warning",message:`${e}: ignored sub-fields (${s.join("; ")}).`}):this.errors.remove(t)}prepareAxis(t,e){const{data:i,parseError:s}=O(e,"measure");if(s||null===i)return null;const{config:a}=L(i);return null!==a&&f(a.measure)?(void 0!==a.min&&void 0!==a.max&&a.min>=a.max?(this.errors.addOrReplace({id:"WARN_xy_domain_"+t,type:"warning",message:t+": min must be smaller than max; the override is ignored."}),a.min=void 0,a.max=void 0):this.errors.remove("WARN_xy_domain_"+t),a):null}prepareSize(){const{data:t,parseError:e}=O(this.size,"measure");if(e||null===t)return null;const{config:i}=$(t);return null!==i&&f(i.measure)?i:null}prepareShare(){const{data:t,parseError:e}=O(this.share,"measure");if(e||null===t)return null;const{config:i}=j(t);return null!==i&&f(i.measure)?i:null}prepareCompareFamily(){var t;const e=null===(t=this.compareWith)||void 0===t?void 0:t.trim().toLowerCase();return F.includes(e)?e:null}prepareLabels(){const t=this.labelDefaults(),{data:e,parseError:i}=O(this.labels,null);return i||null===e?{points:t.points,values:t.values,max:t.max}:A(e,t).config}prepareLegend(){const{data:t,parseError:e}=O(this.legend,null);return e||null===t?{show:!0,position:"right"}:C(t).config}prepareFacet(){const{data:t,parseError:e}=O(this.facet,null);return e||null===t?null:z(t).config}preparePointLevel(){var t,e;const i=null===(t=this.level)||void 0===t?void 0:t.trim().toLowerCase();if("category"===i)return"category";if("subcategory"===i)return"subCategory";const s=null===(e=this.datasetMeta)||void 0===e?void 0:e.suggestedLevel;return"rowGroup"===s||"category"===s||"subCategory"===s?s:"category"}prepareSeriesLevel(t){var e;const i=null===(e=this.seriesLevel)||void 0===e?void 0:e.trim().toLowerCase();return"none"===i?null:"rowgroup"===i?"rowGroup":"category"===i||"subCategory"===t?"category":"category"===t?"rowGroup":null}validateCrossProp(t,e){const i=new Set;let s=!1;for(const e of t){if(void 0===e)continue;const t=R(e);null!==t&&("scenario"===t.kind?i.add(E(t.slot)):s=!0)}this.setBlockingError("ERR_xy_family",i.size>1?this.t(".xy-family-mixed",{families:[...i].join(", ")}):null);const a=this.prepareCompareFamily();this.setBlockingError("ERR_xy_compare_variance",null!==a&&s?this.t(".xy-compare-variance"):null),this.setBlockingError("ERR_xy_compare_family",null!==a&&1===i.size&&i.has(a)?`compare-with: '${a}' is already the primary scenario family.`:null);const r=this.preparePointLevel(),n=this.prepareSeriesLevel(r),l=null!==e?"rowgroup"===e.level?"rowGroup":"category":null;let o=null;if(null!==n&&W[n]>=W[r]&&(o=`series '${n}' vs point '${r}'`),null!==l){const t=null!=n?n:r;W[l]>=W[t]&&(o=`facet '${l}' vs '${t}'`)}this.setBlockingError("ERR_xy_level_order",null!==o?this.t(".xy-level-order",{detail:o}):null)}parseAspect(t){const e=/^\s*(\d+(?:\.\d+)?)\s*:\s*(\d+(?:\.\d+)?)\s*$/.exec(null!=t?t:"");if(null===e)return null;const i=Number(e[1]),s=Number(e[2]);return i<=0||s<=0?null:i/s}prepareAspect(){var t;return null!==(t=this.parseAspect(this.aspect))&&void 0!==t?t:16/9}prepareLimit(){const t=Math.floor(Number(this.limit)||0);return t>0?t:0}prepareSizeAreaPerUnit(){var t;const e=null===(t=this.prepareSize())||void 0===t?void 0:t.group;if(void 0===e||!this.pixelPerUnitGroupMap.has(e))return 0;const i=this.pixelPerUnitGroupMap.get(e);if(!(i>0))return 0;const s=this.getEffectiveFontPx();return s*s/i}i18nLocalKeys(){return["no-data","axis.in","legend.title","legend.size","legend.compare"]}prepareI18n(){const t=new Map(this.i18nLocalKeys().map((t=>[t,this.t(".".concat(t))]))),e=new Map(h.map((t=>[t,this.t("global.".concat(t))])));return new Map([...e.entries(),...t.entries()])}prepareStyle(){const t=this.getEffectiveScaleFactor();return this.componentStyle((e=>{const i=e.global.fontSizePx*t;return{scaleFactors:e["bn-chart-bubble"].scaleFactors,fontStyles:{font:`${i}px ${e.global.fontFamily}`,size:i,color:e.global.fontColor,background:e.global.fontBackgroundColor,leading:1.8},axisStyles:e["bn-chart-bubble"].axisStyles,seriesColors:e["bn-chart-bubble"].seriesColors,padding:e["bn-chart-bubble"].padding}}))}async getLayoutState(t){var e;const i=null!==(e=null==t?void 0:t.detail)&&void 0!==e?e:"summary",s=l(this.element),a=this.getEffectiveScaleFactor(),r=Number.isFinite(a)&&a>0?a:1,n=this.componentStyle((t=>{var e;return(null===(e=t.global)||void 0===e?void 0:e.fontSizePx)||13.3333}))*r;return o(this.element,"ibcs-chart-bubble",this.chartTitle||void 0,{fontSizePx:n,appliedScaleFactor:r},s,i)}getEffectiveScaleFactor(){const{mode:t,factor:e}=p(this.scale);return"factor"===t?e:"auto"===t||"empty"===t?this.appliedScaleFactor:1}getEffectiveFontPx(){return this.componentStyle((t=>{var e;return(null===(e=t.global)||void 0===e?void 0:e.fontSizePx)||13.3333}))*this.getEffectiveScaleFactor()}getFontStyles(){const t=this.getEffectiveScaleFactor();return this.componentStyle((e=>{var i,s,a,r;const n=(null===(i=e.global)||void 0===i?void 0:i.fontSizePx)||13.3333;return{"--bn-font-family":(null===(s=e.global)||void 0===s?void 0:s.fontFamily)||"'Noto Sans', sans-serif","--bn-font-size":n*t+"px","--bn-font-color":(null===(a=e.global)||void 0===a?void 0:a.fontColor)||"#000000","--bn-font-background":(null===(r=e.global)||void 0===r?void 0:r.fontBackgroundColor)||"#ffffff"}}))}getDataStructure(){const t={};for(const e of["ac","pp","fc","pl"])for(const i of[1,2,3,4])t[`${e}${i}`]={type:"number",isOptional:!0,description:""};const e={x:this.prepareAxis("x",this.x),y:this.prepareAxis("y",this.y),size:this.prepareSize(),share:this.prepareShare()};for(const[i,s]of Object.entries(e)){if(null===s)continue;const e=R(s.measure);null!==e&&("scenario"===e.kind?t[e.slot].description=`${i}: ${void 0!==s.label?s.label:s.measure}`:(t[e.measure.base].description=`${i}: ${s.measure} (base)`,t[e.measure.delta].description=`${i}: ${s.measure} (delta)`))}const i=this.prepareCompareFamily();if(null!==i)for(const[s,a]of Object.entries(e)){if(null===a||"share"===s)continue;const e=R(a.measure);if(null!==e&&"scenario"===e.kind){const a=i+e.slot.replace(/^[a-z]+/,"");""===t[a].description&&(t[a].description=s+": compareWith")}}return{IBubbleChartDataRow:Object.assign({operation:{type:"string",isOptional:!1,description:""},rowGroup:{type:"string",isOptional:!0,description:""},rowGroupIndex:{type:"number",isOptional:!0,description:""},category:{type:"string",isOptional:!1,description:""},categoryIndex:{type:"number",isOptional:!1,description:""},subCategory:{type:"string",isOptional:!0,description:""},subCategoryIndex:{type:"number",isOptional:!0,description:""}},t)}}chartTemplate(){const t=this.prepareAxis("x",this.x),e=this.prepareAxis("y",this.y),i=this.prepareSize(),s=this.prepareShare(),r=this.prepareFacet();if(this.validateCrossProp([null==t?void 0:t.measure,null==e?void 0:e.measure,null==i?void 0:i.measure,null==s?void 0:s.measure],r),this.validateSizeScaling(),this.hasBlockingErrors()||null===t||null===e||null===i)return null;const n=this.preparePointLevel(),l=this.prepareI18n(),o=this.prepareStyle(),h=u(this.element).width;return a("ibcs-chart-bubble",{tableName:this.datasetName,dataVersion:this.dataVersion,chartTitle:this.chartTitle,x:t,y:e,size:i,share:s,compareFamily:this.prepareCompareFamily(),labels:this.prepareLabels(),legend:this.prepareLegend(),facet:r,pointLevel:n,seriesLevel:this.prepareSeriesLevel(n),aspect:this.prepareAspect(),limit:this.prepareLimit(),filter:this.filter,sizeAreaPerUnit:this.prepareSizeAreaPerUnit(),styles:o,i18n:l,containerWidth:h,ruleSetConfig:this.ruleSetConfig(),errors:this.errors,translate:this.translateForInner})}render(){return a(r,{key:"0dd049de98d978c2d8223eb8b68faef8568260b6",style:this.getFontStyles()},a("div",{key:"676705ee1711e0780a3a80b01e4f951800742bbd",class:"container"},this.chartTemplate()))}get element(){return this}static get watchers(){return{x:[{validateX:0}],y:[{validateY:0}],size:[{validateSize:0}],share:[{validateShare:0}],compareWith:[{validateCompareWith:0}],level:[{validateLevel:0}],seriesLevel:[{validateSeriesLevel:0}],facet:[{validateFacet:0}],labels:[{validateLabels:0}],legend:[{validateLegend:0}],aspect:[{validateAspect:0}],limit:[{validateLimit:0}],scale:[{validateScale:0}]}}static get style(){return':host{display:inline-block;position:relative;overflow:hidden;font-family:var(--bn-font-family, "Noto Sans", sans-serif);font-size:var(--bn-font-size, 13.3333px);color:var(--bn-font-color, #000000)}.container{display:flex;flex-direction:column}'}},[1,"bn-chart-bubble",{ruleset:[513],chartTitle:[1,"chart-title"],filter:[1],x:[1],y:[1],size:[1],share:[1],compareWith:[1,"compare-with"],level:[1],seriesLevel:[1,"series-level"],facet:[1],labels:[1],legend:[1],aspect:[1],limit:[2],scale:[1],datasetName:[32],dataVersion:[32],datasetMeta:[32],appliedScaleFactor:[32],getLayoutState:[64]},void 0,{x:[{validateX:0}],y:[{validateY:0}],size:[{validateSize:0}],share:[{validateShare:0}],compareWith:[{validateCompareWith:0}],level:[{validateLevel:0}],seriesLevel:[{validateSeriesLevel:0}],facet:[{validateFacet:0}],labels:[{validateLabels:0}],legend:[{validateLegend:0}],aspect:[{validateAspect:0}],limit:[{validateLimit:0}],scale:[{validateScale:0}]}]),M=k,G=function(){"undefined"!=typeof customElements&&["bn-chart-bubble","ibcs-chart-bubble"].forEach((t=>{switch(t){case"bn-chart-bubble":customElements.get(n(t))||customElements.define(n(t),k);break;case"ibcs-chart-bubble":customElements.get(n(t))||N()}}))};export{M as BnChartBubble,G as defineCustomElement}
|
|
1
|
+
import{proxyCustomElement as t,HTMLElement as e,writeTask as i,forceUpdate as s,h as a,Host as r,transformTag as n}from"@stencil/core/internal/client";import{h as o,a as l}from"./context-protocol.js";import{o as h}from"./geometry.js";import{c}from"./svgChartElements.js";import{g as u}from"./parentDimensions.js";import{c as d}from"./checkXYOverflow.js";import{o as p}from"./layoutObserver.js";import{p as v}from"./scaling.js";import{i as m,h as f,j as b}from"./validate.js";import{w as y}from"./withComponentStatus.js";import{w as g}from"./withComponentStyle.js";import{w}from"./withDataset.js";import{w as x}from"./withHasError.js";import{w as _}from"./withRuleSet.js";import{w as S}from"./withScalingGroup.js";import{w as R}from"./withTranslation.js";import{w as E}from"./withStyled.js";import{r as L,s as j}from"./VarianceMeasure.js";import{t as $,a as z,b as A,c as C,d as O,e as F,p as k}from"./AxisConfig.js";import{s as N}from"./emptyState.js";import{d as W}from"./ibcs-chart-bubble2.js";const M={rowGroup:0,category:1,subCategory:2},G=["ac","pp","fc","pl"],D=t(class extends e{validateFilter(t){const e="ERR_filter";o(t)?this.errors.addOrReplace({id:e,type:"error",message:"filter: double backticks are not allowed."}):this.errors.remove(e)}validateX(t){this.validateMeasureSpec("x",t,!0,(t=>$(t)))}validateY(t){this.validateMeasureSpec("y",t,!0,(t=>$(t)))}validateSize(t){this.validateMeasureSpec("size",t,!0,(t=>z(t))),this.validateSizeScaling()}validateShare(t){this.validateMeasureSpec("share",t,!1,(t=>A(t)))}validateCompareWith(t){const e="ERR_compareWith";m(t)||G.includes(t.trim().toLowerCase())?this.errors.remove(e):this.errors.addOrReplace({id:e,type:"warning",message:`compare-with: invalid value '${t}' - expected ${G.join("/")}; ignored.`})}validateLevel(t){const e="ERR_level",i=["auto","category","subcategory"];m(t)||i.includes(t.trim().toLowerCase())?this.errors.remove(e):this.errors.addOrReplace({id:e,type:"warning",message:`level: invalid value '${t}' - expected ${i.join("/")}; using 'auto'.`})}validateSeriesLevel(t){const e="ERR_seriesLevel",i=["auto","rowgroup","category","none"];m(t)||i.includes(t.trim().toLowerCase())?this.errors.remove(e):this.errors.addOrReplace({id:e,type:"warning",message:`series-level: invalid value '${t}' - expected ${i.join("/")}; using 'auto'.`})}validateFacet(t){this.validateObjectSpec("facet",t,(t=>C(t)))}validateLabels(t){this.validateObjectSpec("labels",t,(t=>O(t,this.labelDefaults())))}validateLegend(t){this.validateObjectSpec("legend",t,(t=>F(t)))}validateAspect(t){const e="ERR_aspect";m(t)||null!==this.parseAspect(t)?this.errors.remove(e):this.errors.addOrReplace({id:e,type:"warning",message:`aspect: invalid value '${t}' - expected "w:h" (e.g. "16:9"); using the default.`})}validateLimit(t){const e="ERR_limit";f(t)&&Number(t)>=0?this.errors.remove(e):this.errors.addOrReplace({id:e,type:"warning",message:`limit: invalid value '${t}' - expected a non-negative integer; using 0.`})}validateScale(t){const e="ERR_scale";if(m(t))return void this.errors.remove(e);const{mode:i,factor:s}=v(t);"factor"===i&&(void 0===s||s<=0)?this.errors.addOrReplace({id:e,type:"warning",message:`scale: invalid value '${t}' - expected none/auto or a positive number.`}):this.errors.remove(e)}constructor(t){super(),!1!==t&&this.__registerHost(),this.__attachShadow(),this.datasetName="",this.dataVersion=0,this.datasetMeta=null,this.appliedScaleFactor=1,this.layoutObserver=null,this.activeErrors=new Set,this.pixelPerUnitGroupMap=new Map,this.chartTitle="",this.filter="",this.share="",this.compareWith="",this.level="auto",this.seriesLevel="auto",this.facet="",this.labels="",this.legend="",this.aspect="16:9",this.limit=0,this._autoScaleGuard=!1,this._lastObservedWidth=0,this.translateForInner=(t,e)=>this.t(t,e),E(this),y(this),w(this,(t=>{this.datasetName=(null==t?void 0:t.startsWith("$"))?t.substring(1):t||"",this.dataVersion=this.dataVersion+1}),((t,e)=>{this.datasetMeta=e})),this.errors=x(this),S(this),this.componentStyle=g(this),this.ruleSetConfig=_(this),this.t=R(this).t}componentWillLoad(){this.validateFilter(this.filter),this.validateX(this.x),this.validateY(this.y),this.validateSize(this.size),this.validateShare(this.share),this.validateCompareWith(this.compareWith),this.validateLevel(this.level),this.validateSeriesLevel(this.seriesLevel),this.validateFacet(this.facet),this.validateLabels(this.labels),this.validateLegend(this.legend),this.validateAspect(this.aspect),this.validateLimit(this.limit),this.validateScale(this.scale)}componentDidRender(){N(this.element,"ibcs-chart-bubble");const{mode:t}=v(this.scale);if("auto"!==t&&"empty"!==t)return this._autoScaleGuard=!1,void this.checkOverflow();if(this._autoScaleGuard)return this._autoScaleGuard=!1,void this.checkOverflow();const e=this.element,{width:s}=u(e);if(s<=0)return void this.checkOverflow();this._lastObservedWidth=s;const a=this.componentStyle((t=>{var e;return(null===(e=t.global)||void 0===e?void 0:e.fontSizePx)||13.3333})),r=e.scrollWidth,n=this.appliedScaleFactor;if(!Number.isFinite(r)||r<=s+1)return this.errors.remove("AUTO_scale"),void this.checkOverflow();const o=Math.max(.3,n*(s-1)/r);Math.abs(o-n)<.01||(e.style.setProperty("--bn-font-size",a*o+"px"),"empty"===t?this.errors.addOrReplace({id:"AUTO_scale",type:"warning",message:"Auto-scaled chart by factor "+o.toFixed(3)}):this.errors.remove("AUTO_scale"),this._autoScaleGuard=!0,i((()=>{this.appliedScaleFactor=o}))),this.checkOverflow()}checkOverflow(){d(this.element,"ibcs-chart-bubble",this.errors)}componentDidLoad(){this.layoutObserver=p(this.element,(()=>{if(this._autoScaleGuard)return;const{width:t}=u(this.element);t>0&&Math.abs(t-this._lastObservedWidth)>2?(this._lastObservedWidth=t,s(this)):this.checkOverflow()})),requestAnimationFrame((()=>{requestAnimationFrame((()=>{if(this._autoScaleGuard)return;const{width:t}=u(this.element);this._lastObservedWidth=t,s(this)}))}))}disconnectedCallback(){var t;null===(t=this.layoutObserver)||void 0===t||t.disconnect(),this.layoutObserver=null}labelDefaults(){return{points:"all",values:!0,max:12}}setBlockingError(t,e){null===e?(this.errors.remove(t),this.activeErrors.delete(t)):(this.errors.addOrReplace({id:t,type:"error",message:e}),this.activeErrors.add(t))}hasBlockingErrors(){return this.activeErrors.size>0}validateSizeScaling(){var t;const e=null===(t=this.prepareSize())||void 0===t?void 0:t.group;this.setBlockingError("ERR_xy_scale_group",void 0===e||this.pixelPerUnitGroupMap.has(e)?null:this.t(".bubble-scale-group-unknown",{group:e}))}validateMeasureSpec(t,e,i,s){var a;const r="ERR_xy_json_"+t,n="ERR_xy_measure_"+t,o="WARN_xy_fields_"+t,{data:l,parseError:h}=k(e,"measure");if(h)return this.setBlockingError(r,this.t(".xy-prop-json",{prop:t})),this.setBlockingError(n,null),void this.errors.remove(o);if(this.setBlockingError(r,null),null===l)return this.setBlockingError(n,i?this.t(".xy-measure-invalid",{prop:t,measure:""}):null),void this.errors.remove(o);const c=null!==(a=l.measure)&&void 0!==a?a:"";b(c)?this.setBlockingError(n,null):this.setBlockingError(n,this.t(".xy-measure-invalid",{prop:t,measure:c})),this.reportSpecIssues(o,t,s(l))}validateObjectSpec(t,e,i){const s="ERR_xy_json_"+t,a="WARN_xy_fields_"+t,{data:r,parseError:n}=k(e,null);if(n)return this.setBlockingError(s,this.t(".xy-prop-json",{prop:t})),void this.errors.remove(a);this.setBlockingError(s,null),null!==r?this.reportSpecIssues(a,t,i(r)):this.errors.remove(a)}reportSpecIssues(t,e,i){const s=[];null!==i&&i.invalidFields.length>0&&s.push("invalid: "+i.invalidFields.join(", ")),null!==i&&i.unknownKeys.length>0&&s.push("unknown: "+i.unknownKeys.join(", ")),s.length>0?this.errors.addOrReplace({id:t,type:"warning",message:`${e}: ignored sub-fields (${s.join("; ")}).`}):this.errors.remove(t)}prepareAxis(t,e){const{data:i,parseError:s}=k(e,"measure");if(s||null===i)return null;const{config:a}=$(i);return null!==a&&b(a.measure)?(void 0!==a.min&&void 0!==a.max&&a.min>=a.max?(this.errors.addOrReplace({id:"WARN_xy_domain_"+t,type:"warning",message:t+": min must be smaller than max; the override is ignored."}),a.min=void 0,a.max=void 0):this.errors.remove("WARN_xy_domain_"+t),a):null}prepareSize(){const{data:t,parseError:e}=k(this.size,"measure");if(e||null===t)return null;const{config:i}=z(t);return null!==i&&b(i.measure)?i:null}prepareShare(){const{data:t,parseError:e}=k(this.share,"measure");if(e||null===t)return null;const{config:i}=A(t);return null!==i&&b(i.measure)?i:null}prepareCompareFamily(){var t;const e=null===(t=this.compareWith)||void 0===t?void 0:t.trim().toLowerCase();return G.includes(e)?e:null}prepareLabels(){const t=this.labelDefaults(),{data:e,parseError:i}=k(this.labels,null);return i||null===e?{points:t.points,values:t.values,max:t.max}:O(e,t).config}prepareLegend(){const{data:t,parseError:e}=k(this.legend,null);return e||null===t?{show:!0,position:"right"}:F(t).config}prepareFacet(){const{data:t,parseError:e}=k(this.facet,null);return e||null===t?null:C(t).config}preparePointLevel(){var t,e;const i=null===(t=this.level)||void 0===t?void 0:t.trim().toLowerCase();if("category"===i)return"category";if("subcategory"===i)return"subCategory";const s=null===(e=this.datasetMeta)||void 0===e?void 0:e.suggestedLevel;return"rowGroup"===s||"category"===s||"subCategory"===s?s:"category"}prepareSeriesLevel(t){var e;const i=null===(e=this.seriesLevel)||void 0===e?void 0:e.trim().toLowerCase();return"none"===i?null:"rowgroup"===i?"rowGroup":"category"===i||"subCategory"===t?"category":"category"===t?"rowGroup":null}validateCrossProp(t,e){const i=new Set;let s=!1;for(const e of t){if(void 0===e)continue;const t=L(e);null!==t&&("scenario"===t.kind?i.add(j(t.slot)):s=!0)}this.setBlockingError("ERR_xy_family",i.size>1?this.t(".xy-family-mixed",{families:[...i].join(", ")}):null);const a=this.prepareCompareFamily();this.setBlockingError("ERR_xy_compare_variance",null!==a&&s?this.t(".xy-compare-variance"):null),this.setBlockingError("ERR_xy_compare_family",null!==a&&1===i.size&&i.has(a)?`compare-with: '${a}' is already the primary scenario family.`:null);const r=this.preparePointLevel(),n=this.prepareSeriesLevel(r),o=null!==e?"rowgroup"===e.level?"rowGroup":"category":null;let l=null;if(null!==n&&M[n]>=M[r]&&(l=`series '${n}' vs point '${r}'`),null!==o){const t=null!=n?n:r;M[o]>=M[t]&&(l=`facet '${o}' vs '${t}'`)}this.setBlockingError("ERR_xy_level_order",null!==l?this.t(".xy-level-order",{detail:l}):null)}parseAspect(t){const e=/^\s*(\d+(?:\.\d+)?)\s*:\s*(\d+(?:\.\d+)?)\s*$/.exec(null!=t?t:"");if(null===e)return null;const i=Number(e[1]),s=Number(e[2]);return i<=0||s<=0?null:i/s}prepareAspect(){var t;return null!==(t=this.parseAspect(this.aspect))&&void 0!==t?t:16/9}prepareLimit(){const t=Math.floor(Number(this.limit)||0);return t>0?t:0}prepareSizeAreaPerUnit(){var t;const e=null===(t=this.prepareSize())||void 0===t?void 0:t.group;if(void 0===e||!this.pixelPerUnitGroupMap.has(e))return 0;const i=this.pixelPerUnitGroupMap.get(e);if(!(i>0))return 0;const s=this.getEffectiveFontPx();return s*s/i}i18nLocalKeys(){return["no-data","axis.in","legend.title","legend.size","legend.compare"]}prepareI18n(){const t=new Map(this.i18nLocalKeys().map((t=>[t,this.t(".".concat(t))]))),e=new Map(l.map((t=>[t,this.t("global.".concat(t))])));return new Map([...e.entries(),...t.entries()])}prepareStyle(){const t=this.getEffectiveScaleFactor();return this.componentStyle((e=>{const i=e.global.fontSizePx*t;return{scaleFactors:e["bn-chart-bubble"].scaleFactors,fontStyles:{font:`${i}px ${e.global.fontFamily}`,size:i,color:e.global.fontColor,background:e.global.fontBackgroundColor,leading:1.8},axisStyles:e["bn-chart-bubble"].axisStyles,seriesColors:e["bn-chart-bubble"].seriesColors,padding:e["bn-chart-bubble"].padding}}))}async getLayoutState(t){var e;const i=null!==(e=null==t?void 0:t.detail)&&void 0!==e?e:"summary",s=h(this.element),a=this.getEffectiveScaleFactor(),r=Number.isFinite(a)&&a>0?a:1,n=this.componentStyle((t=>{var e;return(null===(e=t.global)||void 0===e?void 0:e.fontSizePx)||13.3333}))*r;return c(this.element,"ibcs-chart-bubble",this.chartTitle||void 0,{fontSizePx:n,appliedScaleFactor:r},s,i)}getEffectiveScaleFactor(){const{mode:t,factor:e}=v(this.scale);return"factor"===t?e:"auto"===t||"empty"===t?this.appliedScaleFactor:1}getEffectiveFontPx(){return this.componentStyle((t=>{var e;return(null===(e=t.global)||void 0===e?void 0:e.fontSizePx)||13.3333}))*this.getEffectiveScaleFactor()}getFontStyles(){const t=this.getEffectiveScaleFactor();return this.componentStyle((e=>{var i,s,a,r;const n=(null===(i=e.global)||void 0===i?void 0:i.fontSizePx)||13.3333;return{"--bn-font-family":(null===(s=e.global)||void 0===s?void 0:s.fontFamily)||"'Noto Sans', sans-serif","--bn-font-size":n*t+"px","--bn-font-color":(null===(a=e.global)||void 0===a?void 0:a.fontColor)||"#000000","--bn-font-background":(null===(r=e.global)||void 0===r?void 0:r.fontBackgroundColor)||"#ffffff"}}))}getDataStructure(){const t={};for(const e of["ac","pp","fc","pl"])for(const i of[1,2,3,4])t[`${e}${i}`]={type:"number",isOptional:!0,description:""};const e={x:this.prepareAxis("x",this.x),y:this.prepareAxis("y",this.y),size:this.prepareSize(),share:this.prepareShare()};for(const[i,s]of Object.entries(e)){if(null===s)continue;const e=L(s.measure);null!==e&&("scenario"===e.kind?t[e.slot].description=`${i}: ${void 0!==s.label?s.label:s.measure}`:(t[e.measure.base].description=`${i}: ${s.measure} (base)`,t[e.measure.delta].description=`${i}: ${s.measure} (delta)`))}const i=this.prepareCompareFamily();if(null!==i)for(const[s,a]of Object.entries(e)){if(null===a||"share"===s)continue;const e=L(a.measure);if(null!==e&&"scenario"===e.kind){const a=i+e.slot.replace(/^[a-z]+/,"");""===t[a].description&&(t[a].description=s+": compareWith")}}return{IBubbleChartDataRow:Object.assign({operation:{type:"string",isOptional:!1,description:""},rowGroup:{type:"string",isOptional:!0,description:""},rowGroupIndex:{type:"number",isOptional:!0,description:""},category:{type:"string",isOptional:!1,description:""},categoryIndex:{type:"number",isOptional:!1,description:""},subCategory:{type:"string",isOptional:!0,description:""},subCategoryIndex:{type:"number",isOptional:!0,description:""}},t)}}chartTemplate(){const t=this.prepareAxis("x",this.x),e=this.prepareAxis("y",this.y),i=this.prepareSize(),s=this.prepareShare(),r=this.prepareFacet();if(this.validateCrossProp([null==t?void 0:t.measure,null==e?void 0:e.measure,null==i?void 0:i.measure,null==s?void 0:s.measure],r),this.validateSizeScaling(),this.hasBlockingErrors()||null===t||null===e||null===i)return null;const n=this.preparePointLevel(),o=this.prepareI18n(),l=this.prepareStyle(),h=u(this.element).width;return a("ibcs-chart-bubble",{tableName:this.datasetName,dataVersion:this.dataVersion,chartTitle:this.chartTitle,x:t,y:e,size:i,share:s,compareFamily:this.prepareCompareFamily(),labels:this.prepareLabels(),legend:this.prepareLegend(),facet:r,pointLevel:n,seriesLevel:this.prepareSeriesLevel(n),aspect:this.prepareAspect(),limit:this.prepareLimit(),filter:this.filter,sizeAreaPerUnit:this.prepareSizeAreaPerUnit(),styles:l,i18n:o,containerWidth:h,ruleSetConfig:this.ruleSetConfig(),errors:this.errors,translate:this.translateForInner})}render(){return a(r,{key:"0bfa49a51e13bdc7a52a57539f3c9228bed2dfd1",style:this.getFontStyles()},a("div",{key:"12c6edc017728be62060ae4f9196e26e73c07e25",class:"container"},this.chartTemplate()))}get element(){return this}static get watchers(){return{filter:[{validateFilter:0}],x:[{validateX:0}],y:[{validateY:0}],size:[{validateSize:0}],share:[{validateShare:0}],compareWith:[{validateCompareWith:0}],level:[{validateLevel:0}],seriesLevel:[{validateSeriesLevel:0}],facet:[{validateFacet:0}],labels:[{validateLabels:0}],legend:[{validateLegend:0}],aspect:[{validateAspect:0}],limit:[{validateLimit:0}],scale:[{validateScale:0}]}}static get style(){return':host(.no-data){display:block;box-sizing:border-box;width:100%;height:100%}:host(.no-data)>div{float:none;width:100%;height:100%}:host(.no-data) .no-data~.no-data{display:none}.empty-state{box-sizing:border-box;display:flex;align-items:center;justify-content:center;float:none;width:100%;height:100%;min-height:3em;margin:0;padding:0.5em;overflow:hidden;border:0.1em dashed #ddd;color:#808080;font-family:var(--bn-font-family, "Noto Sans", sans-serif);font-size:var(--bn-font-size, 13.3333px);font-style:normal;text-align:center}:host{display:inline-block;position:relative;overflow:hidden;font-family:var(--bn-font-family, "Noto Sans", sans-serif);font-size:var(--bn-font-size, 13.3333px);color:var(--bn-font-color, #000000)}.container{display:flex;flex-direction:column}'}},[1,"bn-chart-bubble",{ruleset:[513],chartTitle:[1,"chart-title"],filter:[1],x:[1],y:[1],size:[1],share:[1],compareWith:[1,"compare-with"],level:[1],seriesLevel:[1,"series-level"],facet:[1],labels:[1],legend:[1],aspect:[1],limit:[2],scale:[1],datasetName:[32],dataVersion:[32],datasetMeta:[32],appliedScaleFactor:[32],getLayoutState:[64]},void 0,{filter:[{validateFilter:0}],x:[{validateX:0}],y:[{validateY:0}],size:[{validateSize:0}],share:[{validateShare:0}],compareWith:[{validateCompareWith:0}],level:[{validateLevel:0}],seriesLevel:[{validateSeriesLevel:0}],facet:[{validateFacet:0}],labels:[{validateLabels:0}],legend:[{validateLegend:0}],aspect:[{validateAspect:0}],limit:[{validateLimit:0}],scale:[{validateScale:0}]}]),T=D,I=function(){"undefined"!=typeof customElements&&["bn-chart-bubble","ibcs-chart-bubble"].forEach((t=>{switch(t){case"bn-chart-bubble":customElements.get(n(t))||customElements.define(n(t),D);break;case"ibcs-chart-bubble":customElements.get(n(t))||W()}}))};export{T as BnChartBubble,I as defineCustomElement}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{proxyCustomElement as t,HTMLElement as e,writeTask as i,forceUpdate as s,h as a,Host as r,transformTag as n}from"@stencil/core/internal/client";import{o as l}from"./geometry.js";import{c as o}from"./svgChartElements.js";import{a as u}from"./context-protocol.js";import{C as h,A as d}from"./CompareUtil.js";import{o as c}from"./layoutObserver.js";import{O as v,b as p,a as m}from"./Order.js";import{w as g,g as f}from"./withDataset.js";import{p as b}from"./scaling.js";import{b as y,i as _,c as w,h as O}from"./validate.js";import{w as R,a as A}from"./withHasError.js";import{w as E}from"./withComponentStyle.js";import{w as j}from"./withRuleSet.js";import{w as S}from"./withTranslation.js";import{w as T}from"./withStyled.js";import{r as N}from"./VarianceMeasure.js";import{p as x}from"./AxisConfig.js";import{d as L}from"./ibcs-chart-bullet2.js";const $=["measure","label","unit"];function z(t){const e=[],i=F(t,"measure",e);if(void 0===i||""===i.trim())return e.push("measure"),{config:null,unknownKeys:C(t,$),invalidFields:e};const s={measure:i.trim()};return s.label=F(t,"label",e),s.unit=F(t,"unit",e),{config:s,unknownKeys:C(t,$),invalidFields:e}}const U=["show","decimals"];function k(t,e){const i=[],s={show:e.show,decimals:e.decimals};return h.isExisting(t.show)&&("auto"===t.show||"none"===t.show?s.show=t.show:i.push("show")),h.isExisting(t.decimals)&&(h.isNumber(t.decimals)&&t.decimals>=0&&t.decimals<=4?s.decimals=Math.floor(t.decimals):i.push("decimals")),{config:s,unknownKeys:C(t,U),invalidFields:i}}function D(t){var e;const i=null!==(e=null==t?void 0:t.trim())&&void 0!==e?e:"";if(""===i||"null"===i)return{ranges:[],parseError:!1,issues:[]};let s;try{s=JSON.parse(i)}catch(t){return{ranges:[],parseError:!0,issues:[]}}if(!Array.isArray(s)||0===s.length)return{ranges:[],parseError:!0,issues:[]};if(!s.every((t=>h.isNumber(t)&&isFinite(t)&&t>0)))return{ranges:[],parseError:!0,issues:[]};const a=[];let r=s;const n=[...r].sort(((t,e)=>t-e));return n.some(((t,e)=>t!==r[e]))&&a.push("not ascending, sorted"),r=n,r.length>2&&(a.push(r.length+" entries, first 2 kept"),r=r.slice(0,2)),{ranges:r,parseError:!1,issues:a}}function C(t,e){return Object.keys(t).filter((t=>!e.includes(t)))}function F(t,e,i){if(h.isExisting(t[e]))return h.isString(t[e])?t[e]:void i.push(e)}const M=["pl1","pp1","fc1"],W=t(class extends e{validateActual(t){this.validateMeasureSpec("actual",t)}validateTarget(t){this.validateMeasureSpec("target",t)}validateRanges(t){const e="ERR_bullet_json_ranges",i="WARN_bullet_ranges",s=D(t);if(s.parseError)return this.setBlockingError(e,this.t(".bullet-prop-json",{prop:"ranges"})),void this.errors.remove(i);this.setBlockingError(e,null),s.issues.length>0?this.errors.addOrReplace({id:i,type:"warning",message:this.t(".bullet-ranges-invalid",{detail:s.issues.join("; ")})}):this.errors.remove(i)}validateNormalize(t){this.validateEnum("normalize","ERR_normalize",t,["target","none"],"target")}validateVariances(t){this.validateEnum("variances","ERR_variances",t,["auto","none"],"auto")}validateLevel(t){this.validateEnum("level","ERR_level",t,["auto","rowgroup","category","subcategory"],"auto")}validateOrder(t){const e="ERR_order",i=y(t).filter((t=>""!==t));0===i.length?this.errors.remove(e):this.errors.addOrReplace({id:e,type:"warning",message:`order: invalid value(s) '${i.join(", ")}'; using the dataset order.`})}validateOrderDirection(t){const e="ERR_orderDirection";_(t)||w(t)?this.errors.remove(e):this.errors.addOrReplace({id:e,type:"warning",message:`order-direction: invalid value '${t}' — expected asc/desc; using asc.`})}validateLimit(t){const e="ERR_limit";O(t)&&Number(t)>=0?this.errors.remove(e):this.errors.addOrReplace({id:e,type:"warning",message:`limit: invalid value '${t}' — expected a non-negative integer; using 0.`})}validateLabels(t){const e="ERR_bullet_json_labels",i="WARN_bullet_fields_labels",{data:s,parseError:a}=x(t,null);if(a)return this.setBlockingError(e,this.t(".bullet-prop-json",{prop:"labels"})),void this.errors.remove(i);this.setBlockingError(e,null),null!==s?this.reportSpecIssues(i,"labels",k(s,this.labelDefaults())):this.errors.remove(i)}validateScale(t){const e="ERR_scale";if(_(t))return void this.errors.remove(e);const{mode:i,factor:s}=b(t);"factor"===i&&(void 0===s||s<=0)?this.errors.addOrReplace({id:e,type:"warning",message:`scale: invalid value '${t}' — expected none/auto or a positive number.`}):this.errors.remove(e)}constructor(t){super(),!1!==t&&this.__registerHost(),this.__attachShadow(),this.datasetName="",this.dataVersion=0,this.datasetMeta=null,this.appliedScaleFactor=1,this.layoutObserver=null,this.activeErrors=new Set,this.chartTitle="",this.filter="",this.actual="",this.target="",this.ranges="",this.normalize="target",this.variances="auto",this.level="auto",this.order="",this.orderDirection="",this.limit=0,this.labels="",this._autoScaleGuard=!1,this._lastScaledParentHeight=0,this.translateForInner=(t,e)=>this.t(t,e),T(this),R(this),g(this,(t=>{this.datasetName=(null==t?void 0:t.startsWith("$"))?t.substring(1):t||"",this.dataVersion=this.dataVersion+1}),((t,e)=>{this.datasetMeta=e})),this.errors=A(this),this.componentStyle=E(this),this.ruleSetConfig=j(this),this.t=S(this).t}componentWillLoad(){this.validateActual(this.actual),this.validateTarget(this.target),this.validateRanges(this.ranges),this.validateNormalize(this.normalize),this.validateVariances(this.variances),this.validateLevel(this.level),this.validateOrder(this.order),this.validateOrderDirection(this.orderDirection),this.validateLimit(this.limit),this.validateLabels(this.labels),this.validateScale(this.scale)}componentDidRender(){const{mode:t}=b(this.scale);if("auto"!==t&&"empty"!==t)return void(this._autoScaleGuard=!1);if(this._autoScaleGuard)return void(this._autoScaleGuard=!1);const e=this.element,{height:s}=f(e);if(s<=0)return;this._lastScaledParentHeight=s;const a=this.componentStyle((t=>{var e;return(null===(e=t.global)||void 0===e?void 0:e.fontSizePx)||13.3333})),r=e.scrollHeight,n=this.appliedScaleFactor;if(r<=s+1)return void this.errors.remove("AUTO_scale");const l=Math.max(.3,n*(s-1)/r);Math.abs(l-n)<.01||(e.style.setProperty("--bn-font-size",a*l+"px"),"empty"===t?this.errors.addOrReplace({id:"AUTO_scale",type:"warning",message:"Auto-scaled chart by factor "+l.toFixed(3)}):this.errors.remove("AUTO_scale"),this._autoScaleGuard=!0,i((()=>{this.appliedScaleFactor=l})))}componentDidLoad(){this.layoutObserver=c(this.element,(()=>{if(this._autoScaleGuard)return;const{height:t}=f(this.element);t>0&&Math.abs(t-this._lastScaledParentHeight)>2&&(this._lastScaledParentHeight=t,s(this))})),requestAnimationFrame((()=>{requestAnimationFrame((()=>{if(this._autoScaleGuard)return;const{height:t}=f(this.element);this._lastScaledParentHeight=t,s(this)}))}))}disconnectedCallback(){var t;null===(t=this.layoutObserver)||void 0===t||t.disconnect(),this.layoutObserver=null}labelDefaults(){return{show:"auto",decimals:1}}setBlockingError(t,e){null===e?(this.errors.remove(t),this.activeErrors.delete(t)):(this.errors.addOrReplace({id:t,type:"error",message:e}),this.activeErrors.add(t))}hasBlockingErrors(){return this.activeErrors.size>0}validateMeasureSpec(t,e){var i;const s="ERR_bullet_json_"+t,a="ERR_bullet_measure_"+t,r="WARN_bullet_fields_"+t,{data:n,parseError:l}=x(e,"measure");if(l)return this.setBlockingError(s,this.t(".bullet-prop-json",{prop:t})),this.setBlockingError(a,null),void this.errors.remove(r);if(this.setBlockingError(s,null),null===n)return this.setBlockingError(a,null),void this.errors.remove(r);const o=(null!==(i=n.measure)&&void 0!==i?i:"").trim(),u=N(o);"auto"===o.toLowerCase()||null!==u&&"scenario"===u.kind?this.setBlockingError(a,null):this.setBlockingError(a,this.t(".bullet-measure-invalid",{prop:t,measure:o})),this.reportSpecIssues(r,t,z(n))}validateEnum(t,e,i,s,a){_(i)||s.includes(i.trim().toLowerCase())?this.errors.remove(e):this.errors.addOrReplace({id:e,type:"warning",message:`${t}: invalid value '${i}' — expected ${s.join("/")}; using '${a}'.`})}reportSpecIssues(t,e,i){const s=[];null!==i&&i.invalidFields.length>0&&s.push("invalid: "+i.invalidFields.join(", ")),null!==i&&i.unknownKeys.length>0&&s.push("unknown: "+i.unknownKeys.join(", ")),s.length>0?this.errors.addOrReplace({id:t,type:"warning",message:`${e}: ignored sub-fields (${s.join("; ")}).`}):this.errors.remove(t)}prepareActual(){var t,e,i,s,a;const{data:r,parseError:n}=x(this.actual,"measure");if(n)return null;const l=null!==r?z(r).config:null;if(null===l||"auto"===l.measure.toLowerCase()){const a=null!==l,r=null!==(e=null===(t=this.datasetMeta)||void 0===t?void 0:t.availableScenarios)&&void 0!==e?e:[],n=null!==(s=r.includes("ac1")?"ac1":null!==(i=r.find((t=>t.startsWith("ac"))))&&void 0!==i?i:r[0])&&void 0!==s?s:"ac1";return a||null===this.datasetMeta?this.errors.remove("AUTO_actual"):this.errors.addOrReplace({id:"AUTO_actual",type:"warning",message:"actual: not set, auto-detected: "+n}),null===l?{measure:n}:Object.assign(Object.assign({},l),{measure:n})}return this.errors.remove("AUTO_actual"),"scenario"===(null===(a=N(l.measure))||void 0===a?void 0:a.kind)?l:null}prepareTarget(){var t,e,i;const{data:s,parseError:a}=x(this.target,"measure");if(a)return null;const r=null!==s?z(s).config:null;if(null===r||"auto"===r.measure.toLowerCase()){const i=null!==r,s=null!==(e=null===(t=this.datasetMeta)||void 0===t?void 0:t.availableScenarios)&&void 0!==e?e:[],a=M.find((t=>s.includes(t)));return void 0===a?(this.errors.remove("AUTO_target"),null!==this.datasetMeta?this.errors.addOrReplace({id:"WARN_bullet_target_unavailable",type:"warning",message:this.t(".bullet-target-none")}):this.errors.remove("WARN_bullet_target_unavailable"),null):(this.errors.remove("WARN_bullet_target_unavailable"),i||null===this.datasetMeta?this.errors.remove("AUTO_target"):this.errors.addOrReplace({id:"AUTO_target",type:"warning",message:"target: not set, auto-detected: "+a}),null===r?{measure:a}:Object.assign(Object.assign({},r),{measure:a}))}return this.errors.remove("AUTO_target"),this.errors.remove("WARN_bullet_target_unavailable"),"scenario"===(null===(i=N(r.measure))||void 0===i?void 0:i.kind)?r:null}prepareNormalize(){var t;return"none"===(null===(t=this.normalize)||void 0===t?void 0:t.trim().toLowerCase())?"none":"target"}prepareShowVariances(){var t;return"none"!==(null===(t=this.variances)||void 0===t?void 0:t.trim().toLowerCase())}prepareLevel(){var t,e;const i=null===(t=this.level)||void 0===t?void 0:t.trim().toLowerCase();if("rowgroup"===i)return d.ROWGROUP;if("category"===i)return d.CATEGORY;if("subcategory"===i)return d.SUBCATEGORY;const s=null===(e=this.datasetMeta)||void 0===e?void 0:e.suggestedLevel;if(void 0!==s&&""!==s){const t=d[s.toUpperCase()];if(void 0!==t)return t}return d.CATEGORY}prepareOrder(){var t,e,i,s;const a="auto"===(null===(t=this.order)||void 0===t?void 0:t.trim().toLowerCase());let r;_(this.order)||a?(null===(e=this.datasetMeta)||void 0===e?void 0:e.suggestedOrder)?(a?this.errors.remove("AUTO_order"):this.errors.addOrReplace({id:"AUTO_order",type:"warning",message:"order: not set, auto-detected: "+this.datasetMeta.suggestedOrder}),r=this.datasetMeta.suggestedOrder):(this.errors.remove("AUTO_order"),r=""):(this.errors.remove("AUTO_order"),r=this.order);const n=null!==(s=v[null===(i=this.orderDirection)||void 0===i?void 0:i.toUpperCase()])&&void 0!==s?s:v.ASC;if(_(r))return new p([m.CATEGORYINDEX],n);const l=r.split(",").map((t=>m[t.trim().toUpperCase()])).filter((t=>void 0!==t));return new p(l.length>0?l:[m.CATEGORYINDEX],n)}prepareLabels(){const t=this.labelDefaults(),{data:e,parseError:i}=x(this.labels,null);return i||null===e?{show:t.show,decimals:t.decimals}:k(e,t).config}prepareLimit(){const t=Math.floor(Number(this.limit)||0);return t>0?t:0}i18nLocalKeys(){return["no-data","target","axis.in"]}prepareI18n(){const t=new Map(this.i18nLocalKeys().map((t=>[t,this.t(".".concat(t))]))),e=new Map(u.map((t=>[t,this.t("global.".concat(t))])));return new Map([...e.entries(),...t.entries()])}prepareStyle(){const t=this.getEffectiveScaleFactor();return this.componentStyle((e=>{const i=e.global.fontSizePx*t;return{scaleFactors:e["bn-chart-bullet"].scaleFactors,fontStyles:{font:`${i}px ${e.global.fontFamily}`,size:i,color:e.global.fontColor,background:e.global.fontBackgroundColor,leading:1.8},axisStyles:e["bn-chart-bullet"].axisStyles,barStyles:e["bn-chart-bullet"].barStyles,varianceStyles:e["bn-chart-bullet"].varianceStyles,rangeColors:e["bn-chart-bullet"].rangeColors,padding:e["bn-chart-bullet"].padding}}))}async getLayoutState(t){var e;const i=null!==(e=null==t?void 0:t.detail)&&void 0!==e?e:"summary",s=l(this.element),a=this.getEffectiveScaleFactor(),r=Number.isFinite(a)&&a>0?a:1,n=this.componentStyle((t=>{var e;return(null===(e=t.global)||void 0===e?void 0:e.fontSizePx)||13.3333}))*r;return o(this.element,"ibcs-chart-bullet",this.chartTitle||void 0,{fontSizePx:n,appliedScaleFactor:r},s,i)}getEffectiveScaleFactor(){const{mode:t,factor:e}=b(this.scale);return"factor"===t?e:"auto"===t||"empty"===t?this.appliedScaleFactor:1}getFontStyles(){const t=this.getEffectiveScaleFactor();return this.componentStyle((e=>{var i,s,a,r;const n=(null===(i=e.global)||void 0===i?void 0:i.fontSizePx)||13.3333;return{"--bn-font-family":(null===(s=e.global)||void 0===s?void 0:s.fontFamily)||"'Noto Sans', sans-serif","--bn-font-size":n*t+"px","--bn-font-color":(null===(a=e.global)||void 0===a?void 0:a.fontColor)||"#000000","--bn-font-background":(null===(r=e.global)||void 0===r?void 0:r.fontBackgroundColor)||"#ffffff"}}))}getDataStructure(){const t={};for(const e of["ac","pp","fc","pl"])for(const i of[1,2,3,4])t[`${e}${i}`]={type:"number",isOptional:!0,description:""};const e={actual:this.prepareActual(),target:this.prepareTarget()};for(const[i,s]of Object.entries(e))null!==s&&void 0!==t[s.measure]&&(t[s.measure].description=`${i}: ${void 0!==s.label?s.label:s.measure}`);return{IBulletChartDataRow:Object.assign({operation:{type:"string",isOptional:!1,description:""},rowGroup:{type:"string",isOptional:!0,description:""},rowGroupIndex:{type:"number",isOptional:!0,description:""},category:{type:"string",isOptional:!1,description:""},categoryIndex:{type:"number",isOptional:!1,description:""},subCategory:{type:"string",isOptional:!0,description:""},subCategoryIndex:{type:"number",isOptional:!0,description:""}},t)}}chartTemplate(){const t=this.prepareActual(),e=this.prepareTarget(),i=D(this.ranges).ranges,s=this.prepareNormalize();return this.setBlockingError("ERR_bullet_measure_same",null!==t&&null!==e&&t.measure===e.measure?this.t(".bullet-measure-same",{measure:t.measure}):null),i.length>0&&"target"===s?this.errors.addOrReplace({id:"WARN_bullet_ranges_ignored",type:"warning",message:this.t(".bullet-ranges-ignored")}):this.errors.remove("WARN_bullet_ranges_ignored"),this.hasBlockingErrors()||null===t?null:a("ibcs-chart-bullet",{tableName:this.datasetName,dataVersion:this.dataVersion,chartTitle:this.chartTitle,actual:t,target:e,ranges:i,normalize:s,showVariances:this.prepareShowVariances(),level:this.prepareLevel(),order:this.prepareOrder(),limit:this.prepareLimit(),labels:this.prepareLabels(),filter:this.filter,styles:this.prepareStyle(),i18n:this.prepareI18n(),containerWidth:f(this.element).width,ruleSetConfig:this.ruleSetConfig(),errors:this.errors,translate:this.translateForInner})}render(){return a(r,{key:"31096e122fe62354e4a9ad0a15af5329a72265ba",style:this.getFontStyles()},a("div",{key:"8288f32a3ac40790136b751a5630787cfd958a9d",class:"container"},this.chartTemplate()))}get element(){return this}static get watchers(){return{actual:[{validateActual:0}],target:[{validateTarget:0}],ranges:[{validateRanges:0}],normalize:[{validateNormalize:0}],variances:[{validateVariances:0}],level:[{validateLevel:0}],order:[{validateOrder:0}],orderDirection:[{validateOrderDirection:0}],limit:[{validateLimit:0}],labels:[{validateLabels:0}],scale:[{validateScale:0}]}}static get style(){return':host{display:inline-block;position:relative;overflow:hidden;font-family:var(--bn-font-family, "Noto Sans", sans-serif);font-size:var(--bn-font-size, 13.3333px);color:var(--bn-font-color, #000000)}.container{display:flex;flex-direction:column}'}},[1,"bn-chart-bullet",{ruleset:[513],chartTitle:[1,"chart-title"],filter:[1],actual:[1],target:[1],ranges:[1],normalize:[1],variances:[1],level:[1],order:[1],orderDirection:[1,"order-direction"],limit:[2],labels:[1],scale:[1],datasetName:[32],dataVersion:[32],datasetMeta:[32],appliedScaleFactor:[32],getLayoutState:[64]},void 0,{actual:[{validateActual:0}],target:[{validateTarget:0}],ranges:[{validateRanges:0}],normalize:[{validateNormalize:0}],variances:[{validateVariances:0}],level:[{validateLevel:0}],order:[{validateOrder:0}],orderDirection:[{validateOrderDirection:0}],limit:[{validateLimit:0}],labels:[{validateLabels:0}],scale:[{validateScale:0}]}]),V=W,I=function(){"undefined"!=typeof customElements&&["bn-chart-bullet","ibcs-chart-bullet"].forEach((t=>{switch(t){case"bn-chart-bullet":customElements.get(n(t))||customElements.define(n(t),W);break;case"ibcs-chart-bullet":customElements.get(n(t))||L()}}))};export{V as BnChartBullet,I as defineCustomElement}
|
|
1
|
+
import{proxyCustomElement as t,HTMLElement as e,writeTask as i,forceUpdate as s,h as a,Host as r,transformTag as n}from"@stencil/core/internal/client";import{h as l,a as o}from"./context-protocol.js";import{o as h}from"./geometry.js";import{c as u}from"./svgChartElements.js";import{C as d,A as c}from"./CompareUtil.js";import{o as v}from"./layoutObserver.js";import{a as p,b as m,O as g}from"./Order.js";import{g as f}from"./parentDimensions.js";import{p as b}from"./scaling.js";import{b as y,i as _,c as w,h as R}from"./validate.js";import{w as O}from"./withComponentStatus.js";import{w as j}from"./withComponentStyle.js";import{w as A}from"./withDataset.js";import{w as E}from"./withHasError.js";import{w as S}from"./withRuleSet.js";import{w as x}from"./withTranslation.js";import{w as N}from"./withStyled.js";import{r as T}from"./VarianceMeasure.js";import{p as z}from"./AxisConfig.js";import{s as k}from"./emptyState.js";import{d as L}from"./ibcs-chart-bullet2.js";const $=["measure","label","unit"];function U(t){const e=[],i=W(t,"measure",e);if(void 0===i||""===i.trim())return e.push("measure"),{config:null,unknownKeys:M(t,$),invalidFields:e};const s={measure:i.trim()};return s.label=W(t,"label",e),s.unit=W(t,"unit",e),{config:s,unknownKeys:M(t,$),invalidFields:e}}const D=["show","decimals"];function F(t,e){const i=[],s={show:e.show,decimals:e.decimals};return d.isExisting(t.show)&&("auto"===t.show||"none"===t.show?s.show=t.show:i.push("show")),d.isExisting(t.decimals)&&(d.isNumber(t.decimals)&&t.decimals>=0&&t.decimals<=4?s.decimals=Math.floor(t.decimals):i.push("decimals")),{config:s,unknownKeys:M(t,D),invalidFields:i}}function C(t){var e;const i=null!==(e=null==t?void 0:t.trim())&&void 0!==e?e:"";if(""===i||"null"===i)return{ranges:[],parseError:!1,issues:[]};let s;try{s=JSON.parse(i)}catch(t){return{ranges:[],parseError:!0,issues:[]}}if(!Array.isArray(s)||0===s.length)return{ranges:[],parseError:!0,issues:[]};if(!s.every((t=>d.isNumber(t)&&isFinite(t)&&t>0)))return{ranges:[],parseError:!0,issues:[]};const a=[];let r=s;const n=[...r].sort(((t,e)=>t-e));return n.some(((t,e)=>t!==r[e]))&&a.push("not ascending, sorted"),r=n,r.length>2&&(a.push(r.length+" entries, first 2 kept"),r=r.slice(0,2)),{ranges:r,parseError:!1,issues:a}}function M(t,e){return Object.keys(t).filter((t=>!e.includes(t)))}function W(t,e,i){if(d.isExisting(t[e]))return d.isString(t[e])?t[e]:void i.push(e)}const V=["pl1","pp1","fc1"],I=t(class extends e{validateFilter(t){const e="ERR_filter";l(t)?this.errors.addOrReplace({id:e,type:"error",message:"filter: double backticks are not allowed."}):this.errors.remove(e)}validateActual(t){this.validateMeasureSpec("actual",t)}validateTarget(t){this.validateMeasureSpec("target",t)}validateRanges(t){const e="ERR_bullet_json_ranges",i="WARN_bullet_ranges",s=C(t);if(s.parseError)return this.setBlockingError(e,this.t(".bullet-prop-json",{prop:"ranges"})),void this.errors.remove(i);this.setBlockingError(e,null),s.issues.length>0?this.errors.addOrReplace({id:i,type:"warning",message:this.t(".bullet-ranges-invalid",{detail:s.issues.join("; ")})}):this.errors.remove(i)}validateNormalize(t){this.validateEnum("normalize","ERR_normalize",t,["target","none"],"target")}validateVariances(t){this.validateEnum("variances","ERR_variances",t,["auto","none"],"auto")}validateLevel(t){this.validateEnum("level","ERR_level",t,["auto","rowgroup","category","subcategory"],"auto")}validateOrder(t){const e="ERR_order",i=y(t).filter((t=>""!==t));0===i.length?this.errors.remove(e):this.errors.addOrReplace({id:e,type:"warning",message:`order: invalid value(s) '${i.join(", ")}'; using the dataset order.`})}validateOrderDirection(t){const e="ERR_orderDirection";_(t)||w(t)?this.errors.remove(e):this.errors.addOrReplace({id:e,type:"warning",message:`order-direction: invalid value '${t}' - expected asc/desc; using asc.`})}validateLimit(t){const e="ERR_limit";R(t)&&Number(t)>=0?this.errors.remove(e):this.errors.addOrReplace({id:e,type:"warning",message:`limit: invalid value '${t}' - expected a non-negative integer; using 0.`})}validateLabels(t){const e="ERR_bullet_json_labels",i="WARN_bullet_fields_labels",{data:s,parseError:a}=z(t,null);if(a)return this.setBlockingError(e,this.t(".bullet-prop-json",{prop:"labels"})),void this.errors.remove(i);this.setBlockingError(e,null),null!==s?this.reportSpecIssues(i,"labels",F(s,this.labelDefaults())):this.errors.remove(i)}validateScale(t){const e="ERR_scale";if(_(t))return void this.errors.remove(e);const{mode:i,factor:s}=b(t);"factor"===i&&(void 0===s||s<=0)?this.errors.addOrReplace({id:e,type:"warning",message:`scale: invalid value '${t}' - expected none/auto or a positive number.`}):this.errors.remove(e)}constructor(t){super(),!1!==t&&this.__registerHost(),this.__attachShadow(),this.datasetName="",this.dataVersion=0,this.datasetMeta=null,this.appliedScaleFactor=1,this.layoutObserver=null,this.activeErrors=new Set,this.chartTitle="",this.filter="",this.actual="",this.target="",this.ranges="",this.normalize="target",this.variances="auto",this.level="auto",this.order="",this.orderDirection="",this.limit=0,this.labels="",this._autoScaleGuard=!1,this._lastScaledParentHeight=0,this.translateForInner=(t,e)=>this.t(t,e),N(this),O(this),A(this,(t=>{this.datasetName=(null==t?void 0:t.startsWith("$"))?t.substring(1):t||"",this.dataVersion=this.dataVersion+1}),((t,e)=>{this.datasetMeta=e})),this.errors=E(this),this.componentStyle=j(this),this.ruleSetConfig=S(this),this.t=x(this).t}componentWillLoad(){this.validateFilter(this.filter),this.validateActual(this.actual),this.validateTarget(this.target),this.validateRanges(this.ranges),this.validateNormalize(this.normalize),this.validateVariances(this.variances),this.validateLevel(this.level),this.validateOrder(this.order),this.validateOrderDirection(this.orderDirection),this.validateLimit(this.limit),this.validateLabels(this.labels),this.validateScale(this.scale)}componentDidRender(){k(this.element,"ibcs-chart-bullet");const{mode:t}=b(this.scale);if("auto"!==t&&"empty"!==t)return void(this._autoScaleGuard=!1);if(this._autoScaleGuard)return void(this._autoScaleGuard=!1);const e=this.element,{height:s}=f(e);if(s<=0)return;this._lastScaledParentHeight=s;const a=this.componentStyle((t=>{var e;return(null===(e=t.global)||void 0===e?void 0:e.fontSizePx)||13.3333})),r=e.scrollHeight,n=this.appliedScaleFactor;if(r<=s+1)return void this.errors.remove("AUTO_scale");const l=Math.max(.3,n*(s-1)/r);Math.abs(l-n)<.01||(e.style.setProperty("--bn-font-size",a*l+"px"),"empty"===t?this.errors.addOrReplace({id:"AUTO_scale",type:"warning",message:"Auto-scaled chart by factor "+l.toFixed(3)}):this.errors.remove("AUTO_scale"),this._autoScaleGuard=!0,i((()=>{this.appliedScaleFactor=l})))}componentDidLoad(){this.layoutObserver=v(this.element,(()=>{if(this._autoScaleGuard)return;const{height:t}=f(this.element);t>0&&Math.abs(t-this._lastScaledParentHeight)>2&&(this._lastScaledParentHeight=t,s(this))})),requestAnimationFrame((()=>{requestAnimationFrame((()=>{if(this._autoScaleGuard)return;const{height:t}=f(this.element);this._lastScaledParentHeight=t,s(this)}))}))}disconnectedCallback(){var t;null===(t=this.layoutObserver)||void 0===t||t.disconnect(),this.layoutObserver=null}labelDefaults(){return{show:"auto",decimals:1}}setBlockingError(t,e){null===e?(this.errors.remove(t),this.activeErrors.delete(t)):(this.errors.addOrReplace({id:t,type:"error",message:e}),this.activeErrors.add(t))}hasBlockingErrors(){return this.activeErrors.size>0}validateMeasureSpec(t,e){var i;const s="ERR_bullet_json_"+t,a="ERR_bullet_measure_"+t,r="WARN_bullet_fields_"+t,{data:n,parseError:l}=z(e,"measure");if(l)return this.setBlockingError(s,this.t(".bullet-prop-json",{prop:t})),this.setBlockingError(a,null),void this.errors.remove(r);if(this.setBlockingError(s,null),null===n)return this.setBlockingError(a,null),void this.errors.remove(r);const o=(null!==(i=n.measure)&&void 0!==i?i:"").trim(),h=T(o);"auto"===o.toLowerCase()||null!==h&&"scenario"===h.kind?this.setBlockingError(a,null):this.setBlockingError(a,this.t(".bullet-measure-invalid",{prop:t,measure:o})),this.reportSpecIssues(r,t,U(n))}validateEnum(t,e,i,s,a){_(i)||s.includes(i.trim().toLowerCase())?this.errors.remove(e):this.errors.addOrReplace({id:e,type:"warning",message:`${t}: invalid value '${i}' - expected ${s.join("/")}; using '${a}'.`})}reportSpecIssues(t,e,i){const s=[];null!==i&&i.invalidFields.length>0&&s.push("invalid: "+i.invalidFields.join(", ")),null!==i&&i.unknownKeys.length>0&&s.push("unknown: "+i.unknownKeys.join(", ")),s.length>0?this.errors.addOrReplace({id:t,type:"warning",message:`${e}: ignored sub-fields (${s.join("; ")}).`}):this.errors.remove(t)}prepareActual(){var t,e,i,s,a;const{data:r,parseError:n}=z(this.actual,"measure");if(n)return null;const l=null!==r?U(r).config:null;if(null===l||"auto"===l.measure.toLowerCase()){const a=null!==l,r=null!==(e=null===(t=this.datasetMeta)||void 0===t?void 0:t.availableScenarios)&&void 0!==e?e:[],n=null!==(s=r.includes("ac1")?"ac1":null!==(i=r.find((t=>t.startsWith("ac"))))&&void 0!==i?i:r[0])&&void 0!==s?s:"ac1";return a||null===this.datasetMeta?this.errors.remove("AUTO_actual"):this.errors.addOrReplace({id:"AUTO_actual",type:"warning",message:"actual: not set, auto-detected: "+n}),null===l?{measure:n}:Object.assign(Object.assign({},l),{measure:n})}return this.errors.remove("AUTO_actual"),"scenario"===(null===(a=T(l.measure))||void 0===a?void 0:a.kind)?l:null}prepareTarget(){var t,e,i;const{data:s,parseError:a}=z(this.target,"measure");if(a)return null;const r=null!==s?U(s).config:null;if(null===r||"auto"===r.measure.toLowerCase()){const i=null!==r,s=null!==(e=null===(t=this.datasetMeta)||void 0===t?void 0:t.availableScenarios)&&void 0!==e?e:[],a=V.find((t=>s.includes(t)));return void 0===a?(this.errors.remove("AUTO_target"),null!==this.datasetMeta?this.errors.addOrReplace({id:"WARN_bullet_target_unavailable",type:"warning",message:this.t(".bullet-target-none")}):this.errors.remove("WARN_bullet_target_unavailable"),null):(this.errors.remove("WARN_bullet_target_unavailable"),i||null===this.datasetMeta?this.errors.remove("AUTO_target"):this.errors.addOrReplace({id:"AUTO_target",type:"warning",message:"target: not set, auto-detected: "+a}),null===r?{measure:a}:Object.assign(Object.assign({},r),{measure:a}))}return this.errors.remove("AUTO_target"),this.errors.remove("WARN_bullet_target_unavailable"),"scenario"===(null===(i=T(r.measure))||void 0===i?void 0:i.kind)?r:null}prepareNormalize(){var t;return"none"===(null===(t=this.normalize)||void 0===t?void 0:t.trim().toLowerCase())?"none":"target"}prepareShowVariances(){var t;return"none"!==(null===(t=this.variances)||void 0===t?void 0:t.trim().toLowerCase())}prepareLevel(){var t,e;const i=null===(t=this.level)||void 0===t?void 0:t.trim().toLowerCase();if("rowgroup"===i)return c.ROWGROUP;if("category"===i)return c.CATEGORY;if("subcategory"===i)return c.SUBCATEGORY;const s=null===(e=this.datasetMeta)||void 0===e?void 0:e.suggestedLevel;if(void 0!==s&&""!==s){const t=c[s.toUpperCase()];if(void 0!==t)return t}return c.CATEGORY}prepareOrder(){var t,e,i,s;const a="auto"===(null===(t=this.order)||void 0===t?void 0:t.trim().toLowerCase());let r;_(this.order)||a?(null===(e=this.datasetMeta)||void 0===e?void 0:e.suggestedOrder)?(a?this.errors.remove("AUTO_order"):this.errors.addOrReplace({id:"AUTO_order",type:"warning",message:"order: not set, auto-detected: "+this.datasetMeta.suggestedOrder}),r=this.datasetMeta.suggestedOrder):(this.errors.remove("AUTO_order"),r=""):(this.errors.remove("AUTO_order"),r=this.order);const n=null!==(s=p[null===(i=this.orderDirection)||void 0===i?void 0:i.toUpperCase()])&&void 0!==s?s:p.ASC;if(_(r))return new m([g.CATEGORYINDEX],n);const l=r.split(",").map((t=>g[t.trim().toUpperCase()])).filter((t=>void 0!==t));return new m(l.length>0?l:[g.CATEGORYINDEX],n)}prepareLabels(){const t=this.labelDefaults(),{data:e,parseError:i}=z(this.labels,null);return i||null===e?{show:t.show,decimals:t.decimals}:F(e,t).config}prepareLimit(){const t=Math.floor(Number(this.limit)||0);return t>0?t:0}i18nLocalKeys(){return["no-data","target","axis.in"]}prepareI18n(){const t=new Map(this.i18nLocalKeys().map((t=>[t,this.t(".".concat(t))]))),e=new Map(o.map((t=>[t,this.t("global.".concat(t))])));return new Map([...e.entries(),...t.entries()])}prepareStyle(){const t=this.getEffectiveScaleFactor();return this.componentStyle((e=>{const i=e.global.fontSizePx*t;return{scaleFactors:e["bn-chart-bullet"].scaleFactors,fontStyles:{font:`${i}px ${e.global.fontFamily}`,size:i,color:e.global.fontColor,background:e.global.fontBackgroundColor,leading:1.8},axisStyles:e["bn-chart-bullet"].axisStyles,barStyles:e["bn-chart-bullet"].barStyles,varianceStyles:e["bn-chart-bullet"].varianceStyles,rangeColors:e["bn-chart-bullet"].rangeColors,padding:e["bn-chart-bullet"].padding}}))}async getLayoutState(t){var e;const i=null!==(e=null==t?void 0:t.detail)&&void 0!==e?e:"summary",s=h(this.element),a=this.getEffectiveScaleFactor(),r=Number.isFinite(a)&&a>0?a:1,n=this.componentStyle((t=>{var e;return(null===(e=t.global)||void 0===e?void 0:e.fontSizePx)||13.3333}))*r;return u(this.element,"ibcs-chart-bullet",this.chartTitle||void 0,{fontSizePx:n,appliedScaleFactor:r},s,i)}getEffectiveScaleFactor(){const{mode:t,factor:e}=b(this.scale);return"factor"===t?e:"auto"===t||"empty"===t?this.appliedScaleFactor:1}getFontStyles(){const t=this.getEffectiveScaleFactor();return this.componentStyle((e=>{var i,s,a,r;const n=(null===(i=e.global)||void 0===i?void 0:i.fontSizePx)||13.3333;return{"--bn-font-family":(null===(s=e.global)||void 0===s?void 0:s.fontFamily)||"'Noto Sans', sans-serif","--bn-font-size":n*t+"px","--bn-font-color":(null===(a=e.global)||void 0===a?void 0:a.fontColor)||"#000000","--bn-font-background":(null===(r=e.global)||void 0===r?void 0:r.fontBackgroundColor)||"#ffffff"}}))}getDataStructure(){const t={};for(const e of["ac","pp","fc","pl"])for(const i of[1,2,3,4])t[`${e}${i}`]={type:"number",isOptional:!0,description:""};const e={actual:this.prepareActual(),target:this.prepareTarget()};for(const[i,s]of Object.entries(e))null!==s&&void 0!==t[s.measure]&&(t[s.measure].description=`${i}: ${void 0!==s.label?s.label:s.measure}`);return{IBulletChartDataRow:Object.assign({operation:{type:"string",isOptional:!1,description:""},rowGroup:{type:"string",isOptional:!0,description:""},rowGroupIndex:{type:"number",isOptional:!0,description:""},category:{type:"string",isOptional:!1,description:""},categoryIndex:{type:"number",isOptional:!1,description:""},subCategory:{type:"string",isOptional:!0,description:""},subCategoryIndex:{type:"number",isOptional:!0,description:""}},t)}}chartTemplate(){const t=this.prepareActual(),e=this.prepareTarget(),i=C(this.ranges).ranges,s=this.prepareNormalize();return this.setBlockingError("ERR_bullet_measure_same",null!==t&&null!==e&&t.measure===e.measure?this.t(".bullet-measure-same",{measure:t.measure}):null),i.length>0&&"target"===s?this.errors.addOrReplace({id:"WARN_bullet_ranges_ignored",type:"warning",message:this.t(".bullet-ranges-ignored")}):this.errors.remove("WARN_bullet_ranges_ignored"),this.hasBlockingErrors()||null===t?null:a("ibcs-chart-bullet",{tableName:this.datasetName,dataVersion:this.dataVersion,chartTitle:this.chartTitle,actual:t,target:e,ranges:i,normalize:s,showVariances:this.prepareShowVariances(),level:this.prepareLevel(),order:this.prepareOrder(),limit:this.prepareLimit(),labels:this.prepareLabels(),filter:this.filter,styles:this.prepareStyle(),i18n:this.prepareI18n(),containerWidth:f(this.element).width,ruleSetConfig:this.ruleSetConfig(),errors:this.errors,translate:this.translateForInner})}render(){return a(r,{key:"895f33380b663aff0f9aa116add2d485e02588e6",style:this.getFontStyles()},a("div",{key:"58425ce02fa1cf074333464dfe17e702fd41acb0",class:"container"},this.chartTemplate()))}get element(){return this}static get watchers(){return{filter:[{validateFilter:0}],actual:[{validateActual:0}],target:[{validateTarget:0}],ranges:[{validateRanges:0}],normalize:[{validateNormalize:0}],variances:[{validateVariances:0}],level:[{validateLevel:0}],order:[{validateOrder:0}],orderDirection:[{validateOrderDirection:0}],limit:[{validateLimit:0}],labels:[{validateLabels:0}],scale:[{validateScale:0}]}}static get style(){return':host(.no-data){display:block;box-sizing:border-box;width:100%;height:100%}:host(.no-data)>div{float:none;width:100%;height:100%}:host(.no-data) .no-data~.no-data{display:none}.empty-state{box-sizing:border-box;display:flex;align-items:center;justify-content:center;float:none;width:100%;height:100%;min-height:3em;margin:0;padding:0.5em;overflow:hidden;border:0.1em dashed #ddd;color:#808080;font-family:var(--bn-font-family, "Noto Sans", sans-serif);font-size:var(--bn-font-size, 13.3333px);font-style:normal;text-align:center}:host{display:inline-block;position:relative;overflow:hidden;font-family:var(--bn-font-family, "Noto Sans", sans-serif);font-size:var(--bn-font-size, 13.3333px);color:var(--bn-font-color, #000000)}.container{display:flex;flex-direction:column}'}},[1,"bn-chart-bullet",{ruleset:[513],chartTitle:[1,"chart-title"],filter:[1],actual:[1],target:[1],ranges:[1],normalize:[1],variances:[1],level:[1],order:[1],orderDirection:[1,"order-direction"],limit:[2],labels:[1],scale:[1],datasetName:[32],dataVersion:[32],datasetMeta:[32],appliedScaleFactor:[32],getLayoutState:[64]},void 0,{filter:[{validateFilter:0}],actual:[{validateActual:0}],target:[{validateTarget:0}],ranges:[{validateRanges:0}],normalize:[{validateNormalize:0}],variances:[{validateVariances:0}],level:[{validateLevel:0}],order:[{validateOrder:0}],orderDirection:[{validateOrderDirection:0}],limit:[{validateLimit:0}],labels:[{validateLabels:0}],scale:[{validateScale:0}]}]),K=I,B=function(){"undefined"!=typeof customElements&&["bn-chart-bullet","ibcs-chart-bullet"].forEach((t=>{switch(t){case"bn-chart-bullet":customElements.get(n(t))||customElements.define(n(t),I);break;case"ibcs-chart-bullet":customElements.get(n(t))||L()}}))};export{K as BnChartBullet,B as defineCustomElement}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{proxyCustomElement as t,HTMLElement as e,writeTask as i,forceUpdate as s,h as a,Host as r,transformTag as n}from"@stencil/core/internal/client";import{o as l}from"./geometry.js";import{c as o}from"./svgChartElements.js";import{a as h}from"./context-protocol.js";import{w as c,g as u}from"./withDataset.js";import{o as d}from"./layoutObserver.js";import{p}from"./scaling.js";import{i as v,h as m,j as f}from"./validate.js";import{w as y,a as g}from"./withHasError.js";import{w as b}from"./withComponentStyle.js";import{w as x}from"./withRuleSet.js";import{w}from"./withTranslation.js";import{w as _}from"./withStyled.js";import{r as L,s as S}from"./VarianceMeasure.js";import{f as R,c as E,d as $,e as j,p as A,t as C}from"./AxisConfig.js";import{d as N}from"./ibcs-chart-scatter2.js";const O={rowGroup:0,category:1,subCategory:2},k=t(class extends e{validateX(t){this.validateAxisSpec("x",t)}validateY(t){this.validateAxisSpec("y",t)}validateIso(t){this.validateObjectSpec("iso",t,null,(t=>R(t)))}validateLevel(t){const e="ERR_level",i=["auto","category","subcategory"];v(t)||i.includes(t.trim().toLowerCase())?this.errors.remove(e):this.errors.addOrReplace({id:e,type:"warning",message:`level: invalid value '${t}' — expected ${i.join("/")}; using 'auto'.`})}validateSeriesLevel(t){const e="ERR_seriesLevel",i=["auto","rowgroup","category","none"];v(t)||i.includes(t.trim().toLowerCase())?this.errors.remove(e):this.errors.addOrReplace({id:e,type:"warning",message:`series-level: invalid value '${t}' — expected ${i.join("/")}; using 'auto'.`})}validateFacet(t){this.validateObjectSpec("facet",t,null,(t=>E(t)))}validateLabels(t){this.validateObjectSpec("labels",t,null,(t=>$(t,this.labelDefaults())))}validateLegend(t){this.validateObjectSpec("legend",t,null,(t=>j(t)))}validateAspect(t){const e="ERR_aspect";v(t)||null!==this.parseAspect(t)?this.errors.remove(e):this.errors.addOrReplace({id:e,type:"warning",message:`aspect: invalid value '${t}' — expected "w:h" (e.g. "16:9"); using the default.`})}validateLimit(t){const e="ERR_limit";m(t)&&Number(t)>=0?this.errors.remove(e):this.errors.addOrReplace({id:e,type:"warning",message:`limit: invalid value '${t}' — expected a non-negative integer; using 0.`})}validateScale(t){const e="ERR_scale";if(v(t))return void this.errors.remove(e);const{mode:i,factor:s}=p(t);"factor"===i&&(void 0===s||s<=0)?this.errors.addOrReplace({id:e,type:"warning",message:`scale: invalid value '${t}' — expected none/auto or a positive number.`}):this.errors.remove(e)}constructor(t){super(),!1!==t&&this.__registerHost(),this.__attachShadow(),this.datasetName="",this.dataVersion=0,this.datasetMeta=null,this.appliedScaleFactor=1,this.layoutObserver=null,this.activeErrors=new Set,this.chartTitle="",this.filter="",this.iso="",this.level="auto",this.seriesLevel="auto",this.facet="",this.labels="",this.legend="",this.aspect="16:9",this.limit=0,this._autoScaleGuard=!1,this._lastObservedWidth=0,this.translateForInner=(t,e)=>this.t(t,e),_(this),y(this),c(this,(t=>{this.datasetName=(null==t?void 0:t.startsWith("$"))?t.substring(1):t||"",this.dataVersion=this.dataVersion+1}),((t,e)=>{this.datasetMeta=e})),this.errors=g(this),this.componentStyle=b(this),this.ruleSetConfig=x(this),this.t=w(this).t}componentWillLoad(){this.validateX(this.x),this.validateY(this.y),this.validateIso(this.iso),this.validateLevel(this.level),this.validateSeriesLevel(this.seriesLevel),this.validateFacet(this.facet),this.validateLabels(this.labels),this.validateLegend(this.legend),this.validateAspect(this.aspect),this.validateLimit(this.limit),this.validateScale(this.scale)}componentDidRender(){const{mode:t}=p(this.scale);if("auto"!==t&&"empty"!==t){this._autoScaleGuard=!1;const t=u(this.element),e="WARN_overflow";return void(t.width>0&&this.element.scrollWidth>t.width+1?this.errors.addOrReplace({id:e,type:"warning",message:"Chart exceeds available space and will be cut off. Check the scale value."}):this.errors.remove(e))}if(this._autoScaleGuard)return void(this._autoScaleGuard=!1);const e=this.element,{width:s}=u(e);if(s<=0)return;this._lastObservedWidth=s;const a=this.componentStyle((t=>{var e;return(null===(e=t.global)||void 0===e?void 0:e.fontSizePx)||13.3333})),r=e.scrollWidth,n=this.appliedScaleFactor;if(!Number.isFinite(r)||r<=s+1)return void this.errors.remove("AUTO_scale");const l=Math.max(.3,n*(s-1)/r);Math.abs(l-n)<.01||(e.style.setProperty("--bn-font-size",a*l+"px"),"empty"===t?this.errors.addOrReplace({id:"AUTO_scale",type:"warning",message:"Auto-scaled chart by factor "+l.toFixed(3)}):this.errors.remove("AUTO_scale"),this._autoScaleGuard=!0,i((()=>{this.appliedScaleFactor=l})))}componentDidLoad(){this.layoutObserver=d(this.element,(()=>{if(this._autoScaleGuard)return;const{width:t}=u(this.element);t>0&&Math.abs(t-this._lastObservedWidth)>2&&(this._lastObservedWidth=t,s(this))})),requestAnimationFrame((()=>{requestAnimationFrame((()=>{if(this._autoScaleGuard)return;const{width:t}=u(this.element);this._lastObservedWidth=t,s(this)}))}))}disconnectedCallback(){var t;null===(t=this.layoutObserver)||void 0===t||t.disconnect(),this.layoutObserver=null}labelDefaults(){return{points:"auto",values:!1,max:12}}setBlockingError(t,e){null===e?(this.errors.remove(t),this.activeErrors.delete(t)):(this.errors.addOrReplace({id:t,type:"error",message:e}),this.activeErrors.add(t))}hasBlockingErrors(){return this.activeErrors.size>0}validateAxisSpec(t,e){var i;const s="ERR_xy_json_"+t,a="ERR_xy_measure_"+t,r="WARN_xy_fields_"+t,n="x"===t||"y"===t||"size"===t,{data:l,parseError:o}=A(e,"measure");if(o)return this.setBlockingError(s,this.t(".xy-prop-json",{prop:t})),this.setBlockingError(a,null),void this.errors.remove(r);if(this.setBlockingError(s,null),null===l)return this.setBlockingError(a,n?this.t(".xy-measure-invalid",{prop:t,measure:""}):null),void this.errors.remove(r);const h="share"===t?null:C(l),c=null!==(i=l.measure)&&void 0!==i?i:"";f(c)?this.setBlockingError(a,null):this.setBlockingError(a,this.t(".xy-measure-invalid",{prop:t,measure:c})),this.reportSpecIssues(r,t,h)}validateObjectSpec(t,e,i,s){const a="ERR_xy_json_"+t,r="WARN_xy_fields_"+t,{data:n,parseError:l}=A(e,i);if(l)return this.setBlockingError(a,this.t(".xy-prop-json",{prop:t})),void this.errors.remove(r);this.setBlockingError(a,null),null!==n?this.reportSpecIssues(r,t,s(n)):this.errors.remove(r)}reportSpecIssues(t,e,i){const s=[];null!==i&&i.invalidFields.length>0&&s.push("invalid: "+i.invalidFields.join(", ")),null!==i&&i.unknownKeys.length>0&&s.push("unknown: "+i.unknownKeys.join(", ")),s.length>0?this.errors.addOrReplace({id:t,type:"warning",message:`${e}: ignored sub-fields (${s.join("; ")}).`}):this.errors.remove(t)}prepareAxis(t,e){const{data:i,parseError:s}=A(e,"measure");if(s||null===i)return null;const{config:a}=C(i);return null!==a&&f(a.measure)?(void 0!==a.min&&void 0!==a.max&&a.min>=a.max?(this.errors.addOrReplace({id:"WARN_xy_domain_"+t,type:"warning",message:t+": min must be smaller than max; the override is ignored."}),a.min=void 0,a.max=void 0):this.errors.remove("WARN_xy_domain_"+t),a):null}prepareIso(){const{data:t,parseError:e}=A(this.iso,null);return e||null===t?null:R(t).config}prepareLabels(){const t=this.labelDefaults(),{data:e,parseError:i}=A(this.labels,null);return i||null===e?{points:t.points,values:t.values,max:t.max}:$(e,t).config}prepareLegend(){const{data:t,parseError:e}=A(this.legend,null);return e||null===t?{show:!0,position:"right"}:j(t).config}prepareFacet(){const{data:t,parseError:e}=A(this.facet,null);return e||null===t?null:E(t).config}preparePointLevel(){var t,e;const i=null===(t=this.level)||void 0===t?void 0:t.trim().toLowerCase();if("category"===i)return"category";if("subcategory"===i)return"subCategory";const s=null===(e=this.datasetMeta)||void 0===e?void 0:e.suggestedLevel;return"rowGroup"===s||"category"===s||"subCategory"===s?s:"category"}prepareSeriesLevel(t){var e;const i=null===(e=this.seriesLevel)||void 0===e?void 0:e.trim().toLowerCase();return"none"===i?null:"rowgroup"===i?"rowGroup":"category"===i||"subCategory"===t?"category":"category"===t?"rowGroup":null}validateCrossProp(t,e){const i=new Set;for(const e of t){if(void 0===e)continue;const t=L(e);null!==t&&"scenario"===t.kind&&i.add(S(t.slot))}this.setBlockingError("ERR_xy_family",i.size>1?this.t(".xy-family-mixed",{families:[...i].join(", ")}):null);const s=this.preparePointLevel(),a=this.prepareSeriesLevel(s),r=null!==e?"rowgroup"===e.level?"rowGroup":"category":null;let n=null;if(null!==a&&O[a]>=O[s]&&(n=`series '${a}' vs point '${s}'`),null!==r){const t=null!=a?a:s;O[r]>=O[t]&&(n=`facet '${r}' vs '${t}'`)}this.setBlockingError("ERR_xy_level_order",null!==n?this.t(".xy-level-order",{detail:n}):null)}parseAspect(t){const e=/^\s*(\d+(?:\.\d+)?)\s*:\s*(\d+(?:\.\d+)?)\s*$/.exec(null!=t?t:"");if(null===e)return null;const i=Number(e[1]),s=Number(e[2]);return i<=0||s<=0?null:i/s}prepareAspect(){var t;return null!==(t=this.parseAspect(this.aspect))&&void 0!==t?t:16/9}prepareLimit(){const t=Math.floor(Number(this.limit)||0);return t>0?t:0}i18nLocalKeys(){return["no-data","axis.in","legend.title"]}prepareI18n(){const t=new Map(this.i18nLocalKeys().map((t=>[t,this.t(".".concat(t))]))),e=new Map(h.map((t=>[t,this.t("global.".concat(t))])));return new Map([...e.entries(),...t.entries()])}prepareStyle(){const t=this.getEffectiveScaleFactor(),e=this.element.localName;return this.componentStyle((i=>{const s=i.global.fontSizePx*t;return{scaleFactors:i[e].scaleFactors,fontStyles:{font:`${s}px ${i.global.fontFamily}`,size:s,color:i.global.fontColor,background:i.global.fontBackgroundColor,leading:1.8},axisStyles:i[e].axisStyles,seriesColors:i[e].seriesColors,padding:i[e].padding}}))}async getLayoutState(t){var e;const i=null!==(e=null==t?void 0:t.detail)&&void 0!==e?e:"summary",s=l(this.element),a=this.getEffectiveScaleFactor(),r=Number.isFinite(a)&&a>0?a:1,n=this.componentStyle((t=>{var e;return(null===(e=t.global)||void 0===e?void 0:e.fontSizePx)||13.3333}))*r;return o(this.element,"ibcs-chart-scatter",this.chartTitle||void 0,{fontSizePx:n,appliedScaleFactor:r},s,i)}getEffectiveScaleFactor(){const{mode:t,factor:e}=p(this.scale);return"factor"===t?e:"auto"===t||"empty"===t?this.appliedScaleFactor:1}getFontStyles(){const t=this.getEffectiveScaleFactor();return this.componentStyle((e=>{var i,s,a,r;const n=(null===(i=e.global)||void 0===i?void 0:i.fontSizePx)||13.3333;return{"--bn-font-family":(null===(s=e.global)||void 0===s?void 0:s.fontFamily)||"'Noto Sans', sans-serif","--bn-font-size":n*t+"px","--bn-font-color":(null===(a=e.global)||void 0===a?void 0:a.fontColor)||"#000000","--bn-font-background":(null===(r=e.global)||void 0===r?void 0:r.fontBackgroundColor)||"#ffffff"}}))}getDataStructure(){const t={};for(const e of["ac","pp","fc","pl"])for(const i of[1,2,3,4])t[`${e}${i}`]={type:"number",isOptional:!0,description:""};for(const[e,i]of Object.entries(this.mappedAxes())){if(null===i)continue;const s=L(i.measure);null!==s&&("scenario"===s.kind?t[s.slot].description=`${e}: ${"label"in i&&void 0!==i.label?i.label:i.measure}`:(t[s.measure.base].description=`${e}: ${i.measure} (base)`,t[s.measure.delta].description=`${e}: ${i.measure} (delta)`))}return{[this.dataStructureName()]:Object.assign({operation:{type:"string",isOptional:!1,description:""},rowGroup:{type:"string",isOptional:!0,description:""},rowGroupIndex:{type:"number",isOptional:!0,description:""},category:{type:"string",isOptional:!1,description:""},categoryIndex:{type:"number",isOptional:!1,description:""},subCategory:{type:"string",isOptional:!0,description:""},subCategoryIndex:{type:"number",isOptional:!0,description:""}},t)}}mappedAxes(){return{x:this.prepareAxis("x",this.x),y:this.prepareAxis("y",this.y)}}dataStructureName(){return"IScatterChartDataRow"}chartTemplate(){const t=this.prepareAxis("x",this.x),e=this.prepareAxis("y",this.y),i=this.prepareFacet();if(this.validateCrossProp([null==t?void 0:t.measure,null==e?void 0:e.measure],i),this.hasBlockingErrors()||null===t||null===e)return null;const s=this.preparePointLevel(),r=this.prepareI18n(),n=this.prepareStyle(),l=u(this.element).width;return a("ibcs-chart-scatter",{tableName:this.datasetName,dataVersion:this.dataVersion,chartTitle:this.chartTitle,x:t,y:e,iso:this.prepareIso(),labels:this.prepareLabels(),legend:this.prepareLegend(),facet:i,pointLevel:s,seriesLevel:this.prepareSeriesLevel(s),aspect:this.prepareAspect(),limit:this.prepareLimit(),filter:this.filter,styles:n,i18n:r,containerWidth:l,ruleSetConfig:this.ruleSetConfig(),errors:this.errors,translate:this.translateForInner})}render(){return a(r,{key:"1e347d72935a145bb50bed0516c7aeda34014547",style:this.getFontStyles()},a("div",{key:"8fb0acb5218bb5dba7252eda639a60ff6384e744",class:"container"},this.chartTemplate()))}get element(){return this}static get watchers(){return{x:[{validateX:0}],y:[{validateY:0}],iso:[{validateIso:0}],level:[{validateLevel:0}],seriesLevel:[{validateSeriesLevel:0}],facet:[{validateFacet:0}],labels:[{validateLabels:0}],legend:[{validateLegend:0}],aspect:[{validateAspect:0}],limit:[{validateLimit:0}],scale:[{validateScale:0}]}}static get style(){return':host{display:inline-block;position:relative;overflow:hidden;font-family:var(--bn-font-family, "Noto Sans", sans-serif);font-size:var(--bn-font-size, 13.3333px);color:var(--bn-font-color, #000000)}.container{display:flex;flex-direction:column}'}},[1,"bn-chart-scatter",{ruleset:[513],chartTitle:[1,"chart-title"],filter:[1],x:[1],y:[1],iso:[1],level:[1],seriesLevel:[1,"series-level"],facet:[1],labels:[1],legend:[1],aspect:[1],limit:[2],scale:[1],datasetName:[32],dataVersion:[32],datasetMeta:[32],appliedScaleFactor:[32],getLayoutState:[64]},void 0,{x:[{validateX:0}],y:[{validateY:0}],iso:[{validateIso:0}],level:[{validateLevel:0}],seriesLevel:[{validateSeriesLevel:0}],facet:[{validateFacet:0}],labels:[{validateLabels:0}],legend:[{validateLegend:0}],aspect:[{validateAspect:0}],limit:[{validateLimit:0}],scale:[{validateScale:0}]}]),F=k,I=function(){"undefined"!=typeof customElements&&["bn-chart-scatter","ibcs-chart-scatter"].forEach((t=>{switch(t){case"bn-chart-scatter":customElements.get(n(t))||customElements.define(n(t),k);break;case"ibcs-chart-scatter":customElements.get(n(t))||N()}}))};export{F as BnChartScatter,I as defineCustomElement}
|
|
1
|
+
import{proxyCustomElement as t,HTMLElement as e,writeTask as i,forceUpdate as s,h as a,Host as r,transformTag as o}from"@stencil/core/internal/client";import{h as n,a as l}from"./context-protocol.js";import{o as h}from"./geometry.js";import{c}from"./svgChartElements.js";import{g as d}from"./parentDimensions.js";import{c as u}from"./checkXYOverflow.js";import{o as p}from"./layoutObserver.js";import{p as v}from"./scaling.js";import{i as m,h as f,j as y}from"./validate.js";import{w as g}from"./withComponentStatus.js";import{w as b}from"./withComponentStyle.js";import{w as x}from"./withDataset.js";import{w}from"./withHasError.js";import{w as _}from"./withRuleSet.js";import{w as S}from"./withTranslation.js";import{w as L}from"./withStyled.js";import{r as R,s as j}from"./VarianceMeasure.js";import{f as E,c as $,d as A,e as O,p as N,t as k}from"./AxisConfig.js";import{s as C}from"./emptyState.js";import{d as F}from"./ibcs-chart-scatter2.js";const z={rowGroup:0,category:1,subCategory:2},I=t(class extends e{validateFilter(t){const e="ERR_filter";n(t)?this.errors.addOrReplace({id:e,type:"error",message:"filter: double backticks are not allowed."}):this.errors.remove(e)}validateX(t){this.validateAxisSpec("x",t)}validateY(t){this.validateAxisSpec("y",t)}validateIso(t){this.validateObjectSpec("iso",t,null,(t=>E(t)))}validateLevel(t){const e="ERR_level",i=["auto","category","subcategory"];m(t)||i.includes(t.trim().toLowerCase())?this.errors.remove(e):this.errors.addOrReplace({id:e,type:"warning",message:`level: invalid value '${t}' - expected ${i.join("/")}; using 'auto'.`})}validateSeriesLevel(t){const e="ERR_seriesLevel",i=["auto","rowgroup","category","none"];m(t)||i.includes(t.trim().toLowerCase())?this.errors.remove(e):this.errors.addOrReplace({id:e,type:"warning",message:`series-level: invalid value '${t}' - expected ${i.join("/")}; using 'auto'.`})}validateFacet(t){this.validateObjectSpec("facet",t,null,(t=>$(t)))}validateLabels(t){this.validateObjectSpec("labels",t,null,(t=>A(t,this.labelDefaults())))}validateLegend(t){this.validateObjectSpec("legend",t,null,(t=>O(t)))}validateAspect(t){const e="ERR_aspect";m(t)||null!==this.parseAspect(t)?this.errors.remove(e):this.errors.addOrReplace({id:e,type:"warning",message:`aspect: invalid value '${t}' - expected "w:h" (e.g. "16:9"); using the default.`})}validateLimit(t){const e="ERR_limit";f(t)&&Number(t)>=0?this.errors.remove(e):this.errors.addOrReplace({id:e,type:"warning",message:`limit: invalid value '${t}' - expected a non-negative integer; using 0.`})}validateScale(t){const e="ERR_scale";if(m(t))return void this.errors.remove(e);const{mode:i,factor:s}=v(t);"factor"===i&&(void 0===s||s<=0)?this.errors.addOrReplace({id:e,type:"warning",message:`scale: invalid value '${t}' - expected none/auto or a positive number.`}):this.errors.remove(e)}constructor(t){super(),!1!==t&&this.__registerHost(),this.__attachShadow(),this.datasetName="",this.dataVersion=0,this.datasetMeta=null,this.appliedScaleFactor=1,this.layoutObserver=null,this.activeErrors=new Set,this.chartTitle="",this.filter="",this.iso="",this.level="auto",this.seriesLevel="auto",this.facet="",this.labels="",this.legend="",this.aspect="16:9",this.limit=0,this._autoScaleGuard=!1,this._lastObservedWidth=0,this.translateForInner=(t,e)=>this.t(t,e),L(this),g(this),x(this,(t=>{this.datasetName=(null==t?void 0:t.startsWith("$"))?t.substring(1):t||"",this.dataVersion=this.dataVersion+1}),((t,e)=>{this.datasetMeta=e})),this.errors=w(this),this.componentStyle=b(this),this.ruleSetConfig=_(this),this.t=S(this).t}componentWillLoad(){this.validateFilter(this.filter),this.validateX(this.x),this.validateY(this.y),this.validateIso(this.iso),this.validateLevel(this.level),this.validateSeriesLevel(this.seriesLevel),this.validateFacet(this.facet),this.validateLabels(this.labels),this.validateLegend(this.legend),this.validateAspect(this.aspect),this.validateLimit(this.limit),this.validateScale(this.scale)}componentDidRender(){C(this.element,"ibcs-chart-scatter");const{mode:t}=v(this.scale);if("auto"!==t&&"empty"!==t)return this._autoScaleGuard=!1,void this.checkOverflow();if(this._autoScaleGuard)return this._autoScaleGuard=!1,void this.checkOverflow();const e=this.element,{width:s}=d(e);if(s<=0)return void this.checkOverflow();this._lastObservedWidth=s;const a=this.componentStyle((t=>{var e;return(null===(e=t.global)||void 0===e?void 0:e.fontSizePx)||13.3333})),r=e.scrollWidth,o=this.appliedScaleFactor;if(!Number.isFinite(r)||r<=s+1)return this.errors.remove("AUTO_scale"),void this.checkOverflow();const n=Math.max(.3,o*(s-1)/r);Math.abs(n-o)<.01||(e.style.setProperty("--bn-font-size",a*n+"px"),"empty"===t?this.errors.addOrReplace({id:"AUTO_scale",type:"warning",message:"Auto-scaled chart by factor "+n.toFixed(3)}):this.errors.remove("AUTO_scale"),this._autoScaleGuard=!0,i((()=>{this.appliedScaleFactor=n}))),this.checkOverflow()}checkOverflow(){u(this.element,"ibcs-chart-scatter",this.errors)}componentDidLoad(){this.layoutObserver=p(this.element,(()=>{if(this._autoScaleGuard)return;const{width:t}=d(this.element);t>0&&Math.abs(t-this._lastObservedWidth)>2?(this._lastObservedWidth=t,s(this)):this.checkOverflow()})),requestAnimationFrame((()=>{requestAnimationFrame((()=>{if(this._autoScaleGuard)return;const{width:t}=d(this.element);this._lastObservedWidth=t,s(this)}))}))}disconnectedCallback(){var t;null===(t=this.layoutObserver)||void 0===t||t.disconnect(),this.layoutObserver=null}labelDefaults(){return{points:"auto",values:!1,max:12}}setBlockingError(t,e){null===e?(this.errors.remove(t),this.activeErrors.delete(t)):(this.errors.addOrReplace({id:t,type:"error",message:e}),this.activeErrors.add(t))}hasBlockingErrors(){return this.activeErrors.size>0}validateAxisSpec(t,e){var i;const s="ERR_xy_json_"+t,a="ERR_xy_measure_"+t,r="WARN_xy_fields_"+t,o="x"===t||"y"===t||"size"===t,{data:n,parseError:l}=N(e,"measure");if(l)return this.setBlockingError(s,this.t(".xy-prop-json",{prop:t})),this.setBlockingError(a,null),void this.errors.remove(r);if(this.setBlockingError(s,null),null===n)return this.setBlockingError(a,o?this.t(".xy-measure-invalid",{prop:t,measure:""}):null),void this.errors.remove(r);const h="share"===t?null:k(n),c=null!==(i=n.measure)&&void 0!==i?i:"";y(c)?this.setBlockingError(a,null):this.setBlockingError(a,this.t(".xy-measure-invalid",{prop:t,measure:c})),this.reportSpecIssues(r,t,h)}validateObjectSpec(t,e,i,s){const a="ERR_xy_json_"+t,r="WARN_xy_fields_"+t,{data:o,parseError:n}=N(e,i);if(n)return this.setBlockingError(a,this.t(".xy-prop-json",{prop:t})),void this.errors.remove(r);this.setBlockingError(a,null),null!==o?this.reportSpecIssues(r,t,s(o)):this.errors.remove(r)}reportSpecIssues(t,e,i){const s=[];null!==i&&i.invalidFields.length>0&&s.push("invalid: "+i.invalidFields.join(", ")),null!==i&&i.unknownKeys.length>0&&s.push("unknown: "+i.unknownKeys.join(", ")),s.length>0?this.errors.addOrReplace({id:t,type:"warning",message:`${e}: ignored sub-fields (${s.join("; ")}).`}):this.errors.remove(t)}prepareAxis(t,e){const{data:i,parseError:s}=N(e,"measure");if(s||null===i)return null;const{config:a}=k(i);return null!==a&&y(a.measure)?(void 0!==a.min&&void 0!==a.max&&a.min>=a.max?(this.errors.addOrReplace({id:"WARN_xy_domain_"+t,type:"warning",message:t+": min must be smaller than max; the override is ignored."}),a.min=void 0,a.max=void 0):this.errors.remove("WARN_xy_domain_"+t),a):null}prepareIso(){const{data:t,parseError:e}=N(this.iso,null);return e||null===t?null:E(t).config}prepareLabels(){const t=this.labelDefaults(),{data:e,parseError:i}=N(this.labels,null);return i||null===e?{points:t.points,values:t.values,max:t.max}:A(e,t).config}prepareLegend(){const{data:t,parseError:e}=N(this.legend,null);return e||null===t?{show:!0,position:"right"}:O(t).config}prepareFacet(){const{data:t,parseError:e}=N(this.facet,null);return e||null===t?null:$(t).config}preparePointLevel(){var t,e;const i=null===(t=this.level)||void 0===t?void 0:t.trim().toLowerCase();if("category"===i)return"category";if("subcategory"===i)return"subCategory";const s=null===(e=this.datasetMeta)||void 0===e?void 0:e.suggestedLevel;return"rowGroup"===s||"category"===s||"subCategory"===s?s:"category"}prepareSeriesLevel(t){var e;const i=null===(e=this.seriesLevel)||void 0===e?void 0:e.trim().toLowerCase();return"none"===i?null:"rowgroup"===i?"rowGroup":"category"===i||"subCategory"===t?"category":"category"===t?"rowGroup":null}validateCrossProp(t,e){const i=new Set;for(const e of t){if(void 0===e)continue;const t=R(e);null!==t&&"scenario"===t.kind&&i.add(j(t.slot))}this.setBlockingError("ERR_xy_family",i.size>1?this.t(".xy-family-mixed",{families:[...i].join(", ")}):null);const s=this.preparePointLevel(),a=this.prepareSeriesLevel(s),r=null!==e?"rowgroup"===e.level?"rowGroup":"category":null;let o=null;if(null!==a&&z[a]>=z[s]&&(o=`series '${a}' vs point '${s}'`),null!==r){const t=null!=a?a:s;z[r]>=z[t]&&(o=`facet '${r}' vs '${t}'`)}this.setBlockingError("ERR_xy_level_order",null!==o?this.t(".xy-level-order",{detail:o}):null)}parseAspect(t){const e=/^\s*(\d+(?:\.\d+)?)\s*:\s*(\d+(?:\.\d+)?)\s*$/.exec(null!=t?t:"");if(null===e)return null;const i=Number(e[1]),s=Number(e[2]);return i<=0||s<=0?null:i/s}prepareAspect(){var t;return null!==(t=this.parseAspect(this.aspect))&&void 0!==t?t:16/9}prepareLimit(){const t=Math.floor(Number(this.limit)||0);return t>0?t:0}i18nLocalKeys(){return["no-data","axis.in","legend.title"]}prepareI18n(){const t=new Map(this.i18nLocalKeys().map((t=>[t,this.t(".".concat(t))]))),e=new Map(l.map((t=>[t,this.t("global.".concat(t))])));return new Map([...e.entries(),...t.entries()])}prepareStyle(){const t=this.getEffectiveScaleFactor(),e=this.element.localName;return this.componentStyle((i=>{const s=i.global.fontSizePx*t;return{scaleFactors:i[e].scaleFactors,fontStyles:{font:`${s}px ${i.global.fontFamily}`,size:s,color:i.global.fontColor,background:i.global.fontBackgroundColor,leading:1.8},axisStyles:i[e].axisStyles,seriesColors:i[e].seriesColors,padding:i[e].padding}}))}async getLayoutState(t){var e;const i=null!==(e=null==t?void 0:t.detail)&&void 0!==e?e:"summary",s=h(this.element),a=this.getEffectiveScaleFactor(),r=Number.isFinite(a)&&a>0?a:1,o=this.componentStyle((t=>{var e;return(null===(e=t.global)||void 0===e?void 0:e.fontSizePx)||13.3333}))*r;return c(this.element,"ibcs-chart-scatter",this.chartTitle||void 0,{fontSizePx:o,appliedScaleFactor:r},s,i)}getEffectiveScaleFactor(){const{mode:t,factor:e}=v(this.scale);return"factor"===t?e:"auto"===t||"empty"===t?this.appliedScaleFactor:1}getFontStyles(){const t=this.getEffectiveScaleFactor();return this.componentStyle((e=>{var i,s,a,r;const o=(null===(i=e.global)||void 0===i?void 0:i.fontSizePx)||13.3333;return{"--bn-font-family":(null===(s=e.global)||void 0===s?void 0:s.fontFamily)||"'Noto Sans', sans-serif","--bn-font-size":o*t+"px","--bn-font-color":(null===(a=e.global)||void 0===a?void 0:a.fontColor)||"#000000","--bn-font-background":(null===(r=e.global)||void 0===r?void 0:r.fontBackgroundColor)||"#ffffff"}}))}getDataStructure(){const t={};for(const e of["ac","pp","fc","pl"])for(const i of[1,2,3,4])t[`${e}${i}`]={type:"number",isOptional:!0,description:""};for(const[e,i]of Object.entries(this.mappedAxes())){if(null===i)continue;const s=R(i.measure);null!==s&&("scenario"===s.kind?t[s.slot].description=`${e}: ${"label"in i&&void 0!==i.label?i.label:i.measure}`:(t[s.measure.base].description=`${e}: ${i.measure} (base)`,t[s.measure.delta].description=`${e}: ${i.measure} (delta)`))}return{[this.dataStructureName()]:Object.assign({operation:{type:"string",isOptional:!1,description:""},rowGroup:{type:"string",isOptional:!0,description:""},rowGroupIndex:{type:"number",isOptional:!0,description:""},category:{type:"string",isOptional:!1,description:""},categoryIndex:{type:"number",isOptional:!1,description:""},subCategory:{type:"string",isOptional:!0,description:""},subCategoryIndex:{type:"number",isOptional:!0,description:""}},t)}}mappedAxes(){return{x:this.prepareAxis("x",this.x),y:this.prepareAxis("y",this.y)}}dataStructureName(){return"IScatterChartDataRow"}chartTemplate(){const t=this.prepareAxis("x",this.x),e=this.prepareAxis("y",this.y),i=this.prepareFacet();if(this.validateCrossProp([null==t?void 0:t.measure,null==e?void 0:e.measure],i),this.hasBlockingErrors()||null===t||null===e)return null;const s=this.preparePointLevel(),r=this.prepareI18n(),o=this.prepareStyle(),n=d(this.element).width;return a("ibcs-chart-scatter",{tableName:this.datasetName,dataVersion:this.dataVersion,chartTitle:this.chartTitle,x:t,y:e,iso:this.prepareIso(),labels:this.prepareLabels(),legend:this.prepareLegend(),facet:i,pointLevel:s,seriesLevel:this.prepareSeriesLevel(s),aspect:this.prepareAspect(),limit:this.prepareLimit(),filter:this.filter,styles:o,i18n:r,containerWidth:n,ruleSetConfig:this.ruleSetConfig(),errors:this.errors,translate:this.translateForInner})}render(){return a(r,{key:"61ebef430224576a8dc7dc0538e362848c31004f",style:this.getFontStyles()},a("div",{key:"89a3c7653191348e8dd4231395e599f32365c8c1",class:"container"},this.chartTemplate()))}get element(){return this}static get watchers(){return{filter:[{validateFilter:0}],x:[{validateX:0}],y:[{validateY:0}],iso:[{validateIso:0}],level:[{validateLevel:0}],seriesLevel:[{validateSeriesLevel:0}],facet:[{validateFacet:0}],labels:[{validateLabels:0}],legend:[{validateLegend:0}],aspect:[{validateAspect:0}],limit:[{validateLimit:0}],scale:[{validateScale:0}]}}static get style(){return':host(.no-data){display:block;box-sizing:border-box;width:100%;height:100%}:host(.no-data)>div{float:none;width:100%;height:100%}:host(.no-data) .no-data~.no-data{display:none}.empty-state{box-sizing:border-box;display:flex;align-items:center;justify-content:center;float:none;width:100%;height:100%;min-height:3em;margin:0;padding:0.5em;overflow:hidden;border:0.1em dashed #ddd;color:#808080;font-family:var(--bn-font-family, "Noto Sans", sans-serif);font-size:var(--bn-font-size, 13.3333px);font-style:normal;text-align:center}:host{display:inline-block;position:relative;overflow:hidden;font-family:var(--bn-font-family, "Noto Sans", sans-serif);font-size:var(--bn-font-size, 13.3333px);color:var(--bn-font-color, #000000)}.container{display:flex;flex-direction:column}'}},[1,"bn-chart-scatter",{ruleset:[513],chartTitle:[1,"chart-title"],filter:[1],x:[1],y:[1],iso:[1],level:[1],seriesLevel:[1,"series-level"],facet:[1],labels:[1],legend:[1],aspect:[1],limit:[2],scale:[1],datasetName:[32],dataVersion:[32],datasetMeta:[32],appliedScaleFactor:[32],getLayoutState:[64]},void 0,{filter:[{validateFilter:0}],x:[{validateX:0}],y:[{validateY:0}],iso:[{validateIso:0}],level:[{validateLevel:0}],seriesLevel:[{validateSeriesLevel:0}],facet:[{validateFacet:0}],labels:[{validateLabels:0}],legend:[{validateLegend:0}],aspect:[{validateAspect:0}],limit:[{validateLimit:0}],scale:[{validateScale:0}]}]),M=I,D=function(){"undefined"!=typeof customElements&&["bn-chart-scatter","ibcs-chart-scatter"].forEach((t=>{switch(t){case"bn-chart-scatter":customElements.get(o(t))||customElements.define(o(t),I);break;case"ibcs-chart-scatter":customElements.get(o(t))||F()}}))};export{M as BnChartScatter,D as defineCustomElement}
|