@bino-bi/bn-template-engine 1.0.0-next.28 → 1.0.0-next.30
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-132ad556.entry.js +1 -0
- package/dist/bn-template-engine/p-17d71782.entry.js +1 -0
- package/dist/bn-template-engine/p-40ba7f43.entry.js +1 -0
- package/dist/bn-template-engine/p-467871f3.entry.js +1 -0
- package/dist/bn-template-engine/p-64803a42.entry.js +1 -0
- package/dist/bn-template-engine/p-B8AjeKja.js +1 -0
- package/dist/bn-template-engine/p-CCZcKl0Q.js +2 -0
- package/dist/bn-template-engine/p-CrT83eO4.js +1 -0
- package/dist/bn-template-engine/p-D_DzKxRV.js +1 -0
- package/dist/bn-template-engine/p-Z2rUaSh_.js +1 -0
- package/dist/bn-template-engine/p-c41c0a1b.entry.js +1 -0
- package/dist/bn-template-engine/p-yc69rwuH.js +1 -0
- package/dist/cjs/{bn-asset_28.cjs.entry.js → bn-annotation-layer_30.cjs.entry.js} +27566 -26774
- package/dist/cjs/bn-grid.cjs.entry.js +11 -63
- package/dist/cjs/bn-image.cjs.entry.js +5 -6
- package/dist/cjs/bn-internationalization.cjs.entry.js +11 -7
- package/dist/cjs/bn-ruleset.cjs.entry.js +7 -8
- package/dist/cjs/bn-template-engine.cjs.js +2 -2
- package/dist/cjs/bn-text.cjs.entry.js +18 -18
- package/dist/cjs/{diagnostics-Cq-qDtXq.js → diagnostics-C4Ggts3w.js} +50 -2
- package/dist/cjs/{index-C1Z9vO7z.js → index-DGis1BzT.js} +0 -1
- package/dist/cjs/loader.cjs.js +2 -2
- package/dist/cjs/{withBodyObserver-CaPUjuC5.js → withBodyObserver-BK4idxqG.js} +2 -2
- package/dist/cjs/{context-protocol-C0rKepqu.js → withHasError-CqvcS23z.js} +462 -14
- package/dist/cjs/{withStyled-vSfogp9J.js → withStyled-70D4Isgt.js} +22 -35
- package/dist/cjs/{sanitizeHtml-Yx1xn6i_.js → withTranslation-C6Pye2CM.js} +148 -129
- package/dist/collection/collection-manifest.json +11 -11
- package/dist/collection/components/bn-annotation-layer/bn-annotation-layer.css +24 -0
- package/dist/collection/components/bn-annotation-layer/bn-annotation-layer.js +430 -0
- package/dist/collection/components/bn-annotation-layer/utils/marks.js +161 -0
- package/dist/collection/components/bn-annotation-layer/utils/matchPoint.js +25 -0
- package/dist/collection/components/bn-annotation-list/bn-annotation-list.css +46 -0
- package/dist/collection/components/bn-annotation-list/bn-annotation-list.js +112 -0
- package/dist/collection/components/bn-asset/bn-asset.js +1 -1
- package/dist/collection/components/bn-body/bn-body.js +24 -1
- package/dist/collection/components/bn-card/bn-card.js +24 -1
- package/dist/collection/components/bn-chart-bubble/{ibcs-chart-bubble.js → bn-chart-bubble-renderer/bn-chart-bubble-renderer.js} +153 -59
- package/dist/collection/components/bn-chart-bubble/bn-chart-bubble.js +70 -13
- package/dist/collection/components/bn-chart-bubble/utils/BubbleChart.js +29 -21
- package/dist/collection/components/bn-chart-bullet/{ibcs-chart-bullet.js → bn-chart-bullet-renderer/bn-chart-bullet-renderer.js} +127 -53
- package/dist/collection/components/bn-chart-bullet/bn-chart-bullet.js +83 -20
- package/dist/collection/components/bn-chart-bullet/utils/BulletChart.js +26 -17
- package/dist/collection/components/bn-chart-bullet/utils/model/BulletChartStyle.js +4 -4
- package/dist/collection/components/bn-chart-scatter/{ibcs-chart-scatter.js → bn-chart-scatter-renderer/bn-chart-scatter-renderer.js} +132 -53
- package/dist/collection/components/bn-chart-scatter/bn-chart-scatter.js +69 -12
- package/dist/collection/components/bn-chart-scatter/utils/ScatterChart.js +26 -14
- package/dist/collection/components/bn-chart-structure/{ibcs-chart-structure.js → bn-chart-structure-renderer/bn-chart-structure-renderer.js} +159 -66
- package/dist/collection/components/bn-chart-structure/bn-chart-structure.js +115 -95
- package/dist/collection/components/bn-chart-structure/utils/StructureChart.js +44 -15
- package/dist/collection/components/bn-chart-structure/utils/elements/Axis.js +1 -1
- package/dist/collection/components/bn-chart-structure/utils/elements/Bar.js +6 -2
- package/dist/collection/components/bn-chart-structure/utils/elements/Label.js +11 -0
- package/dist/collection/components/bn-chart-structure/utils/elements/Marker.js +5 -1
- package/dist/collection/components/bn-chart-structure/utils/elements/Needle.js +4 -1
- package/dist/collection/components/bn-chart-structure/utils/elements/StackedBar.js +6 -2
- package/dist/collection/components/bn-chart-time/{ibcs-chart-time.js → bn-chart-time-renderer/bn-chart-time-renderer.js} +188 -150
- package/dist/collection/components/bn-chart-time/bn-chart-time.js +140 -405
- package/dist/collection/components/bn-chart-time/utils/TimeChart.js +55 -15
- package/dist/collection/components/bn-chart-time/utils/elements/Column.js +5 -1
- package/dist/collection/components/bn-chart-time/utils/elements/Label.js +14 -0
- package/dist/collection/components/bn-chart-time/utils/elements/LineSeries.js +18 -12
- package/dist/collection/components/bn-chart-time/utils/elements/Marker.js +5 -1
- package/dist/collection/components/bn-chart-time/utils/elements/Needle.js +4 -1
- package/dist/collection/components/bn-chart-time/utils/elements/StackedColumn.js +6 -2
- package/dist/collection/components/bn-chart-time/utils/factories/ScenarioFactory.js +2 -2
- package/dist/collection/components/bn-chart-time/utils/model/TimeChartComponentConfig.js +2 -18
- package/dist/collection/components/bn-component-style/bn-component-style.js +3 -3
- package/dist/collection/components/bn-context/bn-context.js +24 -5
- package/dist/collection/components/bn-dataset/bn-dataset.js +8 -8
- package/dist/collection/components/bn-datasource/bn-datasource.js +8 -8
- package/dist/collection/components/bn-footer/bn-footer.css +1 -15
- package/dist/collection/components/bn-footer/bn-footer.js +17 -34
- package/dist/collection/components/bn-grid/bn-grid.js +38 -71
- package/dist/collection/components/bn-image/bn-image.js +21 -2
- package/dist/collection/components/bn-internationalization/bn-internationalization.js +7 -1
- package/dist/collection/components/bn-layout-card/bn-layout-card.js +3 -32
- package/dist/collection/components/bn-layout-page/bn-layout-page.js +3 -32
- package/dist/collection/components/bn-message/bn-message.js +20 -2
- package/dist/collection/components/bn-page/bn-page.js +22 -3
- package/dist/collection/components/bn-ruleset/bn-ruleset.js +3 -3
- package/dist/collection/components/bn-scaling-group/bn-scaling-group.js +9 -9
- package/dist/collection/components/bn-table/{ibcs-table.js → bn-table-renderer/bn-table-renderer.js} +230 -83
- package/dist/collection/components/bn-table/bn-table.js +134 -157
- package/dist/collection/components/bn-table/utils/Table.js +3 -3
- package/dist/collection/components/bn-table/utils/elements/TableRow.js +1 -1
- package/dist/collection/components/bn-table/utils/factories/tableDataSetFactory.js +38 -4
- package/dist/collection/components/bn-table/utils/helper/DataQuery.js +3 -1
- package/dist/collection/components/bn-table/utils/helper/barColumnGeometry.js +2 -2
- package/dist/collection/components/bn-text/bn-text.js +66 -8
- package/dist/collection/components/bn-title/{ibcs-title/ibcs-title.js → bn-title-renderer/bn-title-renderer.js} +59 -83
- package/dist/collection/components/bn-title/{ibcs-title → bn-title-renderer}/utils/Title.js +2 -2
- package/dist/collection/components/bn-title/{ibcs-title → bn-title-renderer}/utils/factories/TitleDataSetFactory.js +1 -1
- package/dist/collection/components/bn-title/bn-title.js +58 -14
- package/dist/collection/components/bn-tree/bn-tree.js +30 -28
- package/dist/collection/index.js +0 -1
- package/dist/collection/schemas.js +1 -0
- package/dist/collection/stores/componentStyles.js +10 -6
- package/dist/collection/stores/createScopedStores.js +3 -1
- package/dist/collection/stores/internationalization.js +10 -6
- package/dist/collection/utils/annotations.js +66 -0
- package/dist/collection/utils/autoFit.js +2 -2
- package/dist/collection/utils/emptyState.js +1 -1
- package/dist/collection/utils/ibcsRuleSet.js +42 -0
- package/dist/collection/utils/layoutState/dataPoint.js +59 -0
- package/dist/collection/utils/layoutState/geometry.js +46 -0
- package/dist/collection/utils/layoutState/index.js +1 -0
- package/dist/collection/utils/layoutState/svgChartElements.js +113 -11
- package/dist/collection/utils/layoutTemplate.js +0 -2
- package/dist/collection/utils/scaling.js +9 -0
- package/dist/collection/utils/validate.js +0 -7
- package/dist/collection/utils/withComponentStyle.js +14 -18
- package/dist/collection/utils/withDataset.js +22 -11
- package/dist/collection/utils/withHasError.js +17 -2
- package/dist/collection/utils/withRuleSet.js +7 -7
- package/dist/collection/utils/withTranslation.js +14 -14
- package/dist/collection/utils/xy/XYFrame.js +13 -3
- package/dist/collection/utils/xy/model/ScaleFactorsXYChart.js +8 -9
- package/dist/collection/utils/xy/pointKey.js +10 -0
- package/dist/components/{ibcs-chart-bullet.d.ts → bn-annotation-layer.d.ts} +4 -4
- package/dist/components/bn-annotation-layer.js +1 -0
- package/dist/components/{ibcs-chart-scatter.d.ts → bn-annotation-list.d.ts} +4 -4
- package/dist/components/bn-annotation-list.js +1 -0
- package/dist/components/bn-asset.js +1 -1
- package/dist/components/bn-body.js +1 -1
- package/dist/components/bn-card.js +1 -1
- package/dist/components/bn-chart-bubble-renderer.d.ts +11 -0
- package/dist/components/bn-chart-bubble-renderer.js +1 -0
- package/dist/components/bn-chart-bubble.js +1 -1
- package/dist/components/bn-chart-bullet-renderer.d.ts +11 -0
- package/dist/components/bn-chart-bullet-renderer.js +1 -0
- package/dist/components/bn-chart-bullet.js +1 -1
- package/dist/components/bn-chart-scatter-renderer.d.ts +11 -0
- package/dist/components/bn-chart-scatter-renderer.js +1 -0
- package/dist/components/bn-chart-scatter.js +1 -1
- package/dist/components/bn-chart-structure-renderer.d.ts +11 -0
- package/dist/components/bn-chart-structure-renderer.js +1 -0
- package/dist/components/bn-chart-structure.js +1 -1
- package/dist/components/{bn-template.d.ts → bn-chart-time-renderer.d.ts} +4 -4
- package/dist/components/bn-chart-time-renderer.js +1 -0
- 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-footer.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-message.js +1 -1
- package/dist/components/bn-page.js +1 -1
- package/dist/components/bn-ruleset.js +1 -1
- package/dist/components/bn-scaling-group.js +1 -1
- package/dist/components/{ibcs-chart-bubble.d.ts → bn-table-renderer.d.ts} +4 -4
- package/dist/components/bn-table-renderer.js +1 -0
- package/dist/components/bn-table.js +1 -1
- package/dist/components/bn-text.js +1 -1
- package/dist/components/{editor-companion.d.ts → bn-title-renderer.d.ts} +4 -4
- package/dist/components/bn-title-renderer.js +1 -0
- package/dist/components/bn-title.js +1 -1
- package/dist/components/bn-tree.js +1 -1
- package/dist/components/index.js +1 -1
- package/dist/components/p-B1nL0yOa.js +1 -0
- package/dist/components/p-B7uwck1J.js +1 -0
- package/dist/components/p-BDS_jiow.js +1 -0
- package/dist/components/p-BIIDTtcR.js +1 -0
- package/dist/components/p-BQMKgvEC.js +1 -0
- package/dist/components/p-BSV_vyqs.js +1 -0
- package/dist/components/p-BVKLCz2k.js +1 -0
- package/dist/components/p-BWBHlztH.js +1 -0
- package/dist/components/p-BXrPfAvP.js +1 -0
- package/dist/components/p-Ba9PUiBp.js +1 -0
- package/dist/components/p-BpCL2bfw.js +1 -0
- package/dist/components/p-BpsXOtoW.js +1 -0
- package/dist/components/p-Bs-YxJEt.js +1 -0
- package/dist/components/p-CGI6XIaK.js +1 -0
- package/dist/components/p-CMM8vtHW.js +1 -0
- package/dist/components/p-COqIkH1M.js +1 -0
- package/dist/components/p-CYwd_ZNM.js +1 -0
- package/dist/components/p-CkW23yp2.js +1 -0
- package/dist/components/p-CtBM3KFY.js +1 -0
- package/dist/{bn-template-engine/p-DFmSrSnf.js → components/p-CurWSJkH.js} +1 -1
- package/dist/components/p-CxPSvrcF.js +1 -0
- package/dist/components/p-D2Epww9R.js +1 -0
- package/dist/components/p-D5-dYgK_.js +1 -0
- package/dist/components/p-D6YGOYV1.js +2 -0
- package/dist/components/p-DEHnizot.js +1 -0
- package/dist/components/p-DIyUaSBg.js +1 -0
- package/dist/components/p-DPLcGhVt.js +1 -0
- package/dist/components/p-DUHp_9X-.js +1 -0
- package/dist/components/p-DYG9FH_u.js +1 -0
- package/dist/components/p-DdGnuNtc.js +1 -0
- package/dist/components/p-Dlb4ncGF.js +1 -0
- package/dist/components/p-Dm55bMs2.js +1 -0
- package/dist/components/p-Dq1AzGKX.js +1 -0
- package/dist/components/p-Dq4KMCDU.js +1 -0
- package/dist/components/p-DsOaqeTN.js +1 -0
- package/dist/components/p-Ds_BSK8v.js +1 -0
- package/dist/components/p-LZ9lAY8T.js +1 -0
- package/dist/components/p-U3zkcEJZ.js +1 -0
- package/dist/components/p-WzaayhTX.js +1 -0
- package/dist/components/p-X9hpquOX.js +1 -0
- package/dist/components/p-Xb6Ilq8u.js +1 -0
- package/dist/components/p-ey23VlID.js +1 -0
- package/dist/components/p-jbp6YiHf.js +1 -0
- package/dist/components/p-oJjMz8JF.js +1 -0
- package/dist/components/p-xhiPDAZa.js +1 -0
- package/dist/components/p-xpguaboj.js +1 -0
- package/dist/esm/{bn-asset_28.entry.js → bn-annotation-layer_30.entry.js} +24689 -23899
- package/dist/esm/bn-grid.entry.js +11 -63
- package/dist/esm/bn-image.entry.js +4 -5
- package/dist/esm/bn-internationalization.entry.js +9 -5
- package/dist/esm/bn-ruleset.entry.js +6 -7
- package/dist/esm/bn-template-engine.js +3 -3
- package/dist/esm/bn-text.entry.js +12 -12
- package/dist/esm/{diagnostics-vw6TKMiT.js → diagnostics-Cyqy1zDT.js} +48 -2
- package/dist/esm/{index-C5UYpZUU.js → index-CCZcKl0Q.js} +1 -1
- package/dist/esm/loader.js +3 -3
- package/dist/esm/{withBodyObserver-DD_-r04o.js → withBodyObserver-JcRB9OPQ.js} +2 -2
- package/dist/esm/{context-protocol-CdTp19uA.js → withHasError-l3cMN-oP.js} +458 -14
- package/dist/esm/{withStyled-BDEyKd_H.js → withStyled-DGOiR00Q.js} +17 -29
- package/dist/esm/{sanitizeHtml-C5bFtARM.js → withTranslation-BpO8BC5B.js} +144 -126
- package/dist/schemas/axis.schema.json +52 -0
- package/dist/schemas/i18n.schema.json +31 -0
- package/dist/schemas/partof.schema.json +33 -0
- package/dist/schemas/ruleset.schema.json +59 -0
- package/dist/schemas/stack.schema.json +51 -0
- package/dist/schemas/theme.schema.json +604 -0
- package/dist/schemas/thereof.schema.json +34 -0
- package/dist/types/components/bn-annotation-layer/bn-annotation-layer.d.ts +81 -0
- package/dist/types/components/bn-annotation-layer/utils/marks.d.ts +69 -0
- package/dist/types/components/bn-annotation-layer/utils/matchPoint.d.ts +17 -0
- package/dist/types/components/bn-annotation-list/bn-annotation-list.d.ts +35 -0
- package/dist/types/components/bn-body/bn-body.d.ts +5 -0
- package/dist/types/components/bn-card/bn-card.d.ts +5 -0
- package/dist/types/components/bn-chart-bubble/bn-chart-bubble-renderer/bn-chart-bubble-renderer.d.ts +97 -0
- package/dist/types/components/bn-chart-bubble/bn-chart-bubble.d.ts +20 -2
- package/dist/types/components/bn-chart-bullet/bn-chart-bullet-renderer/bn-chart-bullet-renderer.d.ts +81 -0
- package/dist/types/components/bn-chart-bullet/bn-chart-bullet.d.ts +21 -3
- package/dist/types/components/bn-chart-bullet/utils/BulletChart.d.ts +2 -0
- package/dist/types/components/bn-chart-bullet/utils/model/BulletChartStyle.d.ts +2 -2
- package/dist/types/components/bn-chart-scatter/bn-chart-scatter-renderer/bn-chart-scatter-renderer.d.ts +85 -0
- package/dist/types/components/bn-chart-scatter/bn-chart-scatter.d.ts +20 -2
- package/dist/types/components/bn-chart-structure/{ibcs-chart-structure.d.ts → bn-chart-structure-renderer/bn-chart-structure-renderer.d.ts} +43 -13
- package/dist/types/components/bn-chart-structure/bn-chart-structure.d.ts +29 -17
- package/dist/types/components/bn-chart-structure/utils/StructureChart.d.ts +7 -0
- package/dist/types/components/bn-chart-structure/utils/elements/Label.d.ts +5 -0
- package/dist/types/components/bn-chart-structure/utils/elements/Marker.d.ts +1 -0
- package/dist/types/components/bn-chart-structure/utils/elements/StackedBar.d.ts +2 -1
- package/dist/types/components/bn-chart-structure/utils/model/DataPoint.d.ts +3 -0
- package/dist/types/components/bn-chart-time/{ibcs-chart-time.d.ts → bn-chart-time-renderer/bn-chart-time-renderer.d.ts} +50 -17
- package/dist/types/components/bn-chart-time/bn-chart-time.d.ts +36 -66
- package/dist/types/components/bn-chart-time/utils/TimeChart.d.ts +7 -0
- package/dist/types/components/bn-chart-time/utils/elements/Label.d.ts +5 -0
- package/dist/types/components/bn-chart-time/utils/elements/LineSeries.d.ts +5 -1
- package/dist/types/components/bn-chart-time/utils/elements/Marker.d.ts +1 -0
- package/dist/types/components/bn-chart-time/utils/elements/StackedColumn.d.ts +2 -1
- package/dist/types/components/bn-chart-time/utils/factories/ScenarioFactory.d.ts +1 -1
- package/dist/types/components/bn-chart-time/utils/model/DataPoint.d.ts +3 -0
- package/dist/types/components/bn-chart-time/utils/model/TimeChartComponentConfig.d.ts +2 -8
- package/dist/types/components/bn-context/bn-context.d.ts +7 -1
- package/dist/types/components/bn-dataset/bn-dataset.d.ts +2 -2
- package/dist/types/components/bn-datasource/bn-datasource.d.ts +2 -2
- package/dist/types/components/bn-footer/bn-footer.d.ts +5 -7
- package/dist/types/components/bn-grid/bn-grid.d.ts +8 -6
- package/dist/types/components/bn-image/bn-image.d.ts +4 -0
- package/dist/types/components/bn-layout-card/bn-layout-card.d.ts +0 -1
- package/dist/types/components/bn-layout-page/bn-layout-page.d.ts +0 -1
- package/dist/types/components/bn-message/bn-message.d.ts +5 -0
- package/dist/types/components/bn-page/bn-page.d.ts +5 -0
- package/dist/types/components/bn-table/{ibcs-table.d.ts → bn-table-renderer/bn-table-renderer.d.ts} +49 -12
- package/dist/types/components/bn-table/bn-table.d.ts +48 -49
- package/dist/types/components/bn-table/utils/elements/Cell.d.ts +2 -0
- package/dist/types/components/bn-table/utils/elements/CellBarChart.d.ts +2 -1
- package/dist/types/components/bn-table/utils/elements/TableRow.d.ts +3 -0
- package/dist/types/components/bn-table/utils/factories/tableDataSetFactory.d.ts +9 -2
- package/dist/types/components/bn-text/bn-text.d.ts +19 -1
- package/dist/types/components/bn-title/{ibcs-title/ibcs-title.d.ts → bn-title-renderer/bn-title-renderer.d.ts} +15 -4
- package/dist/types/components/bn-title/bn-title.d.ts +15 -3
- package/dist/types/components/bn-tree/bn-tree.d.ts +6 -2
- package/dist/types/components.d.ts +2070 -2406
- package/dist/types/context/context-protocol.d.ts +2 -0
- package/dist/types/context/scopedDb.d.ts +9 -12
- package/dist/types/index.d.ts +0 -1
- package/dist/types/schemas.d.ts +50 -0
- package/dist/types/stores/componentStyles.d.ts +8 -0
- package/dist/types/stores/createScopedStores.d.ts +1 -0
- package/dist/types/stores/internationalization.d.ts +3 -2
- package/dist/types/stores/ruleSets.d.ts +15 -3
- package/dist/types/utils/annotations.d.ts +45 -0
- package/dist/types/utils/autoFit.d.ts +2 -2
- package/dist/types/utils/emptyState.d.ts +1 -1
- package/dist/types/utils/ibcsRuleSet.d.ts +16 -0
- package/dist/types/utils/layoutState/dataPoint.d.ts +13 -0
- package/dist/types/utils/layoutState/geometry.d.ts +12 -0
- package/dist/types/utils/layoutState/index.d.ts +1 -0
- package/dist/types/utils/layoutState/svgChartElements.d.ts +9 -6
- package/dist/types/utils/layoutState/types.d.ts +29 -0
- package/dist/types/utils/model/ChartStyles.d.ts +2 -1
- package/dist/types/utils/scaling.d.ts +2 -0
- package/dist/types/utils/validate.d.ts +0 -1
- package/dist/types/utils/withComponentStyle.d.ts +4 -4
- package/dist/types/utils/withDataset.d.ts +3 -3
- package/dist/types/utils/withHasError.d.ts +22 -1
- package/dist/types/utils/withRuleSet.d.ts +3 -2
- package/dist/types/utils/withTranslation.d.ts +1 -2
- package/dist/types/utils/xy/model/ScaleFactorsXYChart.d.ts +6 -7
- package/dist/types/utils/xy/pointKey.d.ts +9 -0
- package/package.json +24 -8
- package/readme.md +14 -8
- package/dist/bn-template-engine/assets/bar.png +0 -0
- package/dist/bn-template-engine/assets/matrix.png +0 -0
- package/dist/bn-template-engine/p-5075771a.entry.js +0 -1
- package/dist/bn-template-engine/p-5d516435.entry.js +0 -1
- package/dist/bn-template-engine/p-5e90e728.entry.js +0 -1
- package/dist/bn-template-engine/p-9ef7e132.entry.js +0 -1
- package/dist/bn-template-engine/p-9f7a1980.entry.js +0 -1
- package/dist/bn-template-engine/p-BeXgxHkW.js +0 -1
- package/dist/bn-template-engine/p-C5UYpZUU.js +0 -2
- package/dist/bn-template-engine/p-CH0bpt_k.js +0 -1
- package/dist/bn-template-engine/p-DI3efDSV.js +0 -1
- package/dist/bn-template-engine/p-DXLTTILG.js +0 -1
- package/dist/bn-template-engine/p-DtP4jqG5.js +0 -1
- package/dist/bn-template-engine/p-a8281b71.entry.js +0 -1
- package/dist/bn-template-engine/p-b31277e7.entry.js +0 -1
- package/dist/bn-template-engine/p-b396ac84.entry.js +0 -1
- package/dist/cjs/bn-template.cjs.entry.js +0 -18
- package/dist/cjs/editor-companion.cjs.entry.js +0 -56
- package/dist/cjs/withHasError-qGW_yqIv.js +0 -426
- package/dist/collection/components/bn-footer/assets/bar.png +0 -0
- package/dist/collection/components/bn-footer/assets/matrix.png +0 -0
- package/dist/collection/components/bn-message/assets/bar.png +0 -0
- package/dist/collection/components/bn-message/assets/matrix.png +0 -0
- package/dist/collection/components/bn-template/bn-template.js +0 -38
- package/dist/collection/components/editor-companion/editor-companion.css +0 -3
- package/dist/collection/components/editor-companion/editor-companion.js +0 -137
- package/dist/collection/utils/templateId.js +0 -12
- package/dist/collection/utils/testing/fakeGroup.js +0 -21
- package/dist/collection/utils/testing/hostFont.js +0 -20
- package/dist/collection/utils/testing/mutationObserver.js +0 -44
- package/dist/collection/utils/testing/structureChart.js +0 -26
- package/dist/collection/utils/testing/timeChart.js +0 -28
- package/dist/components/AxisConfig.js +0 -1
- package/dist/components/CompareUtil.js +0 -1
- package/dist/components/DataFormatDigits.js +0 -1
- package/dist/components/DateStringFactory.js +0 -1
- package/dist/components/LabelCollisionManager.js +0 -1
- package/dist/components/Order.js +0 -1
- package/dist/components/SVGStyle.js +0 -1
- package/dist/components/SVGVariancesStyleGroup.js +0 -1
- package/dist/components/StringAdapter.js +0 -1
- package/dist/components/VarianceMeasure.js +0 -1
- package/dist/components/XYChartDataRow.js +0 -1
- package/dist/components/bn-body2.js +0 -1
- package/dist/components/bn-card2.js +0 -1
- package/dist/components/bn-footer2.js +0 -1
- package/dist/components/bn-message2.js +0 -1
- package/dist/components/bn-page2.js +0 -1
- package/dist/components/bn-template.js +0 -1
- package/dist/components/bn-title2.js +0 -1
- package/dist/components/checkXYOverflow.js +0 -1
- package/dist/components/contentDecoder.js +0 -1
- package/dist/components/context-protocol.js +0 -1
- package/dist/components/editor-companion.js +0 -1
- package/dist/components/formatter.js +0 -1
- package/dist/components/geometry.js +0 -1
- package/dist/components/ibcs-chart-bubble.js +0 -1
- package/dist/components/ibcs-chart-bubble2.js +0 -1
- package/dist/components/ibcs-chart-bullet.js +0 -1
- package/dist/components/ibcs-chart-bullet2.js +0 -1
- package/dist/components/ibcs-chart-scatter.js +0 -1
- package/dist/components/ibcs-chart-scatter2.js +0 -1
- package/dist/components/ibcs-chart-structure.d.ts +0 -11
- package/dist/components/ibcs-chart-structure.js +0 -1
- package/dist/components/ibcs-chart-structure2.js +0 -1
- package/dist/components/ibcs-chart-time.d.ts +0 -11
- package/dist/components/ibcs-chart-time.js +0 -1
- package/dist/components/ibcs-chart-time2.js +0 -1
- package/dist/components/ibcs-table.d.ts +0 -11
- package/dist/components/ibcs-table.js +0 -1
- package/dist/components/ibcs-table2.js +0 -1
- package/dist/components/ibcs-title.d.ts +0 -11
- package/dist/components/ibcs-title.js +0 -1
- package/dist/components/ibcs-title2.js +0 -1
- package/dist/components/layoutTemplate.js +0 -1
- package/dist/components/luxon.js +0 -1
- package/dist/components/scaling.js +0 -1
- package/dist/components/svg.esm.js +0 -1
- package/dist/components/svgChartElements.js +0 -1
- package/dist/components/types.js +0 -1
- package/dist/components/validate.js +0 -1
- package/dist/components/withBodyObserver.js +0 -1
- package/dist/components/withComponentStatus.js +0 -1
- package/dist/components/withComponentStyle.js +0 -1
- package/dist/components/withDataset.js +0 -1
- package/dist/components/withHasError.js +0 -1
- package/dist/components/withRuleSet.js +0 -1
- package/dist/components/withScalingGroup.js +0 -1
- package/dist/components/withStyled.js +0 -1
- package/dist/components/withTranslation.js +0 -1
- package/dist/esm/bn-template.entry.js +0 -16
- package/dist/esm/editor-companion.entry.js +0 -54
- package/dist/esm/withHasError-73WV2SP5.js +0 -422
- package/dist/types/components/bn-chart-bubble/ibcs-chart-bubble.d.ts +0 -59
- package/dist/types/components/bn-chart-bullet/ibcs-chart-bullet.d.ts +0 -53
- package/dist/types/components/bn-chart-scatter/ibcs-chart-scatter.d.ts +0 -54
- package/dist/types/components/bn-template/bn-template.d.ts +0 -10
- package/dist/types/components/editor-companion/editor-companion.d.ts +0 -20
- package/dist/types/utils/templateId.d.ts +0 -9
- package/dist/types/utils/testing/fakeGroup.d.ts +0 -8
- package/dist/types/utils/testing/hostFont.d.ts +0 -16
- package/dist/types/utils/testing/mutationObserver.d.ts +0 -5
- package/dist/types/utils/testing/structureChart.d.ts +0 -5
- package/dist/types/utils/testing/timeChart.d.ts +0 -5
- /package/dist/collection/components/bn-chart-bubble/{ibcs-chart-bubble.css → bn-chart-bubble-renderer/bn-chart-bubble-renderer.css} +0 -0
- /package/dist/collection/components/bn-chart-bullet/{ibcs-chart-bullet.css → bn-chart-bullet-renderer/bn-chart-bullet-renderer.css} +0 -0
- /package/dist/collection/components/bn-chart-scatter/{ibcs-chart-scatter.css → bn-chart-scatter-renderer/bn-chart-scatter-renderer.css} +0 -0
- /package/dist/collection/components/bn-chart-time/{ibcs-chart-time.css → bn-chart-time-renderer/bn-chart-time-renderer.css} +0 -0
- /package/dist/collection/components/bn-table/{ibcs-table.css → bn-table-renderer/bn-table-renderer.css} +0 -0
- /package/dist/collection/components/bn-title/{ibcs-title/ibcs-title.css → bn-title-renderer/bn-title-renderer.css} +0 -0
- /package/dist/collection/components/bn-title/{ibcs-title → bn-title-renderer}/utils/factories/index.js +0 -0
- /package/dist/collection/components/bn-title/{ibcs-title → bn-title-renderer}/utils/model/MeasureEntriy.js +0 -0
- /package/dist/collection/components/bn-title/{ibcs-title → bn-title-renderer}/utils/model/TimePeriod.js +0 -0
- /package/dist/collection/components/bn-title/{ibcs-title → bn-title-renderer}/utils/model/TitleConfig.js +0 -0
- /package/dist/collection/components/bn-title/{ibcs-title → bn-title-renderer}/utils/model/index.js +0 -0
- /package/dist/components/{stackColors.js → p-4q8nRcWC.js} +0 -0
- /package/dist/components/{merge.js → p-B2NXsfMz.js} +0 -0
- /package/dist/components/{layoutObserver.js → p-B6kka9sT.js} +0 -0
- /package/dist/components/{NumericScale.js → p-BJmwHV0a.js} +0 -0
- /package/dist/components/{stackLayout.js → p-BTnRaHPb.js} +0 -0
- /package/dist/components/{emotion-hash.esm.js → p-BYBpC0EO.js} +0 -0
- /package/dist/components/{diagnostics.js → p-CckAR27O.js} +0 -0
- /package/dist/components/{SiPrefix.js → p-CeE4_3wQ.js} +0 -0
- /package/dist/components/{queryError.js → p-ClruFZD_.js} +0 -0
- /package/dist/components/{sanitizeHtml.js → p-CyUmrWfW.js} +0 -0
- /package/dist/components/{TableAttribute.js → p-DCPLGEs_.js} +0 -0
- /package/dist/components/{parentDimensions.js → p-DD1zlev_.js} +0 -0
- /package/dist/components/{pageFormats.js → p-DM7fwmH4.js} +0 -0
- /package/dist/components/{emptyState.js → p-DakXa7Dp.js} +0 -0
- /package/dist/components/{relativeVariance.js → p-fCjsrD7I.js} +0 -0
- /package/dist/types/components/bn-title/{ibcs-title → bn-title-renderer}/utils/Title.d.ts +0 -0
- /package/dist/types/components/bn-title/{ibcs-title → bn-title-renderer}/utils/factories/TitleDataSetFactory.d.ts +0 -0
- /package/dist/types/components/bn-title/{ibcs-title → bn-title-renderer}/utils/factories/index.d.ts +0 -0
- /package/dist/types/components/bn-title/{ibcs-title → bn-title-renderer}/utils/model/MeasureEntriy.d.ts +0 -0
- /package/dist/types/components/bn-title/{ibcs-title → bn-title-renderer}/utils/model/TimePeriod.d.ts +0 -0
- /package/dist/types/components/bn-title/{ibcs-title → bn-title-renderer}/utils/model/TitleConfig.d.ts +0 -0
- /package/dist/types/components/bn-title/{ibcs-title → bn-title-renderer}/utils/model/index.d.ts +0 -0
|
@@ -2,11 +2,10 @@ import { CompareUtil } from "../../helper/CompareUtil";
|
|
|
2
2
|
/**
|
|
3
3
|
* Proportional scale factors for XY chart elements (scatter and bubble).
|
|
4
4
|
*
|
|
5
|
-
* All values
|
|
6
|
-
*
|
|
7
|
-
*
|
|
8
|
-
*
|
|
9
|
-
* pixel values (hairlines must not scale with the font).
|
|
5
|
+
* All values are expressed in **font-size multiples** (em-like units), so
|
|
6
|
+
* the chart scales uniformly when the base font size changes. The chart
|
|
7
|
+
* renderer multiplies each factor by the computed font size to get pixel
|
|
8
|
+
* dimensions. The line widths give 1 px at the default font size.
|
|
10
9
|
*/
|
|
11
10
|
export class ScaleFactorsXYChart {
|
|
12
11
|
constructor() {
|
|
@@ -24,10 +23,10 @@ export class ScaleFactorsXYChart {
|
|
|
24
23
|
this.legendSwatch = 0.9;
|
|
25
24
|
/** Gap between facet panels. */
|
|
26
25
|
this.panelGap = 1.6;
|
|
27
|
-
/** Stroke width of reference lines
|
|
28
|
-
this.refLineWidth =
|
|
29
|
-
/** Stroke width of gridlines and the plot frame
|
|
30
|
-
this.gridLineWidth =
|
|
26
|
+
/** Stroke width of reference lines. */
|
|
27
|
+
this.refLineWidth = 0.075;
|
|
28
|
+
/** Stroke width of gridlines and the plot frame. */
|
|
29
|
+
this.gridLineWidth = 0.075;
|
|
31
30
|
}
|
|
32
31
|
}
|
|
33
32
|
/** Converts untyped JSON into a validated {@link ScaleFactorsXYChart}. */
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/** The dimensions of one XY mark: its name, and its series and panel when the chart has them. */
|
|
2
|
+
export function xyPointKey(point, facetKey, config) {
|
|
3
|
+
const key = { [config.pointLevel]: point.name };
|
|
4
|
+
if (config.seriesLevel !== null && point.seriesKey !== "")
|
|
5
|
+
key[config.seriesLevel] = point.seriesKey;
|
|
6
|
+
if (config.facet !== null && facetKey !== "") {
|
|
7
|
+
key[config.facet.level === "rowgroup" ? "rowGroup" : "category"] = facetKey;
|
|
8
|
+
}
|
|
9
|
+
return key;
|
|
10
|
+
}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import type { Components, JSX } from "../types/components";
|
|
2
2
|
|
|
3
|
-
interface
|
|
4
|
-
export const
|
|
5
|
-
prototype:
|
|
6
|
-
new ():
|
|
3
|
+
interface BnAnnotationLayer extends Components.BnAnnotationLayer, HTMLElement {}
|
|
4
|
+
export const BnAnnotationLayer: {
|
|
5
|
+
prototype: BnAnnotationLayer;
|
|
6
|
+
new (): BnAnnotationLayer;
|
|
7
7
|
};
|
|
8
8
|
/**
|
|
9
9
|
* Used to define this component and all nested components recursively.
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{p as t,t as e,H as n,h as i,a as o}from"./p-D6YGOYV1.js";import{g as s}from"./p-BVKLCz2k.js";import{a as r,c as a,b as l}from"./p-DIyUaSBg.js";import{w as h,C as c}from"./p-DEHnizot.js";import{w as u}from"./p-jbp6YiHf.js";import{w as d}from"./p-CGI6XIaK.js";const b=t=>({x:t.x+t.width/2,y:t.y+t.height/2});function f(t,e){const n=b(t),i=e.x-n.x,o=e.y-n.y,s=Math.min(0===i?1/0:t.width/2/Math.abs(i),0===o?1/0:t.height/2/Math.abs(o));return Number.isFinite(s)?{x:n.x+i*s,y:n.y+o*s}:n}function m(t,e){return e?Object.assign(Object.assign({},t),{cx:Math.max(t.r,Math.min(t.cx,e.width-t.r)),cy:Math.max(t.r,Math.min(t.cy,e.height-t.r))}):t}const v=(t,e)=>t.x<e.x+e.width&&e.x<t.x+t.width&&t.y<e.y+e.height&&e.y<t.y+t.height;function y(t,e,n,i){var o,s,r;const a=.25*n,l=t.y+t.height/2,h=null!==(o=i.obstacles)&&void 0!==o?o:[],c=t=>{const n={x:t-e,y:l-e,width:2*e,height:2*e},o=i.area;return(!o||n.x>=0&&n.x+n.width<=o.width)&&!h.some((t=>v(n,t)))},u=t.x+t.width,d=t.x-a-e,b=u+a+e;if(c(d))return{x:d,y:l,r:e};if(c(b))return{x:b,y:l,r:e};const f=2*(e+a),m=h.filter((t=>t.y<l&&t.y+t.height>l)),y=Math.max(0,t.x-f,...m.filter((e=>e.x+e.width<=t.x)).map((t=>t.x+t.width))),p=Math.min(null!==(r=null===(s=i.area)||void 0===s?void 0:s.width)&&void 0!==r?r:1/0,u+f,...m.filter((t=>t.x>=u)).map((t=>t.x))),g=t.x-y,w=p-u;return{x:w>=g?u+w/2:t.x-g/2,y:l,r:Math.min(e,Math.max(Math.max(g,w)/2,.3*n))}}function p(t,e,n,i,o={}){var s;const{label:r,color:a}=t,{whole:l,area:h,text:c}=o,u=!l&&!c&&null!=o.obstacles,d=((t,e)=>t?Math.min(e,t.height/1.3):e)(null!=c?c:u?e:void 0,i);if("arrow"===t.mark){if(!n)return;const t=b(e),o=b(n);if(t.x===o.x&&t.y===o.y)return;let s=f(e,o),l=f(n,t);(l.x-s.x)*(o.x-t.x)+(l.y-s.y)*(o.y-t.y)<=0&&(s=t,l=o);const c=Math.hypot(l.x-s.x,l.y-s.y),u=Math.min(.8*i,c),d=(l.x-s.x)/c,v=(l.y-s.y)/c,y=l.x-d*u,p=l.y-v*u,g=.35*i;return{kind:"arrow",color:a,x1:s.x,y1:s.y,x2:y,y2:p,head:[`${l.x},${l.y}`,`${y-v*g},${p+d*g}`,`${y+v*g},${p-d*g}`].join(" "),badge:null!=r?m({cx:s.x,cy:s.y,r:.65*i,label:r},h):void 0}}if("frame"===t.mark){const n=null!=c?c:e,o=null===(s=t.point)||void 0===s?void 0:s.part,u=!l&&(null!=c||"label"===o||"total"===o),b=(u?.45:.2)*d,f=(u?.1:.2)*d,v=u?Math.max(n.width,n.height):n.width,y=n.x+n.width/2,p=1,g=Math.max(h?p:-1/0,y-v/2-b),w=Math.max(h?p:-1/0,n.y-f),x=Math.min(h?h.width-p:1/0,y+v/2+b),M=Math.min(h?h.height-p:1/0,n.y+n.height+f),k=Math.min(x-g,M-w)/2,S=l?.25*i:k,$=l?.25*i:u?Math.min((x-g)/2,1.6*k):k,O=1-Math.SQRT1_2,j=.65*d,C=u?.6*j:0;return{kind:"frame",color:a,x:g,y:w,width:x-g,height:M-w,rx:$,ry:S,badge:null!=r?m({cx:x-$*O+C,cy:w+S*O-C,r:j,label:r},h):void 0}}if(c&&!l){const t=y(c,(null==r?.4:.65)*d,d,o);return{kind:"marker",color:a,badge:m({cx:t.x,cy:t.y,r:t.r,label:r},h)}}const p=(null==r?.4:.75)*d,g=u?Math.min(p,e.height/2):p,w=l?{x:e.x+e.width-g,y:e.y+g}:b(e);if(u){const t={x:w.x-g,y:w.y-g,width:2*g,height:2*g},e=o.obstacles.find((e=>v(t,e)));if(e){const t=y(e,g,d,o);return{kind:"marker",color:a,badge:m({cx:t.x,cy:t.y,r:t.r,label:r},h)}}}return{kind:"marker",color:a,badge:m({cx:w.x,cy:w.y,r:g,label:r},h)}}const g=["rowGroup","category","subCategory","date","scenario","row"];function w(t,e){const n=e.getBoundingClientRect();if(0===n.width||0===n.height)return!0;const i=t.x+t.width/2,o=t.y+t.height/2;return i>=n.left&&i<=n.right&&o>=n.top&&o<=n.bottom}const x=new Set(["bn-asset","bn-component-style","bn-dataset","bn-datasource","bn-internationalization","bn-ruleset","bn-scaling-group"]);function M(t,e){const n=e.getBoundingClientRect();return 0===n.width||0===n.height||t.x<n.right&&t.x+t.width>n.left&&t.y<n.bottom&&t.y+t.height>n.top}const k=t(class extends n{constructor(t){super(),!1!==t&&this.__registerHost(),this.__attachShadow(),this.marks=[],this.pageKey="",this.parsedItems=[],this.scheduled=!1,this.run=0,this.observed=new WeakSet,this.reported=new Set,this.schedule=()=>{this.scheduled||(this.scheduled=!0,this.holdStatus(new Promise((t=>{requestAnimationFrame((()=>{this.scheduled=!1,this.place().catch((t=>console.error("bn-annotation-layer: placing the marks failed",t))).finally(t)}))}))))},this.holdStatus=h(this),this.errors=d(this),this.componentStyle=u(this)}connectedCallback(){var t;this.stores=s(this.element),this.pageKey=r(this.element),this.observed=new WeakSet,this.resizeObserver=new ResizeObserver(this.schedule),this.mutationObserver=new MutationObserver(this.schedule),this.observeSize(this.element);const e=this.element.closest("bn-layout-page");e&&this.mutationObserver.observe(e,{childList:!0,subtree:!0,attributes:!0,attributeFilter:["slot","data-bino-annotation-target"]}),null===(t=document.fonts)||void 0===t||t.addEventListener("loadingdone",this.schedule)}disconnectedCallback(){var t,e,n,i;null===(t=this.resizeObserver)||void 0===t||t.disconnect(),null===(e=this.mutationObserver)||void 0===e||e.disconnect(),null===(n=document.fonts)||void 0===n||n.removeEventListener("loadingdone",this.schedule),this.run++,(null===(i=this.stores)||void 0===i?void 0:i.annotationsUnplaced.state[this.pageKey])&&this.stores.annotationsUnplaced.set(this.pageKey,void 0)}componentWillLoad(){this.parseItems()}componentDidLoad(){this.schedule()}onItemsChange(){this.parseItems(),this.schedule()}parseItems(){const t=a(this.items);t?this.errors.remove("ERR_items"):this.errors.addOrReplace({id:"ERR_items",type:"error",message:"items: not a JSON array of objects."}),this.parsedItems=null!=t?t:[]}async place(){var t;const e=++this.run;if(!this.element.isConnected||!this.svg)return;const n=this.element.closest("bn-layout-page"),i=new Map,o=new Map;null==n||n.querySelectorAll("[data-bino-annotation-target]").forEach((t=>{const e=Array.from(t.querySelectorAll("*")).find((t=>t.localName.startsWith("bn-")&&!x.has(t.localName))),n=null!=e?e:t;i.set(t.getAttribute("data-bino-annotation-target"),n),o.set(n,t)})),null==n||n.querySelectorAll("[slot]").forEach((t=>this.observeSize(t)));const s=new Set(this.parsedItems.flatMap((t=>[t.target,t.to]))),r=[...i].filter((([t])=>s.has(t))).map((([,t])=>t));if(await Promise.all(r.map((t=>{var e;return null===(e=t.componentOnReady)||void 0===e?void 0:e.call(t)}))),e!==this.run)return;r.forEach((t=>this.observe(t)));const a=new Map;if(await Promise.all(r.map((async t=>{var e;a.set(t,await(null===(e=t.getLayoutState)||void 0===e?void 0:e.call(t,{detail:"full"}).catch((()=>{}))))}))),e!==this.run)return;const l=(t,e)=>{var n;const s=null!=t?i.get(t):void 0;if(!s)return{problem:`no target "${t}" on this page`};const r=s.getBoundingClientRect();if(function(t){return!t||g.every((e=>null==t[e]))&&null==t.part}(e)){const e={x:r.left,y:r.top,width:r.width,height:r.height};return function(t,e,n){if(0===t.width||0===t.height||!M(t,n))return!0;for(let n=e;n&&"bn-layout-page"!==n.localName;n=n.parentElement)if(!M(t,n))return!0;return!1}(e,o.get(s),this.element)?{problem:`"${t}" cannot be seen`}:{box:e,whole:!0}}const l=a.get(s),h=l?function(t,e){var n;const i=t.table&&null==e.scenario?t.table.rows:null!==(n=t.elements)&&void 0!==n?n:[],o=null!=t.table&&null==e.subCategory;return i.filter((t=>function(t,e){var n;return!(!t||t.part!==(null!==(n=e.part)&&void 0!==n?n:"element"))&&g.every((n=>null==e[n]||e[n]+""===t[n]))}(t.point,e)&&!(o&&null!=t.point.subCategory))).map((({rect:t,content:e,contentSign:n})=>({rect:t,content:e,contentSign:n})))}(l,e):[];if(1!==h.length)return{problem:`${h.length} elements match the point ${JSON.stringify(e)} in "${t}"`};const c=({component:{x:t,y:e,width:n,height:i}})=>({x:r.left+t,y:r.top+e,width:n,height:i}),u=c(h[0].rect);if(function(t,e){for(let n=e;n&&"bn-layout-page"!==n.localName;n=n.parentElement)if(!w(t,n))return!0;return!1}(u,o.get(s))||!w(u,this.element))return{problem:`the point ${JSON.stringify(e)} in "${t}" is cut off`};const d=h[0].content;if(!l.table)return{box:u,whole:!1};const b=(null!==(n=l.elements)&&void 0!==n?n:[]).flatMap((t=>"cell"===t.kind&&t.content?[{box:c(t.content),sign:t.contentSign}]:[]));return{box:u,whole:!1,text:d&&{box:c(d),sign:h[0].contentSign},obstacles:b}},h=this.toLocalSpace(),c=({box:t,sign:e=0})=>{const n=h(t);return Object.assign(Object.assign({},n),{x:n.x-e,width:n.width+e})},u=parseFloat(getComputedStyle(this.svg).fontSize)||13.3333,d={width:this.element.clientWidth,height:this.element.clientHeight},b=[],f=[];for(const e of this.parsedItems){const n=l(e.target,e.point),i="arrow"===e.mark?l(e.to,e.toPoint):void 0,o="problem"in n?n:i&&"problem"in i?i:void 0;if(o){f.push({item:e,problem:o.problem});continue}const s=n,r=i,a=p(e,h(s.box),r&&h(r.box),u,{whole:s.whole,area:d,text:s.text&&c(s.text),obstacles:null===(t=s.obstacles)||void 0===t?void 0:t.map(c)});a?b.push(a):f.push({item:e,problem:"an arrow needs two ends at different places"})}this.marks=b,this.storeUnplaced(f.flatMap((({item:t})=>null!=t.label?[t.label]:[]))),f.length>0&&this.reportWhenQuiet(e,f)}async reportWhenQuiet(t,e){let n=0;for(let e=0;e<50&&n<2;e++){if(await new Promise((t=>window.setTimeout(t,200))),t!==this.run)return;n=0===c.componentRegisterStatus().running?n+1:0}this.report(e)}report(t){var e,n;for(const{item:i,problem:o}of t){const t=`bn-annotation-layer: ${null!==(e=i.mark)&&void 0!==e?e:"marker"} ${null!==(n=i.label)&&void 0!==n?n:"without a number"} is not drawn: ${o}.`;this.reported.has(t)||(this.reported.add(t),console.warn(t))}}toLocalSpace(){var t;const e=null===(t=this.svg.getScreenCTM())||void 0===t?void 0:t.inverse();return t=>{if(!e)return t;const n=[[t.x,t.y],[t.x+t.width,t.y+t.height]].map((([t,n])=>new DOMPoint(t,n).matrixTransform(e)));return{x:Math.min(n[0].x,n[1].x),y:Math.min(n[0].y,n[1].y),width:Math.abs(n[1].x-n[0].x),height:Math.abs(n[1].y-n[0].y)}}}storeUnplaced(t){var e,n;const i=null===(e=this.stores)||void 0===e?void 0:e.annotationsUnplaced,o=null!==(n=null==i?void 0:i.state[this.pageKey])&&void 0!==n?n:[];i&&JSON.stringify(o)!==JSON.stringify(t)&&i.set(this.pageKey,t)}observe(t){this.observeSize(t);const e=t=>{var n;t&&(this.observed.has(t)||(this.observed.add(t),null===(n=this.mutationObserver)||void 0===n||n.observe(t,{childList:!0,subtree:!0,characterData:!0,attributes:!0,attributeFilter:["x","y","width","height","transform","style","class"]})),t.querySelectorAll("*").forEach((t=>e(t.shadowRoot))))};e(t.shadowRoot)}observeSize(t){var e;this.observed.has(t)||(this.observed.add(t),null===(e=this.resizeObserver)||void 0===e||e.observe(t))}renderBadge(t,e){return t?i("g",null,i("circle",{cx:t.cx,cy:t.cy,r:t.r,style:{fill:e}}),null!=t.label?i("text",{class:"badge-text",x:t.cx,y:t.cy,style:{fontSize:1.1*t.r+"px"}},t.label):null):null}renderMark(t){var e,n;const o=l(t.color,this.componentStyle((t=>t["bn-annotation"])));return"marker"===t.kind?i("g",{class:"mark marker","data-label":t.badge.label},this.renderBadge(t.badge,o)):"frame"===t.kind?i("g",{class:"mark frame","data-label":null===(e=t.badge)||void 0===e?void 0:e.label},i("rect",{x:t.x,y:t.y,width:t.width,height:t.height,rx:t.rx,ry:t.ry,style:{fill:"none",stroke:o,strokeWidth:"1.5"}}),this.renderBadge(t.badge,o)):i("g",{class:"mark arrow","data-label":null===(n=t.badge)||void 0===n?void 0:n.label},i("line",{x1:t.x1,y1:t.y1,x2:t.x2,y2:t.y2,style:{stroke:o,strokeWidth:"1.5"}}),i("polygon",{points:t.head,style:{fill:o}}),this.renderBadge(t.badge,o))}render(){return i(o,{key:"05ca564aeeaf190a45cd42020b307891990e04fe"},i("svg",{key:"995c55b16803107766bf2c394d8d799c0de5765d",ref:t=>this.svg=t},this.marks.map((t=>this.renderMark(t)))))}get element(){return this}static get watchers(){return{items:[{onItemsChange:0}]}}static get style(){return':host{position:absolute;inset:0;z-index:1;display:block;pointer-events:none;font-family:var(--bn-font-family, "Noto Sans", sans-serif);font-size:var(--bn-font-size, 13.3333px)}svg{position:absolute;inset:0;width:100%;height:100%;overflow:visible}.badge-text{fill:#ffffff;font-weight:bold;text-anchor:middle;dominant-baseline:central}'}},[1,"bn-annotation-layer",{items:[1],selectedStyle:[513,"selected-style"],marks:[32]},void 0,{items:[{onItemsChange:0}]}]),S=k,$=function(){"undefined"!=typeof customElements&&["bn-annotation-layer"].forEach((t=>{"bn-annotation-layer"===t&&(customElements.get(e(t))||customElements.define(e(t),k))}))};export{S as BnAnnotationLayer,$ as defineCustomElement}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import type { Components, JSX } from "../types/components";
|
|
2
2
|
|
|
3
|
-
interface
|
|
4
|
-
export const
|
|
5
|
-
prototype:
|
|
6
|
-
new ():
|
|
3
|
+
interface BnAnnotationList extends Components.BnAnnotationList, HTMLElement {}
|
|
4
|
+
export const BnAnnotationList: {
|
|
5
|
+
prototype: BnAnnotationList;
|
|
6
|
+
new (): BnAnnotationList;
|
|
7
7
|
};
|
|
8
8
|
/**
|
|
9
9
|
* Used to define this component and all nested components recursively.
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{p as t,H as s,f as e,h as i,a as n,t as o}from"./p-D6YGOYV1.js";import{g as a}from"./p-BVKLCz2k.js";import{a as l,p as r,b as c}from"./p-DIyUaSBg.js";import{s as d}from"./p-CyUmrWfW.js";import{w as m}from"./p-DEHnizot.js";import{w as f}from"./p-jbp6YiHf.js";import{w as h}from"./p-CGI6XIaK.js";const p=t(class extends s{constructor(t){super(),!1!==t&&this.__registerHost(),this.__attachShadow(),this.pageKey="",m(this),this.errors=h(this),this.componentStyle=f(this)}connectedCallback(){this.stores=a(this.element),this.pageKey=l(this.element),this.unsubscribe=this.stores.annotationsUnplaced.on("set",(t=>{t===this.pageKey&&e(this.element)})),e(this.element)}disconnectedCallback(){var t;null===(t=this.unsubscribe)||void 0===t||t.call(this)}render(){var t,s;const e=r(this.items);e?this.errors.remove("ERR_items"):this.errors.addOrReplace({id:"ERR_items",type:"error",message:"items: not a JSON array of objects."});const o=c(void 0,this.componentStyle((t=>t["bn-annotation"]))),a=null!==(s=null===(t=this.stores)||void 0===t?void 0:t.annotationsUnplaced.state[this.pageKey])&&void 0!==s?s:[];return i(n,{key:"69a1cb7ec4623dd722328638b93fa2ac05775dcf"},i("ol",{key:"cc7925db54a9015cd774242487967e25d0eb1dc0"},(null!=e?e:[]).map((t=>i("li",null,null==t.label||a.includes(t.label)?null!=t.label?i("div",{class:"badge-space"}):null:i("div",{class:"badge",style:{background:o}},i("span",null,t.label)),i("div",{class:"text"},t.title?i("span",{class:"title"},t.title," "):null,t.html?i("span",{innerHTML:d(t.html)}):null))))))}get element(){return this}static get style(){return':host{display:block;font-family:var(--bn-font-family, "Noto Sans", sans-serif);font-size:var(--bn-font-size, 13.3333px);color:var(--bn-font-color, #000000)}ol{margin:0;padding:0;list-style:none}li{display:flex;gap:0.5em;margin-bottom:0.6em;align-items:flex-start}.badge-space{flex:none;width:1.5em;height:1.5em}.badge{flex:none;display:flex;align-items:center;justify-content:center;width:1.5em;height:1.5em;border-radius:50%;color:#ffffff;font-weight:bold;line-height:1}.badge span{font-size:0.825em}.title{font-weight:bold}'}},[1,"bn-annotation-list",{items:[1],selectedStyle:[513,"selected-style"]}]),b=p,u=function(){"undefined"!=typeof customElements&&["bn-annotation-list"].forEach((t=>{"bn-annotation-list"===t&&(customElements.get(o(t))||customElements.define(o(t),p))}))};export{b as BnAnnotationList,u as defineCustomElement}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{p as s,H as t,h as e,a as r,t as o}from"./p-D6YGOYV1.js";import{w as i}from"./p-DEHnizot.js";import{g as n}from"./p-BVKLCz2k.js";import{w as a}from"./p-CurWSJkH.js";import{w as m}from"./p-CGI6XIaK.js";const h=s(class extends t{constructor(s){super(),!1!==s&&this.__registerHost(),this.__attachShadow(),i(this),this.errors=m(this),a(this,(s=>{this.stores||(this.stores=n(this.element));try{const t=s.replace(/\s/g,"");this.stores.assets.set(this.name,t)}catch(t){console.error("Error parsing asset",t,s),this.stores.assets.set(this.name,void 0)}}))}render(){return e(r,{key:"9df81e3697e02833b8cb1fad7ea06a5f446852be"})}get element(){return this}static get style(){return":host{display:none}"}},[1,"bn-asset",{name:[1]}]),p=h,c=function(){"undefined"!=typeof customElements&&["bn-asset"].forEach((s=>{"bn-asset"===s&&(customElements.get(o(s))||customElements.define(o(s),h))}))};export{p as BnAsset,c as defineCustomElement}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{B as
|
|
1
|
+
import{B as a,d as o}from"./p-WzaayhTX.js";const s=a,p=o;export{s as BnBody,p as defineCustomElement}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{C as
|
|
1
|
+
import{C as s,d as o}from"./p-Bs-YxJEt.js";const t=s,p=o;export{t as BnCard,p as defineCustomElement}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { Components, JSX } from "../types/components";
|
|
2
|
+
|
|
3
|
+
interface BnChartBubbleRenderer extends Components.BnChartBubbleRenderer, HTMLElement {}
|
|
4
|
+
export const BnChartBubbleRenderer: {
|
|
5
|
+
prototype: BnChartBubbleRenderer;
|
|
6
|
+
new (): BnChartBubbleRenderer;
|
|
7
|
+
};
|
|
8
|
+
/**
|
|
9
|
+
* Used to define this component and all nested components recursively.
|
|
10
|
+
*/
|
|
11
|
+
export const defineCustomElement: () => void;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{B as o,d as p}from"./p-X9hpquOX.js";const s=o,r=p;export{s as BnChartBubbleRenderer,r as defineCustomElement}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{proxyCustomElement as t,HTMLElement as e,writeTask as i,forceUpdate as s,h as a,Host as r,transformTag as n}from"@stencil/core/internal/client";import{h as o,a as l}from"./context-protocol.js";import{o as h}from"./geometry.js";import{c}from"./svgChartElements.js";import{g as u}from"./parentDimensions.js";import{c as d}from"./checkXYOverflow.js";import{o as p}from"./layoutObserver.js";import{p as v}from"./scaling.js";import{i as m,h as f,j as b}from"./validate.js";import{w as y}from"./withComponentStatus.js";import{w as g}from"./withComponentStyle.js";import{w}from"./withDataset.js";import{w as x}from"./withHasError.js";import{w as _}from"./withRuleSet.js";import{w as S}from"./withScalingGroup.js";import{w as R}from"./withTranslation.js";import{w as E}from"./withStyled.js";import{r as L,s as j}from"./VarianceMeasure.js";import{t as $,a as z,b as A,c as C,d as O,e as F,p as k}from"./AxisConfig.js";import{s as N}from"./emptyState.js";import{d as W}from"./ibcs-chart-bubble2.js";const M={rowGroup:0,category:1,subCategory:2},G=["ac","pp","fc","pl"],D=t(class extends e{validateFilter(t){const e="ERR_filter";o(t)?this.errors.addOrReplace({id:e,type:"error",message:"filter: double backticks are not allowed."}):this.errors.remove(e)}validateX(t){this.validateMeasureSpec("x",t,!0,(t=>$(t)))}validateY(t){this.validateMeasureSpec("y",t,!0,(t=>$(t)))}validateSize(t){this.validateMeasureSpec("size",t,!0,(t=>z(t))),this.validateSizeScaling()}validateShare(t){this.validateMeasureSpec("share",t,!1,(t=>A(t)))}validateCompareWith(t){const e="ERR_compareWith";m(t)||G.includes(t.trim().toLowerCase())?this.errors.remove(e):this.errors.addOrReplace({id:e,type:"warning",message:`compare-with: invalid value '${t}' - expected ${G.join("/")}; ignored.`})}validateLevel(t){const e="ERR_level",i=["auto","category","subcategory"];m(t)||i.includes(t.trim().toLowerCase())?this.errors.remove(e):this.errors.addOrReplace({id:e,type:"warning",message:`level: invalid value '${t}' - expected ${i.join("/")}; using 'auto'.`})}validateSeriesLevel(t){const e="ERR_seriesLevel",i=["auto","rowgroup","category","none"];m(t)||i.includes(t.trim().toLowerCase())?this.errors.remove(e):this.errors.addOrReplace({id:e,type:"warning",message:`series-level: invalid value '${t}' - expected ${i.join("/")}; using 'auto'.`})}validateFacet(t){this.validateObjectSpec("facet",t,(t=>C(t)))}validateLabels(t){this.validateObjectSpec("labels",t,(t=>O(t,this.labelDefaults())))}validateLegend(t){this.validateObjectSpec("legend",t,(t=>F(t)))}validateAspect(t){const e="ERR_aspect";m(t)||null!==this.parseAspect(t)?this.errors.remove(e):this.errors.addOrReplace({id:e,type:"warning",message:`aspect: invalid value '${t}' - expected "w:h" (e.g. "16:9"); using the default.`})}validateLimit(t){const e="ERR_limit";f(t)&&Number(t)>=0?this.errors.remove(e):this.errors.addOrReplace({id:e,type:"warning",message:`limit: invalid value '${t}' - expected a non-negative integer; using 0.`})}validateScale(t){const e="ERR_scale";if(m(t))return void this.errors.remove(e);const{mode:i,factor:s}=v(t);"factor"===i&&(void 0===s||s<=0)?this.errors.addOrReplace({id:e,type:"warning",message:`scale: invalid value '${t}' - expected none/auto or a positive number.`}):this.errors.remove(e)}constructor(t){super(),!1!==t&&this.__registerHost(),this.__attachShadow(),this.datasetName="",this.dataVersion=0,this.datasetMeta=null,this.appliedScaleFactor=1,this.layoutObserver=null,this.activeErrors=new Set,this.pixelPerUnitGroupMap=new Map,this.chartTitle="",this.filter="",this.share="",this.compareWith="",this.level="auto",this.seriesLevel="auto",this.facet="",this.labels="",this.legend="",this.aspect="16:9",this.limit=0,this._autoScaleGuard=!1,this._lastObservedWidth=0,this.translateForInner=(t,e)=>this.t(t,e),E(this),y(this),w(this,(t=>{this.datasetName=(null==t?void 0:t.startsWith("$"))?t.substring(1):t||"",this.dataVersion=this.dataVersion+1}),((t,e)=>{this.datasetMeta=e})),this.errors=x(this),S(this),this.componentStyle=g(this),this.ruleSetConfig=_(this),this.t=R(this).t}componentWillLoad(){this.validateFilter(this.filter),this.validateX(this.x),this.validateY(this.y),this.validateSize(this.size),this.validateShare(this.share),this.validateCompareWith(this.compareWith),this.validateLevel(this.level),this.validateSeriesLevel(this.seriesLevel),this.validateFacet(this.facet),this.validateLabels(this.labels),this.validateLegend(this.legend),this.validateAspect(this.aspect),this.validateLimit(this.limit),this.validateScale(this.scale)}componentDidRender(){N(this.element,"ibcs-chart-bubble");const{mode:t}=v(this.scale);if("auto"!==t&&"empty"!==t)return this._autoScaleGuard=!1,void this.checkOverflow();if(this._autoScaleGuard)return this._autoScaleGuard=!1,void this.checkOverflow();const e=this.element,{width:s}=u(e);if(s<=0)return void this.checkOverflow();this._lastObservedWidth=s;const a=this.componentStyle((t=>{var e;return(null===(e=t.global)||void 0===e?void 0:e.fontSizePx)||13.3333})),r=e.scrollWidth,n=this.appliedScaleFactor;if(!Number.isFinite(r)||r<=s+1)return this.errors.remove("AUTO_scale"),void this.checkOverflow();const o=Math.max(.3,n*(s-1)/r);Math.abs(o-n)<.01||(e.style.setProperty("--bn-font-size",a*o+"px"),"empty"===t?this.errors.addOrReplace({id:"AUTO_scale",type:"warning",message:"Auto-scaled chart by factor "+o.toFixed(3)}):this.errors.remove("AUTO_scale"),this._autoScaleGuard=!0,i((()=>{this.appliedScaleFactor=o}))),this.checkOverflow()}checkOverflow(){d(this.element,"ibcs-chart-bubble",this.errors)}componentDidLoad(){this.layoutObserver=p(this.element,(()=>{if(this._autoScaleGuard)return;const{width:t}=u(this.element);t>0&&Math.abs(t-this._lastObservedWidth)>2?(this._lastObservedWidth=t,s(this)):this.checkOverflow()})),requestAnimationFrame((()=>{requestAnimationFrame((()=>{if(this._autoScaleGuard)return;const{width:t}=u(this.element);this._lastObservedWidth=t,s(this)}))}))}disconnectedCallback(){var t;null===(t=this.layoutObserver)||void 0===t||t.disconnect(),this.layoutObserver=null}labelDefaults(){return{points:"all",values:!0,max:12}}setBlockingError(t,e){null===e?(this.errors.remove(t),this.activeErrors.delete(t)):(this.errors.addOrReplace({id:t,type:"error",message:e}),this.activeErrors.add(t))}hasBlockingErrors(){return this.activeErrors.size>0}validateSizeScaling(){var t;const e=null===(t=this.prepareSize())||void 0===t?void 0:t.group;this.setBlockingError("ERR_xy_scale_group",void 0===e||this.pixelPerUnitGroupMap.has(e)?null:this.t(".bubble-scale-group-unknown",{group:e}))}validateMeasureSpec(t,e,i,s){var a;const r="ERR_xy_json_"+t,n="ERR_xy_measure_"+t,o="WARN_xy_fields_"+t,{data:l,parseError:h}=k(e,"measure");if(h)return this.setBlockingError(r,this.t(".xy-prop-json",{prop:t})),this.setBlockingError(n,null),void this.errors.remove(o);if(this.setBlockingError(r,null),null===l)return this.setBlockingError(n,i?this.t(".xy-measure-invalid",{prop:t,measure:""}):null),void this.errors.remove(o);const c=null!==(a=l.measure)&&void 0!==a?a:"";b(c)?this.setBlockingError(n,null):this.setBlockingError(n,this.t(".xy-measure-invalid",{prop:t,measure:c})),this.reportSpecIssues(o,t,s(l))}validateObjectSpec(t,e,i){const s="ERR_xy_json_"+t,a="WARN_xy_fields_"+t,{data:r,parseError:n}=k(e,null);if(n)return this.setBlockingError(s,this.t(".xy-prop-json",{prop:t})),void this.errors.remove(a);this.setBlockingError(s,null),null!==r?this.reportSpecIssues(a,t,i(r)):this.errors.remove(a)}reportSpecIssues(t,e,i){const s=[];null!==i&&i.invalidFields.length>0&&s.push("invalid: "+i.invalidFields.join(", ")),null!==i&&i.unknownKeys.length>0&&s.push("unknown: "+i.unknownKeys.join(", ")),s.length>0?this.errors.addOrReplace({id:t,type:"warning",message:`${e}: ignored sub-fields (${s.join("; ")}).`}):this.errors.remove(t)}prepareAxis(t,e){const{data:i,parseError:s}=k(e,"measure");if(s||null===i)return null;const{config:a}=$(i);return null!==a&&b(a.measure)?(void 0!==a.min&&void 0!==a.max&&a.min>=a.max?(this.errors.addOrReplace({id:"WARN_xy_domain_"+t,type:"warning",message:t+": min must be smaller than max; the override is ignored."}),a.min=void 0,a.max=void 0):this.errors.remove("WARN_xy_domain_"+t),a):null}prepareSize(){const{data:t,parseError:e}=k(this.size,"measure");if(e||null===t)return null;const{config:i}=z(t);return null!==i&&b(i.measure)?i:null}prepareShare(){const{data:t,parseError:e}=k(this.share,"measure");if(e||null===t)return null;const{config:i}=A(t);return null!==i&&b(i.measure)?i:null}prepareCompareFamily(){var t;const e=null===(t=this.compareWith)||void 0===t?void 0:t.trim().toLowerCase();return G.includes(e)?e:null}prepareLabels(){const t=this.labelDefaults(),{data:e,parseError:i}=k(this.labels,null);return i||null===e?{points:t.points,values:t.values,max:t.max}:O(e,t).config}prepareLegend(){const{data:t,parseError:e}=k(this.legend,null);return e||null===t?{show:!0,position:"right"}:F(t).config}prepareFacet(){const{data:t,parseError:e}=k(this.facet,null);return e||null===t?null:C(t).config}preparePointLevel(){var t,e;const i=null===(t=this.level)||void 0===t?void 0:t.trim().toLowerCase();if("category"===i)return"category";if("subcategory"===i)return"subCategory";const s=null===(e=this.datasetMeta)||void 0===e?void 0:e.suggestedLevel;return"rowGroup"===s||"category"===s||"subCategory"===s?s:"category"}prepareSeriesLevel(t){var e;const i=null===(e=this.seriesLevel)||void 0===e?void 0:e.trim().toLowerCase();return"none"===i?null:"rowgroup"===i?"rowGroup":"category"===i||"subCategory"===t?"category":"category"===t?"rowGroup":null}validateCrossProp(t,e){const i=new Set;let s=!1;for(const e of t){if(void 0===e)continue;const t=L(e);null!==t&&("scenario"===t.kind?i.add(j(t.slot)):s=!0)}this.setBlockingError("ERR_xy_family",i.size>1?this.t(".xy-family-mixed",{families:[...i].join(", ")}):null);const a=this.prepareCompareFamily();this.setBlockingError("ERR_xy_compare_variance",null!==a&&s?this.t(".xy-compare-variance"):null),this.setBlockingError("ERR_xy_compare_family",null!==a&&1===i.size&&i.has(a)?`compare-with: '${a}' is already the primary scenario family.`:null);const r=this.preparePointLevel(),n=this.prepareSeriesLevel(r),o=null!==e?"rowgroup"===e.level?"rowGroup":"category":null;let l=null;if(null!==n&&M[n]>=M[r]&&(l=`series '${n}' vs point '${r}'`),null!==o){const t=null!=n?n:r;M[o]>=M[t]&&(l=`facet '${o}' vs '${t}'`)}this.setBlockingError("ERR_xy_level_order",null!==l?this.t(".xy-level-order",{detail:l}):null)}parseAspect(t){const e=/^\s*(\d+(?:\.\d+)?)\s*:\s*(\d+(?:\.\d+)?)\s*$/.exec(null!=t?t:"");if(null===e)return null;const i=Number(e[1]),s=Number(e[2]);return i<=0||s<=0?null:i/s}prepareAspect(){var t;return null!==(t=this.parseAspect(this.aspect))&&void 0!==t?t:16/9}prepareLimit(){const t=Math.floor(Number(this.limit)||0);return t>0?t:0}prepareSizeAreaPerUnit(){var t;const e=null===(t=this.prepareSize())||void 0===t?void 0:t.group;if(void 0===e||!this.pixelPerUnitGroupMap.has(e))return 0;const i=this.pixelPerUnitGroupMap.get(e);if(!(i>0))return 0;const s=this.getEffectiveFontPx();return s*s/i}i18nLocalKeys(){return["no-data","axis.in","legend.title","legend.size","legend.compare"]}prepareI18n(){const t=new Map(this.i18nLocalKeys().map((t=>[t,this.t(".".concat(t))]))),e=new Map(l.map((t=>[t,this.t("global.".concat(t))])));return new Map([...e.entries(),...t.entries()])}prepareStyle(){const t=this.getEffectiveScaleFactor();return this.componentStyle((e=>{const i=e.global.fontSizePx*t;return{scaleFactors:e["bn-chart-bubble"].scaleFactors,fontStyles:{font:`${i}px ${e.global.fontFamily}`,size:i,color:e.global.fontColor,background:e.global.fontBackgroundColor,leading:1.8},axisStyles:e["bn-chart-bubble"].axisStyles,seriesColors:e["bn-chart-bubble"].seriesColors,padding:e["bn-chart-bubble"].padding}}))}async getLayoutState(t){var e;const i=null!==(e=null==t?void 0:t.detail)&&void 0!==e?e:"summary",s=h(this.element),a=this.getEffectiveScaleFactor(),r=Number.isFinite(a)&&a>0?a:1,n=this.componentStyle((t=>{var e;return(null===(e=t.global)||void 0===e?void 0:e.fontSizePx)||13.3333}))*r;return c(this.element,"ibcs-chart-bubble",this.chartTitle||void 0,{fontSizePx:n,appliedScaleFactor:r},s,i)}getEffectiveScaleFactor(){const{mode:t,factor:e}=v(this.scale);return"factor"===t?e:"auto"===t||"empty"===t?this.appliedScaleFactor:1}getEffectiveFontPx(){return this.componentStyle((t=>{var e;return(null===(e=t.global)||void 0===e?void 0:e.fontSizePx)||13.3333}))*this.getEffectiveScaleFactor()}getFontStyles(){const t=this.getEffectiveScaleFactor();return this.componentStyle((e=>{var i,s,a,r;const n=(null===(i=e.global)||void 0===i?void 0:i.fontSizePx)||13.3333;return{"--bn-font-family":(null===(s=e.global)||void 0===s?void 0:s.fontFamily)||"'Noto Sans', sans-serif","--bn-font-size":n*t+"px","--bn-font-color":(null===(a=e.global)||void 0===a?void 0:a.fontColor)||"#000000","--bn-font-background":(null===(r=e.global)||void 0===r?void 0:r.fontBackgroundColor)||"#ffffff"}}))}getDataStructure(){const t={};for(const e of["ac","pp","fc","pl"])for(const i of[1,2,3,4])t[`${e}${i}`]={type:"number",isOptional:!0,description:""};const e={x:this.prepareAxis("x",this.x),y:this.prepareAxis("y",this.y),size:this.prepareSize(),share:this.prepareShare()};for(const[i,s]of Object.entries(e)){if(null===s)continue;const e=L(s.measure);null!==e&&("scenario"===e.kind?t[e.slot].description=`${i}: ${void 0!==s.label?s.label:s.measure}`:(t[e.measure.base].description=`${i}: ${s.measure} (base)`,t[e.measure.delta].description=`${i}: ${s.measure} (delta)`))}const i=this.prepareCompareFamily();if(null!==i)for(const[s,a]of Object.entries(e)){if(null===a||"share"===s)continue;const e=L(a.measure);if(null!==e&&"scenario"===e.kind){const a=i+e.slot.replace(/^[a-z]+/,"");""===t[a].description&&(t[a].description=s+": compareWith")}}return{IBubbleChartDataRow:Object.assign({operation:{type:"string",isOptional:!1,description:""},rowGroup:{type:"string",isOptional:!0,description:""},rowGroupIndex:{type:"number",isOptional:!0,description:""},category:{type:"string",isOptional:!1,description:""},categoryIndex:{type:"number",isOptional:!1,description:""},subCategory:{type:"string",isOptional:!0,description:""},subCategoryIndex:{type:"number",isOptional:!0,description:""}},t)}}chartTemplate(){const t=this.prepareAxis("x",this.x),e=this.prepareAxis("y",this.y),i=this.prepareSize(),s=this.prepareShare(),r=this.prepareFacet();if(this.validateCrossProp([null==t?void 0:t.measure,null==e?void 0:e.measure,null==i?void 0:i.measure,null==s?void 0:s.measure],r),this.validateSizeScaling(),this.hasBlockingErrors()||null===t||null===e||null===i)return null;const n=this.preparePointLevel(),o=this.prepareI18n(),l=this.prepareStyle(),h=u(this.element).width;return a("ibcs-chart-bubble",{tableName:this.datasetName,dataVersion:this.dataVersion,chartTitle:this.chartTitle,x:t,y:e,size:i,share:s,compareFamily:this.prepareCompareFamily(),labels:this.prepareLabels(),legend:this.prepareLegend(),facet:r,pointLevel:n,seriesLevel:this.prepareSeriesLevel(n),aspect:this.prepareAspect(),limit:this.prepareLimit(),filter:this.filter,sizeAreaPerUnit:this.prepareSizeAreaPerUnit(),styles:l,i18n:o,containerWidth:h,ruleSetConfig:this.ruleSetConfig(),errors:this.errors,translate:this.translateForInner})}render(){return a(r,{key:"0bfa49a51e13bdc7a52a57539f3c9228bed2dfd1",style:this.getFontStyles()},a("div",{key:"12c6edc017728be62060ae4f9196e26e73c07e25",class:"container"},this.chartTemplate()))}get element(){return this}static get watchers(){return{filter:[{validateFilter:0}],x:[{validateX:0}],y:[{validateY:0}],size:[{validateSize:0}],share:[{validateShare:0}],compareWith:[{validateCompareWith:0}],level:[{validateLevel:0}],seriesLevel:[{validateSeriesLevel:0}],facet:[{validateFacet:0}],labels:[{validateLabels:0}],legend:[{validateLegend:0}],aspect:[{validateAspect:0}],limit:[{validateLimit:0}],scale:[{validateScale:0}]}}static get style(){return':host(.no-data){display:block;box-sizing:border-box;width:100%;height:100%}:host(.no-data)>div{float:none;width:100%;height:100%}:host(.no-data) .no-data~.no-data{display:none}.empty-state{box-sizing:border-box;display:flex;align-items:center;justify-content:center;float:none;width:100%;height:100%;min-height:3em;margin:0;padding:0.5em;overflow:hidden;border:0.1em dashed #ddd;color:#808080;font-family:var(--bn-font-family, "Noto Sans", sans-serif);font-size:var(--bn-font-size, 13.3333px);font-style:normal;text-align:center}:host{display:inline-block;position:relative;overflow:hidden;font-family:var(--bn-font-family, "Noto Sans", sans-serif);font-size:var(--bn-font-size, 13.3333px);color:var(--bn-font-color, #000000)}.container{display:flex;flex-direction:column}'}},[1,"bn-chart-bubble",{ruleset:[513],chartTitle:[1,"chart-title"],filter:[1],x:[1],y:[1],size:[1],share:[1],compareWith:[1,"compare-with"],level:[1],seriesLevel:[1,"series-level"],facet:[1],labels:[1],legend:[1],aspect:[1],limit:[2],scale:[1],datasetName:[32],dataVersion:[32],datasetMeta:[32],appliedScaleFactor:[32],getLayoutState:[64]},void 0,{filter:[{validateFilter:0}],x:[{validateX:0}],y:[{validateY:0}],size:[{validateSize:0}],share:[{validateShare:0}],compareWith:[{validateCompareWith:0}],level:[{validateLevel:0}],seriesLevel:[{validateSeriesLevel:0}],facet:[{validateFacet:0}],labels:[{validateLabels:0}],legend:[{validateLegend:0}],aspect:[{validateAspect:0}],limit:[{validateLimit:0}],scale:[{validateScale:0}]}]),T=D,I=function(){"undefined"!=typeof customElements&&["bn-chart-bubble","ibcs-chart-bubble"].forEach((t=>{switch(t){case"bn-chart-bubble":customElements.get(n(t))||customElements.define(n(t),D);break;case"ibcs-chart-bubble":customElements.get(n(t))||W()}}))};export{T as BnChartBubble,I as defineCustomElement}
|
|
1
|
+
import{p as t,H as e,w as i,f as s,h as a,a as r,t as n}from"./p-D6YGOYV1.js";import{h as l,a as o}from"./p-BVKLCz2k.js";import{o as h}from"./p-B1nL0yOa.js";import{c as d}from"./p-BIIDTtcR.js";import{g as c}from"./p-DD1zlev_.js";import{c as u}from"./p-D2Epww9R.js";import{o as p}from"./p-B6kka9sT.js";import{p as v}from"./p-Xb6Ilq8u.js";import{i as m,h as f,j as b}from"./p-DYG9FH_u.js";import{w as y}from"./p-DEHnizot.js";import{w as g}from"./p-jbp6YiHf.js";import{w as x}from"./p-BXrPfAvP.js";import{w}from"./p-CGI6XIaK.js";import{w as _}from"./p-CkW23yp2.js";import{w as S}from"./p-BDS_jiow.js";import{w as L}from"./p-DsOaqeTN.js";import{w as j}from"./p-DdGnuNtc.js";import{r as R,s as z}from"./p-BpsXOtoW.js";import{t as $,a as E,b as A,c as N,d as W,e as O,p as k}from"./p-LZ9lAY8T.js";import{s as C}from"./p-DakXa7Dp.js";import{d as F}from"./p-X9hpquOX.js";const D={rowGroup:0,category:1,subCategory:2},G=["ac","pp","fc","pl"],I=t(class extends e{validateFilter(t){const e="ERR_filter";l(t)?this.errors.addOrReplace({id:e,type:"error",message:"filter: double backticks are not allowed."}):this.errors.remove(e)}validateX(t){this.validateMeasureSpec("x",t,!0,(t=>$(t)))}validateY(t){this.validateMeasureSpec("y",t,!0,(t=>$(t)))}validateSize(t){this.validateMeasureSpec("size",t,!0,(t=>E(t))),this.validateSizeScaling()}validateShare(t){this.validateMeasureSpec("share",t,!1,(t=>A(t)))}validateCompareWith(t){const e="WARN_compareWith";m(t)||G.includes(t.trim().toLowerCase())?this.errors.remove(e):this.errors.addOrReplace({id:e,type:"warning",message:`compare-with: invalid value '${t}' - expected ${G.join("/")}; ignored.`})}validateLevel(t){const e="WARN_level",i=["auto","category","subcategory"];m(t)||i.includes(t.trim().toLowerCase())?this.errors.remove(e):this.errors.addOrReplace({id:e,type:"warning",message:`level: invalid value '${t}' - expected ${i.join("/")}; using 'auto'.`})}validateSeriesLevel(t){const e="WARN_seriesLevel",i=["auto","rowgroup","category","none"];m(t)||i.includes(t.trim().toLowerCase())?this.errors.remove(e):this.errors.addOrReplace({id:e,type:"warning",message:`series-level: invalid value '${t}' - expected ${i.join("/")}; using 'auto'.`})}validateFacet(t){this.validateObjectSpec("facet",t,(t=>N(t)))}validateLabels(t){this.validateObjectSpec("labels",t,(t=>W(t,this.labelDefaults())))}validateLegend(t){this.validateObjectSpec("legend",t,(t=>O(t)))}validateAspect(t){const e="WARN_aspect";m(t)||null!==this.parseAspect(t)?this.errors.remove(e):this.errors.addOrReplace({id:e,type:"warning",message:`aspect: invalid value '${t}' - expected "w:h" (e.g. "16:9"); using the default.`})}validateLimit(t){const e="WARN_limit";f(t)&&Number(t)>=0?this.errors.remove(e):this.errors.addOrReplace({id:e,type:"warning",message:`limit: invalid value '${t}' - expected a non-negative integer; using 0.`})}validateScale(t){const e="WARN_scale";if(m(t))return void this.errors.remove(e);const{mode:i,factor:s}=v(t);"factor"===i&&(void 0===s||s<=0)?this.errors.addOrReplace({id:e,type:"warning",message:`scale: invalid value '${t}' - expected none/auto or a positive number.`}):this.errors.remove(e)}constructor(t){super(),!1!==t&&this.__registerHost(),this.__attachShadow(),this.datasetName="",this.dataVersion=0,this.datasetMeta=null,this.appliedScaleFactor=1,this.layoutObserver=null,this.activeErrors=new Set,this.pixelPerUnitGroupMap=new Map,this.chartTitle="",this.filter="",this.share="",this.compareWith="",this.level="auto",this.seriesLevel="auto",this.facet="",this.labels="",this.legend="",this.aspect="16:9",this.limit=0,this._autoScaleGuard=!1,this._lastObservedWidth=0,this.translateForInner=(t,e)=>this.t(t,e),j(this),y(this),x(this,(t=>{this.datasetName=(null==t?void 0:t.startsWith("$"))?t.substring(1):t||"",this.dataVersion=this.dataVersion+1}),((t,e)=>{this.datasetMeta=e})),this.errors=w(this),S(this),this.componentStyle=g(this),this.ruleSetConfig=_(this),this.t=L(this).t}componentWillLoad(){this.validateFilter(this.filter),this.validateX(this.x),this.validateY(this.y),this.validateSize(this.size),this.validateShare(this.share),this.validateCompareWith(this.compareWith),this.validateLevel(this.level),this.validateSeriesLevel(this.seriesLevel),this.validateFacet(this.facet),this.validateLabels(this.labels),this.validateLegend(this.legend),this.validateAspect(this.aspect),this.validateLimit(this.limit),this.validateScale(this.scale)}componentDidRender(){C(this.element,"bn-chart-bubble-renderer");const{mode:t}=v(this.scale);if("auto"!==t&&"empty"!==t)return this._autoScaleGuard=!1,void this.checkOverflow();if(this._autoScaleGuard)return this._autoScaleGuard=!1,void this.checkOverflow();const e=this.element,{width:s}=c(e);if(s<=0)return void this.checkOverflow();this._lastObservedWidth=s;const a=this.componentStyle((t=>{var e;return(null===(e=t.global)||void 0===e?void 0:e.fontSizePx)||13.3333})),r=e.scrollWidth,n=this.appliedScaleFactor;if(!Number.isFinite(r)||r<=s+1)return this.errors.remove("AUTO_scale"),void this.checkOverflow();const l=Math.max(.3,n*(s-1)/r);Math.abs(l-n)<.01||(e.style.setProperty("--bn-font-size",a*l+"px"),"empty"===t?this.errors.addOrReplace({id:"AUTO_scale",type:"warning",message:"Auto-scaled chart by factor "+l.toFixed(3)}):this.errors.remove("AUTO_scale"),this._autoScaleGuard=!0,i((()=>{this.appliedScaleFactor=l}))),this.checkOverflow()}checkOverflow(){u(this.element,"bn-chart-bubble-renderer",this.errors)}componentDidLoad(){this.layoutObserver=p(this.element,(()=>{if(this._autoScaleGuard)return;const{width:t}=c(this.element);t>0&&Math.abs(t-this._lastObservedWidth)>2?(this._lastObservedWidth=t,s(this)):this.checkOverflow()})),requestAnimationFrame((()=>{requestAnimationFrame((()=>{if(this._autoScaleGuard)return;const{width:t}=c(this.element);this._lastObservedWidth=t,s(this)}))}))}disconnectedCallback(){var t;null===(t=this.layoutObserver)||void 0===t||t.disconnect(),this.layoutObserver=null}labelDefaults(){return{points:"all",values:!0,max:12}}setBlockingError(t,e){null===e?(this.errors.remove(t),this.activeErrors.delete(t)):(this.errors.addOrReplace({id:t,type:"error",message:e}),this.activeErrors.add(t))}hasBlockingErrors(){return this.activeErrors.size>0}validateSizeScaling(){var t;const e=null===(t=this.prepareSize())||void 0===t?void 0:t.group;this.setBlockingError("ERR_xy_scale_group",void 0===e||this.pixelPerUnitGroupMap.has(e)?null:this.t(".bubble-scale-group-unknown",{group:e}))}validateMeasureSpec(t,e,i,s){var a;const r="ERR_xy_json_"+t,n="ERR_xy_measure_"+t,l="WARN_xy_fields_"+t,{data:o,parseError:h}=k(e,"measure");if(h)return this.setBlockingError(r,this.t(".xy-prop-json",{prop:t})),this.setBlockingError(n,null),void this.errors.remove(l);if(this.setBlockingError(r,null),null===o)return this.setBlockingError(n,i?this.t(".xy-measure-invalid",{prop:t,measure:""}):null),void this.errors.remove(l);const d=null!==(a=o.measure)&&void 0!==a?a:"";b(d)?this.setBlockingError(n,null):this.setBlockingError(n,this.t(".xy-measure-invalid",{prop:t,measure:d})),this.reportSpecIssues(l,t,s(o))}validateObjectSpec(t,e,i){const s="ERR_xy_json_"+t,a="WARN_xy_fields_"+t,{data:r,parseError:n}=k(e,null);if(n)return this.setBlockingError(s,this.t(".xy-prop-json",{prop:t})),void this.errors.remove(a);this.setBlockingError(s,null),null!==r?this.reportSpecIssues(a,t,i(r)):this.errors.remove(a)}reportSpecIssues(t,e,i){const s=[];null!==i&&i.invalidFields.length>0&&s.push("invalid: "+i.invalidFields.join(", ")),null!==i&&i.unknownKeys.length>0&&s.push("unknown: "+i.unknownKeys.join(", ")),s.length>0?this.errors.addOrReplace({id:t,type:"warning",message:`${e}: ignored sub-fields (${s.join("; ")}).`}):this.errors.remove(t)}prepareAxis(t,e){const{data:i,parseError:s}=k(e,"measure");if(s||null===i)return null;const{config:a}=$(i);return null!==a&&b(a.measure)?(void 0!==a.min&&void 0!==a.max&&a.min>=a.max?(this.errors.addOrReplace({id:"WARN_xy_domain_"+t,type:"warning",message:t+": min must be smaller than max; the override is ignored."}),a.min=void 0,a.max=void 0):this.errors.remove("WARN_xy_domain_"+t),a):null}prepareSize(){const{data:t,parseError:e}=k(this.size,"measure");if(e||null===t)return null;const{config:i}=E(t);return null!==i&&b(i.measure)?i:null}prepareShare(){const{data:t,parseError:e}=k(this.share,"measure");if(e||null===t)return null;const{config:i}=A(t);return null!==i&&b(i.measure)?i:null}prepareCompareFamily(){var t;const e=null===(t=this.compareWith)||void 0===t?void 0:t.trim().toLowerCase();return G.includes(e)?e:null}prepareLabels(){const t=this.labelDefaults(),{data:e,parseError:i}=k(this.labels,null);return i||null===e?{points:t.points,values:t.values,max:t.max}:W(e,t).config}prepareLegend(){const{data:t,parseError:e}=k(this.legend,null);return e||null===t?{show:!0,position:"right"}:O(t).config}prepareFacet(){const{data:t,parseError:e}=k(this.facet,null);return e||null===t?null:N(t).config}preparePointLevel(){var t,e;const i=null===(t=this.level)||void 0===t?void 0:t.trim().toLowerCase();if("category"===i)return"category";if("subcategory"===i)return"subCategory";const s=null===(e=this.datasetMeta)||void 0===e?void 0:e.suggestedLevel;return"rowGroup"===s||"category"===s||"subCategory"===s?s:"category"}prepareSeriesLevel(t){var e;const i=null===(e=this.seriesLevel)||void 0===e?void 0:e.trim().toLowerCase();return"none"===i?null:"rowgroup"===i?"rowGroup":"category"===i||"subCategory"===t?"category":"category"===t?"rowGroup":null}validateCrossProp(t,e){const i=new Set;let s=!1;for(const e of t){if(void 0===e)continue;const t=R(e);null!==t&&("scenario"===t.kind?i.add(z(t.slot)):s=!0)}this.setBlockingError("ERR_xy_family",i.size>1?this.t(".xy-family-mixed",{families:[...i].join(", ")}):null);const a=this.prepareCompareFamily();this.setBlockingError("ERR_xy_compare_variance",null!==a&&s?this.t(".xy-compare-variance"):null),this.setBlockingError("ERR_xy_compare_family",null!==a&&1===i.size&&i.has(a)?`compare-with: '${a}' is already the primary scenario family.`:null);const r=this.preparePointLevel(),n=this.prepareSeriesLevel(r),l=null!==e?"rowgroup"===e.level?"rowGroup":"category":null;let o=null;if(null!==n&&D[n]>=D[r]&&(o=`series '${n}' vs point '${r}'`),null!==l){const t=null!=n?n:r;D[l]>=D[t]&&(o=`facet '${l}' vs '${t}'`)}this.setBlockingError("ERR_xy_level_order",null!==o?this.t(".xy-level-order",{detail:o}):null)}parseAspect(t){const e=/^\s*(\d+(?:\.\d+)?)\s*:\s*(\d+(?:\.\d+)?)\s*$/.exec(null!=t?t:"");if(null===e)return null;const i=Number(e[1]),s=Number(e[2]);return i<=0||s<=0?null:i/s}prepareAspect(){var t;return null!==(t=this.parseAspect(this.aspect))&&void 0!==t?t:16/9}prepareLimit(){const t=Math.floor(Number(this.limit)||0);return t>0?t:0}prepareSizeAreaPerUnit(){var t;const e=null===(t=this.prepareSize())||void 0===t?void 0:t.group;if(void 0===e||!this.pixelPerUnitGroupMap.has(e))return 0;const i=this.pixelPerUnitGroupMap.get(e);if(!(i>0))return 0;const s=this.getEffectiveFontPx();return s*s/i}i18nLocalKeys(){return["no-data","axis.in","legend.title","legend.size","legend.compare"]}prepareI18n(){const t=new Map(this.i18nLocalKeys().map((t=>[t,this.t(".".concat(t))]))),e=new Map(o.map((t=>[t,this.t("global.".concat(t))])));return new Map([...e.entries(),...t.entries()])}prepareStyle(){const t=this.getEffectiveScaleFactor();return this.componentStyle((e=>{const i=e.global.fontSizePx*t;return{scaleFactors:e["bn-chart-bubble"].scaleFactors,fontStyles:{font:`${i}px ${e.global.fontFamily}`,size:i,color:e.global.fontColor,background:e.global.fontBackgroundColor,leading:1.8},axisStyles:e["bn-chart-bubble"].axisStyles,seriesColors:e["bn-chart-bubble"].seriesColors,padding:e["bn-chart-bubble"].padding}}))}async getLayoutState(t){var e;const i=null!==(e=null==t?void 0:t.detail)&&void 0!==e?e:"summary",s=h(this.element),a=this.getEffectiveScaleFactor(),r=Number.isFinite(a)&&a>0?a:1,n=this.componentStyle((t=>{var e;return(null===(e=t.global)||void 0===e?void 0:e.fontSizePx)||13.3333}))*r;return d(this.element,"bn-chart-bubble-renderer",this.chartTitle||void 0,{fontSizePx:n,appliedScaleFactor:r},s,i)}getEffectiveScaleFactor(){const{mode:t,factor:e}=v(this.scale);return"factor"===t?e:"auto"===t||"empty"===t?this.appliedScaleFactor:1}getEffectiveFontPx(){return this.componentStyle((t=>{var e;return(null===(e=t.global)||void 0===e?void 0:e.fontSizePx)||13.3333}))*this.getEffectiveScaleFactor()}getFontStyles(){const t=this.getEffectiveScaleFactor();return this.componentStyle((e=>{var i,s,a,r;const n=(null===(i=e.global)||void 0===i?void 0:i.fontSizePx)||13.3333;return{"--bn-font-family":(null===(s=e.global)||void 0===s?void 0:s.fontFamily)||"'Noto Sans', sans-serif","--bn-font-size":n*t+"px","--bn-font-color":(null===(a=e.global)||void 0===a?void 0:a.fontColor)||"#000000","--bn-font-background":(null===(r=e.global)||void 0===r?void 0:r.fontBackgroundColor)||"#ffffff"}}))}getDataStructure(){const t={};for(const e of["ac","pp","fc","pl"])for(const i of[1,2,3,4])t[`${e}${i}`]={type:"number",isOptional:!0,description:""};const e={x:this.prepareAxis("x",this.x),y:this.prepareAxis("y",this.y),size:this.prepareSize(),share:this.prepareShare()};for(const[i,s]of Object.entries(e)){if(null===s)continue;const e=R(s.measure);null!==e&&("scenario"===e.kind?t[e.slot].description=`${i}: ${void 0!==s.label?s.label:s.measure}`:(t[e.measure.base].description=`${i}: ${s.measure} (base)`,t[e.measure.delta].description=`${i}: ${s.measure} (delta)`))}const i=this.prepareCompareFamily();if(null!==i)for(const[s,a]of Object.entries(e)){if(null===a||"share"===s)continue;const e=R(a.measure);if(null!==e&&"scenario"===e.kind){const a=i+e.slot.replace(/^[a-z]+/,"");""===t[a].description&&(t[a].description=s+": compareWith")}}return{IBubbleChartDataRow:Object.assign({operation:{type:"string",isOptional:!1,description:""},rowGroup:{type:"string",isOptional:!0,description:""},rowGroupIndex:{type:"number",isOptional:!0,description:""},category:{type:"string",isOptional:!1,description:""},categoryIndex:{type:"number",isOptional:!1,description:""},subCategory:{type:"string",isOptional:!0,description:""},subCategoryIndex:{type:"number",isOptional:!0,description:""}},t)}}chartTemplate(){const t=this.prepareAxis("x",this.x),e=this.prepareAxis("y",this.y),i=this.prepareSize(),s=this.prepareShare(),r=this.prepareFacet();if(this.validateCrossProp([null==t?void 0:t.measure,null==e?void 0:e.measure,null==i?void 0:i.measure,null==s?void 0:s.measure],r),this.validateSizeScaling(),this.hasBlockingErrors()||null===t||null===e||null===i)return null;const n=this.preparePointLevel(),l=this.prepareI18n(),o=this.prepareStyle(),h=c(this.element).width;return a("bn-chart-bubble-renderer",{tableName:this.datasetName,dataVersion:this.dataVersion,chartTitle:this.chartTitle,x:t,y:e,size:i,share:s,compareFamily:this.prepareCompareFamily(),labels:this.prepareLabels(),legend:this.prepareLegend(),facet:r,pointLevel:n,seriesLevel:this.prepareSeriesLevel(n),aspect:this.prepareAspect(),limit:this.prepareLimit(),filter:this.filter,sizeAreaPerUnit:this.prepareSizeAreaPerUnit(),styles:o,i18n:l,containerWidth:h,ruleSetConfig:this.ruleSetConfig(),errors:this.errors,translator:this.translateForInner})}render(){return a(r,{key:"2c420ff611b866ae161e3e4a559f7a5a69d1cd33",style:this.getFontStyles()},a("div",{key:"5ae3d9c267424e71aac4b689bd0fbb757f442e9e",class:"container"},this.chartTemplate()))}get element(){return this}static get watchers(){return{filter:[{validateFilter:0}],x:[{validateX:0}],y:[{validateY:0}],size:[{validateSize:0}],share:[{validateShare:0}],compareWith:[{validateCompareWith:0}],level:[{validateLevel:0}],seriesLevel:[{validateSeriesLevel:0}],facet:[{validateFacet:0}],labels:[{validateLabels:0}],legend:[{validateLegend:0}],aspect:[{validateAspect:0}],limit:[{validateLimit:0}],scale:[{validateScale:0}]}}static get style(){return':host(.no-data){display:block;box-sizing:border-box;width:100%;height:100%}:host(.no-data)>div{float:none;width:100%;height:100%}:host(.no-data) .no-data~.no-data{display:none}.empty-state{box-sizing:border-box;display:flex;align-items:center;justify-content:center;float:none;width:100%;height:100%;min-height:3em;margin:0;padding:0.5em;overflow:hidden;border:0.1em dashed #ddd;color:#808080;font-family:var(--bn-font-family, "Noto Sans", sans-serif);font-size:var(--bn-font-size, 13.3333px);font-style:normal;text-align:center}:host{display:inline-block;position:relative;overflow:hidden;font-family:var(--bn-font-family, "Noto Sans", sans-serif);font-size:var(--bn-font-size, 13.3333px);color:var(--bn-font-color, #000000)}.container{display:flex;flex-direction:column}'}},[1,"bn-chart-bubble",{datasets:[513],selectedStyle:[513,"selected-style"],i18nNamespace:[513,"i18n-namespace"],ruleset:[513],chartTitle:[1,"chart-title"],filter:[1],x:[1],y:[1],size:[1],share:[1],compareWith:[1,"compare-with"],level:[1],seriesLevel:[1,"series-level"],facet:[1],labels:[1],legend:[1],aspect:[1],limit:[2],scale:[1],datasetName:[32],dataVersion:[32],datasetMeta:[32],appliedScaleFactor:[32],getLayoutState:[64]},void 0,{filter:[{validateFilter:0}],x:[{validateX:0}],y:[{validateY:0}],size:[{validateSize:0}],share:[{validateShare:0}],compareWith:[{validateCompareWith:0}],level:[{validateLevel:0}],seriesLevel:[{validateSeriesLevel:0}],facet:[{validateFacet:0}],labels:[{validateLabels:0}],legend:[{validateLegend:0}],aspect:[{validateAspect:0}],limit:[{validateLimit:0}],scale:[{validateScale:0}]}]),B=I,M=function(){"undefined"!=typeof customElements&&["bn-chart-bubble","bn-chart-bubble-renderer"].forEach((t=>{switch(t){case"bn-chart-bubble":customElements.get(n(t))||customElements.define(n(t),I);break;case"bn-chart-bubble-renderer":customElements.get(n(t))||F()}}))};export{B as BnChartBubble,M as defineCustomElement}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { Components, JSX } from "../types/components";
|
|
2
|
+
|
|
3
|
+
interface BnChartBulletRenderer extends Components.BnChartBulletRenderer, HTMLElement {}
|
|
4
|
+
export const BnChartBulletRenderer: {
|
|
5
|
+
prototype: BnChartBulletRenderer;
|
|
6
|
+
new (): BnChartBulletRenderer;
|
|
7
|
+
};
|
|
8
|
+
/**
|
|
9
|
+
* Used to define this component and all nested components recursively.
|
|
10
|
+
*/
|
|
11
|
+
export const defineCustomElement: () => void;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{B as o,d as p}from"./p-DUHp_9X-.js";const s=o,r=p;export{s as BnChartBulletRenderer,r as defineCustomElement}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{proxyCustomElement as t,HTMLElement as e,writeTask as i,forceUpdate as s,h as a,Host as r,transformTag as n}from"@stencil/core/internal/client";import{h as l,a as o}from"./context-protocol.js";import{o as h}from"./geometry.js";import{c as u}from"./svgChartElements.js";import{C as d,A as c}from"./CompareUtil.js";import{o as v}from"./layoutObserver.js";import{a as p,b as m,O as g}from"./Order.js";import{g as f}from"./parentDimensions.js";import{p as b}from"./scaling.js";import{b as y,i as _,c as w,h as R}from"./validate.js";import{w as O}from"./withComponentStatus.js";import{w as j}from"./withComponentStyle.js";import{w as A}from"./withDataset.js";import{w as E}from"./withHasError.js";import{w as S}from"./withRuleSet.js";import{w as x}from"./withTranslation.js";import{w as N}from"./withStyled.js";import{r as T}from"./VarianceMeasure.js";import{p as z}from"./AxisConfig.js";import{s as k}from"./emptyState.js";import{d as L}from"./ibcs-chart-bullet2.js";const $=["measure","label","unit"];function U(t){const e=[],i=W(t,"measure",e);if(void 0===i||""===i.trim())return e.push("measure"),{config:null,unknownKeys:M(t,$),invalidFields:e};const s={measure:i.trim()};return s.label=W(t,"label",e),s.unit=W(t,"unit",e),{config:s,unknownKeys:M(t,$),invalidFields:e}}const D=["show","decimals"];function F(t,e){const i=[],s={show:e.show,decimals:e.decimals};return d.isExisting(t.show)&&("auto"===t.show||"none"===t.show?s.show=t.show:i.push("show")),d.isExisting(t.decimals)&&(d.isNumber(t.decimals)&&t.decimals>=0&&t.decimals<=4?s.decimals=Math.floor(t.decimals):i.push("decimals")),{config:s,unknownKeys:M(t,D),invalidFields:i}}function C(t){var e;const i=null!==(e=null==t?void 0:t.trim())&&void 0!==e?e:"";if(""===i||"null"===i)return{ranges:[],parseError:!1,issues:[]};let s;try{s=JSON.parse(i)}catch(t){return{ranges:[],parseError:!0,issues:[]}}if(!Array.isArray(s)||0===s.length)return{ranges:[],parseError:!0,issues:[]};if(!s.every((t=>d.isNumber(t)&&isFinite(t)&&t>0)))return{ranges:[],parseError:!0,issues:[]};const a=[];let r=s;const n=[...r].sort(((t,e)=>t-e));return n.some(((t,e)=>t!==r[e]))&&a.push("not ascending, sorted"),r=n,r.length>2&&(a.push(r.length+" entries, first 2 kept"),r=r.slice(0,2)),{ranges:r,parseError:!1,issues:a}}function M(t,e){return Object.keys(t).filter((t=>!e.includes(t)))}function W(t,e,i){if(d.isExisting(t[e]))return d.isString(t[e])?t[e]:void i.push(e)}const V=["pl1","pp1","fc1"],I=t(class extends e{validateFilter(t){const e="ERR_filter";l(t)?this.errors.addOrReplace({id:e,type:"error",message:"filter: double backticks are not allowed."}):this.errors.remove(e)}validateActual(t){this.validateMeasureSpec("actual",t)}validateTarget(t){this.validateMeasureSpec("target",t)}validateRanges(t){const e="ERR_bullet_json_ranges",i="WARN_bullet_ranges",s=C(t);if(s.parseError)return this.setBlockingError(e,this.t(".bullet-prop-json",{prop:"ranges"})),void this.errors.remove(i);this.setBlockingError(e,null),s.issues.length>0?this.errors.addOrReplace({id:i,type:"warning",message:this.t(".bullet-ranges-invalid",{detail:s.issues.join("; ")})}):this.errors.remove(i)}validateNormalize(t){this.validateEnum("normalize","ERR_normalize",t,["target","none"],"target")}validateVariances(t){this.validateEnum("variances","ERR_variances",t,["auto","none"],"auto")}validateLevel(t){this.validateEnum("level","ERR_level",t,["auto","rowgroup","category","subcategory"],"auto")}validateOrder(t){const e="ERR_order",i=y(t).filter((t=>""!==t));0===i.length?this.errors.remove(e):this.errors.addOrReplace({id:e,type:"warning",message:`order: invalid value(s) '${i.join(", ")}'; using the dataset order.`})}validateOrderDirection(t){const e="ERR_orderDirection";_(t)||w(t)?this.errors.remove(e):this.errors.addOrReplace({id:e,type:"warning",message:`order-direction: invalid value '${t}' - expected asc/desc; using asc.`})}validateLimit(t){const e="ERR_limit";R(t)&&Number(t)>=0?this.errors.remove(e):this.errors.addOrReplace({id:e,type:"warning",message:`limit: invalid value '${t}' - expected a non-negative integer; using 0.`})}validateLabels(t){const e="ERR_bullet_json_labels",i="WARN_bullet_fields_labels",{data:s,parseError:a}=z(t,null);if(a)return this.setBlockingError(e,this.t(".bullet-prop-json",{prop:"labels"})),void this.errors.remove(i);this.setBlockingError(e,null),null!==s?this.reportSpecIssues(i,"labels",F(s,this.labelDefaults())):this.errors.remove(i)}validateScale(t){const e="ERR_scale";if(_(t))return void this.errors.remove(e);const{mode:i,factor:s}=b(t);"factor"===i&&(void 0===s||s<=0)?this.errors.addOrReplace({id:e,type:"warning",message:`scale: invalid value '${t}' - expected none/auto or a positive number.`}):this.errors.remove(e)}constructor(t){super(),!1!==t&&this.__registerHost(),this.__attachShadow(),this.datasetName="",this.dataVersion=0,this.datasetMeta=null,this.appliedScaleFactor=1,this.layoutObserver=null,this.activeErrors=new Set,this.chartTitle="",this.filter="",this.actual="",this.target="",this.ranges="",this.normalize="target",this.variances="auto",this.level="auto",this.order="",this.orderDirection="",this.limit=0,this.labels="",this._autoScaleGuard=!1,this._lastScaledParentHeight=0,this.translateForInner=(t,e)=>this.t(t,e),N(this),O(this),A(this,(t=>{this.datasetName=(null==t?void 0:t.startsWith("$"))?t.substring(1):t||"",this.dataVersion=this.dataVersion+1}),((t,e)=>{this.datasetMeta=e})),this.errors=E(this),this.componentStyle=j(this),this.ruleSetConfig=S(this),this.t=x(this).t}componentWillLoad(){this.validateFilter(this.filter),this.validateActual(this.actual),this.validateTarget(this.target),this.validateRanges(this.ranges),this.validateNormalize(this.normalize),this.validateVariances(this.variances),this.validateLevel(this.level),this.validateOrder(this.order),this.validateOrderDirection(this.orderDirection),this.validateLimit(this.limit),this.validateLabels(this.labels),this.validateScale(this.scale)}componentDidRender(){k(this.element,"ibcs-chart-bullet");const{mode:t}=b(this.scale);if("auto"!==t&&"empty"!==t)return void(this._autoScaleGuard=!1);if(this._autoScaleGuard)return void(this._autoScaleGuard=!1);const e=this.element,{height:s}=f(e);if(s<=0)return;this._lastScaledParentHeight=s;const a=this.componentStyle((t=>{var e;return(null===(e=t.global)||void 0===e?void 0:e.fontSizePx)||13.3333})),r=e.scrollHeight,n=this.appliedScaleFactor;if(r<=s+1)return void this.errors.remove("AUTO_scale");const l=Math.max(.3,n*(s-1)/r);Math.abs(l-n)<.01||(e.style.setProperty("--bn-font-size",a*l+"px"),"empty"===t?this.errors.addOrReplace({id:"AUTO_scale",type:"warning",message:"Auto-scaled chart by factor "+l.toFixed(3)}):this.errors.remove("AUTO_scale"),this._autoScaleGuard=!0,i((()=>{this.appliedScaleFactor=l})))}componentDidLoad(){this.layoutObserver=v(this.element,(()=>{if(this._autoScaleGuard)return;const{height:t}=f(this.element);t>0&&Math.abs(t-this._lastScaledParentHeight)>2&&(this._lastScaledParentHeight=t,s(this))})),requestAnimationFrame((()=>{requestAnimationFrame((()=>{if(this._autoScaleGuard)return;const{height:t}=f(this.element);this._lastScaledParentHeight=t,s(this)}))}))}disconnectedCallback(){var t;null===(t=this.layoutObserver)||void 0===t||t.disconnect(),this.layoutObserver=null}labelDefaults(){return{show:"auto",decimals:1}}setBlockingError(t,e){null===e?(this.errors.remove(t),this.activeErrors.delete(t)):(this.errors.addOrReplace({id:t,type:"error",message:e}),this.activeErrors.add(t))}hasBlockingErrors(){return this.activeErrors.size>0}validateMeasureSpec(t,e){var i;const s="ERR_bullet_json_"+t,a="ERR_bullet_measure_"+t,r="WARN_bullet_fields_"+t,{data:n,parseError:l}=z(e,"measure");if(l)return this.setBlockingError(s,this.t(".bullet-prop-json",{prop:t})),this.setBlockingError(a,null),void this.errors.remove(r);if(this.setBlockingError(s,null),null===n)return this.setBlockingError(a,null),void this.errors.remove(r);const o=(null!==(i=n.measure)&&void 0!==i?i:"").trim(),h=T(o);"auto"===o.toLowerCase()||null!==h&&"scenario"===h.kind?this.setBlockingError(a,null):this.setBlockingError(a,this.t(".bullet-measure-invalid",{prop:t,measure:o})),this.reportSpecIssues(r,t,U(n))}validateEnum(t,e,i,s,a){_(i)||s.includes(i.trim().toLowerCase())?this.errors.remove(e):this.errors.addOrReplace({id:e,type:"warning",message:`${t}: invalid value '${i}' - expected ${s.join("/")}; using '${a}'.`})}reportSpecIssues(t,e,i){const s=[];null!==i&&i.invalidFields.length>0&&s.push("invalid: "+i.invalidFields.join(", ")),null!==i&&i.unknownKeys.length>0&&s.push("unknown: "+i.unknownKeys.join(", ")),s.length>0?this.errors.addOrReplace({id:t,type:"warning",message:`${e}: ignored sub-fields (${s.join("; ")}).`}):this.errors.remove(t)}prepareActual(){var t,e,i,s,a;const{data:r,parseError:n}=z(this.actual,"measure");if(n)return null;const l=null!==r?U(r).config:null;if(null===l||"auto"===l.measure.toLowerCase()){const a=null!==l,r=null!==(e=null===(t=this.datasetMeta)||void 0===t?void 0:t.availableScenarios)&&void 0!==e?e:[],n=null!==(s=r.includes("ac1")?"ac1":null!==(i=r.find((t=>t.startsWith("ac"))))&&void 0!==i?i:r[0])&&void 0!==s?s:"ac1";return a||null===this.datasetMeta?this.errors.remove("AUTO_actual"):this.errors.addOrReplace({id:"AUTO_actual",type:"warning",message:"actual: not set, auto-detected: "+n}),null===l?{measure:n}:Object.assign(Object.assign({},l),{measure:n})}return this.errors.remove("AUTO_actual"),"scenario"===(null===(a=T(l.measure))||void 0===a?void 0:a.kind)?l:null}prepareTarget(){var t,e,i;const{data:s,parseError:a}=z(this.target,"measure");if(a)return null;const r=null!==s?U(s).config:null;if(null===r||"auto"===r.measure.toLowerCase()){const i=null!==r,s=null!==(e=null===(t=this.datasetMeta)||void 0===t?void 0:t.availableScenarios)&&void 0!==e?e:[],a=V.find((t=>s.includes(t)));return void 0===a?(this.errors.remove("AUTO_target"),null!==this.datasetMeta?this.errors.addOrReplace({id:"WARN_bullet_target_unavailable",type:"warning",message:this.t(".bullet-target-none")}):this.errors.remove("WARN_bullet_target_unavailable"),null):(this.errors.remove("WARN_bullet_target_unavailable"),i||null===this.datasetMeta?this.errors.remove("AUTO_target"):this.errors.addOrReplace({id:"AUTO_target",type:"warning",message:"target: not set, auto-detected: "+a}),null===r?{measure:a}:Object.assign(Object.assign({},r),{measure:a}))}return this.errors.remove("AUTO_target"),this.errors.remove("WARN_bullet_target_unavailable"),"scenario"===(null===(i=T(r.measure))||void 0===i?void 0:i.kind)?r:null}prepareNormalize(){var t;return"none"===(null===(t=this.normalize)||void 0===t?void 0:t.trim().toLowerCase())?"none":"target"}prepareShowVariances(){var t;return"none"!==(null===(t=this.variances)||void 0===t?void 0:t.trim().toLowerCase())}prepareLevel(){var t,e;const i=null===(t=this.level)||void 0===t?void 0:t.trim().toLowerCase();if("rowgroup"===i)return c.ROWGROUP;if("category"===i)return c.CATEGORY;if("subcategory"===i)return c.SUBCATEGORY;const s=null===(e=this.datasetMeta)||void 0===e?void 0:e.suggestedLevel;if(void 0!==s&&""!==s){const t=c[s.toUpperCase()];if(void 0!==t)return t}return c.CATEGORY}prepareOrder(){var t,e,i,s;const a="auto"===(null===(t=this.order)||void 0===t?void 0:t.trim().toLowerCase());let r;_(this.order)||a?(null===(e=this.datasetMeta)||void 0===e?void 0:e.suggestedOrder)?(a?this.errors.remove("AUTO_order"):this.errors.addOrReplace({id:"AUTO_order",type:"warning",message:"order: not set, auto-detected: "+this.datasetMeta.suggestedOrder}),r=this.datasetMeta.suggestedOrder):(this.errors.remove("AUTO_order"),r=""):(this.errors.remove("AUTO_order"),r=this.order);const n=null!==(s=p[null===(i=this.orderDirection)||void 0===i?void 0:i.toUpperCase()])&&void 0!==s?s:p.ASC;if(_(r))return new m([g.CATEGORYINDEX],n);const l=r.split(",").map((t=>g[t.trim().toUpperCase()])).filter((t=>void 0!==t));return new m(l.length>0?l:[g.CATEGORYINDEX],n)}prepareLabels(){const t=this.labelDefaults(),{data:e,parseError:i}=z(this.labels,null);return i||null===e?{show:t.show,decimals:t.decimals}:F(e,t).config}prepareLimit(){const t=Math.floor(Number(this.limit)||0);return t>0?t:0}i18nLocalKeys(){return["no-data","target","axis.in"]}prepareI18n(){const t=new Map(this.i18nLocalKeys().map((t=>[t,this.t(".".concat(t))]))),e=new Map(o.map((t=>[t,this.t("global.".concat(t))])));return new Map([...e.entries(),...t.entries()])}prepareStyle(){const t=this.getEffectiveScaleFactor();return this.componentStyle((e=>{const i=e.global.fontSizePx*t;return{scaleFactors:e["bn-chart-bullet"].scaleFactors,fontStyles:{font:`${i}px ${e.global.fontFamily}`,size:i,color:e.global.fontColor,background:e.global.fontBackgroundColor,leading:1.8},axisStyles:e["bn-chart-bullet"].axisStyles,barStyles:e["bn-chart-bullet"].barStyles,varianceStyles:e["bn-chart-bullet"].varianceStyles,rangeColors:e["bn-chart-bullet"].rangeColors,padding:e["bn-chart-bullet"].padding}}))}async getLayoutState(t){var e;const i=null!==(e=null==t?void 0:t.detail)&&void 0!==e?e:"summary",s=h(this.element),a=this.getEffectiveScaleFactor(),r=Number.isFinite(a)&&a>0?a:1,n=this.componentStyle((t=>{var e;return(null===(e=t.global)||void 0===e?void 0:e.fontSizePx)||13.3333}))*r;return u(this.element,"ibcs-chart-bullet",this.chartTitle||void 0,{fontSizePx:n,appliedScaleFactor:r},s,i)}getEffectiveScaleFactor(){const{mode:t,factor:e}=b(this.scale);return"factor"===t?e:"auto"===t||"empty"===t?this.appliedScaleFactor:1}getFontStyles(){const t=this.getEffectiveScaleFactor();return this.componentStyle((e=>{var i,s,a,r;const n=(null===(i=e.global)||void 0===i?void 0:i.fontSizePx)||13.3333;return{"--bn-font-family":(null===(s=e.global)||void 0===s?void 0:s.fontFamily)||"'Noto Sans', sans-serif","--bn-font-size":n*t+"px","--bn-font-color":(null===(a=e.global)||void 0===a?void 0:a.fontColor)||"#000000","--bn-font-background":(null===(r=e.global)||void 0===r?void 0:r.fontBackgroundColor)||"#ffffff"}}))}getDataStructure(){const t={};for(const e of["ac","pp","fc","pl"])for(const i of[1,2,3,4])t[`${e}${i}`]={type:"number",isOptional:!0,description:""};const e={actual:this.prepareActual(),target:this.prepareTarget()};for(const[i,s]of Object.entries(e))null!==s&&void 0!==t[s.measure]&&(t[s.measure].description=`${i}: ${void 0!==s.label?s.label:s.measure}`);return{IBulletChartDataRow:Object.assign({operation:{type:"string",isOptional:!1,description:""},rowGroup:{type:"string",isOptional:!0,description:""},rowGroupIndex:{type:"number",isOptional:!0,description:""},category:{type:"string",isOptional:!1,description:""},categoryIndex:{type:"number",isOptional:!1,description:""},subCategory:{type:"string",isOptional:!0,description:""},subCategoryIndex:{type:"number",isOptional:!0,description:""}},t)}}chartTemplate(){const t=this.prepareActual(),e=this.prepareTarget(),i=C(this.ranges).ranges,s=this.prepareNormalize();return this.setBlockingError("ERR_bullet_measure_same",null!==t&&null!==e&&t.measure===e.measure?this.t(".bullet-measure-same",{measure:t.measure}):null),i.length>0&&"target"===s?this.errors.addOrReplace({id:"WARN_bullet_ranges_ignored",type:"warning",message:this.t(".bullet-ranges-ignored")}):this.errors.remove("WARN_bullet_ranges_ignored"),this.hasBlockingErrors()||null===t?null:a("ibcs-chart-bullet",{tableName:this.datasetName,dataVersion:this.dataVersion,chartTitle:this.chartTitle,actual:t,target:e,ranges:i,normalize:s,showVariances:this.prepareShowVariances(),level:this.prepareLevel(),order:this.prepareOrder(),limit:this.prepareLimit(),labels:this.prepareLabels(),filter:this.filter,styles:this.prepareStyle(),i18n:this.prepareI18n(),containerWidth:f(this.element).width,ruleSetConfig:this.ruleSetConfig(),errors:this.errors,translate:this.translateForInner})}render(){return a(r,{key:"895f33380b663aff0f9aa116add2d485e02588e6",style:this.getFontStyles()},a("div",{key:"58425ce02fa1cf074333464dfe17e702fd41acb0",class:"container"},this.chartTemplate()))}get element(){return this}static get watchers(){return{filter:[{validateFilter:0}],actual:[{validateActual:0}],target:[{validateTarget:0}],ranges:[{validateRanges:0}],normalize:[{validateNormalize:0}],variances:[{validateVariances:0}],level:[{validateLevel:0}],order:[{validateOrder:0}],orderDirection:[{validateOrderDirection:0}],limit:[{validateLimit:0}],labels:[{validateLabels:0}],scale:[{validateScale:0}]}}static get style(){return':host(.no-data){display:block;box-sizing:border-box;width:100%;height:100%}:host(.no-data)>div{float:none;width:100%;height:100%}:host(.no-data) .no-data~.no-data{display:none}.empty-state{box-sizing:border-box;display:flex;align-items:center;justify-content:center;float:none;width:100%;height:100%;min-height:3em;margin:0;padding:0.5em;overflow:hidden;border:0.1em dashed #ddd;color:#808080;font-family:var(--bn-font-family, "Noto Sans", sans-serif);font-size:var(--bn-font-size, 13.3333px);font-style:normal;text-align:center}:host{display:inline-block;position:relative;overflow:hidden;font-family:var(--bn-font-family, "Noto Sans", sans-serif);font-size:var(--bn-font-size, 13.3333px);color:var(--bn-font-color, #000000)}.container{display:flex;flex-direction:column}'}},[1,"bn-chart-bullet",{ruleset:[513],chartTitle:[1,"chart-title"],filter:[1],actual:[1],target:[1],ranges:[1],normalize:[1],variances:[1],level:[1],order:[1],orderDirection:[1,"order-direction"],limit:[2],labels:[1],scale:[1],datasetName:[32],dataVersion:[32],datasetMeta:[32],appliedScaleFactor:[32],getLayoutState:[64]},void 0,{filter:[{validateFilter:0}],actual:[{validateActual:0}],target:[{validateTarget:0}],ranges:[{validateRanges:0}],normalize:[{validateNormalize:0}],variances:[{validateVariances:0}],level:[{validateLevel:0}],order:[{validateOrder:0}],orderDirection:[{validateOrderDirection:0}],limit:[{validateLimit:0}],labels:[{validateLabels:0}],scale:[{validateScale:0}]}]),K=I,B=function(){"undefined"!=typeof customElements&&["bn-chart-bullet","ibcs-chart-bullet"].forEach((t=>{switch(t){case"bn-chart-bullet":customElements.get(n(t))||customElements.define(n(t),I);break;case"ibcs-chart-bullet":customElements.get(n(t))||L()}}))};export{K as BnChartBullet,B as defineCustomElement}
|
|
1
|
+
import{p as t,H as e,w as i,f as s,h as a,a as r,t as n}from"./p-D6YGOYV1.js";import{h as l,a as o}from"./p-BVKLCz2k.js";import{o as u}from"./p-B1nL0yOa.js";import{c as d}from"./p-BIIDTtcR.js";import{C as h,A as c}from"./p-BQMKgvEC.js";import{o as p}from"./p-B6kka9sT.js";import{a as v,b as m,O as g}from"./p-CxPSvrcF.js";import{g as f}from"./p-DD1zlev_.js";import{p as b}from"./p-Xb6Ilq8u.js";import{b as y,i as _,c as w,h as O}from"./p-DYG9FH_u.js";import{w as A}from"./p-DEHnizot.js";import{w as j}from"./p-jbp6YiHf.js";import{w as R}from"./p-BXrPfAvP.js";import{w as N}from"./p-CGI6XIaK.js";import{r as x}from"./p-xpguaboj.js";import{w as S}from"./p-CkW23yp2.js";import{w as E}from"./p-DsOaqeTN.js";import{w as T}from"./p-DdGnuNtc.js";import{r as z}from"./p-BpsXOtoW.js";import{p as D}from"./p-LZ9lAY8T.js";import{s as k}from"./p-DakXa7Dp.js";import{d as L}from"./p-DUHp_9X-.js";const W=["measure","label","unit"];function $(t){const e=[],i=I(t,"measure",e);if(void 0===i||""===i.trim())return e.push("measure"),{config:null,unknownKeys:C(t,W),invalidFields:e};const s={measure:i.trim()};return s.label=I(t,"label",e),s.unit=I(t,"unit",e),{config:s,unknownKeys:C(t,W),invalidFields:e}}const F=["show","decimals"];function M(t,e){const i=[],s={show:e.show,decimals:e.decimals};return h.isExisting(t.show)&&("auto"===t.show||"none"===t.show?s.show=t.show:i.push("show")),h.isExisting(t.decimals)&&(h.isNumber(t.decimals)&&t.decimals>=0&&t.decimals<=4?s.decimals=Math.floor(t.decimals):i.push("decimals")),{config:s,unknownKeys:C(t,F),invalidFields:i}}function U(t){var e;const i=null!==(e=null==t?void 0:t.trim())&&void 0!==e?e:"";if(""===i||"null"===i)return{ranges:[],parseError:!1,issues:[]};let s;try{s=JSON.parse(i)}catch(t){return{ranges:[],parseError:!0,issues:[]}}if(!Array.isArray(s)||0===s.length)return{ranges:[],parseError:!0,issues:[]};if(!s.every((t=>h.isNumber(t)&&isFinite(t)&&t>0)))return{ranges:[],parseError:!0,issues:[]};const a=[];let r=s;const n=[...r].sort(((t,e)=>t-e));return n.some(((t,e)=>t!==r[e]))&&a.push("not ascending, sorted"),r=n,r.length>2&&(a.push(r.length+" entries, first 2 kept"),r=r.slice(0,2)),{ranges:r,parseError:!1,issues:a}}function C(t,e){return Object.keys(t).filter((t=>!e.includes(t)))}function I(t,e,i){if(h.isExisting(t[e]))return h.isString(t[e])?t[e]:void i.push(e)}const B=["pl1","pp1","fc1"],V=t(class extends e{validateFilter(t){const e="ERR_filter";l(t)?this.errors.addOrReplace({id:e,type:"error",message:"filter: double backticks are not allowed."}):this.errors.remove(e)}validateActual(t){this.validateMeasureSpec("actual",t)}validateTarget(t){this.validateMeasureSpec("target",t)}validateRanges(t){const e="ERR_bullet_json_ranges",i="WARN_bullet_ranges",s=U(t);if(s.parseError)return this.setBlockingError(e,this.t(".bullet-prop-json",{prop:"ranges"})),void this.errors.remove(i);this.setBlockingError(e,null),s.issues.length>0?this.errors.addOrReplace({id:i,type:"warning",message:this.t(".bullet-ranges-invalid",{detail:s.issues.join("; ")})}):this.errors.remove(i)}validateNormalize(t){this.validateEnum("normalize","WARN_normalize",t,["target","none"],"target")}validateVariances(t){this.validateEnum("variances","WARN_variances",t,["auto","none"],"auto")}validateLevel(t){this.validateEnum("level","WARN_level",t,["auto","rowgroup","category","subcategory"],"auto")}validateOrder(t){const e="WARN_order",i=y(t).filter((t=>""!==t));0===i.length?this.errors.remove(e):this.errors.addOrReplace({id:e,type:"warning",message:`order: invalid value(s) '${i.join(", ")}'; using the dataset order.`})}validateOrderDirection(t){const e="WARN_orderDirection";_(t)||w(t)?this.errors.remove(e):this.errors.addOrReplace({id:e,type:"warning",message:`order-direction: invalid value '${t}' - expected asc/desc; using asc.`})}validateLimit(t){const e="WARN_limit";O(t)&&Number(t)>=0?this.errors.remove(e):this.errors.addOrReplace({id:e,type:"warning",message:`limit: invalid value '${t}' - expected a non-negative integer; using 0.`})}validateLabels(t){const e="ERR_bullet_json_labels",i="WARN_bullet_fields_labels",{data:s,parseError:a}=D(t,null);if(a)return this.setBlockingError(e,this.t(".bullet-prop-json",{prop:"labels"})),void this.errors.remove(i);this.setBlockingError(e,null),null!==s?this.reportSpecIssues(i,"labels",M(s,this.labelDefaults())):this.errors.remove(i)}validateScale(t){const e="WARN_scale";if(_(t))return void this.errors.remove(e);const{mode:i,factor:s}=b(t);"factor"===i&&(void 0===s||s<=0)?this.errors.addOrReplace({id:e,type:"warning",message:`scale: invalid value '${t}' - expected none/auto or a positive number.`}):this.errors.remove(e)}constructor(t){super(),!1!==t&&this.__registerHost(),this.__attachShadow(),this.datasetName="",this.dataVersion=0,this.datasetMeta=null,this.appliedScaleFactor=1,this.layoutObserver=null,this.activeErrors=new Set,this.chartTitle="",this.filter="",this.actual="",this.target="",this.ranges="",this.normalizeMode="target",this.variances="auto",this.level="auto",this.order="",this.orderDirection="",this.limit=0,this.labels="",this._autoScaleGuard=!1,this._lastScaledParentHeight=0,this.translateForInner=(t,e)=>this.t(t,e),T(this),A(this),R(this,(t=>{this.datasetName=(null==t?void 0:t.startsWith("$"))?t.substring(1):t||"",this.dataVersion=this.dataVersion+1}),((t,e)=>{this.datasetMeta=e})),this.errors=N(this),this.componentStyle=j(this),this.ruleSetConfig=S(this),this.t=E(this).t}componentWillLoad(){this.validateFilter(this.filter),this.validateActual(this.actual),this.validateTarget(this.target),this.validateRanges(this.ranges),this.validateNormalize(this.normalizeMode),this.validateVariances(this.variances),this.validateLevel(this.level),this.validateOrder(this.order),this.validateOrderDirection(this.orderDirection),this.validateLimit(this.limit),this.validateLabels(this.labels),this.validateScale(this.scale)}componentDidRender(){k(this.element,"bn-chart-bullet-renderer");const{mode:t}=b(this.scale);if("auto"!==t&&"empty"!==t)return void(this._autoScaleGuard=!1);if(this._autoScaleGuard)return void(this._autoScaleGuard=!1);const e=this.element,{height:s}=f(e);if(s<=0)return;this._lastScaledParentHeight=s;const a=this.componentStyle((t=>{var e;return(null===(e=t.global)||void 0===e?void 0:e.fontSizePx)||13.3333})),r=e.scrollHeight,n=this.appliedScaleFactor;if(r<=s+1)return void this.errors.remove("AUTO_scale");const l=Math.max(.3,n*(s-1)/r);Math.abs(l-n)<.01||(e.style.setProperty("--bn-font-size",a*l+"px"),"empty"===t?this.errors.addOrReplace({id:"AUTO_scale",type:"warning",message:"Auto-scaled chart by factor "+l.toFixed(3)}):this.errors.remove("AUTO_scale"),this._autoScaleGuard=!0,i((()=>{this.appliedScaleFactor=l})))}componentDidLoad(){this.layoutObserver=p(this.element,(()=>{if(this._autoScaleGuard)return;const{height:t}=f(this.element);t>0&&Math.abs(t-this._lastScaledParentHeight)>2&&(this._lastScaledParentHeight=t,s(this))})),requestAnimationFrame((()=>{requestAnimationFrame((()=>{if(this._autoScaleGuard)return;const{height:t}=f(this.element);this._lastScaledParentHeight=t,s(this)}))}))}disconnectedCallback(){var t;null===(t=this.layoutObserver)||void 0===t||t.disconnect(),this.layoutObserver=null}labelDefaults(){return{show:"auto",decimals:1}}setBlockingError(t,e){null===e?(this.errors.remove(t),this.activeErrors.delete(t)):(this.errors.addOrReplace({id:t,type:"error",message:e}),this.activeErrors.add(t))}hasBlockingErrors(){return this.activeErrors.size>0}validateMeasureSpec(t,e){var i;const s="ERR_bullet_json_"+t,a="ERR_bullet_measure_"+t,r="WARN_bullet_fields_"+t,{data:n,parseError:l}=D(e,"measure");if(l)return this.setBlockingError(s,this.t(".bullet-prop-json",{prop:t})),this.setBlockingError(a,null),void this.errors.remove(r);if(this.setBlockingError(s,null),null===n)return this.setBlockingError(a,null),void this.errors.remove(r);const o=(null!==(i=n.measure)&&void 0!==i?i:"").trim(),u=z(o);"auto"===o.toLowerCase()||null!==u&&"scenario"===u.kind?this.setBlockingError(a,null):this.setBlockingError(a,this.t(".bullet-measure-invalid",{prop:t,measure:o})),this.reportSpecIssues(r,t,$(n))}validateEnum(t,e,i,s,a){_(i)||s.includes(i.trim().toLowerCase())?this.errors.remove(e):this.errors.addOrReplace({id:e,type:"warning",message:`${t}: invalid value '${i}' - expected ${s.join("/")}; using '${a}'.`})}reportSpecIssues(t,e,i){const s=[];null!==i&&i.invalidFields.length>0&&s.push("invalid: "+i.invalidFields.join(", ")),null!==i&&i.unknownKeys.length>0&&s.push("unknown: "+i.unknownKeys.join(", ")),s.length>0?this.errors.addOrReplace({id:t,type:"warning",message:`${e}: ignored sub-fields (${s.join("; ")}).`}):this.errors.remove(t)}prepareActual(){var t,e,i,s,a;const{data:r,parseError:n}=D(this.actual,"measure");if(n)return null;const l=null!==r?$(r).config:null;if(null===l||"auto"===l.measure.toLowerCase()){const a=null!==l,r=null!==(e=null===(t=this.datasetMeta)||void 0===t?void 0:t.availableScenarios)&&void 0!==e?e:[],n=null!==(s=r.includes("ac1")?"ac1":null!==(i=r.find((t=>t.startsWith("ac"))))&&void 0!==i?i:r[0])&&void 0!==s?s:"ac1";return a||null===this.datasetMeta?this.errors.remove("AUTO_actual"):this.errors.addOrReplace({id:"AUTO_actual",type:"warning",message:"actual: not set, auto-detected: "+n}),null===l?{measure:n}:Object.assign(Object.assign({},l),{measure:n})}return this.errors.remove("AUTO_actual"),"scenario"===(null===(a=z(l.measure))||void 0===a?void 0:a.kind)?l:null}prepareTarget(){var t,e,i;const{data:s,parseError:a}=D(this.target,"measure");if(a)return null;const r=null!==s?$(s).config:null;if(null===r||"auto"===r.measure.toLowerCase()){const i=null!==r,s=null!==(e=null===(t=this.datasetMeta)||void 0===t?void 0:t.availableScenarios)&&void 0!==e?e:[],a=B.find((t=>s.includes(t)));return void 0===a?(this.errors.remove("AUTO_target"),null!==this.datasetMeta?this.errors.addOrReplace({id:"WARN_bullet_target_unavailable",type:"warning",message:this.t(".bullet-target-none")}):this.errors.remove("WARN_bullet_target_unavailable"),null):(this.errors.remove("WARN_bullet_target_unavailable"),i||null===this.datasetMeta?this.errors.remove("AUTO_target"):this.errors.addOrReplace({id:"AUTO_target",type:"warning",message:"target: not set, auto-detected: "+a}),null===r?{measure:a}:Object.assign(Object.assign({},r),{measure:a}))}return this.errors.remove("AUTO_target"),this.errors.remove("WARN_bullet_target_unavailable"),"scenario"===(null===(i=z(r.measure))||void 0===i?void 0:i.kind)?r:null}prepareNormalize(){var t;return"none"===(null===(t=this.normalizeMode)||void 0===t?void 0:t.trim().toLowerCase())?"none":"target"}prepareShowVariances(){var t;return"none"!==(null===(t=this.variances)||void 0===t?void 0:t.trim().toLowerCase())}prepareLevel(){var t,e;const i=null===(t=this.level)||void 0===t?void 0:t.trim().toLowerCase();if("rowgroup"===i)return c.ROWGROUP;if("category"===i)return c.CATEGORY;if("subcategory"===i)return c.SUBCATEGORY;const s=null===(e=this.datasetMeta)||void 0===e?void 0:e.suggestedLevel;if(void 0!==s&&""!==s){const t=c[s.toUpperCase()];if(void 0!==t)return t}return c.CATEGORY}prepareOrder(){var t,e,i,s;const a="auto"===(null===(t=this.order)||void 0===t?void 0:t.trim().toLowerCase());let r;_(this.order)||a?(null===(e=this.datasetMeta)||void 0===e?void 0:e.suggestedOrder)?(a?this.errors.remove("AUTO_order"):this.errors.addOrReplace({id:"AUTO_order",type:"warning",message:"order: not set, auto-detected: "+this.datasetMeta.suggestedOrder}),r=this.datasetMeta.suggestedOrder):(this.errors.remove("AUTO_order"),r=""):(this.errors.remove("AUTO_order"),r=this.order);const n=null!==(s=v[null===(i=this.orderDirection)||void 0===i?void 0:i.toUpperCase()])&&void 0!==s?s:v.ASC;if(_(r))return new m([g.CATEGORYINDEX],n);const l=r.split(",").map((t=>g[t.trim().toUpperCase()])).filter((t=>void 0!==t));return new m(l.length>0?l:[g.CATEGORYINDEX],n)}prepareLabels(){const t=this.labelDefaults(),{data:e,parseError:i}=D(this.labels,null);return i||null===e?{show:t.show,decimals:t.decimals}:M(e,t).config}prepareLimit(){const t=Math.floor(Number(this.limit)||0);return t>0?t:0}i18nLocalKeys(){return["no-data","target","axis.in"]}prepareI18n(){const t=new Map(this.i18nLocalKeys().map((t=>[t,this.t(".".concat(t))]))),e=new Map(o.map((t=>[t,this.t("global.".concat(t))])));return new Map([...e.entries(),...t.entries(),...x(this.ruleSetConfig("user"))])}prepareStyle(){const t=this.getEffectiveScaleFactor();return this.componentStyle((e=>{const i=e.global.fontSizePx*t;return{scaleFactors:e["bn-chart-bullet"].scaleFactors,fontStyles:{font:`${i}px ${e.global.fontFamily}`,size:i,color:e.global.fontColor,background:e.global.fontBackgroundColor,leading:1.8},axisStyles:e["bn-chart-bullet"].axisStyles,barStyles:e["bn-chart-bullet"].barStyles,varianceStyles:e["bn-chart-bullet"].varianceStyles,rangeColors:e["bn-chart-bullet"].rangeColors,padding:e["bn-chart-bullet"].padding}}))}async getLayoutState(t){var e;const i=null!==(e=null==t?void 0:t.detail)&&void 0!==e?e:"summary",s=u(this.element),a=this.getEffectiveScaleFactor(),r=Number.isFinite(a)&&a>0?a:1,n=this.componentStyle((t=>{var e;return(null===(e=t.global)||void 0===e?void 0:e.fontSizePx)||13.3333}))*r;return d(this.element,"bn-chart-bullet-renderer",this.chartTitle||void 0,{fontSizePx:n,appliedScaleFactor:r},s,i)}getEffectiveScaleFactor(){const{mode:t,factor:e}=b(this.scale);return"factor"===t?e:"auto"===t||"empty"===t?this.appliedScaleFactor:1}getFontStyles(){const t=this.getEffectiveScaleFactor();return this.componentStyle((e=>{var i,s,a,r;const n=(null===(i=e.global)||void 0===i?void 0:i.fontSizePx)||13.3333;return{"--bn-font-family":(null===(s=e.global)||void 0===s?void 0:s.fontFamily)||"'Noto Sans', sans-serif","--bn-font-size":n*t+"px","--bn-font-color":(null===(a=e.global)||void 0===a?void 0:a.fontColor)||"#000000","--bn-font-background":(null===(r=e.global)||void 0===r?void 0:r.fontBackgroundColor)||"#ffffff"}}))}getDataStructure(){const t={};for(const e of["ac","pp","fc","pl"])for(const i of[1,2,3,4])t[`${e}${i}`]={type:"number",isOptional:!0,description:""};const e={actual:this.prepareActual(),target:this.prepareTarget()};for(const[i,s]of Object.entries(e))null!==s&&void 0!==t[s.measure]&&(t[s.measure].description=`${i}: ${void 0!==s.label?s.label:s.measure}`);return{IBulletChartDataRow:Object.assign({operation:{type:"string",isOptional:!1,description:""},rowGroup:{type:"string",isOptional:!0,description:""},rowGroupIndex:{type:"number",isOptional:!0,description:""},category:{type:"string",isOptional:!1,description:""},categoryIndex:{type:"number",isOptional:!1,description:""},subCategory:{type:"string",isOptional:!0,description:""},subCategoryIndex:{type:"number",isOptional:!0,description:""}},t)}}chartTemplate(){const t=this.prepareActual(),e=this.prepareTarget(),i=U(this.ranges).ranges,s=this.prepareNormalize();return this.setBlockingError("ERR_bullet_measure_same",null!==t&&null!==e&&t.measure===e.measure?this.t(".bullet-measure-same",{measure:t.measure}):null),i.length>0&&"target"===s?this.errors.addOrReplace({id:"WARN_bullet_ranges_ignored",type:"warning",message:this.t(".bullet-ranges-ignored")}):this.errors.remove("WARN_bullet_ranges_ignored"),this.hasBlockingErrors()||null===t?null:a("bn-chart-bullet-renderer",{tableName:this.datasetName,dataVersion:this.dataVersion,chartTitle:this.chartTitle,actual:t,target:e,ranges:i,normalizeMode:s,showVariances:this.prepareShowVariances(),level:this.prepareLevel(),order:this.prepareOrder(),limit:this.prepareLimit(),labels:this.prepareLabels(),filter:this.filter,styles:this.prepareStyle(),i18n:this.prepareI18n(),containerWidth:f(this.element).width,ruleSetConfig:this.ruleSetConfig(),errors:this.errors,translator:this.translateForInner})}render(){return a(r,{key:"6112536add9b6762b9df8eb7a8c8dd3ab0e9a717",style:this.getFontStyles()},a("div",{key:"c33e3e78b180b61ac7c727d93202add9fd39fe10",class:"container"},this.chartTemplate()))}get element(){return this}static get watchers(){return{filter:[{validateFilter:0}],actual:[{validateActual:0}],target:[{validateTarget:0}],ranges:[{validateRanges:0}],normalizeMode:[{validateNormalize:0}],variances:[{validateVariances:0}],level:[{validateLevel:0}],order:[{validateOrder:0}],orderDirection:[{validateOrderDirection:0}],limit:[{validateLimit:0}],labels:[{validateLabels:0}],scale:[{validateScale:0}]}}static get style(){return':host(.no-data){display:block;box-sizing:border-box;width:100%;height:100%}:host(.no-data)>div{float:none;width:100%;height:100%}:host(.no-data) .no-data~.no-data{display:none}.empty-state{box-sizing:border-box;display:flex;align-items:center;justify-content:center;float:none;width:100%;height:100%;min-height:3em;margin:0;padding:0.5em;overflow:hidden;border:0.1em dashed #ddd;color:#808080;font-family:var(--bn-font-family, "Noto Sans", sans-serif);font-size:var(--bn-font-size, 13.3333px);font-style:normal;text-align:center}:host{display:inline-block;position:relative;overflow:hidden;font-family:var(--bn-font-family, "Noto Sans", sans-serif);font-size:var(--bn-font-size, 13.3333px);color:var(--bn-font-color, #000000)}.container{display:flex;flex-direction:column}'}},[1,"bn-chart-bullet",{datasets:[513],selectedStyle:[513,"selected-style"],i18nNamespace:[513,"i18n-namespace"],ruleset:[513],chartTitle:[1,"chart-title"],filter:[1],actual:[1],target:[1],ranges:[1],normalizeMode:[1,"normalize"],variances:[1],level:[1],order:[1],orderDirection:[1,"order-direction"],limit:[2],labels:[1],scale:[1],datasetName:[32],dataVersion:[32],datasetMeta:[32],appliedScaleFactor:[32],getLayoutState:[64]},void 0,{filter:[{validateFilter:0}],actual:[{validateActual:0}],target:[{validateTarget:0}],ranges:[{validateRanges:0}],normalizeMode:[{validateNormalize:0}],variances:[{validateVariances:0}],level:[{validateLevel:0}],order:[{validateOrder:0}],orderDirection:[{validateOrderDirection:0}],limit:[{validateLimit:0}],labels:[{validateLabels:0}],scale:[{validateScale:0}]}]),K=V,G=function(){"undefined"!=typeof customElements&&["bn-chart-bullet","bn-chart-bullet-renderer"].forEach((t=>{switch(t){case"bn-chart-bullet":customElements.get(n(t))||customElements.define(n(t),V);break;case"bn-chart-bullet-renderer":customElements.get(n(t))||L()}}))};export{K as BnChartBullet,G as defineCustomElement}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { Components, JSX } from "../types/components";
|
|
2
|
+
|
|
3
|
+
interface BnChartScatterRenderer extends Components.BnChartScatterRenderer, HTMLElement {}
|
|
4
|
+
export const BnChartScatterRenderer: {
|
|
5
|
+
prototype: BnChartScatterRenderer;
|
|
6
|
+
new (): BnChartScatterRenderer;
|
|
7
|
+
};
|
|
8
|
+
/**
|
|
9
|
+
* Used to define this component and all nested components recursively.
|
|
10
|
+
*/
|
|
11
|
+
export const defineCustomElement: () => void;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{B as o,d as s}from"./p-ey23VlID.js";const p=o,r=s;export{p as BnChartScatterRenderer,r as defineCustomElement}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{proxyCustomElement as t,HTMLElement as e,writeTask as i,forceUpdate as s,h as a,Host as r,transformTag as o}from"@stencil/core/internal/client";import{h as n,a as l}from"./context-protocol.js";import{o as h}from"./geometry.js";import{c}from"./svgChartElements.js";import{g as d}from"./parentDimensions.js";import{c as u}from"./checkXYOverflow.js";import{o as p}from"./layoutObserver.js";import{p as v}from"./scaling.js";import{i as m,h as f,j as y}from"./validate.js";import{w as g}from"./withComponentStatus.js";import{w as b}from"./withComponentStyle.js";import{w as x}from"./withDataset.js";import{w}from"./withHasError.js";import{w as _}from"./withRuleSet.js";import{w as S}from"./withTranslation.js";import{w as L}from"./withStyled.js";import{r as R,s as j}from"./VarianceMeasure.js";import{f as E,c as $,d as A,e as O,p as N,t as k}from"./AxisConfig.js";import{s as C}from"./emptyState.js";import{d as F}from"./ibcs-chart-scatter2.js";const z={rowGroup:0,category:1,subCategory:2},I=t(class extends e{validateFilter(t){const e="ERR_filter";n(t)?this.errors.addOrReplace({id:e,type:"error",message:"filter: double backticks are not allowed."}):this.errors.remove(e)}validateX(t){this.validateAxisSpec("x",t)}validateY(t){this.validateAxisSpec("y",t)}validateIso(t){this.validateObjectSpec("iso",t,null,(t=>E(t)))}validateLevel(t){const e="ERR_level",i=["auto","category","subcategory"];m(t)||i.includes(t.trim().toLowerCase())?this.errors.remove(e):this.errors.addOrReplace({id:e,type:"warning",message:`level: invalid value '${t}' - expected ${i.join("/")}; using 'auto'.`})}validateSeriesLevel(t){const e="ERR_seriesLevel",i=["auto","rowgroup","category","none"];m(t)||i.includes(t.trim().toLowerCase())?this.errors.remove(e):this.errors.addOrReplace({id:e,type:"warning",message:`series-level: invalid value '${t}' - expected ${i.join("/")}; using 'auto'.`})}validateFacet(t){this.validateObjectSpec("facet",t,null,(t=>$(t)))}validateLabels(t){this.validateObjectSpec("labels",t,null,(t=>A(t,this.labelDefaults())))}validateLegend(t){this.validateObjectSpec("legend",t,null,(t=>O(t)))}validateAspect(t){const e="ERR_aspect";m(t)||null!==this.parseAspect(t)?this.errors.remove(e):this.errors.addOrReplace({id:e,type:"warning",message:`aspect: invalid value '${t}' - expected "w:h" (e.g. "16:9"); using the default.`})}validateLimit(t){const e="ERR_limit";f(t)&&Number(t)>=0?this.errors.remove(e):this.errors.addOrReplace({id:e,type:"warning",message:`limit: invalid value '${t}' - expected a non-negative integer; using 0.`})}validateScale(t){const e="ERR_scale";if(m(t))return void this.errors.remove(e);const{mode:i,factor:s}=v(t);"factor"===i&&(void 0===s||s<=0)?this.errors.addOrReplace({id:e,type:"warning",message:`scale: invalid value '${t}' - expected none/auto or a positive number.`}):this.errors.remove(e)}constructor(t){super(),!1!==t&&this.__registerHost(),this.__attachShadow(),this.datasetName="",this.dataVersion=0,this.datasetMeta=null,this.appliedScaleFactor=1,this.layoutObserver=null,this.activeErrors=new Set,this.chartTitle="",this.filter="",this.iso="",this.level="auto",this.seriesLevel="auto",this.facet="",this.labels="",this.legend="",this.aspect="16:9",this.limit=0,this._autoScaleGuard=!1,this._lastObservedWidth=0,this.translateForInner=(t,e)=>this.t(t,e),L(this),g(this),x(this,(t=>{this.datasetName=(null==t?void 0:t.startsWith("$"))?t.substring(1):t||"",this.dataVersion=this.dataVersion+1}),((t,e)=>{this.datasetMeta=e})),this.errors=w(this),this.componentStyle=b(this),this.ruleSetConfig=_(this),this.t=S(this).t}componentWillLoad(){this.validateFilter(this.filter),this.validateX(this.x),this.validateY(this.y),this.validateIso(this.iso),this.validateLevel(this.level),this.validateSeriesLevel(this.seriesLevel),this.validateFacet(this.facet),this.validateLabels(this.labels),this.validateLegend(this.legend),this.validateAspect(this.aspect),this.validateLimit(this.limit),this.validateScale(this.scale)}componentDidRender(){C(this.element,"ibcs-chart-scatter");const{mode:t}=v(this.scale);if("auto"!==t&&"empty"!==t)return this._autoScaleGuard=!1,void this.checkOverflow();if(this._autoScaleGuard)return this._autoScaleGuard=!1,void this.checkOverflow();const e=this.element,{width:s}=d(e);if(s<=0)return void this.checkOverflow();this._lastObservedWidth=s;const a=this.componentStyle((t=>{var e;return(null===(e=t.global)||void 0===e?void 0:e.fontSizePx)||13.3333})),r=e.scrollWidth,o=this.appliedScaleFactor;if(!Number.isFinite(r)||r<=s+1)return this.errors.remove("AUTO_scale"),void this.checkOverflow();const n=Math.max(.3,o*(s-1)/r);Math.abs(n-o)<.01||(e.style.setProperty("--bn-font-size",a*n+"px"),"empty"===t?this.errors.addOrReplace({id:"AUTO_scale",type:"warning",message:"Auto-scaled chart by factor "+n.toFixed(3)}):this.errors.remove("AUTO_scale"),this._autoScaleGuard=!0,i((()=>{this.appliedScaleFactor=n}))),this.checkOverflow()}checkOverflow(){u(this.element,"ibcs-chart-scatter",this.errors)}componentDidLoad(){this.layoutObserver=p(this.element,(()=>{if(this._autoScaleGuard)return;const{width:t}=d(this.element);t>0&&Math.abs(t-this._lastObservedWidth)>2?(this._lastObservedWidth=t,s(this)):this.checkOverflow()})),requestAnimationFrame((()=>{requestAnimationFrame((()=>{if(this._autoScaleGuard)return;const{width:t}=d(this.element);this._lastObservedWidth=t,s(this)}))}))}disconnectedCallback(){var t;null===(t=this.layoutObserver)||void 0===t||t.disconnect(),this.layoutObserver=null}labelDefaults(){return{points:"auto",values:!1,max:12}}setBlockingError(t,e){null===e?(this.errors.remove(t),this.activeErrors.delete(t)):(this.errors.addOrReplace({id:t,type:"error",message:e}),this.activeErrors.add(t))}hasBlockingErrors(){return this.activeErrors.size>0}validateAxisSpec(t,e){var i;const s="ERR_xy_json_"+t,a="ERR_xy_measure_"+t,r="WARN_xy_fields_"+t,o="x"===t||"y"===t||"size"===t,{data:n,parseError:l}=N(e,"measure");if(l)return this.setBlockingError(s,this.t(".xy-prop-json",{prop:t})),this.setBlockingError(a,null),void this.errors.remove(r);if(this.setBlockingError(s,null),null===n)return this.setBlockingError(a,o?this.t(".xy-measure-invalid",{prop:t,measure:""}):null),void this.errors.remove(r);const h="share"===t?null:k(n),c=null!==(i=n.measure)&&void 0!==i?i:"";y(c)?this.setBlockingError(a,null):this.setBlockingError(a,this.t(".xy-measure-invalid",{prop:t,measure:c})),this.reportSpecIssues(r,t,h)}validateObjectSpec(t,e,i,s){const a="ERR_xy_json_"+t,r="WARN_xy_fields_"+t,{data:o,parseError:n}=N(e,i);if(n)return this.setBlockingError(a,this.t(".xy-prop-json",{prop:t})),void this.errors.remove(r);this.setBlockingError(a,null),null!==o?this.reportSpecIssues(r,t,s(o)):this.errors.remove(r)}reportSpecIssues(t,e,i){const s=[];null!==i&&i.invalidFields.length>0&&s.push("invalid: "+i.invalidFields.join(", ")),null!==i&&i.unknownKeys.length>0&&s.push("unknown: "+i.unknownKeys.join(", ")),s.length>0?this.errors.addOrReplace({id:t,type:"warning",message:`${e}: ignored sub-fields (${s.join("; ")}).`}):this.errors.remove(t)}prepareAxis(t,e){const{data:i,parseError:s}=N(e,"measure");if(s||null===i)return null;const{config:a}=k(i);return null!==a&&y(a.measure)?(void 0!==a.min&&void 0!==a.max&&a.min>=a.max?(this.errors.addOrReplace({id:"WARN_xy_domain_"+t,type:"warning",message:t+": min must be smaller than max; the override is ignored."}),a.min=void 0,a.max=void 0):this.errors.remove("WARN_xy_domain_"+t),a):null}prepareIso(){const{data:t,parseError:e}=N(this.iso,null);return e||null===t?null:E(t).config}prepareLabels(){const t=this.labelDefaults(),{data:e,parseError:i}=N(this.labels,null);return i||null===e?{points:t.points,values:t.values,max:t.max}:A(e,t).config}prepareLegend(){const{data:t,parseError:e}=N(this.legend,null);return e||null===t?{show:!0,position:"right"}:O(t).config}prepareFacet(){const{data:t,parseError:e}=N(this.facet,null);return e||null===t?null:$(t).config}preparePointLevel(){var t,e;const i=null===(t=this.level)||void 0===t?void 0:t.trim().toLowerCase();if("category"===i)return"category";if("subcategory"===i)return"subCategory";const s=null===(e=this.datasetMeta)||void 0===e?void 0:e.suggestedLevel;return"rowGroup"===s||"category"===s||"subCategory"===s?s:"category"}prepareSeriesLevel(t){var e;const i=null===(e=this.seriesLevel)||void 0===e?void 0:e.trim().toLowerCase();return"none"===i?null:"rowgroup"===i?"rowGroup":"category"===i||"subCategory"===t?"category":"category"===t?"rowGroup":null}validateCrossProp(t,e){const i=new Set;for(const e of t){if(void 0===e)continue;const t=R(e);null!==t&&"scenario"===t.kind&&i.add(j(t.slot))}this.setBlockingError("ERR_xy_family",i.size>1?this.t(".xy-family-mixed",{families:[...i].join(", ")}):null);const s=this.preparePointLevel(),a=this.prepareSeriesLevel(s),r=null!==e?"rowgroup"===e.level?"rowGroup":"category":null;let o=null;if(null!==a&&z[a]>=z[s]&&(o=`series '${a}' vs point '${s}'`),null!==r){const t=null!=a?a:s;z[r]>=z[t]&&(o=`facet '${r}' vs '${t}'`)}this.setBlockingError("ERR_xy_level_order",null!==o?this.t(".xy-level-order",{detail:o}):null)}parseAspect(t){const e=/^\s*(\d+(?:\.\d+)?)\s*:\s*(\d+(?:\.\d+)?)\s*$/.exec(null!=t?t:"");if(null===e)return null;const i=Number(e[1]),s=Number(e[2]);return i<=0||s<=0?null:i/s}prepareAspect(){var t;return null!==(t=this.parseAspect(this.aspect))&&void 0!==t?t:16/9}prepareLimit(){const t=Math.floor(Number(this.limit)||0);return t>0?t:0}i18nLocalKeys(){return["no-data","axis.in","legend.title"]}prepareI18n(){const t=new Map(this.i18nLocalKeys().map((t=>[t,this.t(".".concat(t))]))),e=new Map(l.map((t=>[t,this.t("global.".concat(t))])));return new Map([...e.entries(),...t.entries()])}prepareStyle(){const t=this.getEffectiveScaleFactor(),e=this.element.localName;return this.componentStyle((i=>{const s=i.global.fontSizePx*t;return{scaleFactors:i[e].scaleFactors,fontStyles:{font:`${s}px ${i.global.fontFamily}`,size:s,color:i.global.fontColor,background:i.global.fontBackgroundColor,leading:1.8},axisStyles:i[e].axisStyles,seriesColors:i[e].seriesColors,padding:i[e].padding}}))}async getLayoutState(t){var e;const i=null!==(e=null==t?void 0:t.detail)&&void 0!==e?e:"summary",s=h(this.element),a=this.getEffectiveScaleFactor(),r=Number.isFinite(a)&&a>0?a:1,o=this.componentStyle((t=>{var e;return(null===(e=t.global)||void 0===e?void 0:e.fontSizePx)||13.3333}))*r;return c(this.element,"ibcs-chart-scatter",this.chartTitle||void 0,{fontSizePx:o,appliedScaleFactor:r},s,i)}getEffectiveScaleFactor(){const{mode:t,factor:e}=v(this.scale);return"factor"===t?e:"auto"===t||"empty"===t?this.appliedScaleFactor:1}getFontStyles(){const t=this.getEffectiveScaleFactor();return this.componentStyle((e=>{var i,s,a,r;const o=(null===(i=e.global)||void 0===i?void 0:i.fontSizePx)||13.3333;return{"--bn-font-family":(null===(s=e.global)||void 0===s?void 0:s.fontFamily)||"'Noto Sans', sans-serif","--bn-font-size":o*t+"px","--bn-font-color":(null===(a=e.global)||void 0===a?void 0:a.fontColor)||"#000000","--bn-font-background":(null===(r=e.global)||void 0===r?void 0:r.fontBackgroundColor)||"#ffffff"}}))}getDataStructure(){const t={};for(const e of["ac","pp","fc","pl"])for(const i of[1,2,3,4])t[`${e}${i}`]={type:"number",isOptional:!0,description:""};for(const[e,i]of Object.entries(this.mappedAxes())){if(null===i)continue;const s=R(i.measure);null!==s&&("scenario"===s.kind?t[s.slot].description=`${e}: ${"label"in i&&void 0!==i.label?i.label:i.measure}`:(t[s.measure.base].description=`${e}: ${i.measure} (base)`,t[s.measure.delta].description=`${e}: ${i.measure} (delta)`))}return{[this.dataStructureName()]:Object.assign({operation:{type:"string",isOptional:!1,description:""},rowGroup:{type:"string",isOptional:!0,description:""},rowGroupIndex:{type:"number",isOptional:!0,description:""},category:{type:"string",isOptional:!1,description:""},categoryIndex:{type:"number",isOptional:!1,description:""},subCategory:{type:"string",isOptional:!0,description:""},subCategoryIndex:{type:"number",isOptional:!0,description:""}},t)}}mappedAxes(){return{x:this.prepareAxis("x",this.x),y:this.prepareAxis("y",this.y)}}dataStructureName(){return"IScatterChartDataRow"}chartTemplate(){const t=this.prepareAxis("x",this.x),e=this.prepareAxis("y",this.y),i=this.prepareFacet();if(this.validateCrossProp([null==t?void 0:t.measure,null==e?void 0:e.measure],i),this.hasBlockingErrors()||null===t||null===e)return null;const s=this.preparePointLevel(),r=this.prepareI18n(),o=this.prepareStyle(),n=d(this.element).width;return a("ibcs-chart-scatter",{tableName:this.datasetName,dataVersion:this.dataVersion,chartTitle:this.chartTitle,x:t,y:e,iso:this.prepareIso(),labels:this.prepareLabels(),legend:this.prepareLegend(),facet:i,pointLevel:s,seriesLevel:this.prepareSeriesLevel(s),aspect:this.prepareAspect(),limit:this.prepareLimit(),filter:this.filter,styles:o,i18n:r,containerWidth:n,ruleSetConfig:this.ruleSetConfig(),errors:this.errors,translate:this.translateForInner})}render(){return a(r,{key:"61ebef430224576a8dc7dc0538e362848c31004f",style:this.getFontStyles()},a("div",{key:"89a3c7653191348e8dd4231395e599f32365c8c1",class:"container"},this.chartTemplate()))}get element(){return this}static get watchers(){return{filter:[{validateFilter:0}],x:[{validateX:0}],y:[{validateY:0}],iso:[{validateIso:0}],level:[{validateLevel:0}],seriesLevel:[{validateSeriesLevel:0}],facet:[{validateFacet:0}],labels:[{validateLabels:0}],legend:[{validateLegend:0}],aspect:[{validateAspect:0}],limit:[{validateLimit:0}],scale:[{validateScale:0}]}}static get style(){return':host(.no-data){display:block;box-sizing:border-box;width:100%;height:100%}:host(.no-data)>div{float:none;width:100%;height:100%}:host(.no-data) .no-data~.no-data{display:none}.empty-state{box-sizing:border-box;display:flex;align-items:center;justify-content:center;float:none;width:100%;height:100%;min-height:3em;margin:0;padding:0.5em;overflow:hidden;border:0.1em dashed #ddd;color:#808080;font-family:var(--bn-font-family, "Noto Sans", sans-serif);font-size:var(--bn-font-size, 13.3333px);font-style:normal;text-align:center}:host{display:inline-block;position:relative;overflow:hidden;font-family:var(--bn-font-family, "Noto Sans", sans-serif);font-size:var(--bn-font-size, 13.3333px);color:var(--bn-font-color, #000000)}.container{display:flex;flex-direction:column}'}},[1,"bn-chart-scatter",{ruleset:[513],chartTitle:[1,"chart-title"],filter:[1],x:[1],y:[1],iso:[1],level:[1],seriesLevel:[1,"series-level"],facet:[1],labels:[1],legend:[1],aspect:[1],limit:[2],scale:[1],datasetName:[32],dataVersion:[32],datasetMeta:[32],appliedScaleFactor:[32],getLayoutState:[64]},void 0,{filter:[{validateFilter:0}],x:[{validateX:0}],y:[{validateY:0}],iso:[{validateIso:0}],level:[{validateLevel:0}],seriesLevel:[{validateSeriesLevel:0}],facet:[{validateFacet:0}],labels:[{validateLabels:0}],legend:[{validateLegend:0}],aspect:[{validateAspect:0}],limit:[{validateLimit:0}],scale:[{validateScale:0}]}]),M=I,D=function(){"undefined"!=typeof customElements&&["bn-chart-scatter","ibcs-chart-scatter"].forEach((t=>{switch(t){case"bn-chart-scatter":customElements.get(o(t))||customElements.define(o(t),I);break;case"ibcs-chart-scatter":customElements.get(o(t))||F()}}))};export{M as BnChartScatter,D as defineCustomElement}
|
|
1
|
+
import{p as t,H as e,w as s,f as i,h as a,a as r,t as n}from"./p-D6YGOYV1.js";import{h as o,a as l}from"./p-BVKLCz2k.js";import{o as h}from"./p-B1nL0yOa.js";import{c as d}from"./p-BIIDTtcR.js";import{g as c}from"./p-DD1zlev_.js";import{c as u}from"./p-D2Epww9R.js";import{o as p}from"./p-B6kka9sT.js";import{p as v}from"./p-Xb6Ilq8u.js";import{i as m,h as f,j as y}from"./p-DYG9FH_u.js";import{w as g}from"./p-DEHnizot.js";import{w as b}from"./p-jbp6YiHf.js";import{w as x}from"./p-BXrPfAvP.js";import{w}from"./p-CGI6XIaK.js";import{w as _}from"./p-CkW23yp2.js";import{w as L}from"./p-DsOaqeTN.js";import{w as j}from"./p-DdGnuNtc.js";import{r as S,s as A}from"./p-BpsXOtoW.js";import{f as R,c as $,d as N,e as E,p as k,t as O}from"./p-LZ9lAY8T.js";import{s as D}from"./p-DakXa7Dp.js";import{d as I}from"./p-ey23VlID.js";const F={rowGroup:0,category:1,subCategory:2},z=t(class extends e{validateFilter(t){const e="ERR_filter";o(t)?this.errors.addOrReplace({id:e,type:"error",message:"filter: double backticks are not allowed."}):this.errors.remove(e)}validateX(t){this.validateAxisSpec("x",t)}validateY(t){this.validateAxisSpec("y",t)}validateIso(t){this.validateObjectSpec("iso",t,null,(t=>R(t)))}validateLevel(t){const e="WARN_level",s=["auto","category","subcategory"];m(t)||s.includes(t.trim().toLowerCase())?this.errors.remove(e):this.errors.addOrReplace({id:e,type:"warning",message:`level: invalid value '${t}' - expected ${s.join("/")}; using 'auto'.`})}validateSeriesLevel(t){const e="WARN_seriesLevel",s=["auto","rowgroup","category","none"];m(t)||s.includes(t.trim().toLowerCase())?this.errors.remove(e):this.errors.addOrReplace({id:e,type:"warning",message:`series-level: invalid value '${t}' - expected ${s.join("/")}; using 'auto'.`})}validateFacet(t){this.validateObjectSpec("facet",t,null,(t=>$(t)))}validateLabels(t){this.validateObjectSpec("labels",t,null,(t=>N(t,this.labelDefaults())))}validateLegend(t){this.validateObjectSpec("legend",t,null,(t=>E(t)))}validateAspect(t){const e="WARN_aspect";m(t)||null!==this.parseAspect(t)?this.errors.remove(e):this.errors.addOrReplace({id:e,type:"warning",message:`aspect: invalid value '${t}' - expected "w:h" (e.g. "16:9"); using the default.`})}validateLimit(t){const e="WARN_limit";f(t)&&Number(t)>=0?this.errors.remove(e):this.errors.addOrReplace({id:e,type:"warning",message:`limit: invalid value '${t}' - expected a non-negative integer; using 0.`})}validateScale(t){const e="WARN_scale";if(m(t))return void this.errors.remove(e);const{mode:s,factor:i}=v(t);"factor"===s&&(void 0===i||i<=0)?this.errors.addOrReplace({id:e,type:"warning",message:`scale: invalid value '${t}' - expected none/auto or a positive number.`}):this.errors.remove(e)}constructor(t){super(),!1!==t&&this.__registerHost(),this.__attachShadow(),this.datasetName="",this.dataVersion=0,this.datasetMeta=null,this.appliedScaleFactor=1,this.layoutObserver=null,this.activeErrors=new Set,this.chartTitle="",this.filter="",this.iso="",this.level="auto",this.seriesLevel="auto",this.facet="",this.labels="",this.legend="",this.aspect="16:9",this.limit=0,this._autoScaleGuard=!1,this._lastObservedWidth=0,this.translateForInner=(t,e)=>this.t(t,e),j(this),g(this),x(this,(t=>{this.datasetName=(null==t?void 0:t.startsWith("$"))?t.substring(1):t||"",this.dataVersion=this.dataVersion+1}),((t,e)=>{this.datasetMeta=e})),this.errors=w(this),this.componentStyle=b(this),this.ruleSetConfig=_(this),this.t=L(this).t}componentWillLoad(){this.validateFilter(this.filter),this.validateX(this.x),this.validateY(this.y),this.validateIso(this.iso),this.validateLevel(this.level),this.validateSeriesLevel(this.seriesLevel),this.validateFacet(this.facet),this.validateLabels(this.labels),this.validateLegend(this.legend),this.validateAspect(this.aspect),this.validateLimit(this.limit),this.validateScale(this.scale)}componentDidRender(){D(this.element,"bn-chart-scatter-renderer");const{mode:t}=v(this.scale);if("auto"!==t&&"empty"!==t)return this._autoScaleGuard=!1,void this.checkOverflow();if(this._autoScaleGuard)return this._autoScaleGuard=!1,void this.checkOverflow();const e=this.element,{width:i}=c(e);if(i<=0)return void this.checkOverflow();this._lastObservedWidth=i;const a=this.componentStyle((t=>{var e;return(null===(e=t.global)||void 0===e?void 0:e.fontSizePx)||13.3333})),r=e.scrollWidth,n=this.appliedScaleFactor;if(!Number.isFinite(r)||r<=i+1)return this.errors.remove("AUTO_scale"),void this.checkOverflow();const o=Math.max(.3,n*(i-1)/r);Math.abs(o-n)<.01||(e.style.setProperty("--bn-font-size",a*o+"px"),"empty"===t?this.errors.addOrReplace({id:"AUTO_scale",type:"warning",message:"Auto-scaled chart by factor "+o.toFixed(3)}):this.errors.remove("AUTO_scale"),this._autoScaleGuard=!0,s((()=>{this.appliedScaleFactor=o}))),this.checkOverflow()}checkOverflow(){u(this.element,"bn-chart-scatter-renderer",this.errors)}componentDidLoad(){this.layoutObserver=p(this.element,(()=>{if(this._autoScaleGuard)return;const{width:t}=c(this.element);t>0&&Math.abs(t-this._lastObservedWidth)>2?(this._lastObservedWidth=t,i(this)):this.checkOverflow()})),requestAnimationFrame((()=>{requestAnimationFrame((()=>{if(this._autoScaleGuard)return;const{width:t}=c(this.element);this._lastObservedWidth=t,i(this)}))}))}disconnectedCallback(){var t;null===(t=this.layoutObserver)||void 0===t||t.disconnect(),this.layoutObserver=null}labelDefaults(){return{points:"auto",values:!1,max:12}}setBlockingError(t,e){null===e?(this.errors.remove(t),this.activeErrors.delete(t)):(this.errors.addOrReplace({id:t,type:"error",message:e}),this.activeErrors.add(t))}hasBlockingErrors(){return this.activeErrors.size>0}validateAxisSpec(t,e){var s;const i="ERR_xy_json_"+t,a="ERR_xy_measure_"+t,r="WARN_xy_fields_"+t,n="x"===t||"y"===t||"size"===t,{data:o,parseError:l}=k(e,"measure");if(l)return this.setBlockingError(i,this.t(".xy-prop-json",{prop:t})),this.setBlockingError(a,null),void this.errors.remove(r);if(this.setBlockingError(i,null),null===o)return this.setBlockingError(a,n?this.t(".xy-measure-invalid",{prop:t,measure:""}):null),void this.errors.remove(r);const h="share"===t?null:O(o),d=null!==(s=o.measure)&&void 0!==s?s:"";y(d)?this.setBlockingError(a,null):this.setBlockingError(a,this.t(".xy-measure-invalid",{prop:t,measure:d})),this.reportSpecIssues(r,t,h)}validateObjectSpec(t,e,s,i){const a="ERR_xy_json_"+t,r="WARN_xy_fields_"+t,{data:n,parseError:o}=k(e,s);if(o)return this.setBlockingError(a,this.t(".xy-prop-json",{prop:t})),void this.errors.remove(r);this.setBlockingError(a,null),null!==n?this.reportSpecIssues(r,t,i(n)):this.errors.remove(r)}reportSpecIssues(t,e,s){const i=[];null!==s&&s.invalidFields.length>0&&i.push("invalid: "+s.invalidFields.join(", ")),null!==s&&s.unknownKeys.length>0&&i.push("unknown: "+s.unknownKeys.join(", ")),i.length>0?this.errors.addOrReplace({id:t,type:"warning",message:`${e}: ignored sub-fields (${i.join("; ")}).`}):this.errors.remove(t)}prepareAxis(t,e){const{data:s,parseError:i}=k(e,"measure");if(i||null===s)return null;const{config:a}=O(s);return null!==a&&y(a.measure)?(void 0!==a.min&&void 0!==a.max&&a.min>=a.max?(this.errors.addOrReplace({id:"WARN_xy_domain_"+t,type:"warning",message:t+": min must be smaller than max; the override is ignored."}),a.min=void 0,a.max=void 0):this.errors.remove("WARN_xy_domain_"+t),a):null}prepareIso(){const{data:t,parseError:e}=k(this.iso,null);return e||null===t?null:R(t).config}prepareLabels(){const t=this.labelDefaults(),{data:e,parseError:s}=k(this.labels,null);return s||null===e?{points:t.points,values:t.values,max:t.max}:N(e,t).config}prepareLegend(){const{data:t,parseError:e}=k(this.legend,null);return e||null===t?{show:!0,position:"right"}:E(t).config}prepareFacet(){const{data:t,parseError:e}=k(this.facet,null);return e||null===t?null:$(t).config}preparePointLevel(){var t,e;const s=null===(t=this.level)||void 0===t?void 0:t.trim().toLowerCase();if("category"===s)return"category";if("subcategory"===s)return"subCategory";const i=null===(e=this.datasetMeta)||void 0===e?void 0:e.suggestedLevel;return"rowGroup"===i||"category"===i||"subCategory"===i?i:"category"}prepareSeriesLevel(t){var e;const s=null===(e=this.seriesLevel)||void 0===e?void 0:e.trim().toLowerCase();return"none"===s?null:"rowgroup"===s?"rowGroup":"category"===s||"subCategory"===t?"category":"category"===t?"rowGroup":null}validateCrossProp(t,e){const s=new Set;for(const e of t){if(void 0===e)continue;const t=S(e);null!==t&&"scenario"===t.kind&&s.add(A(t.slot))}this.setBlockingError("ERR_xy_family",s.size>1?this.t(".xy-family-mixed",{families:[...s].join(", ")}):null);const i=this.preparePointLevel(),a=this.prepareSeriesLevel(i),r=null!==e?"rowgroup"===e.level?"rowGroup":"category":null;let n=null;if(null!==a&&F[a]>=F[i]&&(n=`series '${a}' vs point '${i}'`),null!==r){const t=null!=a?a:i;F[r]>=F[t]&&(n=`facet '${r}' vs '${t}'`)}this.setBlockingError("ERR_xy_level_order",null!==n?this.t(".xy-level-order",{detail:n}):null)}parseAspect(t){const e=/^\s*(\d+(?:\.\d+)?)\s*:\s*(\d+(?:\.\d+)?)\s*$/.exec(null!=t?t:"");if(null===e)return null;const s=Number(e[1]),i=Number(e[2]);return s<=0||i<=0?null:s/i}prepareAspect(){var t;return null!==(t=this.parseAspect(this.aspect))&&void 0!==t?t:16/9}prepareLimit(){const t=Math.floor(Number(this.limit)||0);return t>0?t:0}i18nLocalKeys(){return["no-data","axis.in","legend.title"]}prepareI18n(){const t=new Map(this.i18nLocalKeys().map((t=>[t,this.t(".".concat(t))]))),e=new Map(l.map((t=>[t,this.t("global.".concat(t))])));return new Map([...e.entries(),...t.entries()])}prepareStyle(){const t=this.getEffectiveScaleFactor(),e=this.element.localName;return this.componentStyle((s=>{const i=s.global.fontSizePx*t;return{scaleFactors:s[e].scaleFactors,fontStyles:{font:`${i}px ${s.global.fontFamily}`,size:i,color:s.global.fontColor,background:s.global.fontBackgroundColor,leading:1.8},axisStyles:s[e].axisStyles,seriesColors:s[e].seriesColors,padding:s[e].padding}}))}async getLayoutState(t){var e;const s=null!==(e=null==t?void 0:t.detail)&&void 0!==e?e:"summary",i=h(this.element),a=this.getEffectiveScaleFactor(),r=Number.isFinite(a)&&a>0?a:1,n=this.componentStyle((t=>{var e;return(null===(e=t.global)||void 0===e?void 0:e.fontSizePx)||13.3333}))*r;return d(this.element,"bn-chart-scatter-renderer",this.chartTitle||void 0,{fontSizePx:n,appliedScaleFactor:r},i,s)}getEffectiveScaleFactor(){const{mode:t,factor:e}=v(this.scale);return"factor"===t?e:"auto"===t||"empty"===t?this.appliedScaleFactor:1}getFontStyles(){const t=this.getEffectiveScaleFactor();return this.componentStyle((e=>{var s,i,a,r;const n=(null===(s=e.global)||void 0===s?void 0:s.fontSizePx)||13.3333;return{"--bn-font-family":(null===(i=e.global)||void 0===i?void 0:i.fontFamily)||"'Noto Sans', sans-serif","--bn-font-size":n*t+"px","--bn-font-color":(null===(a=e.global)||void 0===a?void 0:a.fontColor)||"#000000","--bn-font-background":(null===(r=e.global)||void 0===r?void 0:r.fontBackgroundColor)||"#ffffff"}}))}getDataStructure(){const t={};for(const e of["ac","pp","fc","pl"])for(const s of[1,2,3,4])t[`${e}${s}`]={type:"number",isOptional:!0,description:""};for(const[e,s]of Object.entries(this.mappedAxes())){if(null===s)continue;const i=S(s.measure);null!==i&&("scenario"===i.kind?t[i.slot].description=`${e}: ${"label"in s&&void 0!==s.label?s.label:s.measure}`:(t[i.measure.base].description=`${e}: ${s.measure} (base)`,t[i.measure.delta].description=`${e}: ${s.measure} (delta)`))}return{[this.dataStructureName()]:Object.assign({operation:{type:"string",isOptional:!1,description:""},rowGroup:{type:"string",isOptional:!0,description:""},rowGroupIndex:{type:"number",isOptional:!0,description:""},category:{type:"string",isOptional:!1,description:""},categoryIndex:{type:"number",isOptional:!1,description:""},subCategory:{type:"string",isOptional:!0,description:""},subCategoryIndex:{type:"number",isOptional:!0,description:""}},t)}}mappedAxes(){return{x:this.prepareAxis("x",this.x),y:this.prepareAxis("y",this.y)}}dataStructureName(){return"IScatterChartDataRow"}chartTemplate(){const t=this.prepareAxis("x",this.x),e=this.prepareAxis("y",this.y),s=this.prepareFacet();if(this.validateCrossProp([null==t?void 0:t.measure,null==e?void 0:e.measure],s),this.hasBlockingErrors()||null===t||null===e)return null;const i=this.preparePointLevel(),r=this.prepareI18n(),n=this.prepareStyle(),o=c(this.element).width;return a("bn-chart-scatter-renderer",{tableName:this.datasetName,dataVersion:this.dataVersion,chartTitle:this.chartTitle,x:t,y:e,iso:this.prepareIso(),labels:this.prepareLabels(),legend:this.prepareLegend(),facet:s,pointLevel:i,seriesLevel:this.prepareSeriesLevel(i),aspect:this.prepareAspect(),limit:this.prepareLimit(),filter:this.filter,styles:n,i18n:r,containerWidth:o,ruleSetConfig:this.ruleSetConfig(),errors:this.errors,translator:this.translateForInner})}render(){return a(r,{key:"e3b4145baa75c73aa1dce6f44f3eac3a2a093cac",style:this.getFontStyles()},a("div",{key:"e60ee9b18969fc5c51ec59aae202b8519789d0a3",class:"container"},this.chartTemplate()))}get element(){return this}static get watchers(){return{filter:[{validateFilter:0}],x:[{validateX:0}],y:[{validateY:0}],iso:[{validateIso:0}],level:[{validateLevel:0}],seriesLevel:[{validateSeriesLevel:0}],facet:[{validateFacet:0}],labels:[{validateLabels:0}],legend:[{validateLegend:0}],aspect:[{validateAspect:0}],limit:[{validateLimit:0}],scale:[{validateScale:0}]}}static get style(){return':host(.no-data){display:block;box-sizing:border-box;width:100%;height:100%}:host(.no-data)>div{float:none;width:100%;height:100%}:host(.no-data) .no-data~.no-data{display:none}.empty-state{box-sizing:border-box;display:flex;align-items:center;justify-content:center;float:none;width:100%;height:100%;min-height:3em;margin:0;padding:0.5em;overflow:hidden;border:0.1em dashed #ddd;color:#808080;font-family:var(--bn-font-family, "Noto Sans", sans-serif);font-size:var(--bn-font-size, 13.3333px);font-style:normal;text-align:center}:host{display:inline-block;position:relative;overflow:hidden;font-family:var(--bn-font-family, "Noto Sans", sans-serif);font-size:var(--bn-font-size, 13.3333px);color:var(--bn-font-color, #000000)}.container{display:flex;flex-direction:column}'}},[1,"bn-chart-scatter",{datasets:[513],selectedStyle:[513,"selected-style"],i18nNamespace:[513,"i18n-namespace"],ruleset:[513],chartTitle:[1,"chart-title"],filter:[1],x:[1],y:[1],iso:[1],level:[1],seriesLevel:[1,"series-level"],facet:[1],labels:[1],legend:[1],aspect:[1],limit:[2],scale:[1],datasetName:[32],dataVersion:[32],datasetMeta:[32],appliedScaleFactor:[32],getLayoutState:[64]},void 0,{filter:[{validateFilter:0}],x:[{validateX:0}],y:[{validateY:0}],iso:[{validateIso:0}],level:[{validateLevel:0}],seriesLevel:[{validateSeriesLevel:0}],facet:[{validateFacet:0}],labels:[{validateLabels:0}],legend:[{validateLegend:0}],aspect:[{validateAspect:0}],limit:[{validateLimit:0}],scale:[{validateScale:0}]}]),C=z,W=function(){"undefined"!=typeof customElements&&["bn-chart-scatter","bn-chart-scatter-renderer"].forEach((t=>{switch(t){case"bn-chart-scatter":customElements.get(n(t))||customElements.define(n(t),z);break;case"bn-chart-scatter-renderer":customElements.get(n(t))||I()}}))};export{C as BnChartScatter,W as defineCustomElement}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { Components, JSX } from "../types/components";
|
|
2
|
+
|
|
3
|
+
interface BnChartStructureRenderer extends Components.BnChartStructureRenderer, HTMLElement {}
|
|
4
|
+
export const BnChartStructureRenderer: {
|
|
5
|
+
prototype: BnChartStructureRenderer;
|
|
6
|
+
new (): BnChartStructureRenderer;
|
|
7
|
+
};
|
|
8
|
+
/**
|
|
9
|
+
* Used to define this component and all nested components recursively.
|
|
10
|
+
*/
|
|
11
|
+
export const defineCustomElement: () => void;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{B as o,d as p}from"./p-Ba9PUiBp.js";const s=o,a=p;export{s as BnChartStructureRenderer,a as defineCustomElement}
|