@bino-bi/bn-template-engine 1.0.0-next.26 → 1.0.0-next.28
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/bn-template-engine/bn-template-engine.esm.js +1 -1
- package/dist/bn-template-engine/p-5075771a.entry.js +1 -0
- package/dist/bn-template-engine/p-5d516435.entry.js +1 -0
- package/dist/bn-template-engine/p-5e90e728.entry.js +1 -0
- package/dist/bn-template-engine/p-9ef7e132.entry.js +1 -0
- package/dist/bn-template-engine/{p-f06c3703.entry.js → p-9f7a1980.entry.js} +1 -1
- package/dist/bn-template-engine/p-BeXgxHkW.js +1 -0
- package/dist/bn-template-engine/p-CH0bpt_k.js +1 -0
- package/dist/bn-template-engine/p-ClruFZD_.js +1 -0
- package/dist/bn-template-engine/{p-CTrNbSXN.js → p-DFmSrSnf.js} +1 -1
- package/dist/bn-template-engine/{p-BcLsoDrW.js → p-DI3efDSV.js} +1 -1
- package/dist/bn-template-engine/p-DXLTTILG.js +1 -0
- package/dist/bn-template-engine/p-DtP4jqG5.js +1 -0
- package/dist/bn-template-engine/p-a8281b71.entry.js +1 -0
- package/dist/bn-template-engine/p-b31277e7.entry.js +1 -0
- package/dist/bn-template-engine/p-b396ac84.entry.js +1 -0
- package/dist/cjs/{bn-asset_21.cjs.entry.js → bn-asset_28.cjs.entry.js} +21358 -6528
- package/dist/cjs/bn-grid.cjs.entry.js +4 -6
- package/dist/cjs/bn-image.cjs.entry.js +3 -5
- package/dist/cjs/bn-internationalization.cjs.entry.js +17 -6
- package/dist/cjs/bn-ruleset.cjs.entry.js +5 -5
- package/dist/cjs/bn-template-engine.cjs.js +1 -1
- package/dist/cjs/bn-template.cjs.entry.js +2 -2
- package/dist/cjs/bn-text.cjs.entry.js +115 -43
- package/dist/cjs/{context-protocol-DcTEh1rq.js → context-protocol-C0rKepqu.js} +108 -22
- package/dist/cjs/{diagnostics-CTgbq_Gc.js → diagnostics-Cq-qDtXq.js} +1 -1
- package/dist/cjs/editor-companion.cjs.entry.js +2 -2
- package/dist/cjs/loader.cjs.js +1 -1
- package/dist/cjs/queryError-BZjnIW_w.js +16 -0
- package/dist/cjs/{scaling-Dsb5_NXy.js → sanitizeHtml-Yx1xn6i_.js} +467 -287
- package/dist/cjs/{withBodyObserver-DJO98AJ-.js → withBodyObserver-CaPUjuC5.js} +1 -1
- package/dist/cjs/withHasError-qGW_yqIv.js +426 -0
- package/dist/cjs/{withStyled-D0jLwCib.js → withStyled-vSfogp9J.js} +543 -42
- package/dist/collection/components/bn-chart-bubble/bn-chart-bubble.css +37 -0
- package/dist/collection/components/bn-chart-bubble/bn-chart-bubble.js +53 -28
- package/dist/collection/components/bn-chart-bubble/ibcs-chart-bubble.css +37 -5
- package/dist/collection/components/bn-chart-bubble/ibcs-chart-bubble.js +16 -7
- package/dist/collection/components/bn-chart-bubble/utils/BubbleChart.js +67 -30
- package/dist/collection/components/bn-chart-bullet/bn-chart-bullet.css +37 -0
- package/dist/collection/components/bn-chart-bullet/bn-chart-bullet.js +49 -29
- package/dist/collection/components/bn-chart-bullet/ibcs-chart-bullet.css +37 -5
- package/dist/collection/components/bn-chart-bullet/ibcs-chart-bullet.js +17 -7
- package/dist/collection/components/bn-chart-bullet/utils/BulletChart.js +34 -18
- package/dist/collection/components/bn-chart-bullet/utils/model/BulletChartStyle.js +2 -0
- package/dist/collection/components/bn-chart-bullet/utils/model/BulletConfig.js +1 -1
- package/dist/collection/components/bn-chart-scatter/bn-chart-scatter.css +37 -0
- package/dist/collection/components/bn-chart-scatter/bn-chart-scatter.js +52 -27
- package/dist/collection/components/bn-chart-scatter/ibcs-chart-scatter.css +37 -5
- package/dist/collection/components/bn-chart-scatter/ibcs-chart-scatter.js +16 -7
- package/dist/collection/components/bn-chart-scatter/utils/ScatterChart.js +52 -18
- package/dist/collection/components/bn-chart-structure/bn-chart-structure.css +37 -5
- package/dist/collection/components/bn-chart-structure/bn-chart-structure.js +74 -44
- package/dist/collection/components/bn-chart-structure/ibcs-chart-structure.js +60 -19
- package/dist/collection/components/bn-chart-structure/utils/StructureChart.js +218 -262
- package/dist/collection/components/bn-chart-structure/utils/elements/Label.js +1 -1
- package/dist/collection/components/bn-chart-structure/utils/elements/Needle.js +11 -4
- package/dist/collection/components/bn-chart-structure/utils/elements/StackedBar.js +16 -25
- package/dist/collection/components/bn-chart-structure/utils/model/StructureChartComponentConfig.js +3 -2
- package/dist/collection/components/bn-chart-structure/utils/model/styles/StructureChartStyle.js +2 -0
- package/dist/collection/components/bn-chart-time/bn-chart-time.css +37 -0
- package/dist/collection/components/bn-chart-time/bn-chart-time.js +122 -52
- package/dist/collection/components/bn-chart-time/ibcs-chart-time.css +37 -0
- package/dist/collection/components/bn-chart-time/ibcs-chart-time.js +60 -19
- package/dist/collection/components/bn-chart-time/utils/TimeChart.js +245 -250
- package/dist/collection/components/bn-chart-time/utils/elements/AreaFill.js +1 -1
- package/dist/collection/components/bn-chart-time/utils/elements/Label.js +1 -1
- package/dist/collection/components/bn-chart-time/utils/elements/LineSeries.js +1 -1
- package/dist/collection/components/bn-chart-time/utils/elements/Needle.js +11 -4
- package/dist/collection/components/bn-chart-time/utils/elements/StackedColumn.js +22 -34
- package/dist/collection/components/bn-chart-time/utils/helper/LabelCollisionManager.js +3 -3
- package/dist/collection/components/bn-chart-time/utils/model/TimeChartComponentConfig.js +4 -3
- package/dist/collection/components/bn-chart-time/utils/model/TimeChartDataRow.js +2 -2
- package/dist/collection/components/bn-chart-time/utils/model/styles/TimeChartStyle.js +2 -0
- package/dist/collection/components/bn-component-style/bn-component-style.js +14 -2
- package/dist/collection/components/bn-context/bn-context.js +92 -22
- package/dist/collection/components/bn-dataset/bn-dataset.js +246 -90
- package/dist/collection/components/bn-datasource/bn-datasource.js +169 -77
- package/dist/collection/components/bn-footer/bn-footer.js +6 -6
- package/dist/collection/components/bn-internationalization/bn-internationalization.js +14 -3
- package/dist/collection/components/bn-layout-card/bn-layout-card.js +25 -74
- package/dist/collection/components/bn-layout-page/bn-layout-page.js +59 -71
- package/dist/collection/components/bn-message/bn-message.js +2 -2
- package/dist/collection/components/bn-page/bn-page.css +0 -240
- package/dist/collection/components/bn-page/bn-page.js +14 -4
- package/dist/collection/components/bn-page/pageFormats.js +69 -0
- package/dist/collection/components/bn-ruleset/bn-ruleset.js +2 -2
- package/dist/collection/components/bn-scaling-group/bn-scaling-group.js +7 -7
- package/dist/collection/components/bn-table/bn-table.css +38 -1
- package/dist/collection/components/bn-table/bn-table.js +96 -59
- package/dist/collection/components/bn-table/ibcs-table.css +39 -1
- package/dist/collection/components/bn-table/ibcs-table.js +89 -30
- package/dist/collection/components/bn-table/utils/Table.js +12 -13
- package/dist/collection/components/bn-table/utils/elements/Cell.js +9 -3
- package/dist/collection/components/bn-table/utils/elements/CellBarChart.js +38 -34
- package/dist/collection/components/bn-table/utils/elements/TableRow.js +2 -1
- package/dist/collection/components/bn-table/utils/elements/WaterfallBar.js +4 -4
- package/dist/collection/components/bn-table/utils/factories/tableDataSetFactory.js +17 -4
- package/dist/collection/components/bn-table/utils/helper/DataQuery.js +128 -98
- package/dist/collection/components/bn-table/utils/helper/IntervalColumns.js +6 -20
- package/dist/collection/components/bn-table/utils/helper/QueryGroup.js +9 -2
- package/dist/collection/components/bn-table/utils/helper/barColumnGeometry.js +2 -2
- package/dist/collection/components/bn-table/utils/model/TableAttribute.js +2 -2
- package/dist/collection/components/bn-table/utils/model/TableComponentConfig.js +3 -2
- package/dist/collection/components/bn-template/bn-template.js +1 -1
- package/dist/collection/components/bn-text/bn-text.js +36 -39
- package/dist/collection/components/bn-text/utils/template.js +79 -0
- package/dist/collection/components/bn-title/bn-title.js +10 -4
- package/dist/collection/components/bn-title/ibcs-title/ibcs-title.js +3 -1
- package/dist/collection/components/bn-tree/bn-tree.js +119 -23
- package/dist/collection/components/bn-tree/utils/EdgeRenderer.js +59 -51
- package/dist/collection/components/bn-tree/utils/TreeLayout.js +30 -5
- package/dist/collection/components/bn-tree/utils/TreeParser.js +35 -0
- package/dist/collection/components/editor-companion/editor-companion.js +1 -1
- package/dist/collection/context/context-protocol.js +1 -1
- package/dist/collection/context/scopedDb.js +47 -4
- package/dist/collection/stores/componentStyles.js +39 -0
- package/dist/collection/stores/internationalization.js +15 -13
- package/dist/collection/utils/DateStringFactory.js +17 -15
- package/dist/collection/utils/autoFit.js +2 -2
- package/dist/collection/utils/componentRegister.js +60 -16
- package/dist/collection/utils/constants.js +2 -2
- package/dist/collection/utils/dataAnalyzer.js +9 -12
- package/dist/collection/utils/emptyState.js +21 -0
- package/dist/collection/utils/formatter.js +29 -20
- package/dist/collection/utils/layoutObserver.js +1 -1
- package/dist/collection/utils/layoutState/generic.js +1 -1
- package/dist/collection/utils/layoutState/svgChartElements.js +2 -2
- package/dist/collection/utils/layoutTemplate.js +81 -0
- package/dist/collection/utils/measurementHost.js +2 -2
- package/dist/collection/utils/model/Order.js +1 -1
- package/dist/collection/utils/model/styles/SVGStyle.js +12 -4
- package/dist/collection/utils/parentDimensions.js +35 -3
- package/dist/collection/utils/queryError.js +11 -0
- package/dist/collection/utils/relativeVariance.js +14 -0
- package/dist/collection/utils/sanitizeHtml.js +30 -16
- package/dist/collection/utils/scaling.js +2 -2
- package/dist/collection/utils/stackColors.js +27 -5
- package/dist/collection/utils/stackLayout.js +71 -0
- package/dist/collection/utils/styled/attributes.js +16 -3
- package/dist/collection/utils/styled/style-sheet.js +1 -1
- package/dist/collection/utils/styled/withStyled.js +1 -1
- package/dist/collection/utils/testing/fakeGroup.js +21 -0
- package/dist/collection/utils/testing/mutationObserver.js +44 -0
- package/dist/collection/utils/testing/structureChart.js +26 -0
- package/dist/collection/utils/testing/timeChart.js +28 -0
- package/dist/collection/utils/validate.js +1 -1
- package/dist/collection/utils/withComponentStatus.js +137 -12
- package/dist/collection/utils/withInheritedProps.js +113 -64
- package/dist/collection/utils/withRuleSet.js +10 -7
- package/dist/collection/utils/withTranslation.js +3 -3
- package/dist/collection/utils/xy/FacetGrid.js +1 -1
- package/dist/collection/utils/xy/IsoCurves.js +1 -1
- package/dist/collection/utils/xy/NumericScale.js +46 -15
- package/dist/collection/utils/xy/PointLabeler.js +2 -2
- package/dist/collection/utils/xy/RadiusScale.js +2 -2
- package/dist/collection/utils/xy/SeriesPalette.js +3 -3
- package/dist/collection/utils/xy/VarianceMeasure.js +22 -4
- package/dist/collection/utils/xy/XYFrame.js +4 -4
- package/dist/collection/utils/xy/XYLegend.js +5 -7
- package/dist/collection/utils/xy/checkXYOverflow.js +32 -0
- package/dist/collection/utils/xy/formatXYValue.js +13 -0
- package/dist/collection/utils/xy/model/XYChartDataRow.js +0 -0
- package/dist/collection/utils/xy/model/XYChartStyle.js +2 -0
- package/dist/components/DataFormatDigits.js +1 -1
- package/dist/components/DateStringFactory.js +1 -1
- package/dist/components/LabelCollisionManager.js +1 -1
- package/dist/components/NumericScale.js +1 -1
- package/dist/components/Order.js +1 -1
- package/dist/components/SVGStyle.js +1 -0
- package/dist/components/TableAttribute.js +1 -0
- package/dist/components/VarianceMeasure.js +1 -1
- package/dist/components/XYChartDataRow.js +1 -1
- package/dist/components/bn-asset.js +1 -1
- package/dist/components/bn-body2.js +1 -1
- package/dist/components/bn-card2.js +1 -1
- package/dist/components/bn-chart-bubble.js +1 -1
- package/dist/components/bn-chart-bullet.js +1 -1
- package/dist/components/bn-chart-scatter.js +1 -1
- package/dist/components/bn-chart-structure.js +1 -1
- package/dist/components/bn-chart-time.js +1 -1
- package/dist/components/bn-component-style.js +1 -1
- package/dist/components/bn-context.js +1 -1
- package/dist/components/bn-dataset.js +1 -1
- package/dist/components/bn-datasource.js +1 -1
- package/dist/components/bn-footer2.js +1 -1
- package/dist/components/bn-grid.js +1 -1
- package/dist/components/bn-image.js +1 -1
- package/dist/components/bn-internationalization.js +1 -1
- package/dist/components/bn-layout-card.js +1 -1
- package/dist/components/bn-layout-page.js +1 -1
- package/dist/components/bn-message2.js +1 -1
- package/dist/components/bn-page2.js +1 -1
- package/dist/components/bn-ruleset.js +1 -1
- package/dist/components/bn-scaling-group.js +1 -1
- package/dist/components/bn-table.js +1 -1
- package/dist/components/bn-template.js +1 -1
- package/dist/components/bn-text.js +1 -1
- package/dist/components/bn-title2.js +1 -1
- package/dist/components/bn-tree.js +1 -1
- package/dist/components/checkXYOverflow.js +1 -0
- package/dist/components/context-protocol.js +1 -1
- package/dist/components/editor-companion.js +1 -1
- package/dist/components/emptyState.js +1 -0
- package/dist/components/formatter.js +1 -1
- package/dist/components/ibcs-chart-bubble2.js +1 -1
- package/dist/components/ibcs-chart-bullet2.js +1 -1
- package/dist/components/ibcs-chart-scatter2.js +1 -1
- package/dist/components/ibcs-chart-structure2.js +1 -1
- package/dist/components/ibcs-chart-time2.js +1 -1
- package/dist/components/ibcs-table2.js +1 -1
- package/dist/components/ibcs-title2.js +1 -1
- package/dist/components/layoutTemplate.js +1 -0
- package/dist/components/pageFormats.js +1 -0
- package/dist/components/parentDimensions.js +1 -0
- package/dist/components/queryError.js +1 -0
- package/dist/components/relativeVariance.js +1 -0
- package/dist/components/sanitizeHtml.js +1 -1
- package/dist/components/stackColors.js +1 -1
- package/dist/components/stackLayout.js +1 -0
- package/dist/components/svg.esm.js +1 -0
- package/dist/components/validate.js +1 -1
- package/dist/components/withBodyObserver.js +1 -1
- package/dist/components/withComponentStatus.js +1 -0
- package/dist/components/withComponentStyle.js +1 -1
- package/dist/components/withDataset.js +1 -1
- package/dist/components/withHasError.js +1 -1
- package/dist/components/withRuleSet.js +1 -1
- package/dist/components/withScalingGroup.js +1 -1
- package/dist/components/withStyled.js +1 -1
- package/dist/components/withTranslation.js +1 -1
- package/dist/esm/{bn-asset_21.entry.js → bn-asset_28.entry.js} +20948 -6125
- package/dist/esm/bn-grid.entry.js +4 -6
- package/dist/esm/bn-image.entry.js +3 -5
- package/dist/esm/bn-internationalization.entry.js +17 -6
- package/dist/esm/bn-ruleset.entry.js +5 -5
- package/dist/esm/bn-template-engine.js +1 -1
- package/dist/esm/bn-template.entry.js +2 -2
- package/dist/esm/bn-text.entry.js +111 -39
- package/dist/esm/{context-protocol-B-vdGKeG.js → context-protocol-CdTp19uA.js} +106 -22
- package/dist/esm/{diagnostics-CiquIw8B.js → diagnostics-vw6TKMiT.js} +1 -1
- package/dist/esm/editor-companion.entry.js +2 -2
- package/dist/esm/loader.js +1 -1
- package/dist/esm/queryError-ClruFZD_.js +13 -0
- package/dist/esm/{scaling-Dggyeqts.js → sanitizeHtml-C5bFtARM.js} +464 -287
- package/dist/esm/{withBodyObserver-Cb9ZC5_J.js → withBodyObserver-DD_-r04o.js} +1 -1
- package/dist/esm/withHasError-73WV2SP5.js +422 -0
- package/dist/esm/{withStyled-DoNsbwS3.js → withStyled-BDEyKd_H.js} +513 -27
- package/dist/types/components/bn-chart-bubble/bn-chart-bubble.d.ts +8 -4
- package/dist/types/components/bn-chart-bubble/ibcs-chart-bubble.d.ts +2 -1
- package/dist/types/components/bn-chart-bubble/utils/BubbleChart.d.ts +14 -2
- package/dist/types/components/bn-chart-bullet/bn-chart-bullet.d.ts +12 -11
- package/dist/types/components/bn-chart-bullet/ibcs-chart-bullet.d.ts +2 -1
- package/dist/types/components/bn-chart-bullet/utils/BulletChart.d.ts +8 -5
- package/dist/types/components/bn-chart-bullet/utils/model/BulletChartStyle.d.ts +2 -0
- package/dist/types/components/bn-chart-bullet/utils/model/BulletConfig.d.ts +1 -1
- package/dist/types/components/bn-chart-scatter/bn-chart-scatter.d.ts +8 -4
- package/dist/types/components/bn-chart-scatter/ibcs-chart-scatter.d.ts +2 -1
- package/dist/types/components/bn-chart-scatter/utils/ScatterChart.d.ts +11 -1
- package/dist/types/components/bn-chart-structure/bn-chart-structure.d.ts +13 -12
- package/dist/types/components/bn-chart-structure/ibcs-chart-structure.d.ts +8 -1
- package/dist/types/components/bn-chart-structure/utils/StructureChart.d.ts +29 -6
- package/dist/types/components/bn-chart-structure/utils/elements/StackedBar.d.ts +4 -3
- package/dist/types/components/bn-chart-structure/utils/model/DataPoint.d.ts +3 -2
- package/dist/types/components/bn-chart-structure/utils/model/StructureChartComponentConfig.d.ts +2 -1
- package/dist/types/components/bn-chart-structure/utils/model/styles/StructureChartStyle.d.ts +2 -0
- package/dist/types/components/bn-chart-time/bn-chart-time.d.ts +19 -15
- package/dist/types/components/bn-chart-time/ibcs-chart-time.d.ts +8 -1
- package/dist/types/components/bn-chart-time/utils/TimeChart.d.ts +63 -5
- package/dist/types/components/bn-chart-time/utils/elements/AreaFill.d.ts +1 -1
- package/dist/types/components/bn-chart-time/utils/elements/StackedColumn.d.ts +9 -8
- package/dist/types/components/bn-chart-time/utils/model/DataPoint.d.ts +3 -2
- package/dist/types/components/bn-chart-time/utils/model/TimeChartComponentConfig.d.ts +3 -2
- package/dist/types/components/bn-chart-time/utils/model/styles/TimeChartStyle.d.ts +2 -0
- package/dist/types/components/bn-context/bn-context.d.ts +15 -3
- package/dist/types/components/bn-dataset/bn-dataset.d.ts +41 -20
- package/dist/types/components/bn-datasource/bn-datasource.d.ts +34 -18
- package/dist/types/components/bn-footer/bn-footer.d.ts +2 -2
- package/dist/types/components/bn-layout-card/bn-layout-card.d.ts +3 -10
- package/dist/types/components/bn-layout-page/bn-layout-page.d.ts +13 -6
- package/dist/types/components/bn-message/bn-message.d.ts +2 -1
- package/dist/types/components/bn-page/bn-page.d.ts +2 -1
- package/dist/types/components/bn-page/pageFormats.d.ts +40 -0
- package/dist/types/components/bn-scaling-group/bn-scaling-group.d.ts +2 -2
- package/dist/types/components/bn-table/bn-table.d.ts +11 -10
- package/dist/types/components/bn-table/ibcs-table.d.ts +8 -5
- package/dist/types/components/bn-table/utils/Table.d.ts +3 -1
- package/dist/types/components/bn-table/utils/elements/Cell.d.ts +2 -2
- package/dist/types/components/bn-table/utils/elements/CellBarChart.d.ts +6 -4
- package/dist/types/components/bn-table/utils/elements/WaterfallBar.d.ts +1 -1
- package/dist/types/components/bn-table/utils/factories/tableDataSetFactory.d.ts +2 -0
- package/dist/types/components/bn-table/utils/helper/DataQuery.d.ts +14 -5
- package/dist/types/components/bn-table/utils/helper/IntervalColumns.d.ts +2 -2
- package/dist/types/components/bn-table/utils/helper/QueryGroup.d.ts +6 -1
- package/dist/types/components/bn-table/utils/helper/barColumnGeometry.d.ts +2 -2
- package/dist/types/components/bn-table/utils/model/TableAttribute.d.ts +2 -0
- package/dist/types/components/bn-table/utils/model/TableComponentConfig.d.ts +2 -1
- package/dist/types/components/bn-text/bn-text.d.ts +20 -13
- package/dist/types/components/bn-text/utils/template.d.ts +10 -0
- package/dist/types/components/bn-title/ibcs-title/ibcs-title.d.ts +1 -0
- package/dist/types/components/bn-tree/bn-tree.d.ts +8 -1
- package/dist/types/components/bn-tree/utils/EdgeRenderer.d.ts +18 -5
- package/dist/types/components/bn-tree/utils/TreeLayout.d.ts +5 -0
- package/dist/types/components.d.ts +226 -184
- package/dist/types/context/scopedDb.d.ts +20 -0
- package/dist/types/stores/componentStyles.d.ts +6 -0
- package/dist/types/utils/DateStringFactory.d.ts +3 -2
- package/dist/types/utils/autoFit.d.ts +2 -2
- package/dist/types/utils/componentRegister.d.ts +21 -5
- package/dist/types/utils/constants.d.ts +2 -2
- package/dist/types/utils/dataAnalyzer.d.ts +1 -1
- package/dist/types/utils/emptyState.d.ts +10 -0
- package/dist/types/utils/formatter.d.ts +7 -9
- package/dist/types/utils/layoutState/generic.d.ts +1 -1
- package/dist/types/utils/layoutState/svgChartElements.d.ts +2 -2
- package/dist/types/utils/layoutTemplate.d.ts +16 -0
- package/dist/types/utils/model/ChartStyles.d.ts +1 -1
- package/dist/types/utils/model/DataQueryResultRow.d.ts +2 -2
- package/dist/types/utils/model/Order.d.ts +1 -1
- package/dist/types/utils/model/styles/SVGStyle.d.ts +5 -1
- package/dist/types/utils/parentDimensions.d.ts +9 -0
- package/dist/types/utils/queryError.d.ts +5 -0
- package/dist/types/utils/relativeVariance.d.ts +9 -0
- package/dist/types/utils/sanitizeHtml.d.ts +2 -2
- package/dist/types/utils/scaling.d.ts +1 -1
- package/dist/types/utils/stackColors.d.ts +3 -2
- package/dist/types/utils/stackLayout.d.ts +49 -0
- package/dist/types/utils/testing/fakeGroup.d.ts +8 -0
- package/dist/types/utils/testing/mutationObserver.d.ts +5 -0
- package/dist/types/utils/testing/structureChart.d.ts +5 -0
- package/dist/types/utils/testing/timeChart.d.ts +5 -0
- package/dist/types/utils/validate.d.ts +1 -1
- package/dist/types/utils/withComponentStatus.d.ts +11 -3
- package/dist/types/utils/withInheritedProps.d.ts +42 -15
- package/dist/types/utils/withRuleSet.d.ts +2 -1
- package/dist/types/utils/withTranslation.d.ts +2 -2
- package/dist/types/utils/xy/FacetGrid.d.ts +1 -1
- package/dist/types/utils/xy/IsoCurves.d.ts +1 -1
- package/dist/types/utils/xy/NumericScale.d.ts +9 -4
- package/dist/types/utils/xy/PointLabeler.d.ts +2 -2
- package/dist/types/utils/xy/RadiusScale.d.ts +2 -2
- package/dist/types/utils/xy/SeriesPalette.d.ts +3 -3
- package/dist/types/utils/xy/VarianceMeasure.d.ts +10 -2
- package/dist/types/utils/xy/XYFrame.d.ts +4 -1
- package/dist/types/utils/xy/XYLegend.d.ts +3 -1
- package/dist/types/utils/xy/checkXYOverflow.d.ts +8 -0
- package/dist/types/utils/xy/formatXYValue.d.ts +7 -0
- package/dist/types/utils/xy/model/AxisConfig.d.ts +1 -1
- package/dist/types/utils/xy/model/XYChartStyle.d.ts +2 -0
- package/package.json +4 -2
- package/readme.md +11 -11
- package/dist/bn-template-engine/p-03304284.entry.js +0 -1
- package/dist/bn-template-engine/p-0fb02c57.entry.js +0 -1
- package/dist/bn-template-engine/p-4419db8f.entry.js +0 -1
- package/dist/bn-template-engine/p-45508f1b.entry.js +0 -1
- package/dist/bn-template-engine/p-461fdffa.entry.js +0 -1
- package/dist/bn-template-engine/p-5d7a3a77.entry.js +0 -1
- package/dist/bn-template-engine/p-62cc95b7.entry.js +0 -1
- package/dist/bn-template-engine/p-686d8e44.entry.js +0 -1
- package/dist/bn-template-engine/p-829212c3.entry.js +0 -1
- package/dist/bn-template-engine/p-B5Jd_eCX.js +0 -1
- package/dist/bn-template-engine/p-BA48JiHe.js +0 -1
- package/dist/bn-template-engine/p-BbmobTg0.js +0 -1
- package/dist/bn-template-engine/p-BcaI745G.js +0 -1
- package/dist/bn-template-engine/p-CG_Bcm6V.js +0 -1
- package/dist/bn-template-engine/p-CWWWM-XC.js +0 -1
- package/dist/bn-template-engine/p-CsJ84YRk.js +0 -1
- package/dist/bn-template-engine/p-D5e8I9Qe.js +0 -1
- package/dist/bn-template-engine/p-DVrDYxlh.js +0 -1
- package/dist/bn-template-engine/p-DjPXefnq.js +0 -1
- package/dist/bn-template-engine/p-DsTzlzxQ.js +0 -1
- package/dist/bn-template-engine/p-DtLI_CzV.js +0 -1
- package/dist/bn-template-engine/p-EtT29btN.js +0 -1
- package/dist/bn-template-engine/p-TuLpbB5O.js +0 -1
- package/dist/bn-template-engine/p-a5867a4c.entry.js +0 -1
- package/dist/bn-template-engine/p-b27009eb.entry.js +0 -1
- package/dist/bn-template-engine/p-bfa87b07.entry.js +0 -1
- package/dist/bn-template-engine/p-ceb80db3.entry.js +0 -1
- package/dist/bn-template-engine/p-fcfbb329.entry.js +0 -1
- package/dist/bn-template-engine/p-qRZrT-U3.js +0 -1
- package/dist/cjs/AxisConfig-DwiNUyYG.js +0 -233
- package/dist/cjs/LabelCollisionManager-Bv-xkeXw.js +0 -415
- package/dist/cjs/NumericScale-BAyYXpKL.js +0 -107
- package/dist/cjs/Order-2wRydarc.js +0 -87
- package/dist/cjs/SVGStyle-DoxylrEQ.js +0 -8219
- package/dist/cjs/SVGVariancesStyleGroup-CiI4GeWe.js +0 -50
- package/dist/cjs/VarianceMeasure-CQlSRzlp.js +0 -372
- package/dist/cjs/XYChartDataRow-C2FdL58s.js +0 -829
- package/dist/cjs/bn-chart-bubble.cjs.entry.js +0 -792
- package/dist/cjs/bn-chart-bullet.cjs.entry.js +0 -805
- package/dist/cjs/bn-chart-scatter.cjs.entry.js +0 -678
- package/dist/cjs/bn-tree.cjs.entry.js +0 -1042
- package/dist/cjs/ibcs-chart-bubble.cjs.entry.js +0 -624
- package/dist/cjs/ibcs-chart-bullet.cjs.entry.js +0 -673
- package/dist/cjs/ibcs-chart-scatter.cjs.entry.js +0 -667
- package/dist/cjs/sanitizeHtml-LuZr1IMd.js +0 -85
- package/dist/cjs/svgChartElements-tDA43aYj.js +0 -400
- package/dist/cjs/withHasError-BdDmiOXM.js +0 -258
- package/dist/cjs/withScalingGroup-CFIc5-6s.js +0 -73
- package/dist/components/autoFit.js +0 -1
- package/dist/components/main.js +0 -1
- package/dist/components/utils.js +0 -1
- package/dist/esm/AxisConfig-KqzWQbML.js +0 -224
- package/dist/esm/LabelCollisionManager-585bQMtP.js +0 -407
- package/dist/esm/NumericScale-DsTzlzxQ.js +0 -105
- package/dist/esm/Order-DZVWjEL_.js +0 -83
- package/dist/esm/SVGStyle-OrPkzjcb.js +0 -8209
- package/dist/esm/SVGVariancesStyleGroup-DO5QJfRQ.js +0 -48
- package/dist/esm/VarianceMeasure-DDjChp8C.js +0 -364
- package/dist/esm/XYChartDataRow-Dn83Tqh9.js +0 -820
- package/dist/esm/bn-chart-bubble.entry.js +0 -790
- package/dist/esm/bn-chart-bullet.entry.js +0 -803
- package/dist/esm/bn-chart-scatter.entry.js +0 -676
- package/dist/esm/bn-tree.entry.js +0 -1040
- package/dist/esm/ibcs-chart-bubble.entry.js +0 -622
- package/dist/esm/ibcs-chart-bullet.entry.js +0 -671
- package/dist/esm/ibcs-chart-scatter.entry.js +0 -665
- package/dist/esm/sanitizeHtml-BA48JiHe.js +0 -83
- package/dist/esm/svgChartElements-B3YClivG.js +0 -395
- package/dist/esm/withHasError-Bh1Viz52.js +0 -254
- package/dist/esm/withScalingGroup-DNBSqRC0.js +0 -71
|
@@ -1 +1 @@
|
|
|
1
|
-
import{proxyCustomElement as t,HTMLElement as i,writeTask as e,forceUpdate as s,h as a,Host as r,transformTag as n}from"@stencil/core/internal/client";import{v as o,a as l,k as c,b as h,c as d,h as u,l as p,m as v,n as m,i as g}from"./validate.js";import{w as f,g as y}from"./withDataset.js";import{w as b,a as S}from"./withHasError.js";import{i as w,w as O,a as _}from"./withTranslation.js";import{w as k}from"./withScalingGroup.js";import{a as x}from"./context-protocol.js";import{w as A}from"./withStyled.js";import{w as R}from"./withComponentStyle.js";import{w as T}from"./withRuleSet.js";import{r as M,f as E,p as U}from"./scaling.js";import{o as N}from"./layoutObserver.js";import{A as C,e as L,f as j,g as $}from"./CompareUtil.js";import{O as D,a as P}from"./Order.js";import{L as z}from"./types.js";import{o as W,m as F}from"./geometry.js";import{r as G,a as I}from"./diagnostics.js";import{a as H}from"./svgChartElements.js";import{d as V}from"./ibcs-chart-structure2.js";const J=t(class t extends i{validateScenario(t){const i="ERR_scenarios";if(w(t))return void this.errors.remove(i);const e=o(t);e.length>0?this.errors.addOrReplace({id:i,type:"warning",message:"scenarios: invalid value(s) '"+JSON.stringify(e)+"' are not supported."}):this.errors.remove(i)}validateVariances(t){const i="ERR_variances";if(w(t))return void this.errors.remove(i);const e=l(t);e.length>0?this.errors.addOrReplace({id:i,type:"warning",message:"variances: invalid value(s) '"+JSON.stringify(e)+"' are not supported."}):this.errors.remove(i)}validateUnitScaling(t){const i="ERR_unitScaling";"invalid"===M(t,this.pixelPerUnitGroupMap).kind?this.errors.addOrReplace({id:i,type:"warning",message:"unitScaling: invalid value(s) '"+t+"' are not supported."}):this.errors.remove(i)}validatePercentageScaling(t){const i="ERR_percentageScaling";"invalid"===M(t,this.pixelPerUnitGroupMap).kind?this.errors.addOrReplace({id:i,type:"warning",message:"percentageScaling: invalid value(s) '"+t+"' are not supported."}):this.errors.remove(i)}validateLevel(t){const i="ERR_level";c(t)?this.errors.remove(i):this.errors.addOrReplace({id:i,type:"warning",message:"level: invalid value(s) '"+t+"' are not supported."})}validateOrderList(t){const i="ERR_order";if(w(t))return void this.errors.remove(i);const e=h(t);e.length>0?this.errors.addOrReplace({id:i,type:"warning",message:"order: invalid value(s) '"+JSON.stringify(e)+"' are not supported."}):this.errors.remove(i)}validateOrderDirection(t){const i="ERR_orderDirection";w(t)||d(t)?this.errors.remove(i):this.errors.addOrReplace({id:i,type:"warning",message:"orderDirection: invalid value '"+(null==t?void 0:""+t)+"' is not supported."})}validateLimit(t){const i="ERR_limit";u(t)?this.errors.remove(i):this.errors.addOrReplace({id:i,type:"warning",message:"limit: invalid value '"+(null==t?void 0:""+t)+"' is not supported."})}validateShowCategories(t){const i="ERR_showCategories";p(t)?this.errors.remove(i):this.errors.addOrReplace({id:i,type:"warning",message:"showCategories: invalid value(s) '"+(null==t?void 0:""+t)+"' are not supported."})}validateMeasureScale(t){const i="ERR_measureScale";v(t)?this.errors.remove(i):this.errors.addOrReplace({id:i,type:"warning",message:"measureScale: invalid value '"+(null==t?void 0:""+t)+"' is not supported."})}validateShowMeasureScale(t){const i="ERR_grouped";p(t)?this.errors.remove(i):this.errors.addOrReplace({id:i,type:"warning",message:"showMeasureScale: invalid value(s) '"+(null==t?void 0:""+t)+"' are not supported."})}validateStack(t){const i="ERR_stack",e=m(t);e.length>0?this.errors.addOrReplace({id:i,type:"warning",message:e.join("; ")}):this.errors.remove(i)}validateScaling(t){if(null==t||""===t||"none"===t||"auto"===t)return void this.errors.remove("ERR_scale");const i=Number(t);isNaN(i)||i<=0?this.errors.addOrReplace({id:"ERR_scale",type:"warning",message:`Invalid scale value: "${t}". Use "none", "auto", or a positive number.`}):this.errors.remove("ERR_scale")}constructor(i){super(),!1!==i&&this.__registerHost(),this.__attachShadow(),this.datasetName="",this.dataVersion=0,this.datasetMeta=null,this.appliedScaleFactor=1,this.layoutObserver=null,this._lastScaledParentHeight=0,this.chartTitle="",this.filter="",this.limit=0,this.showCategories="true",this.measureScale="greatest",this.showMeasureScale="false",this.measureUnit="",this.stack="",this.pixelPerUnitGroupMap=new Map,this._autoScaleGuard=!1,this.autoUnitWarningActive=!1,this.autoPctWarningActive=!1,this.handleAutoScalingReport=i=>{var e,s,a,r,n,o;this.lastAutoScalingReport={unit:null!==(e=i.unit)&&void 0!==e?e:null===(s=this.lastAutoScalingReport)||void 0===s?void 0:s.unit,percentage:null!==(a=i.percentage)&&void 0!==a?a:null===(r=this.lastAutoScalingReport)||void 0===r?void 0:r.percentage};const l=(t,i)=>void 0===i||Math.abs(t-i)>.001*Math.abs(t),c=this.getEffectiveFontPx();if(void 0!==i.unit&&i.unit>0&&this.autoUnitWarningActive){const e=c/i.unit;l(e,this.lastReportedUnitsPerEm)&&(this.lastReportedUnitsPerEm=e,this.errors.addOrReplace({id:"AUTO_unitScaling",type:"warning",message:`unit-scaling: ${t.describeScalingInput(((null!==(n=this.unitScaling)&&void 0!==n?n:"")+"").trim())}, auto-fitted to 1 em ≈ ${E(e)} units.`}))}if(void 0!==i.percentage&&i.percentage>0&&this.autoPctWarningActive){const e=100*c/i.percentage;l(e,this.lastReportedPpPerEm)&&(this.lastReportedPpPerEm=e,this.errors.addOrReplace({id:"AUTO_percentageScaling",type:"warning",message:`percentage-scaling: ${t.describeScalingInput(((null!==(o=this.percentageScaling)&&void 0!==o?o:"")+"").trim())}, auto-fitted to 1 em ≈ ${E(e)} percentage points.`}))}},A(this),b(this),f(this,(t=>{this.datasetName=(null==t?void 0:t.startsWith("$"))?t.substring(1):t||"",this.dataVersion=this.dataVersion+1}),((t,i)=>{this.datasetMeta=i})),this.chartTemplate=this.chartTemplate.bind(this),this.errors=S(this),k(this),this.componentStyle=R(this),this.ruleSetConfig=T(this),this.t=O(this).t,this.resolveInherited=_(this,[{propName:"scenarios",ancestorAttr:"title-scenarios"},{propName:"variances",ancestorAttr:"title-variances"},{propName:"order",ancestorAttr:"title-order"},{propName:"orderDirection",ancestorAttr:"title-order-direction"}])}componentWillLoad(){this.validateScenario(this.scenarios),this.validateVariances(this.variances),this.validateUnitScaling(this.unitScaling),this.validateLevel(this.level),this.validateOrderDirection(this.orderDirection),this.validateOrderList(this.order),this.validateShowCategories(this.showCategories),this.validateMeasureScale(this.measureScale),this.validateShowMeasureScale(this.showMeasureScale),this.validateStack(this.stack),this.validateScaling(this.scale)}componentDidRender(){const{mode:t}=U(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 i=this.element,{height:s}=y(i);if(s<=0)return void this.checkOverflow();this._lastScaledParentHeight=s;const a=this.componentStyle((t=>{var i;return(null===(i=t.global)||void 0===i?void 0:i.fontSizePx)||13.3333})),r=i.scrollHeight,n=this.appliedScaleFactor;if(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||(i.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,e((()=>{this.appliedScaleFactor=o}))),this.checkOverflow()}componentDidLoad(){this.layoutObserver=N(this.element,(()=>{if(this._autoScaleGuard)return;const{height:t}=y(this.element);t>0&&Math.abs(t-this._lastScaledParentHeight)>2&&(this._lastScaledParentHeight=t,s(this))})),requestAnimationFrame((()=>{requestAnimationFrame((()=>{if(this._autoScaleGuard)return;const{height:t}=y(this.element);this._lastScaledParentHeight=t,s(this)}))}))}disconnectedCallback(){var t;null===(t=this.layoutObserver)||void 0===t||t.disconnect(),this.layoutObserver=null}measureContentWidth(){var t;const i=null===(t=this.element.shadowRoot)||void 0===t?void 0:t.querySelectorAll("ibcs-chart-structure");let e=0,s=!1;return null==i||i.forEach((t=>{var i,a,r;const n=parseFloat(null!==(r=null===(a=null===(i=t.shadowRoot)||void 0===i?void 0:i.querySelector("svg#drawCanvas"))||void 0===a?void 0:a.getAttribute("width"))&&void 0!==r?r:"");Number.isNaN(n)||(e+=n,s=!0)})),s?Math.max(Math.floor(e),this.element.scrollWidth):this.element.scrollWidth}checkOverflow(){const t="WARN_overflow",i=y(this.element),e=this.measureContentWidth(),s=this.element.scrollHeight,a=i.width>0&&e>i.width+1,r=i.height>0&&s>i.height+1;if(!a&&!r)return void this.errors.remove(t);const n=this.prepareVariances().some((t=>t.startsWith("dr"))),o="value"===M(this.unitScaling,this.pixelPerUnitGroupMap).kind,l=n&&"value"===M(this.percentageScaling,this.pixelPerUnitGroupMap).kind,{mode:c}=U(this.scale),h="auto"!==c&&"empty"!==c,d=[];a&&o&&d.push("unit-scaling"),a&&l&&d.push("percentage-scaling"),r&&h&&d.push("scale");const u=[];a&&u.push(`width (${Math.round(e)}px > ${Math.round(i.width)}px)`),r&&u.push(`height (${Math.round(s)}px > ${Math.round(i.height)}px)`),this.errors.addOrReplace({id:t,type:d.length>0?"error":"warning",message:`Chart exceeds available ${u.join(" and ")}. `+(d.length>0?`Adjust ${d.join(" / ")} or set to "auto".`:"Content does not fit even at minimum auto scaling; enlarge the container.")})}prepareDimension(){const t=y(this.element),i=this.prepareVariances();return this.canvasWidthSegmented=t.width/(1+i.length),{width:this.canvasWidthSegmented,height:t.height}}prepareScenarios(){var t,i,e,s;const a=this.resolveInherited("scenarios",this.scenarios);if(void 0!==a)return this.errors.remove("AUTO_scenarios"),a.split(",").map((t=>t.trim()));const r="auto"===(null===(t=this.scenarios)||void 0===t?void 0:t.trim().toLowerCase());return g(this.scenarios)||r?(null===(e=null===(i=this.datasetMeta)||void 0===i?void 0:i.availableScenarios)||void 0===e?void 0:e.length)>0?(r?this.errors.remove("AUTO_scenarios"):this.errors.addOrReplace({id:"AUTO_scenarios",type:"warning",message:"scenarios: not set, auto-detected: "+this.datasetMeta.availableScenarios.join(",")}),this.datasetMeta.availableScenarios):[]:(this.errors.remove("AUTO_scenarios"),null===(s=this.scenarios)||void 0===s?void 0:s.split(",").map((t=>t.trim())))}prepareVariances(){var t;const i=this.resolveInherited("variances",this.variances);return void 0!==i?i.split(",").map((t=>t.trim())):g(this.variances)?[]:null===(t=this.variances)||void 0===t?void 0:t.split(",").map((t=>t.trim()))}prepareHideCategories(t){return t>=1||"true"!==this.showCategories}prepareI18n(){const t=x,i=new Map(["no-data","REST"].map((t=>[t,this.t(".".concat(t))]))),e=new Map(t.map((t=>[t,this.t("global.".concat(t))])));return new Map([...e.entries(),...i.entries()])}static describeScalingInput(t){return""===t?"not set":`invalid value "${t}"`}preparePixelPerUnit(){const i=M(this.unitScaling,this.pixelPerUnitGroupMap);return"value"===i.kind?(this.errors.remove("AUTO_unitScaling"),this.autoUnitWarningActive=!1,this.lastReportedUnitsPerEm=void 0,this.getEffectiveFontPx()/i.value):"auto"===i.kind?(this.errors.remove("AUTO_unitScaling"),this.autoUnitWarningActive=!1,this.lastReportedUnitsPerEm=void 0,0):(this.autoUnitWarningActive=!0,this.errors.addOrReplace({id:"AUTO_unitScaling",type:"warning",message:`unit-scaling: ${t.describeScalingInput(i.raw)}, auto-calculated to fit available space.`}),0)}preparePixelPerPercentage(){const i=M(this.percentageScaling,this.pixelPerUnitGroupMap);return"value"===i.kind?(this.errors.remove("AUTO_percentageScaling"),this.autoPctWarningActive=!1,this.lastReportedPpPerEm=void 0,100*this.getEffectiveFontPx()/i.value):"auto"===i.kind?(this.errors.remove("AUTO_percentageScaling"),this.autoPctWarningActive=!1,this.lastReportedPpPerEm=void 0,0):(this.autoPctWarningActive=!0,this.errors.addOrReplace({id:"AUTO_percentageScaling",type:"warning",message:`percentage-scaling: ${t.describeScalingInput(i.raw)}, auto-calculated to fit available space.`}),0)}prepareLevel(){var t,i,e;const s="auto"===(null===(t=this.level)||void 0===t?void 0:t.trim().toLowerCase());return g(this.level)||s?(null===(i=this.datasetMeta)||void 0===i?void 0:i.suggestedLevel)?(s?this.errors.remove("AUTO_level"):this.errors.addOrReplace({id:"AUTO_level",type:"warning",message:"level: not set, auto-detected: "+this.datasetMeta.suggestedLevel}),C[this.datasetMeta.suggestedLevel.toUpperCase()]):void 0:(this.errors.remove("AUTO_level"),C[null===(e=this.level)||void 0===e?void 0:e.toUpperCase()])}prepareOrder(){var t;const i=this.resolveInherited("order",this.order),e=this.resolveInherited("orderDirection",this.orderDirection),s=null!=i?i:this.order,a=null!=e?e:this.orderDirection,r="auto"===(null==s?void 0:s.trim().toLowerCase());let n;return g(s)||r?(null===(t=this.datasetMeta)||void 0===t?void 0:t.suggestedOrder)?(r?this.errors.remove("AUTO_order"):this.errors.addOrReplace({id:"AUTO_order",type:"warning",message:"order: not set, auto-detected: "+this.datasetMeta.suggestedOrder}),n=this.datasetMeta.suggestedOrder):n=s:(this.errors.remove("AUTO_order"),n=s),{hierarchy:null==n?void 0:n.split(",").map((t=>P[null==t?void 0:t.toUpperCase()])),direction:D[null==a?void 0:a.toUpperCase()]}}prepareStyle(){const t=this.getEffectiveScaleFactor();return this.componentStyle((i=>{const e=i.global.fontSizePx*t;return{scaleFactors:{scenarioOffset:i["bn-chart-structure"].scaleFactors.scenarioOffset,scenarioLabelToBar:i["bn-chart-structure"].scaleFactors.scenarioLabelToBar,labelToBar:i["bn-chart-structure"].scaleFactors.labelToBar,labelToAxis:i["bn-chart-structure"].scaleFactors.labelToAxis,needleWidth:i["bn-chart-structure"].scaleFactors.needleWidth,needleHeadWidth:i["bn-chart-structure"].scaleFactors.needleHeadWidth,barWidth:i["bn-chart-structure"].scaleFactors.barWidth,varianceAxisLineWidth:i["bn-chart-structure"].scaleFactors.varianceAxisLineWidth,axisLineWidth:i["bn-chart-structure"].scaleFactors.axisLineWidth,auxiliaryLineWidth:i["bn-chart-structure"].scaleFactors.auxiliaryLineWidth,scenarioLineWidth:i["bn-chart-structure"].scaleFactors.scenarioLineWidth,markerWidth:i["bn-chart-structure"].scaleFactors.markerWidth,markerOffset:i["bn-chart-structure"].scaleFactors.markerOffset,categoryWidth:i["bn-chart-structure"].scaleFactors.categoryWidth,axisTickLength:i["bn-chart-structure"].scaleFactors.axisTickLength},fontStyles:{font:`${e}px ${i.global.fontFamily}`,family:i.global.fontFamily,size:e,color:i.global.fontColor,background:i.global.fontBackgroundColor,leading:1.8},axisStyles:i["bn-chart-structure"].axisStyles,barStyles:i["bn-chart-structure"].barStyles,varianceStyles:i["bn-chart-structure"].varianceStyles,padding:i["bn-chart-structure"].padding,pattern:null}}))}prepareChartTitle(t){return t>=1?"":this.chartTitle}prepareStackConfig(){if(g(this.stack))return this.errors.remove("WARN_stack_dimensions_scenarios"),null;try{const t=JSON.parse(this.stack),i=t.by,e="WARN_stack_dimensions_scenarios";if(i===L.DIMENSIONS){const t=this.prepareScenarios();t.length>1?this.errors.addOrReplace({id:e,type:"warning",message:`stack by dimensions: only the first scenario "${t[0]}" is used, the rest (${t.slice(1).join(", ")}) are discarded.`}):this.errors.remove(e)}else this.errors.remove(e);return{by:i,mode:t.mode||$.ABSOLUTE,order:t.order||j.DATASET}}catch(t){return this.errors.remove("WARN_stack_dimensions_scenarios"),null}}prepareFilter(){return 0===this.filter.length?"":this.filter}prepareLimit(){return Math.floor(Number(this.limit)||0)}getDataStructure(){return{IStructureChartDataRow:{operation:{type:"string",isOptional:!1,description:""},rowGroup:{type:"string",isOptional:!1,description:""},rowGroupIndex:{type:"number",isOptional:!1,description:""},category:{type:"string",isOptional:!1,description:""},categoryIndex:{type:"number",isOptional:!1,description:""},subCategory:{type:"string",isOptional:!1,description:""},subCategoryIndex:{type:"number",isOptional:!1,description:""},columnGroup:{type:"string",isOptional:!1,description:""},columnGroupIndex:{type:"number",isOptional:!1,description:""},columnSubGroup:{type:"string",isOptional:!1,description:""},columnSubGroupIndex:{type:"number",isOptional:!1,description:""},ac1:{type:"number",isOptional:!1,description:""},ac2:{type:"number",isOptional:!1,description:""},ac3:{type:"number",isOptional:!1,description:""},ac4:{type:"number",isOptional:!1,description:""},pp1:{type:"number",isOptional:!1,description:""},pp2:{type:"number",isOptional:!1,description:""},pp3:{type:"number",isOptional:!1,description:""},pp4:{type:"number",isOptional:!1,description:""},fc1:{type:"number",isOptional:!1,description:""},fc2:{type:"number",isOptional:!1,description:""},fc3:{type:"number",isOptional:!1,description:""},fc4:{type:"number",isOptional:!1,description:""},pl1:{type:"number",isOptional:!1,description:""},pl2:{type:"number",isOptional:!1,description:""},pl3:{type:"number",isOptional:!1,description:""},pl4:{type:"number",isOptional:!1,description:""}}}}prepareMeasureScale(){return g(this.measureScale)?"GREATEST":["_","k","M","G","T","P","E","Z","Y","m","μ","n","p","P","f","a","z","y"].includes(this.measureScale.trim())||"LEAST"===this.measureScale.trim().toUpperCase()?this.measureScale.trim():"GREATEST"}prepareShowMeasureScale(t){return 0===t&&"true"===this.showMeasureScale}prepareMeasureUnit(){return""===this.measureUnit||null==this.measureUnit?"":this.measureUnit}chartTemplate(t,i){const e=this.preparePixelPerUnit(),s=this.preparePixelPerPercentage(),r=this.prepareStackConfig(),n=this.prepareScenarios(),o=(null==r?void 0:r.by)===L.DIMENSIONS?n.slice(0,1):n;return a("ibcs-chart-structure",{tableName:this.datasetName,dataVersion:this.dataVersion,chartTitle:this.prepareChartTitle(i),scenarios:o,variances:[t],hideCategories:this.prepareHideCategories(i),pixelPerUnit:e,pixelPerPercentage:s,reportAutoScaling:this.handleAutoScalingReport,limit:this.prepareLimit(),styles:this.prepareStyle(),i18n:this.prepareI18n(),order:this.prepareOrder(),level:this.prepareLevel(),filter:this.prepareFilter(),"measure-scale":this.prepareMeasureScale(),"measure-unit":this.prepareMeasureUnit(),showMeasureScale:this.prepareShowMeasureScale(i),stackConfig:r,parentDimensions:this.prepareDimension(),ruleSetConfig:this.ruleSetConfig()})}async getLayoutState(t){var i,e,s,a;const r=null!==(i=null==t?void 0:t.detail)&&void 0!==i?i:"summary",n=W(this.element),o=this.getEffectiveScaleFactor(),l=Number.isFinite(o)&&o>0?o:1,c=this.componentStyle((t=>{var i;return(null===(i=t.global)||void 0===i?void 0:i.fontSizePx)||13.3333}))*l,h=this.prepareVariances(),d=H(this.element,"ibcs-chart-structure",["base",...h],n,r),u=null===(e=this.element.shadowRoot)||void 0===e?void 0:e.querySelector("ibcs-chart-structure"),p={version:z,tag:this.element.localName,id:I(this.element),slot:null!==(s=this.element.getAttribute("slot"))&&void 0!==s?s:void 0,rect:F(this.element,n),em:{fontSizePx:c,appliedScaleFactor:l},regions:d.regions,metadata:{title:this.chartTitle||void 0,scenarios:null!==(a=null==u?void 0:u.scenarios)&&void 0!==a?a:[],variances:h,barCount:d.barCount,hasNoData:0===d.barCount},diagnostics:G(this.element),scaling:this.resolveScalingInfo(c)};return d.elements&&(p.elements=d.elements),p}resolveScalingInfo(t){var i,e;const s={},a=M(this.unitScaling,this.pixelPerUnitGroupMap);if("value"===a.kind)s.unitMode="fixed",s.unitsPerEm=a.value,s.unitPxPerUnit=t/a.value;else{s.unitMode="auto";const e=null===(i=this.lastAutoScalingReport)||void 0===i?void 0:i.unit;void 0!==e&&e>0&&(s.unitPxPerUnit=e,s.unitsPerEm=t/e)}const r=M(this.percentageScaling,this.pixelPerUnitGroupMap);if("value"===r.kind)s.percentageMode="fixed",s.percentagePointsPerEm=r.value,s.percentagePxPerPoint=t/r.value;else{s.percentageMode="auto";const i=null===(e=this.lastAutoScalingReport)||void 0===e?void 0:e.percentage;void 0!==i&&i>0&&(s.percentagePxPerPoint=i/100,s.percentagePointsPerEm=100*t/i)}return s}getEffectiveScaleFactor(){const{mode:t,factor:i}=U(this.scale);return"factor"===t?i:"auto"===t||"empty"===t?this.appliedScaleFactor:1}getEffectiveFontPx(){return this.componentStyle((t=>{var i;return(null===(i=t.global)||void 0===i?void 0:i.fontSizePx)||13.3333}))*this.getEffectiveScaleFactor()}getFontStyles(){const t=this.getEffectiveScaleFactor();return this.componentStyle((i=>{var e,s,a,r;const n=(null===(e=i.global)||void 0===e?void 0:e.fontSizePx)||13.3333;return{"--bn-font-family":(null===(s=i.global)||void 0===s?void 0:s.fontFamily)||"'Noto Sans', sans-serif","--bn-font-size":n*t+"px","--bn-font-color":(null===(a=i.global)||void 0===a?void 0:a.fontColor)||"#000000","--bn-font-background":(null===(r=i.global)||void 0===r?void 0:r.fontBackgroundColor)||"#ffffff"}}))}render(){let t=[""];const i=this.prepareVariances();i.length>0&&(t=[...t,...i]);const e=this.getFontStyles();return a(r,{key:"4039c2676dbb48bc14e30092d5f5e7a8c080bd2a",style:e},a("div",{key:"c57dbcf301b86f4b22da3142c242008f8f049268",class:"container"},t.map(this.chartTemplate)))}get element(){return this}static get watchers(){return{scenarios:[{validateScenario:0}],variances:[{validateVariances:0}],unitScaling:[{validateUnitScaling:0}],percentageScaling:[{validatePercentageScaling:0}],level:[{validateLevel:0}],order:[{validateOrderList:0}],orderDirection:[{validateOrderDirection:0}],limit:[{validateLimit:0}],showCategories:[{validateShowCategories:0}],measureScale:[{validateMeasureScale:0}],showMeasureScale:[{validateShowMeasureScale:0}],stack:[{validateStack:0}],scale:[{validateScaling: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:row}.background-image{display:flex;flex-wrap:wrap;justify-content:flex-end}.categories{text-align:right;font-size:var(--bn-font-size, 1em);font-family:var(--bn-font-family, "Noto Sans", "Helvetica Neue", Helvetica, sans-serif);color:var(--bn-font-color, black)}.label-bg{fill:var(--bn-font-background, white);opacity:0.7}.label-text{text-align:right;font-size:var(--bn-font-size, 1em);font-family:var(--bn-font-family, "Noto Sans", "Helvetica Neue", Helvetica, sans-serif);color:var(--bn-font-color, black)}.axis-title{text-align:center;font-family:var(--bn-font-family, "Noto Sans", "Helvetica Neue", Helvetica, sans-serif);color:var(--bn-font-color, black)}.axis-ac{stroke:black;stroke-width:0.1em}.axis-pp{stroke:grey;stroke-width:0.1em}.axis-fc{stroke:black;stroke-dasharray:2;stroke-width:0.1em}.axis-pl{stroke:white;stroke-width:0.1em;outline-offset:0em;outline:0.1em solid black}canvas{image-rendering:-moz-crisp-edges;image-rendering:-webkit-crisp-edges;image-rendering:pixelated;image-rendering:crisp-edges}.measure{font-weight:bold}span{display:inline-block}.hidePatternContainer{height:0;width:0}div{float:left}.warning{font-size:0.8em;font-style:italic}svg#drawCanvas{display:block}.footer{margin:0.2em;font-size:0.6em}.footer-hide{margin:0.2em;font-size:0.6em;opacity:0}'}},[1,"bn-chart-structure",{chartTitle:[1,"chart-title"],ruleset:[513],filter:[1],scenarios:[1],variances:[1],unitScaling:[8,"unit-scaling"],percentageScaling:[8,"percentage-scaling"],level:[1],order:[1],orderDirection:[1,"order-direction"],limit:[2],showCategories:[1,"show-categories"],measureScale:[1,"measure-scale"],showMeasureScale:[1,"show-measure-scale"],measureUnit:[1,"measure-unit"],stack:[1],scale:[1],datasetName:[32],dataVersion:[32],datasetMeta:[32],appliedScaleFactor:[32],getLayoutState:[64]},void 0,{scenarios:[{validateScenario:0}],variances:[{validateVariances:0}],unitScaling:[{validateUnitScaling:0}],percentageScaling:[{validatePercentageScaling:0}],level:[{validateLevel:0}],order:[{validateOrderList:0}],orderDirection:[{validateOrderDirection:0}],limit:[{validateLimit:0}],showCategories:[{validateShowCategories:0}],measureScale:[{validateMeasureScale:0}],showMeasureScale:[{validateShowMeasureScale:0}],stack:[{validateStack:0}],scale:[{validateScaling:0}]}]),q=J,B=function(){"undefined"!=typeof customElements&&["bn-chart-structure","ibcs-chart-structure"].forEach((t=>{switch(t){case"bn-chart-structure":customElements.get(n(t))||customElements.define(n(t),J);break;case"ibcs-chart-structure":customElements.get(n(t))||V()}}))};export{q as BnChartStructure,B as defineCustomElement}
|
|
1
|
+
import{proxyCustomElement as t,HTMLElement as i,writeTask as e,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{v as c,a as h,i as d,k as u,b as p,c as v,h as m,l as g,m as f,n as y}from"./validate.js";import{w as b}from"./withDataset.js";import{w as S}from"./withComponentStatus.js";import{i as w,w as O,a as x}from"./withTranslation.js";import{w as k}from"./withScalingGroup.js";import{w as _}from"./withStyled.js";import{w as R}from"./withComponentStyle.js";import{w as A}from"./withRuleSet.js";import{w as T}from"./withHasError.js";import{g as M}from"./parentDimensions.js";import{r as E,f as C,p as N}from"./scaling.js";import{o as U}from"./layoutObserver.js";import{A as j,e as L,f as D,g as $}from"./CompareUtil.js";import{a as z,O as P}from"./Order.js";import{L as W}from"./types.js";import{o as F,m as G}from"./geometry.js";import{r as I,a as H}from"./diagnostics.js";import{a as V}from"./svgChartElements.js";import{s as J}from"./emptyState.js";import{d as q}from"./ibcs-chart-structure2.js";const B=t(class t extends i{validateFilter(t){const i="ERR_filter";o(t)?this.errors.addOrReplace({id:i,type:"error",message:"filter: double backticks are not allowed."}):this.errors.remove(i)}validateScenario(t){const i="ERR_scenarios";if(w(t))return void this.errors.remove(i);const e=c(t);e.length>0?this.errors.addOrReplace({id:i,type:"warning",message:"scenarios: invalid value(s) '"+JSON.stringify(e)+"' are not supported."}):this.errors.remove(i)}validateVariances(t){const i="ERR_variances";if(w(t))return void this.errors.remove(i);const e=h(t);e.length>0?this.errors.addOrReplace({id:i,type:"warning",message:"variances: invalid value(s) '"+JSON.stringify(e)+"' are not supported."}):this.errors.remove(i)}validateUnitScaling(t){const i="ERR_unitScaling";d(t)?this.errors.remove(i):"invalid"===E(t,this.pixelPerUnitGroupMap).kind?this.errors.addOrReplace({id:i,type:"warning",message:"unitScaling: invalid value(s) '"+t+"' are not supported."}):this.errors.remove(i)}validatePercentageScaling(t){const i="ERR_percentageScaling";d(t)?this.errors.remove(i):"invalid"===E(t,this.pixelPerUnitGroupMap).kind?this.errors.addOrReplace({id:i,type:"warning",message:"percentageScaling: invalid value(s) '"+t+"' are not supported."}):this.errors.remove(i)}validateLevel(t){const i="ERR_level";d(t)||u(t)?this.errors.remove(i):this.errors.addOrReplace({id:i,type:"warning",message:"level: invalid value(s) '"+t+"' are not supported."})}validateOrderList(t){const i="ERR_order";if(w(t))return void this.errors.remove(i);const e=p(t);e.length>0?this.errors.addOrReplace({id:i,type:"warning",message:"order: invalid value(s) '"+JSON.stringify(e)+"' are not supported."}):this.errors.remove(i)}validateOrderDirection(t){const i="ERR_orderDirection";w(t)||d(t)||v(t)?this.errors.remove(i):this.errors.addOrReplace({id:i,type:"warning",message:"orderDirection: invalid value '"+(null==t?void 0:""+t)+"' is not supported."})}validateLimit(t){const i="ERR_limit";m(t)?this.errors.remove(i):this.errors.addOrReplace({id:i,type:"warning",message:"limit: invalid value '"+(null==t?void 0:""+t)+"' is not supported."})}validateShowCategories(t){const i="ERR_showCategories";g(t)?this.errors.remove(i):this.errors.addOrReplace({id:i,type:"warning",message:"showCategories: invalid value(s) '"+(null==t?void 0:""+t)+"' are not supported."})}validateMeasureScale(t){const i="ERR_measureScale";f(t)?this.errors.remove(i):this.errors.addOrReplace({id:i,type:"warning",message:"measureScale: invalid value '"+(null==t?void 0:""+t)+"' is not supported."})}validateShowMeasureScale(t){const i="ERR_showMeasureScale";g(t)?this.errors.remove(i):this.errors.addOrReplace({id:i,type:"warning",message:"showMeasureScale: invalid value(s) '"+(null==t?void 0:""+t)+"' are not supported."})}validateStack(t){const i="ERR_stack",e=y(t);e.length>0?this.errors.addOrReplace({id:i,type:"warning",message:e.join("; ")}):this.errors.remove(i)}validateScaling(t){if(null==t||""===t||"none"===t||"auto"===t)return void this.errors.remove("ERR_scale");const i=Number(t);isNaN(i)||i<=0?this.errors.addOrReplace({id:"ERR_scale",type:"warning",message:`Invalid scale value: "${t}". Use "none", "auto", or a positive number.`}):this.errors.remove("ERR_scale")}constructor(i){super(),!1!==i&&this.__registerHost(),this.__attachShadow(),this.datasetName="",this.dataVersion=0,this.datasetMeta=null,this.appliedScaleFactor=1,this.layoutObserver=null,this._lastScaledParentHeight=0,this.chartTitle="",this.filter="",this.limit=0,this.showCategories="true",this.measureScale="greatest",this.showMeasureScale="false",this.measureUnit="",this.stack="",this.pixelPerUnitGroupMap=new Map,this._autoScaleGuard=!1,this.autoUnitWarningActive=!1,this.autoPctWarningActive=!1,this.handleAutoScalingReport=i=>{var e,s,a,r,n,o;this.lastAutoScalingReport={unit:null!==(e=i.unit)&&void 0!==e?e:null===(s=this.lastAutoScalingReport)||void 0===s?void 0:s.unit,percentage:null!==(a=i.percentage)&&void 0!==a?a:null===(r=this.lastAutoScalingReport)||void 0===r?void 0:r.percentage};const l=(t,i)=>void 0===i||Math.abs(t-i)>.001*Math.abs(t),c=this.getEffectiveFontPx();if(void 0!==i.unit&&i.unit>0&&this.autoUnitWarningActive){const e=c/i.unit;l(e,this.lastReportedUnitsPerEm)&&(this.lastReportedUnitsPerEm=e,this.errors.addOrReplace({id:"AUTO_unitScaling",type:"warning",message:`unit-scaling: ${t.describeScalingInput(((null!==(n=this.unitScaling)&&void 0!==n?n:"")+"").trim())}, auto-fitted to 1 em ≈ ${C(e)} units.`}))}if(void 0!==i.percentage&&i.percentage>0&&this.autoPctWarningActive){const e=100*c/i.percentage;l(e,this.lastReportedPpPerEm)&&(this.lastReportedPpPerEm=e,this.errors.addOrReplace({id:"AUTO_percentageScaling",type:"warning",message:`percentage-scaling: ${t.describeScalingInput(((null!==(o=this.percentageScaling)&&void 0!==o?o:"")+"").trim())}, auto-fitted to 1 em ≈ ${C(e)} percentage points.`}))}},_(this),S(this),b(this,(t=>{this.datasetName=(null==t?void 0:t.startsWith("$"))?t.substring(1):t||"",this.dataVersion=this.dataVersion+1}),((t,i)=>{this.datasetMeta=i})),this.chartTemplate=this.chartTemplate.bind(this),this.errors=T(this),k(this),this.componentStyle=R(this),this.ruleSetConfig=A(this),this.t=O(this).t,this.resolveInherited=x(this,[{propName:"scenarios",ancestorAttr:"title-scenarios"},{propName:"variances",ancestorAttr:"title-variances"},{propName:"order",ancestorAttr:"title-order"},{propName:"orderDirection",ancestorAttr:"title-order-direction"}],this.errors)}componentWillLoad(){this.validateFilter(this.filter),this.validateScenario(this.scenarios),this.validateVariances(this.variances),this.validateUnitScaling(this.unitScaling),this.validateLevel(this.level),this.validateOrderDirection(this.orderDirection),this.validateOrderList(this.order),this.validateShowCategories(this.showCategories),this.validateMeasureScale(this.measureScale),this.validateShowMeasureScale(this.showMeasureScale),this.validateStack(this.stack),this.validateScaling(this.scale)}componentDidRender(){J(this.element,"ibcs-chart-structure");const{mode:t}=N(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 i=this.element,{height:s}=M(i);if(s<=0)return void this.checkOverflow();this._lastScaledParentHeight=s;const a=this.componentStyle((t=>{var i;return(null===(i=t.global)||void 0===i?void 0:i.fontSizePx)||13.3333})),r=i.scrollHeight,n=this.appliedScaleFactor;if(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||(i.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,e((()=>{this.appliedScaleFactor=o}))),this.checkOverflow()}componentDidLoad(){this.layoutObserver=U(this.element,(()=>{if(this._autoScaleGuard)return;const{height:t}=M(this.element);t>0&&Math.abs(t-this._lastScaledParentHeight)>2&&(this._lastScaledParentHeight=t,s(this))})),requestAnimationFrame((()=>{requestAnimationFrame((()=>{if(this._autoScaleGuard)return;const{height:t}=M(this.element);this._lastScaledParentHeight=t,s(this)}))}))}disconnectedCallback(){var t;null===(t=this.layoutObserver)||void 0===t||t.disconnect(),this.layoutObserver=null}measureContentWidth(){var t;const i=null===(t=this.element.shadowRoot)||void 0===t?void 0:t.querySelectorAll("ibcs-chart-structure");let e=0,s=!1;return null==i||i.forEach((t=>{var i,a,r;const n=parseFloat(null!==(r=null===(a=null===(i=t.shadowRoot)||void 0===i?void 0:i.querySelector("svg#drawCanvas"))||void 0===a?void 0:a.getAttribute("width"))&&void 0!==r?r:"");Number.isNaN(n)||(e+=n,s=!0)})),s?Math.max(Math.floor(e),this.element.scrollWidth):this.element.scrollWidth}checkOverflow(){const t="WARN_overflow",i=M(this.element),e=this.measureContentWidth(),s=this.element.scrollHeight,a=i.width>0&&e>i.width+1,r=i.height>0&&s>i.height+1;if(!a&&!r)return void this.errors.remove(t);const n=this.prepareVariances().some((t=>t.startsWith("dr"))),o="value"===E(this.unitScaling,this.pixelPerUnitGroupMap).kind,l=n&&"value"===E(this.percentageScaling,this.pixelPerUnitGroupMap).kind,{mode:c}=N(this.scale),h="auto"!==c&&"empty"!==c,d=[];a&&o&&d.push("unit-scaling"),a&&l&&d.push("percentage-scaling"),r&&h&&d.push("scale");const u=[];a&&u.push(`width (${Math.round(e)}px > ${Math.round(i.width)}px)`),r&&u.push(`height (${Math.round(s)}px > ${Math.round(i.height)}px)`),this.errors.addOrReplace({id:t,type:d.length>0?"error":"warning",message:`Chart exceeds available ${u.join(" and ")}. `+(d.length>0?`Adjust ${d.join(" / ")} or set to "auto".`:"Content does not fit even at minimum auto scaling; enlarge the container.")})}prepareDimension(){const t=M(this.element),i=this.prepareVariances();return this.canvasWidthSegmented=t.width/(1+i.length),{width:this.canvasWidthSegmented,height:t.height}}prepareScenarios(){var t,i,e,s;const a=this.resolveInherited("scenarios",this.scenarios);if(a.inherited)return this.errors.remove("AUTO_scenarios"),a.value.split(",").map((t=>t.trim()));const r="auto"===(null===(t=a.value)||void 0===t?void 0:t.trim().toLowerCase());return d(a.value)||r?(null===(e=null===(i=this.datasetMeta)||void 0===i?void 0:i.availableScenarios)||void 0===e?void 0:e.length)>0?(r||a.unresolved?this.errors.remove("AUTO_scenarios"):this.errors.addOrReplace({id:"AUTO_scenarios",type:"warning",message:"scenarios: not set, auto-detected: "+this.datasetMeta.availableScenarios.join(",")}),this.datasetMeta.availableScenarios):[]:(this.errors.remove("AUTO_scenarios"),null===(s=a.value)||void 0===s?void 0:s.split(",").map((t=>t.trim())))}prepareVariances(){const t=this.resolveInherited("variances",this.variances).value;return d(t)?[]:null==t?void 0:t.split(",").map((t=>t.trim()))}prepareHideCategories(t){return t>=1||"true"!==this.showCategories}prepareI18n(){const t=l,i=new Map(["no-data","REST"].map((t=>[t,this.t(".".concat(t))]))),e=new Map(t.map((t=>[t,this.t("global.".concat(t))])));return new Map([...e.entries(),...i.entries()])}static describeScalingInput(t){return""===t?"not set":`invalid value "${t}"`}preparePixelPerUnit(){const i=E(this.unitScaling,this.pixelPerUnitGroupMap);return"value"===i.kind?(this.errors.remove("AUTO_unitScaling"),this.autoUnitWarningActive=!1,this.lastReportedUnitsPerEm=void 0,this.getEffectiveFontPx()/i.value):"auto"===i.kind?(this.errors.remove("AUTO_unitScaling"),this.autoUnitWarningActive=!1,this.lastReportedUnitsPerEm=void 0,0):(this.autoUnitWarningActive=!0,this.errors.addOrReplace({id:"AUTO_unitScaling",type:"warning",message:`unit-scaling: ${t.describeScalingInput(i.raw)}, auto-calculated to fit available space.`}),0)}preparePixelPerPercentage(){const i=E(this.percentageScaling,this.pixelPerUnitGroupMap);return"value"===i.kind?(this.errors.remove("AUTO_percentageScaling"),this.autoPctWarningActive=!1,this.lastReportedPpPerEm=void 0,100*this.getEffectiveFontPx()/i.value):"auto"===i.kind?(this.errors.remove("AUTO_percentageScaling"),this.autoPctWarningActive=!1,this.lastReportedPpPerEm=void 0,0):(this.autoPctWarningActive=!0,this.errors.addOrReplace({id:"AUTO_percentageScaling",type:"warning",message:`percentage-scaling: ${t.describeScalingInput(i.raw)}, auto-calculated to fit available space.`}),0)}prepareLevel(){var t,i,e;const s="auto"===(null===(t=this.level)||void 0===t?void 0:t.trim().toLowerCase());return d(this.level)||s?(null===(i=this.datasetMeta)||void 0===i?void 0:i.suggestedLevel)?(s?this.errors.remove("AUTO_level"):this.errors.addOrReplace({id:"AUTO_level",type:"warning",message:"level: not set, auto-detected: "+this.datasetMeta.suggestedLevel}),j[this.datasetMeta.suggestedLevel.toUpperCase()]):void 0:(this.errors.remove("AUTO_level"),j[null===(e=this.level)||void 0===e?void 0:e.toUpperCase()])}prepareOrder(){var t;const i=this.resolveInherited("order",this.order),e=i.value,s=this.resolveInherited("orderDirection",this.orderDirection).value,a="auto"===(null==e?void 0:e.trim().toLowerCase());let r;return d(e)||a?(null===(t=this.datasetMeta)||void 0===t?void 0:t.suggestedOrder)?(a||i.unresolved?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):r=e:(this.errors.remove("AUTO_order"),r=e),{hierarchy:null==r?void 0:r.split(",").map((t=>P[null==t?void 0:t.toUpperCase()])),direction:z[null==s?void 0:s.toUpperCase()]}}prepareStyle(){const t=this.getEffectiveScaleFactor();return this.componentStyle((i=>{const e=i.global.fontSizePx*t;return{scaleFactors:{scenarioOffset:i["bn-chart-structure"].scaleFactors.scenarioOffset,scenarioLabelToBar:i["bn-chart-structure"].scaleFactors.scenarioLabelToBar,labelToBar:i["bn-chart-structure"].scaleFactors.labelToBar,labelToAxis:i["bn-chart-structure"].scaleFactors.labelToAxis,needleWidth:i["bn-chart-structure"].scaleFactors.needleWidth,needleHeadWidth:i["bn-chart-structure"].scaleFactors.needleHeadWidth,barWidth:i["bn-chart-structure"].scaleFactors.barWidth,varianceAxisLineWidth:i["bn-chart-structure"].scaleFactors.varianceAxisLineWidth,axisLineWidth:i["bn-chart-structure"].scaleFactors.axisLineWidth,auxiliaryLineWidth:i["bn-chart-structure"].scaleFactors.auxiliaryLineWidth,scenarioLineWidth:i["bn-chart-structure"].scaleFactors.scenarioLineWidth,markerWidth:i["bn-chart-structure"].scaleFactors.markerWidth,markerOffset:i["bn-chart-structure"].scaleFactors.markerOffset,categoryWidth:i["bn-chart-structure"].scaleFactors.categoryWidth,axisTickLength:i["bn-chart-structure"].scaleFactors.axisTickLength},fontStyles:{font:`${e}px ${i.global.fontFamily}`,family:i.global.fontFamily,size:e,color:i.global.fontColor,background:i.global.fontBackgroundColor,leading:1.8},axisStyles:i["bn-chart-structure"].axisStyles,barStyles:i["bn-chart-structure"].barStyles,varianceStyles:i["bn-chart-structure"].varianceStyles,stackColors:i["bn-chart-structure"].stackColors,padding:i["bn-chart-structure"].padding,pattern:null}}))}prepareChartTitle(t){return t>=1?"":this.chartTitle}prepareStackConfig(){if(d(this.stack))return this.errors.remove("WARN_stack_dimensions_scenarios"),null;try{const t=JSON.parse(this.stack),i=t.by,e="WARN_stack_dimensions_scenarios";if(i===L.DIMENSIONS){const t=this.prepareScenarios();t.length>1?this.errors.addOrReplace({id:e,type:"warning",message:`stack by dimensions: only the first scenario "${t[0]}" is used, the rest (${t.slice(1).join(", ")}) are discarded.`}):this.errors.remove(e)}else this.errors.remove(e);return{by:i,mode:t.mode||$.ABSOLUTE,order:t.order||D.DATASET}}catch(t){return this.errors.remove("WARN_stack_dimensions_scenarios"),null}}prepareFilter(){return 0===this.filter.length?"":this.filter}prepareLimit(){return Math.floor(Number(this.limit)||0)}getDataStructure(){return{IStructureChartDataRow:{operation:{type:"string",isOptional:!1,description:""},rowGroup:{type:"string",isOptional:!1,description:""},rowGroupIndex:{type:"number",isOptional:!1,description:""},category:{type:"string",isOptional:!1,description:""},categoryIndex:{type:"number",isOptional:!1,description:""},subCategory:{type:"string",isOptional:!1,description:""},subCategoryIndex:{type:"number",isOptional:!1,description:""},columnGroup:{type:"string",isOptional:!1,description:""},columnGroupIndex:{type:"number",isOptional:!1,description:""},columnSubGroup:{type:"string",isOptional:!1,description:""},columnSubGroupIndex:{type:"number",isOptional:!1,description:""},ac1:{type:"number",isOptional:!1,description:""},ac2:{type:"number",isOptional:!1,description:""},ac3:{type:"number",isOptional:!1,description:""},ac4:{type:"number",isOptional:!1,description:""},pp1:{type:"number",isOptional:!1,description:""},pp2:{type:"number",isOptional:!1,description:""},pp3:{type:"number",isOptional:!1,description:""},pp4:{type:"number",isOptional:!1,description:""},fc1:{type:"number",isOptional:!1,description:""},fc2:{type:"number",isOptional:!1,description:""},fc3:{type:"number",isOptional:!1,description:""},fc4:{type:"number",isOptional:!1,description:""},pl1:{type:"number",isOptional:!1,description:""},pl2:{type:"number",isOptional:!1,description:""},pl3:{type:"number",isOptional:!1,description:""},pl4:{type:"number",isOptional:!1,description:""}}}}prepareMeasureScale(){return d(this.measureScale)?"GREATEST":["_","k","M","G","T","P","E","Z","Y","m","μ","n","p","P","f","a","z","y"].includes(this.measureScale.trim())||"LEAST"===this.measureScale.trim().toUpperCase()?this.measureScale.trim():"GREATEST"}prepareShowMeasureScale(t){return 0===t&&"true"===this.showMeasureScale}prepareMeasureUnit(){return""===this.measureUnit||null==this.measureUnit?"":this.measureUnit}chartTemplate(t,i){const e=this.preparePixelPerUnit(),s=this.preparePixelPerPercentage(),r=this.prepareStackConfig(),n=this.prepareScenarios(),o=(null==r?void 0:r.by)===L.DIMENSIONS?n.slice(0,1):n;return a("ibcs-chart-structure",{tableName:this.datasetName,dataVersion:this.dataVersion,chartTitle:this.prepareChartTitle(i),scenarios:o,variances:[t],hideCategories:this.prepareHideCategories(i),pixelPerUnit:e,pixelPerPercentage:s,reportAutoScaling:this.handleAutoScalingReport,errors:this.errors,limit:this.prepareLimit(),styles:this.prepareStyle(),i18n:this.prepareI18n(),order:this.prepareOrder(),level:this.prepareLevel(),filter:this.prepareFilter(),"measure-scale":this.prepareMeasureScale(),"measure-unit":this.prepareMeasureUnit(),showMeasureScale:this.prepareShowMeasureScale(i),stackConfig:r,parentDimensions:this.prepareDimension(),ruleSetConfig:this.ruleSetConfig()})}async getLayoutState(t){var i,e,s,a;const r=null!==(i=null==t?void 0:t.detail)&&void 0!==i?i:"summary",n=F(this.element),o=this.getEffectiveScaleFactor(),l=Number.isFinite(o)&&o>0?o:1,c=this.componentStyle((t=>{var i;return(null===(i=t.global)||void 0===i?void 0:i.fontSizePx)||13.3333}))*l,h=this.prepareVariances(),d=V(this.element,"ibcs-chart-structure",["base",...h],n,r),u=null===(e=this.element.shadowRoot)||void 0===e?void 0:e.querySelector("ibcs-chart-structure"),p={version:W,tag:this.element.localName,id:H(this.element),slot:null!==(s=this.element.getAttribute("slot"))&&void 0!==s?s:void 0,rect:G(this.element,n),em:{fontSizePx:c,appliedScaleFactor:l},regions:d.regions,metadata:{title:this.chartTitle||void 0,scenarios:null!==(a=null==u?void 0:u.scenarios)&&void 0!==a?a:[],variances:h,barCount:d.barCount,hasNoData:0===d.barCount},diagnostics:I(this.element),scaling:this.resolveScalingInfo(c)};return d.elements&&(p.elements=d.elements),p}resolveScalingInfo(t){var i,e;const s={},a=E(this.unitScaling,this.pixelPerUnitGroupMap);if("value"===a.kind)s.unitMode="fixed",s.unitsPerEm=a.value,s.unitPxPerUnit=t/a.value;else{s.unitMode="auto";const e=null===(i=this.lastAutoScalingReport)||void 0===i?void 0:i.unit;void 0!==e&&e>0&&(s.unitPxPerUnit=e,s.unitsPerEm=t/e)}const r=E(this.percentageScaling,this.pixelPerUnitGroupMap);if("value"===r.kind)s.percentageMode="fixed",s.percentagePointsPerEm=r.value,s.percentagePxPerPoint=t/r.value;else{s.percentageMode="auto";const i=null===(e=this.lastAutoScalingReport)||void 0===e?void 0:e.percentage;void 0!==i&&i>0&&(s.percentagePxPerPoint=i/100,s.percentagePointsPerEm=100*t/i)}return s}getEffectiveScaleFactor(){const{mode:t,factor:i}=N(this.scale);return"factor"===t?i:"auto"===t||"empty"===t?this.appliedScaleFactor:1}getEffectiveFontPx(){return this.componentStyle((t=>{var i;return(null===(i=t.global)||void 0===i?void 0:i.fontSizePx)||13.3333}))*this.getEffectiveScaleFactor()}getFontStyles(){const t=this.getEffectiveScaleFactor();return this.componentStyle((i=>{var e,s,a,r;const n=(null===(e=i.global)||void 0===e?void 0:e.fontSizePx)||13.3333;return{"--bn-font-family":(null===(s=i.global)||void 0===s?void 0:s.fontFamily)||"'Noto Sans', sans-serif","--bn-font-size":n*t+"px","--bn-font-color":(null===(a=i.global)||void 0===a?void 0:a.fontColor)||"#000000","--bn-font-background":(null===(r=i.global)||void 0===r?void 0:r.fontBackgroundColor)||"#ffffff"}}))}render(){let t=[""];const i=this.prepareVariances();i.length>0&&(t=[...t,...i]);const e=this.getFontStyles();return a(r,{key:"c87917d6897bc4dfb21bc5ba1760df91038cf554",style:e},a("div",{key:"38c2b4a8b0d0c9fd6f13010782c2ae5faa1b218b",class:"container"},t.map(this.chartTemplate)))}get element(){return this}static get watchers(){return{filter:[{validateFilter:0}],scenarios:[{validateScenario:0}],variances:[{validateVariances:0}],unitScaling:[{validateUnitScaling:0}],percentageScaling:[{validatePercentageScaling:0}],level:[{validateLevel:0}],order:[{validateOrderList:0}],orderDirection:[{validateOrderDirection:0}],limit:[{validateLimit:0}],showCategories:[{validateShowCategories:0}],measureScale:[{validateMeasureScale:0}],showMeasureScale:[{validateShowMeasureScale:0}],stack:[{validateStack:0}],scale:[{validateScaling: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:row}.background-image{display:flex;flex-wrap:wrap;justify-content:flex-end}.categories{text-align:right;font-size:var(--bn-font-size, 1em);font-family:var(--bn-font-family, "Noto Sans", "Helvetica Neue", Helvetica, sans-serif);color:var(--bn-font-color, black)}.label-bg{fill:var(--bn-font-background, white);opacity:0.7}.label-text{text-align:right;font-size:var(--bn-font-size, 1em);font-family:var(--bn-font-family, "Noto Sans", "Helvetica Neue", Helvetica, sans-serif);color:var(--bn-font-color, black)}.axis-title{text-align:center;font-family:var(--bn-font-family, "Noto Sans", "Helvetica Neue", Helvetica, sans-serif);color:var(--bn-font-color, black)}.axis-ac{stroke:black;stroke-width:0.1em}.axis-pp{stroke:grey;stroke-width:0.1em}.axis-fc{stroke:black;stroke-dasharray:2;stroke-width:0.1em}.axis-pl{stroke:white;stroke-width:0.1em;outline-offset:0em;outline:0.1em solid black}canvas{image-rendering:-moz-crisp-edges;image-rendering:-webkit-crisp-edges;image-rendering:pixelated;image-rendering:crisp-edges}.measure{font-weight:bold}span{display:inline-block}.hidePatternContainer{height:0;width:0}div{float:left}svg#drawCanvas{display:block}.footer{margin:0.2em;font-size:0.6em}.footer-hide{margin:0.2em;font-size:0.6em;opacity:0}'}},[1,"bn-chart-structure",{chartTitle:[1,"chart-title"],ruleset:[513],filter:[1],scenarios:[1],variances:[1],unitScaling:[8,"unit-scaling"],percentageScaling:[8,"percentage-scaling"],level:[1],order:[1],orderDirection:[1,"order-direction"],limit:[2],showCategories:[1,"show-categories"],measureScale:[1,"measure-scale"],showMeasureScale:[1,"show-measure-scale"],measureUnit:[1,"measure-unit"],stack:[1],scale:[1],datasetName:[32],dataVersion:[32],datasetMeta:[32],appliedScaleFactor:[32],getLayoutState:[64]},void 0,{filter:[{validateFilter:0}],scenarios:[{validateScenario:0}],variances:[{validateVariances:0}],unitScaling:[{validateUnitScaling:0}],percentageScaling:[{validatePercentageScaling:0}],level:[{validateLevel:0}],order:[{validateOrderList:0}],orderDirection:[{validateOrderDirection:0}],limit:[{validateLimit:0}],showCategories:[{validateShowCategories:0}],measureScale:[{validateMeasureScale:0}],showMeasureScale:[{validateShowMeasureScale:0}],stack:[{validateStack:0}],scale:[{validateScaling:0}]}]),Y=B,Z=function(){"undefined"!=typeof customElements&&["bn-chart-structure","ibcs-chart-structure"].forEach((t=>{switch(t){case"bn-chart-structure":customElements.get(n(t))||customElements.define(n(t),B);break;case"ibcs-chart-structure":customElements.get(n(t))||q()}}))};export{Y as BnChartStructure,Z as defineCustomElement}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{proxyCustomElement as t,HTMLElement as i,writeTask as e,forceUpdate as s,h as a,Host as n,transformTag as r}from"@stencil/core/internal/client";import{v as o,a as l,o as h,h as d,k as c,b as u,c as v,f as p,n as m,p as g,l as y,m as f,i as S}from"./validate.js";import{w,g as b}from"./withDataset.js";import{w as O,a as M}from"./withHasError.js";import{i as x,w as _,a as A}from"./withTranslation.js";import{w as R}from"./withScalingGroup.js";import{a as L}from"./context-protocol.js";import{w as T}from"./withStyled.js";import{w as E}from"./withComponentStyle.js";import{w as C}from"./withRuleSet.js";import{r as U,f as I,p as k}from"./scaling.js";import{o as N}from"./layoutObserver.js";import{O as W,a as F}from"./Order.js";import{F as D}from"./formatter.js";import{b as j,e as $,f as P,g as G,h as B}from"./CompareUtil.js";import{a as z}from"./DateStringFactory.js";import{L as V}from"./types.js";import{o as H,m as J}from"./geometry.js";import{r as q,a as Y}from"./diagnostics.js";import{a as Z}from"./svgChartElements.js";import{d as K}from"./ibcs-chart-time2.js";var Q;!function(t){t.ROWGROUP="rowGroup",t.ROWGROUPINDEX="rowGroupIndex",t.CATEGORY="category",t.CATEGORYINDEX="categoryIndex",t.SUBCATEGORY="subCategory",t.SUBCATEGORYINDEX="subCategoryIndex"}(Q||(Q={}));const X=t(class t extends i{validateScenario(t){const i="ERR_scenarios";if(x(t))return void this.errors.remove(i);const e=o(t);e.length>0?this.errors.addOrReplace({id:i,type:"warning",message:"scenarios: invalid value(s) '"+JSON.stringify(e)+"' are not supported."}):this.errors.remove(i)}validateVariances(t){const i="ERR_variances";if(x(t))return void this.errors.remove(i);const e=l(t);e.length>0?this.errors.addOrReplace({id:i,type:"warning",message:"variances: invalid value(s) '"+JSON.stringify(e)+"' are not supported."}):this.errors.remove(i)}validateLeftSync(t){const i="ERR_syncSpaceLeft";h(t)?this.errors.remove(i):this.errors.addOrReplace({id:i,type:"warning",message:"syncSpaceLeft: invalid value(s) '"+t+"' are not supported."})}validateLimit(t){const i="ERR_limit";d(t)?this.errors.remove(i):this.errors.addOrReplace({id:i,type:"warning",message:"limit: invalid value '"+(null==t?void 0:""+t)+"' is not supported."})}validateUnitScaling(t){const i="ERR_unitScaling";"invalid"===U(t,this.pixelPerUnitGroupMap).kind?this.errors.addOrReplace({id:i,type:"warning",message:"unitScaling: invalid value(s) '"+t+"' are not supported."}):this.errors.remove(i)}validatePercentageScaling(t){const i="ERR_percentageScaling";"invalid"===U(t,this.pixelPerUnitGroupMap).kind?this.errors.addOrReplace({id:i,type:"warning",message:"percentageScaling: invalid value(s) '"+t+"' are not supported."}):this.errors.remove(i)}validateLevel(t){const i="ERR_level";c(t)?this.errors.remove(i):this.errors.addOrReplace({id:i,type:"warning",message:"level: invalid value(s) '"+t+"' are not supported."})}validateOrderList(t){const i="ERR_order";if(x(t))return void this.errors.remove(i);const e=u(t);e.length>0?this.errors.addOrReplace({id:i,type:"warning",message:"order: invalid value(s) '"+JSON.stringify(e)+"' are not supported."}):this.errors.remove(i)}validateOrderDirection(t){const i="ERR_orderDirection";x(t)||v(t)?this.errors.remove(i):this.errors.addOrReplace({id:i,type:"warning",message:"orderDirection: invalid value '"+(null==t?void 0:""+t)+"' is not supported."})}validateDateInterval(t){const i="ERR_dateInterval";p(t)?this.errors.remove(i):this.errors.addOrReplace({id:i,type:"warning",message:"dateInterval: invalid value '"+(null==t?void 0:""+t)+"' is not supported."})}validateChartMode(t){const i="ERR_chartMode";["bar","line","auto"].includes(null==t?void 0:t.toLowerCase())?this.errors.remove(i):this.errors.addOrReplace({id:i,type:"warning",message:"chartMode: invalid value '"+(null==t?void 0:""+t)+"' is not supported. Valid values are: bar, line, auto."})}validateMaxBars(t){const i="ERR_maxBars";!d(t)||t<1?this.errors.addOrReplace({id:i,type:"warning",message:"maxBars: invalid value '"+(null==t?void 0:""+t)+"' is not supported. Must be a positive integer."}):this.errors.remove(i)}validateStack(t){const i="ERR_stack",e=m(t);e.length>0?this.errors.addOrReplace({id:i,type:"warning",message:e.join("; ")}):this.errors.remove(i)}validateScaling(t){if(null==t||""===t||"none"===t||"auto"===t)return void this.errors.remove("ERR_scale");const i=Number(t);isNaN(i)||i<=0?this.errors.addOrReplace({id:"ERR_scale",type:"warning",message:`Invalid scale value: "${t}". Use "none", "auto", or a positive number.`}):this.errors.remove("ERR_scale")}validateAxisLabelsMode(t){const i="ERR_axisLabelsMode";g(t)?this.errors.remove(i):this.errors.addOrReplace({id:i,type:"warning",message:"axisLabelsMode: invalid value '"+(null==t?void 0:""+t)+"' is not supported."})}validateLineFullWidth(t){const i="ERR_lineFullWidth";y(t)?this.errors.remove(i):this.errors.addOrReplace({id:i,type:"warning",message:"lineFullWidth: invalid value(s) '"+(null==t?void 0:""+t)+"' are not supported."})}validateShowCategories(t){const i="ERR_showCategories";y(t)?this.errors.remove(i):this.errors.addOrReplace({id:i,type:"warning",message:"showCategories: invalid value(s) '"+(null==t?void 0:""+t)+"' are not supported."})}validateMeasureScale(t){const i="ERR_measureScale";f(t)?this.errors.remove(i):this.errors.addOrReplace({id:i,type:"warning",message:"measureScale: invalid value '"+(null==t?void 0:""+t)+"' is not supported."})}validateShowMeasureScale(t){const i="ERR_grouped";y(t)?this.errors.remove(i):this.errors.addOrReplace({id:i,type:"warning",message:"showMeasureScale: invalid value(s) '"+(null==t?void 0:""+t)+"' are not supported."})}validateShowOverlayAvg(t){const i="ERR_grouped";y(t)?this.errors.remove(i):this.errors.addOrReplace({id:i,type:"warning",message:"showOverlayAvg: invalid value(s) '"+(null==t?void 0:""+t)+"' are not supported."})}validateShowOverlayMedian(t){const i="ERR_grouped";y(t)?this.errors.remove(i):this.errors.addOrReplace({id:i,type:"warning",message:"showOverlayMedian: invalid value(s) '"+(null==t?void 0:""+t)+"' are not supported."})}constructor(i){super(),!1!==i&&this.__registerHost(),this.__attachShadow(),this.datasetName="",this.dataVersion=0,this.datasetMeta=null,this.appliedScaleFactor=1,this.layoutObserver=null,this.chartTitle="",this.filter="",this.syncSpaceLeft=-1,this.limit=0,this.chartMode="bar",this.maxBars=28,this.stack="",this.intervalSpanLimit=28,this.lineFullWidth="true",this.showCategories="true",this.measureScale="greatest",this.showMeasureScale="false",this.showOverlayAvg="true",this.showOverlayMedian="false",this.measureUnit="",this.pixelPerUnitGroupMap=new Map,this._autoScaleGuard=!1,this._lastObservedWidth=0,this._settleTimer=null,this._lastAppliedHeight=0,this.autoUnitWarningActive=!1,this.autoPctWarningActive=!1,this.handleAutoScalingReport=i=>{var e,s,a,n,r,o;this.lastAutoScalingReport={unit:null!==(e=i.unit)&&void 0!==e?e:null===(s=this.lastAutoScalingReport)||void 0===s?void 0:s.unit,percentage:null!==(a=i.percentage)&&void 0!==a?a:null===(n=this.lastAutoScalingReport)||void 0===n?void 0:n.percentage};const l=(t,i)=>void 0===i||Math.abs(t-i)>.001*Math.abs(t),h=this.getEffectiveFontPx();if(void 0!==i.unit&&i.unit>0&&this.autoUnitWarningActive){const e=h/i.unit;l(e,this.lastReportedUnitsPerEm)&&(this.lastReportedUnitsPerEm=e,this.errors.addOrReplace({id:"AUTO_unitScaling",type:"warning",message:`unit-scaling: ${t.describeScalingInput(((null!==(r=this.unitScaling)&&void 0!==r?r:"")+"").trim())}, auto-fitted to 1 em ≈ ${I(e)} units.`}))}if(void 0!==i.percentage&&i.percentage>0&&this.autoPctWarningActive){const e=100*h/i.percentage;l(e,this.lastReportedPpPerEm)&&(this.lastReportedPpPerEm=e,this.errors.addOrReplace({id:"AUTO_percentageScaling",type:"warning",message:`percentage-scaling: ${t.describeScalingInput(((null!==(o=this.percentageScaling)&&void 0!==o?o:"")+"").trim())}, auto-fitted to 1 em ≈ ${I(e)} percentage points.`}))}},T(this),O(this),w(this,(t=>{this.datasetName=(null==t?void 0:t.startsWith("$"))?t.substring(1):t||"",this.dataVersion=this.dataVersion+1}),((t,i)=>{this.datasetMeta=i})),this.chartTemplate=this.chartTemplate.bind(this),this.errors=M(this),R(this),this.componentStyle=E(this),this.ruleSetConfig=C(this),this.t=_(this).t,this.resolveInherited=A(this,[{propName:"scenarios",ancestorAttr:"title-scenarios"},{propName:"variances",ancestorAttr:"title-variances"},{propName:"order",ancestorAttr:"title-order"},{propName:"orderDirection",ancestorAttr:"title-order-direction"}])}componentWillLoad(){this.validateScenario(this.scenarios),this.validateVariances(this.variances),this.validateUnitScaling(this.unitScaling),this.validateLimit(this.limit),this.validateLevel(this.level),this.validateOrderDirection(this.orderDirection),this.validateOrderList(this.order),this.validateLeftSync(this.syncSpaceLeft),this.validateDateInterval(this.dateInterval),this.validateAxisLabelsMode(this.axisLabelsMode),this.validateLineFullWidth(this.lineFullWidth),this.validateShowCategories(this.showCategories),this.validateMeasureScale(this.measureScale),this.validateShowMeasureScale(this.showMeasureScale),this.validateShowOverlayAvg(this.showOverlayAvg),this.validateShowOverlayMedian(this.showOverlayMedian),this.validateChartMode(this.chartMode),this.validateMaxBars(this.maxBars),this.validateStack(this.stack),this.validateScaling(this.scale)}measureContentWidth(){var t;const i=null===(t=this.element.shadowRoot)||void 0===t?void 0:t.querySelectorAll("ibcs-chart-time");let e=0,s=!1;return null==i||i.forEach((t=>{var i,a,n;const r=parseFloat(null!==(n=null===(a=null===(i=t.shadowRoot)||void 0===i?void 0:i.querySelector("svg#drawCanvas"))||void 0===a?void 0:a.getAttribute("width"))&&void 0!==n?n:"");Number.isNaN(r)||(e=Math.max(e,r),s=!0)})),s?Math.max(Math.floor(e),this.element.scrollWidth):this.element.scrollWidth}measureContentHeight(){var t;const i=null===(t=this.element.shadowRoot)||void 0===t?void 0:t.querySelectorAll("ibcs-chart-time");let e=0,s=!1;return null==i||i.forEach((t=>{var i,a,n;const r=parseFloat(null!==(n=null===(a=null===(i=t.shadowRoot)||void 0===i?void 0:i.querySelector("svg#drawCanvas"))||void 0===a?void 0:a.getAttribute("height"))&&void 0!==n?n:"");Number.isNaN(r)||(e+=r,s=!0)})),s?Math.max(Math.floor(e),this.element.scrollHeight):this.element.scrollHeight}checkOverflow(){const t="WARN_overflow",i=b(this.element),e=this.measureContentWidth(),s=this.measureContentHeight(),a=i.width>0&&e>i.width+1,n=i.height>0&&s>i.height+1;if(!a&&!n)return void this.errors.remove(t);const r=this.prepareVariances().some((t=>t.startsWith("dr"))),o="value"===U(this.unitScaling,this.pixelPerUnitGroupMap).kind,l=r&&"value"===U(this.percentageScaling,this.pixelPerUnitGroupMap).kind,{mode:h}=k(this.scale),d="auto"!==h&&"empty"!==h,c=[];n&&o&&c.push("unit-scaling"),n&&l&&c.push("percentage-scaling"),a&&d&&c.push("scale");const u=[];a&&u.push(`width (${Math.round(e)}px > ${Math.round(i.width)}px)`),n&&u.push(`height (${Math.round(s)}px > ${Math.round(i.height)}px)`),this.errors.addOrReplace({id:t,type:c.length>0?"error":"warning",message:`Chart exceeds available ${u.join(" and ")}. `+(c.length>0?`Adjust ${c.join(" / ")} or set to "auto".`:"Content does not fit even at minimum auto scaling; enlarge the container.")})}componentDidRender(){const{mode:t}=k(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 i=this.element,{width:s}=b(i);if(s<=0)return void this.checkOverflow();this._lastObservedWidth=s;const a=this.componentStyle((t=>{var i;return(null===(i=t.global)||void 0===i?void 0:i.fontSizePx)||13.3333})),n=i.scrollWidth,r=this.appliedScaleFactor;if(n<=s+1)return this.errors.remove("AUTO_scale"),void this.checkOverflow();const o=Math.max(.3,r*(s-1)/n);Math.abs(o-r)<.01||(i.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,e((()=>{this.appliedScaleFactor=o}))),this.checkOverflow()}componentDidLoad(){this.layoutObserver=N(this.element,(()=>{if(this._autoScaleGuard)return;const{width:t}=b(this.element);t>0&&Math.abs(t-this._lastObservedWidth)>2&&(this._lastObservedWidth=t,s(this))})),requestAnimationFrame((()=>{requestAnimationFrame((()=>{if(this._autoScaleGuard)return;const{width:t}=b(this.element);this._lastObservedWidth=t,s(this)}))})),this.settleParentHeight()}settleParentHeight(){const t=[150,400,1e3,2500],i=()=>{if(this._settleTimer=null,!this.element.isConnected)return;const{height:e}=b(this.element);e>0&&Math.abs(e-this._lastAppliedHeight)>8&&!this._autoScaleGuard&&s(this);const a=t.shift();void 0!==a&&(this._settleTimer=setTimeout(i,a))};this._settleTimer=setTimeout(i,t.shift())}disconnectedCallback(){var t;null===(t=this.layoutObserver)||void 0===t||t.disconnect(),this.layoutObserver=null,null!=this._settleTimer&&(clearTimeout(this._settleTimer),this._settleTimer=null)}prepareDimension(){const t=b(this.element),i=this.prepareScenarios(),e=this.prepareVariances();this.canvasWidthSegmented=t.width/(i.length+e.length||1),this._lastAppliedHeight=t.height;const s=1+e.length,a="true"===this.showMeasureScale?this.getEffectiveFontPx():0;return{width:this.canvasWidthSegmented,height:Math.max(0,t.height-a)/s}}prepareScenarios(){var t,i,e,s;const a=this.resolveInherited("scenarios",this.scenarios);if(void 0!==a)return this.errors.remove("AUTO_scenarios"),a.split(",").map((t=>t.trim()));const n="auto"===(null===(t=this.scenarios)||void 0===t?void 0:t.trim().toLowerCase());return S(this.scenarios)||n?(null===(e=null===(i=this.datasetMeta)||void 0===i?void 0:i.availableScenarios)||void 0===e?void 0:e.length)>0?(n?this.errors.remove("AUTO_scenarios"):this.errors.addOrReplace({id:"AUTO_scenarios",type:"warning",message:"scenarios: not set, auto-detected: "+this.datasetMeta.availableScenarios.join(",")}),this.datasetMeta.availableScenarios):[]:(this.errors.remove("AUTO_scenarios"),null===(s=this.scenarios)||void 0===s?void 0:s.split(",").map((t=>t.trim())))}prepareAvg(){return"true"===this.showOverlayAvg}prepareMedian(){return"true"===this.showOverlayMedian}prepareVariances(){var t;const i=this.resolveInherited("variances",this.variances);return void 0!==i?i.split(",").map((t=>t.trim())):S(this.variances)?[]:null===(t=this.variances)||void 0===t?void 0:t.split(",").map((t=>t.trim()))}prepareHideAxisLabels(t){return t>=1||"true"!==this.showCategories}prepareI18n(){const t=L,i=new Map(["no-data"].map((t=>[t,this.t(".".concat(t))]))),e=new Map(t.map((t=>[t,this.t("global.".concat(t))])));return new Map([...e.entries(),...i.entries()])}static describeScalingInput(t){return""===t?"not set":`invalid value "${t}"`}preparePixelPerUnit(){const i=U(this.unitScaling,this.pixelPerUnitGroupMap);return"value"===i.kind?(this.errors.remove("AUTO_unitScaling"),this.autoUnitWarningActive=!1,this.lastReportedUnitsPerEm=void 0,this.getEffectiveFontPx()/i.value):"auto"===i.kind?(this.errors.remove("AUTO_unitScaling"),this.autoUnitWarningActive=!1,this.lastReportedUnitsPerEm=void 0,0):(this.autoUnitWarningActive=!0,this.errors.addOrReplace({id:"AUTO_unitScaling",type:"warning",message:`unit-scaling: ${t.describeScalingInput(i.raw)}, auto-calculated to fit available space.`}),0)}preparePixelPerPercentage(){const i=U(this.percentageScaling,this.pixelPerUnitGroupMap);return"value"===i.kind?(this.errors.remove("AUTO_percentageScaling"),this.autoPctWarningActive=!1,this.lastReportedPpPerEm=void 0,100*this.getEffectiveFontPx()/i.value):"auto"===i.kind?(this.errors.remove("AUTO_percentageScaling"),this.autoPctWarningActive=!1,this.lastReportedPpPerEm=void 0,0):(this.autoPctWarningActive=!0,this.errors.addOrReplace({id:"AUTO_percentageScaling",type:"warning",message:`percentage-scaling: ${t.describeScalingInput(i.raw)}, auto-calculated to fit available space.`}),0)}prepareLevel(){var t,i,e;const s="auto"===(null===(t=this.level)||void 0===t?void 0:t.trim().toLowerCase());return S(this.level)||s?(null===(i=this.datasetMeta)||void 0===i?void 0:i.suggestedLevel)?(s?this.errors.remove("AUTO_level"):this.errors.addOrReplace({id:"AUTO_level",type:"warning",message:"level: not set, auto-detected: "+this.datasetMeta.suggestedLevel}),Q[this.datasetMeta.suggestedLevel.toUpperCase()]):void 0:(this.errors.remove("AUTO_level"),Q[null===(e=this.level)||void 0===e?void 0:e.toUpperCase()])}prepareOrder(){var t,i,e;const s=this.resolveInherited("order",this.order),a=this.resolveInherited("orderDirection",this.orderDirection),n=null!=s?s:this.order,r=null!=a?a:this.orderDirection;let o=(S(this.level)||"auto"===(null===(t=this.level)||void 0===t?void 0:t.trim().toLowerCase()))&&(null===(i=this.datasetMeta)||void 0===i?void 0:i.suggestedLevel)?this.datasetMeta.suggestedLevel:this.level;const l="auto"===(null==n?void 0:n.trim().toLowerCase());return S(n)||l?(null===(e=this.datasetMeta)||void 0===e?void 0:e.suggestedLevel)&&(l?this.errors.remove("AUTO_order"):this.errors.addOrReplace({id:"AUTO_order",type:"warning",message:"order: not set, auto-detected: "+o})):(this.errors.remove("AUTO_order"),"levelindex"===(null==n?void 0:n.toLocaleLowerCase())&&(o+="Index")),{hierarchy:[F[null==o?void 0:o.toUpperCase()]],direction:W[null==r?void 0:r.toUpperCase()]}}prepareStyle(){const t=this.getEffectiveScaleFactor();return this.componentStyle((i=>{const e=i.global.fontSizePx*t;return{scaleFactors:{scenarioOffset:i["bn-chart-time"].scaleFactors.scenarioOffset,scenarioLabelToColumn:i["bn-chart-time"].scaleFactors.scenarioLabelToColumn,labelToColumn:.3,labelToColum:i["bn-chart-time"].scaleFactors.labelToColum,labelToAxis:i["bn-chart-time"].scaleFactors.labelToAxis,needleWidth:i["bn-chart-time"].scaleFactors.needleWidth,needleHeadWidth:i["bn-chart-time"].scaleFactors.needleHeadWidth,columnWidth:i["bn-chart-time"].scaleFactors.columnWidth,varianceAxisLineWidth:i["bn-chart-time"].scaleFactors.varianceAxisLineWidth,axisLineWidth:i["bn-chart-time"].scaleFactors.axisLineWidth,auxiliaryLineWidth:i["bn-chart-time"].scaleFactors.auxiliaryLineWidth,scenarioLineWidth:i["bn-chart-time"].scaleFactors.scenarioLineWidth,markerWidth:i["bn-chart-time"].scaleFactors.markerWidth,markerOffset:i["bn-chart-time"].scaleFactors.markerOffset,categoryWidth:i["bn-chart-time"].scaleFactors.categoryWidth,axisTickLength:i["bn-chart-time"].scaleFactors.axisTickLength},fontStyles:{font:`${e}px ${i.global.fontFamily}`,family:i.global.fontFamily,size:e,color:i.global.fontColor,background:i.global.fontBackgroundColor,leading:1.8},axisStyles:i["bn-chart-time"].axisStyles,barStyles:i["bn-chart-time"].barStyles,varianceStyles:i["bn-chart-time"].varianceStyles,stackColors:i["bn-chart-time"].stackColors,padding:i["bn-chart-time"].padding,pattern:null}}))}prepareLeftSideOffset(t,i){return this.syncSpaceLeft>-1?this.syncSpaceLeft:D.getMaxWidthOfArrayItems([...this.prepareVariances(),...this.prepareScenarios(),this.chartTitle],t,i)}prepareChartTitle(t){return t>=1?"":this.chartTitle}prepareLimit(){return Math.floor(Number(this.limit)||0)}prepareDateInterval(){var t,i,e;const s="auto"===(null===(t=this.dateInterval)||void 0===t?void 0:t.trim().toLowerCase());return S(this.dateInterval)||s?(null===(i=this.datasetMeta)||void 0===i?void 0:i.suggestedDateInterval)?(s?this.errors.remove("AUTO_dateInterval"):this.errors.addOrReplace({id:"AUTO_dateInterval",type:"warning",message:"dateInterval: not set, auto-detected: "+this.datasetMeta.suggestedDateInterval}),z[this.datasetMeta.suggestedDateInterval.toUpperCase()]):s?z.AUTO:void 0:(this.errors.remove("AUTO_dateInterval"),z[null===(e=this.dateInterval)||void 0===e?void 0:e.toUpperCase()])}prepareIntervalSpanLimit(){return this.intervalSpanLimit}prepareAxisLabelsMode(){var t;return j[null===(t=this.axisLabelsMode)||void 0===t?void 0:t.toUpperCase()]}prepareFilter(){return 0===this.filter.length?"":this.filter}getDataStructure(){return{ITimeChartDataRow:{setName:{type:"string",isOptional:!1,description:""},date:{type:"string",isOptional:!1,description:""},operation:{type:"string",isOptional:!1,description:""},rowGroup:{type:"string",isOptional:!1,description:""},rowGroupIndex:{type:"number",isOptional:!1,description:""},category:{type:"string",isOptional:!1,description:""},categoryIndex:{type:"number",isOptional:!1,description:""},subCategory:{type:"string",isOptional:!1,description:""},subCategoryIndex:{type:"number",isOptional:!1,description:""},columnGroup:{type:"string",isOptional:!1,description:""},columnGroupIndex:{type:"number",isOptional:!1,description:""},columnSubGroup:{type:"string",isOptional:!1,description:""},columnSubGroupIndex:{type:"number",isOptional:!1,description:""},ac1:{type:"number",isOptional:!1,description:""},ac2:{type:"number",isOptional:!1,description:""},ac3:{type:"number",isOptional:!1,description:""},ac4:{type:"number",isOptional:!1,description:""},pp1:{type:"number",isOptional:!1,description:""},pp2:{type:"number",isOptional:!1,description:""},pp3:{type:"number",isOptional:!1,description:""},pp4:{type:"number",isOptional:!1,description:""},fc1:{type:"number",isOptional:!1,description:""},fc2:{type:"number",isOptional:!1,description:""},fc3:{type:"number",isOptional:!1,description:""},fc4:{type:"number",isOptional:!1,description:""},pl1:{type:"number",isOptional:!1,description:""},pl2:{type:"number",isOptional:!1,description:""},pl3:{type:"number",isOptional:!1,description:""},pl4:{type:"number",isOptional:!1,description:""}}}}prepareMeasureScale(){return S(this.measureScale)?"GREATEST":["_","k","M","G","T","P","E","Z","Y","m","μ","n","p","P","f","a","z","y"].includes(this.measureScale.trim())||"LEAST"===this.measureScale.trim().toUpperCase()?this.measureScale.trim():"GREATEST"}prepareShowMeasureScale(t){return 0===t&&"true"===this.showMeasureScale}prepareMeasureUnit(){return""===this.measureUnit||null==this.measureUnit?"":this.measureUnit}prepareStackConfig(){if(S(this.stack))return this.errors.remove("WARN_stack_dimensions_scenarios"),null;try{const t=JSON.parse(this.stack),i=t.by,e="WARN_stack_dimensions_scenarios";if(i===$.DIMENSIONS){const t=this.prepareScenarios();t.length>1?this.errors.addOrReplace({id:e,type:"warning",message:`stack by dimensions: only the first scenario "${t[0]}" is used, the rest (${t.slice(1).join(", ")}) are discarded.`}):this.errors.remove(e)}else this.errors.remove(e);return{by:i,mode:t.mode||G.ABSOLUTE,order:t.order||P.DATASET}}catch(t){return this.errors.remove("WARN_stack_dimensions_scenarios"),null}}prepareLineFullWidth(){return"true"===this.lineFullWidth}prepareChartMode(){var t;const i=null===(t=this.chartMode)||void 0===t?void 0:t.toLowerCase();return"line"===i?B.LINE:"auto"===i?B.AUTO:B.BAR}prepareMaxBars(){return Math.floor(Number(this.maxBars)||28)}chartTemplate(t,i){const e=this.prepareI18n(),s=this.prepareStyle(),n=b(this.element).width,r=this.preparePixelPerUnit(),o=this.preparePixelPerPercentage(),l=this.prepareStackConfig(),h=this.prepareScenarios(),d=(null==l?void 0:l.by)===$.DIMENSIONS?h.slice(0,1):h;return a("ibcs-chart-time",{tableName:this.datasetName,dataVersion:this.dataVersion,chartTitle:this.prepareChartTitle(i),scenarios:d,variances:[t],hideAxisLabels:this.prepareHideAxisLabels(i),pixelPerUnit:r,pixelPerPercentage:o,reportAutoScaling:this.handleAutoScalingReport,limit:this.prepareLimit(),leftSideOffsetForHorizontalSync:this.prepareLeftSideOffset(e,s),styles:s,i18n:e,order:this.prepareOrder(),level:this.prepareLevel(),dateInterval:this.prepareDateInterval(),intervalSpanLimit:this.prepareIntervalSpanLimit(),axisLabelsMode:this.prepareAxisLabelsMode(),filter:this.prepareFilter(),"measure-scale":this.prepareMeasureScale(),"measure-unit":this.prepareMeasureUnit(),showOverlayAvg:this.prepareAvg(),showOverlayMedian:this.prepareMedian(),showMeasureScale:this.prepareShowMeasureScale(i),chartMode:this.prepareChartMode(),maxBars:this.prepareMaxBars(),stackConfig:l,lineFullWidth:this.prepareLineFullWidth(),containerWidth:n,parentDimensions:this.prepareDimension(),ruleSetConfig:this.ruleSetConfig()})}async getLayoutState(t){var i,e,s,a;const n=null!==(i=null==t?void 0:t.detail)&&void 0!==i?i:"summary",r=H(this.element),o=this.getEffectiveScaleFactor(),l=Number.isFinite(o)&&o>0?o:1,h=this.componentStyle((t=>{var i;return(null===(i=t.global)||void 0===i?void 0:i.fontSizePx)||13.3333}))*l,d=this.prepareVariances(),c=Z(this.element,"ibcs-chart-time",["base",...d],r,n),u=null===(e=this.element.shadowRoot)||void 0===e?void 0:e.querySelector("ibcs-chart-time"),v={version:V,tag:this.element.localName,id:Y(this.element),slot:null!==(s=this.element.getAttribute("slot"))&&void 0!==s?s:void 0,rect:J(this.element,r),em:{fontSizePx:h,appliedScaleFactor:l},regions:c.regions,metadata:{title:this.chartTitle||void 0,scenarios:null!==(a=null==u?void 0:u.scenarios)&&void 0!==a?a:[],variances:d,barCount:c.barCount,chartMode:this.chartMode||void 0,hasNoData:0===c.barCount},diagnostics:q(this.element),scaling:this.resolveScalingInfo(h)};return c.elements&&(v.elements=c.elements),v}resolveScalingInfo(t){var i,e;const s={},a=U(this.unitScaling,this.pixelPerUnitGroupMap);if("value"===a.kind)s.unitMode="fixed",s.unitsPerEm=a.value,s.unitPxPerUnit=t/a.value;else{s.unitMode="auto";const e=null===(i=this.lastAutoScalingReport)||void 0===i?void 0:i.unit;void 0!==e&&e>0&&(s.unitPxPerUnit=e,s.unitsPerEm=t/e)}const n=U(this.percentageScaling,this.pixelPerUnitGroupMap);if("value"===n.kind)s.percentageMode="fixed",s.percentagePointsPerEm=n.value,s.percentagePxPerPoint=t/n.value;else{s.percentageMode="auto";const i=null===(e=this.lastAutoScalingReport)||void 0===e?void 0:e.percentage;void 0!==i&&i>0&&(s.percentagePxPerPoint=i/100,s.percentagePointsPerEm=100*t/i)}return s}getEffectiveScaleFactor(){const{mode:t,factor:i}=k(this.scale);return"factor"===t?i:"auto"===t||"empty"===t?this.appliedScaleFactor:1}getEffectiveFontPx(){return this.componentStyle((t=>{var i;return(null===(i=t.global)||void 0===i?void 0:i.fontSizePx)||13.3333}))*this.getEffectiveScaleFactor()}getFontStyles(){const t=this.getEffectiveScaleFactor();return this.componentStyle((i=>{var e,s,a,n;const r=(null===(e=i.global)||void 0===e?void 0:e.fontSizePx)||13.3333;return{"--bn-font-family":(null===(s=i.global)||void 0===s?void 0:s.fontFamily)||"'Noto Sans', sans-serif","--bn-font-size":r*t+"px","--bn-font-color":(null===(a=i.global)||void 0===a?void 0:a.fontColor)||"#000000","--bn-font-background":(null===(n=i.global)||void 0===n?void 0:n.fontBackgroundColor)||"#ffffff"}}))}render(){let t=[""];const i=this.prepareVariances();i.length>0&&(t=[...t,...i]);const e=this.getFontStyles();return a(n,{key:"93a5778cad09ee33f54df92f3b3e32d030a734d6",style:e},a("div",{key:"b431ad76c90bc3c6e5f6820ba03df574155b0038",class:"container"},t.map(this.chartTemplate)))}get element(){return this}static get watchers(){return{scenarios:[{validateScenario:0}],variances:[{validateVariances:0}],syncSpaceLeft:[{validateLeftSync:0}],limit:[{validateLimit:0}],unitScaling:[{validateUnitScaling:0}],percentageScaling:[{validatePercentageScaling:0}],level:[{validateLevel:0}],order:[{validateOrderList:0}],orderDirection:[{validateOrderDirection:0}],dateInterval:[{validateDateInterval:0}],chartMode:[{validateChartMode:0}],maxBars:[{validateMaxBars:0}],stack:[{validateStack:0}],scale:[{validateScaling:0}],axisLabelsMode:[{validateAxisLabelsMode:0}],lineFullWidth:[{validateLineFullWidth:0}],showCategories:[{validateShowCategories:0}],measureScale:[{validateMeasureScale:0}],showMeasureScale:[{validateShowMeasureScale:0}],showOverlayAvg:[{validateShowOverlayAvg:0}],showOverlayMedian:[{validateShowOverlayMedian: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-reverse}.background-image{display:flex;flex-wrap:wrap;justify-content:flex-end}'}},[1,"bn-chart-time",{ruleset:[513],chartTitle:[1,"chart-title"],filter:[1],scenarios:[1],variances:[1],syncSpaceLeft:[2,"sync-space-left"],limit:[2],unitScaling:[8,"unit-scaling"],percentageScaling:[8,"percentage-scaling"],level:[1],order:[1],orderDirection:[1,"order-direction"],dateInterval:[1,"date-interval"],chartMode:[1,"chart-mode"],maxBars:[2,"max-bars"],stack:[1],scale:[1],intervalSpanLimit:[2,"interval-span-limit"],axisLabelsMode:[1,"axis-labels-mode"],lineFullWidth:[1,"line-full-width"],showCategories:[1,"show-categories"],measureScale:[1,"measure-scale"],showMeasureScale:[1,"show-measure-scale"],showOverlayAvg:[1,"show-overlay-avg"],showOverlayMedian:[1,"show-overlay-median"],measureUnit:[1,"measure-unit"],datasetName:[32],dataVersion:[32],datasetMeta:[32],appliedScaleFactor:[32],getLayoutState:[64]},void 0,{scenarios:[{validateScenario:0}],variances:[{validateVariances:0}],syncSpaceLeft:[{validateLeftSync:0}],limit:[{validateLimit:0}],unitScaling:[{validateUnitScaling:0}],percentageScaling:[{validatePercentageScaling:0}],level:[{validateLevel:0}],order:[{validateOrderList:0}],orderDirection:[{validateOrderDirection:0}],dateInterval:[{validateDateInterval:0}],chartMode:[{validateChartMode:0}],maxBars:[{validateMaxBars:0}],stack:[{validateStack:0}],scale:[{validateScaling:0}],axisLabelsMode:[{validateAxisLabelsMode:0}],lineFullWidth:[{validateLineFullWidth:0}],showCategories:[{validateShowCategories:0}],measureScale:[{validateMeasureScale:0}],showMeasureScale:[{validateShowMeasureScale:0}],showOverlayAvg:[{validateShowOverlayAvg:0}],showOverlayMedian:[{validateShowOverlayMedian:0}]}]),tt=X,it=function(){"undefined"!=typeof customElements&&["bn-chart-time","ibcs-chart-time"].forEach((t=>{switch(t){case"bn-chart-time":customElements.get(r(t))||customElements.define(r(t),X);break;case"ibcs-chart-time":customElements.get(r(t))||K()}}))};export{tt as BnChartTime,it as defineCustomElement}
|
|
1
|
+
import{proxyCustomElement as t,HTMLElement as i,writeTask as e,forceUpdate as s,h as a,Host as n,transformTag as r}from"@stencil/core/internal/client";import{h as o,a as l}from"./context-protocol.js";import{v as h,a as d,o as c,h as u,i as v,k as p,b as m,c as g,f,n as y,p as w,l as b,m as S}from"./validate.js";import{w as O}from"./withDataset.js";import{w as M}from"./withComponentStatus.js";import{i as x,w as _,a as A}from"./withTranslation.js";import{w as R}from"./withScalingGroup.js";import{w as L}from"./withStyled.js";import{w as T}from"./withComponentStyle.js";import{w as E}from"./withRuleSet.js";import{w as C}from"./withHasError.js";import{g as U}from"./parentDimensions.js";import{r as k,f as I,p as N}from"./scaling.js";import{o as F}from"./layoutObserver.js";import{V as W,F as j}from"./formatter.js";import{a as D,O as $}from"./Order.js";import{b as P,e as z,f as G,g as B,h as V}from"./CompareUtil.js";import{D as H}from"./DateStringFactory.js";import{L as J}from"./types.js";import{o as q,m as Y}from"./geometry.js";import{r as Z,a as K}from"./diagnostics.js";import{a as Q}from"./svgChartElements.js";import{s as X}from"./emptyState.js";import{d as tt}from"./ibcs-chart-time2.js";var it;!function(t){t.ROWGROUP="rowGroup",t.ROWGROUPINDEX="rowGroupIndex",t.CATEGORY="category",t.CATEGORYINDEX="categoryIndex",t.SUBCATEGORY="subCategory",t.SUBCATEGORYINDEX="subCategoryIndex"}(it||(it={}));const et=t(class t extends i{validateFilter(t){const i="ERR_filter";o(t)?this.errors.addOrReplace({id:i,type:"error",message:"filter: double backticks are not allowed."}):this.errors.remove(i)}validateScenario(t){const i="ERR_scenarios";if(x(t))return void this.errors.remove(i);const e=h(t);e.length>0?this.errors.addOrReplace({id:i,type:"warning",message:"scenarios: invalid value(s) '"+JSON.stringify(e)+"' are not supported."}):this.errors.remove(i)}validateVariances(t){const i="ERR_variances";if(x(t))return void this.errors.remove(i);const e=d(t);e.length>0?this.errors.addOrReplace({id:i,type:"warning",message:"variances: invalid value(s) '"+JSON.stringify(e)+"' are not supported."}):this.errors.remove(i)}validateLeftSync(t){const i="ERR_syncSpaceLeft";c(t)?this.errors.remove(i):this.errors.addOrReplace({id:i,type:"warning",message:"syncSpaceLeft: invalid value(s) '"+t+"' are not supported."})}validateLimit(t){const i="ERR_limit";u(t)?this.errors.remove(i):this.errors.addOrReplace({id:i,type:"warning",message:"limit: invalid value '"+(null==t?void 0:""+t)+"' is not supported."})}validateUnitScaling(t){const i="ERR_unitScaling";v(t)?this.errors.remove(i):"invalid"===k(t,this.pixelPerUnitGroupMap).kind?this.errors.addOrReplace({id:i,type:"warning",message:"unitScaling: invalid value(s) '"+t+"' are not supported."}):this.errors.remove(i)}validatePercentageScaling(t){const i="ERR_percentageScaling";v(t)?this.errors.remove(i):"invalid"===k(t,this.pixelPerUnitGroupMap).kind?this.errors.addOrReplace({id:i,type:"warning",message:"percentageScaling: invalid value(s) '"+t+"' are not supported."}):this.errors.remove(i)}validateLevel(t){const i="ERR_level";v(t)||p(t)?this.errors.remove(i):this.errors.addOrReplace({id:i,type:"warning",message:"level: invalid value(s) '"+t+"' are not supported."})}validateOrderList(t){const i="ERR_order";if(x(t))return void this.errors.remove(i);const e=m(t);e.length>0?this.errors.addOrReplace({id:i,type:"warning",message:"order: invalid value(s) '"+JSON.stringify(e)+"' are not supported."}):this.errors.remove(i)}validateOrderDirection(t){const i="ERR_orderDirection";x(t)||v(t)||g(t)?this.errors.remove(i):this.errors.addOrReplace({id:i,type:"warning",message:"orderDirection: invalid value '"+(null==t?void 0:""+t)+"' is not supported."})}validateDateInterval(t){const i="ERR_dateInterval";v(t)||f(t)?this.errors.remove(i):this.errors.addOrReplace({id:i,type:"warning",message:"dateInterval: invalid value '"+(null==t?void 0:""+t)+"' is not supported."})}validateChartMode(t){const i="ERR_chartMode";["bar","line","auto"].includes(null==t?void 0:t.toLowerCase())?this.errors.remove(i):this.errors.addOrReplace({id:i,type:"warning",message:"chartMode: invalid value '"+(null==t?void 0:""+t)+"' is not supported. Valid values are: bar, line, auto."})}validateMaxBars(t){const i="ERR_maxBars";!u(t)||t<1?this.errors.addOrReplace({id:i,type:"warning",message:"maxBars: invalid value '"+(null==t?void 0:""+t)+"' is not supported. Must be a positive integer."}):this.errors.remove(i)}validateStack(t){const i="ERR_stack",e=y(t);e.length>0?this.errors.addOrReplace({id:i,type:"warning",message:e.join("; ")}):this.errors.remove(i)}validateScaling(t){if(null==t||""===t||"none"===t||"auto"===t)return void this.errors.remove("ERR_scale");const i=Number(t);isNaN(i)||i<=0?this.errors.addOrReplace({id:"ERR_scale",type:"warning",message:`Invalid scale value: "${t}". Use "none", "auto", or a positive number.`}):this.errors.remove("ERR_scale")}validateAxisLabelsMode(t){const i="ERR_axisLabelsMode";v(t)||w(t)?this.errors.remove(i):this.errors.addOrReplace({id:i,type:"warning",message:"axisLabelsMode: invalid value '"+(null==t?void 0:""+t)+"' is not supported."})}validateLineFullWidth(t){const i="ERR_lineFullWidth";b(t)?this.errors.remove(i):this.errors.addOrReplace({id:i,type:"warning",message:"lineFullWidth: invalid value(s) '"+(null==t?void 0:""+t)+"' are not supported."})}validateShowCategories(t){const i="ERR_showCategories";b(t)?this.errors.remove(i):this.errors.addOrReplace({id:i,type:"warning",message:"showCategories: invalid value(s) '"+(null==t?void 0:""+t)+"' are not supported."})}validateMeasureScale(t){const i="ERR_measureScale";S(t)?this.errors.remove(i):this.errors.addOrReplace({id:i,type:"warning",message:"measureScale: invalid value '"+(null==t?void 0:""+t)+"' is not supported."})}validateShowMeasureScale(t){const i="ERR_showMeasureScale";b(t)?this.errors.remove(i):this.errors.addOrReplace({id:i,type:"warning",message:"showMeasureScale: invalid value(s) '"+(null==t?void 0:""+t)+"' are not supported."})}validateShowOverlayAvg(t){const i="ERR_showOverlayAvg";b(t)?this.errors.remove(i):this.errors.addOrReplace({id:i,type:"warning",message:"showOverlayAvg: invalid value(s) '"+(null==t?void 0:""+t)+"' are not supported."})}validateShowOverlayMedian(t){const i="ERR_showOverlayMedian";b(t)?this.errors.remove(i):this.errors.addOrReplace({id:i,type:"warning",message:"showOverlayMedian: invalid value(s) '"+(null==t?void 0:""+t)+"' are not supported."})}constructor(i){super(),!1!==i&&this.__registerHost(),this.__attachShadow(),this.datasetName="",this.dataVersion=0,this.datasetMeta=null,this.appliedScaleFactor=1,this.layoutObserver=null,this.chartTitle="",this.filter="",this.syncSpaceLeft=-1,this.limit=0,this.chartMode="bar",this.maxBars=28,this.stack="",this.intervalSpanLimit=28,this.lineFullWidth="true",this.showCategories="true",this.measureScale="greatest",this.showMeasureScale="false",this.showOverlayAvg="true",this.showOverlayMedian="false",this.measureUnit="",this.pixelPerUnitGroupMap=new Map,this._autoScaleGuard=!1,this._lastObservedWidth=0,this._settleTimer=null,this._lastAppliedHeight=0,this.autoUnitWarningActive=!1,this.autoPctWarningActive=!1,this.handleAutoScalingReport=i=>{var e,s,a,n,r,o;this.lastAutoScalingReport={unit:null!==(e=i.unit)&&void 0!==e?e:null===(s=this.lastAutoScalingReport)||void 0===s?void 0:s.unit,percentage:null!==(a=i.percentage)&&void 0!==a?a:null===(n=this.lastAutoScalingReport)||void 0===n?void 0:n.percentage};const l=(t,i)=>void 0===i||Math.abs(t-i)>.001*Math.abs(t),h=this.getEffectiveFontPx();if(void 0!==i.unit&&i.unit>0&&this.autoUnitWarningActive){const e=h/i.unit;l(e,this.lastReportedUnitsPerEm)&&(this.lastReportedUnitsPerEm=e,this.errors.addOrReplace({id:"AUTO_unitScaling",type:"warning",message:`unit-scaling: ${t.describeScalingInput(((null!==(r=this.unitScaling)&&void 0!==r?r:"")+"").trim())}, auto-fitted to 1 em ≈ ${I(e)} units.`}))}if(void 0!==i.percentage&&i.percentage>0&&this.autoPctWarningActive){const e=100*h/i.percentage;l(e,this.lastReportedPpPerEm)&&(this.lastReportedPpPerEm=e,this.errors.addOrReplace({id:"AUTO_percentageScaling",type:"warning",message:`percentage-scaling: ${t.describeScalingInput(((null!==(o=this.percentageScaling)&&void 0!==o?o:"")+"").trim())}, auto-fitted to 1 em ≈ ${I(e)} percentage points.`}))}},L(this),M(this),O(this,(t=>{this.datasetName=(null==t?void 0:t.startsWith("$"))?t.substring(1):t||"",this.dataVersion=this.dataVersion+1}),((t,i)=>{this.datasetMeta=i})),this.chartTemplate=this.chartTemplate.bind(this),this.errors=C(this),R(this),this.componentStyle=T(this),this.ruleSetConfig=E(this),this.t=_(this).t,this.resolveInherited=A(this,[{propName:"scenarios",ancestorAttr:"title-scenarios"},{propName:"variances",ancestorAttr:"title-variances"},{propName:"order",ancestorAttr:"title-order"},{propName:"orderDirection",ancestorAttr:"title-order-direction"}],this.errors)}componentWillLoad(){this.validateFilter(this.filter),this.validateScenario(this.scenarios),this.validateVariances(this.variances),this.validateUnitScaling(this.unitScaling),this.validateLimit(this.limit),this.validateLevel(this.level),this.validateOrderDirection(this.orderDirection),this.validateOrderList(this.order),this.validateLeftSync(this.syncSpaceLeft),this.validateDateInterval(this.dateInterval),this.validateAxisLabelsMode(this.axisLabelsMode),this.validateLineFullWidth(this.lineFullWidth),this.validateShowCategories(this.showCategories),this.validateMeasureScale(this.measureScale),this.validateShowMeasureScale(this.showMeasureScale),this.validateShowOverlayAvg(this.showOverlayAvg),this.validateShowOverlayMedian(this.showOverlayMedian),this.validateChartMode(this.chartMode),this.validateMaxBars(this.maxBars),this.validateStack(this.stack),this.validateScaling(this.scale)}measureContentWidth(){var t;const i=null===(t=this.element.shadowRoot)||void 0===t?void 0:t.querySelectorAll("ibcs-chart-time");let e=0,s=!1;return null==i||i.forEach((t=>{var i,a,n;const r=parseFloat(null!==(n=null===(a=null===(i=t.shadowRoot)||void 0===i?void 0:i.querySelector("svg#drawCanvas"))||void 0===a?void 0:a.getAttribute("width"))&&void 0!==n?n:"");Number.isNaN(r)||(e=Math.max(e,r),s=!0)})),s?Math.max(Math.floor(e),this.element.scrollWidth):this.element.scrollWidth}measureContentHeight(){var t;const i=null===(t=this.element.shadowRoot)||void 0===t?void 0:t.querySelectorAll("ibcs-chart-time");let e=0,s=!1;return null==i||i.forEach((t=>{var i,a,n;const r=parseFloat(null!==(n=null===(a=null===(i=t.shadowRoot)||void 0===i?void 0:i.querySelector("svg#drawCanvas"))||void 0===a?void 0:a.getAttribute("height"))&&void 0!==n?n:"");Number.isNaN(r)||(e+=r,s=!0)})),s?Math.max(Math.floor(e),this.element.scrollHeight):this.element.scrollHeight}checkOverflow(){const t="WARN_overflow",i=U(this.element),e=this.measureContentWidth(),s=this.measureContentHeight(),a=i.width>0&&e>i.width+1,n=i.height>0&&s>i.height+1;if(!a&&!n)return void this.errors.remove(t);const r=this.prepareVariances().some((t=>t.startsWith("dr"))),o="value"===k(this.unitScaling,this.pixelPerUnitGroupMap).kind,l=r&&"value"===k(this.percentageScaling,this.pixelPerUnitGroupMap).kind,{mode:h}=N(this.scale),d="auto"!==h&&"empty"!==h,c=[];n&&o&&c.push("unit-scaling"),n&&l&&c.push("percentage-scaling"),a&&d&&c.push("scale");const u=[];a&&u.push(`width (${Math.round(e)}px > ${Math.round(i.width)}px)`),n&&u.push(`height (${Math.round(s)}px > ${Math.round(i.height)}px)`),this.errors.addOrReplace({id:t,type:c.length>0?"error":"warning",message:`Chart exceeds available ${u.join(" and ")}. `+(c.length>0?`Adjust ${c.join(" / ")} or set to "auto".`:"Content does not fit even at minimum auto scaling; enlarge the container.")})}componentDidRender(){X(this.element,"ibcs-chart-time");const{mode:t}=N(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 i=this.element,{width:s}=U(i);if(s<=0)return void this.checkOverflow();this._lastObservedWidth=s;const a=this.componentStyle((t=>{var i;return(null===(i=t.global)||void 0===i?void 0:i.fontSizePx)||13.3333})),n=i.scrollWidth,r=this.appliedScaleFactor;if(n<=s+1)return this.errors.remove("AUTO_scale"),void this.checkOverflow();const o=Math.max(.3,r*(s-1)/n);Math.abs(o-r)<.01||(i.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,e((()=>{this.appliedScaleFactor=o}))),this.checkOverflow()}componentDidLoad(){this.layoutObserver=F(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)}))})),this.settleParentHeight()}settleParentHeight(){const t=[150,400,1e3,2500],i=()=>{if(this._settleTimer=null,!this.element.isConnected)return;const{height:e}=U(this.element);e>0&&Math.abs(e-this._lastAppliedHeight)>8&&!this._autoScaleGuard&&s(this);const a=t.shift();void 0!==a&&(this._settleTimer=setTimeout(i,a))};this._settleTimer=setTimeout(i,t.shift())}disconnectedCallback(){var t;null===(t=this.layoutObserver)||void 0===t||t.disconnect(),this.layoutObserver=null,null!=this._settleTimer&&(clearTimeout(this._settleTimer),this._settleTimer=null)}prepareDimension(){const t=U(this.element),i=this.prepareScenarios(),e=this.prepareVariances();this.canvasWidthSegmented=t.width/(i.length+e.length||1),this._lastAppliedHeight=t.height;const s=1+e.length,a="true"===this.showMeasureScale?this.getEffectiveFontPx():0;return{width:this.canvasWidthSegmented,height:Math.max(0,t.height-a)/s}}prepareScenarios(){var t,i,e,s;const a=this.resolveInherited("scenarios",this.scenarios);if(a.inherited)return this.errors.remove("AUTO_scenarios"),a.value.split(",").map((t=>t.trim()));const n="auto"===(null===(t=a.value)||void 0===t?void 0:t.trim().toLowerCase());return v(a.value)||n?(null===(e=null===(i=this.datasetMeta)||void 0===i?void 0:i.availableScenarios)||void 0===e?void 0:e.length)>0?(n||a.unresolved?this.errors.remove("AUTO_scenarios"):this.errors.addOrReplace({id:"AUTO_scenarios",type:"warning",message:"scenarios: not set, auto-detected: "+this.datasetMeta.availableScenarios.join(",")}),this.datasetMeta.availableScenarios):[]:(this.errors.remove("AUTO_scenarios"),null===(s=a.value)||void 0===s?void 0:s.split(",").map((t=>t.trim())))}prepareAvg(){return"true"===this.showOverlayAvg}prepareMedian(){return"true"===this.showOverlayMedian}prepareVariances(){const t=this.resolveInherited("variances",this.variances).value;return v(t)?[]:null==t?void 0:t.split(",").map((t=>t.trim()))}checkVarianceScenarios(t){const i="WARN_variances_scenario",e=this.prepareScenarios(),s=[];for(const i of t){const t=new W(i);if(t.isValid)for(const a of[t.base,t.delta])e.includes(a)||s.push(`'${i}' needs '${a}'`)}e.length>0&&s.length>0?this.errors.addOrReplace({id:i,type:"warning",message:`variances: ${s.join(", ")}, which is not in scenarios (${e.join(", ")}). The variance has no values.`}):this.errors.remove(i)}prepareHideAxisLabels(t){return t>=1||"true"!==this.showCategories}prepareI18n(){const t=l,i=new Map(["no-data"].map((t=>[t,this.t(".".concat(t))]))),e=new Map(t.map((t=>[t,this.t("global.".concat(t))])));return new Map([...e.entries(),...i.entries()])}static describeScalingInput(t){return""===t?"not set":`invalid value "${t}"`}preparePixelPerUnit(){const i=k(this.unitScaling,this.pixelPerUnitGroupMap);return"value"===i.kind?(this.errors.remove("AUTO_unitScaling"),this.autoUnitWarningActive=!1,this.lastReportedUnitsPerEm=void 0,this.getEffectiveFontPx()/i.value):"auto"===i.kind?(this.errors.remove("AUTO_unitScaling"),this.autoUnitWarningActive=!1,this.lastReportedUnitsPerEm=void 0,0):(this.autoUnitWarningActive=!0,this.errors.addOrReplace({id:"AUTO_unitScaling",type:"warning",message:`unit-scaling: ${t.describeScalingInput(i.raw)}, auto-calculated to fit available space.`}),0)}preparePixelPerPercentage(){const i=k(this.percentageScaling,this.pixelPerUnitGroupMap);return"value"===i.kind?(this.errors.remove("AUTO_percentageScaling"),this.autoPctWarningActive=!1,this.lastReportedPpPerEm=void 0,100*this.getEffectiveFontPx()/i.value):"auto"===i.kind?(this.errors.remove("AUTO_percentageScaling"),this.autoPctWarningActive=!1,this.lastReportedPpPerEm=void 0,0):(this.autoPctWarningActive=!0,this.errors.addOrReplace({id:"AUTO_percentageScaling",type:"warning",message:`percentage-scaling: ${t.describeScalingInput(i.raw)}, auto-calculated to fit available space.`}),0)}prepareLevel(){var t,i,e;const s="auto"===(null===(t=this.level)||void 0===t?void 0:t.trim().toLowerCase());return v(this.level)||s?(null===(i=this.datasetMeta)||void 0===i?void 0:i.suggestedLevel)?(s?this.errors.remove("AUTO_level"):this.errors.addOrReplace({id:"AUTO_level",type:"warning",message:"level: not set, auto-detected: "+this.datasetMeta.suggestedLevel}),it[this.datasetMeta.suggestedLevel.toUpperCase()]):void 0:(this.errors.remove("AUTO_level"),it[null===(e=this.level)||void 0===e?void 0:e.toUpperCase()])}prepareOrder(){var t,i,e;const s=this.resolveInherited("order",this.order),a=s.value,n=this.resolveInherited("orderDirection",this.orderDirection).value;let r=(v(this.level)||"auto"===(null===(t=this.level)||void 0===t?void 0:t.trim().toLowerCase()))&&(null===(i=this.datasetMeta)||void 0===i?void 0:i.suggestedLevel)?this.datasetMeta.suggestedLevel:this.level;const o="auto"===(null==a?void 0:a.trim().toLowerCase());return v(a)||o?(null===(e=this.datasetMeta)||void 0===e?void 0:e.suggestedLevel)&&(o||s.unresolved?this.errors.remove("AUTO_order"):this.errors.addOrReplace({id:"AUTO_order",type:"warning",message:"order: not set, auto-detected: "+r})):(this.errors.remove("AUTO_order"),"levelindex"===(null==a?void 0:a.toLocaleLowerCase())&&(r+="Index")),{hierarchy:[$[null==r?void 0:r.toUpperCase()]],direction:D[null==n?void 0:n.toUpperCase()]}}prepareStyle(){const t=this.getEffectiveScaleFactor();return this.componentStyle((i=>{const e=i.global.fontSizePx*t;return{scaleFactors:{scenarioOffset:i["bn-chart-time"].scaleFactors.scenarioOffset,scenarioLabelToColumn:i["bn-chart-time"].scaleFactors.scenarioLabelToColumn,labelToColumn:i["bn-chart-time"].scaleFactors.labelToColumn,labelToAxis:i["bn-chart-time"].scaleFactors.labelToAxis,needleWidth:i["bn-chart-time"].scaleFactors.needleWidth,needleHeadWidth:i["bn-chart-time"].scaleFactors.needleHeadWidth,columnWidth:i["bn-chart-time"].scaleFactors.columnWidth,varianceAxisLineWidth:i["bn-chart-time"].scaleFactors.varianceAxisLineWidth,axisLineWidth:i["bn-chart-time"].scaleFactors.axisLineWidth,auxiliaryLineWidth:i["bn-chart-time"].scaleFactors.auxiliaryLineWidth,scenarioLineWidth:i["bn-chart-time"].scaleFactors.scenarioLineWidth,markerWidth:i["bn-chart-time"].scaleFactors.markerWidth,markerOffset:i["bn-chart-time"].scaleFactors.markerOffset,categoryWidth:i["bn-chart-time"].scaleFactors.categoryWidth,axisTickLength:i["bn-chart-time"].scaleFactors.axisTickLength},fontStyles:{font:`${e}px ${i.global.fontFamily}`,family:i.global.fontFamily,size:e,color:i.global.fontColor,background:i.global.fontBackgroundColor,leading:1.8},axisStyles:i["bn-chart-time"].axisStyles,barStyles:i["bn-chart-time"].barStyles,varianceStyles:i["bn-chart-time"].varianceStyles,stackColors:i["bn-chart-time"].stackColors,padding:i["bn-chart-time"].padding,pattern:null,locale:"de"}}))}prepareLeftSideOffset(t,i){return this.syncSpaceLeft>-1?this.syncSpaceLeft:j.getMaxWidthOfArrayItems([...this.prepareVariances(),...this.prepareScenarios(),this.chartTitle],t,i)}prepareChartTitle(t){return t>=1?"":this.chartTitle}prepareLimit(){return Math.floor(Number(this.limit)||0)}prepareDateInterval(){var t,i,e;const s="auto"===(null===(t=this.dateInterval)||void 0===t?void 0:t.trim().toLowerCase());return v(this.dateInterval)||s?(null===(i=this.datasetMeta)||void 0===i?void 0:i.suggestedDateInterval)?(s?this.errors.remove("AUTO_dateInterval"):this.errors.addOrReplace({id:"AUTO_dateInterval",type:"warning",message:"dateInterval: not set, auto-detected: "+this.datasetMeta.suggestedDateInterval}),H[this.datasetMeta.suggestedDateInterval.toUpperCase()]):s?H.AUTO:void 0:(this.errors.remove("AUTO_dateInterval"),H[null===(e=this.dateInterval)||void 0===e?void 0:e.toUpperCase()])}prepareIntervalSpanLimit(){const t=Number(this.intervalSpanLimit);return t>0?t:28}prepareAxisLabelsMode(){var t;return P[null===(t=this.axisLabelsMode)||void 0===t?void 0:t.toUpperCase()]}prepareFilter(){return 0===this.filter.length?"":this.filter}getDataStructure(){return{ITimeChartDataRow:{setName:{type:"string",isOptional:!1,description:""},date:{type:"string",isOptional:!1,description:""},operation:{type:"string",isOptional:!1,description:""},rowGroup:{type:"string",isOptional:!1,description:""},rowGroupIndex:{type:"number",isOptional:!1,description:""},category:{type:"string",isOptional:!1,description:""},categoryIndex:{type:"number",isOptional:!1,description:""},subCategory:{type:"string",isOptional:!1,description:""},subCategoryIndex:{type:"number",isOptional:!1,description:""},columnGroup:{type:"string",isOptional:!1,description:""},columnGroupIndex:{type:"number",isOptional:!1,description:""},columnSubGroup:{type:"string",isOptional:!1,description:""},columnSubGroupIndex:{type:"number",isOptional:!1,description:""},ac1:{type:"number",isOptional:!1,description:""},ac2:{type:"number",isOptional:!1,description:""},ac3:{type:"number",isOptional:!1,description:""},ac4:{type:"number",isOptional:!1,description:""},pp1:{type:"number",isOptional:!1,description:""},pp2:{type:"number",isOptional:!1,description:""},pp3:{type:"number",isOptional:!1,description:""},pp4:{type:"number",isOptional:!1,description:""},fc1:{type:"number",isOptional:!1,description:""},fc2:{type:"number",isOptional:!1,description:""},fc3:{type:"number",isOptional:!1,description:""},fc4:{type:"number",isOptional:!1,description:""},pl1:{type:"number",isOptional:!1,description:""},pl2:{type:"number",isOptional:!1,description:""},pl3:{type:"number",isOptional:!1,description:""},pl4:{type:"number",isOptional:!1,description:""}}}}prepareMeasureScale(){return v(this.measureScale)?"GREATEST":["_","k","M","G","T","P","E","Z","Y","m","μ","n","p","P","f","a","z","y"].includes(this.measureScale.trim())||"LEAST"===this.measureScale.trim().toUpperCase()?this.measureScale.trim():"GREATEST"}prepareShowMeasureScale(t){return 0===t&&"true"===this.showMeasureScale}prepareMeasureUnit(){return""===this.measureUnit||null==this.measureUnit?"":this.measureUnit}prepareStackConfig(){if(v(this.stack))return this.errors.remove("WARN_stack_dimensions_scenarios"),null;try{const t=JSON.parse(this.stack),i=t.by,e="WARN_stack_dimensions_scenarios";if(i===z.DIMENSIONS){const t=this.prepareScenarios();t.length>1?this.errors.addOrReplace({id:e,type:"warning",message:`stack by dimensions: only the first scenario "${t[0]}" is used, the rest (${t.slice(1).join(", ")}) are discarded.`}):this.errors.remove(e)}else this.errors.remove(e);return{by:i,mode:t.mode||B.ABSOLUTE,order:t.order||G.DATASET}}catch(t){return this.errors.remove("WARN_stack_dimensions_scenarios"),null}}prepareLineFullWidth(){return"true"===this.lineFullWidth}prepareChartMode(){var t;const i=null===(t=this.chartMode)||void 0===t?void 0:t.toLowerCase();return"line"===i?V.LINE:"auto"===i?V.AUTO:V.BAR}prepareMaxBars(){return Math.floor(Number(this.maxBars)||28)}chartTemplate(t,i){const e=this.prepareI18n(),s=this.prepareStyle(),n=U(this.element).width,r=this.preparePixelPerUnit(),o=this.preparePixelPerPercentage(),l=this.prepareStackConfig(),h=this.prepareScenarios(),d=(null==l?void 0:l.by)===z.DIMENSIONS?h.slice(0,1):h;return a("ibcs-chart-time",{tableName:this.datasetName,dataVersion:this.dataVersion,chartTitle:this.prepareChartTitle(i),scenarios:d,variances:[t],hideAxisLabels:this.prepareHideAxisLabels(i),pixelPerUnit:r,pixelPerPercentage:o,reportAutoScaling:this.handleAutoScalingReport,errors:this.errors,limit:this.prepareLimit(),leftSideOffsetForHorizontalSync:this.prepareLeftSideOffset(e,s),styles:s,i18n:e,order:this.prepareOrder(),level:this.prepareLevel(),dateInterval:this.prepareDateInterval(),intervalSpanLimit:this.prepareIntervalSpanLimit(),axisLabelsMode:this.prepareAxisLabelsMode(),filter:this.prepareFilter(),"measure-scale":this.prepareMeasureScale(),"measure-unit":this.prepareMeasureUnit(),showOverlayAvg:this.prepareAvg(),showOverlayMedian:this.prepareMedian(),showMeasureScale:this.prepareShowMeasureScale(i),chartMode:this.prepareChartMode(),maxBars:this.prepareMaxBars(),stackConfig:l,lineFullWidth:this.prepareLineFullWidth(),containerWidth:n,parentDimensions:this.prepareDimension(),ruleSetConfig:this.ruleSetConfig()})}async getLayoutState(t){var i,e,s,a;const n=null!==(i=null==t?void 0:t.detail)&&void 0!==i?i:"summary",r=q(this.element),o=this.getEffectiveScaleFactor(),l=Number.isFinite(o)&&o>0?o:1,h=this.componentStyle((t=>{var i;return(null===(i=t.global)||void 0===i?void 0:i.fontSizePx)||13.3333}))*l,d=this.prepareVariances(),c=Q(this.element,"ibcs-chart-time",["base",...d],r,n),u=null===(e=this.element.shadowRoot)||void 0===e?void 0:e.querySelector("ibcs-chart-time"),v={version:J,tag:this.element.localName,id:K(this.element),slot:null!==(s=this.element.getAttribute("slot"))&&void 0!==s?s:void 0,rect:Y(this.element,r),em:{fontSizePx:h,appliedScaleFactor:l},regions:c.regions,metadata:{title:this.chartTitle||void 0,scenarios:null!==(a=null==u?void 0:u.scenarios)&&void 0!==a?a:[],variances:d,barCount:c.barCount,chartMode:this.chartMode||void 0,hasNoData:0===c.barCount},diagnostics:Z(this.element),scaling:this.resolveScalingInfo(h)};return c.elements&&(v.elements=c.elements),v}resolveScalingInfo(t){var i,e;const s={},a=k(this.unitScaling,this.pixelPerUnitGroupMap);if("value"===a.kind)s.unitMode="fixed",s.unitsPerEm=a.value,s.unitPxPerUnit=t/a.value;else{s.unitMode="auto";const e=null===(i=this.lastAutoScalingReport)||void 0===i?void 0:i.unit;void 0!==e&&e>0&&(s.unitPxPerUnit=e,s.unitsPerEm=t/e)}const n=k(this.percentageScaling,this.pixelPerUnitGroupMap);if("value"===n.kind)s.percentageMode="fixed",s.percentagePointsPerEm=n.value,s.percentagePxPerPoint=t/n.value;else{s.percentageMode="auto";const i=null===(e=this.lastAutoScalingReport)||void 0===e?void 0:e.percentage;void 0!==i&&i>0&&(s.percentagePxPerPoint=i/100,s.percentagePointsPerEm=100*t/i)}return s}getEffectiveScaleFactor(){const{mode:t,factor:i}=N(this.scale);return"factor"===t?i:"auto"===t||"empty"===t?this.appliedScaleFactor:1}getEffectiveFontPx(){return this.componentStyle((t=>{var i;return(null===(i=t.global)||void 0===i?void 0:i.fontSizePx)||13.3333}))*this.getEffectiveScaleFactor()}getFontStyles(){const t=this.getEffectiveScaleFactor();return this.componentStyle((i=>{var e,s,a,n;const r=(null===(e=i.global)||void 0===e?void 0:e.fontSizePx)||13.3333;return{"--bn-font-family":(null===(s=i.global)||void 0===s?void 0:s.fontFamily)||"'Noto Sans', sans-serif","--bn-font-size":r*t+"px","--bn-font-color":(null===(a=i.global)||void 0===a?void 0:a.fontColor)||"#000000","--bn-font-background":(null===(n=i.global)||void 0===n?void 0:n.fontBackgroundColor)||"#ffffff"}}))}render(){let t=[""];const i=this.prepareVariances();this.checkVarianceScenarios(i),i.length>0&&(t=[...t,...i]);const e=this.getFontStyles();return a(n,{key:"a357016dd99c03b2bd2a2a64036b7b8d7dbeac6b",style:e},a("div",{key:"253fbdb945eca47c1bbec2484172186fb4ae8e8a",class:"container"},t.map(this.chartTemplate)))}get element(){return this}static get watchers(){return{filter:[{validateFilter:0}],scenarios:[{validateScenario:0}],variances:[{validateVariances:0}],syncSpaceLeft:[{validateLeftSync:0}],limit:[{validateLimit:0}],unitScaling:[{validateUnitScaling:0}],percentageScaling:[{validatePercentageScaling:0}],level:[{validateLevel:0}],order:[{validateOrderList:0}],orderDirection:[{validateOrderDirection:0}],dateInterval:[{validateDateInterval:0}],chartMode:[{validateChartMode:0}],maxBars:[{validateMaxBars:0}],stack:[{validateStack:0}],scale:[{validateScaling:0}],axisLabelsMode:[{validateAxisLabelsMode:0}],lineFullWidth:[{validateLineFullWidth:0}],showCategories:[{validateShowCategories:0}],measureScale:[{validateMeasureScale:0}],showMeasureScale:[{validateShowMeasureScale:0}],showOverlayAvg:[{validateShowOverlayAvg:0}],showOverlayMedian:[{validateShowOverlayMedian: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-reverse}.background-image{display:flex;flex-wrap:wrap;justify-content:flex-end}'}},[1,"bn-chart-time",{ruleset:[513],chartTitle:[1,"chart-title"],filter:[1],scenarios:[1],variances:[1],syncSpaceLeft:[2,"sync-space-left"],limit:[2],unitScaling:[8,"unit-scaling"],percentageScaling:[8,"percentage-scaling"],level:[1],order:[1],orderDirection:[1,"order-direction"],dateInterval:[1,"date-interval"],chartMode:[1,"chart-mode"],maxBars:[2,"max-bars"],stack:[1],scale:[1],intervalSpanLimit:[2,"interval-span-limit"],axisLabelsMode:[1,"axis-labels-mode"],lineFullWidth:[1,"line-full-width"],showCategories:[1,"show-categories"],measureScale:[1,"measure-scale"],showMeasureScale:[1,"show-measure-scale"],showOverlayAvg:[1,"show-overlay-avg"],showOverlayMedian:[1,"show-overlay-median"],measureUnit:[1,"measure-unit"],datasetName:[32],dataVersion:[32],datasetMeta:[32],appliedScaleFactor:[32],getLayoutState:[64]},void 0,{filter:[{validateFilter:0}],scenarios:[{validateScenario:0}],variances:[{validateVariances:0}],syncSpaceLeft:[{validateLeftSync:0}],limit:[{validateLimit:0}],unitScaling:[{validateUnitScaling:0}],percentageScaling:[{validatePercentageScaling:0}],level:[{validateLevel:0}],order:[{validateOrderList:0}],orderDirection:[{validateOrderDirection:0}],dateInterval:[{validateDateInterval:0}],chartMode:[{validateChartMode:0}],maxBars:[{validateMaxBars:0}],stack:[{validateStack:0}],scale:[{validateScaling:0}],axisLabelsMode:[{validateAxisLabelsMode:0}],lineFullWidth:[{validateLineFullWidth:0}],showCategories:[{validateShowCategories:0}],measureScale:[{validateMeasureScale:0}],showMeasureScale:[{validateShowMeasureScale:0}],showOverlayAvg:[{validateShowOverlayAvg:0}],showOverlayMedian:[{validateShowOverlayMedian:0}]}]),st=et,at=function(){"undefined"!=typeof customElements&&["bn-chart-time","ibcs-chart-time"].forEach((t=>{switch(t){case"bn-chart-time":customElements.get(r(t))||customElements.define(r(t),et);break;case"ibcs-chart-time":customElements.get(r(t))||tt()}}))};export{st as BnChartTime,at as defineCustomElement}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{proxyCustomElement as t,HTMLElement as e,h as s,Host as o,transformTag as n}from"@stencil/core/internal/client";import{w as r}from"./withBodyObserver.js";import{g as i}from"./context-protocol.js";import{w as
|
|
1
|
+
import{proxyCustomElement as t,HTMLElement as e,h as s,Host as o,transformTag as n}from"@stencil/core/internal/client";import{w as r}from"./withBodyObserver.js";import{g as i,u as c}from"./context-protocol.js";import{w as m}from"./withComponentStatus.js";import{w as a}from"./withHasError.js";const h=t(class extends e{constructor(t){super(),!1!==t&&this.__registerHost(),this.name="_default",m(this),this.errors=a(this),r(this,(t=>{this.stores||(this.stores=i(this.element));try{const e=JSON.parse(t);this.stores.componentStyles.set(this.name,e),this.errors.remove("JSON_PARSE");const s=c(e);s.length>0?this.errors.addOrReplace({id:"ERR_keys",type:"error",message:"Unknown style keys, they are ignored: "+s.join(", ")}):this.errors.remove("ERR_keys")}catch(t){this.errors.addOrReplace({id:"JSON_PARSE",type:"error",message:"bn-component-style: Failed to parse JSON body - "+t.message}),console.error(t)}}))}render(){return s(o,{key:"d2737ee7ff674501929f28adbc733ed27aec95e5"})}get element(){return this}static get style(){return"bn-component-style{display:none}"}},[0,"bn-component-style",{name:[1]}]),l=h,p=function(){"undefined"!=typeof customElements&&["bn-component-style"].forEach((t=>{"bn-component-style"===t&&(customElements.get(n(t))||customElements.define(n(t),h))}))};export{l as BnComponentStyle,p as defineCustomElement}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{proxyCustomElement as t,HTMLElement as e,h as o,Host as
|
|
1
|
+
import{proxyCustomElement as t,HTMLElement as e,forceUpdate as n,h as o,Host as a,transformTag as i}from"@stencil/core/internal/client";import{S as r,d as s}from"./context-protocol.js";import{L as c}from"./types.js";import{m as l,t as d}from"./geometry.js";import{r as m,a as u,b as p,c as h}from"./diagnostics.js";import{w as b}from"./withComponentStatus.js";import{w as g}from"./withHasError.js";import{b as f}from"./pageFormats.js";function y(t){if("function"==typeof getComputedStyle){const e=parseFloat(getComputedStyle(t).fontSize);if(Number.isFinite(e)&&e>0)return e}return r.global.fontSizePx}function v(t,e){var n;return{version:c,tag:t.localName,id:u(t),slot:null!==(n=t.getAttribute("slot"))&&void 0!==n?n:void 0,rect:l(t,e),em:{fontSizePx:y(t),appliedScaleFactor:1},regions:[],metadata:{},diagnostics:m(t)}}const x=["format","orientation","page-format","page-orientation","render-orientation","page-number"],w=(t,e,n)=>{const o=t[e];return"string"==typeof o?o:e in t?null:t.getAttribute(n)},S=t(class extends e{constructor(t){super(),!1!==t&&this.__registerHost(),this.__attachShadow(),this.assignedPageNumbers=new WeakMap,b(this),this.errors=g(this)}setLocale(t){this.stores.context.state.locale=t}connectedCallback(){this.stores=s(this.element),this.locale&&(this.stores.context.state.locale=this.locale),this.syncPages(),this.pageObserver=new MutationObserver((()=>this.syncPages())),this.pageObserver.observe(this.element,{childList:!0,subtree:!0,attributes:!0,attributeFilter:x})}disconnectedCallback(){var t,e;null===(t=this.pageObserver)||void 0===t||t.disconnect(),null===(e=this.pageSizeStyle)||void 0===e||e.remove(),this.pageSizeStyle=void 0}syncPages(){const t=Array.from(this.element.querySelectorAll("bn-page, bn-layout-page"));t.forEach(((t,e)=>{const n="bn-layout-page"===t.localName?t:t.querySelector("bn-footer");if(!n)return;const o=w(n,"pageNumber","page-number");if(null!==o&&o!==this.assignedPageNumbers.get(n))return;const a=""+(e+1);this.assignedPageNumbers.set(n,a),o!==a&&n.setAttribute("page-number",a)}));const e=this.element.getAttribute("render-orientation");void 0!==this.renderOrientation&&this.renderOrientation!==e&&t.filter((t=>"bn-layout-page"===t.localName)).forEach((t=>n(t))),this.renderOrientation=e,this.writePageSize(t[0],e)}writePageSize(t,e){var n;if(!t||document.querySelector("bn-context")!==this.element)return null===(n=this.pageSizeStyle)||void 0===n||n.remove(),void(this.pageSizeStyle=void 0);const o="bn-layout-page"===t.localName?f(w(t,"pageFormat","page-format"),w(t,"pageOrientation","page-orientation"),e):f(w(t,"format","format"),w(t,"orientation","orientation"));this.pageSizeStyle||(this.pageSizeStyle=document.createElement("style"),this.pageSizeStyle.setAttribute("data-bn-page-size",""),document.head.append(this.pageSizeStyle)),this.pageSizeStyle.textContent!==o&&(this.pageSizeStyle.textContent=o)}async getLayoutState(t){var e,n;const o=null!==(e=null==t?void 0:t.detail)&&void 0!==e?e:"summary",a=Array.from(this.element.querySelectorAll("bn-body, bn-card, bn-chart-bubble, bn-chart-bullet, bn-chart-scatter, bn-chart-structure, bn-chart-time, bn-footer, bn-grid, bn-image, bn-layout-card, bn-layout-page, bn-message, bn-page, bn-table, bn-template, bn-text, bn-title, bn-tree"));await Promise.all(a.map((t=>{var e,n,o;return null!==(o=null===(n=(e=t).componentOnReady)||void 0===n?void 0:n.call(e))&&void 0!==o?o:Promise.resolve()})));const i=this.element.getBoundingClientRect(),r={x:i.left,y:i.top},s=await Promise.all(a.map((async t=>{const e=t.getBoundingClientRect(),n={context:r,component:{x:e.left,y:e.top}};try{const e=t;return"function"==typeof e.getLayoutState?await e.getLayoutState({detail:o}):v(t,n)}catch(e){let o;try{o=v(t,n)}catch(e){const n={x:0,y:0,width:0,height:0};o={version:c,tag:t.localName,id:t.localName,rect:{context:Object.assign({},n),component:Object.assign({},n)},em:{fontSizePx:0,appliedScaleFactor:1},regions:[],metadata:{},diagnostics:[]}}return o.error=(e instanceof Error?e.message:e)+"",o}}))),l=p(a.map((t=>({tag:t.localName,explicitId:h(t)}))));return s.forEach(((t,e)=>{t.id=l[e]})),{version:c,generatedAt:(new Date).toISOString(),detail:o,context:{viewport:d(i),locale:null===(n=this.stores)||void 0===n?void 0:n.context.state.locale},components:s}}componentWillLoad(){}componentDidLoad(){}componentShouldUpdate(){}componentWillRender(){}componentDidRender(){}componentWillUpdate(){}componentDidUpdate(){}render(){return o(a,{key:"b67db95d4e6f7f07e1f3cf277eacc26104af4620"},o("slot",{key:"33e5e400aaf3c9e929a40afa0e3dd108295762a9"}))}get element(){return this}static get watchers(){return{locale:[{setLocale:0}]}}static get style(){return":host{display:block}"}},[257,"bn-context",{locale:[1],i18nNamespace:[513,"i18n-namespace"],getLayoutState:[64]},void 0,{locale:[{setLocale:0}]}]),j=S,L=function(){"undefined"!=typeof customElements&&["bn-context"].forEach((t=>{"bn-context"===t&&(customElements.get(i(t))||customElements.define(i(t),S))}))};export{j as BnContext,L as defineCustomElement}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{getElement as t,proxyCustomElement as s,HTMLElement as i,h as e,Host as
|
|
1
|
+
import{getElement as t,proxyCustomElement as s,HTMLElement as i,h as e,Host as h,transformTag as r}from"@stencil/core/internal/client";import{g as n,c as o,h as l}from"./context-protocol.js";import{r as a,w as c}from"./withComponentStatus.js";import{w as u}from"./withBodyObserver.js";import{w as d}from"./withHasError.js";import{d as f,c as m}from"./contentDecoder.js";import{e as y}from"./queryError.js";const v=["ac1","ac2","ac3","ac4","pp1","pp2","pp3","pp4","fc1","fc2","fc3","fc4","pl1","pl2","pl3","pl4"],p=["rowGroup","category","subCategory","columnGroup","columnSubGroup"];function R(t){return"number"==typeof t&&!isNaN(t)&&isFinite(t)}function E(t){const s=Array.from(t);return{distinctValues:s,count:s.length,hasData:s.length>0}}const g=s(class extends i{constructor(s){super(),!1!==s&&this.__registerHost(),this.datasources="",this.static=!1,this.raw=!0,this.interval=0,this.lastBodyHash=null,this.lastViewQuery=null,this.nameShared=!1,this.currentUrl=null,this.pollTimerId=null,this.abortController=null,this.firstLoadPending=!1,this.onNameShared=t=>{const s=this.nameShared;this.nameShared=t,t?this.errors.addOrReplace({id:"ERR_name",type:"error",message:`name: "${this.name}" is used by more than one dataset or datasource.`}):(this.errors.remove("ERR_name"),s&&this.reload())},this.holdStatus=c(this),this.errors=d(this),((s,i)=>{let e,h=[],r=[];const l=t=>{let s;try{s=e.db.db.exec(`SELECT * FROM \`${t}\``)}catch(t){s=[]}i()},c=()=>{h.forEach((t=>t())),h=[],r.forEach((t=>{t&&(h.push(e.db.subscribe(t,(()=>l(t)))),l(t))}))},u=new MutationObserver((i=>{i.forEach((i=>{"datasources"===i.attributeName&&(r=(t(s).getAttribute("datasources")||"").split(","),c())}))})),d=s.connectedCallback;s.connectedCallback=()=>{const i=t(s);e=n(i),r=(i.getAttribute("datasources")||"").split(","),c(),u.observe(i,{attributes:!0,attributeFilter:["datasources"]}),a(d,s)};const f=s.disconnectedCallback;s.disconnectedCallback=()=>{u.disconnect(),h.forEach((t=>t())),h=[],o(t(s)),a(f,s)}})(this,(()=>{this.executeQuery()})),u(this,(t=>this.sync(t)))}sync(t){if(this.stores=n(this.element),!this.releaseName&&this.name&&(this.releaseName=this.stores.db.claim(this.name,this.onNameShared)),this.src){if(this.src===this.currentUrl)return;return this.currentUrl=this.src,this.lastBodyHash=null,this.query="",this.errors.remove("ERR_sql"),this.errors.remove("ERR_body"),this.firstLoadPending=!0,this.holdStatus(this.fetchAndStore(this.src)),void this.startPolling()}let s,i;if(null!==this.currentUrl&&(this.cancelInFlight(),this.currentUrl=null),this.errors.remove("ERR_src"),!this.raw&&this.static&&""!==t.trim())try{const e=f(t);s=e.hash,i=e.json}catch(t){return this.errors.addOrReplace({id:"ERR_body",type:"error",message:"Body: "+y(t)}),void(this.lastBodyHash=null)}else s=m(t),i=t;s!==this.lastBodyHash&&(this.lastBodyHash=s,this.errors.remove("ERR_body"),this.query=i,this.executeQuery())}executeQuery(){var t,s;if(this.stores||(this.stores=n(this.element)),this.query||this.errors.remove("ERR_sql"),!this.name)return;if(!(this.query||this.static&&null===this.currentUrl))return;const i=this.stores.db.db;let e;if(this.static){try{e=""===this.query.trim()?[]:null!==(t=JSON.parse(this.query))&&void 0!==t?t:[],Array.isArray(e)?this.errors.remove("ERR_body"):this.errors.addOrReplace({id:"ERR_body",type:"error",message:"Body: not a JSON array."})}catch(t){this.errors.addOrReplace({id:"ERR_body",type:"error",message:"Body: "+y(t)}),e=[]}i.tables[this.name]={data:Array.isArray(e)?e:[]},this.registered=i.tables[this.name],this.dropViewStatements(),this.errors.remove("ERR_sql")}else{if(this.lastViewQuery!==this.query){try{i.exec(`DROP VIEW \`${this.name}\``)}catch(t){}null!=i.tables[this.name]&&delete i.tables[this.name],i.views&&null!=i.views[this.name]&&delete i.views[this.name];try{if(l(this.query))throw Error("double backticks are not allowed.");i.exec(`CREATE VIEW \`${this.name}\` AS ${this.query}`),this.registered=i.tables[this.name],i.resetSqlCache(),this.lastViewQuery=this.query}catch(t){return console.error("bn-dataset: failed to register SQL view",t,this.query),this.errors.addOrReplace({id:"ERR_sql",type:"error",message:"SQL: "+(t instanceof Error?t.message:t)}),i.resetSqlCache(),this.lastViewQuery=null,e=[],void this.publish(e)}}else null===(s=i.tables[this.name])||void 0===s||delete s.select;try{e=i.exec(`SELECT * FROM \`${this.name}\``),this.errors.remove("ERR_sql")}catch(t){if(void 0===this.latestResult)return;return this.errors.addOrReplace({id:"ERR_sql",type:"error",message:"SQL: "+(t instanceof Error?t.message:t)}),void this.publish([])}}this.publish(e)}publish(t){this.latestResult!==t?(this.latestResult=t,this.stores.db.notify(this.name),this.publishedMeta=function(t){const s={};for(const t of p)s[t]=new Set;const i={};for(const t of v)i[t]={hasData:!1,min:null,max:null};const e=new Set;let h=null,r=null;const n=Array.isArray(t)?t:[];for(let t=0;t<n.length;t++){const o=n[t];if(null==o)continue;for(const t of p){const i=o[t];null!=i&&""!==i&&s[t].add(i+"")}for(const t of v){const s=o[t];if(R(s)){const e=i[t];e.hasData=!0,(null===e.min||s<e.min)&&(e.min=s),(null===e.max||s>e.max)&&(e.max=s)}}const l=o.date;if(null!=l&&""!==l){const t=l+"";e.add(t),(null===h||t<h)&&(h=t),(null===r||t>r)&&(r=t)}}const o=v.map((t=>({key:t,hasData:i[t].hasData,min:i[t].min,max:i[t].max}))),l=o.filter((t=>t.hasData)).map((t=>t.key)),a=E(s.rowGroup),c=E(s.category),u=E(s.subCategory),d=E(s.columnGroup),f=E(s.columnSubGroup),m={min:h,max:r,hasData:e.size>0,distinctCount:e.size};let y="category";return u.hasData?y="subCategory":c.hasData?y="category":a.hasData&&(y="rowGroup"),{rowCount:n.length,scenarios:o,availableScenarios:l,rowGroup:a,category:c,subCategory:u,columnGroup:d,columnSubGroup:f,dateRange:m,suggestedLevel:y,suggestedOrder:y,suggestedDateInterval:m.hasData?"auto":null,calculatedAt:Date.now()}}(t),this.stores.datasetsMeta.set(this.name,this.publishedMeta)):this.stores.db.notify(this.name)}nameUpdated(t,s){var i;this.unregister(s),this.name&&this.element.isConnected&&this.sync(null!==(i=this.element.textContent)&&void 0!==i?i:"")}onIntervalChange(){this.currentUrl&&this.startPolling()}onSrcChange(){var t;this.element.isConnected&&this.sync(null!==(t=this.element.textContent)&&void 0!==t?t:"")}disconnectedCallback(){this.cancelInFlight(),this.unregister(this.name)}unregister(t){var s,i,e;const h=null===(i=null===(s=this.stores)||void 0===s?void 0:s.db)||void 0===i?void 0:i.db;h&&null!==this.lastViewQuery&&h.resetSqlCache(),null===(e=this.releaseName)||void 0===e||e.call(this),this.releaseName=void 0;const r=null!=(null==h?void 0:h.tables[t])&&h.tables[t]!==this.registered;if(r&&void 0!==this.publishedMeta&&this.stores.datasetsMeta.get(t)===this.publishedMeta&&this.stores.datasetsMeta.set(t,null),this.publishedMeta=void 0,this.registered=void 0,this.lastBodyHash=null,this.lastViewQuery=null,this.currentUrl=null,this.latestResult=void 0,h&&t&&!r){try{h.exec(`DROP VIEW \`${t}\``)}catch(t){}null!=h.tables[t]&&delete h.tables[t],h.views&&null!=h.views[t]&&delete h.views[t],this.stores.datasetsMeta.set(t,null),this.stores.db.notify(t)}}async fetchAndStore(t){var s,i;null===(s=this.abortController)||void 0===s||s.abort(),this.abortController=new AbortController,this.stores||(this.stores=n(this.element));try{const s=await fetch(t,{signal:this.abortController.signal});if(!s.ok)throw Error("HTTP "+s.status);const e=null!==(i=await s.json())&&void 0!==i?i:[];if(!Array.isArray(e))throw Error("not a JSON array.");const h=this.stores.db.db;h.tables[this.name]={data:e},this.registered=h.tables[this.name],this.dropViewStatements(),this.errors.remove("ERR_src"),this.publish(e)}catch(t){if(t instanceof DOMException&&"AbortError"===t.name)return;this.errors.addOrReplace({id:"ERR_src",type:"error",message:"src: "+y(t)});const s=this.stores.db.db;s.tables[this.name]={data:[]},this.registered=s.tables[this.name],this.dropViewStatements(),this.publish([])}this.firstLoadPending=!1}reload(){var t;null!==this.lastViewQuery&&this.stores.db.db.resetSqlCache(),this.lastBodyHash=null,this.lastViewQuery=null,this.currentUrl=null,this.latestResult=void 0,this.sync(null!==(t=this.element.textContent)&&void 0!==t?t:"")}dropViewStatements(){null!==this.lastViewQuery&&this.stores.db.db.resetSqlCache(),this.lastViewQuery=null}clearPollTimer(){null!==this.pollTimerId&&(clearInterval(this.pollTimerId),this.pollTimerId=null)}cancelInFlight(){var t;this.clearPollTimer(),null===(t=this.abortController)||void 0===t||t.abort(),this.abortController=null}startPolling(){this.clearPollTimer(),this.currentUrl&&this.interval>0&&(this.pollTimerId=setInterval((()=>{this.currentUrl&&!this.firstLoadPending&&this.fetchAndStore(this.currentUrl)}),1e3*this.interval))}render(){return e(h,{key:"b1b6c4f25ecbd1f37be510b3b926c22a8193f637"})}get element(){return this}static get watchers(){return{name:[{nameUpdated:0}],interval:[{onIntervalChange:0}],src:[{onSrcChange:0}]}}static get style(){return"bn-dataset{display:none}"}},[0,"bn-dataset",{name:[1],datasources:[1],static:[4],raw:[4],interval:[2],src:[1]},void 0,{name:[{nameUpdated:0}],interval:[{onIntervalChange:0}],src:[{onSrcChange:0}]}]),b=g,w=function(){"undefined"!=typeof customElements&&["bn-dataset"].forEach((t=>{"bn-dataset"===t&&(customElements.get(r(t))||customElements.define(r(t),g))}))};export{b as BnDataset,w as defineCustomElement}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{proxyCustomElement as t,HTMLElement as s,h as i,Host as
|
|
1
|
+
import{proxyCustomElement as t,HTMLElement as s,h as i,Host as h,transformTag as r}from"@stencil/core/internal/client";import{w as e}from"./withBodyObserver.js";import{g as n,c as o}from"./context-protocol.js";import{w as a}from"./withComponentStatus.js";import{w as l}from"./withHasError.js";import{c,d}from"./contentDecoder.js";import{e as u}from"./queryError.js";const m=t(class extends s{constructor(t){super(),!1!==t&&this.__registerHost(),this.raw=!0,this.interval=0,this.lastHash=null,this.nameShared=!1,this.currentUrl=null,this.pollTimerId=null,this.abortController=null,this.firstLoadPending=!1,this.onNameShared=t=>{const s=this.nameShared;this.nameShared=t,t?this.errors.addOrReplace({id:"ERR_name",type:"error",message:`name: "${this.name}" is used by more than one dataset or datasource.`}):(this.errors.remove("ERR_name"),s&&this.reload())},this.holdStatus=a(this),this.errors=l(this),e(this,(t=>this.sync(t)))}sync(t){var s;if(this.stores=n(this.element),!this.releaseName&&this.name&&(this.releaseName=this.stores.db.claim(this.name,this.onNameShared)),this.src){if(this.src===this.currentUrl)return;return this.currentUrl=this.src,this.lastHash=null,this.errors.remove("ERR_body"),this.firstLoadPending=!0,this.holdStatus(this.fetchAndStore(this.src)),void this.startPolling()}null!==this.currentUrl&&(this.cancelInFlight(),this.currentUrl=null),this.errors.remove("ERR_src");try{let i,h;if(this.raw||""===t.trim())i=c(t),h=t;else{const s=d(t);i=s.hash,h=s.json}if(i===this.lastHash)return;this.lastHash=i;const r=""===h.trim()?[]:null!==(s=JSON.parse(h))&&void 0!==s?s:[];Array.isArray(r)?this.errors.remove("ERR_body"):this.errors.addOrReplace({id:"ERR_body",type:"error",message:"Body: not a JSON array."}),this.publish(r)}catch(t){this.lastHash=null,this.errors.addOrReplace({id:"ERR_body",type:"error",message:"Body: "+u(t)}),this.publish([])}}reload(){var t;this.lastHash=null,this.currentUrl=null,this.sync(null!==(t=this.element.textContent)&&void 0!==t?t:"")}publish(t){const s=this.stores.db.db;s.tables[this.name]={data:Array.isArray(t)?t:[]},this.registered=s.tables[this.name],this.stores.db.notify(this.name)}onIntervalChange(){this.currentUrl&&this.startPolling()}onSrcChange(){var t;this.element.isConnected&&this.sync(null!==(t=this.element.textContent)&&void 0!==t?t:"")}nameUpdated(t,s){var i;this.unregister(s),this.name&&this.element.isConnected&&this.sync(null!==(i=this.element.textContent)&&void 0!==i?i:"")}disconnectedCallback(){this.cancelInFlight(),this.unregister(this.name),o(this.element)}unregister(t){var s,i,h;null===(s=this.releaseName)||void 0===s||s.call(this),this.releaseName=void 0,this.lastHash=null,this.currentUrl=null;const r=null===(h=null===(i=this.stores)||void 0===i?void 0:i.db)||void 0===h?void 0:h.db,e=null!=(null==r?void 0:r.tables[t])&&r.tables[t]!==this.registered;this.registered=void 0,r&&t&&!e&&(null!=r.tables[t]&&delete r.tables[t],r.views&&null!=r.views[t]&&delete r.views[t],this.stores.db.notify(t))}async fetchAndStore(t){var s,i;null===(s=this.abortController)||void 0===s||s.abort(),this.abortController=new AbortController,this.stores||(this.stores=n(this.element));try{const s=await fetch(t,{signal:this.abortController.signal});if(!s.ok)throw Error("HTTP "+s.status);const h=null!==(i=await s.json())&&void 0!==i?i:[];if(!Array.isArray(h))throw Error("not a JSON array.");this.errors.remove("ERR_src"),this.publish(h)}catch(t){if(t instanceof DOMException&&"AbortError"===t.name)return;this.errors.addOrReplace({id:"ERR_src",type:"error",message:"src: "+u(t)}),this.publish([])}this.firstLoadPending=!1}clearPollTimer(){null!==this.pollTimerId&&(clearInterval(this.pollTimerId),this.pollTimerId=null)}cancelInFlight(){var t;this.clearPollTimer(),null===(t=this.abortController)||void 0===t||t.abort(),this.abortController=null}startPolling(){this.clearPollTimer(),this.currentUrl&&this.interval>0&&(this.pollTimerId=setInterval((()=>{this.currentUrl&&!this.firstLoadPending&&this.fetchAndStore(this.currentUrl)}),1e3*this.interval))}render(){return i(h,{key:"4e164358c873601f39332f5d35d14a1ad5f66f73"})}get element(){return this}static get watchers(){return{interval:[{onIntervalChange:0}],src:[{onSrcChange:0}],name:[{nameUpdated:0}]}}static get style(){return"bn-datasource{display:none}"}},[0,"bn-datasource",{name:[1],raw:[4],interval:[2],src:[1]},void 0,{interval:[{onIntervalChange:0}],src:[{onSrcChange:0}],name:[{nameUpdated:0}]}]),v=m,y=function(){"undefined"!=typeof customElements&&["bn-datasource"].forEach((t=>{"bn-datasource"===t&&(customElements.get(r(t))||customElements.define(r(t),m))}))};export{v as BnDatasource,y as defineCustomElement}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{proxyCustomElement as
|
|
1
|
+
import{proxyCustomElement as t,HTMLElement as e,h as i,Host as s,getAssetPath as n,transformTag as o}from"@stencil/core/internal/client";import{w as r}from"./withComponentStatus.js";import{w as a}from"./withComponentStyle.js";import{w as d}from"./withHasError.js";const f=t(class extends e{constructor(t){super(),!1!==t&&this.__registerHost(),this.__attachShadow(),this.pageNumber=null,this.displayPageNumber=!0,r(this),this.errors=d(this),this.componentStyle=a(this)}getFontStyles(){return this.componentStyle((t=>{var e,i,s,n;return{"--bn-font-family":(null===(e=t.global)||void 0===e?void 0:e.fontFamily)||"'Noto Sans', sans-serif","--bn-font-size":`${(null===(i=t.global)||void 0===i?void 0:i.fontSizePx)||13.3333}px`,"--bn-font-color":(null===(s=t.global)||void 0===s?void 0:s.fontColor)||"#000000","--bn-font-background":(null===(n=t.global)||void 0===n?void 0:n.fontBackgroundColor)||"#ffffff"}}))}isValidHttpUrl(t){let e;try{e=new URL(t)}catch(t){return!1}return"http:"===e.protocol||"https:"===e.protocol}prepareAssetUrl(t){return this.isValidHttpUrl(t)?t:`./assets/${t}.png`}render(){return i(s,{key:"8751cf4e338d54605350f06743956689eb4286ce",id:this.displayPageNumber||this.text||this.code?"container-page-footer":"container",style:this.getFontStyles()},i("div",{key:"7a9fb20453df0db4755d90c00043fff4c262eda2",id:"footer-text"},null!=this.text?i("span",{class:"note"},this.text):""),i("div",{key:"7ef166a4d0d48b1fb5cceb7e79ca678c4c4e0d63",id:"code"},null!=this.code?i("img",{class:"image",src:n(`${this.prepareAssetUrl(this.code)}`)}):""),i("div",{key:"bf74b278f43540612327e03539278f7fa35996f1",id:"page-number"},this.displayPageNumber?i("span",{class:"page"},this.pageNumber):""))}static get assetsDirs(){return["assets"]}get element(){return this}static get style(){return':host{padding:0.2em 0.5em;display:flex;flex-direction:row;justify-content:space-between;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(#container-page-footer){box-sizing:border-box;-webkit-box-sizing:border-box;border-top:0.1em solid #ddd}div#footer-text{font-size:0.6em;display:inline}div#code{flex:1;display:inline;text-align:right;padding-right:1em}div#page-number{font-size:0.6em;display:inline}.image{z-index:2;background-color:transparent;border:transparent;height:1.2em;width:auto}'}},[1,"bn-footer",{pageNumber:[1025,"page-number"],text:[1025],code:[1025],displayPageNumber:[4,"display-page-number"]}]);function l(){"undefined"!=typeof customElements&&["bn-footer"].forEach((t=>{"bn-footer"===t&&(customElements.get(o(t))||customElements.define(o(t),f))}))}export{f as F,l as d}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{proxyCustomElement as e,HTMLElement as t,h as i,Host as r,transformTag as o}from"@stencil/core/internal/client";import{l as s}from"./validate.js";import{L as d}from"./types.js";import{o as n,m as a}from"./geometry.js";import{r as l,a as h}from"./diagnostics.js";import{w as u
|
|
1
|
+
import{proxyCustomElement as e,HTMLElement as t,h as i,Host as r,transformTag as o}from"@stencil/core/internal/client";import{l as s}from"./validate.js";import{L as d}from"./types.js";import{o as n,m as a}from"./geometry.js";import{r as l,a as h}from"./diagnostics.js";import{w as u}from"./withComponentStatus.js";import{w as c}from"./withStyled.js";import{w as m}from"./withComponentStyle.js";import{w as v}from"./withHasError.js";function g(e){if(!e||""===e.trim()||"[]"===e)return[];try{const t=JSON.parse(e);return Array.isArray(t)?t.map(((e,t)=>{var i,r,o;return"string"==typeof e?{label:e,id:t+""}:"object"==typeof e&&null!==e?{label:null!==(r=null!==(i=e.label)&&void 0!==i?i:e.name)&&void 0!==r?r:t+"",id:null!==(o=e.id)&&void 0!==o?o:t+""}:{label:e+"",id:t+""}})):[]}catch(e){return console.error("parseHeaders: failed to parse JSON",e),[]}}function w(e){if(!e||""===e.trim()||"[]"===e)return[];try{const t=JSON.parse(e);if(!Array.isArray(t))return["Headers must be an array"];const i=[],r=new Set;return t.forEach(((e,t)=>{"object"==typeof e&&null!==e&&void 0!==e.id&&("string"!=typeof e.id?i.push(`Header[${t}]: 'id' must be a string`):r.has(e.id)?i.push(`Header[${t}]: duplicate id '${e.id}'`):r.add(e.id),void 0!==e.label&&"string"!=typeof e.label&&i.push(`Header[${t}]: 'label' must be a string`))})),i}catch(e){return console.error("validateHeadersJson: failed to parse JSON",e),["Invalid JSON structure"]}}const p=e(class extends t{validateRowHeaders(e){const t="ERR_rowHeaders",i=w(e);i.length>0?this.errors.addOrReplace({id:t,type:"error",message:"row-headers: "+i.join("; ")}):this.errors.remove(t),this.updateGridConfig()}validateColumnHeaders(e){const t="ERR_columnHeaders",i=w(e);i.length>0?this.errors.addOrReplace({id:t,type:"error",message:"column-headers: "+i.join("; ")}):this.errors.remove(t),this.updateGridConfig()}validateShowRowHeaders(e){const t="ERR_showRowHeaders";s(e)?this.errors.remove(t):this.errors.addOrReplace({id:t,type:"warning",message:`show-row-headers: invalid value '${e}', must be 'true' or 'false'`})}validateShowColumnHeaders(e){const t="ERR_showColumnHeaders";s(e)?this.errors.remove(t):this.errors.addOrReplace({id:t,type:"warning",message:`show-column-headers: invalid value '${e}', must be 'true' or 'false'`})}validateShowBorders(e){const t="ERR_showBorders";s(e)?this.errors.remove(t):this.errors.addOrReplace({id:t,type:"warning",message:`show-borders: invalid value '${e}', must be 'true' or 'false'`})}constructor(e){super(),!1!==e&&this.__registerHost(),this.__attachShadow(),this.gridConfig={rows:[],columns:[]},this.chartTitle="",this.rowHeaders="[]",this.columnHeaders="[]",this.showRowHeaders="true",this.showColumnHeaders="true",this.showBorders="true",this.rowHeaderWidth="auto",this.cellGap="0px",c(this),u(this),this.errors=v(this),this.componentStyle=m(this)}async getLayoutState(e){var t,i,r,o;const s=null!==(t=null==e?void 0:e.detail)&&void 0!==t?t:"summary",u=n(this.element),c=this.componentStyle((e=>{var t;return(null===(t=e.global)||void 0===t?void 0:t.fontSizePx)||13.3333})),{rows:m,columns:v}=this.gridConfig,g={version:d,tag:this.element.localName,id:h(this.element),slot:null!==(i=this.element.getAttribute("slot"))&&void 0!==i?i:void 0,rect:a(this.element,u),em:{fontSizePx:c,appliedScaleFactor:1},regions:[],metadata:{title:this.chartTitle||void 0,rowCount:m.length,columnCount:v.length,cellCount:m.length*v.length},diagnostics:l(this.element)},w=null===(r=this.element.shadowRoot)||void 0===r?void 0:r.querySelector(".grid-container");if(w&&g.regions.push({id:"grid",rect:a(w,u)}),"full"!==s||!w)return g;const p=[],f=e=>p.push(e),b=w.querySelector(".grid-title");return b&&f({kind:"gridTitle",label:(null===(o=b.textContent)||void 0===o?void 0:o.trim())||void 0,rect:a(b,u)}),w.querySelectorAll(".grid-header-col").forEach(((e,t)=>{var i,r;f({kind:"gridHeader",columnId:null===(i=v[t])||void 0===i?void 0:i.id,label:(null===(r=e.textContent)||void 0===r?void 0:r.trim())||void 0,rect:a(e,u)})})),w.querySelectorAll(".grid-header-row").forEach(((e,t)=>{var i,r;f({kind:"gridHeader",rowId:null===(i=m[t])||void 0===i?void 0:i.id,label:(null===(r=e.textContent)||void 0===r?void 0:r.trim())||void 0,rect:a(e,u)})})),w.querySelectorAll(".grid-cell").forEach(((e,t)=>{var i,r,o,s;f({kind:"gridCell",rowId:v.length>0?null===(i=m[Math.floor(t/v.length)])||void 0===i?void 0:i.id:void 0,columnId:v.length>0?null===(r=v[t%v.length])||void 0===r?void 0:r.id:void 0,slot:null!==(s=null===(o=e.querySelector("slot"))||void 0===o?void 0:o.getAttribute("name"))&&void 0!==s?s:void 0,rect:a(e,u)})})),g.elements=p,g}getGridStyle(){return this.componentStyle((e=>e["bn-grid"]))}componentWillLoad(){this.validateRowHeaders(this.rowHeaders),this.validateColumnHeaders(this.columnHeaders),this.validateShowRowHeaders(this.showRowHeaders),this.validateShowColumnHeaders(this.showColumnHeaders),this.validateShowBorders(this.showBorders)}updateGridConfig(){this.gridConfig=function(e,t){return{rows:g(e),columns:g(t)}}(this.rowHeaders,this.columnHeaders)}shouldShowRowHeaders(){return"true"===this.showRowHeaders&&this.gridConfig.rows.length>0}shouldShowColumnHeaders(){return"true"===this.showColumnHeaders&&this.gridConfig.columns.length>0}shouldShowBorders(){return"true"===this.showBorders}getGridTemplateColumns(){const e=[];this.shouldShowRowHeaders()&&e.push(this.rowHeaderWidth);const t=this.gridConfig.columns.length||1;for(let i=0;i<t;i++)e.push("auto");return e.join(" ")}getGridTemplateRows(){const e=[];this.chartTitle&&e.push("auto"),this.shouldShowColumnHeaders()&&e.push("auto");const t=this.gridConfig.rows.length||1;for(let i=0;i<t;i++)e.push("auto");return e.join(" ")}renderTitle(){if(!this.chartTitle)return null;const e=(this.shouldShowRowHeaders()?1:0)+this.gridConfig.columns.length;return i("div",{class:"grid-title",style:{"grid-column":"1 / span "+e,"grid-row":"1"}},this.chartTitle)}renderColumnHeaders(){if(!this.shouldShowColumnHeaders())return null;const e=this.getGridStyle(),t=this.shouldShowBorders()?`${e.borderWidth}px solid ${e.borderColor}`:"none",r=this.shouldShowRowHeaders()?2:1,o=this.chartTitle?2:1;return this.gridConfig.columns.map(((s,d)=>{const n=d>0;return i("div",{key:"col-header-"+s.id,class:"grid-header grid-header-col",style:{"grid-column":r+d+"","grid-row":o+"","border-left":n?t:"none",padding:e.cellPadding+"px","padding-left":n?e.cellPadding+4+"px":e.cellPadding+"px"}},s.label)}))}renderDataCells(){const e=this.getGridStyle(),t=this.shouldShowBorders()?`${e.borderWidth}px solid ${e.borderColor}`:"none",r=this.shouldShowRowHeaders()?2:1,o=(this.chartTitle?1:0)+(this.shouldShowColumnHeaders()?1:0)+1,s=[];return this.gridConfig.rows.length>0&&this.gridConfig.columns.length>0&&this.gridConfig.rows.forEach(((d,n)=>{if(this.shouldShowRowHeaders()){const r=n>0;s.push(i("div",{key:"row-header-"+d.id,class:"grid-header grid-header-row",style:{"grid-column":"1","grid-row":o+n+"","border-top":r?t:"none",padding:e.cellPadding+"px","padding-top":r?e.cellPadding+4+"px":e.cellPadding+"px"}},d.label))}this.gridConfig.columns.forEach(((a,l)=>{const h=function(e,t){return`${e.id}-${t.id}`}(d,a),u=l>0,c=n>0;s.push(i("div",{key:"cell-"+h,class:"grid-cell",style:{"grid-column":r+l+"","grid-row":o+n+"","border-left":u?t:"none","border-top":c?t:"none","padding-left":u?e.cellPadding+4+"px":"0","padding-top":c?e.cellPadding+4+"px":"0"}},i("slot",{name:h})))}))})),s}getFontStyles(){return this.componentStyle((e=>{var t,i,r,o;return{"--bn-font-family":(null===(t=e.global)||void 0===t?void 0:t.fontFamily)||"'Noto Sans', sans-serif","--bn-font-size":((null===(i=e.global)||void 0===i?void 0:i.fontSizePx)||13.3333)+"px","--bn-font-color":(null===(r=e.global)||void 0===r?void 0:r.fontColor)||"#000000","--bn-font-background":(null===(o=e.global)||void 0===o?void 0:o.fontBackgroundColor)||"#ffffff"}}))}render(){const e={display:"inline-grid","grid-template-columns":this.getGridTemplateColumns(),"grid-template-rows":this.getGridTemplateRows(),gap:this.cellGap};return i(r,{key:"5d23af570a5b4640c4e6cf6bcb74bb67485b73ee",style:this.getFontStyles()},i("div",{key:"75bcd69b8dc77e5d8c0c44410c49fe7ea9f6b702",class:"grid-container",style:e},this.renderTitle(),this.renderColumnHeaders(),this.renderDataCells()),i("slot",{key:"3127e96c863a8e79af76b3ee16050cfcec5bee8d"}))}get element(){return this}static get watchers(){return{rowHeaders:[{validateRowHeaders:0}],columnHeaders:[{validateColumnHeaders:0}],showRowHeaders:[{validateShowRowHeaders:0}],showColumnHeaders:[{validateShowColumnHeaders:0}],showBorders:[{validateShowBorders:0}]}}static get style(){return':host{display:inline-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)}.grid-container{display:inline-grid;box-sizing:border-box}.grid-title{font-weight:normal;padding-bottom:8px}.grid-header{display:flex;align-items:flex-end;box-sizing:border-box}.grid-header-row{justify-content:flex-end;padding-right:8px}.grid-header-col{white-space:nowrap;justify-content:flex-start}.grid-cell{position:relative;box-sizing:border-box}'}},[257,"bn-grid",{chartTitle:[1,"chart-title"],rowHeaders:[1,"row-headers"],columnHeaders:[1,"column-headers"],showRowHeaders:[1,"show-row-headers"],showColumnHeaders:[1,"show-column-headers"],i18nNamespace:[513,"i18n-namespace"],showBorders:[1,"show-borders"],rowHeaderWidth:[1,"row-header-width"],cellGap:[1,"cell-gap"],gridConfig:[32],getLayoutState:[64]},void 0,{rowHeaders:[{validateRowHeaders:0}],columnHeaders:[{validateColumnHeaders:0}],showRowHeaders:[{validateShowRowHeaders:0}],showColumnHeaders:[{validateShowColumnHeaders:0}],showBorders:[{validateShowBorders:0}]}]),f=p,b=function(){"undefined"!=typeof customElements&&["bn-grid"].forEach((e=>{"bn-grid"===e&&(customElements.get(o(e))||customElements.define(o(e),p))}))};export{f as BnGrid,b as defineCustomElement}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{proxyCustomElement as t,HTMLElement as e,h as s,Host as i,transformTag as o}from"@stencil/core/internal/client";import{w as n}from"./withStyled.js";import{w as r
|
|
1
|
+
import{proxyCustomElement as t,HTMLElement as e,h as s,Host as i,transformTag as o}from"@stencil/core/internal/client";import{w as n}from"./withStyled.js";import{w as r}from"./withComponentStatus.js";import{w as l}from"./withComponentStyle.js";import{g as a}from"./context-protocol.js";import{w as m}from"./withHasError.js";const f=t(class extends e{constructor(t){super(),!1!==t&&this.__registerHost(),this.__attachShadow(),n(this),r(this),this.errors=m(this),this.componentStyle=l(this)}connectedCallback(){this.stores=a(this.element)}getFontStyles(){return this.componentStyle((t=>{var e,s,i,o;return{"--bn-font-family":(null===(e=t.global)||void 0===e?void 0:e.fontFamily)||"'Noto Sans', sans-serif","--bn-font-size":((null===(s=t.global)||void 0===s?void 0:s.fontSizePx)||13.3333)+"px","--bn-font-color":(null===(i=t.global)||void 0===i?void 0:i.fontColor)||"#000000","--bn-font-background":(null===(o=t.global)||void 0===o?void 0:o.fontBackgroundColor)||"#ffffff"}}))}prepareAssetUrl(t){if(null==t||""===t)return"";const e=this.stores.assets.state;return t.startsWith("asset:")?e[t.substring(6)]:e[t]||t}render(){return s(i,{key:"cfa7e1b2978773f449f6596174edf51e4a61d4d7",style:this.getFontStyles()},null!=this.source&&""!==this.source?s("img",{src:this.prepareAssetUrl(this.source)}):"")}get element(){return this}static get style(){return":host{display:inline-block;position:relative;overflow:hidden}img{max-width:100%;height:auto}"}},[1,"bn-image",{source:[1]}]),h=f,c=function(){"undefined"!=typeof customElements&&["bn-image"].forEach((t=>{"bn-image"===t&&(customElements.get(o(t))||customElements.define(o(t),f))}))};export{h as BnImage,c as defineCustomElement}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{proxyCustomElement as t,HTMLElement as e,h as s,Host as
|
|
1
|
+
import{proxyCustomElement as t,HTMLElement as e,h as s,Host as o,transformTag as i}from"@stencil/core/internal/client";import{w as r}from"./withBodyObserver.js";import{g as n,b as a}from"./context-protocol.js";import{e as c}from"./queryError.js";import{w as m}from"./withComponentStatus.js";import{w as h}from"./withHasError.js";const l=t(class extends e{constructor(t){super(),!1!==t&&this.__registerHost(),this.namespace="_system",m(this),this.errors=h(this),r(this,(t=>{if(this.stores||(this.stores=n(this.element)),""!==t.trim())try{const e=JSON.parse(t);if(null===e||"object"!=typeof e||Array.isArray(e))throw Error("not a JSON object.");const s=a(e),o=this.namespace||"_system",i=Object.assign({},this.stores.internationalization.get(o));i[this.code]=Object.assign(Object.assign({},i[this.code]),s),this.stores.internationalization.set(o,i),this.errors.remove("ERR_body")}catch(t){this.errors.addOrReplace({id:"ERR_body",type:"error",message:"Body: "+c(t)})}else this.errors.remove("ERR_body")}))}render(){return s(o,{key:"9b45d8f87b99238f5a83d9a3c231d10de8e53acf"})}get element(){return this}static get style(){return"bn-internationalization{display:none}"}},[0,"bn-internationalization",{code:[1],namespace:[1]}]),b=l,d=function(){"undefined"!=typeof customElements&&["bn-internationalization"].forEach((t=>{"bn-internationalization"===t&&(customElements.get(i(t))||customElements.define(i(t),l))}))};export{b as BnInternationalization,d as defineCustomElement}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{proxyCustomElement as t,HTMLElement as e,h as
|
|
1
|
+
import{proxyCustomElement as t,HTMLElement as e,h as s,Fragment as i,transformTag as r}from"@stencil/core/internal/client";import{g as a}from"./context-protocol.js";import{w as o}from"./withComponentStatus.js";import{w as n}from"./withHasError.js";import{a as l}from"./withTranslation.js";import{t as c,a as d,b as m,c as h,C as u,d as b}from"./layoutTemplate.js";import{d as p}from"./bn-body2.js";import{d as f}from"./bn-card2.js";import{d as y}from"./bn-footer2.js";import{d as g}from"./bn-title2.js";import{d as k}from"./ibcs-title2.js";const w=t(class extends e{constructor(t){super(),!1!==t&&this.__registerHost(),this.__attachShadow(),this.titleImage="",this.titleBusinessUnit="",this.titleOrder="category",this.titleOrderDirection="asc",this.titleDateFormat="none",this.titleDateLink="none",this.footerText="",this.cardLayout="full",this.cardCustomTemplate='"a b" "c d"',this.cardGridGap="0",this.cardFitToContent=!1,this.cardShowBorder=!0,o(this),this.errors=n(this),this.resolveInherited=l(this,[{propName:"titleScenarios",ancestorAttr:"title-scenarios"},{propName:"titleVariances",ancestorAttr:"title-variances"},{propName:"titleOrder",ancestorAttr:"title-order"},{propName:"titleOrderDirection",ancestorAttr:"title-order-direction"},{propName:"ruleset",ancestorAttr:"ruleset"}])}connectedCallback(){this.stores=a(this.element)}getCommonStyles(){let t="100%";return!0===this.cardFitToContent&&(t="fit-content"),{display:"grid",height:t,width:"100%",gap:this.cardGridGap+"px"}}getGridTemplateColumns(t){return c(this.getTemplatePattern(t))}getRowCount(t){return d(this.getTemplatePattern(t)).length||1}getGridTemplateRows(t){const e=this.getRowCount(t);return this.cardFitToContent?Array(e).fill("auto").join(" "):Array(e).fill("minmax(0, 1fr)").join(" ")}getLayoutStyle(){return Object.assign(Object.assign({},this.getCommonStyles()),{"grid-template-areas":this.getTemplatePattern(this.cardLayout),"grid-template-columns":this.getGridTemplateColumns(this.cardLayout),"grid-template-rows":this.getGridTemplateRows(this.cardLayout)})}createDivAreaStyles(t){return t.map((t=>({display:"flex",overflow:"hidden","grid-area":t})))}getSlots(t){const e=this.createDivAreaStyles(t);return s(i,null,e.map(((t,e)=>s("div",{style:t},s("slot",{name:"card-slot-"+e})))))}extractSlotNames(t){return m(t)}getTemplatePattern(t){return h(t,this.cardCustomTemplate)}async getNumberOfSlot(t){const e=this.getTemplatePattern(t);return this.extractSlotNames(e).length}componentWillRender(){const t=this.cardLayout===u?b(this.cardCustomTemplate):void 0;t?this.errors.addOrReplace({id:"ERR_cardCustomTemplate",type:"warning",message:"cardCustomTemplate: "+t}):this.errors.remove("ERR_cardCustomTemplate")}setCardClass(){return!0===this.cardShowBorder?"card_box border":"card_box"}titleProp(t){return this.resolveInherited(t,this[t],"").value}prepareTitleImage(t){if(null==t||""===t)return"";const e=this.stores.assets.state;return t.startsWith("asset:")?e[t.substring(6)]:e[t]||t}render(){var t;const e=this.getLayoutStyle(),i=this.extractSlotNames(e["grid-template-areas"]);return s("bn-card",{key:"5356123d5ccb6a4d201b19f27b739d2e3738654c",styles:this.styles,"selected-style":this.selectedStyle,class:this.setCardClass()},s("div",{key:"2847a91836d59929ce6c14d934ec20f408159b0e",class:"cardtitle"},s("bn-title",{key:"54a7d3136ef39c616319001bf10575be3de787e6","i18n-namespace":null!==(t=this.i18nNamespace)&&void 0!==t?t:this.titleNamespace,ruleset:this.titleProp("ruleset"),"business-unit":this.titleBusinessUnit,scenarios:this.titleProp("titleScenarios"),variances:this.titleProp("titleVariances"),order:this.titleProp("titleOrder"),"order-direction":this.titleProp("titleOrderDirection"),measures:this.titleMeasures,"date-start":this.titleDateStart,"date-end":this.titleDateEnd,"date-format":this.titleDateFormat,"date-link":this.titleDateLink}),null!=this.titleImage&&""!==this.titleImage?s("img",{class:"image",src:this.prepareTitleImage(this.titleImage)}):""),s("bn-body",{key:"6109186cc1d27c73b38a5fd08db72373e0e147c4"},s("div",{key:"673e56a5d2a313a968c4d4e52e697f1f8590f265",style:e,"data-bn-fit-content":this.cardFitToContent?this.getRowCount(this.cardLayout)+"":null},this.getSlots(i))),s("bn-footer",{key:"d7788950df85f3babff77294ccadb6ea72490192",text:this.footerText,"page-number":"0","display-page-number":"false"}))}get element(){return this}static get style(){return':host{background:var(--bn-font-background, white);color:var(--bn-font-color, black);font-family:var(--bn-font-family, "Noto Sans", sans-serif);font-size:var(--bn-font-size, 13.3333px);display:flex;flex-direction:column;width:100%;height:100%;overflow:hidden}.cardtitle{display:inline-flex}::slotted(*){flex:1 1 auto;min-width:0}.image{margin-right:0.5em;margin-top:0.5em;z-index:2;background-color:transparent;border:transparent;height:4em;width:auto;display:inline}'}},[257,"bn-layout-card",{styles:[1],selectedStyle:[1,"selected-style"],ruleset:[1],titleImage:[1,"title-image"],titleBusinessUnit:[1,"title-business-unit"],titleScenarios:[1,"title-scenarios"],titleVariances:[1,"title-variances"],titleOrder:[1,"title-order"],titleOrderDirection:[1,"title-order-direction"],titleMeasures:[1,"title-measures"],titleDateStart:[1,"title-date-start"],titleDateEnd:[1,"title-date-end"],titleDateFormat:[1,"title-date-format"],titleDateLink:[1,"title-date-link"],titleNamespace:[1,"title-namespace"],i18nNamespace:[513,"i18n-namespace"],footerText:[1,"footer-text"],cardLayout:[1,"card-layout"],cardCustomTemplate:[1,"card-custom-template"],cardGridGap:[1,"card-grid-gap"],cardFitToContent:[4,"card-fit-to-content"],cardShowBorder:[4,"card-show-border"],getNumberOfSlot:[64]}]),x=w,v=function(){"undefined"!=typeof customElements&&["bn-layout-card","bn-body","bn-card","bn-footer","bn-title","ibcs-title"].forEach((t=>{switch(t){case"bn-layout-card":customElements.get(r(t))||customElements.define(r(t),w);break;case"bn-body":customElements.get(r(t))||p();break;case"bn-card":customElements.get(r(t))||f();break;case"bn-footer":customElements.get(r(t))||y();break;case"bn-title":customElements.get(r(t))||g();break;case"ibcs-title":customElements.get(r(t))||k()}}))};export{x as BnLayoutCard,v as defineCustomElement}
|