@bino-bi/bn-template-engine 1.0.0-next.19 → 1.0.0-next.20
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-7bdc0e28.entry.js → p-28d5c266.entry.js} +1 -1
- package/dist/bn-template-engine/{p-2e6dc267.entry.js → p-2d3ea756.entry.js} +1 -1
- package/dist/bn-template-engine/{p-9879c9b2.entry.js → p-2fba7c99.entry.js} +1 -1
- package/dist/bn-template-engine/{p-eca8e2e2.entry.js → p-6077155f.entry.js} +1 -1
- package/dist/bn-template-engine/{p-74c5a95d.entry.js → p-687032d5.entry.js} +1 -1
- package/dist/bn-template-engine/{p-22d0fb7a.entry.js → p-6c7f0076.entry.js} +1 -1
- package/dist/bn-template-engine/{p-Dg9OcXAO.js → p-6lOdN-fB.js} +1 -1
- package/dist/bn-template-engine/{p-83c71b16.entry.js → p-7e9dbc93.entry.js} +1 -1
- package/dist/bn-template-engine/{p-b25455a7.entry.js → p-99477a27.entry.js} +1 -1
- package/dist/bn-template-engine/p-A8xyE4b1.js +1 -0
- package/dist/bn-template-engine/p-BgIpdpfH.js +1 -0
- package/dist/bn-template-engine/p-BpWWgN6k.js +1 -0
- package/dist/bn-template-engine/{p-Bdfxd_Ke.js → p-C5uvAEKI.js} +1 -1
- package/dist/bn-template-engine/p-C8Q0lsaU.js +1 -0
- package/dist/bn-template-engine/{p-DY7YYmpa.js → p-C9i1Xsib.js} +1 -1
- package/dist/bn-template-engine/{p-BWKdb9ym.js → p-CJThzFZm.js} +1 -1
- package/dist/bn-template-engine/{p-rdqTC0_5.js → p-CYE0I1Mx.js} +1 -1
- package/dist/bn-template-engine/{p-X6CxL6W-.js → p-DwYUTvvI.js} +1 -1
- package/dist/bn-template-engine/{p-19bbac66.entry.js → p-a1380d7c.entry.js} +1 -1
- package/dist/bn-template-engine/{p-485d23d7.entry.js → p-a4ea9a79.entry.js} +1 -1
- package/dist/bn-template-engine/p-b5274369.entry.js +1 -0
- package/dist/bn-template-engine/{p-e96da91f.entry.js → p-b9e94127.entry.js} +1 -1
- package/dist/bn-template-engine/p-ba912130.entry.js +1 -0
- package/dist/bn-template-engine/{p-f9dfd120.entry.js → p-de29986f.entry.js} +1 -1
- package/dist/bn-template-engine/{p-BZV1b5VH.js → p-eEfqksk-.js} +1 -1
- package/dist/bn-template-engine/{p-aakBGfzL.js → p-fFtEvsY-.js} +1 -1
- package/dist/cjs/{AxisConfig-VnVelfSV.js → AxisConfig-D7CAyPLO.js} +1 -1
- package/dist/cjs/{LabelCollisionManager-nfD5P__k.js → LabelCollisionManager-DkdQ9Xdg.js} +2 -2
- package/dist/cjs/{Order-DobBozQC.js → Order-IPfAP0q8.js} +1 -1
- package/dist/cjs/{SVGStyle-BQOmGWLX.js → SVGStyle-BD8jApd4.js} +2 -2
- package/dist/cjs/{SVGVariancesStyleGroup-DCGfHrqh.js → SVGVariancesStyleGroup-BaWzR951.js} +1 -1
- package/dist/cjs/{VarianceMeasure-NY9yhiNV.js → VarianceMeasure-BBWTgv2e.js} +1 -1
- package/dist/cjs/{XYChartDataRow-B7OKrAcC.js → XYChartDataRow-BoR0CTfl.js} +4 -4
- package/dist/cjs/bn-asset_21.cjs.entry.js +93 -35
- package/dist/cjs/bn-chart-bubble.cjs.entry.js +8 -8
- package/dist/cjs/bn-chart-bullet.cjs.entry.js +7 -7
- package/dist/cjs/bn-chart-scatter.cjs.entry.js +7 -7
- package/dist/cjs/bn-grid.cjs.entry.js +5 -5
- package/dist/cjs/bn-image.cjs.entry.js +4 -4
- package/dist/cjs/bn-internationalization.cjs.entry.js +1 -1
- package/dist/cjs/bn-ruleset.cjs.entry.js +1 -1
- package/dist/cjs/bn-template-engine.cjs.js +1 -1
- package/dist/cjs/bn-text.cjs.entry.js +5 -5
- package/dist/cjs/bn-tree.cjs.entry.js +4 -4
- package/dist/cjs/{context-protocol-BDrMkhc4.js → context-protocol-BBhT9B52.js} +9 -3
- package/dist/cjs/editor-companion.cjs.entry.js +1 -1
- package/dist/cjs/ibcs-chart-bubble.cjs.entry.js +5 -5
- package/dist/cjs/ibcs-chart-bullet.cjs.entry.js +5 -5
- package/dist/cjs/ibcs-chart-scatter.cjs.entry.js +5 -5
- package/dist/cjs/{layoutObserver-o03YUfn_.js → layoutObserver-DUYYkDMQ.js} +3 -3
- package/dist/cjs/loader.cjs.js +1 -1
- package/dist/cjs/{scaling-DKZyjWj5.js → scaling-BIJQ2NV1.js} +4 -2
- package/dist/cjs/{withScalingGroup-BmcRlWBs.js → withScalingGroup-D5clRvRe.js} +1 -1
- package/dist/cjs/{withStyled-CRiC9fzc.js → withStyled-Cm9dWQhu.js} +34 -3
- package/dist/collection/components/bn-chart-structure/bn-chart-structure.js +2 -2
- package/dist/collection/components/bn-chart-structure/ibcs-chart-structure.js +1 -1
- package/dist/collection/components/bn-chart-structure/utils/StructureChart.js +19 -2
- package/dist/collection/components/bn-chart-time/bn-chart-time.js +2 -2
- package/dist/collection/components/bn-chart-time/ibcs-chart-time.js +3 -1
- package/dist/collection/components/bn-chart-time/utils/TimeChart.js +19 -1
- package/dist/collection/components/bn-chart-time/utils/model/TimeChartComponentConfig.js +5 -0
- package/dist/collection/components/bn-context/bn-context.js +20 -1
- package/dist/collection/components/bn-grid/bn-grid.js +20 -1
- package/dist/collection/components/bn-layout-card/bn-layout-card.js +3 -3
- package/dist/collection/components/bn-layout-page/bn-layout-page.js +3 -3
- package/dist/collection/components/bn-table/bn-table.js +2 -2
- package/dist/collection/components/bn-table/ibcs-table.js +1 -1
- package/dist/collection/components/bn-table/utils/Table.js +0 -1
- package/dist/collection/components/bn-table/utils/factories/tableDataSetFactory.js +3 -1
- package/dist/collection/components/bn-title/bn-title.js +5 -1
- package/dist/collection/components/bn-title/ibcs-title/ibcs-title.js +25 -2
- package/dist/collection/components/bn-title/ibcs-title/utils/Title.js +4 -4
- package/dist/collection/components/bn-title/ibcs-title/utils/factories/TitleDataSetFactory.js +6 -2
- package/dist/collection/components/bn-title/ibcs-title/utils/model/TitleConfig.js +5 -0
- package/dist/collection/components/bn-tree/bn-tree.js +19 -0
- package/dist/collection/stores/internationalization.js +9 -3
- package/dist/collection/utils/DateStringFactory.js +31 -0
- package/dist/collection/utils/withTranslation.js +3 -1
- package/dist/components/DateStringFactory.js +1 -1
- package/dist/components/bn-chart-structure.js +1 -1
- package/dist/components/bn-chart-time.js +1 -1
- package/dist/components/bn-context.js +1 -1
- package/dist/components/bn-grid.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-table.js +1 -1
- package/dist/components/bn-title2.js +1 -1
- package/dist/components/bn-tree.js +1 -1
- package/dist/components/context-protocol.js +1 -1
- package/dist/components/ibcs-chart-structure2.js +1 -1
- package/dist/components/ibcs-chart-time2.js +1 -1
- package/dist/components/ibcs-table2.js +1 -1
- package/dist/components/ibcs-title2.js +1 -1
- package/dist/esm/{AxisConfig-C_zWCKlL.js → AxisConfig-ByIP5J-9.js} +1 -1
- package/dist/esm/{LabelCollisionManager-8swVQHKA.js → LabelCollisionManager-DaNiDiM9.js} +2 -2
- package/dist/esm/{Order-BPeWfygb.js → Order-BQeJE_yi.js} +1 -1
- package/dist/esm/{SVGStyle-BxEDw9zh.js → SVGStyle-BwBlY3Km.js} +2 -2
- package/dist/esm/{SVGVariancesStyleGroup-DRQYvSDD.js → SVGVariancesStyleGroup-BpGW4CvN.js} +1 -1
- package/dist/esm/{VarianceMeasure-DnwNKspZ.js → VarianceMeasure-CE3N8Bea.js} +1 -1
- package/dist/esm/{XYChartDataRow-DeV4r-Wm.js → XYChartDataRow-DeMI1JKU.js} +4 -4
- package/dist/esm/bn-asset_21.entry.js +93 -35
- package/dist/esm/bn-chart-bubble.entry.js +8 -8
- package/dist/esm/bn-chart-bullet.entry.js +7 -7
- package/dist/esm/bn-chart-scatter.entry.js +7 -7
- package/dist/esm/bn-grid.entry.js +5 -5
- package/dist/esm/bn-image.entry.js +4 -4
- package/dist/esm/bn-internationalization.entry.js +1 -1
- package/dist/esm/bn-ruleset.entry.js +1 -1
- package/dist/esm/bn-template-engine.js +1 -1
- package/dist/esm/bn-text.entry.js +5 -5
- package/dist/esm/bn-tree.entry.js +4 -4
- package/dist/esm/{context-protocol-1Yj1uKvh.js → context-protocol-d8MHrEo8.js} +9 -3
- package/dist/esm/editor-companion.entry.js +1 -1
- package/dist/esm/ibcs-chart-bubble.entry.js +5 -5
- package/dist/esm/ibcs-chart-bullet.entry.js +5 -5
- package/dist/esm/ibcs-chart-scatter.entry.js +5 -5
- package/dist/esm/{layoutObserver-BG5dOBYH.js → layoutObserver-BJBEyhNf.js} +3 -3
- package/dist/esm/loader.js +1 -1
- package/dist/esm/{scaling-CeSRcRl1.js → scaling-BGnpSN1j.js} +4 -2
- package/dist/esm/{withScalingGroup-Br70pAv9.js → withScalingGroup-CC3UcvC5.js} +1 -1
- package/dist/esm/{withStyled-Br2DGTPs.js → withStyled-2l5Tx3cf.js} +34 -3
- package/dist/types/components/bn-chart-structure/utils/StructureChart.d.ts +5 -0
- package/dist/types/components/bn-chart-time/utils/TimeChart.d.ts +5 -0
- package/dist/types/components/bn-chart-time/utils/model/TimeChartComponentConfig.d.ts +2 -0
- package/dist/types/components/bn-context/bn-context.d.ts +8 -0
- package/dist/types/components/bn-grid/bn-grid.d.ts +8 -0
- package/dist/types/components/bn-layout-card/bn-layout-card.d.ts +4 -0
- package/dist/types/components/bn-layout-page/bn-layout-page.d.ts +4 -0
- package/dist/types/components/bn-title/bn-title.d.ts +1 -0
- package/dist/types/components/bn-title/ibcs-title/ibcs-title.d.ts +2 -0
- package/dist/types/components/bn-title/ibcs-title/utils/factories/TitleDataSetFactory.d.ts +3 -1
- package/dist/types/components/bn-title/ibcs-title/utils/model/TitleConfig.d.ts +2 -0
- package/dist/types/components/bn-tree/bn-tree.d.ts +8 -0
- package/dist/types/components.d.ts +42 -4
- package/dist/types/utils/DateStringFactory.d.ts +19 -0
- package/dist/types/utils/withTranslation.d.ts +3 -1
- package/package.json +1 -1
- package/dist/bn-template-engine/p-209351c9.entry.js +0 -1
- package/dist/bn-template-engine/p-90806e7a.entry.js +0 -1
- package/dist/bn-template-engine/p-BqhIhYr1.js +0 -1
- package/dist/bn-template-engine/p-C0Pwqx-O.js +0 -1
- package/dist/bn-template-engine/p-CiudZRQr.js +0 -1
- package/dist/bn-template-engine/p-DTuaq8Pj.js +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
import{p as e,B as a,c as t,w as i,N as l,a as r,b as n}from"./p-B_d-jp99.js";export{s as setNonce}from"./p-B_d-jp99.js";import{g as o}from"./p-DQuL1Twl.js";var d=e=>{const a=e.cloneNode;e.cloneNode=function(e){if("TEMPLATE"===this.nodeName)return a.call(this,e);const t=a.call(this,!1),i=this.childNodes;if(e)for(let e=0;e<i.length;e++)2!==i[e].nodeType&&t.appendChild(i[e].cloneNode(!0));return t}};(()=>{a.isDev&&!a.isTesting&&t("Running in development mode."),a.cloneNodeFix&&d(r.prototype);const s=a.scriptDataOpts?i.document&&Array.from(i.document.querySelectorAll("script")).find((e=>new RegExp(`/${l}(\\.esm)?\\.js($|\\?|#)`).test(e.src)||e.getAttribute("data-stencil-namespace")===l)):null,n=import.meta.url,o=a.scriptDataOpts&&(s||{})["data-opts"]||{};return""!==n&&(o.resourcesUrl=new URL(".",n).href),e(o)})().then((async e=>(await o(),n(JSON.parse('[["p-83c71b16",[[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]},null,{"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}]}]]],["p-eca8e2e2",[[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]},null,{"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}]}]]],["p-b25455a7",[[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]},null,{"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}]}]]],["p-209351c9",[[257,"bn-grid",{"chartTitle":[1,"chart-title"],"rowHeaders":[1,"row-headers"],"columnHeaders":[1,"column-headers"],"showRowHeaders":[1,"show-row-headers"],"showColumnHeaders":[1,"show-column-headers"],"showBorders":[1,"show-borders"],"rowHeaderWidth":[1,"row-header-width"],"cellGap":[1,"cell-gap"],"gridConfig":[32]},null,{"rowHeaders":[{"validateRowHeaders":0}],"columnHeaders":[{"validateColumnHeaders":0}],"showRowHeaders":[{"validateShowRowHeaders":0}],"showColumnHeaders":[{"validateShowColumnHeaders":0}],"showBorders":[{"validateShowBorders":0}]}]]],["p-e96da91f",[[1,"bn-image",{"source":[1]}]]],["p-74c5a95d",[[0,"bn-internationalization",{"code":[1],"namespace":[1]}]]],["p-f9dfd120",[[0,"bn-ruleset",{"name":[1]}]]],["p-a8291de2",[[257,"bn-template",{"templateId":[1,"template-id"]}]]],["p-19bbac66",[[1,"bn-text",{"value":[1],"scale":[1],"data":[32]},null,{"value":[{"validateValue":0}],"scale":[{"validateScaling":0}]}]]],["p-22d0fb7a",[[257,"bn-tree",{"edges":[1],"direction":[1],"levelSpacing":[2,"level-spacing"],"nodeSpacing":[2,"node-spacing"],"edgeStyle":[1,"edge-style"],"showOperators":[1,"show-operators"],"treeConfig":[32],"layout":[32],"nodeRects":[32],"svgWidth":[32],"svgHeight":[32]},null,{"edges":[{"validateEdgesProp":0}],"direction":[{"validateDirection":0}],"levelSpacing":[{"validateLevelSpacing":0}],"nodeSpacing":[{"validateNodeSpacing":0}],"edgeStyle":[{"validateEdgeStyle":0}],"showOperators":[{"validateShowOperators":0}]}]]],["p-7bdc0e28",[[0,"editor-companion",{"internationalizationKeys":[64],"getDistinctFromDataSource":[64],"getDistinctFromDataset":[64]}]]],["p-9879c9b2",[[1,"ibcs-chart-bubble",{"tableName":[1,"table-name"],"dataVersion":[2,"data-version"],"chartTitle":[1,"chart-title"],"x":[16],"y":[16],"size":[16],"share":[16],"compareFamily":[1,"compare-family"],"labels":[16],"legend":[16],"facet":[16],"pointLevel":[1,"point-level"],"seriesLevel":[1,"series-level"],"aspect":[2],"limit":[2],"filter":[1],"sizeAreaPerUnit":[2,"size-area-per-unit"],"styles":[16],"i18n":[16],"containerWidth":[2,"container-width"],"ruleSetConfig":[16],"errors":[16],"translate":[16]}]]],["p-2e6dc267",[[1,"ibcs-chart-bullet",{"tableName":[1,"table-name"],"dataVersion":[2,"data-version"],"chartTitle":[1,"chart-title"],"actual":[16],"target":[16],"ranges":[16],"normalize":[1],"showVariances":[4,"show-variances"],"level":[1],"order":[16],"limit":[2],"labels":[16],"filter":[1],"styles":[16],"i18n":[16],"containerWidth":[2,"container-width"],"ruleSetConfig":[16],"errors":[16],"translate":[16]}]]],["p-485d23d7",[[1,"ibcs-chart-scatter",{"tableName":[1,"table-name"],"dataVersion":[2,"data-version"],"chartTitle":[1,"chart-title"],"x":[16],"y":[16],"iso":[16],"labels":[16],"legend":[16],"facet":[16],"pointLevel":[1,"point-level"],"seriesLevel":[1,"series-level"],"aspect":[2],"limit":[2],"filter":[1],"styles":[16],"i18n":[16],"containerWidth":[2,"container-width"],"ruleSetConfig":[16],"errors":[16],"translate":[16]}]]],["p-90806e7a",[[257,"bn-layout-page",{"styles":[1],"selectedStyle":[1,"selected-style"],"ruleset":[1],"messageText":[1,"message-text"],"messageImage":[1,"message-image"],"titleBusinessUnit":[1,"title-business-unit"],"titleScenarios":[1,"title-scenarios"],"titleVariances":[1,"title-variances"],"titleOrder":[1,"title-order"],"titleOrderDirection":[1,"title-order-direction"],"titleMeasures":[1,"title-measures"],"titleDateStart":[1,"title-date-start"],"titleDateEnd":[1,"title-date-end"],"titleDateFormat":[1,"title-date-format"],"titleDateLink":[1,"title-date-link"],"titleNamespace":[1,"title-namespace"],"i18nNamespace":[513,"i-1-8n-namespace"],"pageFormat":[1,"page-format"],"pageOrientation":[1,"page-orientation"],"pageNumber":[1,"page-number"],"footerText":[1,"footer-text"],"footerDisplayPageNumber":[4,"footer-display-page-number"],"pageLayout":[1,"page-layout"],"pageCustomTemplate":[1,"page-custom-template"],"pageGridGap":[1,"page-grid-gap"],"pageFitToContent":[4,"page-fit-to-content"],"getNumberOfSlot":[64]}],[257,"bn-layout-card",{"styles":[1],"selectedStyle":[1,"selected-style"],"ruleset":[1],"titleImage":[1,"title-image"],"titleBusinessUnit":[1,"title-business-unit"],"titleScenarios":[1,"title-scenarios"],"titleVariances":[1,"title-variances"],"titleOrder":[1,"title-order"],"titleOrderDirection":[1,"title-order-direction"],"titleMeasures":[1,"title-measures"],"titleDateStart":[1,"title-date-start"],"titleDateEnd":[1,"title-date-end"],"titleDateFormat":[1,"title-date-format"],"titleDateLink":[1,"title-date-link"],"titleNamespace":[1,"title-namespace"],"i18nNamespace":[513,"i-1-8n-namespace"],"footerText":[1,"footer-text"],"cardLayout":[1,"card-layout"],"cardCustomTemplate":[1,"card-custom-template"],"cardGridGap":[1,"card-grid-gap"],"cardFitToContent":[4,"card-fit-to-content"],"cardShowBorder":[4,"card-show-border"],"getNumberOfSlot":[64]}],[1,"bn-chart-structure",{"chartTitle":[1,"chart-title"],"ruleset":[513],"filter":[1],"scenarios":[1],"variances":[1],"unitScaling":[8,"unit-scaling"],"percentageScaling":[8,"percentage-scaling"],"level":[1],"order":[1],"orderDirection":[1,"order-direction"],"limit":[2],"showCategories":[1,"show-categories"],"measureScale":[1,"measure-scale"],"showMeasureScale":[1,"show-measure-scale"],"measureUnit":[1,"measure-unit"],"stack":[1],"scale":[1],"datasetName":[32],"dataVersion":[32],"datasetMeta":[32],"appliedScaleFactor":[32]},null,{"scenarios":[{"validateScenario":0}],"variances":[{"validateVariances":0}],"unitScaling":[{"validateUnitScaling":0}],"percentageScaling":[{"validatePercentageScaling":0}],"level":[{"validateLevel":0}],"order":[{"validateOrderList":0}],"orderDirection":[{"validateOrderDirection":0}],"limit":[{"validateLimit":0}],"showCategories":[{"validateShowCategories":0}],"measureScale":[{"validateMeasureScale":0}],"showMeasureScale":[{"validateShowMeasureScale":0}],"stack":[{"validateStack":0}],"scale":[{"validateScaling":0}]}],[1,"bn-chart-time",{"ruleset":[513],"chartTitle":[1,"chart-title"],"filter":[1],"scenarios":[1],"variances":[1],"syncSpaceLeft":[2,"sync-space-left"],"limit":[2],"unitScaling":[8,"unit-scaling"],"percentageScaling":[8,"percentage-scaling"],"level":[1],"order":[1],"orderDirection":[1,"order-direction"],"dateInterval":[1,"date-interval"],"chartMode":[1,"chart-mode"],"maxBars":[2,"max-bars"],"stack":[1],"scale":[1],"intervalSpanLimit":[2,"interval-span-limit"],"axisLabelsMode":[1,"axis-labels-mode"],"lineFullWidth":[1,"line-full-width"],"showCategories":[1,"show-categories"],"measureScale":[1,"measure-scale"],"showMeasureScale":[1,"show-measure-scale"],"showOverlayAvg":[1,"show-overlay-avg"],"showOverlayMedian":[1,"show-overlay-median"],"measureUnit":[1,"measure-unit"],"datasetName":[32],"dataVersion":[32],"datasetMeta":[32],"appliedScaleFactor":[32]},null,{"scenarios":[{"validateScenario":0}],"variances":[{"validateVariances":0}],"syncSpaceLeft":[{"validateLeftSync":0}],"limit":[{"validateLimit":0}],"unitScaling":[{"validateUnitScaling":0}],"percentageScaling":[{"validatePercentageScaling":0}],"level":[{"validateLevel":0}],"order":[{"validateOrderList":0}],"orderDirection":[{"validateOrderDirection":0}],"dateInterval":[{"validateDateInterval":0}],"chartMode":[{"validateChartMode":0}],"maxBars":[{"validateMaxBars":0}],"stack":[{"validateStack":0}],"scale":[{"validateScaling":0}],"axisLabelsMode":[{"validateAxisLabelsMode":0}],"lineFullWidth":[{"validateLineFullWidth":0}],"showCategories":[{"validateShowCategories":0}],"measureScale":[{"validateMeasureScale":0}],"showMeasureScale":[{"validateShowMeasureScale":0}],"showOverlayAvg":[{"validateShowOverlayAvg":0}],"showOverlayMedian":[{"validateShowOverlayMedian":0}]}],[1,"bn-table",{"scale":[1],"ruleset":[513],"selectedStyle":[1,"selected-style"],"sumTitle":[1,"sum-title"],"filter":[1],"measureUnit":[1,"measure-unit"],"scenarios":[1],"variances":[1],"barColumns":[1,"bar-columns"],"barColumnWidth":[1,"bar-column-width"],"unitScaling":[8,"unit-scaling"],"percentageScaling":[8,"percentage-scaling"],"dataFormat":[1,"data-format"],"grouped":[1],"showMeasureScale":[1,"show-measure-scale"],"showGroupTitle":[1,"show-group-title"],"type":[1],"limit":[2],"thereof":[1],"partof":[1],"order":[1],"orderDirection":[1,"order-direction"],"measureType":[1,"measure-type"],"measureScale":[1,"measure-scale"],"dataFormatDigitsDecimal":[2,"data-format-digits-decimal"],"dataFormatDigitsPercent":[2,"data-format-digits-percent"],"categoryWidth":[1,"category-width"],"columnthereof":[1],"interval":[1],"tableAttributes":[1,"attributes"],"datasetName":[32],"dataVersion":[32],"datasetMeta":[32],"appliedScaleFactor":[32],"hasBlankSetnames":[32]},null,{"scale":[{"validateScaling":0}],"scenarios":[{"validateScenario":0}],"variances":[{"validateVariances":0}],"barColumns":[{"validateBarColumns":0}],"barColumnWidth":[{"validateBarColumnWidth":0}],"unitScaling":[{"validateUnitScaling":0}],"percentageScaling":[{"validatePercentageScaling":0}],"dataFormat":[{"validateDataFormat":0}],"grouped":[{"validateGrouped":0}],"showMeasureScale":[{"validateShowMeasureScale":0}],"showGroupTitle":[{"validateShowGroupTitle":0}],"type":[{"validateType":0}],"limit":[{"validateLimit":0}],"thereof":[{"validateThereOf":0}],"partof":[{"validatePartOf":0}],"order":[{"validateOrderList":0}],"orderDirection":[{"validateOrderDirection":0}],"measureType":[{"validateMeasureType":0}],"measureScale":[{"validateMeasureScale":0}],"dataFormatDigitsDecimal":[{"validateDataFormatDigitsDecimal":0}],"dataFormatDigitsPercent":[{"validateDateFormatDigitsPercent":0}],"categoryWidth":[{"validateCategoryWidth":0}],"columnthereof":[{"validateColumnThereOf":0}],"interval":[{"validateInterval":0}],"tableAttributes":[{"validateTableAttributes":0}]}],[1,"bn-asset",{"name":[1]}],[0,"bn-component-style",{"name":[1]}],[257,"bn-context",{"locale":[1]},null,{"locale":[{"setLocale":0}]}],[0,"bn-dataset",{"name":[1],"datasources":[1],"static":[4],"raw":[4],"interval":[2]},null,{"name":[{"nameUpdated":0}],"interval":[{"onIntervalChange":0}]}],[0,"bn-datasource",{"name":[1],"raw":[4],"interval":[2]},null,{"interval":[{"onIntervalChange":0}]}],[0,"bn-scaling-group",{"name":[1],"value":[2]},null,{"name":[{"onNameChange":0}],"value":[{"onValueChange":0}]}],[257,"bn-card"],[1,"bn-message",{"text":[1025],"image":[1]}],[257,"bn-page",{"format":[1],"orientation":[1]},null,{"format":[{"validateFormat":0}],"orientation":[{"validateOrientation":0}]}],[1,"ibcs-chart-structure",{"tableName":[1,"table-name"],"dataVersion":[2,"data-version"],"chartTitle":[1,"chart-title"],"scenarios":[16],"variances":[16],"hideCategories":[4,"hide-categories"],"pixelPerUnit":[2,"pixel-per-unit"],"pixelPerPercentage":[2,"pixel-per-percentage"],"limit":[2],"styles":[1040],"i18n":[1040],"order":[16],"level":[1],"filter":[1],"measureScale":[1,"measure-scale"],"measureUnit":[1,"measure-unit"],"showMeasureScale":[4,"show-measure-scale"],"dataFormatDigits":[16],"stackConfig":[16],"parentDimensions":[16],"ruleSetConfig":[16]}],[1,"ibcs-chart-time",{"tableName":[1,"table-name"],"dataVersion":[2,"data-version"],"chartTitle":[1,"chart-title"],"scenarios":[16],"variances":[16],"hideAxisLabels":[4,"hide-axis-labels"],"pixelPerUnit":[2,"pixel-per-unit"],"pixelPerPercentage":[2,"pixel-per-percentage"],"limit":[2],"leftSideOffsetForHorizontalSync":[2,"left-side-offset-for-horizontal-sync"],"styles":[1040],"i18n":[1040],"order":[16],"level":[1],"dateInterval":[1,"date-interval"],"intervalSpanLimit":[2,"interval-span-limit"],"axisLabelsMode":[1,"axis-labels-mode"],"filter":[1],"measureScale":[1,"measure-scale"],"measureUnit":[1,"measure-unit"],"showMeasureScale":[4,"show-measure-scale"],"showOverlayMedian":[4,"show-overlay-median"],"showOverlayAvg":[4,"show-overlay-avg"],"chartMode":[1,"chart-mode"],"maxBars":[2,"max-bars"],"stackConfig":[16],"lineFullWidth":[4,"line-full-width"],"containerWidth":[2,"container-width"],"dataFormatDigits":[16],"parentDimensions":[16],"ruleSetConfig":[16]}],[1,"ibcs-table",{"tableName":[1,"table-name"],"dataVersion":[2,"data-version"],"selectedStyle":[513,"selected-style"],"sumTitle":[1,"sum-title"],"scenarios":[16],"scenariosDataFormat":[1,"scenarios-data-format"],"grouped":[4],"limit":[2],"showGroupTitle":[4,"show-group-title"],"thereof":[16],"partof":[16],"order":[16],"categorythereof":[16],"attributeColumns":[16],"type":[1],"categoryWidth":[1,"category-width"],"dataFormatDigits":[16],"ruleSetConfig":[16],"i18n":[1040],"i18nMode":[1,"i18n-mode"],"measureScale":[1,"measure-scale"],"measureUnit":[1,"measure-unit"],"showMeasureScale":[4,"show-measure-scale"],"measureType":[1,"measure-type"],"filter":[1],"barColumns":[16],"interval":[1],"barColumnMaxWidth":[2,"bar-column-max-width"],"unitScaling":[2,"unit-scaling"],"percentageScaling":[2,"percentage-scaling"],"scaleFactor":[2,"scale-factor"]}],[1,"bn-title",{"ruleset":[513],"businessUnit":[1,"business-unit"],"scenarios":[1],"variances":[1],"order":[1],"orderDirection":[1,"order-direction"],"measures":[1],"dateStart":[1,"date-start"],"dateEnd":[1,"date-end"],"dateFormat":[1,"date-format"],"dateLink":[1,"date-link"]},null,{"scenarios":[{"validateScenario":0}],"variances":[{"validateVariances":0}],"order":[{"validateOrder":0}],"orderDirection":[{"validateOrderDirection":0}],"measures":[{"validateMeasures":0}],"dateStart":[{"validateDateStart":0}],"dateEnd":[{"validateDateEnd":0}],"dateFormat":[{"validateDateFormat":0}],"dateLink":[{"validateDateLink":0}]}],[257,"bn-body"],[1,"bn-footer",{"pageNumber":[1026,"page-number"],"text":[1025],"code":[1025],"displayPageNumber":[4,"display-page-number"]}],[1,"ibcs-title",{"businessUnit":[1537,"business-unit"],"scenarios":[16],"measures":[16],"timeperiod":[16],"intervalSpanLimit":[2,"interval-span-limit"],"order":[16],"i18n":[1040],"i18nMode":[1,"i18n-mode"],"ruleSetConfig":[16],"setBusinessUnit":[64],"setProps":[64]}]]]]'),e))));
|
|
1
|
+
import{p as e,B as a,c as t,w as i,N as l,a as r,b as n}from"./p-B_d-jp99.js";export{s as setNonce}from"./p-B_d-jp99.js";import{g as o}from"./p-DQuL1Twl.js";var d=e=>{const a=e.cloneNode;e.cloneNode=function(e){if("TEMPLATE"===this.nodeName)return a.call(this,e);const t=a.call(this,!1),i=this.childNodes;if(e)for(let e=0;e<i.length;e++)2!==i[e].nodeType&&t.appendChild(i[e].cloneNode(!0));return t}};(()=>{a.isDev&&!a.isTesting&&t("Running in development mode."),a.cloneNodeFix&&d(r.prototype);const s=a.scriptDataOpts?i.document&&Array.from(i.document.querySelectorAll("script")).find((e=>new RegExp(`/${l}(\\.esm)?\\.js($|\\?|#)`).test(e.src)||e.getAttribute("data-stencil-namespace")===l)):null,n=import.meta.url,o=a.scriptDataOpts&&(s||{})["data-opts"]||{};return""!==n&&(o.resourcesUrl=new URL(".",n).href),e(o)})().then((async e=>(await o(),n(JSON.parse('[["p-7e9dbc93",[[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]},null,{"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}]}]]],["p-6077155f",[[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]},null,{"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}]}]]],["p-99477a27",[[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]},null,{"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}]}]]],["p-ba912130",[[257,"bn-grid",{"chartTitle":[1,"chart-title"],"rowHeaders":[1,"row-headers"],"columnHeaders":[1,"column-headers"],"showRowHeaders":[1,"show-row-headers"],"showColumnHeaders":[1,"show-column-headers"],"i18nNamespace":[513,"i18n-namespace"],"showBorders":[1,"show-borders"],"rowHeaderWidth":[1,"row-header-width"],"cellGap":[1,"cell-gap"],"gridConfig":[32]},null,{"rowHeaders":[{"validateRowHeaders":0}],"columnHeaders":[{"validateColumnHeaders":0}],"showRowHeaders":[{"validateShowRowHeaders":0}],"showColumnHeaders":[{"validateShowColumnHeaders":0}],"showBorders":[{"validateShowBorders":0}]}]]],["p-b9e94127",[[1,"bn-image",{"source":[1]}]]],["p-687032d5",[[0,"bn-internationalization",{"code":[1],"namespace":[1]}]]],["p-de29986f",[[0,"bn-ruleset",{"name":[1]}]]],["p-a8291de2",[[257,"bn-template",{"templateId":[1,"template-id"]}]]],["p-a1380d7c",[[1,"bn-text",{"value":[1],"scale":[1],"data":[32]},null,{"value":[{"validateValue":0}],"scale":[{"validateScaling":0}]}]]],["p-6c7f0076",[[257,"bn-tree",{"edges":[1],"direction":[1],"levelSpacing":[2,"level-spacing"],"nodeSpacing":[2,"node-spacing"],"edgeStyle":[1,"edge-style"],"i18nNamespace":[513,"i18n-namespace"],"showOperators":[1,"show-operators"],"treeConfig":[32],"layout":[32],"nodeRects":[32],"svgWidth":[32],"svgHeight":[32]},null,{"edges":[{"validateEdgesProp":0}],"direction":[{"validateDirection":0}],"levelSpacing":[{"validateLevelSpacing":0}],"nodeSpacing":[{"validateNodeSpacing":0}],"edgeStyle":[{"validateEdgeStyle":0}],"showOperators":[{"validateShowOperators":0}]}]]],["p-28d5c266",[[0,"editor-companion",{"internationalizationKeys":[64],"getDistinctFromDataSource":[64],"getDistinctFromDataset":[64]}]]],["p-2fba7c99",[[1,"ibcs-chart-bubble",{"tableName":[1,"table-name"],"dataVersion":[2,"data-version"],"chartTitle":[1,"chart-title"],"x":[16],"y":[16],"size":[16],"share":[16],"compareFamily":[1,"compare-family"],"labels":[16],"legend":[16],"facet":[16],"pointLevel":[1,"point-level"],"seriesLevel":[1,"series-level"],"aspect":[2],"limit":[2],"filter":[1],"sizeAreaPerUnit":[2,"size-area-per-unit"],"styles":[16],"i18n":[16],"containerWidth":[2,"container-width"],"ruleSetConfig":[16],"errors":[16],"translate":[16]}]]],["p-2d3ea756",[[1,"ibcs-chart-bullet",{"tableName":[1,"table-name"],"dataVersion":[2,"data-version"],"chartTitle":[1,"chart-title"],"actual":[16],"target":[16],"ranges":[16],"normalize":[1],"showVariances":[4,"show-variances"],"level":[1],"order":[16],"limit":[2],"labels":[16],"filter":[1],"styles":[16],"i18n":[16],"containerWidth":[2,"container-width"],"ruleSetConfig":[16],"errors":[16],"translate":[16]}]]],["p-a4ea9a79",[[1,"ibcs-chart-scatter",{"tableName":[1,"table-name"],"dataVersion":[2,"data-version"],"chartTitle":[1,"chart-title"],"x":[16],"y":[16],"iso":[16],"labels":[16],"legend":[16],"facet":[16],"pointLevel":[1,"point-level"],"seriesLevel":[1,"series-level"],"aspect":[2],"limit":[2],"filter":[1],"styles":[16],"i18n":[16],"containerWidth":[2,"container-width"],"ruleSetConfig":[16],"errors":[16],"translate":[16]}]]],["p-b5274369",[[257,"bn-layout-page",{"styles":[1],"selectedStyle":[1,"selected-style"],"ruleset":[1],"messageText":[1,"message-text"],"messageImage":[1,"message-image"],"titleBusinessUnit":[1,"title-business-unit"],"titleScenarios":[1,"title-scenarios"],"titleVariances":[1,"title-variances"],"titleOrder":[1,"title-order"],"titleOrderDirection":[1,"title-order-direction"],"titleMeasures":[1,"title-measures"],"titleDateStart":[1,"title-date-start"],"titleDateEnd":[1,"title-date-end"],"titleDateFormat":[1,"title-date-format"],"titleDateLink":[1,"title-date-link"],"titleNamespace":[1,"title-namespace"],"i18nNamespace":[513,"i18n-namespace"],"pageFormat":[1,"page-format"],"pageOrientation":[1,"page-orientation"],"pageNumber":[1,"page-number"],"footerText":[1,"footer-text"],"footerDisplayPageNumber":[4,"footer-display-page-number"],"pageLayout":[1,"page-layout"],"pageCustomTemplate":[1,"page-custom-template"],"pageGridGap":[1,"page-grid-gap"],"pageFitToContent":[4,"page-fit-to-content"],"getNumberOfSlot":[64]}],[257,"bn-layout-card",{"styles":[1],"selectedStyle":[1,"selected-style"],"ruleset":[1],"titleImage":[1,"title-image"],"titleBusinessUnit":[1,"title-business-unit"],"titleScenarios":[1,"title-scenarios"],"titleVariances":[1,"title-variances"],"titleOrder":[1,"title-order"],"titleOrderDirection":[1,"title-order-direction"],"titleMeasures":[1,"title-measures"],"titleDateStart":[1,"title-date-start"],"titleDateEnd":[1,"title-date-end"],"titleDateFormat":[1,"title-date-format"],"titleDateLink":[1,"title-date-link"],"titleNamespace":[1,"title-namespace"],"i18nNamespace":[513,"i18n-namespace"],"footerText":[1,"footer-text"],"cardLayout":[1,"card-layout"],"cardCustomTemplate":[1,"card-custom-template"],"cardGridGap":[1,"card-grid-gap"],"cardFitToContent":[4,"card-fit-to-content"],"cardShowBorder":[4,"card-show-border"],"getNumberOfSlot":[64]}],[1,"bn-chart-structure",{"chartTitle":[1,"chart-title"],"ruleset":[513],"filter":[1],"scenarios":[1],"variances":[1],"unitScaling":[8,"unit-scaling"],"percentageScaling":[8,"percentage-scaling"],"level":[1],"order":[1],"orderDirection":[1,"order-direction"],"limit":[2],"showCategories":[1,"show-categories"],"measureScale":[1,"measure-scale"],"showMeasureScale":[1,"show-measure-scale"],"measureUnit":[1,"measure-unit"],"stack":[1],"scale":[1],"datasetName":[32],"dataVersion":[32],"datasetMeta":[32],"appliedScaleFactor":[32]},null,{"scenarios":[{"validateScenario":0}],"variances":[{"validateVariances":0}],"unitScaling":[{"validateUnitScaling":0}],"percentageScaling":[{"validatePercentageScaling":0}],"level":[{"validateLevel":0}],"order":[{"validateOrderList":0}],"orderDirection":[{"validateOrderDirection":0}],"limit":[{"validateLimit":0}],"showCategories":[{"validateShowCategories":0}],"measureScale":[{"validateMeasureScale":0}],"showMeasureScale":[{"validateShowMeasureScale":0}],"stack":[{"validateStack":0}],"scale":[{"validateScaling":0}]}],[1,"bn-chart-time",{"ruleset":[513],"chartTitle":[1,"chart-title"],"filter":[1],"scenarios":[1],"variances":[1],"syncSpaceLeft":[2,"sync-space-left"],"limit":[2],"unitScaling":[8,"unit-scaling"],"percentageScaling":[8,"percentage-scaling"],"level":[1],"order":[1],"orderDirection":[1,"order-direction"],"dateInterval":[1,"date-interval"],"chartMode":[1,"chart-mode"],"maxBars":[2,"max-bars"],"stack":[1],"scale":[1],"intervalSpanLimit":[2,"interval-span-limit"],"axisLabelsMode":[1,"axis-labels-mode"],"lineFullWidth":[1,"line-full-width"],"showCategories":[1,"show-categories"],"measureScale":[1,"measure-scale"],"showMeasureScale":[1,"show-measure-scale"],"showOverlayAvg":[1,"show-overlay-avg"],"showOverlayMedian":[1,"show-overlay-median"],"measureUnit":[1,"measure-unit"],"datasetName":[32],"dataVersion":[32],"datasetMeta":[32],"appliedScaleFactor":[32]},null,{"scenarios":[{"validateScenario":0}],"variances":[{"validateVariances":0}],"syncSpaceLeft":[{"validateLeftSync":0}],"limit":[{"validateLimit":0}],"unitScaling":[{"validateUnitScaling":0}],"percentageScaling":[{"validatePercentageScaling":0}],"level":[{"validateLevel":0}],"order":[{"validateOrderList":0}],"orderDirection":[{"validateOrderDirection":0}],"dateInterval":[{"validateDateInterval":0}],"chartMode":[{"validateChartMode":0}],"maxBars":[{"validateMaxBars":0}],"stack":[{"validateStack":0}],"scale":[{"validateScaling":0}],"axisLabelsMode":[{"validateAxisLabelsMode":0}],"lineFullWidth":[{"validateLineFullWidth":0}],"showCategories":[{"validateShowCategories":0}],"measureScale":[{"validateMeasureScale":0}],"showMeasureScale":[{"validateShowMeasureScale":0}],"showOverlayAvg":[{"validateShowOverlayAvg":0}],"showOverlayMedian":[{"validateShowOverlayMedian":0}]}],[1,"bn-table",{"scale":[1],"ruleset":[513],"selectedStyle":[1,"selected-style"],"sumTitle":[1,"sum-title"],"filter":[1],"measureUnit":[1,"measure-unit"],"scenarios":[1],"variances":[1],"barColumns":[1,"bar-columns"],"barColumnWidth":[1,"bar-column-width"],"unitScaling":[8,"unit-scaling"],"percentageScaling":[8,"percentage-scaling"],"dataFormat":[1,"data-format"],"grouped":[1],"showMeasureScale":[1,"show-measure-scale"],"showGroupTitle":[1,"show-group-title"],"type":[1],"limit":[2],"thereof":[1],"partof":[1],"order":[1],"orderDirection":[1,"order-direction"],"measureType":[1,"measure-type"],"measureScale":[1,"measure-scale"],"dataFormatDigitsDecimal":[2,"data-format-digits-decimal"],"dataFormatDigitsPercent":[2,"data-format-digits-percent"],"categoryWidth":[1,"category-width"],"columnthereof":[1],"interval":[1],"tableAttributes":[1,"attributes"],"datasetName":[32],"dataVersion":[32],"datasetMeta":[32],"appliedScaleFactor":[32],"hasBlankSetnames":[32]},null,{"scale":[{"validateScaling":0}],"scenarios":[{"validateScenario":0}],"variances":[{"validateVariances":0}],"barColumns":[{"validateBarColumns":0}],"barColumnWidth":[{"validateBarColumnWidth":0}],"unitScaling":[{"validateUnitScaling":0}],"percentageScaling":[{"validatePercentageScaling":0}],"dataFormat":[{"validateDataFormat":0}],"grouped":[{"validateGrouped":0}],"showMeasureScale":[{"validateShowMeasureScale":0}],"showGroupTitle":[{"validateShowGroupTitle":0}],"type":[{"validateType":0}],"limit":[{"validateLimit":0}],"thereof":[{"validateThereOf":0}],"partof":[{"validatePartOf":0}],"order":[{"validateOrderList":0}],"orderDirection":[{"validateOrderDirection":0}],"measureType":[{"validateMeasureType":0}],"measureScale":[{"validateMeasureScale":0}],"dataFormatDigitsDecimal":[{"validateDataFormatDigitsDecimal":0}],"dataFormatDigitsPercent":[{"validateDateFormatDigitsPercent":0}],"categoryWidth":[{"validateCategoryWidth":0}],"columnthereof":[{"validateColumnThereOf":0}],"interval":[{"validateInterval":0}],"tableAttributes":[{"validateTableAttributes":0}]}],[1,"bn-asset",{"name":[1]}],[0,"bn-component-style",{"name":[1]}],[257,"bn-context",{"locale":[1],"i18nNamespace":[513,"i18n-namespace"]},null,{"locale":[{"setLocale":0}]}],[0,"bn-dataset",{"name":[1],"datasources":[1],"static":[4],"raw":[4],"interval":[2]},null,{"name":[{"nameUpdated":0}],"interval":[{"onIntervalChange":0}]}],[0,"bn-datasource",{"name":[1],"raw":[4],"interval":[2]},null,{"interval":[{"onIntervalChange":0}]}],[0,"bn-scaling-group",{"name":[1],"value":[2]},null,{"name":[{"onNameChange":0}],"value":[{"onValueChange":0}]}],[257,"bn-card"],[1,"bn-message",{"text":[1025],"image":[1]}],[257,"bn-page",{"format":[1],"orientation":[1]},null,{"format":[{"validateFormat":0}],"orientation":[{"validateOrientation":0}]}],[1,"ibcs-chart-structure",{"tableName":[1,"table-name"],"dataVersion":[2,"data-version"],"chartTitle":[1,"chart-title"],"scenarios":[16],"variances":[16],"hideCategories":[4,"hide-categories"],"pixelPerUnit":[2,"pixel-per-unit"],"pixelPerPercentage":[2,"pixel-per-percentage"],"limit":[2],"styles":[1040],"i18n":[1040],"order":[16],"level":[1],"filter":[1],"measureScale":[1,"measure-scale"],"measureUnit":[1,"measure-unit"],"showMeasureScale":[4,"show-measure-scale"],"dataFormatDigits":[16],"stackConfig":[16],"parentDimensions":[16],"ruleSetConfig":[16]}],[1,"ibcs-chart-time",{"tableName":[1,"table-name"],"dataVersion":[2,"data-version"],"chartTitle":[1,"chart-title"],"scenarios":[16],"variances":[16],"hideAxisLabels":[4,"hide-axis-labels"],"pixelPerUnit":[2,"pixel-per-unit"],"pixelPerPercentage":[2,"pixel-per-percentage"],"limit":[2],"leftSideOffsetForHorizontalSync":[2,"left-side-offset-for-horizontal-sync"],"styles":[1040],"i18n":[1040],"order":[16],"level":[1],"dateInterval":[1,"date-interval"],"intervalSpanLimit":[2,"interval-span-limit"],"axisLabelsMode":[1,"axis-labels-mode"],"filter":[1],"measureScale":[1,"measure-scale"],"measureUnit":[1,"measure-unit"],"showMeasureScale":[4,"show-measure-scale"],"showOverlayMedian":[4,"show-overlay-median"],"showOverlayAvg":[4,"show-overlay-avg"],"chartMode":[1,"chart-mode"],"maxBars":[2,"max-bars"],"stackConfig":[16],"lineFullWidth":[4,"line-full-width"],"containerWidth":[2,"container-width"],"dataFormatDigits":[16],"parentDimensions":[16],"ruleSetConfig":[16]}],[1,"ibcs-table",{"tableName":[1,"table-name"],"dataVersion":[2,"data-version"],"selectedStyle":[513,"selected-style"],"sumTitle":[1,"sum-title"],"scenarios":[16],"scenariosDataFormat":[1,"scenarios-data-format"],"grouped":[4],"limit":[2],"showGroupTitle":[4,"show-group-title"],"thereof":[16],"partof":[16],"order":[16],"categorythereof":[16],"attributeColumns":[16],"type":[1],"categoryWidth":[1,"category-width"],"dataFormatDigits":[16],"ruleSetConfig":[16],"i18n":[1040],"i18nMode":[1,"i18n-mode"],"measureScale":[1,"measure-scale"],"measureUnit":[1,"measure-unit"],"showMeasureScale":[4,"show-measure-scale"],"measureType":[1,"measure-type"],"filter":[1],"barColumns":[16],"interval":[1],"barColumnMaxWidth":[2,"bar-column-max-width"],"unitScaling":[2,"unit-scaling"],"percentageScaling":[2,"percentage-scaling"],"scaleFactor":[2,"scale-factor"]}],[1,"bn-title",{"ruleset":[513],"businessUnit":[1,"business-unit"],"scenarios":[1],"variances":[1],"order":[1],"orderDirection":[1,"order-direction"],"measures":[1],"dateStart":[1,"date-start"],"dateEnd":[1,"date-end"],"dateFormat":[1,"date-format"],"dateLink":[1,"date-link"]},null,{"scenarios":[{"validateScenario":0}],"variances":[{"validateVariances":0}],"order":[{"validateOrder":0}],"orderDirection":[{"validateOrderDirection":0}],"measures":[{"validateMeasures":0}],"dateStart":[{"validateDateStart":0}],"dateEnd":[{"validateDateEnd":0}],"dateFormat":[{"validateDateFormat":0}],"dateLink":[{"validateDateLink":0}]}],[257,"bn-body"],[1,"bn-footer",{"pageNumber":[1026,"page-number"],"text":[1025],"code":[1025],"displayPageNumber":[4,"display-page-number"]}],[1,"ibcs-title",{"businessUnit":[1537,"business-unit"],"scenarios":[16],"measures":[16],"timeperiod":[16],"intervalSpanLimit":[2,"interval-span-limit"],"order":[16],"i18n":[1040],"i18nMode":[1,"i18n-mode"],"locale":[1],"ruleSetConfig":[16],"setBusinessUnit":[64],"setProps":[64]}]]]]'),e))));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as t,h as s,F as r,g as e}from"./p-B_d-jp99.js";import{g as i,B as n}from"./p-
|
|
1
|
+
import{r as t,h as s,F as r,g as e}from"./p-B_d-jp99.js";import{g as i,B as n}from"./p-BgIpdpfH.js";const o=class{constructor(s){t(this,s),this.distinctCache=new Map}connectedCallback(){this.stores=i(this.element)}internationalizationKeys(){return Promise.resolve(n)}getDistinctFromDataSource(t,s){const r=`datasource:${t}:${s}`;if(this.distinctCache.has(r))return Promise.resolve(this.distinctCache.get(r));const e=this.distinct(this.queryRows(t),s);return this.distinctCache.set(r,e),Promise.resolve(e)}getDistinctFromDataset(t,s){const r=`dataset:${t}:${s}`;if(this.distinctCache.has(r))return Promise.resolve(this.distinctCache.get(r));const e=this.distinct(this.queryRows(t),s);return this.distinctCache.set(r,e),Promise.resolve(e)}render(){return s(r,{key:"35a8fdaa36fb5f9b042d1fad904f9b54a58ba79c"})}queryRows(t){try{return this.stores.db.db.exec(`SELECT * FROM \`${t}\``)}catch(t){return[]}}distinct(t,s){return[...new Set(t.map((t=>t[s])))].filter((t=>null!=t))}get element(){return e(this)}};o.style="editor-companion{display:none}";export{o as editor_companion}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as t,h as i,H as s,g as h}from"./p-B_d-jp99.js";import{g as n,b as e}from"./p-BqhIhYr1.js";import{A as r,s as a,C as o}from"./p-BZV1b5VH.js";import{C as l,F as u,S as c,I as d,a as p,b as v,c as f,P as g}from"./p-X6CxL6W-.js";import{S as m}from"./p-aakBGfzL.js";import{b as w}from"./p-Bdfxd_Ke.js";import{N as b}from"./p-DsTzlzxQ.js";class ${constructor(t,i,s,h,n,e){this.ruleSet=t,this.config=h,this.styles=n,this.availableWidth=e,this.rows=[],this.warnings=[],this.i18nMap=new Map,this.populateModel(i,s),this.normalized="target"===this.config.normalize&&this.rows.some((t=>null!==t.fraction)),null!==this.config.target&&this.rows.length>0&&!this.rows.some((t=>null!==t.target))&&this.warnings.push({code:"bullet-target-none",data:{}})}populateModel(t,i){var s,h,n;if(""===i)return;const e=this.config.level,r=this.config.order,a=this.config.actual.measure,o=null!==(h=null===(s=this.config.target)||void 0===s?void 0:s.measure)&&void 0!==h?h:null,l=[a,...null!==o?[o]:[]].map((t=>`SUM(${t}) as ${t}, COUNT(ISNULL(${t})) as ${t}_cnt`)).join(", ");let u;try{u=t.exec(`SELECT ${this.createSelectString(e,r)}, ${l},\n MIN(transformOperator(operation)) as opMin, MAX(transformOperator(operation)) as opMax\n FROM ${i}\n GROUP BY ${this.createGroupByStr(e,r)}\n ORDER BY ${this.createOrderStr(e,r)}`)}catch(t){return void console.error("BulletChart: populateModel query failed",t)}let c=null!=u?u:[];this.config.limit>0&&(c=c.slice(0,this.config.limit));let d=0,p=0,v=0;for(const t of c){const i=this.readValue(t,a),s=null!==o?this.readValue(t,o):null,h="number"==typeof t.opMin?t.opMin:1,e="number"==typeof t.opMax?t.opMax:1;let r=-1===h&&-1===e?"-":"+";h!==e&&(r="+",d++);let l=null;"target"===this.config.normalize&&(null===s?null!==o&&p++:s<=0?v++:null!==i&&(i<0?v++:l=i/s)),this.rows.push({category:String(null!==(n=t.category)&&void 0!==n?n:""),actual:i,target:s,operation:r,sentiment:this.sentiment(i,s,r),fraction:l})}d>0&&this.warnings.push({code:"bullet-mixed-operation",data:{count:String(d)}}),p>0&&this.warnings.push({code:"bullet-target-missing",data:{count:String(p)}}),v>0&&this.warnings.push({code:"bullet-target-invalid",data:{count:String(v)}})}readValue(t,i){if(0===t[`${i}_cnt`])return null;const s=t[i];return"number"==typeof s&&isFinite(s)?s:null}sentiment(t,i,s){return null===t||null===i||t===i?"neu":t>i!=("-"===s)?"pos":"neg"}createSelectString(t,i){return t===r.CATEGORY&&i.hierarchy.includes(w.CATEGORYINDEX)?`${w.CATEGORYINDEX}, ${r.CATEGORY} as category`:t===r.ROWGROUP&&i.hierarchy.includes(w.ROWGROUPINDEX)?`${w.ROWGROUPINDEX}, ${r.ROWGROUP} as category`:t===r.SUBCATEGORY&&i.hierarchy.includes(w.SUBCATEGORYINDEX)?`${w.SUBCATEGORYINDEX}, ${r.SUBCATEGORY} as category`:`${t.toString()} as category`}createGroupByStr(t,i){return t===r.CATEGORY&&i.hierarchy.includes(w.CATEGORYINDEX)?`${w.CATEGORYINDEX}, ${r.CATEGORY}`:t===r.ROWGROUP&&i.hierarchy.includes(w.ROWGROUPINDEX)?`${w.ROWGROUPINDEX}, ${r.ROWGROUP}`:t===r.SUBCATEGORY&&i.hierarchy.includes(w.SUBCATEGORYINDEX)?`${w.SUBCATEGORYINDEX}, ${r.SUBCATEGORY}`:`${t.toString()}`}createOrderStr(t,i){let s=`${t.toLowerCase()}`;return i.hierarchy.length>=1&&(s=`${i.hierarchy.toString()} ${null==i?void 0:i.direction}`),s}get em(){return this.styles.fontStyles.size}fontFamily(){return this.styles.fontStyles.font.replace(/^[\d.]+px\s*/,"")}textWidth(t,i=!1){const s=l(t,{font:this.styles.fontStyles.font,fontSize:this.styles.fontStyles.size+"px",fontWeight:i?"bold":"normal"}).width;return Number.isFinite(s)&&s>0?s:.6*t.length*this.em}drawText(t,i,s,h,n={}){var e,r,a;t.text(i).font({size:null!==(e=n.size)&&void 0!==e?e:this.styles.fontStyles.size,weight:n.bold?"bold":"normal",anchor:null!==(r=n.anchor)&&void 0!==r?r:"start"}).fill(null!==(a=n.color)&&void 0!==a?a:this.styles.fontStyles.color).attr({x:s,y:h,"font-family":this.fontFamily()})}setI18n(t){this.i18nMap=t}hasNoData(){return 0===this.rows.length}getWarnings(){return this.warnings}getAllocatedCanvasWidth(){return this.availableWidth}getAllocatedCanvasHeight(){return this.styles.padding.top+this.titleHeight()+this.headerHeight()+this.rows.length*this.rowBlockHeight()+this.styles.padding.bottom}titleHeight(){return""!==this.config.chartTitle?1.6*this.em:0}headerHeight(){return this.rows.length>0?1.2*this.em:0}rowBlockHeight(){const t=this.em,i=this.styles.scaleFactors.rowHeight*t;return this.normalized?i:i+this.styles.scaleFactors.tickStripHeight*t}valueLabel(t){return null===t||"none"===this.config.labels.show?"":u.number(t,"decimal",this.config.labels.decimals,0)}targetFamily(){var t,i,s;const h=null!==(i=null===(t=this.config.target)||void 0===t?void 0:t.measure)&&void 0!==i?i:"pl1";return null!==(s={10:"ac",20:"pp",30:"fc",50:"pl"}[this.ruleSet.getScenarioColorIndex(h)])&&void 0!==s?s:a(h)}actualLabel(){var t;return null!==(t=this.config.actual.label)&&void 0!==t?t:u.translateScenarioLabel(this.config.actual.measure,this.i18nMap)}targetLabel(){return null===this.config.target?"":void 0!==this.config.target.label?this.config.target.label:this.normalized?this.i18nMap.get("target")||"Target":u.translateScenarioLabel(this.config.target.measure,this.i18nMap)}toString(){const t=new c;return this.draw(t),t.id("drawCanvas"),t.width(this.getAllocatedCanvasWidth()),t.height(this.getAllocatedCanvasHeight()),t.attr("overflow","visible"),t.svg()}draw(t){var i,s;const h=this.em,n=this.styles.scaleFactors,e=this.styles.padding,r=t.group();if(""!==this.config.chartTitle&&this.drawText(r,this.config.chartTitle,e.left,e.top+h,{bold:!0}),0===this.rows.length)return void t.group().addClass("annotations");const a=n.rowHeight*h,o=this.rowBlockHeight(),l=e.top+this.titleHeight()+this.headerHeight(),u=l+(this.rows.length-1)*o+a,c=Math.max(...this.rows.map((t=>this.textWidth(t.category,!0))),h),d=this.rows.map((t=>this.valueLabel(t.actual))),p="none"===this.config.labels.show?0:Math.max(...d.map((t=>this.textWidth(t))),0),v=e.left+c+n.labelToAxis*h,f=Math.max(10,this.availableWidth-v-e.right-p-(p>0?n.labelToBar*h:0)),g=null!==(i=this.config.actual.unit)&&void 0!==i?i:null===(s=this.config.target)||void 0===s?void 0:s.unit,m=this.i18nMap.get("axis.in")||"in",w=l-.35*h;void 0!==g&&""!==g&&this.drawText(r,`${m} ${g}`,e.left,w,{}),this.drawText(r,this.actualLabel(),v+.2*h,w,{}),this.normalized?this.drawNormalized(r,v,f,l,u,a,o,d):this.drawClassic(r,v,f,l,a,o,d),this.rows.forEach(((t,i)=>{this.drawText(r,t.category,v-n.labelToAxis*h,l+i*o+a/2+.35*h,{anchor:"end",bold:!0})})),r.line(v,l-.2*h,v,u+.2*h).stroke({color:this.styles.axisStyles.ac.stroke,width:n.axisLineWidth}),t.group().addClass("annotations")}drawNormalized(t,i,s,h,n,e,r,a){const o=this.em,l=this.styles.scaleFactors,u=1.05*Math.max(1,...this.rows.map((t=>{var i;return null!==(i=t.fraction)&&void 0!==i?i:0}))),c=t=>i+t/u*s,d=c(1),p=this.styles.barStyles.getSVGStyle(this.targetFamily()),v=t.line(d,h-.3*o,d,n+.3*o).stroke({color:p.stroke,width:l.targetLineWidth});void 0!==p.dasharray&&v.attr("stroke-dasharray",p.dasharray),this.drawText(t,this.targetLabel(),d,h-.35*o,{anchor:"middle",bold:!0}),this.rows.forEach(((s,n)=>{const u=h+n*r+e/2;if(null===s.fraction)return void this.drawValueText(t,a[n],i+l.labelToBar*o,u);const p=l.barHeight*o,v=c(s.fraction);if(t.rect(Math.max(0,v-i),p).move(i,u-p/2).fill(this.styles.barStyles.ac.fill).stroke({color:this.styles.barStyles.ac.stroke,width:this.styles.barStyles.ac.width}),this.config.showVariances&&"neu"!==s.sentiment){const i=l.varianceHeight*o,h=this.styles.varianceStyles.getSVGStyle(s.sentiment);t.rect(Math.abs(v-d),i).move(Math.min(v,d),u-i/2).fill(h.fill).stroke({color:h.stroke,width:h.width})}this.drawValueText(t,a[n],Math.max(v,d)+l.labelToBar*o,u)}))}drawClassic(t,i,s,h,n,e,r){const a=this.em,o=this.styles.scaleFactors,l=o.barHeight*a,c=this.config.ranges.length>0;this.rows.forEach(((d,p)=>{var v,f;const g=h+p*e,m=g+n/2,w=c&&null!==d.target?this.config.ranges.map((t=>t*d.target)):[],$=Math.max(null!==(v=d.actual)&&void 0!==v?v:0,null!==(f=d.target)&&void 0!==f?f:0,...w);if($<=0)return void this.drawValueText(t,r[p],i+o.labelToBar*a,m);const M=b.niceStep($,4),y=Math.ceil($/M-1e-9*M)*M,S=new b(0,y,i,i+s);let x=i;w.forEach(((i,s)=>{const h=.8*n;t.rect(Math.max(0,S.scale(i)-x),h).move(x,m-h/2).fill(this.styles.rangeColors[Math.min(s,this.styles.rangeColors.length-1)]).stroke("none"),x=S.scale(i)}));let N=i;if(null!==d.actual&&d.actual>0){const s=S.scale(d.actual);t.rect(s-i,l).move(i,m-l/2).fill(this.styles.barStyles.ac.fill).stroke({color:this.styles.barStyles.ac.stroke,width:this.styles.barStyles.ac.width}),N=s}if(null!==d.target&&d.target>0){const i=S.scale(d.target),s=o.targetTickHeight*a,n=this.styles.barStyles.getSVGStyle(this.targetFamily()),e=t.line(i,m-s/2,i,m+s/2).stroke({color:n.stroke,width:o.targetLineWidth});void 0!==n.dasharray&&e.attr("stroke-dasharray",n.dasharray),0===p&&this.drawText(t,this.targetLabel(),i,h-.35*a,{anchor:"middle"}),N=Math.max(N,i)}N=Math.max(N,x),this.drawValueText(t,r[p],N+o.labelToBar*a,m);const B=S.ticks(4),C=b.tickDecimals(B),L=g+n;for(const i of B){const s=S.scale(i);t.line(s,L,s,L+o.axisTickLength*a).stroke({color:this.styles.axisStyles.ac.stroke,width:o.axisLineWidth}),this.drawText(t,u.number(i,"decimal",C,C),s,L+o.tickStripHeight*a-.2*a,{anchor:"middle"})}}))}drawValueText(t,i,s,h){""!==i&&this.drawText(t,i,s,h+.35*this.em,{})}}class M{constructor(){this.rowHeight=1.9,this.barHeight=.66,this.varianceHeight=.4,this.targetTickHeight=1.1,this.targetLineWidth=2,this.axisLineWidth=1,this.labelToBar=.3,this.labelToAxis=.3,this.axisTickLength=.35,this.tickStripHeight=1.2}}class y{adapt(t){const i=new M;return o.isNumber(t.rowHeight)&&(i.rowHeight=t.rowHeight),o.isNumber(t.barHeight)&&(i.barHeight=t.barHeight),o.isNumber(t.varianceHeight)&&(i.varianceHeight=t.varianceHeight),o.isNumber(t.targetTickHeight)&&(i.targetTickHeight=t.targetTickHeight),o.isNumber(t.targetLineWidth)&&(i.targetLineWidth=t.targetLineWidth),o.isNumber(t.axisLineWidth)&&(i.axisLineWidth=t.axisLineWidth),o.isNumber(t.labelToBar)&&(i.labelToBar=t.labelToBar),o.isNumber(t.labelToAxis)&&(i.labelToAxis=t.labelToAxis),o.isNumber(t.axisTickLength)&&(i.axisTickLength=t.axisTickLength),o.isNumber(t.tickStripHeight)&&(i.tickStripHeight=t.tickStripHeight),i}default(){return new M}}class S{constructor(t,i,s,h,n,e){this.scaleFactors=t,this.fontStyles=i,this.axisStyles=s,this.barStyles=h,this.varianceStyles=n,this.padding=e,this.rangeColors=["#D9D9D9","#EFEFEF"]}}class x{constructor(t,i,s,h,n){this.scaleFactorsBulletChartAdapter=t,this.fontStyleAdapter=i,this.svgStyleGroupAdapter=s,this.svgVariancesStyleGroupAdapter=h,this.paddingAdapter=n}adapt(t){const i=this.default();return o.isExisting(t)&&(o.isExisting(t.scaleFactors)&&(i.scaleFactors=this.scaleFactorsBulletChartAdapter.adapt(t.scaleFactors)),o.isExisting(t.fontStyles)&&(i.fontStyles=this.fontStyleAdapter.adapt(t.fontStyles)),o.isExisting(t.axisStyles)&&(i.axisStyles=this.svgStyleGroupAdapter.adapt(t.axisStyles)),o.isExisting(t.barStyles)&&(i.barStyles=this.svgStyleGroupAdapter.adapt(t.barStyles)),o.isExisting(t.varianceStyles)&&(i.varianceStyles=this.svgVariancesStyleGroupAdapter.adapt(t.varianceStyles)),o.isExisting(t.padding)&&(i.padding=this.paddingAdapter.adapt(t.padding)),Array.isArray(t.rangeColors)&&t.rangeColors.length>0&&(i.rangeColors=t.rangeColors)),i}default(){return new S(this.scaleFactorsBulletChartAdapter.default(),this.fontStyleAdapter.default(),this.svgStyleGroupAdapter.default(),this.svgStyleGroupAdapter.default(),this.svgVariancesStyleGroupAdapter.default(),this.paddingAdapter.default())}}const N=["bullet-target-missing","bullet-target-invalid","bullet-mixed-operation","bullet-target-none"],B=class{constructor(i){t(this,i),this.tableName="",this.dataVersion=0,this.chartTitle="",this.target=null,this.ranges=[],this.normalize="target",this.showVariances=!0,this.level=r.CATEGORY,this.limit=0,this.filter="",this.i18n=new Map,this.containerWidth=0,this.svgMarkup=""}getDb(){return this.stores||(this.stores=n(this.element)),this.stores.db.db}componentWillLoad(){this.rebuild()}componentWillUpdate(){this.rebuild()}rebuild(){const t=this.prepareStyle(),i=this.tableName?e(this.tableName,this.filter):"";this.chart=new $(new d(this.ruleSetConfig),this.getDb(),i,{chartTitle:this.chartTitle,actual:this.actual,target:this.target,ranges:this.ranges,normalize:this.normalize,showVariances:this.showVariances,level:this.level,order:this.order,limit:this.limit,labels:this.labels},t,this.containerWidth||0),this.chart.setI18n(this.i18n),this.svgMarkup=this.chart.hasNoData()?"":this.chart.toString(),this.syncWarnings(this.chart.getWarnings())}syncWarnings(t){if(void 0===this.errors)return;const i=new Map(t.map((t=>[t.code,t.data])));for(const t of N){const s=`WARN_${t}`;if(i.has(t)){const h=void 0!==this.translate?this.translate(`.${t}`,i.get(t)):t;this.errors.addOrReplace({id:s,type:"warning",message:h})}else this.errors.remove(s)}}prepareStyle(){return new x(new y,new p,new v(new f),new m(new f),new g).adapt(this.styles)}render(){if(void 0===this.chart)return i(s,null);if(this.chart.hasNoData()){const t=this.i18n.get("no-data")||"==No Data==";return i(s,null,i("p",{class:"warning"},t))}return i(s,null,i("div",{innerHTML:this.svgMarkup}))}get element(){return h(this)}};B.style=':host{position:relative;display:inline-block}.warning{font-family:var(--bn-font-family, "Noto Sans", "Helvetica Neue", Helvetica, sans-serif);color:var(--bn-font-color, black)}';export{B as ibcs_chart_bullet}
|
|
1
|
+
import{r as t,h as i,H as s,g as h}from"./p-B_d-jp99.js";import{g as n,b as e}from"./p-BgIpdpfH.js";import{A as r,s as o,C as a}from"./p-eEfqksk-.js";import{C as l,F as u,S as c,I as d,a as p,b as v,c as f,P as g}from"./p-DwYUTvvI.js";import{S as m}from"./p-fFtEvsY-.js";import{b as w}from"./p-C5uvAEKI.js";import{N as b}from"./p-DsTzlzxQ.js";class ${constructor(t,i,s,h,n,e){this.ruleSet=t,this.config=h,this.styles=n,this.availableWidth=e,this.rows=[],this.warnings=[],this.i18nMap=new Map,this.populateModel(i,s),this.normalized="target"===this.config.normalize&&this.rows.some((t=>null!==t.fraction)),null!==this.config.target&&this.rows.length>0&&!this.rows.some((t=>null!==t.target))&&this.warnings.push({code:"bullet-target-none",data:{}})}populateModel(t,i){var s,h,n;if(""===i)return;const e=this.config.level,r=this.config.order,o=this.config.actual.measure,a=null!==(h=null===(s=this.config.target)||void 0===s?void 0:s.measure)&&void 0!==h?h:null,l=[o,...null!==a?[a]:[]].map((t=>`SUM(${t}) as ${t}, COUNT(ISNULL(${t})) as ${t}_cnt`)).join(", ");let u;try{u=t.exec(`SELECT ${this.createSelectString(e,r)}, ${l},\n MIN(transformOperator(operation)) as opMin, MAX(transformOperator(operation)) as opMax\n FROM ${i}\n GROUP BY ${this.createGroupByStr(e,r)}\n ORDER BY ${this.createOrderStr(e,r)}`)}catch(t){return void console.error("BulletChart: populateModel query failed",t)}let c=null!=u?u:[];this.config.limit>0&&(c=c.slice(0,this.config.limit));let d=0,p=0,v=0;for(const t of c){const i=this.readValue(t,o),s=null!==a?this.readValue(t,a):null,h="number"==typeof t.opMin?t.opMin:1,e="number"==typeof t.opMax?t.opMax:1;let r=-1===h&&-1===e?"-":"+";h!==e&&(r="+",d++);let l=null;"target"===this.config.normalize&&(null===s?null!==a&&p++:s<=0?v++:null!==i&&(i<0?v++:l=i/s)),this.rows.push({category:String(null!==(n=t.category)&&void 0!==n?n:""),actual:i,target:s,operation:r,sentiment:this.sentiment(i,s,r),fraction:l})}d>0&&this.warnings.push({code:"bullet-mixed-operation",data:{count:String(d)}}),p>0&&this.warnings.push({code:"bullet-target-missing",data:{count:String(p)}}),v>0&&this.warnings.push({code:"bullet-target-invalid",data:{count:String(v)}})}readValue(t,i){if(0===t[`${i}_cnt`])return null;const s=t[i];return"number"==typeof s&&isFinite(s)?s:null}sentiment(t,i,s){return null===t||null===i||t===i?"neu":t>i!=("-"===s)?"pos":"neg"}createSelectString(t,i){return t===r.CATEGORY&&i.hierarchy.includes(w.CATEGORYINDEX)?`${w.CATEGORYINDEX}, ${r.CATEGORY} as category`:t===r.ROWGROUP&&i.hierarchy.includes(w.ROWGROUPINDEX)?`${w.ROWGROUPINDEX}, ${r.ROWGROUP} as category`:t===r.SUBCATEGORY&&i.hierarchy.includes(w.SUBCATEGORYINDEX)?`${w.SUBCATEGORYINDEX}, ${r.SUBCATEGORY} as category`:`${t.toString()} as category`}createGroupByStr(t,i){return t===r.CATEGORY&&i.hierarchy.includes(w.CATEGORYINDEX)?`${w.CATEGORYINDEX}, ${r.CATEGORY}`:t===r.ROWGROUP&&i.hierarchy.includes(w.ROWGROUPINDEX)?`${w.ROWGROUPINDEX}, ${r.ROWGROUP}`:t===r.SUBCATEGORY&&i.hierarchy.includes(w.SUBCATEGORYINDEX)?`${w.SUBCATEGORYINDEX}, ${r.SUBCATEGORY}`:`${t.toString()}`}createOrderStr(t,i){let s=`${t.toLowerCase()}`;return i.hierarchy.length>=1&&(s=`${i.hierarchy.toString()} ${null==i?void 0:i.direction}`),s}get em(){return this.styles.fontStyles.size}fontFamily(){return this.styles.fontStyles.font.replace(/^[\d.]+px\s*/,"")}textWidth(t,i=!1){const s=l(t,{font:this.styles.fontStyles.font,fontSize:this.styles.fontStyles.size+"px",fontWeight:i?"bold":"normal"}).width;return Number.isFinite(s)&&s>0?s:.6*t.length*this.em}drawText(t,i,s,h,n={}){var e,r,o;t.text(i).font({size:null!==(e=n.size)&&void 0!==e?e:this.styles.fontStyles.size,weight:n.bold?"bold":"normal",anchor:null!==(r=n.anchor)&&void 0!==r?r:"start"}).fill(null!==(o=n.color)&&void 0!==o?o:this.styles.fontStyles.color).attr({x:s,y:h,"font-family":this.fontFamily()})}setI18n(t){this.i18nMap=t}hasNoData(){return 0===this.rows.length}getWarnings(){return this.warnings}getAllocatedCanvasWidth(){return this.availableWidth}getAllocatedCanvasHeight(){return this.styles.padding.top+this.titleHeight()+this.headerHeight()+this.rows.length*this.rowBlockHeight()+this.styles.padding.bottom}titleHeight(){return""!==this.config.chartTitle?1.6*this.em:0}headerHeight(){return this.rows.length>0?1.2*this.em:0}rowBlockHeight(){const t=this.em,i=this.styles.scaleFactors.rowHeight*t;return this.normalized?i:i+this.styles.scaleFactors.tickStripHeight*t}valueLabel(t){return null===t||"none"===this.config.labels.show?"":u.number(t,"decimal",this.config.labels.decimals,0)}targetFamily(){var t,i,s;const h=null!==(i=null===(t=this.config.target)||void 0===t?void 0:t.measure)&&void 0!==i?i:"pl1";return null!==(s={10:"ac",20:"pp",30:"fc",50:"pl"}[this.ruleSet.getScenarioColorIndex(h)])&&void 0!==s?s:o(h)}actualLabel(){var t;return null!==(t=this.config.actual.label)&&void 0!==t?t:u.translateScenarioLabel(this.config.actual.measure,this.i18nMap)}targetLabel(){return null===this.config.target?"":void 0!==this.config.target.label?this.config.target.label:this.normalized?this.i18nMap.get("target")||"Target":u.translateScenarioLabel(this.config.target.measure,this.i18nMap)}toString(){const t=new c;return this.draw(t),t.id("drawCanvas"),t.width(this.getAllocatedCanvasWidth()),t.height(this.getAllocatedCanvasHeight()),t.attr("overflow","visible"),t.svg()}draw(t){var i,s;const h=this.em,n=this.styles.scaleFactors,e=this.styles.padding,r=t.group();if(""!==this.config.chartTitle&&this.drawText(r,this.config.chartTitle,e.left,e.top+h,{bold:!0}),0===this.rows.length)return void t.group().addClass("annotations");const o=n.rowHeight*h,a=this.rowBlockHeight(),l=e.top+this.titleHeight()+this.headerHeight(),u=l+(this.rows.length-1)*a+o,c=Math.max(...this.rows.map((t=>this.textWidth(t.category,!0))),h),d=this.rows.map((t=>this.valueLabel(t.actual))),p="none"===this.config.labels.show?0:Math.max(...d.map((t=>this.textWidth(t))),0),v=e.left+c+n.labelToAxis*h,f=Math.max(10,this.availableWidth-v-e.right-p-(p>0?n.labelToBar*h:0)),g=null!==(i=this.config.actual.unit)&&void 0!==i?i:null===(s=this.config.target)||void 0===s?void 0:s.unit,m=this.i18nMap.get("axis.in")||"in",w=l-.35*h;void 0!==g&&""!==g&&this.drawText(r,`${m} ${g}`,e.left,w,{}),this.drawText(r,this.actualLabel(),v+.2*h,w,{}),this.normalized?this.drawNormalized(r,v,f,l,u,o,a,d):this.drawClassic(r,v,f,l,o,a,d),this.rows.forEach(((t,i)=>{this.drawText(r,t.category,v-n.labelToAxis*h,l+i*a+o/2+.35*h,{anchor:"end",bold:!0})})),r.line(v,l-.2*h,v,u+.2*h).stroke({color:this.styles.axisStyles.ac.stroke,width:n.axisLineWidth}),t.group().addClass("annotations")}drawNormalized(t,i,s,h,n,e,r,o){const a=this.em,l=this.styles.scaleFactors,u=1.05*Math.max(1,...this.rows.map((t=>{var i;return null!==(i=t.fraction)&&void 0!==i?i:0}))),c=t=>i+t/u*s,d=c(1),p=this.styles.barStyles.getSVGStyle(this.targetFamily()),v=t.line(d,h-.3*a,d,n+.3*a).stroke({color:p.stroke,width:l.targetLineWidth});void 0!==p.dasharray&&v.attr("stroke-dasharray",p.dasharray),this.drawText(t,this.targetLabel(),d,h-.35*a,{anchor:"middle",bold:!0}),this.rows.forEach(((s,n)=>{const u=h+n*r+e/2;if(null===s.fraction)return void this.drawValueText(t,o[n],i+l.labelToBar*a,u);const p=l.barHeight*a,v=c(s.fraction);if(t.rect(Math.max(0,v-i),p).move(i,u-p/2).fill(this.styles.barStyles.ac.fill).stroke({color:this.styles.barStyles.ac.stroke,width:this.styles.barStyles.ac.width}),this.config.showVariances&&"neu"!==s.sentiment){const i=l.varianceHeight*a,h=this.styles.varianceStyles.getSVGStyle(s.sentiment);t.rect(Math.abs(v-d),i).move(Math.min(v,d),u-i/2).fill(h.fill).stroke({color:h.stroke,width:h.width})}this.drawValueText(t,o[n],Math.max(v,d)+l.labelToBar*a,u)}))}drawClassic(t,i,s,h,n,e,r){const o=this.em,a=this.styles.scaleFactors,l=a.barHeight*o,c=this.config.ranges.length>0;this.rows.forEach(((d,p)=>{var v,f;const g=h+p*e,m=g+n/2,w=c&&null!==d.target?this.config.ranges.map((t=>t*d.target)):[],$=Math.max(null!==(v=d.actual)&&void 0!==v?v:0,null!==(f=d.target)&&void 0!==f?f:0,...w);if($<=0)return void this.drawValueText(t,r[p],i+a.labelToBar*o,m);const M=b.niceStep($,4),y=Math.ceil($/M-1e-9*M)*M,S=new b(0,y,i,i+s);let x=i;w.forEach(((i,s)=>{const h=.8*n;t.rect(Math.max(0,S.scale(i)-x),h).move(x,m-h/2).fill(this.styles.rangeColors[Math.min(s,this.styles.rangeColors.length-1)]).stroke("none"),x=S.scale(i)}));let N=i;if(null!==d.actual&&d.actual>0){const s=S.scale(d.actual);t.rect(s-i,l).move(i,m-l/2).fill(this.styles.barStyles.ac.fill).stroke({color:this.styles.barStyles.ac.stroke,width:this.styles.barStyles.ac.width}),N=s}if(null!==d.target&&d.target>0){const i=S.scale(d.target),s=a.targetTickHeight*o,n=this.styles.barStyles.getSVGStyle(this.targetFamily()),e=t.line(i,m-s/2,i,m+s/2).stroke({color:n.stroke,width:a.targetLineWidth});void 0!==n.dasharray&&e.attr("stroke-dasharray",n.dasharray),0===p&&this.drawText(t,this.targetLabel(),i,h-.35*o,{anchor:"middle"}),N=Math.max(N,i)}N=Math.max(N,x),this.drawValueText(t,r[p],N+a.labelToBar*o,m);const C=S.ticks(4),D=b.tickDecimals(C),E=g+n;for(const i of C){const s=S.scale(i);t.line(s,E,s,E+a.axisTickLength*o).stroke({color:this.styles.axisStyles.ac.stroke,width:a.axisLineWidth}),this.drawText(t,u.number(i,"decimal",D,D),s,E+a.tickStripHeight*o-.2*o,{anchor:"middle"})}}))}drawValueText(t,i,s,h){""!==i&&this.drawText(t,i,s,h+.35*this.em,{})}}class M{constructor(){this.rowHeight=1.9,this.barHeight=.66,this.varianceHeight=.4,this.targetTickHeight=1.1,this.targetLineWidth=2,this.axisLineWidth=1,this.labelToBar=.3,this.labelToAxis=.3,this.axisTickLength=.35,this.tickStripHeight=1.2}}class y{adapt(t){const i=new M;return a.isNumber(t.rowHeight)&&(i.rowHeight=t.rowHeight),a.isNumber(t.barHeight)&&(i.barHeight=t.barHeight),a.isNumber(t.varianceHeight)&&(i.varianceHeight=t.varianceHeight),a.isNumber(t.targetTickHeight)&&(i.targetTickHeight=t.targetTickHeight),a.isNumber(t.targetLineWidth)&&(i.targetLineWidth=t.targetLineWidth),a.isNumber(t.axisLineWidth)&&(i.axisLineWidth=t.axisLineWidth),a.isNumber(t.labelToBar)&&(i.labelToBar=t.labelToBar),a.isNumber(t.labelToAxis)&&(i.labelToAxis=t.labelToAxis),a.isNumber(t.axisTickLength)&&(i.axisTickLength=t.axisTickLength),a.isNumber(t.tickStripHeight)&&(i.tickStripHeight=t.tickStripHeight),i}default(){return new M}}class S{constructor(t,i,s,h,n,e){this.scaleFactors=t,this.fontStyles=i,this.axisStyles=s,this.barStyles=h,this.varianceStyles=n,this.padding=e,this.rangeColors=["#D9D9D9","#EFEFEF"]}}class x{constructor(t,i,s,h,n){this.scaleFactorsBulletChartAdapter=t,this.fontStyleAdapter=i,this.svgStyleGroupAdapter=s,this.svgVariancesStyleGroupAdapter=h,this.paddingAdapter=n}adapt(t){const i=this.default();return a.isExisting(t)&&(a.isExisting(t.scaleFactors)&&(i.scaleFactors=this.scaleFactorsBulletChartAdapter.adapt(t.scaleFactors)),a.isExisting(t.fontStyles)&&(i.fontStyles=this.fontStyleAdapter.adapt(t.fontStyles)),a.isExisting(t.axisStyles)&&(i.axisStyles=this.svgStyleGroupAdapter.adapt(t.axisStyles)),a.isExisting(t.barStyles)&&(i.barStyles=this.svgStyleGroupAdapter.adapt(t.barStyles)),a.isExisting(t.varianceStyles)&&(i.varianceStyles=this.svgVariancesStyleGroupAdapter.adapt(t.varianceStyles)),a.isExisting(t.padding)&&(i.padding=this.paddingAdapter.adapt(t.padding)),Array.isArray(t.rangeColors)&&t.rangeColors.length>0&&(i.rangeColors=t.rangeColors)),i}default(){return new S(this.scaleFactorsBulletChartAdapter.default(),this.fontStyleAdapter.default(),this.svgStyleGroupAdapter.default(),this.svgStyleGroupAdapter.default(),this.svgVariancesStyleGroupAdapter.default(),this.paddingAdapter.default())}}const N=["bullet-target-missing","bullet-target-invalid","bullet-mixed-operation","bullet-target-none"],C=class{constructor(i){t(this,i),this.tableName="",this.dataVersion=0,this.chartTitle="",this.target=null,this.ranges=[],this.normalize="target",this.showVariances=!0,this.level=r.CATEGORY,this.limit=0,this.filter="",this.i18n=new Map,this.containerWidth=0,this.svgMarkup=""}getDb(){return this.stores||(this.stores=n(this.element)),this.stores.db.db}componentWillLoad(){this.rebuild()}componentWillUpdate(){this.rebuild()}rebuild(){const t=this.prepareStyle(),i=this.tableName?e(this.tableName,this.filter):"";this.chart=new $(new d(this.ruleSetConfig),this.getDb(),i,{chartTitle:this.chartTitle,actual:this.actual,target:this.target,ranges:this.ranges,normalize:this.normalize,showVariances:this.showVariances,level:this.level,order:this.order,limit:this.limit,labels:this.labels},t,this.containerWidth||0),this.chart.setI18n(this.i18n),this.svgMarkup=this.chart.hasNoData()?"":this.chart.toString(),this.syncWarnings(this.chart.getWarnings())}syncWarnings(t){if(void 0===this.errors)return;const i=new Map(t.map((t=>[t.code,t.data])));for(const t of N){const s=`WARN_${t}`;if(i.has(t)){const h=void 0!==this.translate?this.translate(`.${t}`,i.get(t)):t;this.errors.addOrReplace({id:s,type:"warning",message:h})}else this.errors.remove(s)}}prepareStyle(){return new x(new y,new p,new v(new f),new m(new f),new g).adapt(this.styles)}render(){if(void 0===this.chart)return i(s,null);if(this.chart.hasNoData()){const t=this.i18n.get("no-data")||"==No Data==";return i(s,null,i("p",{class:"warning"},t))}return i(s,null,i("div",{innerHTML:this.svgMarkup}))}get element(){return h(this)}};C.style=':host{position:relative;display:inline-block}.warning{font-family:var(--bn-font-family, "Noto Sans", "Helvetica Neue", Helvetica, sans-serif);color:var(--bn-font-color, black)}';export{C as ibcs_chart_bullet}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as t,h as i,H as s,g as h}from"./p-B_d-jp99.js";import{r as e,m as n,s as o,g as l,b as r}from"./p-BqhIhYr1.js";import{C as a,S as d,F as c,I as u,a as v,b as m,c as b,P as f}from"./p-X6CxL6W-.js";import{X as w,r as p,a as g,b as x,P as y,F as M,c as $,S as L}from"./p-rdqTC0_5.js";import{g as S}from"./p-BWKdb9ym.js";import{N as k}from"./p-DsTzlzxQ.js";import{r as z}from"./p-BZV1b5VH.js";class W{constructor(t,i,s,h,e){this.mode=t,this.vMax=i,this.rMaxPx=s,this.rMinPx=h,this.areaPerUnitPx2=e}static local(t,i,s){return new W("local",t,i,s,0)}static grouped(t){return new W("grouped",0,0,0,t)}radius(t){return"grouped"===this.mode?t<=0?0:Math.sqrt(this.areaPerUnitPx2*t/Math.PI):this.vMax<=0||t<=0?this.rMinPx:Math.max(this.rMinPx,this.rMaxPx*Math.sqrt(t/this.vMax))}}class C{constructor(t,i,s,h,e,n){var o,l,r,a;this.ruleSet=t,this.config=h,this.styles=e,this.availableWidth=n,this.warnings=[],this.canvasHeight=0,this.i18nMap=new Map,this.hatchPatterns=new Set,this.scaleOverflowCount=0,this.svgRoot=null;const d=new w,c=""!==s?i.exec(`SELECT * FROM ${s}`):[],u=(null!=c?c:[]).map((t=>d.adapt(t)));this.data=p(u,{pointLevel:h.pointLevel,seriesLevel:h.seriesLevel,facetLevel:null!==h.facet?"rowgroup"===h.facet.level?"rowGroup":"category":null,measures:{x:null!==(o=z(h.x.measure))&&void 0!==o?o:{kind:"scenario",slot:"ac1"},y:null!==(l=z(h.y.measure))&&void 0!==l?l:{kind:"scenario",slot:"ac2"},size:null!==(r=z(h.size.measure))&&void 0!==r?r:{kind:"scenario",slot:"ac3"},share:null!==h.share&&null!==(a=z(h.share.measure))&&void 0!==a?a:void 0},compareFamily:h.compareFamily,domains:{x:{min:h.x.min,max:h.x.max},y:{min:h.y.min,max:h.y.max}},limit:h.limit,limitBy:"size"}),this.warnings.push(...this.data.warnings)}get em(){return this.styles.fontStyles.size}fontFamily(){return this.styles.fontStyles.font.replace(/^[\d.]+px\s*/,"")}textWidth(t,i=!1){const s=a(t,{font:this.styles.fontStyles.font,fontSize:this.styles.fontStyles.size+"px",fontWeight:i?"bold":"normal"}).width;return Number.isFinite(s)&&s>0?s:.6*t.length*this.em}drawText(t,i,s,h,e={}){var n,o;t.text(i).font({size:this.styles.fontStyles.size,weight:e.bold?"bold":"normal",anchor:null!==(n=e.anchor)&&void 0!==n?n:"start"}).fill(null!==(o=e.color)&&void 0!==o?o:this.styles.fontStyles.color).attr({x:s,y:h,"font-family":this.fontFamily()})}hasNoData(){return 0===this.data.totalPoints}getWarnings(){return this.warnings}getAllocatedCanvasWidth(){return this.availableWidth}getAllocatedCanvasHeight(){return this.canvasHeight}setI18n(t){this.i18nMap=t}addWarningOnce(t,i){this.warnings.some((i=>i.code===t))||this.warnings.push({code:t,data:i})}primaryColorIndex(){const t=z(this.config.size.measure);return null===t||"variance"===t.kind?10:this.ruleSet.getScenarioColorIndex(t.slot)}compareColorIndex(){return this.ruleSet.getScenarioColorIndex(`${this.config.compareFamily}1`)}seriesHue(t){const{color:i,overflowed:s}=e(t,this.styles.seriesColors);return s&&this.addWarningOnce("xy-series-overflow",{}),i}familyDisplayName(t){return this.ruleSet.getScenario(`${t}1`).group}legendModel(){var t,i;const s=[],h=null!==(i=null!==(t=this.config.size.label)&&void 0!==t?t:this.i18nMap.get("legend.size"))&&void 0!==i?i:"";""!==h&&(s.push(h),void 0!==this.config.size.unit&&""!==this.config.size.unit&&s.push(`${this.i18nMap.get("axis.in")||"in"} ${this.config.size.unit}`));const e=this.seriesHue(0),o=[];if(null!==this.config.compareFamily){const t=z(this.config.size.measure),i=null!==t&&"scenario"===t.kind?t.slot.replace(/\d+$/,""):"ac";o.push({label:this.familyDisplayName(this.config.compareFamily),treatment:n(this.compareColorIndex(),e,"bubble")}),o.push({label:this.familyDisplayName(i),treatment:n(this.primaryColorIndex(),e,"bubble")})}const l=this.data.series.map((t=>{var i;return{label:""===t.key?null!==(i=this.ruleSet.getScenario("").name)&&void 0!==i?i:"Series":t.key,treatment:n(this.primaryColorIndex(),this.seriesHue(t.index),"bubble")}}));return{sizeCaption:s,title:this.i18nMap.get("legend.title")||null,compareEntries:o,entries:l}}toString(){const t=new d;return this.draw(t),t.id("drawCanvas"),t.width(this.getAllocatedCanvasWidth()),t.height(this.getAllocatedCanvasHeight()),t.attr("overflow","visible"),t.svg()}axisTitle(t,i){var s;const h=null!==(s=t.label)&&void 0!==s?s:"";return""===h?"":void 0===t.unit||""===t.unit?h:`${h} ${i} ${t.unit}`}draw(t){var i,s,h,e,n,o,l,r,a,d,c;this.warnings=this.data.warnings.slice(),this.hatchPatterns.clear(),this.scaleOverflowCount=0,this.svgRoot=t;const u=this.em,v=this.styles.padding,m=this.i18nMap.get("axis.in")||"in",b=t.group(),f=new g(this.styles),w=this.legendModel(),p=this.config.legend.show&&(w.entries.length>0||w.sizeCaption.length>0),x=p?f.measure(w,this.config.legend.position):{width:0,height:0},y="right"===this.config.legend.position&&p?x.width+u:0,$=""!==this.config.chartTitle?1.6*u:0,L=this.axisTitle(this.config.y,m),S=this.axisTitle(this.config.x,m),z=""!==L?1.4*u:.4*u,C=1.4*u+(""!==S?1.3*u:0);let N,T=3*u,j={x:0,y:0,width:0,height:0},H=[];const D=Math.max(1,this.data.facets.length),F=null===(i=this.config.facet)||void 0===i?void 0:i.columns,P=k.domain(null!==(h=null===(s=this.data.extents)||void 0===s?void 0:s.xMin)&&void 0!==h?h:0,null!==(n=null===(e=this.data.extents)||void 0===e?void 0:e.xMax)&&void 0!==n?n:1,{min:this.config.x.min,max:this.config.x.max}),A=k.domain(null!==(l=null===(o=this.data.extents)||void 0===o?void 0:o.yMin)&&void 0!==l?l:0,null!==(a=null===(r=this.data.extents)||void 0===r?void 0:r.yMax)&&void 0!==a?a:1,{min:this.config.y.min,max:this.config.y.max});for(let t=0;t<2;t++){const t=Math.max(10,this.availableWidth-v.left-v.right-T-y);j={x:v.left+T,y:v.top+$+z,width:t,height:t/this.config.aspect},N=new M(D,F,j,this.styles.scaleFactors.panelGap*u);const i=N.panelRect(0).height,s=Math.max(4,Math.min(8,Math.round(i/(4*u)))),h=new k(A[0],A[1],i,0);H=h.ticks(s);const e=k.tickDecimals(H);T=Math.max(...H.map((t=>this.textWidth(this.formatTick(t,e)))),u)+this.styles.scaleFactors.axisTickLength*u+.4*u}this.canvasHeight=j.y+j.height+C+("bottom"===this.config.legend.position&&p?x.height+u:0)+v.bottom,""!==this.config.chartTitle&&this.drawText(b,this.config.chartTitle,v.left,v.top+u,{bold:!0}),""!==L&&this.drawAxisTitleText(b,this.config.y,m,v.left,j.y-.6*u,"start");const B=this.buildPanels(N,P,A),I=B[0].xScale.ticks(Math.max(3,Math.min(8,Math.round(B[0].rect.width/(7*u))))),_=k.tickDecimals(I),E=k.tickDecimals(H),X=this.config.sizeAreaPerUnit>0?W.grouped(this.config.sizeAreaPerUnit):W.local(null!==(c=null===(d=this.data.extents)||void 0===d?void 0:d.sizeMax)&&void 0!==c?c:0,this.styles.scaleFactors.bubbleMaxRadius*u,this.styles.scaleFactors.bubbleMinRadius*u);0===this.data.facets.length?this.drawPanel(b,B[0],{key:"",points:[]},X,I,H,_,E,!0,!0):this.data.facets.forEach(((t,i)=>{this.drawPanel(b,B[i],t,X,I,H,_,E,N.isOuterLeft(i),N.isOuterBottom(i),this.data.facets.length>1?t.key:"")})),""!==S&&this.drawAxisTitleText(b,this.config.x,m,j.x+j.width,j.y+j.height+2.6*u,"end"),p&&("right"===this.config.legend.position?f.draw(b,w,j.x+j.width+u,j.y,"right"):f.draw(b,w,j.x,j.y+j.height+C,"bottom")),this.scaleOverflowCount>0&&this.addWarningOnce("bubble-scale-overflow",{count:String(this.scaleOverflowCount)}),t.group().addClass("annotations")}drawAxisTitleText(t,i,s,h,e,n){var o;const l=null!==(o=i.label)&&void 0!==o?o:"",r=void 0!==i.unit&&""!==i.unit?`${s} ${i.unit}`:"",a=.3*this.em;"start"===n?(this.drawText(t,l,h,e,{bold:!0}),""!==r&&this.drawText(t,r,h+this.textWidth(l,!0)+a,e,{})):""!==r?(this.drawText(t,r,h,e,{anchor:"end"}),this.drawText(t,l,h-this.textWidth(r)-a,e,{anchor:"end",bold:!0})):this.drawText(t,l,h,e,{anchor:"end",bold:!0})}buildPanels(t,i,s){const h=[];for(let e=0;e<t.count;e++){const n=t.panelRect(e),o=new k(i[0],i[1],n.x,n.x+n.width),l=new k(s[0],s[1],n.y+n.height,n.y);h.push({rect:n,xScale:o,yScale:l,frame:new x(o,l,n,this.styles)})}return h}treatmentFill(t,i,s){return!0!==t.hatch?t.fill:(this.ensureHatchPattern(i,s),`url(#xy-fc-${i})`)}ensureHatchPattern(t,i){this.hatchPatterns.has(t)||null===this.svgRoot||(this.hatchPatterns.add(t),this.svgRoot.defs().pattern(10,10,(t=>{t.rect(10,10).fill("#ffffff"),t.line(0,10,10,0).stroke({color:i,width:2}),t.line(-2.5,2.5,2.5,-2.5).stroke({color:i,width:2}),t.line(7.5,12.5,12.5,7.5).stroke({color:i,width:2})})).id(`xy-fc-${t}`))}drawPanel(t,i,s,h,e,l,r,a,d,c,u=""){var v,m,b,f;const w=t.group(),p=this.em;i.frame.drawBands(w,this.config.x.highlight,this.config.y.highlight),i.frame.drawGrid(w,l,void 0===this.config.x.refLine&&void 0===this.config.y.refLine&&i.rect.width>30*p?e:void 0),i.frame.drawRefLines(w,this.config.x.refLine,this.config.y.refLine),i.frame.drawFrame(w);const g=w.group().id("compare"),x=w.group().id("primary"),M=new y(i.rect,this.styles.scaleFactors.labelToMark*p),$=[...s.points].sort(((t,i)=>{var s,h;return(null!==(s=i.size)&&void 0!==s?s:0)-(null!==(h=t.size)&&void 0!==h?h:0)})),L=[];for(const t of $){const s=null!==(m=null===(v=this.data.series.find((i=>i.key===t.seriesKey)))||void 0===v?void 0:v.index)&&void 0!==m?m:0,e=this.seriesHue(s),l=n(this.primaryColorIndex(),e,"bubble"),r=i.xScale.scale(t.x),a=i.yScale.scale(t.y),d=h.radius(null!==(b=t.size)&&void 0!==b?b:0);if(this.config.sizeAreaPerUnit>0&&this.bubbleExceedsPanel(i.rect,r,a,d)&&this.scaleOverflowCount++,null!=t.compare){const o=n(this.compareColorIndex(),e,"bubble"),l=i.xScale.scale(t.compare.x),r=i.yScale.scale(t.compare.y),a=h.radius(null!==(f=t.compare.size)&&void 0!==f?f:0);this.drawBubble(g,l,r,a,o,s,e),M.registerMark(l,r,a),this.config.labels.values&&void 0!==t.compare.size&&a>=1.2*p&&this.drawValueLabel(g,l,r,a,t.compare.size,o.fill)}this.drawBubble(x,r,a,d,l,s,e),M.registerMark(r,a,d),void 0!==t.share&&d>0&&this.drawShareSlice(x,r,a,d,t.share,o(e)),this.config.labels.values&&void 0!==t.size&&this.drawValueLabel(x,r,a,d,t.size,!0===l.hatch?"#ffffff":l.fill),L.push({point:t,cx:r,cy:a,r:d,seriesIndex:s,hue:e,treatment:l})}this.drawNameLabels(w,M,L),i.frame.drawTickLabels(w,{ticksX:e,ticksY:l,xDecimals:r,yDecimals:a,showXLabels:c,showYLabels:d}),""!==u&&i.frame.drawPanelTitle(w,u)}bubbleExceedsPanel(t,i,s,h){return i-h<t.x||i+h>t.x+t.width||s-h<t.y||s+h>t.y+t.height}drawBubble(t,i,s,h,e,n,o){h<=0||t.circle(2*h).center(i,s).fill(this.treatmentFill(e,n,o)).stroke({color:e.stroke,width:e.strokeWidth})}drawShareSlice(t,i,s,h,e,n){if(e<=0)return;if(e>=1)return void t.circle(2*h).center(i,s).fill(n);const o=2*e*Math.PI,l=i+h*Math.sin(o),r=s-h*Math.cos(o),a=o>Math.PI?1:0;t.path(`M ${i} ${s} L ${i} ${s-h} A ${h} ${h} 0 ${a} 1 ${l} ${r} Z`).fill(n).stroke("none")}drawValueLabel(t,i,s,h,e,n){const o=c.number(e,"decimal",1,1);this.textWidth(o)+.4*this.em>2*h||this.drawText(t,o,i,s+.35*this.em,{anchor:"middle",color:S(n.startsWith("#")?n:"#ffffff")})}drawNameLabels(t,i,s){const h=[...s].sort(((t,i)=>{var s,h;return(null!==(s=i.point.size)&&void 0!==s?s:0)-(null!==(h=t.point.size)&&void 0!==h?h:0)})),{selected:e,unknownNames:n}=i.selectCandidates(h,this.config.labels.points,this.config.labels.max,(t=>t.point.name));n.length>0&&this.addWarningOnce("xy-label-unknown",{names:n.join(", ")});const o=e.map((t=>({name:t.point.name,cx:t.cx,cy:t.cy,r:t.r,width:this.textWidth(t.point.name),height:1.1*this.em})));for(const s of i.place(o))this.drawText(t,s.candidate.name,s.x,s.y+.9*s.candidate.height,{})}formatTick(t,i){return c.number(t,"decimal",i,i)}}const N=["xy-duplicate-point","xy-point-clipped","xy-variance-nodata","xy-label-unknown","xy-series-overflow","xy-point-budget","bubble-size-negative","bubble-share-range","bubble-scale-overflow"],T=class{constructor(i){t(this,i),this.tableName="",this.dataVersion=0,this.chartTitle="",this.share=null,this.compareFamily=null,this.facet=null,this.pointLevel="category",this.seriesLevel=null,this.aspect=16/9,this.limit=0,this.filter="",this.sizeAreaPerUnit=0,this.i18n=new Map,this.containerWidth=0,this.svgMarkup=""}getDb(){return this.stores||(this.stores=l(this.element)),this.stores.db.db}componentWillLoad(){this.rebuild()}componentWillUpdate(){this.rebuild()}rebuild(){const t=this.prepareStyle(),i=this.tableName?r(this.tableName,this.filter):"";this.chart=new C(new u(this.ruleSetConfig),this.getDb(),i,{chartTitle:this.chartTitle,x:this.x,y:this.y,size:this.size,share:this.share,compareFamily:this.compareFamily,labels:this.labels,legend:this.legend,facet:this.facet,pointLevel:this.pointLevel,seriesLevel:this.seriesLevel,aspect:this.aspect,limit:this.limit,sizeAreaPerUnit:this.sizeAreaPerUnit},t,this.containerWidth||0),this.chart.setI18n(this.i18n),this.svgMarkup=this.chart.hasNoData()?"":this.chart.toString(),this.syncWarnings(this.chart.getWarnings())}syncWarnings(t){if(void 0===this.errors)return;const i=new Map(t.map((t=>[t.code,t.data])));for(const t of N){const s=`WARN_${t}`;if(i.has(t)){const h=void 0!==this.translate?this.translate(`.${t}`,i.get(t)):t;this.errors.addOrReplace({id:s,type:"warning",message:h})}else this.errors.remove(s)}}prepareStyle(){return new $(new L,new v,new m(new b),new f).adapt(this.styles)}render(){if(void 0===this.chart)return i(s,null);if(this.chart.hasNoData()){const t=this.i18n.get("no-data")||"==No Data==";return i(s,null,i("p",{class:"warning"},t))}return i(s,null,i("div",{innerHTML:this.svgMarkup}))}get element(){return h(this)}};T.style=':host{position:relative;display:inline-block}.warning{font-family:var(--bn-font-family, "Noto Sans", "Helvetica Neue", Helvetica, sans-serif);color:var(--bn-font-color, black)}';export{T as ibcs_chart_bubble}
|
|
1
|
+
import{r as t,h as i,H as s,g as h}from"./p-B_d-jp99.js";import{r as e,m as n,s as o,g as l,b as r}from"./p-BgIpdpfH.js";import{C as a,S as d,F as c,I as u,a as v,b as m,c as f,P as b}from"./p-DwYUTvvI.js";import{X as w,r as p,a as g,b as x,P as y,F as M,c as $,S as k}from"./p-CYE0I1Mx.js";import{g as S}from"./p-CJThzFZm.js";import{N as L}from"./p-DsTzlzxQ.js";import{r as z}from"./p-eEfqksk-.js";class T{constructor(t,i,s,h,e){this.mode=t,this.vMax=i,this.rMaxPx=s,this.rMinPx=h,this.areaPerUnitPx2=e}static local(t,i,s){return new T("local",t,i,s,0)}static grouped(t){return new T("grouped",0,0,0,t)}radius(t){return"grouped"===this.mode?t<=0?0:Math.sqrt(this.areaPerUnitPx2*t/Math.PI):this.vMax<=0||t<=0?this.rMinPx:Math.max(this.rMinPx,this.rMaxPx*Math.sqrt(t/this.vMax))}}class C{constructor(t,i,s,h,e,n){var o,l,r,a;this.ruleSet=t,this.config=h,this.styles=e,this.availableWidth=n,this.warnings=[],this.canvasHeight=0,this.i18nMap=new Map,this.hatchPatterns=new Set,this.scaleOverflowCount=0,this.svgRoot=null;const d=new w,c=""!==s?i.exec(`SELECT * FROM ${s}`):[],u=(null!=c?c:[]).map((t=>d.adapt(t)));this.data=p(u,{pointLevel:h.pointLevel,seriesLevel:h.seriesLevel,facetLevel:null!==h.facet?"rowgroup"===h.facet.level?"rowGroup":"category":null,measures:{x:null!==(o=z(h.x.measure))&&void 0!==o?o:{kind:"scenario",slot:"ac1"},y:null!==(l=z(h.y.measure))&&void 0!==l?l:{kind:"scenario",slot:"ac2"},size:null!==(r=z(h.size.measure))&&void 0!==r?r:{kind:"scenario",slot:"ac3"},share:null!==h.share&&null!==(a=z(h.share.measure))&&void 0!==a?a:void 0},compareFamily:h.compareFamily,domains:{x:{min:h.x.min,max:h.x.max},y:{min:h.y.min,max:h.y.max}},limit:h.limit,limitBy:"size"}),this.warnings.push(...this.data.warnings)}get em(){return this.styles.fontStyles.size}fontFamily(){return this.styles.fontStyles.font.replace(/^[\d.]+px\s*/,"")}textWidth(t,i=!1){const s=a(t,{font:this.styles.fontStyles.font,fontSize:this.styles.fontStyles.size+"px",fontWeight:i?"bold":"normal"}).width;return Number.isFinite(s)&&s>0?s:.6*t.length*this.em}drawText(t,i,s,h,e={}){var n,o;t.text(i).font({size:this.styles.fontStyles.size,weight:e.bold?"bold":"normal",anchor:null!==(n=e.anchor)&&void 0!==n?n:"start"}).fill(null!==(o=e.color)&&void 0!==o?o:this.styles.fontStyles.color).attr({x:s,y:h,"font-family":this.fontFamily()})}hasNoData(){return 0===this.data.totalPoints}getWarnings(){return this.warnings}getAllocatedCanvasWidth(){return this.availableWidth}getAllocatedCanvasHeight(){return this.canvasHeight}setI18n(t){this.i18nMap=t}addWarningOnce(t,i){this.warnings.some((i=>i.code===t))||this.warnings.push({code:t,data:i})}primaryColorIndex(){const t=z(this.config.size.measure);return null===t||"variance"===t.kind?10:this.ruleSet.getScenarioColorIndex(t.slot)}compareColorIndex(){return this.ruleSet.getScenarioColorIndex(`${this.config.compareFamily}1`)}seriesHue(t){const{color:i,overflowed:s}=e(t,this.styles.seriesColors);return s&&this.addWarningOnce("xy-series-overflow",{}),i}familyDisplayName(t){return this.ruleSet.getScenario(`${t}1`).group}legendModel(){var t,i;const s=[],h=null!==(i=null!==(t=this.config.size.label)&&void 0!==t?t:this.i18nMap.get("legend.size"))&&void 0!==i?i:"";""!==h&&(s.push(h),void 0!==this.config.size.unit&&""!==this.config.size.unit&&s.push(`${this.i18nMap.get("axis.in")||"in"} ${this.config.size.unit}`));const e=this.seriesHue(0),o=[];if(null!==this.config.compareFamily){const t=z(this.config.size.measure),i=null!==t&&"scenario"===t.kind?t.slot.replace(/\d+$/,""):"ac";o.push({label:this.familyDisplayName(this.config.compareFamily),treatment:n(this.compareColorIndex(),e,"bubble")}),o.push({label:this.familyDisplayName(i),treatment:n(this.primaryColorIndex(),e,"bubble")})}const l=this.data.series.map((t=>{var i;return{label:""===t.key?null!==(i=this.ruleSet.getScenario("").name)&&void 0!==i?i:"Series":t.key,treatment:n(this.primaryColorIndex(),this.seriesHue(t.index),"bubble")}}));return{sizeCaption:s,title:this.i18nMap.get("legend.title")||null,compareEntries:o,entries:l}}toString(){const t=new d;return this.draw(t),t.id("drawCanvas"),t.width(this.getAllocatedCanvasWidth()),t.height(this.getAllocatedCanvasHeight()),t.attr("overflow","visible"),t.svg()}axisTitle(t,i){var s;const h=null!==(s=t.label)&&void 0!==s?s:"";return""===h?"":void 0===t.unit||""===t.unit?h:`${h} ${i} ${t.unit}`}draw(t){var i,s,h,e,n,o,l,r,a,d,c;this.warnings=this.data.warnings.slice(),this.hatchPatterns.clear(),this.scaleOverflowCount=0,this.svgRoot=t;const u=this.em,v=this.styles.padding,m=this.i18nMap.get("axis.in")||"in",f=t.group(),b=new g(this.styles),w=this.legendModel(),p=this.config.legend.show&&(w.entries.length>0||w.sizeCaption.length>0),x=p?b.measure(w,this.config.legend.position):{width:0,height:0},y="right"===this.config.legend.position&&p?x.width+u:0,$=""!==this.config.chartTitle?1.6*u:0,k=this.axisTitle(this.config.y,m),S=this.axisTitle(this.config.x,m),z=""!==k?1.4*u:.4*u,C=1.4*u+(""!==S?1.3*u:0);let N,W=3*u,j={x:0,y:0,width:0,height:0},D=[];const F=Math.max(1,this.data.facets.length),H=null===(i=this.config.facet)||void 0===i?void 0:i.columns,I=L.domain(null!==(h=null===(s=this.data.extents)||void 0===s?void 0:s.xMin)&&void 0!==h?h:0,null!==(n=null===(e=this.data.extents)||void 0===e?void 0:e.xMax)&&void 0!==n?n:1,{min:this.config.x.min,max:this.config.x.max}),P=L.domain(null!==(l=null===(o=this.data.extents)||void 0===o?void 0:o.yMin)&&void 0!==l?l:0,null!==(a=null===(r=this.data.extents)||void 0===r?void 0:r.yMax)&&void 0!==a?a:1,{min:this.config.y.min,max:this.config.y.max});for(let t=0;t<2;t++){const t=Math.max(10,this.availableWidth-v.left-v.right-W-y);j={x:v.left+W,y:v.top+$+z,width:t,height:t/this.config.aspect},N=new M(F,H,j,this.styles.scaleFactors.panelGap*u);const i=N.panelRect(0).height,s=Math.max(4,Math.min(8,Math.round(i/(4*u)))),h=new L(P[0],P[1],i,0);D=h.ticks(s);const e=L.tickDecimals(D);W=Math.max(...D.map((t=>this.textWidth(this.formatTick(t,e)))),u)+this.styles.scaleFactors.axisTickLength*u+.4*u}this.canvasHeight=j.y+j.height+C+("bottom"===this.config.legend.position&&p?x.height+u:0)+v.bottom,""!==this.config.chartTitle&&this.drawText(f,this.config.chartTitle,v.left,v.top+u,{bold:!0}),""!==k&&this.drawAxisTitleText(f,this.config.y,m,v.left,j.y-.6*u,"start");const A=this.buildPanels(N,I,P),E=A[0].xScale.ticks(Math.max(3,Math.min(8,Math.round(A[0].rect.width/(7*u))))),B=L.tickDecimals(E),Y=L.tickDecimals(D),_=this.config.sizeAreaPerUnit>0?T.grouped(this.config.sizeAreaPerUnit):T.local(null!==(c=null===(d=this.data.extents)||void 0===d?void 0:d.sizeMax)&&void 0!==c?c:0,this.styles.scaleFactors.bubbleMaxRadius*u,this.styles.scaleFactors.bubbleMinRadius*u);0===this.data.facets.length?this.drawPanel(f,A[0],{key:"",points:[]},_,E,D,B,Y,!0,!0):this.data.facets.forEach(((t,i)=>{this.drawPanel(f,A[i],t,_,E,D,B,Y,N.isOuterLeft(i),N.isOuterBottom(i),this.data.facets.length>1?t.key:"")})),""!==S&&this.drawAxisTitleText(f,this.config.x,m,j.x+j.width,j.y+j.height+2.6*u,"end"),p&&("right"===this.config.legend.position?b.draw(f,w,j.x+j.width+u,j.y,"right"):b.draw(f,w,j.x,j.y+j.height+C,"bottom")),this.scaleOverflowCount>0&&this.addWarningOnce("bubble-scale-overflow",{count:String(this.scaleOverflowCount)}),t.group().addClass("annotations")}drawAxisTitleText(t,i,s,h,e,n){var o;const l=null!==(o=i.label)&&void 0!==o?o:"",r=void 0!==i.unit&&""!==i.unit?`${s} ${i.unit}`:"",a=.3*this.em;"start"===n?(this.drawText(t,l,h,e,{bold:!0}),""!==r&&this.drawText(t,r,h+this.textWidth(l,!0)+a,e,{})):""!==r?(this.drawText(t,r,h,e,{anchor:"end"}),this.drawText(t,l,h-this.textWidth(r)-a,e,{anchor:"end",bold:!0})):this.drawText(t,l,h,e,{anchor:"end",bold:!0})}buildPanels(t,i,s){const h=[];for(let e=0;e<t.count;e++){const n=t.panelRect(e),o=new L(i[0],i[1],n.x,n.x+n.width),l=new L(s[0],s[1],n.y+n.height,n.y);h.push({rect:n,xScale:o,yScale:l,frame:new x(o,l,n,this.styles)})}return h}treatmentFill(t,i,s){return!0!==t.hatch?t.fill:(this.ensureHatchPattern(i,s),`url(#xy-fc-${i})`)}ensureHatchPattern(t,i){this.hatchPatterns.has(t)||null===this.svgRoot||(this.hatchPatterns.add(t),this.svgRoot.defs().pattern(10,10,(t=>{t.rect(10,10).fill("#ffffff"),t.line(0,10,10,0).stroke({color:i,width:2}),t.line(-2.5,2.5,2.5,-2.5).stroke({color:i,width:2}),t.line(7.5,12.5,12.5,7.5).stroke({color:i,width:2})})).id(`xy-fc-${t}`))}drawPanel(t,i,s,h,e,l,r,a,d,c,u=""){var v,m,f,b;const w=t.group(),p=this.em;i.frame.drawBands(w,this.config.x.highlight,this.config.y.highlight),i.frame.drawGrid(w,l,void 0===this.config.x.refLine&&void 0===this.config.y.refLine&&i.rect.width>30*p?e:void 0),i.frame.drawRefLines(w,this.config.x.refLine,this.config.y.refLine),i.frame.drawFrame(w);const g=w.group().id("compare"),x=w.group().id("primary"),M=new y(i.rect,this.styles.scaleFactors.labelToMark*p),$=[...s.points].sort(((t,i)=>{var s,h;return(null!==(s=i.size)&&void 0!==s?s:0)-(null!==(h=t.size)&&void 0!==h?h:0)})),k=[];for(const t of $){const s=null!==(m=null===(v=this.data.series.find((i=>i.key===t.seriesKey)))||void 0===v?void 0:v.index)&&void 0!==m?m:0,e=this.seriesHue(s),l=n(this.primaryColorIndex(),e,"bubble"),r=i.xScale.scale(t.x),a=i.yScale.scale(t.y),d=h.radius(null!==(f=t.size)&&void 0!==f?f:0);if(this.config.sizeAreaPerUnit>0&&this.bubbleExceedsPanel(i.rect,r,a,d)&&this.scaleOverflowCount++,null!=t.compare){const o=n(this.compareColorIndex(),e,"bubble"),l=i.xScale.scale(t.compare.x),r=i.yScale.scale(t.compare.y),a=h.radius(null!==(b=t.compare.size)&&void 0!==b?b:0);this.drawBubble(g,l,r,a,o,s,e),M.registerMark(l,r,a),this.config.labels.values&&void 0!==t.compare.size&&a>=1.2*p&&this.drawValueLabel(g,l,r,a,t.compare.size,o.fill)}this.drawBubble(x,r,a,d,l,s,e),M.registerMark(r,a,d),void 0!==t.share&&d>0&&this.drawShareSlice(x,r,a,d,t.share,o(e)),this.config.labels.values&&void 0!==t.size&&this.drawValueLabel(x,r,a,d,t.size,!0===l.hatch?"#ffffff":l.fill),k.push({point:t,cx:r,cy:a,r:d,seriesIndex:s,hue:e,treatment:l})}this.drawNameLabels(w,M,k),i.frame.drawTickLabels(w,{ticksX:e,ticksY:l,xDecimals:r,yDecimals:a,showXLabels:c,showYLabels:d}),""!==u&&i.frame.drawPanelTitle(w,u)}bubbleExceedsPanel(t,i,s,h){return i-h<t.x||i+h>t.x+t.width||s-h<t.y||s+h>t.y+t.height}drawBubble(t,i,s,h,e,n,o){h<=0||t.circle(2*h).center(i,s).fill(this.treatmentFill(e,n,o)).stroke({color:e.stroke,width:e.strokeWidth})}drawShareSlice(t,i,s,h,e,n){if(e<=0)return;if(e>=1)return void t.circle(2*h).center(i,s).fill(n);const o=2*e*Math.PI,l=i+h*Math.sin(o),r=s-h*Math.cos(o),a=o>Math.PI?1:0;t.path(`M ${i} ${s} L ${i} ${s-h} A ${h} ${h} 0 ${a} 1 ${l} ${r} Z`).fill(n).stroke("none")}drawValueLabel(t,i,s,h,e,n){const o=c.number(e,"decimal",1,1);this.textWidth(o)+.4*this.em>2*h||this.drawText(t,o,i,s+.35*this.em,{anchor:"middle",color:S(n.startsWith("#")?n:"#ffffff")})}drawNameLabels(t,i,s){const h=[...s].sort(((t,i)=>{var s,h;return(null!==(s=i.point.size)&&void 0!==s?s:0)-(null!==(h=t.point.size)&&void 0!==h?h:0)})),{selected:e,unknownNames:n}=i.selectCandidates(h,this.config.labels.points,this.config.labels.max,(t=>t.point.name));n.length>0&&this.addWarningOnce("xy-label-unknown",{names:n.join(", ")});const o=e.map((t=>({name:t.point.name,cx:t.cx,cy:t.cy,r:t.r,width:this.textWidth(t.point.name),height:1.1*this.em})));for(const s of i.place(o))this.drawText(t,s.candidate.name,s.x,s.y+.9*s.candidate.height,{})}formatTick(t,i){return c.number(t,"decimal",i,i)}}const N=["xy-duplicate-point","xy-point-clipped","xy-variance-nodata","xy-label-unknown","xy-series-overflow","xy-point-budget","bubble-size-negative","bubble-share-range","bubble-scale-overflow"],W=class{constructor(i){t(this,i),this.tableName="",this.dataVersion=0,this.chartTitle="",this.share=null,this.compareFamily=null,this.facet=null,this.pointLevel="category",this.seriesLevel=null,this.aspect=16/9,this.limit=0,this.filter="",this.sizeAreaPerUnit=0,this.i18n=new Map,this.containerWidth=0,this.svgMarkup=""}getDb(){return this.stores||(this.stores=l(this.element)),this.stores.db.db}componentWillLoad(){this.rebuild()}componentWillUpdate(){this.rebuild()}rebuild(){const t=this.prepareStyle(),i=this.tableName?r(this.tableName,this.filter):"";this.chart=new C(new u(this.ruleSetConfig),this.getDb(),i,{chartTitle:this.chartTitle,x:this.x,y:this.y,size:this.size,share:this.share,compareFamily:this.compareFamily,labels:this.labels,legend:this.legend,facet:this.facet,pointLevel:this.pointLevel,seriesLevel:this.seriesLevel,aspect:this.aspect,limit:this.limit,sizeAreaPerUnit:this.sizeAreaPerUnit},t,this.containerWidth||0),this.chart.setI18n(this.i18n),this.svgMarkup=this.chart.hasNoData()?"":this.chart.toString(),this.syncWarnings(this.chart.getWarnings())}syncWarnings(t){if(void 0===this.errors)return;const i=new Map(t.map((t=>[t.code,t.data])));for(const t of N){const s=`WARN_${t}`;if(i.has(t)){const h=void 0!==this.translate?this.translate(`.${t}`,i.get(t)):t;this.errors.addOrReplace({id:s,type:"warning",message:h})}else this.errors.remove(s)}}prepareStyle(){return new $(new k,new v,new m(new f),new b).adapt(this.styles)}render(){if(void 0===this.chart)return i(s,null);if(this.chart.hasNoData()){const t=this.i18n.get("no-data")||"==No Data==";return i(s,null,i("p",{class:"warning"},t))}return i(s,null,i("div",{innerHTML:this.svgMarkup}))}get element(){return h(this)}};W.style=':host{position:relative;display:inline-block}.warning{font-family:var(--bn-font-family, "Noto Sans", "Helvetica Neue", Helvetica, sans-serif);color:var(--bn-font-color, black)}';export{W as ibcs_chart_bubble}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as t,d as i,f as e,h as s,H as r,g as a}from"./p-B_d-jp99.js";import{a as n}from"./p-BqhIhYr1.js";import{C as l,r as o,A as u}from"./p-BZV1b5VH.js";import{w as h,o as d}from"./p-DTuaq8Pj.js";import{O as c,a as p,b as v}from"./p-Bdfxd_Ke.js";import{w as g,a as m,g as f,p as b}from"./p-DY7YYmpa.js";import{v as _,i as y,d as w,a as O,w as R,b as A}from"./p-C0Pwqx-O.js";import{w as $,a as E}from"./p-B4JfKvVT.js";import{p as j}from"./p-Dg9OcXAO.js";const T=["measure","label","unit"];function x(t){const i=[],e=D(t,"measure",i);if(void 0===e||""===e.trim())return i.push("measure"),{config:null,unknownKeys:k(t,T),invalidFields:i};const s={measure:e.trim()};return s.label=D(t,"label",i),s.unit=D(t,"unit",i),{config:s,unknownKeys:k(t,T),invalidFields:i}}const N=["show","decimals"];function S(t,i){const e=[],s={show:i.show,decimals:i.decimals};return l.isExisting(t.show)&&("auto"===t.show||"none"===t.show?s.show=t.show:e.push("show")),l.isExisting(t.decimals)&&(l.isNumber(t.decimals)&&t.decimals>=0&&t.decimals<=4?s.decimals=Math.floor(t.decimals):e.push("decimals")),{config:s,unknownKeys:k(t,N),invalidFields:e}}function U(t){var i;const e=null!==(i=null==t?void 0:t.trim())&&void 0!==i?i:"";if(""===e||"null"===e)return{ranges:[],parseError:!1,issues:[]};let s;try{s=JSON.parse(e)}catch(t){return{ranges:[],parseError:!0,issues:[]}}if(!Array.isArray(s)||0===s.length)return{ranges:[],parseError:!0,issues:[]};if(!s.every((t=>l.isNumber(t)&&isFinite(t)&&t>0)))return{ranges:[],parseError:!0,issues:[]};const r=[];let a=s;const n=[...a].sort(((t,i)=>t-i));return n.some(((t,i)=>t!==a[i]))&&r.push("not ascending, sorted"),a=n,a.length>2&&(r.push(`${a.length} entries, first 2 kept`),a=a.slice(0,2)),{ranges:a,parseError:!1,issues:r}}function k(t,i){return Object.keys(t).filter((t=>!i.includes(t)))}function D(t,i,e){if(l.isExisting(t[i]))return l.isString(t[i])?t[i]:void e.push(i)}const L=["pl1","pp1","fc1"],W=class{validateActual(t){this.validateMeasureSpec("actual",t)}validateTarget(t){this.validateMeasureSpec("target",t)}validateRanges(t){const i="ERR_bullet_json_ranges",e="WARN_bullet_ranges",s=U(t);if(s.parseError)return this.setBlockingError(i,this.t(".bullet-prop-json",{prop:"ranges"})),void this.errors.remove(e);this.setBlockingError(i,null),s.issues.length>0?this.errors.addOrReplace({id:e,type:"warning",message:this.t(".bullet-ranges-invalid",{detail:s.issues.join("; ")})}):this.errors.remove(e)}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 i="ERR_order",e=_(t).filter((t=>""!==t));0===e.length?this.errors.remove(i):this.errors.addOrReplace({id:i,type:"warning",message:`order: invalid value(s) '${e.join(", ")}'; using the dataset order.`})}validateOrderDirection(t){const i="ERR_orderDirection";y(t)||w(t)?this.errors.remove(i):this.errors.addOrReplace({id:i,type:"warning",message:`order-direction: invalid value '${t}' — expected asc/desc; using asc.`})}validateLimit(t){const i="ERR_limit";O(t)&&Number(t)>=0?this.errors.remove(i):this.errors.addOrReplace({id:i,type:"warning",message:`limit: invalid value '${t}' — expected a non-negative integer; using 0.`})}validateLabels(t){const i="ERR_bullet_json_labels",e="WARN_bullet_fields_labels",{data:s,parseError:r}=j(t,null);if(r)return this.setBlockingError(i,this.t(".bullet-prop-json",{prop:"labels"})),void this.errors.remove(e);this.setBlockingError(i,null),null!==s?this.reportSpecIssues(e,"labels",S(s,this.labelDefaults())):this.errors.remove(e)}validateScale(t){const i="ERR_scale";if(y(t))return void this.errors.remove(i);const{mode:e,factor:s}=b(t);"factor"===e&&(void 0===s||s<=0)?this.errors.addOrReplace({id:i,type:"warning",message:`scale: invalid value '${t}' — expected none/auto or a positive number.`}):this.errors.remove(i)}constructor(i){t(this,i),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,i)=>this.t(t,i),R(this),$(this),g(this,(t=>{this.datasetName=(null==t?void 0:t.startsWith("$"))?t.substring(1):t||"",this.dataVersion=this.dataVersion+1}),((t,i)=>{this.datasetMeta=i})),this.errors=E(this),this.componentStyle=A(this),this.ruleSetConfig=h(this),this.t=m(this).t}componentWillLoad(){this.validateActual(this.actual),this.validateTarget(this.target),this.validateRanges(this.ranges),this.validateNormalize(this.normalize),this.validateVariances(this.variances),this.validateLevel(this.level),this.validateOrder(this.order),this.validateOrderDirection(this.orderDirection),this.validateLimit(this.limit),this.validateLabels(this.labels),this.validateScale(this.scale)}componentDidRender(){const{mode:t}=b(this.scale);if("auto"!==t&&"empty"!==t)return void(this._autoScaleGuard=!1);if(this._autoScaleGuard)return void(this._autoScaleGuard=!1);const e=this.element,{height:s}=f(e);if(s<=0)return;this._lastScaledParentHeight=s;const r=this.componentStyle((t=>{var i;return(null===(i=t.global)||void 0===i?void 0:i.fontSizePx)||13.3333})),a=e.scrollHeight,n=this.appliedScaleFactor;if(a<=s+1)return void this.errors.remove("AUTO_scale");const l=Math.max(.3,n*(s-1)/a);Math.abs(l-n)<.01||(e.style.setProperty("--bn-font-size",r*l+"px"),"empty"===t?this.errors.addOrReplace({id:"AUTO_scale",type:"warning",message:`Auto-scaled chart by factor ${l.toFixed(3)}`}):this.errors.remove("AUTO_scale"),this._autoScaleGuard=!0,i((()=>{this.appliedScaleFactor=l})))}componentDidLoad(){this.layoutObserver=d(this.element,(()=>{if(this._autoScaleGuard)return;const{height:t}=f(this.element);t>0&&Math.abs(t-this._lastScaledParentHeight)>2&&(this._lastScaledParentHeight=t,e(this))})),requestAnimationFrame((()=>{requestAnimationFrame((()=>{if(this._autoScaleGuard)return;const{height:t}=f(this.element);this._lastScaledParentHeight=t,e(this)}))}))}disconnectedCallback(){var t;null===(t=this.layoutObserver)||void 0===t||t.disconnect(),this.layoutObserver=null}labelDefaults(){return{show:"auto",decimals:1}}setBlockingError(t,i){null===i?(this.errors.remove(t),this.activeErrors.delete(t)):(this.errors.addOrReplace({id:t,type:"error",message:i}),this.activeErrors.add(t))}hasBlockingErrors(){return this.activeErrors.size>0}validateMeasureSpec(t,i){var e;const s=`ERR_bullet_json_${t}`,r=`ERR_bullet_measure_${t}`,a=`WARN_bullet_fields_${t}`,{data:n,parseError:l}=j(i,"measure");if(l)return this.setBlockingError(s,this.t(".bullet-prop-json",{prop:t})),this.setBlockingError(r,null),void this.errors.remove(a);if(this.setBlockingError(s,null),null===n)return this.setBlockingError(r,null),void this.errors.remove(a);const u=(null!==(e=n.measure)&&void 0!==e?e:"").trim(),h=o(u);"auto"===u.toLowerCase()||null!==h&&"scenario"===h.kind?this.setBlockingError(r,null):this.setBlockingError(r,this.t(".bullet-measure-invalid",{prop:t,measure:u})),this.reportSpecIssues(a,t,x(n))}validateEnum(t,i,e,s,r){y(e)||s.includes(e.trim().toLowerCase())?this.errors.remove(i):this.errors.addOrReplace({id:i,type:"warning",message:`${t}: invalid value '${e}' — expected ${s.join("/")}; using '${r}'.`})}reportSpecIssues(t,i,e){const s=[];null!==e&&e.invalidFields.length>0&&s.push(`invalid: ${e.invalidFields.join(", ")}`),null!==e&&e.unknownKeys.length>0&&s.push(`unknown: ${e.unknownKeys.join(", ")}`),s.length>0?this.errors.addOrReplace({id:t,type:"warning",message:`${i}: ignored sub-fields (${s.join("; ")}).`}):this.errors.remove(t)}prepareActual(){var t,i,e,s,r;const{data:a,parseError:n}=j(this.actual,"measure");if(n)return null;const l=null!==a?x(a).config:null;if(null===l||"auto"===l.measure.toLowerCase()){const r=null!==l,a=null!==(i=null===(t=this.datasetMeta)||void 0===t?void 0:t.availableScenarios)&&void 0!==i?i:[],n=null!==(s=a.includes("ac1")?"ac1":null!==(e=a.find((t=>t.startsWith("ac"))))&&void 0!==e?e:a[0])&&void 0!==s?s:"ac1";return r||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===(r=o(l.measure))||void 0===r?void 0:r.kind)?l:null}prepareTarget(){var t,i,e;const{data:s,parseError:r}=j(this.target,"measure");if(r)return null;const a=null!==s?x(s).config:null;if(null===a||"auto"===a.measure.toLowerCase()){const e=null!==a,s=null!==(i=null===(t=this.datasetMeta)||void 0===t?void 0:t.availableScenarios)&&void 0!==i?i:[],r=L.find((t=>s.includes(t)));return void 0===r?(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"),e||null===this.datasetMeta?this.errors.remove("AUTO_target"):this.errors.addOrReplace({id:"AUTO_target",type:"warning",message:`target: not set, auto-detected: ${r}`}),null===a?{measure:r}:Object.assign(Object.assign({},a),{measure:r}))}return this.errors.remove("AUTO_target"),this.errors.remove("WARN_bullet_target_unavailable"),"scenario"===(null===(e=o(a.measure))||void 0===e?void 0:e.kind)?a: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,i;const e=null===(t=this.level)||void 0===t?void 0:t.trim().toLowerCase();if("rowgroup"===e)return u.ROWGROUP;if("category"===e)return u.CATEGORY;if("subcategory"===e)return u.SUBCATEGORY;const s=null===(i=this.datasetMeta)||void 0===i?void 0:i.suggestedLevel;if(void 0!==s&&""!==s){const t=u[s.toUpperCase()];if(void 0!==t)return t}return u.CATEGORY}prepareOrder(){var t,i,e,s;const r="auto"===(null===(t=this.order)||void 0===t?void 0:t.trim().toLowerCase());let a;y(this.order)||r?(null===(i=this.datasetMeta)||void 0===i?void 0:i.suggestedOrder)?(r?this.errors.remove("AUTO_order"):this.errors.addOrReplace({id:"AUTO_order",type:"warning",message:`order: not set, auto-detected: ${this.datasetMeta.suggestedOrder}`}),a=this.datasetMeta.suggestedOrder):(this.errors.remove("AUTO_order"),a=""):(this.errors.remove("AUTO_order"),a=this.order);const n=null!==(s=c[null===(e=this.orderDirection)||void 0===e?void 0:e.toUpperCase()])&&void 0!==s?s:c.ASC;if(y(a))return new p([v.CATEGORYINDEX],n);const l=a.split(",").map((t=>v[t.trim().toUpperCase()])).filter((t=>void 0!==t));return new p(l.length>0?l:[v.CATEGORYINDEX],n)}prepareLabels(){const t=this.labelDefaults(),{data:i,parseError:e}=j(this.labels,null);return e||null===i?{show:t.show,decimals:t.decimals}:S(i,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))]))),i=new Map(n.map((t=>[t,this.t("global.".concat(t))])));return new Map([...i.entries(),...t.entries()])}prepareStyle(){const t=this.getEffectiveScaleFactor();return this.componentStyle((i=>{const e=i.global.fontSizePx*t;return{scaleFactors:i["bn-chart-bullet"].scaleFactors,fontStyles:{font:`${e}px ${i.global.fontFamily}`,size:e,color:i.global.fontColor,background:i.global.fontBackgroundColor,leading:1.8},axisStyles:i["bn-chart-bullet"].axisStyles,barStyles:i["bn-chart-bullet"].barStyles,varianceStyles:i["bn-chart-bullet"].varianceStyles,rangeColors:i["bn-chart-bullet"].rangeColors,padding:i["bn-chart-bullet"].padding}}))}getEffectiveScaleFactor(){const{mode:t,factor:i}=b(this.scale);return"factor"===t?i:"auto"===t||"empty"===t?this.appliedScaleFactor:1}getFontStyles(){const t=this.getEffectiveScaleFactor();return this.componentStyle((i=>{var e,s,r,a;const n=(null===(e=i.global)||void 0===e?void 0:e.fontSizePx)||13.3333;return{"--bn-font-family":(null===(s=i.global)||void 0===s?void 0:s.fontFamily)||"'Noto Sans', sans-serif","--bn-font-size":n*t+"px","--bn-font-color":(null===(r=i.global)||void 0===r?void 0:r.fontColor)||"#000000","--bn-font-background":(null===(a=i.global)||void 0===a?void 0:a.fontBackgroundColor)||"#ffffff"}}))}getDataStructure(){const t={};for(const i of["ac","pp","fc","pl"])for(const e of[1,2,3,4])t[`${i}${e}`]={type:"number",isOptional:!0,description:""};const i={actual:this.prepareActual(),target:this.prepareTarget()};for(const[e,s]of Object.entries(i))null!==s&&void 0!==t[s.measure]&&(t[s.measure].description=`${e}: ${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(),i=this.prepareTarget(),e=U(this.ranges).ranges,r=this.prepareNormalize();return this.setBlockingError("ERR_bullet_measure_same",null!==t&&null!==i&&t.measure===i.measure?this.t(".bullet-measure-same",{measure:t.measure}):null),e.length>0&&"target"===r?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:s("ibcs-chart-bullet",{tableName:this.datasetName,dataVersion:this.dataVersion,chartTitle:this.chartTitle,actual:t,target:i,ranges:e,normalize:r,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 s(r,{key:"9fd8c656471de9582652769edf49b80756575830",style:this.getFontStyles()},s("div",{key:"a6fe8d33dde8912a77a86244db092bb364c1aeaa",class:"container"},this.chartTemplate()))}get element(){return a(this)}static get watchers(){return{actual:[{validateActual:0}],target:[{validateTarget:0}],ranges:[{validateRanges:0}],normalize:[{validateNormalize:0}],variances:[{validateVariances:0}],level:[{validateLevel:0}],order:[{validateOrder:0}],orderDirection:[{validateOrderDirection:0}],limit:[{validateLimit:0}],labels:[{validateLabels:0}],scale:[{validateScale:0}]}}};W.style=":host{display:inline-block;position:relative;overflow:hidden}.container{display:flex;flex-direction:column}";export{W as bn_chart_bullet}
|
|
1
|
+
import{r as t,d as i,f as e,h as s,H as r,g as a}from"./p-B_d-jp99.js";import{a as n}from"./p-BgIpdpfH.js";import{C as l,r as o,A as u}from"./p-eEfqksk-.js";import{w as h,o as d}from"./p-A8xyE4b1.js";import{O as c,a as p,b as v}from"./p-C5uvAEKI.js";import{w as g,a as m,g as f,p as b}from"./p-C9i1Xsib.js";import{v as _,i as y,d as w,a as O,w as R,b as A}from"./p-BpWWgN6k.js";import{w as E,a as $}from"./p-B4JfKvVT.js";import{p as j}from"./p-6lOdN-fB.js";const T=["measure","label","unit"];function N(t){const i=[],e=W(t,"measure",i);if(void 0===e||""===e.trim())return i.push("measure"),{config:null,unknownKeys:U(t,T),invalidFields:i};const s={measure:e.trim()};return s.label=W(t,"label",i),s.unit=W(t,"unit",i),{config:s,unknownKeys:U(t,T),invalidFields:i}}const S=["show","decimals"];function k(t,i){const e=[],s={show:i.show,decimals:i.decimals};return l.isExisting(t.show)&&("auto"===t.show||"none"===t.show?s.show=t.show:e.push("show")),l.isExisting(t.decimals)&&(l.isNumber(t.decimals)&&t.decimals>=0&&t.decimals<=4?s.decimals=Math.floor(t.decimals):e.push("decimals")),{config:s,unknownKeys:U(t,S),invalidFields:e}}function x(t){var i;const e=null!==(i=null==t?void 0:t.trim())&&void 0!==i?i:"";if(""===e||"null"===e)return{ranges:[],parseError:!1,issues:[]};let s;try{s=JSON.parse(e)}catch(t){return{ranges:[],parseError:!0,issues:[]}}if(!Array.isArray(s)||0===s.length)return{ranges:[],parseError:!0,issues:[]};if(!s.every((t=>l.isNumber(t)&&isFinite(t)&&t>0)))return{ranges:[],parseError:!0,issues:[]};const r=[];let a=s;const n=[...a].sort(((t,i)=>t-i));return n.some(((t,i)=>t!==a[i]))&&r.push("not ascending, sorted"),a=n,a.length>2&&(r.push(`${a.length} entries, first 2 kept`),a=a.slice(0,2)),{ranges:a,parseError:!1,issues:r}}function U(t,i){return Object.keys(t).filter((t=>!i.includes(t)))}function W(t,i,e){if(l.isExisting(t[i]))return l.isString(t[i])?t[i]:void e.push(i)}const L=["pl1","pp1","fc1"],z=class{validateActual(t){this.validateMeasureSpec("actual",t)}validateTarget(t){this.validateMeasureSpec("target",t)}validateRanges(t){const i="ERR_bullet_json_ranges",e="WARN_bullet_ranges",s=x(t);if(s.parseError)return this.setBlockingError(i,this.t(".bullet-prop-json",{prop:"ranges"})),void this.errors.remove(e);this.setBlockingError(i,null),s.issues.length>0?this.errors.addOrReplace({id:e,type:"warning",message:this.t(".bullet-ranges-invalid",{detail:s.issues.join("; ")})}):this.errors.remove(e)}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 i="ERR_order",e=_(t).filter((t=>""!==t));0===e.length?this.errors.remove(i):this.errors.addOrReplace({id:i,type:"warning",message:`order: invalid value(s) '${e.join(", ")}'; using the dataset order.`})}validateOrderDirection(t){const i="ERR_orderDirection";y(t)||w(t)?this.errors.remove(i):this.errors.addOrReplace({id:i,type:"warning",message:`order-direction: invalid value '${t}' — expected asc/desc; using asc.`})}validateLimit(t){const i="ERR_limit";O(t)&&Number(t)>=0?this.errors.remove(i):this.errors.addOrReplace({id:i,type:"warning",message:`limit: invalid value '${t}' — expected a non-negative integer; using 0.`})}validateLabels(t){const i="ERR_bullet_json_labels",e="WARN_bullet_fields_labels",{data:s,parseError:r}=j(t,null);if(r)return this.setBlockingError(i,this.t(".bullet-prop-json",{prop:"labels"})),void this.errors.remove(e);this.setBlockingError(i,null),null!==s?this.reportSpecIssues(e,"labels",k(s,this.labelDefaults())):this.errors.remove(e)}validateScale(t){const i="ERR_scale";if(y(t))return void this.errors.remove(i);const{mode:e,factor:s}=b(t);"factor"===e&&(void 0===s||s<=0)?this.errors.addOrReplace({id:i,type:"warning",message:`scale: invalid value '${t}' — expected none/auto or a positive number.`}):this.errors.remove(i)}constructor(i){t(this,i),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,i)=>this.t(t,i),R(this),E(this),g(this,(t=>{this.datasetName=(null==t?void 0:t.startsWith("$"))?t.substring(1):t||"",this.dataVersion=this.dataVersion+1}),((t,i)=>{this.datasetMeta=i})),this.errors=$(this),this.componentStyle=A(this),this.ruleSetConfig=h(this),this.t=m(this).t}componentWillLoad(){this.validateActual(this.actual),this.validateTarget(this.target),this.validateRanges(this.ranges),this.validateNormalize(this.normalize),this.validateVariances(this.variances),this.validateLevel(this.level),this.validateOrder(this.order),this.validateOrderDirection(this.orderDirection),this.validateLimit(this.limit),this.validateLabels(this.labels),this.validateScale(this.scale)}componentDidRender(){const{mode:t}=b(this.scale);if("auto"!==t&&"empty"!==t)return void(this._autoScaleGuard=!1);if(this._autoScaleGuard)return void(this._autoScaleGuard=!1);const e=this.element,{height:s}=f(e);if(s<=0)return;this._lastScaledParentHeight=s;const r=this.componentStyle((t=>{var i;return(null===(i=t.global)||void 0===i?void 0:i.fontSizePx)||13.3333})),a=e.scrollHeight,n=this.appliedScaleFactor;if(a<=s+1)return void this.errors.remove("AUTO_scale");const l=Math.max(.3,n*(s-1)/a);Math.abs(l-n)<.01||(e.style.setProperty("--bn-font-size",r*l+"px"),"empty"===t?this.errors.addOrReplace({id:"AUTO_scale",type:"warning",message:`Auto-scaled chart by factor ${l.toFixed(3)}`}):this.errors.remove("AUTO_scale"),this._autoScaleGuard=!0,i((()=>{this.appliedScaleFactor=l})))}componentDidLoad(){this.layoutObserver=d(this.element,(()=>{if(this._autoScaleGuard)return;const{height:t}=f(this.element);t>0&&Math.abs(t-this._lastScaledParentHeight)>2&&(this._lastScaledParentHeight=t,e(this))})),requestAnimationFrame((()=>{requestAnimationFrame((()=>{if(this._autoScaleGuard)return;const{height:t}=f(this.element);this._lastScaledParentHeight=t,e(this)}))}))}disconnectedCallback(){var t;null===(t=this.layoutObserver)||void 0===t||t.disconnect(),this.layoutObserver=null}labelDefaults(){return{show:"auto",decimals:1}}setBlockingError(t,i){null===i?(this.errors.remove(t),this.activeErrors.delete(t)):(this.errors.addOrReplace({id:t,type:"error",message:i}),this.activeErrors.add(t))}hasBlockingErrors(){return this.activeErrors.size>0}validateMeasureSpec(t,i){var e;const s=`ERR_bullet_json_${t}`,r=`ERR_bullet_measure_${t}`,a=`WARN_bullet_fields_${t}`,{data:n,parseError:l}=j(i,"measure");if(l)return this.setBlockingError(s,this.t(".bullet-prop-json",{prop:t})),this.setBlockingError(r,null),void this.errors.remove(a);if(this.setBlockingError(s,null),null===n)return this.setBlockingError(r,null),void this.errors.remove(a);const u=(null!==(e=n.measure)&&void 0!==e?e:"").trim(),h=o(u);"auto"===u.toLowerCase()||null!==h&&"scenario"===h.kind?this.setBlockingError(r,null):this.setBlockingError(r,this.t(".bullet-measure-invalid",{prop:t,measure:u})),this.reportSpecIssues(a,t,N(n))}validateEnum(t,i,e,s,r){y(e)||s.includes(e.trim().toLowerCase())?this.errors.remove(i):this.errors.addOrReplace({id:i,type:"warning",message:`${t}: invalid value '${e}' — expected ${s.join("/")}; using '${r}'.`})}reportSpecIssues(t,i,e){const s=[];null!==e&&e.invalidFields.length>0&&s.push(`invalid: ${e.invalidFields.join(", ")}`),null!==e&&e.unknownKeys.length>0&&s.push(`unknown: ${e.unknownKeys.join(", ")}`),s.length>0?this.errors.addOrReplace({id:t,type:"warning",message:`${i}: ignored sub-fields (${s.join("; ")}).`}):this.errors.remove(t)}prepareActual(){var t,i,e,s,r;const{data:a,parseError:n}=j(this.actual,"measure");if(n)return null;const l=null!==a?N(a).config:null;if(null===l||"auto"===l.measure.toLowerCase()){const r=null!==l,a=null!==(i=null===(t=this.datasetMeta)||void 0===t?void 0:t.availableScenarios)&&void 0!==i?i:[],n=null!==(s=a.includes("ac1")?"ac1":null!==(e=a.find((t=>t.startsWith("ac"))))&&void 0!==e?e:a[0])&&void 0!==s?s:"ac1";return r||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===(r=o(l.measure))||void 0===r?void 0:r.kind)?l:null}prepareTarget(){var t,i,e;const{data:s,parseError:r}=j(this.target,"measure");if(r)return null;const a=null!==s?N(s).config:null;if(null===a||"auto"===a.measure.toLowerCase()){const e=null!==a,s=null!==(i=null===(t=this.datasetMeta)||void 0===t?void 0:t.availableScenarios)&&void 0!==i?i:[],r=L.find((t=>s.includes(t)));return void 0===r?(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"),e||null===this.datasetMeta?this.errors.remove("AUTO_target"):this.errors.addOrReplace({id:"AUTO_target",type:"warning",message:`target: not set, auto-detected: ${r}`}),null===a?{measure:r}:Object.assign(Object.assign({},a),{measure:r}))}return this.errors.remove("AUTO_target"),this.errors.remove("WARN_bullet_target_unavailable"),"scenario"===(null===(e=o(a.measure))||void 0===e?void 0:e.kind)?a: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,i;const e=null===(t=this.level)||void 0===t?void 0:t.trim().toLowerCase();if("rowgroup"===e)return u.ROWGROUP;if("category"===e)return u.CATEGORY;if("subcategory"===e)return u.SUBCATEGORY;const s=null===(i=this.datasetMeta)||void 0===i?void 0:i.suggestedLevel;if(void 0!==s&&""!==s){const t=u[s.toUpperCase()];if(void 0!==t)return t}return u.CATEGORY}prepareOrder(){var t,i,e,s;const r="auto"===(null===(t=this.order)||void 0===t?void 0:t.trim().toLowerCase());let a;y(this.order)||r?(null===(i=this.datasetMeta)||void 0===i?void 0:i.suggestedOrder)?(r?this.errors.remove("AUTO_order"):this.errors.addOrReplace({id:"AUTO_order",type:"warning",message:`order: not set, auto-detected: ${this.datasetMeta.suggestedOrder}`}),a=this.datasetMeta.suggestedOrder):(this.errors.remove("AUTO_order"),a=""):(this.errors.remove("AUTO_order"),a=this.order);const n=null!==(s=c[null===(e=this.orderDirection)||void 0===e?void 0:e.toUpperCase()])&&void 0!==s?s:c.ASC;if(y(a))return new p([v.CATEGORYINDEX],n);const l=a.split(",").map((t=>v[t.trim().toUpperCase()])).filter((t=>void 0!==t));return new p(l.length>0?l:[v.CATEGORYINDEX],n)}prepareLabels(){const t=this.labelDefaults(),{data:i,parseError:e}=j(this.labels,null);return e||null===i?{show:t.show,decimals:t.decimals}:k(i,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))]))),i=new Map(n.map((t=>[t,this.t("global.".concat(t))])));return new Map([...i.entries(),...t.entries()])}prepareStyle(){const t=this.getEffectiveScaleFactor();return this.componentStyle((i=>{const e=i.global.fontSizePx*t;return{scaleFactors:i["bn-chart-bullet"].scaleFactors,fontStyles:{font:`${e}px ${i.global.fontFamily}`,size:e,color:i.global.fontColor,background:i.global.fontBackgroundColor,leading:1.8},axisStyles:i["bn-chart-bullet"].axisStyles,barStyles:i["bn-chart-bullet"].barStyles,varianceStyles:i["bn-chart-bullet"].varianceStyles,rangeColors:i["bn-chart-bullet"].rangeColors,padding:i["bn-chart-bullet"].padding}}))}getEffectiveScaleFactor(){const{mode:t,factor:i}=b(this.scale);return"factor"===t?i:"auto"===t||"empty"===t?this.appliedScaleFactor:1}getFontStyles(){const t=this.getEffectiveScaleFactor();return this.componentStyle((i=>{var e,s,r,a;const n=(null===(e=i.global)||void 0===e?void 0:e.fontSizePx)||13.3333;return{"--bn-font-family":(null===(s=i.global)||void 0===s?void 0:s.fontFamily)||"'Noto Sans', sans-serif","--bn-font-size":n*t+"px","--bn-font-color":(null===(r=i.global)||void 0===r?void 0:r.fontColor)||"#000000","--bn-font-background":(null===(a=i.global)||void 0===a?void 0:a.fontBackgroundColor)||"#ffffff"}}))}getDataStructure(){const t={};for(const i of["ac","pp","fc","pl"])for(const e of[1,2,3,4])t[`${i}${e}`]={type:"number",isOptional:!0,description:""};const i={actual:this.prepareActual(),target:this.prepareTarget()};for(const[e,s]of Object.entries(i))null!==s&&void 0!==t[s.measure]&&(t[s.measure].description=`${e}: ${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(),i=this.prepareTarget(),e=x(this.ranges).ranges,r=this.prepareNormalize();return this.setBlockingError("ERR_bullet_measure_same",null!==t&&null!==i&&t.measure===i.measure?this.t(".bullet-measure-same",{measure:t.measure}):null),e.length>0&&"target"===r?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:s("ibcs-chart-bullet",{tableName:this.datasetName,dataVersion:this.dataVersion,chartTitle:this.chartTitle,actual:t,target:i,ranges:e,normalize:r,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 s(r,{key:"9fd8c656471de9582652769edf49b80756575830",style:this.getFontStyles()},s("div",{key:"a6fe8d33dde8912a77a86244db092bb364c1aeaa",class:"container"},this.chartTemplate()))}get element(){return a(this)}static get watchers(){return{actual:[{validateActual:0}],target:[{validateTarget:0}],ranges:[{validateRanges:0}],normalize:[{validateNormalize:0}],variances:[{validateVariances:0}],level:[{validateLevel:0}],order:[{validateOrder:0}],orderDirection:[{validateOrderDirection:0}],limit:[{validateLimit:0}],labels:[{validateLabels:0}],scale:[{validateScale:0}]}}};z.style=":host{display:inline-block;position:relative;overflow:hidden}.container{display:flex;flex-direction:column}";export{z as bn_chart_bullet}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as t,h as s,H as i,g as a}from"./p-B_d-jp99.js";import{w as
|
|
1
|
+
import{r as t,h as s,H as i,g as a}from"./p-B_d-jp99.js";import{w as e}from"./p-BjBz5cSL.js";import{g as r,f as n}from"./p-BgIpdpfH.js";import{w as o,a as h}from"./p-B4JfKvVT.js";const c=class{constructor(s){t(this,s),this.namespace="_system",o(this),this.errors=h(this),e(this,(t=>{this.stores||(this.stores=r(this.element));try{const s=n(JSON.parse(t)),i=this.namespace||"_system",a=Object.assign({},this.stores.internationalization.get(i));a[this.code]=Object.assign(Object.assign({},a[this.code]),s),this.stores.internationalization.set(i,a)}catch(t){console.error(t)}}))}render(){return s(i,{key:"1b5e46fd06494aada4db697402746be6bcf950db"})}get element(){return a(this)}};c.style="bn-internationalization{display:none}";export{c as bn_internationalization}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as t,h as e,H as n,g as s}from"./p-B_d-jp99.js";import{f as r,e as i,w as o,b as a}from"./p-C0Pwqx-O.js";import{w as l,a as c}from"./p-B4JfKvVT.js";import"./p-BqhIhYr1.js";import"./p-BZV1b5VH.js";import"./p-Bdfxd_Ke.js";const d=["*","/","+","-","x","÷","none"];function u(t){switch(t){case"*":case"x":return"×";case"/":case"÷":return"÷";case"+":return"+";case"-":return"−";default:return""}}function h(t,e,n){return t.find((t=>t.from===e&&t.to===n))}function f(t){return 2*(t-1)+1}function p(t){return 2*(t-1)+1}function g(t,e){const n=t.getBoundingClientRect(),s=n.left-e.left,r=n.top-e.top;return{left:s,top:r,width:n.width,height:n.height,centerX:s+n.width/2,centerY:r+n.height/2}}function v(t,e,n){switch(n){case"ltr":return e?{x:t.left+t.width,y:t.centerY}:{x:t.left,y:t.centerY};case"rtl":return e?{x:t.left,y:t.centerY}:{x:t.left+t.width,y:t.centerY};case"ttb":return e?{x:t.centerX,y:t.top+t.height}:{x:t.centerX,y:t.top};case"btt":return e?{x:t.centerX,y:t.top}:{x:t.centerX,y:t.top+t.height}}}function y(t,e,n,s,r=8){const i=-(s-1)*r/2+n*r;switch(e){case"ltr":return{x:t.left,y:t.centerY+i};case"rtl":return{x:t.left+t.width,y:t.centerY+i};case"ttb":return{x:t.centerX+i,y:t.top};case"btt":return{x:t.centerX+i,y:t.top+t.height}}}function m(t,e,n,s){switch(n){case"straight":return function(t,e){return{path:`M ${t.x} ${t.y} L ${e.x} ${e.y}`,midpoint:{x:(t.x+e.x)/2,y:(t.y+e.y)/2}}}(t,e);case"curved":return function(t,e,n){let s,r;if("ltr"===n||"rtl"===n){const n=(t.x+e.x)/2;s={x:n,y:t.y},r={x:n,y:e.y}}else{const n=(t.y+e.y)/2;s={x:t.x,y:n},r={x:e.x,y:n}}return{path:`M ${t.x} ${t.y} C ${s.x} ${s.y}, ${r.x} ${r.y}, ${e.x} ${e.y}`,midpoint:{x:.125*t.x+.375*s.x+.375*r.x+.125*e.x,y:.125*t.y+.375*s.y+.375*r.y+.125*e.y}}}(t,e,s);default:return function(t,e,n){let s,r;if("ltr"===n||"rtl"===n){const n=t.x+.7*(e.x-t.x);s=`M ${t.x} ${t.y} L ${n} ${t.y} L ${n} ${e.y} L ${e.x} ${e.y}`,r={x:n,y:(t.y+e.y)/2}}else{const n=t.y+.7*(e.y-t.y);s=`M ${t.x} ${t.y} L ${t.x} ${n} L ${e.x} ${n} L ${e.x} ${e.y}`,r={x:(t.x+e.x)/2,y:n}}return{path:s,midpoint:r}}(t,e,s)}}function b(t,e,n,s){const r=.7;switch(s){case"ltr":{const s=t.left+t.width;return{x:s+(Math.min(e.left,n.left)-s)*r,y:t.centerY}}case"rtl":{const s=t.left,i=Math.max(e.left+e.width,n.left+n.width);return{x:i+(s-i)*r,y:t.centerY}}case"ttb":{const s=t.top+t.height,i=Math.min(e.top,n.top);return{x:t.centerX,y:s+(i-s)*r}}case"btt":{const s=t.top,i=Math.max(e.top+e.height,n.top+n.height);return{x:t.centerX,y:i+(s-i)*r}}}}function $(t,e,n){var s,r;return Object.assign({stroke:null!==(s=null==n?void 0:n.color)&&void 0!==s?s:t,strokeWidth:null!==(r=null==n?void 0:n.width)&&void 0!==r?r:e},(null==n?void 0:n.dasharray)?{strokeDasharray:n.dasharray}:{})}const x=class{validateEdgesProp(t){const e="ERR_edges",n=function(t){const e=[];if(!t||""===t.trim())return e.push("edges: value is required"),e;let n;try{n=JSON.parse(t)}catch(t){return e.push("edges: invalid JSON structure"),e}if(!Array.isArray(n))return e.push("edges: must be an array"),e;if(0===n.length)return e.push("edges: array must not be empty"),e;const s=new Set,r=new Set;n.forEach(((t,n)=>{if("object"!=typeof t||null===t)return void e.push(`edges[${n}]: must be an object`);const i=t;if("string"!=typeof i.from||""===i.from.trim()?e.push(`edges[${n}]: 'from' is required and must be a non-empty string`):s.add(i.from),"string"!=typeof i.to||""===i.to.trim()?e.push(`edges[${n}]: 'to' is required and must be a non-empty string`):(s.add(i.to),r.add(i.to)),void 0!==i.operator&&("string"==typeof i.operator&&d.includes(i.operator)||e.push(`edges[${n}]: 'operator' must be one of: ${d.join(", ")}`)),void 0!==i.label&&"string"!=typeof i.label&&e.push(`edges[${n}]: 'label' must be a string`),void 0!==i.style)if("object"!=typeof i.style||null===i.style)e.push(`edges[${n}]: 'style' must be an object`);else{const t=i.style;void 0!==t.color&&"string"!=typeof t.color&&e.push(`edges[${n}]: 'style.color' must be a string`),void 0!==t.width&&"number"!=typeof t.width&&e.push(`edges[${n}]: 'style.width' must be a number`),void 0!==t.dasharray&&"string"!=typeof t.dasharray&&e.push(`edges[${n}]: 'style.dasharray' must be a string`)}}));const i=Array.from(s).filter((t=>!r.has(t)));return 0===i.length?e.push("edges: tree has no root node (circular reference detected)"):i.length>1&&e.push(`edges: tree has multiple root nodes: ${i.join(", ")}`),e}(t);n.length>0?(this.errors.addOrReplace({id:e,type:"error",message:`edges: ${n.join("; ")}`}),this.treeConfig=null):(this.errors.remove(e),this.treeConfig=function(t){if(!t||""===t.trim())return null;try{const e=JSON.parse(t);if(!Array.isArray(e))return null;const n=e,s=function(t){const e=new Map;for(const n of t){const t=e.get(n.from)||[];t.push(n.to),e.set(n.from,t)}return e}(n),r=function(t){const e=new Set;for(const n of t)e.add(n.from),e.add(n.to);return e}(n),i=function(t,e){const n=new Set;for(const e of t)n.add(e.to);const s=Array.from(e).filter((t=>!n.has(t)));return 1===s.length?s[0]:null}(n,r);return{edges:n,adjacencyList:s,rootNode:i,allNodes:r}}catch(t){return console.error("parseTreeConfig: failed to parse tree configuration",t),null}}(t)),this.recalculateLayout()}validateDirection(t){const e="ERR_direction",n=["ltr","rtl","ttb","btt"];n.includes(t)?this.errors.remove(e):this.errors.addOrReplace({id:e,type:"warning",message:`direction: invalid value '${t}', must be one of: ${n.join(", ")}`}),this.recalculateLayout()}validateLevelSpacing(t){const e="ERR_levelSpacing";!r(t)||t<0?this.errors.addOrReplace({id:e,type:"warning",message:`level-spacing: invalid value '${t}', must be a non-negative number`}):this.errors.remove(e),this.recalculateLayout()}validateNodeSpacing(t){const e="ERR_nodeSpacing";!r(t)||t<0?this.errors.addOrReplace({id:e,type:"warning",message:`node-spacing: invalid value '${t}', must be a non-negative number`}):this.errors.remove(e),this.recalculateLayout()}validateEdgeStyle(t){const e="ERR_edgeStyle",n=["straight","orthogonal","curved"];n.includes(t)?this.errors.remove(e):this.errors.addOrReplace({id:e,type:"warning",message:`edge-style: invalid value '${t}', must be one of: ${n.join(", ")}`})}validateShowOperators(t){const e="ERR_showOperators";i(t)?this.errors.remove(e):this.errors.addOrReplace({id:e,type:"warning",message:`show-operators: invalid value '${t}', must be 'true' or 'false'`})}constructor(e){t(this,e),this.treeConfig=null,this.layout=null,this.nodeRects=new Map,this.svgWidth=0,this.svgHeight=0,this.resizeObserver=null,this.gridContainer=null,this.direction="ltr",this.levelSpacing=60,this.nodeSpacing=20,this.edgeStyle="orthogonal",this.showOperators="true",o(this),l(this),this.errors=c(this),this.componentStyle=a(this)}getTreeStyle(){return this.componentStyle((t=>({edgeColor:t["bn-tree"].edgeColor,edgeWidth:t["bn-tree"].edgeWidth,operatorCircleRadius:t["bn-tree"].operatorCircleRadius,operatorFontSize:t.global.fontSizePx*t["bn-tree"].operatorFontSizeScale,operatorColor:t["bn-tree"].operatorColor})))}componentWillLoad(){this.validateEdgesProp(this.edges),this.validateDirection(this.direction),this.validateLevelSpacing(this.levelSpacing),this.validateNodeSpacing(this.nodeSpacing),this.validateEdgeStyle(this.edgeStyle),this.validateShowOperators(this.showOperators)}componentDidLoad(){this.setupResizeObserver(),requestAnimationFrame((()=>{this.updateNodeRects()}))}disconnectedCallback(){this.resizeObserver&&(this.resizeObserver.disconnect(),this.resizeObserver=null)}setupResizeObserver(){var t;this.gridContainer=null===(t=this.element.shadowRoot)||void 0===t?void 0:t.querySelector(".tree-grid"),this.gridContainer&&(this.resizeObserver=new ResizeObserver((()=>{this.updateNodeRects()})),this.resizeObserver.observe(this.gridContainer),this.element.querySelectorAll("[slot]").forEach((t=>{this.resizeObserver.observe(t)})))}recalculateLayout(){this.layout=this.treeConfig?function(t,e,n,s){if(!t.rootNode)return{positions:new Map,gridTemplateColumns:"",gridTemplateRows:"",maxLevel:0,maxIndex:0};const r=function(t){const e=new Map;if(!t.rootNode)return e;const n=[{node:t.rootNode,level:0}],s=new Set;for(;n.length>0;){const{node:r,level:i}=n.shift();if(s.has(r))continue;s.add(r),e.set(r,i);const o=t.adjacencyList.get(r)||[];for(const t of o)s.has(t)||n.push({node:t,level:i+1})}return e}(t),i=function(t){const e=new Map;if(!t.rootNode)return e;let n=0;return function s(r){const i=e.get(r);if(i)return i;const o=t.adjacencyList.get(r)||[];if(0===o.length){const t={startIndex:n,endIndex:n};return e.set(r,t),n++,t}let a=1/0,l=-1/0;for(const t of o){const e=s(t);a=Math.min(a,e.startIndex),l=Math.max(l,e.endIndex)}const c={startIndex:a,endIndex:l};return e.set(r,c),c}(t.rootNode),e}(t),o=function(t,e,n,s){var r,i;const o=new Map,a=Math.max(...Array.from(e.values()));for(const l of t.allNodes){const t=null!==(r=e.get(l))&&void 0!==r?r:0,c=null!==(i=n.get(l))&&void 0!==i?i:{startIndex:0,endIndex:0};let d,u,h;switch(s){case"ltr":d=t+1,u=c.startIndex+1,h=c.endIndex-c.startIndex+1;break;case"rtl":d=a-t+1,u=c.startIndex+1,h=c.endIndex-c.startIndex+1;break;case"ttb":u=t+1,d=c.startIndex+1,h=1;break;case"btt":u=a-t+1,d=c.startIndex+1,h=1}o.set(l,{nodeId:l,level:t,index:c.startIndex,gridColumn:d,gridRow:u,gridRowSpan:h})}return o}(t,r,i,e),a=Math.max(...Array.from(r.values())),l=Math.max(...Array.from(i.values()).map((t=>t.endIndex))),{gridTemplateColumns:c,gridTemplateRows:d}=function(t,e,n,s,r){const i=t+1,o=e+1;if("ltr"===n||"rtl"===n){const t=[];for(let e=0;e<i;e++)t.push("auto"),e<i-1&&t.push(`${s}px`);const e=[];for(let t=0;t<o;t++)e.push("auto"),t<o-1&&e.push(`${r}px`);return{gridTemplateColumns:t.join(" "),gridTemplateRows:e.join(" ")}}{const t=[];for(let e=0;e<i;e++)t.push("auto"),e<i-1&&t.push(`${s}px`);const e=[];for(let t=0;t<o;t++)e.push("auto"),t<o-1&&e.push(`${r}px`);return{gridTemplateColumns:e.join(" "),gridTemplateRows:t.join(" ")}}}(a,l,e,n,s);return{positions:o,gridTemplateColumns:c,gridTemplateRows:d,maxLevel:a,maxIndex:l}}(this.treeConfig,this.direction,this.levelSpacing,this.nodeSpacing):null}updateNodeRects(){if(!this.treeConfig||!this.gridContainer)return;const t=this.gridContainer.getBoundingClientRect(),e=new Map;for(const n of this.treeConfig.allNodes){const s=this.element.querySelector(`[slot="${n}"]`);s&&e.set(n,g(s,t))}this.nodeRects=e,this.svgWidth=t.width,this.svgHeight=t.height}getSlotStyle(t){if(!this.layout)return{};const e=this.layout.positions.get(t);return e?"ltr"===this.direction||"rtl"===this.direction?{"grid-column":String(f(e.gridColumn)),"grid-row":`${p(e.gridRow)} / span ${n=e.gridRowSpan,n<=1?1:2*(n-1)+1}`,"align-self":"center"}:{"grid-row":String(p(e.gridRow)),"grid-column":String(f(e.gridColumn)),"justify-self":"center"}:{};var n}renderEdges(){var t;if(!this.treeConfig||0===this.nodeRects.size)return null;const n=this.getTreeStyle(),s=[],r=[],i=new Map;for(const t of this.treeConfig.edges){const e=i.get(t.to)||[];e.push(t.from),i.set(t.to,e)}for(const t of this.treeConfig.edges){const r=this.nodeRects.get(t.from),o=this.nodeRects.get(t.to);if(!r||!o)continue;const a=v(r,!0,this.direction),l=i.get(t.to)||[];let c;if(l.length>1){const e=l.indexOf(t.from);c=y(o,this.direction,e,l.length)}else c=v(o,!1,this.direction);const{path:d}=m(a,c,this.edgeStyle,this.direction),u=$(n.edgeColor,n.edgeWidth,t.style);s.push(e("path",{key:`edge-${t.from}-${t.to}`,d,fill:"none",stroke:u.stroke,"stroke-width":u.strokeWidth,"stroke-dasharray":u.strokeDasharray}))}if("true"===this.showOperators)for(const[s,i]of this.treeConfig.adjacencyList.entries()){const o=this.nodeRects.get(s);if(o)for(let a=0;a<i.length-1;a++){const l=i[a],c=i[a+1],d=h(this.treeConfig.edges,s,l);if(!(null==d?void 0:d.operator)||"none"===d.operator)continue;const f=this.nodeRects.get(l),p=this.nodeRects.get(c);if(!f||!p)continue;const g=null!==(t=d.label)&&void 0!==t?t:u(d.operator),v=b(o,f,p,this.direction);r.push(e("g",{key:`operator-${s}-${l}`,class:"operator-group"},e("circle",{cx:v.x,cy:v.y,r:n.operatorCircleRadius,fill:"white",stroke:n.edgeColor,"stroke-width":n.edgeWidth}),e("text",{x:v.x,y:v.y,"text-anchor":"middle","dominant-baseline":"central",style:{fontSize:`${n.operatorFontSize}px`,fill:n.operatorColor,fontWeight:"bold"}},g)))}}return e("svg",{class:"edge-layer",width:this.svgWidth,height:this.svgHeight,style:{position:"absolute",top:"0",left:"0",pointerEvents:"none"}},s,r)}renderSlots(){return this.treeConfig&&this.layout?Array.from(this.treeConfig.allNodes).map((t=>e("div",{key:t,class:"tree-node",style:this.getSlotStyle(t)},e("slot",{name:t})))):null}getFontStyles(){return this.componentStyle((t=>{var e,n,s,r;return{"--bn-font-family":(null===(e=t.global)||void 0===e?void 0:e.fontFamily)||"'Noto Sans', sans-serif","--bn-font-size":`${(null===(n=t.global)||void 0===n?void 0:n.fontSizePx)||13.3333}px`,"--bn-font-color":(null===(s=t.global)||void 0===s?void 0:s.fontColor)||"#000000","--bn-font-background":(null===(r=t.global)||void 0===r?void 0:r.fontBackgroundColor)||"#ffffff"}}))}render(){const t=this.getFontStyles();return e(n,{style:t},this.treeConfig&&this.layout?e("div",{class:"tree-container"},e("div",{class:"tree-grid",style:{display:"grid","grid-template-columns":this.layout.gridTemplateColumns,"grid-template-rows":this.layout.gridTemplateRows,position:"relative"}},this.renderEdges(),this.renderSlots())):e("div",{class:"tree-container tree-error"},e("slot",null)))}get element(){return s(this)}static get watchers(){return{edges:[{validateEdgesProp:0}],direction:[{validateDirection:0}],levelSpacing:[{validateLevelSpacing:0}],nodeSpacing:[{validateNodeSpacing:0}],edgeStyle:[{validateEdgeStyle:0}],showOperators:[{validateShowOperators:0}]}}};x.style=':host{display:inline-block;position:relative;font-family:var(--bn-font-family, "Noto Sans", sans-serif);font-size:var(--bn-font-size, 13.3333px);color:var(--bn-font-color, #000000)}.tree-container{position:relative;display:inline-block}.tree-grid{position:relative;display:grid;align-items:center}.tree-node{position:relative;z-index:1;border:1px solid #404040;background:var(--bn-font-background, white)}.edge-layer{position:absolute;top:0;left:0;z-index:0;pointer-events:none;overflow:visible}.tree-error{display:flex;flex-wrap:wrap;gap:20px}';export{x as bn_tree}
|
|
1
|
+
import{r as t,h as e,H as n,g as s}from"./p-B_d-jp99.js";import{f as r,e as i,w as o,b as a}from"./p-BpWWgN6k.js";import{w as l,a as c}from"./p-B4JfKvVT.js";import"./p-BgIpdpfH.js";import"./p-eEfqksk-.js";import"./p-C5uvAEKI.js";const d=["*","/","+","-","x","÷","none"];function u(t){switch(t){case"*":case"x":return"×";case"/":case"÷":return"÷";case"+":return"+";case"-":return"−";default:return""}}function h(t,e,n){return t.find((t=>t.from===e&&t.to===n))}function f(t){return 2*(t-1)+1}function p(t){return 2*(t-1)+1}function g(t,e){const n=t.getBoundingClientRect(),s=n.left-e.left,r=n.top-e.top;return{left:s,top:r,width:n.width,height:n.height,centerX:s+n.width/2,centerY:r+n.height/2}}function v(t,e,n){switch(n){case"ltr":return e?{x:t.left+t.width,y:t.centerY}:{x:t.left,y:t.centerY};case"rtl":return e?{x:t.left,y:t.centerY}:{x:t.left+t.width,y:t.centerY};case"ttb":return e?{x:t.centerX,y:t.top+t.height}:{x:t.centerX,y:t.top};case"btt":return e?{x:t.centerX,y:t.top}:{x:t.centerX,y:t.top+t.height}}}function y(t,e,n,s,r=8){const i=-(s-1)*r/2+n*r;switch(e){case"ltr":return{x:t.left,y:t.centerY+i};case"rtl":return{x:t.left+t.width,y:t.centerY+i};case"ttb":return{x:t.centerX+i,y:t.top};case"btt":return{x:t.centerX+i,y:t.top+t.height}}}function m(t,e,n,s){switch(n){case"straight":return function(t,e){return{path:`M ${t.x} ${t.y} L ${e.x} ${e.y}`,midpoint:{x:(t.x+e.x)/2,y:(t.y+e.y)/2}}}(t,e);case"curved":return function(t,e,n){let s,r;if("ltr"===n||"rtl"===n){const n=(t.x+e.x)/2;s={x:n,y:t.y},r={x:n,y:e.y}}else{const n=(t.y+e.y)/2;s={x:t.x,y:n},r={x:e.x,y:n}}return{path:`M ${t.x} ${t.y} C ${s.x} ${s.y}, ${r.x} ${r.y}, ${e.x} ${e.y}`,midpoint:{x:.125*t.x+.375*s.x+.375*r.x+.125*e.x,y:.125*t.y+.375*s.y+.375*r.y+.125*e.y}}}(t,e,s);default:return function(t,e,n){let s,r;if("ltr"===n||"rtl"===n){const n=t.x+.7*(e.x-t.x);s=`M ${t.x} ${t.y} L ${n} ${t.y} L ${n} ${e.y} L ${e.x} ${e.y}`,r={x:n,y:(t.y+e.y)/2}}else{const n=t.y+.7*(e.y-t.y);s=`M ${t.x} ${t.y} L ${t.x} ${n} L ${e.x} ${n} L ${e.x} ${e.y}`,r={x:(t.x+e.x)/2,y:n}}return{path:s,midpoint:r}}(t,e,s)}}function b(t,e,n,s){const r=.7;switch(s){case"ltr":{const s=t.left+t.width;return{x:s+(Math.min(e.left,n.left)-s)*r,y:t.centerY}}case"rtl":{const s=t.left,i=Math.max(e.left+e.width,n.left+n.width);return{x:i+(s-i)*r,y:t.centerY}}case"ttb":{const s=t.top+t.height,i=Math.min(e.top,n.top);return{x:t.centerX,y:s+(i-s)*r}}case"btt":{const s=t.top,i=Math.max(e.top+e.height,n.top+n.height);return{x:t.centerX,y:i+(s-i)*r}}}}function $(t,e,n){var s,r;return Object.assign({stroke:null!==(s=null==n?void 0:n.color)&&void 0!==s?s:t,strokeWidth:null!==(r=null==n?void 0:n.width)&&void 0!==r?r:e},(null==n?void 0:n.dasharray)?{strokeDasharray:n.dasharray}:{})}const x=class{validateEdgesProp(t){const e="ERR_edges",n=function(t){const e=[];if(!t||""===t.trim())return e.push("edges: value is required"),e;let n;try{n=JSON.parse(t)}catch(t){return e.push("edges: invalid JSON structure"),e}if(!Array.isArray(n))return e.push("edges: must be an array"),e;if(0===n.length)return e.push("edges: array must not be empty"),e;const s=new Set,r=new Set;n.forEach(((t,n)=>{if("object"!=typeof t||null===t)return void e.push(`edges[${n}]: must be an object`);const i=t;if("string"!=typeof i.from||""===i.from.trim()?e.push(`edges[${n}]: 'from' is required and must be a non-empty string`):s.add(i.from),"string"!=typeof i.to||""===i.to.trim()?e.push(`edges[${n}]: 'to' is required and must be a non-empty string`):(s.add(i.to),r.add(i.to)),void 0!==i.operator&&("string"==typeof i.operator&&d.includes(i.operator)||e.push(`edges[${n}]: 'operator' must be one of: ${d.join(", ")}`)),void 0!==i.label&&"string"!=typeof i.label&&e.push(`edges[${n}]: 'label' must be a string`),void 0!==i.style)if("object"!=typeof i.style||null===i.style)e.push(`edges[${n}]: 'style' must be an object`);else{const t=i.style;void 0!==t.color&&"string"!=typeof t.color&&e.push(`edges[${n}]: 'style.color' must be a string`),void 0!==t.width&&"number"!=typeof t.width&&e.push(`edges[${n}]: 'style.width' must be a number`),void 0!==t.dasharray&&"string"!=typeof t.dasharray&&e.push(`edges[${n}]: 'style.dasharray' must be a string`)}}));const i=Array.from(s).filter((t=>!r.has(t)));return 0===i.length?e.push("edges: tree has no root node (circular reference detected)"):i.length>1&&e.push(`edges: tree has multiple root nodes: ${i.join(", ")}`),e}(t);n.length>0?(this.errors.addOrReplace({id:e,type:"error",message:`edges: ${n.join("; ")}`}),this.treeConfig=null):(this.errors.remove(e),this.treeConfig=function(t){if(!t||""===t.trim())return null;try{const e=JSON.parse(t);if(!Array.isArray(e))return null;const n=e,s=function(t){const e=new Map;for(const n of t){const t=e.get(n.from)||[];t.push(n.to),e.set(n.from,t)}return e}(n),r=function(t){const e=new Set;for(const n of t)e.add(n.from),e.add(n.to);return e}(n),i=function(t,e){const n=new Set;for(const e of t)n.add(e.to);const s=Array.from(e).filter((t=>!n.has(t)));return 1===s.length?s[0]:null}(n,r);return{edges:n,adjacencyList:s,rootNode:i,allNodes:r}}catch(t){return console.error("parseTreeConfig: failed to parse tree configuration",t),null}}(t)),this.recalculateLayout()}validateDirection(t){const e="ERR_direction",n=["ltr","rtl","ttb","btt"];n.includes(t)?this.errors.remove(e):this.errors.addOrReplace({id:e,type:"warning",message:`direction: invalid value '${t}', must be one of: ${n.join(", ")}`}),this.recalculateLayout()}validateLevelSpacing(t){const e="ERR_levelSpacing";!r(t)||t<0?this.errors.addOrReplace({id:e,type:"warning",message:`level-spacing: invalid value '${t}', must be a non-negative number`}):this.errors.remove(e),this.recalculateLayout()}validateNodeSpacing(t){const e="ERR_nodeSpacing";!r(t)||t<0?this.errors.addOrReplace({id:e,type:"warning",message:`node-spacing: invalid value '${t}', must be a non-negative number`}):this.errors.remove(e),this.recalculateLayout()}validateEdgeStyle(t){const e="ERR_edgeStyle",n=["straight","orthogonal","curved"];n.includes(t)?this.errors.remove(e):this.errors.addOrReplace({id:e,type:"warning",message:`edge-style: invalid value '${t}', must be one of: ${n.join(", ")}`})}validateShowOperators(t){const e="ERR_showOperators";i(t)?this.errors.remove(e):this.errors.addOrReplace({id:e,type:"warning",message:`show-operators: invalid value '${t}', must be 'true' or 'false'`})}constructor(e){t(this,e),this.treeConfig=null,this.layout=null,this.nodeRects=new Map,this.svgWidth=0,this.svgHeight=0,this.resizeObserver=null,this.gridContainer=null,this.direction="ltr",this.levelSpacing=60,this.nodeSpacing=20,this.edgeStyle="orthogonal",this.showOperators="true",o(this),l(this),this.errors=c(this),this.componentStyle=a(this)}getTreeStyle(){return this.componentStyle((t=>({edgeColor:t["bn-tree"].edgeColor,edgeWidth:t["bn-tree"].edgeWidth,operatorCircleRadius:t["bn-tree"].operatorCircleRadius,operatorFontSize:t.global.fontSizePx*t["bn-tree"].operatorFontSizeScale,operatorColor:t["bn-tree"].operatorColor})))}componentWillLoad(){this.validateEdgesProp(this.edges),this.validateDirection(this.direction),this.validateLevelSpacing(this.levelSpacing),this.validateNodeSpacing(this.nodeSpacing),this.validateEdgeStyle(this.edgeStyle),this.validateShowOperators(this.showOperators)}componentDidLoad(){this.setupResizeObserver(),requestAnimationFrame((()=>{this.updateNodeRects()}))}disconnectedCallback(){this.resizeObserver&&(this.resizeObserver.disconnect(),this.resizeObserver=null)}setupResizeObserver(){var t;this.gridContainer=null===(t=this.element.shadowRoot)||void 0===t?void 0:t.querySelector(".tree-grid"),this.gridContainer&&(this.resizeObserver=new ResizeObserver((()=>{this.updateNodeRects()})),this.resizeObserver.observe(this.gridContainer),this.element.querySelectorAll("[slot]").forEach((t=>{this.resizeObserver.observe(t)})))}recalculateLayout(){this.layout=this.treeConfig?function(t,e,n,s){if(!t.rootNode)return{positions:new Map,gridTemplateColumns:"",gridTemplateRows:"",maxLevel:0,maxIndex:0};const r=function(t){const e=new Map;if(!t.rootNode)return e;const n=[{node:t.rootNode,level:0}],s=new Set;for(;n.length>0;){const{node:r,level:i}=n.shift();if(s.has(r))continue;s.add(r),e.set(r,i);const o=t.adjacencyList.get(r)||[];for(const t of o)s.has(t)||n.push({node:t,level:i+1})}return e}(t),i=function(t){const e=new Map;if(!t.rootNode)return e;let n=0;return function s(r){const i=e.get(r);if(i)return i;const o=t.adjacencyList.get(r)||[];if(0===o.length){const t={startIndex:n,endIndex:n};return e.set(r,t),n++,t}let a=1/0,l=-1/0;for(const t of o){const e=s(t);a=Math.min(a,e.startIndex),l=Math.max(l,e.endIndex)}const c={startIndex:a,endIndex:l};return e.set(r,c),c}(t.rootNode),e}(t),o=function(t,e,n,s){var r,i;const o=new Map,a=Math.max(...Array.from(e.values()));for(const l of t.allNodes){const t=null!==(r=e.get(l))&&void 0!==r?r:0,c=null!==(i=n.get(l))&&void 0!==i?i:{startIndex:0,endIndex:0};let d,u,h;switch(s){case"ltr":d=t+1,u=c.startIndex+1,h=c.endIndex-c.startIndex+1;break;case"rtl":d=a-t+1,u=c.startIndex+1,h=c.endIndex-c.startIndex+1;break;case"ttb":u=t+1,d=c.startIndex+1,h=1;break;case"btt":u=a-t+1,d=c.startIndex+1,h=1}o.set(l,{nodeId:l,level:t,index:c.startIndex,gridColumn:d,gridRow:u,gridRowSpan:h})}return o}(t,r,i,e),a=Math.max(...Array.from(r.values())),l=Math.max(...Array.from(i.values()).map((t=>t.endIndex))),{gridTemplateColumns:c,gridTemplateRows:d}=function(t,e,n,s,r){const i=t+1,o=e+1;if("ltr"===n||"rtl"===n){const t=[];for(let e=0;e<i;e++)t.push("auto"),e<i-1&&t.push(`${s}px`);const e=[];for(let t=0;t<o;t++)e.push("auto"),t<o-1&&e.push(`${r}px`);return{gridTemplateColumns:t.join(" "),gridTemplateRows:e.join(" ")}}{const t=[];for(let e=0;e<i;e++)t.push("auto"),e<i-1&&t.push(`${s}px`);const e=[];for(let t=0;t<o;t++)e.push("auto"),t<o-1&&e.push(`${r}px`);return{gridTemplateColumns:e.join(" "),gridTemplateRows:t.join(" ")}}}(a,l,e,n,s);return{positions:o,gridTemplateColumns:c,gridTemplateRows:d,maxLevel:a,maxIndex:l}}(this.treeConfig,this.direction,this.levelSpacing,this.nodeSpacing):null}updateNodeRects(){if(!this.treeConfig||!this.gridContainer)return;const t=this.gridContainer.getBoundingClientRect(),e=new Map;for(const n of this.treeConfig.allNodes){const s=this.element.querySelector(`[slot="${n}"]`);s&&e.set(n,g(s,t))}this.nodeRects=e,this.svgWidth=t.width,this.svgHeight=t.height}getSlotStyle(t){if(!this.layout)return{};const e=this.layout.positions.get(t);return e?"ltr"===this.direction||"rtl"===this.direction?{"grid-column":String(f(e.gridColumn)),"grid-row":`${p(e.gridRow)} / span ${n=e.gridRowSpan,n<=1?1:2*(n-1)+1}`,"align-self":"center"}:{"grid-row":String(p(e.gridRow)),"grid-column":String(f(e.gridColumn)),"justify-self":"center"}:{};var n}renderEdges(){var t;if(!this.treeConfig||0===this.nodeRects.size)return null;const n=this.getTreeStyle(),s=[],r=[],i=new Map;for(const t of this.treeConfig.edges){const e=i.get(t.to)||[];e.push(t.from),i.set(t.to,e)}for(const t of this.treeConfig.edges){const r=this.nodeRects.get(t.from),o=this.nodeRects.get(t.to);if(!r||!o)continue;const a=v(r,!0,this.direction),l=i.get(t.to)||[];let c;if(l.length>1){const e=l.indexOf(t.from);c=y(o,this.direction,e,l.length)}else c=v(o,!1,this.direction);const{path:d}=m(a,c,this.edgeStyle,this.direction),u=$(n.edgeColor,n.edgeWidth,t.style);s.push(e("path",{key:`edge-${t.from}-${t.to}`,d,fill:"none",stroke:u.stroke,"stroke-width":u.strokeWidth,"stroke-dasharray":u.strokeDasharray}))}if("true"===this.showOperators)for(const[s,i]of this.treeConfig.adjacencyList.entries()){const o=this.nodeRects.get(s);if(o)for(let a=0;a<i.length-1;a++){const l=i[a],c=i[a+1],d=h(this.treeConfig.edges,s,l);if(!(null==d?void 0:d.operator)||"none"===d.operator)continue;const f=this.nodeRects.get(l),p=this.nodeRects.get(c);if(!f||!p)continue;const g=null!==(t=d.label)&&void 0!==t?t:u(d.operator),v=b(o,f,p,this.direction);r.push(e("g",{key:`operator-${s}-${l}`,class:"operator-group"},e("circle",{cx:v.x,cy:v.y,r:n.operatorCircleRadius,fill:"white",stroke:n.edgeColor,"stroke-width":n.edgeWidth}),e("text",{x:v.x,y:v.y,"text-anchor":"middle","dominant-baseline":"central",style:{fontSize:`${n.operatorFontSize}px`,fill:n.operatorColor,fontWeight:"bold"}},g)))}}return e("svg",{class:"edge-layer",width:this.svgWidth,height:this.svgHeight,style:{position:"absolute",top:"0",left:"0",pointerEvents:"none"}},s,r)}renderSlots(){return this.treeConfig&&this.layout?Array.from(this.treeConfig.allNodes).map((t=>e("div",{key:t,class:"tree-node",style:this.getSlotStyle(t)},e("slot",{name:t})))):null}getFontStyles(){return this.componentStyle((t=>{var e,n,s,r;return{"--bn-font-family":(null===(e=t.global)||void 0===e?void 0:e.fontFamily)||"'Noto Sans', sans-serif","--bn-font-size":`${(null===(n=t.global)||void 0===n?void 0:n.fontSizePx)||13.3333}px`,"--bn-font-color":(null===(s=t.global)||void 0===s?void 0:s.fontColor)||"#000000","--bn-font-background":(null===(r=t.global)||void 0===r?void 0:r.fontBackgroundColor)||"#ffffff"}}))}render(){const t=this.getFontStyles();return e(n,{style:t},this.treeConfig&&this.layout?e("div",{class:"tree-container"},e("div",{class:"tree-grid",style:{display:"grid","grid-template-columns":this.layout.gridTemplateColumns,"grid-template-rows":this.layout.gridTemplateRows,position:"relative"}},this.renderEdges(),this.renderSlots())):e("div",{class:"tree-container tree-error"},e("slot",null)))}get element(){return s(this)}static get watchers(){return{edges:[{validateEdgesProp:0}],direction:[{validateDirection:0}],levelSpacing:[{validateLevelSpacing:0}],nodeSpacing:[{validateNodeSpacing:0}],edgeStyle:[{validateEdgeStyle:0}],showOperators:[{validateShowOperators:0}]}}};x.style=':host{display:inline-block;position:relative;font-family:var(--bn-font-family, "Noto Sans", sans-serif);font-size:var(--bn-font-size, 13.3333px);color:var(--bn-font-color, #000000)}.tree-container{position:relative;display:inline-block}.tree-grid{position:relative;display:grid;align-items:center}.tree-node{position:relative;z-index:1;border:1px solid #404040;background:var(--bn-font-background, white)}.edge-layer{position:absolute;top:0;left:0;z-index:0;pointer-events:none;overflow:visible}.tree-error{display:flex;flex-wrap:wrap;gap:20px}';export{x as bn_tree}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{C as n}from"./p-
|
|
1
|
+
import{C as n}from"./p-eEfqksk-.js";function i(n,i){var o;const e=null!==(o=null==n?void 0:n.trim())&&void 0!==o?o:"";if(""===e||"null"===e)return{data:null,parseError:!1};if(e.startsWith("{")||e.startsWith("["))try{const n=JSON.parse(e);return"object"!=typeof n||null===n||Array.isArray(n)?{data:null,parseError:!0}:{data:n,parseError:!1}}catch(n){return{data:null,parseError:!0}}return null!==i?{data:{[i]:e},parseError:!1}:{data:null,parseError:!0}}function o(n,i){return Object.keys(n).filter((n=>!i.includes(n)))}function e(i,o,e){if(n.isExisting(i[o]))return n.isString(i[o])?i[o]:void e.push(o)}function r(i,o,e){if(n.isExisting(i[o]))return n.isNumber(i[o])?i[o]:void e.push(o)}const t=["measure","label","unit","min","max","refLine","highlight"];function u(i){const u=[],s=e(i,"measure",u);if(void 0===s||""===s.trim())return u.push("measure"),{config:null,unknownKeys:o(i,t),invalidFields:u};const l={measure:s.trim()};return l.label=e(i,"label",u),l.unit=e(i,"unit",u),l.min=r(i,"min",u),l.max=r(i,"max",u),l.refLine=r(i,"refLine",u),l.highlight=function(i,o){if(!n.isExisting(i.highlight))return;if(!n.isObject(i.highlight)||Array.isArray(i.highlight))return void o.push("highlight");const e=i.highlight,t={},u=r(e,"from",o),s=r(e,"to",o);return void 0!==u&&(t.from=u),void 0!==s&&(t.to=s),t}(i,u),{config:l,unknownKeys:o(i,t),invalidFields:u}}const s=["measure","label","unit","group"];function l(n){const i=[],r=e(n,"measure",i);if(void 0===r||""===r.trim())return i.push("measure"),{config:null,unknownKeys:o(n,s),invalidFields:i};const t={measure:r.trim()};return t.label=e(n,"label",i),t.unit=e(n,"unit",i),t.group=e(n,"group",i),{config:t,unknownKeys:o(n,s),invalidFields:i}}const a=["measure"];function c(n){const i=[],r=e(n,"measure",i);return void 0===r||""===r.trim()?(i.push("measure"),{config:null,unknownKeys:o(n,a),invalidFields:i}):{config:{measure:r.trim()},unknownKeys:o(n,a),invalidFields:i}}const f=["values","label","unit","highlight"];function d(i){const t=[];let u=null;if("auto"===i.values?u="auto":n.isArray(i.values)&&i.values.every((i=>n.isNumber(i)))?u=i.values:t.push("values"),null===u)return{config:null,unknownKeys:o(i,f),invalidFields:t};const s={values:u};if(s.label=e(i,"label",t),s.unit=e(i,"unit",t),n.isExisting(i.highlight))if(n.isObject(i.highlight)&&!Array.isArray(i.highlight)){const n=r(i.highlight,"from",t);void 0!==n&&(s.highlight={from:n})}else t.push("highlight");return{config:s,unknownKeys:o(i,f),invalidFields:t}}const v=["points","values","max"];function m(i,e){const r=[],t={points:e.points,values:e.values,max:e.max};return n.isExisting(i.points)&&("auto"===i.points||"none"===i.points||"all"===i.points||n.isArray(i.points)&&i.points.every((i=>n.isString(i)))?t.points=i.points:r.push("points")),n.isExisting(i.values)&&(n.isBoolean(i.values)?t.values=i.values:r.push("values")),n.isExisting(i.max)&&(n.isNumber(i.max)&&i.max>0?t.max=Math.floor(i.max):r.push("max")),{config:t,unknownKeys:o(i,v),invalidFields:r}}const g=["level","columns"];function h(i){const e=[],r=n.isString(i.level)?i.level.toLowerCase():null;if("rowgroup"!==r&&"category"!==r)return e.push("level"),{config:null,unknownKeys:o(i,g),invalidFields:e};const t={level:r};return n.isExisting(i.columns)&&(n.isNumber(i.columns)&&i.columns>=1?t.columns=Math.floor(i.columns):e.push("columns")),{config:t,unknownKeys:o(i,g),invalidFields:e}}const p=["show","position"];function y(i){const e=[],r={show:!0,position:"right"};return n.isExisting(i.show)&&(n.isBoolean(i.show)?r.show=i.show:e.push("show")),n.isExisting(i.position)&&("right"===i.position||"bottom"===i.position?r.position=i.position:e.push("position")),{config:r,unknownKeys:o(i,p),invalidFields:e}}export{l as a,c as b,h as c,m as d,y as e,d as f,i as p,u as t}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as t,d as i,f as e,h as s,H as a,g as r}from"./p-B_d-jp99.js";import{a as n}from"./p-BqhIhYr1.js";import{w as l,a as o,g as h,p as u}from"./p-DY7YYmpa.js";import{w as c,o as d}from"./p-DTuaq8Pj.js";import{i as p,a as v,w as m,b as f,c as g}from"./p-C0Pwqx-O.js";import{w as y,a as b}from"./p-B4JfKvVT.js";import{w as x}from"./p-CiudZRQr.js";import{r as _,s as w}from"./p-BZV1b5VH.js";import{t as $,a as R,b as S,c as E,d as L,e as j,p as A}from"./p-Dg9OcXAO.js";import"./p-Bdfxd_Ke.js";const C={rowGroup:0,category:1,subCategory:2},O=["ac","pp","fc","pl"],z=class{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=>R(t))),this.validateSizeScaling()}validateShare(t){this.validateMeasureSpec("share",t,!1,(t=>S(t)))}validateCompareWith(t){const i="ERR_compareWith";p(t)||O.includes(t.trim().toLowerCase())?this.errors.remove(i):this.errors.addOrReplace({id:i,type:"warning",message:`compare-with: invalid value '${t}' — expected ${O.join("/")}; ignored.`})}validateLevel(t){const i="ERR_level",e=["auto","category","subcategory"];p(t)||e.includes(t.trim().toLowerCase())?this.errors.remove(i):this.errors.addOrReplace({id:i,type:"warning",message:`level: invalid value '${t}' — expected ${e.join("/")}; using 'auto'.`})}validateSeriesLevel(t){const i="ERR_seriesLevel",e=["auto","rowgroup","category","none"];p(t)||e.includes(t.trim().toLowerCase())?this.errors.remove(i):this.errors.addOrReplace({id:i,type:"warning",message:`series-level: invalid value '${t}' — expected ${e.join("/")}; using 'auto'.`})}validateFacet(t){this.validateObjectSpec("facet",t,(t=>E(t)))}validateLabels(t){this.validateObjectSpec("labels",t,(t=>L(t,this.labelDefaults())))}validateLegend(t){this.validateObjectSpec("legend",t,(t=>j(t)))}validateAspect(t){const i="ERR_aspect";p(t)||null!==this.parseAspect(t)?this.errors.remove(i):this.errors.addOrReplace({id:i,type:"warning",message:`aspect: invalid value '${t}' — expected "w:h" (e.g. "16:9"); using the default.`})}validateLimit(t){const i="ERR_limit";v(t)&&Number(t)>=0?this.errors.remove(i):this.errors.addOrReplace({id:i,type:"warning",message:`limit: invalid value '${t}' — expected a non-negative integer; using 0.`})}validateScale(t){const i="ERR_scale";if(p(t))return void this.errors.remove(i);const{mode:e,factor:s}=u(t);"factor"===e&&(void 0===s||s<=0)?this.errors.addOrReplace({id:i,type:"warning",message:`scale: invalid value '${t}' — expected none/auto or a positive number.`}):this.errors.remove(i)}constructor(i){t(this,i),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,i)=>this.t(t,i),m(this),y(this),l(this,(t=>{this.datasetName=(null==t?void 0:t.startsWith("$"))?t.substring(1):t||"",this.dataVersion=this.dataVersion+1}),((t,i)=>{this.datasetMeta=i})),this.errors=b(this),x(this),this.componentStyle=f(this),this.ruleSetConfig=c(this),this.t=o(this).t}componentWillLoad(){this.validateX(this.x),this.validateY(this.y),this.validateSize(this.size),this.validateShare(this.share),this.validateCompareWith(this.compareWith),this.validateLevel(this.level),this.validateSeriesLevel(this.seriesLevel),this.validateFacet(this.facet),this.validateLabels(this.labels),this.validateLegend(this.legend),this.validateAspect(this.aspect),this.validateLimit(this.limit),this.validateScale(this.scale)}componentDidRender(){const{mode:t}=u(this.scale);if("auto"!==t&&"empty"!==t){this._autoScaleGuard=!1;const t=h(this.element),i="WARN_overflow";return void(t.width>0&&this.element.scrollWidth>t.width+1?this.errors.addOrReplace({id:i,type:"warning",message:"Chart exceeds available space and will be cut off. Check the scale value."}):this.errors.remove(i))}if(this._autoScaleGuard)return void(this._autoScaleGuard=!1);const e=this.element,{width:s}=h(e);if(s<=0)return;this._lastObservedWidth=s;const a=this.componentStyle((t=>{var i;return(null===(i=t.global)||void 0===i?void 0:i.fontSizePx)||13.3333})),r=e.scrollWidth,n=this.appliedScaleFactor;if(!Number.isFinite(r)||r<=s+1)return void this.errors.remove("AUTO_scale");const l=Math.max(.3,n*(s-1)/r);Math.abs(l-n)<.01||(e.style.setProperty("--bn-font-size",a*l+"px"),"empty"===t?this.errors.addOrReplace({id:"AUTO_scale",type:"warning",message:`Auto-scaled chart by factor ${l.toFixed(3)}`}):this.errors.remove("AUTO_scale"),this._autoScaleGuard=!0,i((()=>{this.appliedScaleFactor=l})))}componentDidLoad(){this.layoutObserver=d(this.element,(()=>{if(this._autoScaleGuard)return;const{width:t}=h(this.element);t>0&&Math.abs(t-this._lastObservedWidth)>2&&(this._lastObservedWidth=t,e(this))})),requestAnimationFrame((()=>{requestAnimationFrame((()=>{if(this._autoScaleGuard)return;const{width:t}=h(this.element);this._lastObservedWidth=t,e(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,i){null===i?(this.errors.remove(t),this.activeErrors.delete(t)):(this.errors.addOrReplace({id:t,type:"error",message:i}),this.activeErrors.add(t))}hasBlockingErrors(){return this.activeErrors.size>0}validateSizeScaling(){var t;const i=null===(t=this.prepareSize())||void 0===t?void 0:t.group;this.setBlockingError("ERR_xy_scale_group",void 0===i||this.pixelPerUnitGroupMap.has(i)?null:this.t(".bubble-scale-group-unknown",{group:i}))}validateMeasureSpec(t,i,e,s){var a;const r=`ERR_xy_json_${t}`,n=`ERR_xy_measure_${t}`,l=`WARN_xy_fields_${t}`,{data:o,parseError:h}=A(i,"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,e?this.t(".xy-measure-invalid",{prop:t,measure:""}):null),void this.errors.remove(l);const u=null!==(a=o.measure)&&void 0!==a?a:"";g(u)?this.setBlockingError(n,null):this.setBlockingError(n,this.t(".xy-measure-invalid",{prop:t,measure:u})),this.reportSpecIssues(l,t,s(o))}validateObjectSpec(t,i,e){const s=`ERR_xy_json_${t}`,a=`WARN_xy_fields_${t}`,{data:r,parseError:n}=A(i,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,e(r)):this.errors.remove(a)}reportSpecIssues(t,i,e){const s=[];null!==e&&e.invalidFields.length>0&&s.push(`invalid: ${e.invalidFields.join(", ")}`),null!==e&&e.unknownKeys.length>0&&s.push(`unknown: ${e.unknownKeys.join(", ")}`),s.length>0?this.errors.addOrReplace({id:t,type:"warning",message:`${i}: ignored sub-fields (${s.join("; ")}).`}):this.errors.remove(t)}prepareAxis(t,i){const{data:e,parseError:s}=A(i,"measure");if(s||null===e)return null;const{config:a}=$(e);return null!==a&&g(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:i}=A(this.size,"measure");if(i||null===t)return null;const{config:e}=R(t);return null!==e&&g(e.measure)?e:null}prepareShare(){const{data:t,parseError:i}=A(this.share,"measure");if(i||null===t)return null;const{config:e}=S(t);return null!==e&&g(e.measure)?e:null}prepareCompareFamily(){var t;const i=null===(t=this.compareWith)||void 0===t?void 0:t.trim().toLowerCase();return O.includes(i)?i:null}prepareLabels(){const t=this.labelDefaults(),{data:i,parseError:e}=A(this.labels,null);return e||null===i?{points:t.points,values:t.values,max:t.max}:L(i,t).config}prepareLegend(){const{data:t,parseError:i}=A(this.legend,null);return i||null===t?{show:!0,position:"right"}:j(t).config}prepareFacet(){const{data:t,parseError:i}=A(this.facet,null);return i||null===t?null:E(t).config}preparePointLevel(){var t,i;const e=null===(t=this.level)||void 0===t?void 0:t.trim().toLowerCase();if("category"===e)return"category";if("subcategory"===e)return"subCategory";const s=null===(i=this.datasetMeta)||void 0===i?void 0:i.suggestedLevel;return"rowGroup"===s||"category"===s||"subCategory"===s?s:"category"}prepareSeriesLevel(t){var i;const e=null===(i=this.seriesLevel)||void 0===i?void 0:i.trim().toLowerCase();return"none"===e?null:"rowgroup"===e?"rowGroup":"category"===e||"subCategory"===t?"category":"category"===t?"rowGroup":null}validateCrossProp(t,i){const e=new Set;let s=!1;for(const i of t){if(void 0===i)continue;const t=_(i);null!==t&&("scenario"===t.kind?e.add(w(t.slot)):s=!0)}this.setBlockingError("ERR_xy_family",e.size>1?this.t(".xy-family-mixed",{families:[...e].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===e.size&&e.has(a)?`compare-with: '${a}' is already the primary scenario family.`:null);const r=this.preparePointLevel(),n=this.prepareSeriesLevel(r),l=null!==i?"rowgroup"===i.level?"rowGroup":"category":null;let o=null;if(null!==n&&C[n]>=C[r]&&(o=`series '${n}' vs point '${r}'`),null!==l){const t=null!=n?n:r;C[l]>=C[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 i=/^\s*(\d+(?:\.\d+)?)\s*:\s*(\d+(?:\.\d+)?)\s*$/.exec(null!=t?t:"");if(null===i)return null;const e=Number(i[1]),s=Number(i[2]);return e<=0||s<=0?null:e/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 i=null===(t=this.prepareSize())||void 0===t?void 0:t.group;if(void 0===i||!this.pixelPerUnitGroupMap.has(i))return 0;const e=this.getEffectiveScaleFactor();return this.pixelPerUnitGroupMap.get(i)*e*e}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))]))),i=new Map(n.map((t=>[t,this.t("global.".concat(t))])));return new Map([...i.entries(),...t.entries()])}prepareStyle(){const t=this.getEffectiveScaleFactor();return this.componentStyle((i=>{const e=i.global.fontSizePx*t;return{scaleFactors:i["bn-chart-bubble"].scaleFactors,fontStyles:{font:`${e}px ${i.global.fontFamily}`,size:e,color:i.global.fontColor,background:i.global.fontBackgroundColor,leading:1.8},axisStyles:i["bn-chart-bubble"].axisStyles,seriesColors:i["bn-chart-bubble"].seriesColors,padding:i["bn-chart-bubble"].padding}}))}getEffectiveScaleFactor(){const{mode:t,factor:i}=u(this.scale);return"factor"===t?i:"auto"===t||"empty"===t?this.appliedScaleFactor:1}getFontStyles(){const t=this.getEffectiveScaleFactor();return this.componentStyle((i=>{var e,s,a,r;const n=(null===(e=i.global)||void 0===e?void 0:e.fontSizePx)||13.3333;return{"--bn-font-family":(null===(s=i.global)||void 0===s?void 0:s.fontFamily)||"'Noto Sans', sans-serif","--bn-font-size":n*t+"px","--bn-font-color":(null===(a=i.global)||void 0===a?void 0:a.fontColor)||"#000000","--bn-font-background":(null===(r=i.global)||void 0===r?void 0:r.fontBackgroundColor)||"#ffffff"}}))}getDataStructure(){const t={};for(const i of["ac","pp","fc","pl"])for(const e of[1,2,3,4])t[`${i}${e}`]={type:"number",isOptional:!0,description:""};const i={x:this.prepareAxis("x",this.x),y:this.prepareAxis("y",this.y),size:this.prepareSize(),share:this.prepareShare()};for(const[e,s]of Object.entries(i)){if(null===s)continue;const i=_(s.measure);null!==i&&("scenario"===i.kind?t[i.slot].description=`${e}: ${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)`))}const e=this.prepareCompareFamily();if(null!==e)for(const[s,a]of Object.entries(i)){if(null===a||"share"===s)continue;const i=_(a.measure);if(null!==i&&"scenario"===i.kind){const a=e+i.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),i=this.prepareAxis("y",this.y),e=this.prepareSize(),a=this.prepareShare(),r=this.prepareFacet();if(this.validateCrossProp([null==t?void 0:t.measure,null==i?void 0:i.measure,null==e?void 0:e.measure,null==a?void 0:a.measure],r),this.validateSizeScaling(),this.hasBlockingErrors()||null===t||null===i||null===e)return null;const n=this.preparePointLevel(),l=this.prepareI18n(),o=this.prepareStyle(),u=h(this.element).width;return s("ibcs-chart-bubble",{tableName:this.datasetName,dataVersion:this.dataVersion,chartTitle:this.chartTitle,x:t,y:i,size:e,share:a,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:u,ruleSetConfig:this.ruleSetConfig(),errors:this.errors,translate:this.translateForInner})}render(){return s(a,{key:"4191801f8d17e3241a9b681d9a7f0ab8a453bf64",style:this.getFontStyles()},s("div",{key:"a5284956b892a3647331532daae8d3251dbb6fad",class:"container"},this.chartTemplate()))}get element(){return r(this)}static get watchers(){return{x:[{validateX:0}],y:[{validateY:0}],size:[{validateSize:0}],share:[{validateShare:0}],compareWith:[{validateCompareWith:0}],level:[{validateLevel:0}],seriesLevel:[{validateSeriesLevel:0}],facet:[{validateFacet:0}],labels:[{validateLabels:0}],legend:[{validateLegend:0}],aspect:[{validateAspect:0}],limit:[{validateLimit:0}],scale:[{validateScale:0}]}}};z.style=":host{display:inline-block;position:relative;overflow:hidden}.container{display:flex;flex-direction:column}";export{z as bn_chart_bubble}
|
|
1
|
+
import{r as t,d as i,f as e,h as s,H as a,g as r}from"./p-B_d-jp99.js";import{a as n}from"./p-BgIpdpfH.js";import{w as l,a as o,g as h,p as u}from"./p-C9i1Xsib.js";import{w as c,o as d}from"./p-A8xyE4b1.js";import{i as p,a as v,w as m,b as f,c as g}from"./p-BpWWgN6k.js";import{w as y,a as b}from"./p-B4JfKvVT.js";import{w as x}from"./p-C8Q0lsaU.js";import{r as _,s as w}from"./p-eEfqksk-.js";import{t as $,a as R,b as E,c as S,d as L,e as A,p as j}from"./p-6lOdN-fB.js";import"./p-C5uvAEKI.js";const C={rowGroup:0,category:1,subCategory:2},O=["ac","pp","fc","pl"],z=class{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=>R(t))),this.validateSizeScaling()}validateShare(t){this.validateMeasureSpec("share",t,!1,(t=>E(t)))}validateCompareWith(t){const i="ERR_compareWith";p(t)||O.includes(t.trim().toLowerCase())?this.errors.remove(i):this.errors.addOrReplace({id:i,type:"warning",message:`compare-with: invalid value '${t}' — expected ${O.join("/")}; ignored.`})}validateLevel(t){const i="ERR_level",e=["auto","category","subcategory"];p(t)||e.includes(t.trim().toLowerCase())?this.errors.remove(i):this.errors.addOrReplace({id:i,type:"warning",message:`level: invalid value '${t}' — expected ${e.join("/")}; using 'auto'.`})}validateSeriesLevel(t){const i="ERR_seriesLevel",e=["auto","rowgroup","category","none"];p(t)||e.includes(t.trim().toLowerCase())?this.errors.remove(i):this.errors.addOrReplace({id:i,type:"warning",message:`series-level: invalid value '${t}' — expected ${e.join("/")}; using 'auto'.`})}validateFacet(t){this.validateObjectSpec("facet",t,(t=>S(t)))}validateLabels(t){this.validateObjectSpec("labels",t,(t=>L(t,this.labelDefaults())))}validateLegend(t){this.validateObjectSpec("legend",t,(t=>A(t)))}validateAspect(t){const i="ERR_aspect";p(t)||null!==this.parseAspect(t)?this.errors.remove(i):this.errors.addOrReplace({id:i,type:"warning",message:`aspect: invalid value '${t}' — expected "w:h" (e.g. "16:9"); using the default.`})}validateLimit(t){const i="ERR_limit";v(t)&&Number(t)>=0?this.errors.remove(i):this.errors.addOrReplace({id:i,type:"warning",message:`limit: invalid value '${t}' — expected a non-negative integer; using 0.`})}validateScale(t){const i="ERR_scale";if(p(t))return void this.errors.remove(i);const{mode:e,factor:s}=u(t);"factor"===e&&(void 0===s||s<=0)?this.errors.addOrReplace({id:i,type:"warning",message:`scale: invalid value '${t}' — expected none/auto or a positive number.`}):this.errors.remove(i)}constructor(i){t(this,i),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,i)=>this.t(t,i),m(this),y(this),l(this,(t=>{this.datasetName=(null==t?void 0:t.startsWith("$"))?t.substring(1):t||"",this.dataVersion=this.dataVersion+1}),((t,i)=>{this.datasetMeta=i})),this.errors=b(this),x(this),this.componentStyle=f(this),this.ruleSetConfig=c(this),this.t=o(this).t}componentWillLoad(){this.validateX(this.x),this.validateY(this.y),this.validateSize(this.size),this.validateShare(this.share),this.validateCompareWith(this.compareWith),this.validateLevel(this.level),this.validateSeriesLevel(this.seriesLevel),this.validateFacet(this.facet),this.validateLabels(this.labels),this.validateLegend(this.legend),this.validateAspect(this.aspect),this.validateLimit(this.limit),this.validateScale(this.scale)}componentDidRender(){const{mode:t}=u(this.scale);if("auto"!==t&&"empty"!==t){this._autoScaleGuard=!1;const t=h(this.element),i="WARN_overflow";return void(t.width>0&&this.element.scrollWidth>t.width+1?this.errors.addOrReplace({id:i,type:"warning",message:"Chart exceeds available space and will be cut off. Check the scale value."}):this.errors.remove(i))}if(this._autoScaleGuard)return void(this._autoScaleGuard=!1);const e=this.element,{width:s}=h(e);if(s<=0)return;this._lastObservedWidth=s;const a=this.componentStyle((t=>{var i;return(null===(i=t.global)||void 0===i?void 0:i.fontSizePx)||13.3333})),r=e.scrollWidth,n=this.appliedScaleFactor;if(!Number.isFinite(r)||r<=s+1)return void this.errors.remove("AUTO_scale");const l=Math.max(.3,n*(s-1)/r);Math.abs(l-n)<.01||(e.style.setProperty("--bn-font-size",a*l+"px"),"empty"===t?this.errors.addOrReplace({id:"AUTO_scale",type:"warning",message:`Auto-scaled chart by factor ${l.toFixed(3)}`}):this.errors.remove("AUTO_scale"),this._autoScaleGuard=!0,i((()=>{this.appliedScaleFactor=l})))}componentDidLoad(){this.layoutObserver=d(this.element,(()=>{if(this._autoScaleGuard)return;const{width:t}=h(this.element);t>0&&Math.abs(t-this._lastObservedWidth)>2&&(this._lastObservedWidth=t,e(this))})),requestAnimationFrame((()=>{requestAnimationFrame((()=>{if(this._autoScaleGuard)return;const{width:t}=h(this.element);this._lastObservedWidth=t,e(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,i){null===i?(this.errors.remove(t),this.activeErrors.delete(t)):(this.errors.addOrReplace({id:t,type:"error",message:i}),this.activeErrors.add(t))}hasBlockingErrors(){return this.activeErrors.size>0}validateSizeScaling(){var t;const i=null===(t=this.prepareSize())||void 0===t?void 0:t.group;this.setBlockingError("ERR_xy_scale_group",void 0===i||this.pixelPerUnitGroupMap.has(i)?null:this.t(".bubble-scale-group-unknown",{group:i}))}validateMeasureSpec(t,i,e,s){var a;const r=`ERR_xy_json_${t}`,n=`ERR_xy_measure_${t}`,l=`WARN_xy_fields_${t}`,{data:o,parseError:h}=j(i,"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,e?this.t(".xy-measure-invalid",{prop:t,measure:""}):null),void this.errors.remove(l);const u=null!==(a=o.measure)&&void 0!==a?a:"";g(u)?this.setBlockingError(n,null):this.setBlockingError(n,this.t(".xy-measure-invalid",{prop:t,measure:u})),this.reportSpecIssues(l,t,s(o))}validateObjectSpec(t,i,e){const s=`ERR_xy_json_${t}`,a=`WARN_xy_fields_${t}`,{data:r,parseError:n}=j(i,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,e(r)):this.errors.remove(a)}reportSpecIssues(t,i,e){const s=[];null!==e&&e.invalidFields.length>0&&s.push(`invalid: ${e.invalidFields.join(", ")}`),null!==e&&e.unknownKeys.length>0&&s.push(`unknown: ${e.unknownKeys.join(", ")}`),s.length>0?this.errors.addOrReplace({id:t,type:"warning",message:`${i}: ignored sub-fields (${s.join("; ")}).`}):this.errors.remove(t)}prepareAxis(t,i){const{data:e,parseError:s}=j(i,"measure");if(s||null===e)return null;const{config:a}=$(e);return null!==a&&g(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:i}=j(this.size,"measure");if(i||null===t)return null;const{config:e}=R(t);return null!==e&&g(e.measure)?e:null}prepareShare(){const{data:t,parseError:i}=j(this.share,"measure");if(i||null===t)return null;const{config:e}=E(t);return null!==e&&g(e.measure)?e:null}prepareCompareFamily(){var t;const i=null===(t=this.compareWith)||void 0===t?void 0:t.trim().toLowerCase();return O.includes(i)?i:null}prepareLabels(){const t=this.labelDefaults(),{data:i,parseError:e}=j(this.labels,null);return e||null===i?{points:t.points,values:t.values,max:t.max}:L(i,t).config}prepareLegend(){const{data:t,parseError:i}=j(this.legend,null);return i||null===t?{show:!0,position:"right"}:A(t).config}prepareFacet(){const{data:t,parseError:i}=j(this.facet,null);return i||null===t?null:S(t).config}preparePointLevel(){var t,i;const e=null===(t=this.level)||void 0===t?void 0:t.trim().toLowerCase();if("category"===e)return"category";if("subcategory"===e)return"subCategory";const s=null===(i=this.datasetMeta)||void 0===i?void 0:i.suggestedLevel;return"rowGroup"===s||"category"===s||"subCategory"===s?s:"category"}prepareSeriesLevel(t){var i;const e=null===(i=this.seriesLevel)||void 0===i?void 0:i.trim().toLowerCase();return"none"===e?null:"rowgroup"===e?"rowGroup":"category"===e||"subCategory"===t?"category":"category"===t?"rowGroup":null}validateCrossProp(t,i){const e=new Set;let s=!1;for(const i of t){if(void 0===i)continue;const t=_(i);null!==t&&("scenario"===t.kind?e.add(w(t.slot)):s=!0)}this.setBlockingError("ERR_xy_family",e.size>1?this.t(".xy-family-mixed",{families:[...e].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===e.size&&e.has(a)?`compare-with: '${a}' is already the primary scenario family.`:null);const r=this.preparePointLevel(),n=this.prepareSeriesLevel(r),l=null!==i?"rowgroup"===i.level?"rowGroup":"category":null;let o=null;if(null!==n&&C[n]>=C[r]&&(o=`series '${n}' vs point '${r}'`),null!==l){const t=null!=n?n:r;C[l]>=C[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 i=/^\s*(\d+(?:\.\d+)?)\s*:\s*(\d+(?:\.\d+)?)\s*$/.exec(null!=t?t:"");if(null===i)return null;const e=Number(i[1]),s=Number(i[2]);return e<=0||s<=0?null:e/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 i=null===(t=this.prepareSize())||void 0===t?void 0:t.group;if(void 0===i||!this.pixelPerUnitGroupMap.has(i))return 0;const e=this.getEffectiveScaleFactor();return this.pixelPerUnitGroupMap.get(i)*e*e}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))]))),i=new Map(n.map((t=>[t,this.t("global.".concat(t))])));return new Map([...i.entries(),...t.entries()])}prepareStyle(){const t=this.getEffectiveScaleFactor();return this.componentStyle((i=>{const e=i.global.fontSizePx*t;return{scaleFactors:i["bn-chart-bubble"].scaleFactors,fontStyles:{font:`${e}px ${i.global.fontFamily}`,size:e,color:i.global.fontColor,background:i.global.fontBackgroundColor,leading:1.8},axisStyles:i["bn-chart-bubble"].axisStyles,seriesColors:i["bn-chart-bubble"].seriesColors,padding:i["bn-chart-bubble"].padding}}))}getEffectiveScaleFactor(){const{mode:t,factor:i}=u(this.scale);return"factor"===t?i:"auto"===t||"empty"===t?this.appliedScaleFactor:1}getFontStyles(){const t=this.getEffectiveScaleFactor();return this.componentStyle((i=>{var e,s,a,r;const n=(null===(e=i.global)||void 0===e?void 0:e.fontSizePx)||13.3333;return{"--bn-font-family":(null===(s=i.global)||void 0===s?void 0:s.fontFamily)||"'Noto Sans', sans-serif","--bn-font-size":n*t+"px","--bn-font-color":(null===(a=i.global)||void 0===a?void 0:a.fontColor)||"#000000","--bn-font-background":(null===(r=i.global)||void 0===r?void 0:r.fontBackgroundColor)||"#ffffff"}}))}getDataStructure(){const t={};for(const i of["ac","pp","fc","pl"])for(const e of[1,2,3,4])t[`${i}${e}`]={type:"number",isOptional:!0,description:""};const i={x:this.prepareAxis("x",this.x),y:this.prepareAxis("y",this.y),size:this.prepareSize(),share:this.prepareShare()};for(const[e,s]of Object.entries(i)){if(null===s)continue;const i=_(s.measure);null!==i&&("scenario"===i.kind?t[i.slot].description=`${e}: ${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)`))}const e=this.prepareCompareFamily();if(null!==e)for(const[s,a]of Object.entries(i)){if(null===a||"share"===s)continue;const i=_(a.measure);if(null!==i&&"scenario"===i.kind){const a=e+i.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),i=this.prepareAxis("y",this.y),e=this.prepareSize(),a=this.prepareShare(),r=this.prepareFacet();if(this.validateCrossProp([null==t?void 0:t.measure,null==i?void 0:i.measure,null==e?void 0:e.measure,null==a?void 0:a.measure],r),this.validateSizeScaling(),this.hasBlockingErrors()||null===t||null===i||null===e)return null;const n=this.preparePointLevel(),l=this.prepareI18n(),o=this.prepareStyle(),u=h(this.element).width;return s("ibcs-chart-bubble",{tableName:this.datasetName,dataVersion:this.dataVersion,chartTitle:this.chartTitle,x:t,y:i,size:e,share:a,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:u,ruleSetConfig:this.ruleSetConfig(),errors:this.errors,translate:this.translateForInner})}render(){return s(a,{key:"4191801f8d17e3241a9b681d9a7f0ab8a453bf64",style:this.getFontStyles()},s("div",{key:"a5284956b892a3647331532daae8d3251dbb6fad",class:"container"},this.chartTemplate()))}get element(){return r(this)}static get watchers(){return{x:[{validateX:0}],y:[{validateY:0}],size:[{validateSize:0}],share:[{validateShare:0}],compareWith:[{validateCompareWith:0}],level:[{validateLevel:0}],seriesLevel:[{validateSeriesLevel:0}],facet:[{validateFacet:0}],labels:[{validateLabels:0}],legend:[{validateLegend:0}],aspect:[{validateAspect:0}],limit:[{validateLimit:0}],scale:[{validateScale:0}]}}};z.style=":host{display:inline-block;position:relative;overflow:hidden}.container{display:flex;flex-direction:column}";export{z as bn_chart_bubble}
|