@bino-bi/bn-template-engine 1.0.0-next.46 → 1.0.0-next.48
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/index.esm.js +1 -1
- package/dist/bn-template-engine/p-203e7d6a.entry.js +1 -0
- package/dist/bn-template-engine/{p-BnzIfgCq.js → p-3ktFZb1x.js} +1 -1
- package/dist/bn-template-engine/{p-21930d0a.entry.js → p-6ab684a9.entry.js} +1 -1
- package/dist/bn-template-engine/{p-B0MEAsAS.js → p-7pLJBHT2.js} +1 -1
- package/dist/bn-template-engine/{p-46c46067.entry.js → p-9a24e486.entry.js} +1 -1
- package/dist/bn-template-engine/p-BL07yV8P.js +1 -0
- package/dist/bn-template-engine/p-DXtYQE4s.js +1 -0
- package/dist/bn-template-engine/p-DY5fMUX8.js +1 -0
- package/dist/bn-template-engine/{p-BA-fydUt.js → p-Dvlw60RF.js} +1 -1
- package/dist/bn-template-engine/p-GstO_GU5.js +2 -0
- package/dist/bn-template-engine/p-a6017fce.entry.js +1 -0
- package/dist/bn-template-engine/{p-16623e0f.entry.js → p-b3f5eba0.entry.js} +1 -1
- package/dist/bn-template-engine/p-ddc1b2a9.entry.js +1 -0
- package/dist/bn-template-engine/p-hV2evPFR.js +1 -0
- package/dist/cjs/bn-annotation-layer_30.cjs.entry.js +58 -40
- package/dist/cjs/bn-grid.cjs.entry.js +6 -6
- package/dist/cjs/bn-image.cjs.entry.js +3 -3
- package/dist/cjs/bn-internationalization.cjs.entry.js +3 -3
- package/dist/cjs/bn-ruleset.cjs.entry.js +3 -3
- package/dist/cjs/bn-template-engine.cjs.js +2 -2
- package/dist/cjs/bn-text.cjs.entry.js +4 -4
- package/dist/cjs/index-CM6022qm.js +66 -0
- package/dist/cjs/{index-DGis1BzT.js → index-DwBbheYB.js} +2 -1
- package/dist/cjs/index.cjs.js +6 -14
- package/dist/cjs/loader.cjs.js +2 -2
- package/dist/cjs/{localFrame-C27GGom1.js → localFrame-C4RBw_zT.js} +1 -1
- package/dist/cjs/types-BngAWYMW.js +17 -0
- package/dist/cjs/{withBodyObserver-B78wzw3f.js → withBodyObserver-CIGVLQEB.js} +2 -2
- package/dist/cjs/{withHasError-0hW3-4mr.js → withHasError-CZFrIJw0.js} +1 -1
- package/dist/cjs/{withStyled-D0hrcfE_.js → withStyled-DHKHBdRb.js} +17 -6
- package/dist/cjs/{withTranslation-B4WipL_5.js → withTranslation-CLwC9a8V.js} +3 -3
- package/dist/collection/components/bn-chart-time/utils/TimeChart.js +3 -2
- package/dist/collection/components/bn-chart-time/utils/elements/AreaFill.js +1 -9
- package/dist/collection/components/bn-chart-time/utils/elements/LineSeries.js +1 -6
- package/dist/collection/components/bn-context/bn-context.js +86 -1
- package/dist/collection/components/bn-layout-page/bn-layout-page.js +1 -23
- package/dist/collection/components/bn-title/bn-title-renderer/bn-title-renderer.css +0 -10
- package/dist/collection/components/bn-title/bn-title-renderer/bn-title-renderer.js +1 -23
- package/dist/collection/components/bn-title/bn-title.js +1 -20
- package/dist/collection/index.js +1 -0
- package/dist/collection/utils/notation.js +56 -0
- package/dist/collection/utils/withComponentStyle.js +14 -4
- package/dist/components/bn-annotation-layer.js +1 -1
- package/dist/components/bn-annotation-list.js +1 -1
- package/dist/components/bn-asset.js +1 -1
- package/dist/components/bn-body.js +1 -1
- package/dist/components/bn-card.js +1 -1
- package/dist/components/bn-chart-bubble-renderer.js +1 -1
- package/dist/components/bn-chart-bubble.js +1 -1
- package/dist/components/bn-chart-bullet-renderer.js +1 -1
- package/dist/components/bn-chart-bullet.js +1 -1
- package/dist/components/bn-chart-scatter-renderer.js +1 -1
- package/dist/components/bn-chart-scatter.js +1 -1
- package/dist/components/bn-chart-structure-renderer.js +1 -1
- package/dist/components/bn-chart-structure.js +1 -1
- package/dist/components/bn-chart-time-renderer.js +1 -1
- package/dist/components/bn-chart-time.js +1 -1
- package/dist/components/bn-component-style.js +1 -1
- package/dist/components/bn-context.js +1 -1
- package/dist/components/bn-dataset.js +1 -1
- package/dist/components/bn-datasource.js +1 -1
- package/dist/components/bn-footer.js +1 -1
- package/dist/components/bn-grid.js +1 -1
- package/dist/components/bn-image.js +1 -1
- package/dist/components/bn-internationalization.js +1 -1
- package/dist/components/bn-layout-card.js +1 -1
- package/dist/components/bn-layout-page.js +1 -1
- package/dist/components/bn-message.js +1 -1
- package/dist/components/bn-page.js +1 -1
- package/dist/components/bn-ruleset.js +1 -1
- package/dist/components/bn-scaling-group.js +1 -1
- package/dist/components/bn-table-renderer.js +1 -1
- package/dist/components/bn-table.js +1 -1
- package/dist/components/bn-text.js +1 -1
- package/dist/components/bn-title-renderer.js +1 -1
- package/dist/components/bn-title.js +1 -1
- package/dist/components/bn-tree.js +1 -1
- package/dist/components/index.js +1 -1
- package/dist/components/{p-CgJB5mCu.js → p-2t-lysdb.js} +1 -1
- package/dist/components/{p-DkCeSWKR.js → p-4xaxuPVU.js} +1 -1
- package/dist/components/{p-Cxx0YNnl.js → p-6242qMx1.js} +1 -1
- package/dist/components/p-6gET6YXc.js +1 -0
- package/dist/components/p-B1_wkOLx.js +1 -0
- package/dist/components/p-BFWvVe7v.js +1 -0
- package/dist/components/{p-BuWNCnvR.js → p-BFoRIqDi.js} +1 -1
- package/dist/components/p-BP2sJ8k9.js +1 -0
- package/dist/components/{p-BzjGUtYh.js → p-BjgkgCAQ.js} +1 -1
- package/dist/components/p-BnmylmXF.js +2 -0
- package/dist/components/p-Bp5Xj4-s.js +1 -0
- package/dist/components/{p-Dq9dG0Kr.js → p-BrQCbmG0.js} +1 -1
- package/dist/components/{p-NBaq67dL.js → p-C-3TOa6K.js} +1 -1
- package/dist/components/{p-CFVoK5Rb.js → p-C8rpOS5t.js} +1 -1
- package/dist/components/{p-DQFahsnV.js → p-CG-iY7pQ.js} +1 -1
- package/dist/components/{p-EQNS13GN.js → p-CLjuZoiT.js} +1 -1
- package/dist/components/p-CUoPUIej.js +1 -0
- package/dist/components/p-CZzlLTQc.js +1 -0
- package/dist/components/p-ChpAMqbN.js +1 -0
- package/dist/components/{p-D_Sbhd0L.js → p-CmvpJzLd.js} +1 -1
- package/dist/components/{p-Be0Q3bvf.js → p-CrZ_O3DT.js} +1 -1
- package/dist/components/{p-eWxolPDU.js → p-CytMTBFu.js} +1 -1
- package/dist/components/{p-4vVbchX2.js → p-D32TsLzd.js} +1 -1
- package/dist/components/p-D3hr9wra.js +1 -0
- package/dist/components/{p-BXg3v5AO.js → p-DDo-fu3v.js} +1 -1
- package/dist/components/{p-B5tixDPM.js → p-DFybNETX.js} +1 -1
- package/dist/components/p-DMAaBt7n.js +1 -0
- package/dist/components/{p-DbWh9W5D.js → p-DRU71K0s.js} +1 -1
- package/dist/components/p-DRmphEA0.js +1 -0
- package/dist/components/{p-9mUU4itF.js → p-DUZCLRVu.js} +1 -1
- package/dist/components/p-DY5fMUX8.js +1 -0
- package/dist/components/p-D_K7tYhY.js +1 -0
- package/dist/components/{p-BrJZUp-K.js → p-DdvG1D18.js} +1 -1
- package/dist/components/{p-D9F5IBFT.js → p-Do4GqlMV.js} +1 -1
- package/dist/components/p-Dw3rv_Y9.js +1 -0
- package/dist/components/{p-BXXjh6We.js → p-Dyzb4ika.js} +1 -1
- package/dist/components/p-JG4Sx1lE.js +1 -0
- package/dist/components/p-TNX3alPU.js +1 -0
- package/dist/components/{p-BKTBdrEA.js → p-Uc0zvXcQ.js} +1 -1
- package/dist/components/p-VtNvNyZK.js +1 -0
- package/dist/components/{p-G56USTsQ.js → p-Zuxd3z0q.js} +1 -1
- package/dist/components/{p-DoOSXntC.js → p-dO0utE8m.js} +1 -1
- package/dist/components/{p-16rjcQ0t.js → p-j42D1yrQ.js} +1 -1
- package/dist/components/{p-B5GRtTLX.js → p-ja0FCkHB.js} +1 -1
- package/dist/esm/bn-annotation-layer_30.entry.js +47 -29
- package/dist/esm/bn-grid.entry.js +5 -5
- package/dist/esm/bn-image.entry.js +3 -3
- package/dist/esm/bn-internationalization.entry.js +3 -3
- package/dist/esm/bn-ruleset.entry.js +3 -3
- package/dist/esm/bn-template-engine.js +3 -3
- package/dist/esm/bn-text.entry.js +4 -4
- package/dist/esm/index-DZHir0Ol.js +60 -0
- package/dist/esm/{index-CCZcKl0Q.js → index-GstO_GU5.js} +2 -2
- package/dist/esm/index.js +2 -15
- package/dist/esm/loader.js +3 -3
- package/dist/esm/{localFrame-CEZ7-hBs.js → localFrame-WNu1bAPm.js} +1 -1
- package/dist/esm/types-DY5fMUX8.js +15 -0
- package/dist/esm/{withBodyObserver-D9yIMxdr.js → withBodyObserver-wJgSN1Pj.js} +2 -2
- package/dist/esm/{withHasError-UGtkLrYT.js → withHasError-BDWEBrrb.js} +1 -1
- package/dist/esm/{withStyled-BlMqEIfr.js → withStyled-CTZFjg4L.js} +17 -7
- package/dist/esm/{withTranslation-Bc3bjHTb.js → withTranslation-BESW5BNq.js} +3 -3
- package/dist/types/components/bn-context/bn-context.d.ts +25 -0
- package/dist/types/components/bn-layout-page/bn-layout-page.d.ts +0 -9
- package/dist/types/components/bn-title/bn-title-renderer/bn-title-renderer.d.ts +0 -2
- package/dist/types/components/bn-title/bn-title.d.ts +0 -5
- package/dist/types/components.d.ts +26 -21
- package/dist/types/index.d.ts +2 -0
- package/dist/types/utils/notation.d.ts +78 -0
- package/dist/types/utils/withComponentStyle.d.ts +6 -0
- package/package.json +1 -1
- package/dist/bn-template-engine/p-17970e07.entry.js +0 -1
- package/dist/bn-template-engine/p-9caa7f46.entry.js +0 -1
- package/dist/bn-template-engine/p-BEGt_7Hr.js +0 -1
- package/dist/bn-template-engine/p-BRO1oW7m.js +0 -1
- package/dist/bn-template-engine/p-CCZcKl0Q.js +0 -2
- package/dist/bn-template-engine/p-b0d528f2.entry.js +0 -1
- package/dist/components/p-9X5fVJqR.js +0 -1
- package/dist/components/p-BKA15uoz.js +0 -1
- package/dist/components/p-BKLq0Pbv.js +0 -1
- package/dist/components/p-BPGLOHUe.js +0 -1
- package/dist/components/p-Bd8cQiLx.js +0 -1
- package/dist/components/p-Bj3RWsEx.js +0 -1
- package/dist/components/p-BoBamuPt.js +0 -1
- package/dist/components/p-D6YGOYV1.js +0 -2
- package/dist/components/p-DROj8gke.js +0 -1
- package/dist/components/p-Do4oPrkE.js +0 -1
- package/dist/components/p-Dxj_pf8s.js +0 -1
- package/dist/components/p-DzYhS_9s.js +0 -1
- package/dist/components/p-OgFFKehL.js +0 -1
- package/dist/components/p-kvYRImZT.js +0 -1
- package/dist/components/p-rEdNIgD8.js +0 -1
- package/dist/components/p-uCpFBDF5.js +0 -1
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
export const NOTATION_API_VERSION = 1;
|
|
2
|
+
/** Dash pattern of a forecast line and of the year separator of the time chart. */
|
|
3
|
+
export const DASH_ARRAY = "4,4";
|
|
4
|
+
/**
|
|
5
|
+
* IBCS Color Schema for Line Chart:
|
|
6
|
+
* | Scenario | Marker Fill | Marker Stroke | Line Style |
|
|
7
|
+
* |----------|-------------|---------------|------------|
|
|
8
|
+
* | AC | Black | Black | Solid |
|
|
9
|
+
* | PP | Gray (#999) | Gray | Solid |
|
|
10
|
+
* | FC | White | Black | Dashed |
|
|
11
|
+
* | PL | White | Black | Solid |
|
|
12
|
+
*/
|
|
13
|
+
export const IBCS_LINE_STYLES = {
|
|
14
|
+
ac: { markerFill: "#000000", markerStroke: "#000000", lineColor: "#000000" },
|
|
15
|
+
pp: { markerFill: "#999999", markerStroke: "#999999", lineColor: "#999999" },
|
|
16
|
+
fc: { markerFill: "#ffffff", markerStroke: "#000000", lineColor: "#000000", lineDashArray: DASH_ARRAY },
|
|
17
|
+
pl: { markerFill: "#ffffff", markerStroke: "#000000", lineColor: "#000000" },
|
|
18
|
+
};
|
|
19
|
+
/**
|
|
20
|
+
* IBCS-style area fill colors for stacked area charts.
|
|
21
|
+
*/
|
|
22
|
+
export const SCENARIO_AREA_STYLES = {
|
|
23
|
+
ac: { fill: "#000000", opacity: 0.3, lineColor: "#000000" },
|
|
24
|
+
pp: { fill: "#999999", opacity: 0.3, lineColor: "#999999" },
|
|
25
|
+
fc: { fill: "#000000", opacity: 0.2, lineColor: "#000000", dashArray: DASH_ARRAY },
|
|
26
|
+
pl: { fill: "#000000", opacity: 0.1, lineColor: "#000000" },
|
|
27
|
+
};
|
|
28
|
+
const scenario = (style, key) => {
|
|
29
|
+
const line = IBCS_LINE_STYLES[key];
|
|
30
|
+
return {
|
|
31
|
+
bar: Object.assign({}, style["bn-chart-time"].barStyles[key]),
|
|
32
|
+
line: Object.assign({ color: line.lineColor }, (line.lineDashArray && { dashArray: line.lineDashArray })),
|
|
33
|
+
marker: { fill: line.markerFill, stroke: line.markerStroke },
|
|
34
|
+
area: Object.assign({}, SCENARIO_AREA_STYLES[key]),
|
|
35
|
+
};
|
|
36
|
+
};
|
|
37
|
+
/**
|
|
38
|
+
* Builds the notation from a merged style and the scaling group store.
|
|
39
|
+
* A group that was removed is still a key of the store, with no value.
|
|
40
|
+
*/
|
|
41
|
+
export function buildNotation(style, scalingGroups) {
|
|
42
|
+
const variance = style["bn-chart-time"].varianceStyles;
|
|
43
|
+
return {
|
|
44
|
+
apiVersion: NOTATION_API_VERSION,
|
|
45
|
+
fontFamily: style.global.fontFamily,
|
|
46
|
+
fontSizePx: style.global.fontSizePx,
|
|
47
|
+
scenarios: {
|
|
48
|
+
ac: scenario(style, "ac"),
|
|
49
|
+
pp: scenario(style, "pp"),
|
|
50
|
+
fc: scenario(style, "fc"),
|
|
51
|
+
pl: scenario(style, "pl"),
|
|
52
|
+
},
|
|
53
|
+
variance: { pos: Object.assign({}, variance.pos), neg: Object.assign({}, variance.neg), neu: Object.assign({}, variance.neu) },
|
|
54
|
+
scalingGroups: Object.fromEntries(Object.entries(scalingGroups).filter((entry) => entry[1] !== undefined)),
|
|
55
|
+
};
|
|
56
|
+
}
|
|
@@ -2,6 +2,19 @@ import { forceUpdate, getElement } from "@stencil/core";
|
|
|
2
2
|
import { getStores, clearStoresCache } from "../context/context-protocol";
|
|
3
3
|
import { runIfExisits } from "./utils";
|
|
4
4
|
import { merge } from "@corex/deepmerge";
|
|
5
|
+
/**
|
|
6
|
+
* Merges the three style layers: `_system`, then `_default`, then the style
|
|
7
|
+
* with the given name. Without a name, or with an unknown one, the result is
|
|
8
|
+
* `_system` and `_default`.
|
|
9
|
+
*/
|
|
10
|
+
export const mergeStyleLayers = (state, selectedStyle) =>
|
|
11
|
+
// Arrays overwrite instead of concatenating: ordered color lists like
|
|
12
|
+
// seriesColors/stackColors must be replaced wholesale by an override.
|
|
13
|
+
merge([
|
|
14
|
+
state["_system"] || {},
|
|
15
|
+
state["_default"] || {},
|
|
16
|
+
(selectedStyle !== undefined && state[selectedStyle]) || {},
|
|
17
|
+
], { arrayMergeType: "overwrite" });
|
|
5
18
|
/**
|
|
6
19
|
* Mixin that provides themed styling to a Stencil component using a
|
|
7
20
|
* three-layer merge strategy.
|
|
@@ -26,10 +39,7 @@ const withComponentStyle = (component) => {
|
|
|
26
39
|
let selectedStyle;
|
|
27
40
|
let style;
|
|
28
41
|
const updateStyle = () => {
|
|
29
|
-
|
|
30
|
-
// Arrays overwrite instead of concatenating: ordered color lists like
|
|
31
|
-
// seriesColors/stackColors must be replaced wholesale by an override.
|
|
32
|
-
style = merge([state["_system"] || {}, state["_default"] || {}, state[selectedStyle] || {}], { arrayMergeType: "overwrite" });
|
|
42
|
+
style = mergeStyleLayers(stores.componentStyles.state, selectedStyle);
|
|
33
43
|
};
|
|
34
44
|
const connectedCallback = component["connectedCallback"];
|
|
35
45
|
component["connectedCallback"] = () => {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{p as t,t as e,H as n,h as i,a as o}from"./p-D6YGOYV1.js";import{g as s}from"./p-Cxx0YNnl.js";import{a as r,c as a,b as l}from"./p-CFVoK5Rb.js";import{w as h,C as c}from"./p-Dq9dG0Kr.js";import{w as u}from"./p-9X5fVJqR.js";import{w as d}from"./p-4vVbchX2.js";const b=t=>({x:t.x+t.width/2,y:t.y+t.height/2});function f(t,e){const n=b(t),i=e.x-n.x,o=e.y-n.y,s=Math.min(0===i?1/0:t.width/2/Math.abs(i),0===o?1/0:t.height/2/Math.abs(o));return Number.isFinite(s)?{x:n.x+i*s,y:n.y+o*s}:n}function m(t,e){return e?Object.assign(Object.assign({},t),{cx:Math.max(t.r,Math.min(t.cx,e.width-t.r)),cy:Math.max(t.r,Math.min(t.cy,e.height-t.r))}):t}const v=(t,e)=>t.x<e.x+e.width&&e.x<t.x+t.width&&t.y<e.y+e.height&&e.y<t.y+t.height;function y(t,e,n,i){var o,s,r;const a=.25*n,l=t.y+t.height/2,h=null!==(o=i.obstacles)&&void 0!==o?o:[],c=t=>{const n={x:t-e,y:l-e,width:2*e,height:2*e},o=i.area;return(!o||n.x>=0&&n.x+n.width<=o.width)&&!h.some((t=>v(n,t)))},u=t.x+t.width,d=t.x-a-e,b=u+a+e;if(c(d))return{x:d,y:l,r:e};if(c(b))return{x:b,y:l,r:e};const f=2*(e+a),m=h.filter((t=>t.y<l&&t.y+t.height>l)),y=Math.max(0,t.x-f,...m.filter((e=>e.x+e.width<=t.x)).map((t=>t.x+t.width))),p=Math.min(null!==(r=null===(s=i.area)||void 0===s?void 0:s.width)&&void 0!==r?r:1/0,u+f,...m.filter((t=>t.x>=u)).map((t=>t.x))),g=t.x-y,w=p-u;return{x:w>=g?u+w/2:t.x-g/2,y:l,r:Math.min(e,Math.max(Math.max(g,w)/2,.3*n))}}function p(t,e,n,i,o={}){var s;const{label:r,color:a}=t,{whole:l,area:h,text:c}=o,u=!l&&!c&&null!=o.obstacles,d=((t,e)=>t?Math.min(e,t.height/1.3):e)(null!=c?c:u?e:void 0,i);if("arrow"===t.mark){if(!n)return;const t=b(e),o=b(n);if(t.x===o.x&&t.y===o.y)return;let s=f(e,o),l=f(n,t);(l.x-s.x)*(o.x-t.x)+(l.y-s.y)*(o.y-t.y)<=0&&(s=t,l=o);const c=Math.hypot(l.x-s.x,l.y-s.y),u=Math.min(.8*i,c),d=(l.x-s.x)/c,v=(l.y-s.y)/c,y=l.x-d*u,p=l.y-v*u,g=.35*i;return{kind:"arrow",color:a,x1:s.x,y1:s.y,x2:y,y2:p,head:[`${l.x},${l.y}`,`${y-v*g},${p+d*g}`,`${y+v*g},${p-d*g}`].join(" "),badge:null!=r?m({cx:s.x,cy:s.y,r:.65*i,label:r},h):void 0}}if("frame"===t.mark){const n=null!=c?c:e,o=null===(s=t.point)||void 0===s?void 0:s.part,u=!l&&(null!=c||"label"===o||"total"===o),b=(u?.45:.2)*d,f=(u?.1:.2)*d,v=u?Math.max(n.width,n.height):n.width,y=n.x+n.width/2,p=1,g=Math.max(h?p:-1/0,y-v/2-b),w=Math.max(h?p:-1/0,n.y-f),x=Math.min(h?h.width-p:1/0,y+v/2+b),M=Math.min(h?h.height-p:1/0,n.y+n.height+f),k=Math.min(x-g,M-w)/2,S=l?.25*i:k,$=l?.25*i:u?Math.min((x-g)/2,1.6*k):k,O=1-Math.SQRT1_2,j=.65*d,C=u?.6*j:0;return{kind:"frame",color:a,x:g,y:w,width:x-g,height:M-w,rx:$,ry:S,badge:null!=r?m({cx:x-$*O+C,cy:w+S*O-C,r:j,label:r},h):void 0}}if(c&&!l){const t=y(c,(null==r?.4:.65)*d,d,o);return{kind:"marker",color:a,badge:m({cx:t.x,cy:t.y,r:t.r,label:r},h)}}const p=(null==r?.4:.75)*d,g=u?Math.min(p,e.height/2):p,w=l?{x:e.x+e.width-g,y:e.y+g}:b(e);if(u){const t={x:w.x-g,y:w.y-g,width:2*g,height:2*g},e=o.obstacles.find((e=>v(t,e)));if(e){const t=y(e,g,d,o);return{kind:"marker",color:a,badge:m({cx:t.x,cy:t.y,r:t.r,label:r},h)}}}return{kind:"marker",color:a,badge:m({cx:w.x,cy:w.y,r:g,label:r},h)}}const g=["rowGroup","category","subCategory","date","scenario","row"];function w(t,e){const n=e.getBoundingClientRect();if(0===n.width||0===n.height)return!0;const i=t.x+t.width/2,o=t.y+t.height/2;return i>=n.left&&i<=n.right&&o>=n.top&&o<=n.bottom}const x=new Set(["bn-asset","bn-component-style","bn-dataset","bn-datasource","bn-internationalization","bn-ruleset","bn-scaling-group"]);function M(t,e){const n=e.getBoundingClientRect();return 0===n.width||0===n.height||t.x<n.right&&t.x+t.width>n.left&&t.y<n.bottom&&t.y+t.height>n.top}const k=t(class extends n{constructor(t){super(),!1!==t&&this.__registerHost(),this.__attachShadow(),this.marks=[],this.pageKey="",this.parsedItems=[],this.scheduled=!1,this.run=0,this.observed=new WeakSet,this.observedAround=new WeakSet,this.reported=new Set,this.schedule=()=>{this.scheduled||(this.scheduled=!0,this.holdStatus(new Promise((t=>{requestAnimationFrame((()=>{this.scheduled=!1,this.place().catch((t=>console.error("bn-annotation-layer: placing the marks failed",t))).finally(t)}))}))))},this.holdStatus=h(this),this.errors=d(this),this.componentStyle=u(this)}connectedCallback(){var t;this.stores=s(this.element),this.pageKey=r(this.element),this.observed=new WeakSet,this.observedAround=new WeakSet,this.resizeObserver=new ResizeObserver(this.schedule),this.mutationObserver=new MutationObserver(this.schedule),this.observeSize(this.element);const e=this.element.closest("bn-layout-page");e&&this.mutationObserver.observe(e,{childList:!0,subtree:!0,attributes:!0,attributeFilter:["slot","data-bino-annotation-target"]}),null===(t=document.fonts)||void 0===t||t.addEventListener("loadingdone",this.schedule)}disconnectedCallback(){var t,e,n,i;null===(t=this.resizeObserver)||void 0===t||t.disconnect(),null===(e=this.mutationObserver)||void 0===e||e.disconnect(),null===(n=document.fonts)||void 0===n||n.removeEventListener("loadingdone",this.schedule),this.run++,(null===(i=this.stores)||void 0===i?void 0:i.annotationsUnplaced.state[this.pageKey])&&this.stores.annotationsUnplaced.set(this.pageKey,void 0)}componentWillLoad(){this.parseItems()}componentDidLoad(){this.schedule()}onItemsChange(){this.parseItems(),this.schedule()}parseItems(){const t=a(this.items);t?this.errors.remove("ERR_items"):this.errors.addOrReplace({id:"ERR_items",type:"error",message:"items: not a JSON array of objects."}),this.parsedItems=null!=t?t:[]}async place(){var t;const e=++this.run;if(!this.element.isConnected||!this.svg)return;const n=this.element.closest("bn-layout-page"),i=new Map,o=new Map;null==n||n.querySelectorAll("[data-bino-annotation-target]").forEach((t=>{const e=Array.from(t.querySelectorAll("*")).find((t=>t.localName.startsWith("bn-")&&!x.has(t.localName))),n=null!=e?e:t;i.set(t.getAttribute("data-bino-annotation-target"),n),o.set(n,t)})),null==n||n.querySelectorAll("[slot]").forEach((t=>this.observeSize(t)));const s=new Set(this.parsedItems.flatMap((t=>[t.target,t.to]))),r=[...i].filter((([t])=>s.has(t))).map((([,t])=>t));if(await Promise.all(r.map((t=>{var e;return null===(e=t.componentOnReady)||void 0===e?void 0:e.call(t)}))),e!==this.run)return;r.forEach((t=>{this.observe(t),this.observeAround(t,n)}));const a=new Map;if(await Promise.all(r.map((async t=>{var e;a.set(t,await(null===(e=t.getLayoutState)||void 0===e?void 0:e.call(t,{detail:"full"}).catch((()=>{}))))}))),e!==this.run)return;const l=(t,e)=>{var n;const s=null!=t?i.get(t):void 0;if(!s)return{problem:`no target "${t}" on this page`};const r=s.getBoundingClientRect();if(function(t){return!t||g.every((e=>null==t[e]))&&null==t.part}(e)){const e={x:r.left,y:r.top,width:r.width,height:r.height};return function(t,e,n){if(0===t.width||0===t.height||!M(t,n))return!0;for(let n=e;n&&"bn-layout-page"!==n.localName;n=n.parentElement)if(!M(t,n))return!0;return!1}(e,o.get(s),this.element)?{problem:`"${t}" cannot be seen`}:{box:e,whole:!0}}const l=a.get(s),h=l?function(t,e){var n;const i=t.table&&null==e.scenario?t.table.rows:null!==(n=t.elements)&&void 0!==n?n:[],o=null!=t.table&&null==e.subCategory;return i.filter((t=>function(t,e){var n;return!(!t||t.part!==(null!==(n=e.part)&&void 0!==n?n:"element"))&&g.every((n=>null==e[n]||e[n]+""===t[n]))}(t.point,e)&&!(o&&null!=t.point.subCategory))).map((({rect:t,content:e,contentSign:n})=>({rect:t,content:e,contentSign:n})))}(l,e):[];if(1!==h.length)return{problem:`${h.length} elements match the point ${JSON.stringify(e)} in "${t}"`};const c=({component:{x:t,y:e,width:n,height:i}})=>({x:r.left+t,y:r.top+e,width:n,height:i}),u=c(h[0].rect);if(function(t,e){for(let n=e;n&&"bn-layout-page"!==n.localName;n=n.parentElement)if(!w(t,n))return!0;return!1}(u,o.get(s))||!w(u,this.element))return{problem:`the point ${JSON.stringify(e)} in "${t}" is cut off`};const d=h[0].content;if(!l.table)return{box:u,whole:!1};const b=(null!==(n=l.elements)&&void 0!==n?n:[]).flatMap((t=>"cell"===t.kind&&t.content?[{box:c(t.content),sign:t.contentSign}]:[]));return{box:u,whole:!1,text:d&&{box:c(d),sign:h[0].contentSign},obstacles:b}},h=this.toLocalSpace(),c=({box:t,sign:e=0})=>{const n=h(t);return Object.assign(Object.assign({},n),{x:n.x-e,width:n.width+e})},u=parseFloat(getComputedStyle(this.svg).fontSize)||13.3333,d={width:this.element.clientWidth,height:this.element.clientHeight},b=[],f=[];for(const e of this.parsedItems){const n=l(e.target,e.point),i="arrow"===e.mark?l(e.to,e.toPoint):void 0,o="problem"in n?n:i&&"problem"in i?i:void 0;if(o){f.push({item:e,problem:o.problem});continue}const s=n,r=i,a=p(e,h(s.box),r&&h(r.box),u,{whole:s.whole,area:d,text:s.text&&c(s.text),obstacles:null===(t=s.obstacles)||void 0===t?void 0:t.map(c)});a?b.push(a):f.push({item:e,problem:"an arrow needs two ends at different places"})}this.marks=b,this.storeUnplaced(f.flatMap((({item:t})=>null!=t.label?[t.label]:[]))),f.length>0&&this.reportWhenQuiet(e,f)}async reportWhenQuiet(t,e){let n=0;for(let e=0;e<50&&n<2;e++){if(await new Promise((t=>window.setTimeout(t,200))),t!==this.run)return;n=0===c.componentRegisterStatus().running?n+1:0}this.report(e)}report(t){var e,n;for(const{item:i,problem:o}of t){const t=`bn-annotation-layer: ${null!==(e=i.mark)&&void 0!==e?e:"marker"} ${null!==(n=i.label)&&void 0!==n?n:"without a number"} is not drawn: ${o}.`;this.reported.has(t)||(this.reported.add(t),console.warn(t))}}toLocalSpace(){var t;const e=null===(t=this.svg.getScreenCTM())||void 0===t?void 0:t.inverse();return t=>{if(!e)return t;const n=[[t.x,t.y],[t.x+t.width,t.y+t.height]].map((([t,n])=>new DOMPoint(t,n).matrixTransform(e)));return{x:Math.min(n[0].x,n[1].x),y:Math.min(n[0].y,n[1].y),width:Math.abs(n[1].x-n[0].x),height:Math.abs(n[1].y-n[0].y)}}}storeUnplaced(t){var e,n;const i=null===(e=this.stores)||void 0===e?void 0:e.annotationsUnplaced,o=null!==(n=null==i?void 0:i.state[this.pageKey])&&void 0!==n?n:[];i&&JSON.stringify(o)!==JSON.stringify(t)&&i.set(this.pageKey,t)}observe(t){this.observeSize(t);const e=t=>{var n;t&&(this.observed.has(t)||(this.observed.add(t),null===(n=this.mutationObserver)||void 0===n||n.observe(t,{childList:!0,subtree:!0,characterData:!0,attributes:!0,attributeFilter:["x","y","width","height","transform","style","class"]})),t.querySelectorAll("*").forEach((t=>e(t.shadowRoot))))};e(t.shadowRoot)}observeAround(t,e){var n,i;for(let o=t.parentElement;o&&o!==e;o=o.parentElement)this.observedAround.has(o)||(this.observedAround.add(o),null===(n=this.mutationObserver)||void 0===n||n.observe(o,{attributes:!0,attributeFilter:["style"]}),o.shadowRoot&&(null===(i=this.mutationObserver)||void 0===i||i.observe(o.shadowRoot,{childList:!0,subtree:!0,attributes:!0,attributeFilter:["style","class"]})))}observeSize(t){var e;this.observed.has(t)||(this.observed.add(t),null===(e=this.resizeObserver)||void 0===e||e.observe(t))}renderBadge(t,e){return t?i("g",null,i("circle",{cx:t.cx,cy:t.cy,r:t.r,style:{fill:e}}),null!=t.label?i("text",{class:"badge-text",x:t.cx,y:t.cy,style:{fontSize:1.1*t.r+"px"}},t.label):null):null}renderMark(t){var e,n;const o=l(t.color,this.componentStyle((t=>t["bn-annotation"])));return"marker"===t.kind?i("g",{class:"mark marker","data-label":t.badge.label},this.renderBadge(t.badge,o)):"frame"===t.kind?i("g",{class:"mark frame","data-label":null===(e=t.badge)||void 0===e?void 0:e.label},i("rect",{x:t.x,y:t.y,width:t.width,height:t.height,rx:t.rx,ry:t.ry,style:{fill:"none",stroke:o,strokeWidth:"1.5"}}),this.renderBadge(t.badge,o)):i("g",{class:"mark arrow","data-label":null===(n=t.badge)||void 0===n?void 0:n.label},i("line",{x1:t.x1,y1:t.y1,x2:t.x2,y2:t.y2,style:{stroke:o,strokeWidth:"1.5"}}),i("polygon",{points:t.head,style:{fill:o}}),this.renderBadge(t.badge,o))}render(){return i(o,{key:"d4d027728ae578a5ced829a3f86f0137530551fc"},i("svg",{key:"a3813930e420db9fdd618bc38c38941295cf4c22",ref:t=>this.svg=t},this.marks.map((t=>this.renderMark(t)))))}get element(){return this}static get watchers(){return{items:[{onItemsChange:0}]}}static get style(){return':host{position:absolute;inset:0;z-index:1;display:block;pointer-events:none;font-family:var(--bn-font-family, "Noto Sans", sans-serif);font-size:var(--bn-font-size, 13.3333px)}svg{position:absolute;inset:0;width:100%;height:100%;overflow:visible}.badge-text{fill:#ffffff;font-weight:bold;text-anchor:middle;dominant-baseline:central}'}},[1,"bn-annotation-layer",{items:[1],selectedStyle:[513,"selected-style"],marks:[32]},void 0,{items:[{onItemsChange:0}]}]),S=k,$=function(){"undefined"!=typeof customElements&&["bn-annotation-layer"].forEach((t=>{"bn-annotation-layer"===t&&(customElements.get(e(t))||customElements.define(e(t),k))}))};export{S as BnAnnotationLayer,$ as defineCustomElement}
|
|
1
|
+
import{p as t,t as e,H as n,h as i,d as o}from"./p-BnmylmXF.js";import{g as s}from"./p-6242qMx1.js";import{a as r,c as a,b as l}from"./p-C8rpOS5t.js";import{w as h,C as c}from"./p-BrQCbmG0.js";import{w as u}from"./p-JG4Sx1lE.js";import{w as d}from"./p-D32TsLzd.js";const b=t=>({x:t.x+t.width/2,y:t.y+t.height/2});function f(t,e){const n=b(t),i=e.x-n.x,o=e.y-n.y,s=Math.min(0===i?1/0:t.width/2/Math.abs(i),0===o?1/0:t.height/2/Math.abs(o));return Number.isFinite(s)?{x:n.x+i*s,y:n.y+o*s}:n}function m(t,e){return e?Object.assign(Object.assign({},t),{cx:Math.max(t.r,Math.min(t.cx,e.width-t.r)),cy:Math.max(t.r,Math.min(t.cy,e.height-t.r))}):t}const v=(t,e)=>t.x<e.x+e.width&&e.x<t.x+t.width&&t.y<e.y+e.height&&e.y<t.y+t.height;function y(t,e,n,i){var o,s,r;const a=.25*n,l=t.y+t.height/2,h=null!==(o=i.obstacles)&&void 0!==o?o:[],c=t=>{const n={x:t-e,y:l-e,width:2*e,height:2*e},o=i.area;return(!o||n.x>=0&&n.x+n.width<=o.width)&&!h.some((t=>v(n,t)))},u=t.x+t.width,d=t.x-a-e,b=u+a+e;if(c(d))return{x:d,y:l,r:e};if(c(b))return{x:b,y:l,r:e};const f=2*(e+a),m=h.filter((t=>t.y<l&&t.y+t.height>l)),y=Math.max(0,t.x-f,...m.filter((e=>e.x+e.width<=t.x)).map((t=>t.x+t.width))),p=Math.min(null!==(r=null===(s=i.area)||void 0===s?void 0:s.width)&&void 0!==r?r:1/0,u+f,...m.filter((t=>t.x>=u)).map((t=>t.x))),g=t.x-y,w=p-u;return{x:w>=g?u+w/2:t.x-g/2,y:l,r:Math.min(e,Math.max(Math.max(g,w)/2,.3*n))}}function p(t,e,n,i,o={}){var s;const{label:r,color:a}=t,{whole:l,area:h,text:c}=o,u=!l&&!c&&null!=o.obstacles,d=((t,e)=>t?Math.min(e,t.height/1.3):e)(null!=c?c:u?e:void 0,i);if("arrow"===t.mark){if(!n)return;const t=b(e),o=b(n);if(t.x===o.x&&t.y===o.y)return;let s=f(e,o),l=f(n,t);(l.x-s.x)*(o.x-t.x)+(l.y-s.y)*(o.y-t.y)<=0&&(s=t,l=o);const c=Math.hypot(l.x-s.x,l.y-s.y),u=Math.min(.8*i,c),d=(l.x-s.x)/c,v=(l.y-s.y)/c,y=l.x-d*u,p=l.y-v*u,g=.35*i;return{kind:"arrow",color:a,x1:s.x,y1:s.y,x2:y,y2:p,head:[`${l.x},${l.y}`,`${y-v*g},${p+d*g}`,`${y+v*g},${p-d*g}`].join(" "),badge:null!=r?m({cx:s.x,cy:s.y,r:.65*i,label:r},h):void 0}}if("frame"===t.mark){const n=null!=c?c:e,o=null===(s=t.point)||void 0===s?void 0:s.part,u=!l&&(null!=c||"label"===o||"total"===o),b=(u?.45:.2)*d,f=(u?.1:.2)*d,v=u?Math.max(n.width,n.height):n.width,y=n.x+n.width/2,p=1,g=Math.max(h?p:-1/0,y-v/2-b),w=Math.max(h?p:-1/0,n.y-f),x=Math.min(h?h.width-p:1/0,y+v/2+b),M=Math.min(h?h.height-p:1/0,n.y+n.height+f),k=Math.min(x-g,M-w)/2,S=l?.25*i:k,$=l?.25*i:u?Math.min((x-g)/2,1.6*k):k,O=1-Math.SQRT1_2,j=.65*d,C=u?.6*j:0;return{kind:"frame",color:a,x:g,y:w,width:x-g,height:M-w,rx:$,ry:S,badge:null!=r?m({cx:x-$*O+C,cy:w+S*O-C,r:j,label:r},h):void 0}}if(c&&!l){const t=y(c,(null==r?.4:.65)*d,d,o);return{kind:"marker",color:a,badge:m({cx:t.x,cy:t.y,r:t.r,label:r},h)}}const p=(null==r?.4:.75)*d,g=u?Math.min(p,e.height/2):p,w=l?{x:e.x+e.width-g,y:e.y+g}:b(e);if(u){const t={x:w.x-g,y:w.y-g,width:2*g,height:2*g},e=o.obstacles.find((e=>v(t,e)));if(e){const t=y(e,g,d,o);return{kind:"marker",color:a,badge:m({cx:t.x,cy:t.y,r:t.r,label:r},h)}}}return{kind:"marker",color:a,badge:m({cx:w.x,cy:w.y,r:g,label:r},h)}}const g=["rowGroup","category","subCategory","date","scenario","row"];function w(t,e){const n=e.getBoundingClientRect();if(0===n.width||0===n.height)return!0;const i=t.x+t.width/2,o=t.y+t.height/2;return i>=n.left&&i<=n.right&&o>=n.top&&o<=n.bottom}const x=new Set(["bn-asset","bn-component-style","bn-dataset","bn-datasource","bn-internationalization","bn-ruleset","bn-scaling-group"]);function M(t,e){const n=e.getBoundingClientRect();return 0===n.width||0===n.height||t.x<n.right&&t.x+t.width>n.left&&t.y<n.bottom&&t.y+t.height>n.top}const k=t(class extends n{constructor(t){super(),!1!==t&&this.__registerHost(),this.__attachShadow(),this.marks=[],this.pageKey="",this.parsedItems=[],this.scheduled=!1,this.run=0,this.observed=new WeakSet,this.observedAround=new WeakSet,this.reported=new Set,this.schedule=()=>{this.scheduled||(this.scheduled=!0,this.holdStatus(new Promise((t=>{requestAnimationFrame((()=>{this.scheduled=!1,this.place().catch((t=>console.error("bn-annotation-layer: placing the marks failed",t))).finally(t)}))}))))},this.holdStatus=h(this),this.errors=d(this),this.componentStyle=u(this)}connectedCallback(){var t;this.stores=s(this.element),this.pageKey=r(this.element),this.observed=new WeakSet,this.observedAround=new WeakSet,this.resizeObserver=new ResizeObserver(this.schedule),this.mutationObserver=new MutationObserver(this.schedule),this.observeSize(this.element);const e=this.element.closest("bn-layout-page");e&&this.mutationObserver.observe(e,{childList:!0,subtree:!0,attributes:!0,attributeFilter:["slot","data-bino-annotation-target"]}),null===(t=document.fonts)||void 0===t||t.addEventListener("loadingdone",this.schedule)}disconnectedCallback(){var t,e,n,i;null===(t=this.resizeObserver)||void 0===t||t.disconnect(),null===(e=this.mutationObserver)||void 0===e||e.disconnect(),null===(n=document.fonts)||void 0===n||n.removeEventListener("loadingdone",this.schedule),this.run++,(null===(i=this.stores)||void 0===i?void 0:i.annotationsUnplaced.state[this.pageKey])&&this.stores.annotationsUnplaced.set(this.pageKey,void 0)}componentWillLoad(){this.parseItems()}componentDidLoad(){this.schedule()}onItemsChange(){this.parseItems(),this.schedule()}parseItems(){const t=a(this.items);t?this.errors.remove("ERR_items"):this.errors.addOrReplace({id:"ERR_items",type:"error",message:"items: not a JSON array of objects."}),this.parsedItems=null!=t?t:[]}async place(){var t;const e=++this.run;if(!this.element.isConnected||!this.svg)return;const n=this.element.closest("bn-layout-page"),i=new Map,o=new Map;null==n||n.querySelectorAll("[data-bino-annotation-target]").forEach((t=>{const e=Array.from(t.querySelectorAll("*")).find((t=>t.localName.startsWith("bn-")&&!x.has(t.localName))),n=null!=e?e:t;i.set(t.getAttribute("data-bino-annotation-target"),n),o.set(n,t)})),null==n||n.querySelectorAll("[slot]").forEach((t=>this.observeSize(t)));const s=new Set(this.parsedItems.flatMap((t=>[t.target,t.to]))),r=[...i].filter((([t])=>s.has(t))).map((([,t])=>t));if(await Promise.all(r.map((t=>{var e;return null===(e=t.componentOnReady)||void 0===e?void 0:e.call(t)}))),e!==this.run)return;r.forEach((t=>{this.observe(t),this.observeAround(t,n)}));const a=new Map;if(await Promise.all(r.map((async t=>{var e;a.set(t,await(null===(e=t.getLayoutState)||void 0===e?void 0:e.call(t,{detail:"full"}).catch((()=>{}))))}))),e!==this.run)return;const l=(t,e)=>{var n;const s=null!=t?i.get(t):void 0;if(!s)return{problem:`no target "${t}" on this page`};const r=s.getBoundingClientRect();if(function(t){return!t||g.every((e=>null==t[e]))&&null==t.part}(e)){const e={x:r.left,y:r.top,width:r.width,height:r.height};return function(t,e,n){if(0===t.width||0===t.height||!M(t,n))return!0;for(let n=e;n&&"bn-layout-page"!==n.localName;n=n.parentElement)if(!M(t,n))return!0;return!1}(e,o.get(s),this.element)?{problem:`"${t}" cannot be seen`}:{box:e,whole:!0}}const l=a.get(s),h=l?function(t,e){var n;const i=t.table&&null==e.scenario?t.table.rows:null!==(n=t.elements)&&void 0!==n?n:[],o=null!=t.table&&null==e.subCategory;return i.filter((t=>function(t,e){var n;return!(!t||t.part!==(null!==(n=e.part)&&void 0!==n?n:"element"))&&g.every((n=>null==e[n]||e[n]+""===t[n]))}(t.point,e)&&!(o&&null!=t.point.subCategory))).map((({rect:t,content:e,contentSign:n})=>({rect:t,content:e,contentSign:n})))}(l,e):[];if(1!==h.length)return{problem:`${h.length} elements match the point ${JSON.stringify(e)} in "${t}"`};const c=({component:{x:t,y:e,width:n,height:i}})=>({x:r.left+t,y:r.top+e,width:n,height:i}),u=c(h[0].rect);if(function(t,e){for(let n=e;n&&"bn-layout-page"!==n.localName;n=n.parentElement)if(!w(t,n))return!0;return!1}(u,o.get(s))||!w(u,this.element))return{problem:`the point ${JSON.stringify(e)} in "${t}" is cut off`};const d=h[0].content;if(!l.table)return{box:u,whole:!1};const b=(null!==(n=l.elements)&&void 0!==n?n:[]).flatMap((t=>"cell"===t.kind&&t.content?[{box:c(t.content),sign:t.contentSign}]:[]));return{box:u,whole:!1,text:d&&{box:c(d),sign:h[0].contentSign},obstacles:b}},h=this.toLocalSpace(),c=({box:t,sign:e=0})=>{const n=h(t);return Object.assign(Object.assign({},n),{x:n.x-e,width:n.width+e})},u=parseFloat(getComputedStyle(this.svg).fontSize)||13.3333,d={width:this.element.clientWidth,height:this.element.clientHeight},b=[],f=[];for(const e of this.parsedItems){const n=l(e.target,e.point),i="arrow"===e.mark?l(e.to,e.toPoint):void 0,o="problem"in n?n:i&&"problem"in i?i:void 0;if(o){f.push({item:e,problem:o.problem});continue}const s=n,r=i,a=p(e,h(s.box),r&&h(r.box),u,{whole:s.whole,area:d,text:s.text&&c(s.text),obstacles:null===(t=s.obstacles)||void 0===t?void 0:t.map(c)});a?b.push(a):f.push({item:e,problem:"an arrow needs two ends at different places"})}this.marks=b,this.storeUnplaced(f.flatMap((({item:t})=>null!=t.label?[t.label]:[]))),f.length>0&&this.reportWhenQuiet(e,f)}async reportWhenQuiet(t,e){let n=0;for(let e=0;e<50&&n<2;e++){if(await new Promise((t=>window.setTimeout(t,200))),t!==this.run)return;n=0===c.componentRegisterStatus().running?n+1:0}this.report(e)}report(t){var e,n;for(const{item:i,problem:o}of t){const t=`bn-annotation-layer: ${null!==(e=i.mark)&&void 0!==e?e:"marker"} ${null!==(n=i.label)&&void 0!==n?n:"without a number"} is not drawn: ${o}.`;this.reported.has(t)||(this.reported.add(t),console.warn(t))}}toLocalSpace(){var t;const e=null===(t=this.svg.getScreenCTM())||void 0===t?void 0:t.inverse();return t=>{if(!e)return t;const n=[[t.x,t.y],[t.x+t.width,t.y+t.height]].map((([t,n])=>new DOMPoint(t,n).matrixTransform(e)));return{x:Math.min(n[0].x,n[1].x),y:Math.min(n[0].y,n[1].y),width:Math.abs(n[1].x-n[0].x),height:Math.abs(n[1].y-n[0].y)}}}storeUnplaced(t){var e,n;const i=null===(e=this.stores)||void 0===e?void 0:e.annotationsUnplaced,o=null!==(n=null==i?void 0:i.state[this.pageKey])&&void 0!==n?n:[];i&&JSON.stringify(o)!==JSON.stringify(t)&&i.set(this.pageKey,t)}observe(t){this.observeSize(t);const e=t=>{var n;t&&(this.observed.has(t)||(this.observed.add(t),null===(n=this.mutationObserver)||void 0===n||n.observe(t,{childList:!0,subtree:!0,characterData:!0,attributes:!0,attributeFilter:["x","y","width","height","transform","style","class"]})),t.querySelectorAll("*").forEach((t=>e(t.shadowRoot))))};e(t.shadowRoot)}observeAround(t,e){var n,i;for(let o=t.parentElement;o&&o!==e;o=o.parentElement)this.observedAround.has(o)||(this.observedAround.add(o),null===(n=this.mutationObserver)||void 0===n||n.observe(o,{attributes:!0,attributeFilter:["style"]}),o.shadowRoot&&(null===(i=this.mutationObserver)||void 0===i||i.observe(o.shadowRoot,{childList:!0,subtree:!0,attributes:!0,attributeFilter:["style","class"]})))}observeSize(t){var e;this.observed.has(t)||(this.observed.add(t),null===(e=this.resizeObserver)||void 0===e||e.observe(t))}renderBadge(t,e){return t?i("g",null,i("circle",{cx:t.cx,cy:t.cy,r:t.r,style:{fill:e}}),null!=t.label?i("text",{class:"badge-text",x:t.cx,y:t.cy,style:{fontSize:1.1*t.r+"px"}},t.label):null):null}renderMark(t){var e,n;const o=l(t.color,this.componentStyle((t=>t["bn-annotation"])));return"marker"===t.kind?i("g",{class:"mark marker","data-label":t.badge.label},this.renderBadge(t.badge,o)):"frame"===t.kind?i("g",{class:"mark frame","data-label":null===(e=t.badge)||void 0===e?void 0:e.label},i("rect",{x:t.x,y:t.y,width:t.width,height:t.height,rx:t.rx,ry:t.ry,style:{fill:"none",stroke:o,strokeWidth:"1.5"}}),this.renderBadge(t.badge,o)):i("g",{class:"mark arrow","data-label":null===(n=t.badge)||void 0===n?void 0:n.label},i("line",{x1:t.x1,y1:t.y1,x2:t.x2,y2:t.y2,style:{stroke:o,strokeWidth:"1.5"}}),i("polygon",{points:t.head,style:{fill:o}}),this.renderBadge(t.badge,o))}render(){return i(o,{key:"d4d027728ae578a5ced829a3f86f0137530551fc"},i("svg",{key:"a3813930e420db9fdd618bc38c38941295cf4c22",ref:t=>this.svg=t},this.marks.map((t=>this.renderMark(t)))))}get element(){return this}static get watchers(){return{items:[{onItemsChange:0}]}}static get style(){return':host{position:absolute;inset:0;z-index:1;display:block;pointer-events:none;font-family:var(--bn-font-family, "Noto Sans", sans-serif);font-size:var(--bn-font-size, 13.3333px)}svg{position:absolute;inset:0;width:100%;height:100%;overflow:visible}.badge-text{fill:#ffffff;font-weight:bold;text-anchor:middle;dominant-baseline:central}'}},[1,"bn-annotation-layer",{items:[1],selectedStyle:[513,"selected-style"],marks:[32]},void 0,{items:[{onItemsChange:0}]}]),S=k,$=function(){"undefined"!=typeof customElements&&["bn-annotation-layer"].forEach((t=>{"bn-annotation-layer"===t&&(customElements.get(e(t))||customElements.define(e(t),k))}))};export{S as BnAnnotationLayer,$ as defineCustomElement}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{p as t,H as s,f as e,h as i,
|
|
1
|
+
import{p as t,H as s,f as e,h as i,d as n,t as l}from"./p-BnmylmXF.js";import{g as o}from"./p-6242qMx1.js";import{a,p as r,b as d}from"./p-C8rpOS5t.js";import{s as m}from"./p-CyUmrWfW.js";import{w as c}from"./p-BrQCbmG0.js";import{w as f}from"./p-JG4Sx1lE.js";import{w as h}from"./p-D32TsLzd.js";const p=t(class extends s{constructor(t){super(),!1!==t&&this.__registerHost(),this.__attachShadow(),this.pageKey="",c(this),this.errors=h(this),this.componentStyle=f(this)}connectedCallback(){this.stores=o(this.element),this.pageKey=a(this.element),this.unsubscribe=this.stores.annotationsUnplaced.on("set",(t=>{t===this.pageKey&&e(this.element)})),e(this.element)}disconnectedCallback(){var t;null===(t=this.unsubscribe)||void 0===t||t.call(this)}render(){var t,s;const e=r(this.items);e?this.errors.remove("ERR_items"):this.errors.addOrReplace({id:"ERR_items",type:"error",message:"items: not a JSON array of objects."});const l=d(void 0,this.componentStyle((t=>t["bn-annotation"]))),o=null!==(s=null===(t=this.stores)||void 0===t?void 0:t.annotationsUnplaced.state[this.pageKey])&&void 0!==s?s:[];return i(n,{key:"69a1cb7ec4623dd722328638b93fa2ac05775dcf"},i("ol",{key:"cc7925db54a9015cd774242487967e25d0eb1dc0"},(null!=e?e:[]).map((t=>i("li",null,null==t.label||o.includes(t.label)?null!=t.label?i("div",{class:"badge-space"}):null:i("div",{class:"badge",style:{background:l}},i("span",null,t.label)),i("div",{class:"text"},t.title?i("span",{class:"title"},t.title," "):null,t.html?i("span",{innerHTML:m(t.html)}):null))))))}get element(){return this}static get style(){return':host{display:block;font-family:var(--bn-font-family, "Noto Sans", sans-serif);font-size:var(--bn-font-size, 13.3333px);color:var(--bn-font-color, #000000)}ol{margin:0;padding:0;list-style:none}li{display:flex;gap:0.5em;margin-bottom:0.6em;align-items:flex-start}.badge-space{flex:none;width:1.5em;height:1.5em}.badge{flex:none;display:flex;align-items:center;justify-content:center;width:1.5em;height:1.5em;border-radius:50%;color:#ffffff;font-weight:bold;line-height:1}.badge span{font-size:0.825em}.title{font-weight:bold}'}},[1,"bn-annotation-list",{items:[1],selectedStyle:[513,"selected-style"]}]),b=p,u=function(){"undefined"!=typeof customElements&&["bn-annotation-list"].forEach((t=>{"bn-annotation-list"===t&&(customElements.get(l(t))||customElements.define(l(t),p))}))};export{b as BnAnnotationList,u as defineCustomElement}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{p as s,H as t,h as e,
|
|
1
|
+
import{p as s,H as t,h as e,d as r,t as o}from"./p-BnmylmXF.js";import{w as i}from"./p-BrQCbmG0.js";import{g as n}from"./p-6242qMx1.js";import{w as m}from"./p-BP2sJ8k9.js";import{w as a}from"./p-D32TsLzd.js";const h=s(class extends t{constructor(s){super(),!1!==s&&this.__registerHost(),this.__attachShadow(),i(this),this.errors=a(this),m(this,(s=>{this.stores||(this.stores=n(this.element));try{const t=s.replace(/\s/g,"");this.stores.assets.set(this.name,t)}catch(t){console.error("Error parsing asset",t,s),this.stores.assets.set(this.name,void 0)}}))}render(){return e(r,{key:"9df81e3697e02833b8cb1fad7ea06a5f446852be"})}get element(){return this}static get style(){return":host{display:none}"}},[1,"bn-asset",{name:[1]}]),p=h,c=function(){"undefined"!=typeof customElements&&["bn-asset"].forEach((s=>{"bn-asset"===s&&(customElements.get(o(s))||customElements.define(o(s),h))}))};export{p as BnAsset,c as defineCustomElement}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{B as o,d as
|
|
1
|
+
import{B as o,d as s}from"./p-DMAaBt7n.js";const t=o,a=s;export{t as BnBody,a as defineCustomElement}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{C as o,d as s}from"./p-
|
|
1
|
+
import{C as o,d as s}from"./p-4xaxuPVU.js";const a=o,p=s;export{a as BnCard,p as defineCustomElement}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{B as o,d as
|
|
1
|
+
import{B as o,d as s}from"./p-Uc0zvXcQ.js";const c=o,p=s;export{c as BnChartBubbleRenderer,p as defineCustomElement}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{p as t,H as e,w as i,f as s,h as a,a as r,t as n}from"./p-D6YGOYV1.js";import{h as l,a as o}from"./p-Cxx0YNnl.js";import{o as h}from"./p-BrJZUp-K.js";import{c}from"./p-kvYRImZT.js";import{a as d}from"./p-JofGXz75.js";import{g as u}from"./p-Dsvjkuy3.js";import{c as p}from"./p-C50Ge-4H.js";import{o as v}from"./p-B6kka9sT.js";import{p as m}from"./p-Xb6Ilq8u.js";import{i as f,h as b,j as y}from"./p-BKLq0Pbv.js";import{w as g}from"./p-Dq9dG0Kr.js";import{w as x}from"./p-9X5fVJqR.js";import{w}from"./p-BKA15uoz.js";import{w as _}from"./p-4vVbchX2.js";import{w as S}from"./p-Bd8cQiLx.js";import{w as j}from"./p-DzYhS_9s.js";import{w as L}from"./p-Bj3RWsEx.js";import{w as R}from"./p-uCpFBDF5.js";import{r as z,s as $}from"./p-BXXjh6We.js";import{t as E,a as A,b as N,c as W,d as k,e as F,p as C}from"./p-9mUU4itF.js";import{s as O}from"./p-DakXa7Dp.js";import{d as B}from"./p-BKTBdrEA.js";const D={rowGroup:0,category:1,subCategory:2},G=["ac","pp","fc","pl"],M=t(class extends e{validateFilter(t){const e="ERR_filter";l(t)?this.errors.addOrReplace({id:e,type:"error",message:"filter: double backticks are not allowed."}):this.errors.remove(e)}validateX(t){this.validateMeasureSpec("x",t,!0,(t=>E(t)))}validateY(t){this.validateMeasureSpec("y",t,!0,(t=>E(t)))}validateSize(t){this.validateMeasureSpec("size",t,!0,(t=>A(t))),this.validateSizeScaling()}validateShare(t){this.validateMeasureSpec("share",t,!1,(t=>N(t)))}validateCompareWith(t){const e="WARN_compareWith";f(t)||G.includes(t.trim().toLowerCase())?this.errors.remove(e):this.errors.addOrReplace({id:e,type:"warning",message:`compare-with: invalid value '${t}' - expected ${G.join("/")}; ignored.`})}validateLevel(t){const e="WARN_level",i=["auto","category","subcategory"];f(t)||i.includes(t.trim().toLowerCase())?this.errors.remove(e):this.errors.addOrReplace({id:e,type:"warning",message:`level: invalid value '${t}' - expected ${i.join("/")}; using 'auto'.`})}validateSeriesLevel(t){const e="WARN_seriesLevel",i=["auto","rowgroup","category","none"];f(t)||i.includes(t.trim().toLowerCase())?this.errors.remove(e):this.errors.addOrReplace({id:e,type:"warning",message:`series-level: invalid value '${t}' - expected ${i.join("/")}; using 'auto'.`})}validateFacet(t){this.validateObjectSpec("facet",t,(t=>W(t)))}validateLabels(t){this.validateObjectSpec("labels",t,(t=>k(t,this.labelDefaults())))}validateLegend(t){this.validateObjectSpec("legend",t,(t=>F(t)))}validateAspect(t){const e="WARN_aspect";f(t)||null!==this.parseAspect(t)?this.errors.remove(e):this.errors.addOrReplace({id:e,type:"warning",message:`aspect: invalid value '${t}' - expected "w:h" (e.g. "16:9"); using the default.`})}validateLimit(t){const e="WARN_limit";b(t)&&Number(t)>=0?this.errors.remove(e):this.errors.addOrReplace({id:e,type:"warning",message:`limit: invalid value '${t}' - expected a non-negative integer; using 0.`})}validateScale(t){const e="WARN_scale";if(f(t))return void this.errors.remove(e);const{mode:i,factor:s}=m(t);"factor"===i&&(void 0===s||s<=0)?this.errors.addOrReplace({id:e,type:"warning",message:`scale: invalid value '${t}' - expected none/auto or a positive number.`}):this.errors.remove(e)}constructor(t){super(),!1!==t&&this.__registerHost(),this.__attachShadow(),this.datasetName="",this.dataVersion=0,this.datasetMeta=null,this.appliedScaleFactor=1,this.layoutObserver=null,this.activeErrors=new Set,this.pixelPerUnitGroupMap=new Map,this.chartTitle="",this.filter="",this.share="",this.compareWith="",this.level="auto",this.seriesLevel="auto",this.facet="",this.labels="",this.legend="",this.aspect="16:9",this.limit=0,this._autoScaleGuard=!1,this._lastObservedWidth=0,this.translateForInner=(t,e)=>this.t(t,e),R(this),g(this),w(this,(t=>{this.datasetName=(null==t?void 0:t.startsWith("$"))?t.substring(1):t||"",this.dataVersion=this.dataVersion+1}),((t,e)=>{this.datasetMeta=e})),this.errors=_(this),j(this),this.componentStyle=x(this),this.ruleSetConfig=S(this),this.t=L(this).t}componentWillLoad(){this.validateFilter(this.filter),this.validateX(this.x),this.validateY(this.y),this.validateSize(this.size),this.validateShare(this.share),this.validateCompareWith(this.compareWith),this.validateLevel(this.level),this.validateSeriesLevel(this.seriesLevel),this.validateFacet(this.facet),this.validateLabels(this.labels),this.validateLegend(this.legend),this.validateAspect(this.aspect),this.validateLimit(this.limit),this.validateScale(this.scale)}componentDidRender(){O(this.element,"bn-chart-bubble-renderer");const{mode:t}=m(this.scale);if("auto"!==t&&"empty"!==t)return this._autoScaleGuard=!1,void this.checkOverflow();if(this._autoScaleGuard)return this._autoScaleGuard=!1,void this.checkOverflow();const e=this.element,{width:s}=u(e);if(s<=0)return void this.checkOverflow();this._lastObservedWidth=s;const a=this.componentStyle((t=>{var e;return(null===(e=t.global)||void 0===e?void 0:e.fontSizePx)||13.3333})),r=e.scrollWidth,n=this.appliedScaleFactor;if(!Number.isFinite(r)||r<=s+1)return this.errors.remove("AUTO_scale"),void this.checkOverflow();const l=Math.max(.3,n*(s-1)/r);Math.abs(l-n)<.01||(e.style.setProperty("--bn-font-size",a*l+"px"),"empty"===t?this.errors.addOrReplace({id:"AUTO_scale",type:"warning",message:"Auto-scaled chart by factor "+l.toFixed(3)}):this.errors.remove("AUTO_scale"),this._autoScaleGuard=!0,i((()=>{this.appliedScaleFactor=l}))),this.checkOverflow()}checkOverflow(){p(this.element,"bn-chart-bubble-renderer",this.errors)}componentDidLoad(){this.layoutObserver=v(this.element,(()=>{if(this._autoScaleGuard)return;const{width:t}=u(this.element);t>0&&Math.abs(t-this._lastObservedWidth)>2?(this._lastObservedWidth=t,s(this)):this.checkOverflow()})),requestAnimationFrame((()=>{requestAnimationFrame((()=>{if(this._autoScaleGuard)return;const{width:t}=u(this.element);this._lastObservedWidth=t,s(this)}))}))}disconnectedCallback(){var t;null===(t=this.layoutObserver)||void 0===t||t.disconnect(),this.layoutObserver=null}labelDefaults(){return{points:"all",values:!0,max:12}}setBlockingError(t,e){null===e?(this.errors.remove(t),this.activeErrors.delete(t)):(this.errors.addOrReplace({id:t,type:"error",message:e}),this.activeErrors.add(t))}hasBlockingErrors(){return this.activeErrors.size>0}validateSizeScaling(){var t;const e=null===(t=this.prepareSize())||void 0===t?void 0:t.group;this.setBlockingError("ERR_xy_scale_group",void 0===e||this.pixelPerUnitGroupMap.has(e)?null:this.t(".bubble-scale-group-unknown",{group:e}))}validateMeasureSpec(t,e,i,s){var a;const r="ERR_xy_json_"+t,n="ERR_xy_measure_"+t,l="WARN_xy_fields_"+t,{data:o,parseError:h}=C(e,"measure");if(h)return this.setBlockingError(r,this.t(".xy-prop-json",{prop:t})),this.setBlockingError(n,null),void this.errors.remove(l);if(this.setBlockingError(r,null),null===o)return this.setBlockingError(n,i?this.t(".xy-measure-invalid",{prop:t,measure:""}):null),void this.errors.remove(l);const c=null!==(a=o.measure)&&void 0!==a?a:"";y(c)?this.setBlockingError(n,null):this.setBlockingError(n,this.t(".xy-measure-invalid",{prop:t,measure:c})),this.reportSpecIssues(l,t,s(o))}validateObjectSpec(t,e,i){const s="ERR_xy_json_"+t,a="WARN_xy_fields_"+t,{data:r,parseError:n}=C(e,null);if(n)return this.setBlockingError(s,this.t(".xy-prop-json",{prop:t})),void this.errors.remove(a);this.setBlockingError(s,null),null!==r?this.reportSpecIssues(a,t,i(r)):this.errors.remove(a)}reportSpecIssues(t,e,i){const s=[];null!==i&&i.invalidFields.length>0&&s.push("invalid: "+i.invalidFields.join(", ")),null!==i&&i.unknownKeys.length>0&&s.push("unknown: "+i.unknownKeys.join(", ")),s.length>0?this.errors.addOrReplace({id:t,type:"warning",message:`${e}: ignored sub-fields (${s.join("; ")}).`}):this.errors.remove(t)}prepareAxis(t,e){const{data:i,parseError:s}=C(e,"measure");if(s||null===i)return null;const{config:a}=E(i);return null!==a&&y(a.measure)?(void 0!==a.min&&void 0!==a.max&&a.min>=a.max?(this.errors.addOrReplace({id:"WARN_xy_domain_"+t,type:"warning",message:t+": min must be smaller than max; the override is ignored."}),a.min=void 0,a.max=void 0):this.errors.remove("WARN_xy_domain_"+t),a):null}prepareSize(){const{data:t,parseError:e}=C(this.size,"measure");if(e||null===t)return null;const{config:i}=A(t);return null!==i&&y(i.measure)?i:null}prepareShare(){const{data:t,parseError:e}=C(this.share,"measure");if(e||null===t)return null;const{config:i}=N(t);return null!==i&&y(i.measure)?i:null}prepareCompareFamily(){var t;const e=null===(t=this.compareWith)||void 0===t?void 0:t.trim().toLowerCase();return G.includes(e)?e:null}prepareLabels(){const t=this.labelDefaults(),{data:e,parseError:i}=C(this.labels,null);return i||null===e?{points:t.points,values:t.values,max:t.max}:k(e,t).config}prepareLegend(){const{data:t,parseError:e}=C(this.legend,null);return e||null===t?{show:!0,position:"right"}:F(t).config}prepareFacet(){const{data:t,parseError:e}=C(this.facet,null);return e||null===t?null:W(t).config}preparePointLevel(){var t,e;const i=null===(t=this.level)||void 0===t?void 0:t.trim().toLowerCase();if("category"===i)return"category";if("subcategory"===i)return"subCategory";const s=null===(e=this.datasetMeta)||void 0===e?void 0:e.suggestedLevel;return"rowGroup"===s||"category"===s||"subCategory"===s?s:"category"}prepareSeriesLevel(t){var e;const i=null===(e=this.seriesLevel)||void 0===e?void 0:e.trim().toLowerCase();return"none"===i?null:"rowgroup"===i?"rowGroup":"category"===i||"subCategory"===t?"category":"category"===t?"rowGroup":null}validateCrossProp(t,e){const i=new Set;let s=!1;for(const e of t){if(void 0===e)continue;const t=z(e);null!==t&&("scenario"===t.kind?i.add($(t.slot)):s=!0)}this.setBlockingError("ERR_xy_family",i.size>1?this.t(".xy-family-mixed",{families:[...i].join(", ")}):null);const a=this.prepareCompareFamily();this.setBlockingError("ERR_xy_compare_variance",null!==a&&s?this.t(".xy-compare-variance"):null),this.setBlockingError("ERR_xy_compare_family",null!==a&&1===i.size&&i.has(a)?`compare-with: '${a}' is already the primary scenario family.`:null);const r=this.preparePointLevel(),n=this.prepareSeriesLevel(r),l=null!==e?"rowgroup"===e.level?"rowGroup":"category":null;let o=null;if(null!==n&&D[n]>=D[r]&&(o=`series '${n}' vs point '${r}'`),null!==l){const t=null!=n?n:r;D[l]>=D[t]&&(o=`facet '${l}' vs '${t}'`)}this.setBlockingError("ERR_xy_level_order",null!==o?this.t(".xy-level-order",{detail:o}):null)}parseAspect(t){const e=/^\s*(\d+(?:\.\d+)?)\s*:\s*(\d+(?:\.\d+)?)\s*$/.exec(null!=t?t:"");if(null===e)return null;const i=Number(e[1]),s=Number(e[2]);return i<=0||s<=0?null:i/s}prepareAspect(){var t;return null!==(t=this.parseAspect(this.aspect))&&void 0!==t?t:16/9}prepareLimit(){const t=Math.floor(Number(this.limit)||0);return t>0?t:0}prepareSizeAreaPerUnit(){var t;const e=null===(t=this.prepareSize())||void 0===t?void 0:t.group;if(void 0===e||!this.pixelPerUnitGroupMap.has(e))return 0;const i=this.pixelPerUnitGroupMap.get(e);if(!(i>0))return 0;const s=this.getEffectiveFontPx();return s*s/i}i18nLocalKeys(){return["no-data","axis.in","legend.title","legend.size","legend.compare"]}prepareI18n(){const t=new Map(this.i18nLocalKeys().map((t=>[t,this.t(".".concat(t))]))),e=new Map(o.map((t=>[t,this.t("global.".concat(t))])));return new Map([...e.entries(),...t.entries()])}prepareStyle(){const t=this.getEffectiveScaleFactor();return this.componentStyle((e=>{const i=e.global.fontSizePx*t;return{scaleFactors:e["bn-chart-bubble"].scaleFactors,fontStyles:{font:`${i}px ${e.global.fontFamily}`,size:i,color:e.global.fontColor,background:e.global.fontBackgroundColor,leading:1.8},axisStyles:e["bn-chart-bubble"].axisStyles,seriesColors:e["bn-chart-bubble"].seriesColors,padding:e["bn-chart-bubble"].padding}}))}async getBaseline(){return d(this.element,"bn-chart-bubble-renderer")}async getLayoutState(t){var e;const i=null!==(e=null==t?void 0:t.detail)&&void 0!==e?e:"summary",s=h(this.element),a=this.getEffectiveScaleFactor(),r=Number.isFinite(a)&&a>0?a:1,n=this.componentStyle((t=>{var e;return(null===(e=t.global)||void 0===e?void 0:e.fontSizePx)||13.3333}))*r;return c(this.element,"bn-chart-bubble-renderer",this.chartTitle||void 0,{fontSizePx:n,appliedScaleFactor:r},s,i)}getEffectiveScaleFactor(){const{mode:t,factor:e}=m(this.scale);return"factor"===t?e:"auto"===t||"empty"===t?this.appliedScaleFactor:1}getEffectiveFontPx(){return this.componentStyle((t=>{var e;return(null===(e=t.global)||void 0===e?void 0:e.fontSizePx)||13.3333}))*this.getEffectiveScaleFactor()}getFontStyles(){const t=this.getEffectiveScaleFactor();return this.componentStyle((e=>{var i,s,a,r;const n=(null===(i=e.global)||void 0===i?void 0:i.fontSizePx)||13.3333;return{"--bn-font-family":(null===(s=e.global)||void 0===s?void 0:s.fontFamily)||"'Noto Sans', sans-serif","--bn-font-size":n*t+"px","--bn-font-color":(null===(a=e.global)||void 0===a?void 0:a.fontColor)||"#000000","--bn-font-background":(null===(r=e.global)||void 0===r?void 0:r.fontBackgroundColor)||"#ffffff"}}))}getDataStructure(){const t={};for(const e of["ac","pp","fc","pl"])for(const i of[1,2,3,4])t[`${e}${i}`]={type:"number",isOptional:!0,description:""};const e={x:this.prepareAxis("x",this.x),y:this.prepareAxis("y",this.y),size:this.prepareSize(),share:this.prepareShare()};for(const[i,s]of Object.entries(e)){if(null===s)continue;const e=z(s.measure);null!==e&&("scenario"===e.kind?t[e.slot].description=`${i}: ${void 0!==s.label?s.label:s.measure}`:(t[e.measure.base].description=`${i}: ${s.measure} (base)`,t[e.measure.delta].description=`${i}: ${s.measure} (delta)`))}const i=this.prepareCompareFamily();if(null!==i)for(const[s,a]of Object.entries(e)){if(null===a||"share"===s)continue;const e=z(a.measure);if(null!==e&&"scenario"===e.kind){const a=i+e.slot.replace(/^[a-z]+/,"");""===t[a].description&&(t[a].description=s+": compareWith")}}return{IBubbleChartDataRow:Object.assign({operation:{type:"string",isOptional:!1,description:""},rowGroup:{type:"string",isOptional:!0,description:""},rowGroupIndex:{type:"number",isOptional:!0,description:""},category:{type:"string",isOptional:!1,description:""},categoryIndex:{type:"number",isOptional:!1,description:""},subCategory:{type:"string",isOptional:!0,description:""},subCategoryIndex:{type:"number",isOptional:!0,description:""}},t)}}chartTemplate(){const t=this.prepareAxis("x",this.x),e=this.prepareAxis("y",this.y),i=this.prepareSize(),s=this.prepareShare(),r=this.prepareFacet();if(this.validateCrossProp([null==t?void 0:t.measure,null==e?void 0:e.measure,null==i?void 0:i.measure,null==s?void 0:s.measure],r),this.validateSizeScaling(),this.hasBlockingErrors()||null===t||null===e||null===i)return null;const n=this.preparePointLevel(),l=this.prepareI18n(),o=this.prepareStyle(),h=u(this.element).width;return a("bn-chart-bubble-renderer",{tableName:this.datasetName,dataVersion:this.dataVersion,chartTitle:this.chartTitle,x:t,y:e,size:i,share:s,compareFamily:this.prepareCompareFamily(),labels:this.prepareLabels(),legend:this.prepareLegend(),facet:r,pointLevel:n,seriesLevel:this.prepareSeriesLevel(n),aspect:this.prepareAspect(),limit:this.prepareLimit(),filter:this.filter,sizeAreaPerUnit:this.prepareSizeAreaPerUnit(),styles:o,i18n:l,containerWidth:h,ruleSetConfig:this.ruleSetConfig(),errors:this.errors,translator:this.translateForInner})}render(){return a(r,{key:"2b15b5b4fc32db48b951e82ecc87f25b0afcc9f8",style:this.getFontStyles()},a("div",{key:"210d8622e1785b8c882f9c9a2fa2072af0e857b6",class:"container"},this.chartTemplate()))}get element(){return this}static get watchers(){return{filter:[{validateFilter:0}],x:[{validateX:0}],y:[{validateY:0}],size:[{validateSize:0}],share:[{validateShare:0}],compareWith:[{validateCompareWith:0}],level:[{validateLevel:0}],seriesLevel:[{validateSeriesLevel:0}],facet:[{validateFacet:0}],labels:[{validateLabels:0}],legend:[{validateLegend:0}],aspect:[{validateAspect:0}],limit:[{validateLimit:0}],scale:[{validateScale:0}]}}static get style(){return':host(.no-data){display:block;box-sizing:border-box;width:100%;height:100%}:host(.no-data)>div{float:none;width:100%;height:100%}:host(.no-data) .no-data~.no-data{display:none}.empty-state{box-sizing:border-box;display:flex;align-items:center;justify-content:center;float:none;width:100%;height:100%;min-height:3em;margin:0;padding:0.5em;overflow:hidden;border:0.1em dashed #ddd;color:#808080;font-family:var(--bn-font-family, "Noto Sans", sans-serif);font-size:var(--bn-font-size, 13.3333px);font-style:normal;text-align:center}:host{display:inline-block;position:relative;overflow:hidden;font-family:var(--bn-font-family, "Noto Sans", sans-serif);font-size:var(--bn-font-size, 13.3333px);color:var(--bn-font-color, #000000)}.container{display:flex;flex-direction:column}'}},[1,"bn-chart-bubble",{datasets:[513],selectedStyle:[513,"selected-style"],i18nNamespace:[513,"i18n-namespace"],ruleset:[513],chartTitle:[1,"chart-title"],filter:[1],x:[1],y:[1],size:[1],share:[1],compareWith:[1,"compare-with"],level:[1],seriesLevel:[1,"series-level"],facet:[1],labels:[1],legend:[1],aspect:[1],limit:[2],scale:[1],datasetName:[32],dataVersion:[32],datasetMeta:[32],appliedScaleFactor:[32],getBaseline:[64],getLayoutState:[64]},void 0,{filter:[{validateFilter:0}],x:[{validateX:0}],y:[{validateY:0}],size:[{validateSize:0}],share:[{validateShare:0}],compareWith:[{validateCompareWith:0}],level:[{validateLevel:0}],seriesLevel:[{validateSeriesLevel:0}],facet:[{validateFacet:0}],labels:[{validateLabels:0}],legend:[{validateLegend:0}],aspect:[{validateAspect:0}],limit:[{validateLimit:0}],scale:[{validateScale:0}]}]),X=M,T=function(){"undefined"!=typeof customElements&&["bn-chart-bubble","bn-chart-bubble-renderer"].forEach((t=>{switch(t){case"bn-chart-bubble":customElements.get(n(t))||customElements.define(n(t),M);break;case"bn-chart-bubble-renderer":customElements.get(n(t))||B()}}))};export{X as BnChartBubble,T as defineCustomElement}
|
|
1
|
+
import{p as t,H as e,w as i,f as s,h as a,d as r,t as n}from"./p-BnmylmXF.js";import{h as l,a as o}from"./p-6242qMx1.js";import{o as h}from"./p-DdvG1D18.js";import{c}from"./p-TNX3alPU.js";import{a as d}from"./p-JofGXz75.js";import{g as u}from"./p-Dsvjkuy3.js";import{c as p}from"./p-C50Ge-4H.js";import{o as v}from"./p-B6kka9sT.js";import{p as m}from"./p-Xb6Ilq8u.js";import{i as f,h as b,j as y}from"./p-Dw3rv_Y9.js";import{w as g}from"./p-BrQCbmG0.js";import{w as x}from"./p-JG4Sx1lE.js";import{w}from"./p-CZzlLTQc.js";import{w as _}from"./p-D32TsLzd.js";import{w as S}from"./p-DRmphEA0.js";import{w as j}from"./p-Bp5Xj4-s.js";import{w as L}from"./p-CUoPUIej.js";import{w as R}from"./p-D_K7tYhY.js";import{r as z,s as $}from"./p-Dyzb4ika.js";import{t as E,a as A,b as N,c as k,d as C,e as W,p as F}from"./p-DUZCLRVu.js";import{s as D}from"./p-DakXa7Dp.js";import{d as O}from"./p-Uc0zvXcQ.js";const G={rowGroup:0,category:1,subCategory:2},M=["ac","pp","fc","pl"],T=t(class extends e{validateFilter(t){const e="ERR_filter";l(t)?this.errors.addOrReplace({id:e,type:"error",message:"filter: double backticks are not allowed."}):this.errors.remove(e)}validateX(t){this.validateMeasureSpec("x",t,!0,(t=>E(t)))}validateY(t){this.validateMeasureSpec("y",t,!0,(t=>E(t)))}validateSize(t){this.validateMeasureSpec("size",t,!0,(t=>A(t))),this.validateSizeScaling()}validateShare(t){this.validateMeasureSpec("share",t,!1,(t=>N(t)))}validateCompareWith(t){const e="WARN_compareWith";f(t)||M.includes(t.trim().toLowerCase())?this.errors.remove(e):this.errors.addOrReplace({id:e,type:"warning",message:`compare-with: invalid value '${t}' - expected ${M.join("/")}; ignored.`})}validateLevel(t){const e="WARN_level",i=["auto","category","subcategory"];f(t)||i.includes(t.trim().toLowerCase())?this.errors.remove(e):this.errors.addOrReplace({id:e,type:"warning",message:`level: invalid value '${t}' - expected ${i.join("/")}; using 'auto'.`})}validateSeriesLevel(t){const e="WARN_seriesLevel",i=["auto","rowgroup","category","none"];f(t)||i.includes(t.trim().toLowerCase())?this.errors.remove(e):this.errors.addOrReplace({id:e,type:"warning",message:`series-level: invalid value '${t}' - expected ${i.join("/")}; using 'auto'.`})}validateFacet(t){this.validateObjectSpec("facet",t,(t=>k(t)))}validateLabels(t){this.validateObjectSpec("labels",t,(t=>C(t,this.labelDefaults())))}validateLegend(t){this.validateObjectSpec("legend",t,(t=>W(t)))}validateAspect(t){const e="WARN_aspect";f(t)||null!==this.parseAspect(t)?this.errors.remove(e):this.errors.addOrReplace({id:e,type:"warning",message:`aspect: invalid value '${t}' - expected "w:h" (e.g. "16:9"); using the default.`})}validateLimit(t){const e="WARN_limit";b(t)&&Number(t)>=0?this.errors.remove(e):this.errors.addOrReplace({id:e,type:"warning",message:`limit: invalid value '${t}' - expected a non-negative integer; using 0.`})}validateScale(t){const e="WARN_scale";if(f(t))return void this.errors.remove(e);const{mode:i,factor:s}=m(t);"factor"===i&&(void 0===s||s<=0)?this.errors.addOrReplace({id:e,type:"warning",message:`scale: invalid value '${t}' - expected none/auto or a positive number.`}):this.errors.remove(e)}constructor(t){super(),!1!==t&&this.__registerHost(),this.__attachShadow(),this.datasetName="",this.dataVersion=0,this.datasetMeta=null,this.appliedScaleFactor=1,this.layoutObserver=null,this.activeErrors=new Set,this.pixelPerUnitGroupMap=new Map,this.chartTitle="",this.filter="",this.share="",this.compareWith="",this.level="auto",this.seriesLevel="auto",this.facet="",this.labels="",this.legend="",this.aspect="16:9",this.limit=0,this._autoScaleGuard=!1,this._lastObservedWidth=0,this.translateForInner=(t,e)=>this.t(t,e),R(this),g(this),w(this,(t=>{this.datasetName=(null==t?void 0:t.startsWith("$"))?t.substring(1):t||"",this.dataVersion=this.dataVersion+1}),((t,e)=>{this.datasetMeta=e})),this.errors=_(this),j(this),this.componentStyle=x(this),this.ruleSetConfig=S(this),this.t=L(this).t}componentWillLoad(){this.validateFilter(this.filter),this.validateX(this.x),this.validateY(this.y),this.validateSize(this.size),this.validateShare(this.share),this.validateCompareWith(this.compareWith),this.validateLevel(this.level),this.validateSeriesLevel(this.seriesLevel),this.validateFacet(this.facet),this.validateLabels(this.labels),this.validateLegend(this.legend),this.validateAspect(this.aspect),this.validateLimit(this.limit),this.validateScale(this.scale)}componentDidRender(){D(this.element,"bn-chart-bubble-renderer");const{mode:t}=m(this.scale);if("auto"!==t&&"empty"!==t)return this._autoScaleGuard=!1,void this.checkOverflow();if(this._autoScaleGuard)return this._autoScaleGuard=!1,void this.checkOverflow();const e=this.element,{width:s}=u(e);if(s<=0)return void this.checkOverflow();this._lastObservedWidth=s;const a=this.componentStyle((t=>{var e;return(null===(e=t.global)||void 0===e?void 0:e.fontSizePx)||13.3333})),r=e.scrollWidth,n=this.appliedScaleFactor;if(!Number.isFinite(r)||r<=s+1)return this.errors.remove("AUTO_scale"),void this.checkOverflow();const l=Math.max(.3,n*(s-1)/r);Math.abs(l-n)<.01||(e.style.setProperty("--bn-font-size",a*l+"px"),"empty"===t?this.errors.addOrReplace({id:"AUTO_scale",type:"warning",message:"Auto-scaled chart by factor "+l.toFixed(3)}):this.errors.remove("AUTO_scale"),this._autoScaleGuard=!0,i((()=>{this.appliedScaleFactor=l}))),this.checkOverflow()}checkOverflow(){p(this.element,"bn-chart-bubble-renderer",this.errors)}componentDidLoad(){this.layoutObserver=v(this.element,(()=>{if(this._autoScaleGuard)return;const{width:t}=u(this.element);t>0&&Math.abs(t-this._lastObservedWidth)>2?(this._lastObservedWidth=t,s(this)):this.checkOverflow()})),requestAnimationFrame((()=>{requestAnimationFrame((()=>{if(this._autoScaleGuard)return;const{width:t}=u(this.element);this._lastObservedWidth=t,s(this)}))}))}disconnectedCallback(){var t;null===(t=this.layoutObserver)||void 0===t||t.disconnect(),this.layoutObserver=null}labelDefaults(){return{points:"all",values:!0,max:12}}setBlockingError(t,e){null===e?(this.errors.remove(t),this.activeErrors.delete(t)):(this.errors.addOrReplace({id:t,type:"error",message:e}),this.activeErrors.add(t))}hasBlockingErrors(){return this.activeErrors.size>0}validateSizeScaling(){var t;const e=null===(t=this.prepareSize())||void 0===t?void 0:t.group;this.setBlockingError("ERR_xy_scale_group",void 0===e||this.pixelPerUnitGroupMap.has(e)?null:this.t(".bubble-scale-group-unknown",{group:e}))}validateMeasureSpec(t,e,i,s){var a;const r="ERR_xy_json_"+t,n="ERR_xy_measure_"+t,l="WARN_xy_fields_"+t,{data:o,parseError:h}=F(e,"measure");if(h)return this.setBlockingError(r,this.t(".xy-prop-json",{prop:t})),this.setBlockingError(n,null),void this.errors.remove(l);if(this.setBlockingError(r,null),null===o)return this.setBlockingError(n,i?this.t(".xy-measure-invalid",{prop:t,measure:""}):null),void this.errors.remove(l);const c=null!==(a=o.measure)&&void 0!==a?a:"";y(c)?this.setBlockingError(n,null):this.setBlockingError(n,this.t(".xy-measure-invalid",{prop:t,measure:c})),this.reportSpecIssues(l,t,s(o))}validateObjectSpec(t,e,i){const s="ERR_xy_json_"+t,a="WARN_xy_fields_"+t,{data:r,parseError:n}=F(e,null);if(n)return this.setBlockingError(s,this.t(".xy-prop-json",{prop:t})),void this.errors.remove(a);this.setBlockingError(s,null),null!==r?this.reportSpecIssues(a,t,i(r)):this.errors.remove(a)}reportSpecIssues(t,e,i){const s=[];null!==i&&i.invalidFields.length>0&&s.push("invalid: "+i.invalidFields.join(", ")),null!==i&&i.unknownKeys.length>0&&s.push("unknown: "+i.unknownKeys.join(", ")),s.length>0?this.errors.addOrReplace({id:t,type:"warning",message:`${e}: ignored sub-fields (${s.join("; ")}).`}):this.errors.remove(t)}prepareAxis(t,e){const{data:i,parseError:s}=F(e,"measure");if(s||null===i)return null;const{config:a}=E(i);return null!==a&&y(a.measure)?(void 0!==a.min&&void 0!==a.max&&a.min>=a.max?(this.errors.addOrReplace({id:"WARN_xy_domain_"+t,type:"warning",message:t+": min must be smaller than max; the override is ignored."}),a.min=void 0,a.max=void 0):this.errors.remove("WARN_xy_domain_"+t),a):null}prepareSize(){const{data:t,parseError:e}=F(this.size,"measure");if(e||null===t)return null;const{config:i}=A(t);return null!==i&&y(i.measure)?i:null}prepareShare(){const{data:t,parseError:e}=F(this.share,"measure");if(e||null===t)return null;const{config:i}=N(t);return null!==i&&y(i.measure)?i:null}prepareCompareFamily(){var t;const e=null===(t=this.compareWith)||void 0===t?void 0:t.trim().toLowerCase();return M.includes(e)?e:null}prepareLabels(){const t=this.labelDefaults(),{data:e,parseError:i}=F(this.labels,null);return i||null===e?{points:t.points,values:t.values,max:t.max}:C(e,t).config}prepareLegend(){const{data:t,parseError:e}=F(this.legend,null);return e||null===t?{show:!0,position:"right"}:W(t).config}prepareFacet(){const{data:t,parseError:e}=F(this.facet,null);return e||null===t?null:k(t).config}preparePointLevel(){var t,e;const i=null===(t=this.level)||void 0===t?void 0:t.trim().toLowerCase();if("category"===i)return"category";if("subcategory"===i)return"subCategory";const s=null===(e=this.datasetMeta)||void 0===e?void 0:e.suggestedLevel;return"rowGroup"===s||"category"===s||"subCategory"===s?s:"category"}prepareSeriesLevel(t){var e;const i=null===(e=this.seriesLevel)||void 0===e?void 0:e.trim().toLowerCase();return"none"===i?null:"rowgroup"===i?"rowGroup":"category"===i||"subCategory"===t?"category":"category"===t?"rowGroup":null}validateCrossProp(t,e){const i=new Set;let s=!1;for(const e of t){if(void 0===e)continue;const t=z(e);null!==t&&("scenario"===t.kind?i.add($(t.slot)):s=!0)}this.setBlockingError("ERR_xy_family",i.size>1?this.t(".xy-family-mixed",{families:[...i].join(", ")}):null);const a=this.prepareCompareFamily();this.setBlockingError("ERR_xy_compare_variance",null!==a&&s?this.t(".xy-compare-variance"):null),this.setBlockingError("ERR_xy_compare_family",null!==a&&1===i.size&&i.has(a)?`compare-with: '${a}' is already the primary scenario family.`:null);const r=this.preparePointLevel(),n=this.prepareSeriesLevel(r),l=null!==e?"rowgroup"===e.level?"rowGroup":"category":null;let o=null;if(null!==n&&G[n]>=G[r]&&(o=`series '${n}' vs point '${r}'`),null!==l){const t=null!=n?n:r;G[l]>=G[t]&&(o=`facet '${l}' vs '${t}'`)}this.setBlockingError("ERR_xy_level_order",null!==o?this.t(".xy-level-order",{detail:o}):null)}parseAspect(t){const e=/^\s*(\d+(?:\.\d+)?)\s*:\s*(\d+(?:\.\d+)?)\s*$/.exec(null!=t?t:"");if(null===e)return null;const i=Number(e[1]),s=Number(e[2]);return i<=0||s<=0?null:i/s}prepareAspect(){var t;return null!==(t=this.parseAspect(this.aspect))&&void 0!==t?t:16/9}prepareLimit(){const t=Math.floor(Number(this.limit)||0);return t>0?t:0}prepareSizeAreaPerUnit(){var t;const e=null===(t=this.prepareSize())||void 0===t?void 0:t.group;if(void 0===e||!this.pixelPerUnitGroupMap.has(e))return 0;const i=this.pixelPerUnitGroupMap.get(e);if(!(i>0))return 0;const s=this.getEffectiveFontPx();return s*s/i}i18nLocalKeys(){return["no-data","axis.in","legend.title","legend.size","legend.compare"]}prepareI18n(){const t=new Map(this.i18nLocalKeys().map((t=>[t,this.t(".".concat(t))]))),e=new Map(o.map((t=>[t,this.t("global.".concat(t))])));return new Map([...e.entries(),...t.entries()])}prepareStyle(){const t=this.getEffectiveScaleFactor();return this.componentStyle((e=>{const i=e.global.fontSizePx*t;return{scaleFactors:e["bn-chart-bubble"].scaleFactors,fontStyles:{font:`${i}px ${e.global.fontFamily}`,size:i,color:e.global.fontColor,background:e.global.fontBackgroundColor,leading:1.8},axisStyles:e["bn-chart-bubble"].axisStyles,seriesColors:e["bn-chart-bubble"].seriesColors,padding:e["bn-chart-bubble"].padding}}))}async getBaseline(){return d(this.element,"bn-chart-bubble-renderer")}async getLayoutState(t){var e;const i=null!==(e=null==t?void 0:t.detail)&&void 0!==e?e:"summary",s=h(this.element),a=this.getEffectiveScaleFactor(),r=Number.isFinite(a)&&a>0?a:1,n=this.componentStyle((t=>{var e;return(null===(e=t.global)||void 0===e?void 0:e.fontSizePx)||13.3333}))*r;return c(this.element,"bn-chart-bubble-renderer",this.chartTitle||void 0,{fontSizePx:n,appliedScaleFactor:r},s,i)}getEffectiveScaleFactor(){const{mode:t,factor:e}=m(this.scale);return"factor"===t?e:"auto"===t||"empty"===t?this.appliedScaleFactor:1}getEffectiveFontPx(){return this.componentStyle((t=>{var e;return(null===(e=t.global)||void 0===e?void 0:e.fontSizePx)||13.3333}))*this.getEffectiveScaleFactor()}getFontStyles(){const t=this.getEffectiveScaleFactor();return this.componentStyle((e=>{var i,s,a,r;const n=(null===(i=e.global)||void 0===i?void 0:i.fontSizePx)||13.3333;return{"--bn-font-family":(null===(s=e.global)||void 0===s?void 0:s.fontFamily)||"'Noto Sans', sans-serif","--bn-font-size":n*t+"px","--bn-font-color":(null===(a=e.global)||void 0===a?void 0:a.fontColor)||"#000000","--bn-font-background":(null===(r=e.global)||void 0===r?void 0:r.fontBackgroundColor)||"#ffffff"}}))}getDataStructure(){const t={};for(const e of["ac","pp","fc","pl"])for(const i of[1,2,3,4])t[`${e}${i}`]={type:"number",isOptional:!0,description:""};const e={x:this.prepareAxis("x",this.x),y:this.prepareAxis("y",this.y),size:this.prepareSize(),share:this.prepareShare()};for(const[i,s]of Object.entries(e)){if(null===s)continue;const e=z(s.measure);null!==e&&("scenario"===e.kind?t[e.slot].description=`${i}: ${void 0!==s.label?s.label:s.measure}`:(t[e.measure.base].description=`${i}: ${s.measure} (base)`,t[e.measure.delta].description=`${i}: ${s.measure} (delta)`))}const i=this.prepareCompareFamily();if(null!==i)for(const[s,a]of Object.entries(e)){if(null===a||"share"===s)continue;const e=z(a.measure);if(null!==e&&"scenario"===e.kind){const a=i+e.slot.replace(/^[a-z]+/,"");""===t[a].description&&(t[a].description=s+": compareWith")}}return{IBubbleChartDataRow:Object.assign({operation:{type:"string",isOptional:!1,description:""},rowGroup:{type:"string",isOptional:!0,description:""},rowGroupIndex:{type:"number",isOptional:!0,description:""},category:{type:"string",isOptional:!1,description:""},categoryIndex:{type:"number",isOptional:!1,description:""},subCategory:{type:"string",isOptional:!0,description:""},subCategoryIndex:{type:"number",isOptional:!0,description:""}},t)}}chartTemplate(){const t=this.prepareAxis("x",this.x),e=this.prepareAxis("y",this.y),i=this.prepareSize(),s=this.prepareShare(),r=this.prepareFacet();if(this.validateCrossProp([null==t?void 0:t.measure,null==e?void 0:e.measure,null==i?void 0:i.measure,null==s?void 0:s.measure],r),this.validateSizeScaling(),this.hasBlockingErrors()||null===t||null===e||null===i)return null;const n=this.preparePointLevel(),l=this.prepareI18n(),o=this.prepareStyle(),h=u(this.element).width;return a("bn-chart-bubble-renderer",{tableName:this.datasetName,dataVersion:this.dataVersion,chartTitle:this.chartTitle,x:t,y:e,size:i,share:s,compareFamily:this.prepareCompareFamily(),labels:this.prepareLabels(),legend:this.prepareLegend(),facet:r,pointLevel:n,seriesLevel:this.prepareSeriesLevel(n),aspect:this.prepareAspect(),limit:this.prepareLimit(),filter:this.filter,sizeAreaPerUnit:this.prepareSizeAreaPerUnit(),styles:o,i18n:l,containerWidth:h,ruleSetConfig:this.ruleSetConfig(),errors:this.errors,translator:this.translateForInner})}render(){return a(r,{key:"2b15b5b4fc32db48b951e82ecc87f25b0afcc9f8",style:this.getFontStyles()},a("div",{key:"210d8622e1785b8c882f9c9a2fa2072af0e857b6",class:"container"},this.chartTemplate()))}get element(){return this}static get watchers(){return{filter:[{validateFilter:0}],x:[{validateX:0}],y:[{validateY:0}],size:[{validateSize:0}],share:[{validateShare:0}],compareWith:[{validateCompareWith:0}],level:[{validateLevel:0}],seriesLevel:[{validateSeriesLevel:0}],facet:[{validateFacet:0}],labels:[{validateLabels:0}],legend:[{validateLegend:0}],aspect:[{validateAspect:0}],limit:[{validateLimit:0}],scale:[{validateScale:0}]}}static get style(){return':host(.no-data){display:block;box-sizing:border-box;width:100%;height:100%}:host(.no-data)>div{float:none;width:100%;height:100%}:host(.no-data) .no-data~.no-data{display:none}.empty-state{box-sizing:border-box;display:flex;align-items:center;justify-content:center;float:none;width:100%;height:100%;min-height:3em;margin:0;padding:0.5em;overflow:hidden;border:0.1em dashed #ddd;color:#808080;font-family:var(--bn-font-family, "Noto Sans", sans-serif);font-size:var(--bn-font-size, 13.3333px);font-style:normal;text-align:center}:host{display:inline-block;position:relative;overflow:hidden;font-family:var(--bn-font-family, "Noto Sans", sans-serif);font-size:var(--bn-font-size, 13.3333px);color:var(--bn-font-color, #000000)}.container{display:flex;flex-direction:column}'}},[1,"bn-chart-bubble",{datasets:[513],selectedStyle:[513,"selected-style"],i18nNamespace:[513,"i18n-namespace"],ruleset:[513],chartTitle:[1,"chart-title"],filter:[1],x:[1],y:[1],size:[1],share:[1],compareWith:[1,"compare-with"],level:[1],seriesLevel:[1,"series-level"],facet:[1],labels:[1],legend:[1],aspect:[1],limit:[2],scale:[1],datasetName:[32],dataVersion:[32],datasetMeta:[32],appliedScaleFactor:[32],getBaseline:[64],getLayoutState:[64]},void 0,{filter:[{validateFilter:0}],x:[{validateX:0}],y:[{validateY:0}],size:[{validateSize:0}],share:[{validateShare:0}],compareWith:[{validateCompareWith:0}],level:[{validateLevel:0}],seriesLevel:[{validateSeriesLevel:0}],facet:[{validateFacet:0}],labels:[{validateLabels:0}],legend:[{validateLegend:0}],aspect:[{validateAspect:0}],limit:[{validateLimit:0}],scale:[{validateScale:0}]}]),U=T,X=function(){"undefined"!=typeof customElements&&["bn-chart-bubble","bn-chart-bubble-renderer"].forEach((t=>{switch(t){case"bn-chart-bubble":customElements.get(n(t))||customElements.define(n(t),T);break;case"bn-chart-bubble-renderer":customElements.get(n(t))||O()}}))};export{U as BnChartBubble,X as defineCustomElement}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{B as o,d as s}from"./p-
|
|
1
|
+
import{B as o,d as s}from"./p-BFoRIqDi.js";const p=o,r=s;export{p as BnChartBulletRenderer,r as defineCustomElement}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{p as t,H as e,w as i,f as s,h as r,a,t as n}from"./p-D6YGOYV1.js";import{h as l,a as o}from"./p-Cxx0YNnl.js";import{o as u}from"./p-BrJZUp-K.js";import{c as h}from"./p-kvYRImZT.js";import{a as d}from"./p-JofGXz75.js";import{C as c,A as p}from"./p-B5tixDPM.js";import{o as v}from"./p-B6kka9sT.js";import{a as m,b as g,O as f}from"./p-16rjcQ0t.js";import{g as b}from"./p-Dsvjkuy3.js";import{p as y}from"./p-Xb6Ilq8u.js";import{b as _,i as w,c as j,h as A}from"./p-BKLq0Pbv.js";import{w as O}from"./p-Dq9dG0Kr.js";import{w as R}from"./p-9X5fVJqR.js";import{w as N}from"./p-BKA15uoz.js";import{w as x}from"./p-4vVbchX2.js";import{r as S}from"./p-D_Sbhd0L.js";import{w as E}from"./p-Bd8cQiLx.js";import{w as z}from"./p-Bj3RWsEx.js";import{w as T}from"./p-uCpFBDF5.js";import{r as k}from"./p-BXXjh6We.js";import{p as W}from"./p-9mUU4itF.js";import{s as D}from"./p-DakXa7Dp.js";import{d as L}from"./p-BuWNCnvR.js";const F=["measure","label","unit"];function U(t){const e=[],i=V(t,"measure",e);if(void 0===i||""===i.trim())return e.push("measure"),{config:null,unknownKeys:C(t,F),invalidFields:e};const s={measure:i.trim()};return s.label=V(t,"label",e),s.unit=V(t,"unit",e),{config:s,unknownKeys:C(t,F),invalidFields:e}}const $=["show","decimals"];function B(t,e){const i=[],s={show:e.show,decimals:e.decimals};return c.isExisting(t.show)&&("auto"===t.show||"none"===t.show?s.show=t.show:i.push("show")),c.isExisting(t.decimals)&&(c.isNumber(t.decimals)&&t.decimals>=0&&t.decimals<=4?s.decimals=Math.floor(t.decimals):i.push("decimals")),{config:s,unknownKeys:C(t,$),invalidFields:i}}function M(t){var e;const i=null!==(e=null==t?void 0:t.trim())&&void 0!==e?e:"";if(""===i||"null"===i)return{ranges:[],parseError:!1,issues:[]};let s;try{s=JSON.parse(i)}catch(t){return{ranges:[],parseError:!0,issues:[]}}if(!Array.isArray(s)||0===s.length)return{ranges:[],parseError:!0,issues:[]};if(!s.every((t=>c.isNumber(t)&&isFinite(t)&&t>0)))return{ranges:[],parseError:!0,issues:[]};const r=[];let a=s;const n=[...a].sort(((t,e)=>t-e));return n.some(((t,e)=>t!==a[e]))&&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 C(t,e){return Object.keys(t).filter((t=>!e.includes(t)))}function V(t,e,i){if(c.isExisting(t[e]))return c.isString(t[e])?t[e]:void i.push(e)}const I=["pl1","pp1","fc1"],K=t(class extends e{validateFilter(t){const e="ERR_filter";l(t)?this.errors.addOrReplace({id:e,type:"error",message:"filter: double backticks are not allowed."}):this.errors.remove(e)}validateActual(t){this.validateMeasureSpec("actual",t)}validateTarget(t){this.validateMeasureSpec("target",t)}validateRanges(t){const e="ERR_bullet_json_ranges",i="WARN_bullet_ranges",s=M(t);if(s.parseError)return this.setBlockingError(e,this.t(".bullet-prop-json",{prop:"ranges"})),void this.errors.remove(i);this.setBlockingError(e,null),s.issues.length>0?this.errors.addOrReplace({id:i,type:"warning",message:this.t(".bullet-ranges-invalid",{detail:s.issues.join("; ")})}):this.errors.remove(i)}validateNormalize(t){this.validateEnum("normalize","WARN_normalize",t,["target","none"],"target")}validateVariances(t){this.validateEnum("variances","WARN_variances",t,["auto","none"],"auto")}validateLevel(t){this.validateEnum("level","WARN_level",t,["auto","rowgroup","category","subcategory"],"auto")}validateOrder(t){const e="WARN_order",i=_(t).filter((t=>""!==t));0===i.length?this.errors.remove(e):this.errors.addOrReplace({id:e,type:"warning",message:`order: invalid value(s) '${i.join(", ")}'; using the dataset order.`})}validateOrderDirection(t){const e="WARN_orderDirection";w(t)||j(t)?this.errors.remove(e):this.errors.addOrReplace({id:e,type:"warning",message:`order-direction: invalid value '${t}' - expected asc/desc; using asc.`})}validateLimit(t){const e="WARN_limit";A(t)&&Number(t)>=0?this.errors.remove(e):this.errors.addOrReplace({id:e,type:"warning",message:`limit: invalid value '${t}' - expected a non-negative integer; using 0.`})}validateLabels(t){const e="ERR_bullet_json_labels",i="WARN_bullet_fields_labels",{data:s,parseError:r}=W(t,null);if(r)return this.setBlockingError(e,this.t(".bullet-prop-json",{prop:"labels"})),void this.errors.remove(i);this.setBlockingError(e,null),null!==s?this.reportSpecIssues(i,"labels",B(s,this.labelDefaults())):this.errors.remove(i)}validateScale(t){const e="WARN_scale";if(w(t))return void this.errors.remove(e);const{mode:i,factor:s}=y(t);"factor"===i&&(void 0===s||s<=0)?this.errors.addOrReplace({id:e,type:"warning",message:`scale: invalid value '${t}' - expected none/auto or a positive number.`}):this.errors.remove(e)}constructor(t){super(),!1!==t&&this.__registerHost(),this.__attachShadow(),this.datasetName="",this.dataVersion=0,this.datasetMeta=null,this.appliedScaleFactor=1,this.layoutObserver=null,this.activeErrors=new Set,this.chartTitle="",this.filter="",this.actual="",this.target="",this.ranges="",this.normalizeMode="target",this.variances="auto",this.level="auto",this.order="",this.orderDirection="",this.limit=0,this.labels="",this._autoScaleGuard=!1,this._lastScaledParentHeight=0,this.translateForInner=(t,e)=>this.t(t,e),T(this),O(this),N(this,(t=>{this.datasetName=(null==t?void 0:t.startsWith("$"))?t.substring(1):t||"",this.dataVersion=this.dataVersion+1}),((t,e)=>{this.datasetMeta=e})),this.errors=x(this),this.componentStyle=R(this),this.ruleSetConfig=E(this),this.t=z(this).t}componentWillLoad(){this.validateFilter(this.filter),this.validateActual(this.actual),this.validateTarget(this.target),this.validateRanges(this.ranges),this.validateNormalize(this.normalizeMode),this.validateVariances(this.variances),this.validateLevel(this.level),this.validateOrder(this.order),this.validateOrderDirection(this.orderDirection),this.validateLimit(this.limit),this.validateLabels(this.labels),this.validateScale(this.scale)}componentDidRender(){D(this.element,"bn-chart-bullet-renderer");const{mode:t}=y(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}=b(e);if(s<=0)return;this._lastScaledParentHeight=s;const r=this.componentStyle((t=>{var e;return(null===(e=t.global)||void 0===e?void 0:e.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=v(this.element,(()=>{if(this._autoScaleGuard)return;const{height:t}=b(this.element);t>0&&Math.abs(t-this._lastScaledParentHeight)>2&&(this._lastScaledParentHeight=t,s(this))})),requestAnimationFrame((()=>{requestAnimationFrame((()=>{if(this._autoScaleGuard)return;const{height:t}=b(this.element);this._lastScaledParentHeight=t,s(this)}))}))}disconnectedCallback(){var t;null===(t=this.layoutObserver)||void 0===t||t.disconnect(),this.layoutObserver=null}labelDefaults(){return{show:"auto",decimals:1}}setBlockingError(t,e){null===e?(this.errors.remove(t),this.activeErrors.delete(t)):(this.errors.addOrReplace({id:t,type:"error",message:e}),this.activeErrors.add(t))}hasBlockingErrors(){return this.activeErrors.size>0}validateMeasureSpec(t,e){var i;const s="ERR_bullet_json_"+t,r="ERR_bullet_measure_"+t,a="WARN_bullet_fields_"+t,{data:n,parseError:l}=W(e,"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 o=(null!==(i=n.measure)&&void 0!==i?i:"").trim(),u=k(o);"auto"===o.toLowerCase()||null!==u&&"scenario"===u.kind?this.setBlockingError(r,null):this.setBlockingError(r,this.t(".bullet-measure-invalid",{prop:t,measure:o})),this.reportSpecIssues(a,t,U(n))}validateEnum(t,e,i,s,r){w(i)||s.includes(i.trim().toLowerCase())?this.errors.remove(e):this.errors.addOrReplace({id:e,type:"warning",message:`${t}: invalid value '${i}' - expected ${s.join("/")}; using '${r}'.`})}reportSpecIssues(t,e,i){const s=[];null!==i&&i.invalidFields.length>0&&s.push("invalid: "+i.invalidFields.join(", ")),null!==i&&i.unknownKeys.length>0&&s.push("unknown: "+i.unknownKeys.join(", ")),s.length>0?this.errors.addOrReplace({id:t,type:"warning",message:`${e}: ignored sub-fields (${s.join("; ")}).`}):this.errors.remove(t)}prepareActual(){var t,e,i,s,r;const{data:a,parseError:n}=W(this.actual,"measure");if(n)return null;const l=null!==a?U(a).config:null;if(null===l||"auto"===l.measure.toLowerCase()){const r=null!==l,a=null!==(e=null===(t=this.datasetMeta)||void 0===t?void 0:t.availableScenarios)&&void 0!==e?e:[],n=null!==(s=a.includes("ac1")?"ac1":null!==(i=a.find((t=>t.startsWith("ac"))))&&void 0!==i?i: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=k(l.measure))||void 0===r?void 0:r.kind)?l:null}prepareTarget(){var t,e,i;const{data:s,parseError:r}=W(this.target,"measure");if(r)return null;const a=null!==s?U(s).config:null;if(null===a||"auto"===a.measure.toLowerCase()){const i=null!==a,s=null!==(e=null===(t=this.datasetMeta)||void 0===t?void 0:t.availableScenarios)&&void 0!==e?e:[],r=I.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"),i||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===(i=k(a.measure))||void 0===i?void 0:i.kind)?a:null}prepareNormalize(){var t;return"none"===(null===(t=this.normalizeMode)||void 0===t?void 0:t.trim().toLowerCase())?"none":"target"}prepareShowVariances(){var t;return"none"!==(null===(t=this.variances)||void 0===t?void 0:t.trim().toLowerCase())}prepareLevel(){var t,e;const i=null===(t=this.level)||void 0===t?void 0:t.trim().toLowerCase();if("rowgroup"===i)return p.ROWGROUP;if("category"===i)return p.CATEGORY;if("subcategory"===i)return p.SUBCATEGORY;const s=null===(e=this.datasetMeta)||void 0===e?void 0:e.suggestedLevel;if(void 0!==s&&""!==s){const t=p[s.toUpperCase()];if(void 0!==t)return t}return p.CATEGORY}prepareOrder(){var t,e,i,s;const r="auto"===(null===(t=this.order)||void 0===t?void 0:t.trim().toLowerCase());let a;w(this.order)||r?(null===(e=this.datasetMeta)||void 0===e?void 0:e.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=m[null===(i=this.orderDirection)||void 0===i?void 0:i.toUpperCase()])&&void 0!==s?s:m.ASC;if(w(a))return new g([f.CATEGORYINDEX],n);const l=a.split(",").map((t=>f[t.trim().toUpperCase()])).filter((t=>void 0!==t));return new g(l.length>0?l:[f.CATEGORYINDEX],n)}prepareLabels(){const t=this.labelDefaults(),{data:e,parseError:i}=W(this.labels,null);return i||null===e?{show:t.show,decimals:t.decimals}:B(e,t).config}prepareLimit(){const t=Math.floor(Number(this.limit)||0);return t>0?t:0}i18nLocalKeys(){return["no-data","target","axis.in"]}prepareI18n(){const t=new Map(this.i18nLocalKeys().map((t=>[t,this.t(".".concat(t))]))),e=new Map(o.map((t=>[t,this.t("global.".concat(t))])));return new Map([...e.entries(),...t.entries(),...S(this.ruleSetConfig("user"))])}prepareStyle(){const t=this.getEffectiveScaleFactor();return this.componentStyle((e=>{const i=e.global.fontSizePx*t;return{scaleFactors:e["bn-chart-bullet"].scaleFactors,fontStyles:{font:`${i}px ${e.global.fontFamily}`,size:i,color:e.global.fontColor,background:e.global.fontBackgroundColor,leading:1.8},axisStyles:e["bn-chart-bullet"].axisStyles,barStyles:e["bn-chart-bullet"].barStyles,varianceStyles:e["bn-chart-bullet"].varianceStyles,rangeColors:e["bn-chart-bullet"].rangeColors,padding:e["bn-chart-bullet"].padding}}))}async getBaseline(){return d(this.element,"bn-chart-bullet-renderer")}async getLayoutState(t){var e;const i=null!==(e=null==t?void 0:t.detail)&&void 0!==e?e:"summary",s=u(this.element),r=this.getEffectiveScaleFactor(),a=Number.isFinite(r)&&r>0?r:1,n=this.componentStyle((t=>{var e;return(null===(e=t.global)||void 0===e?void 0:e.fontSizePx)||13.3333}))*a;return h(this.element,"bn-chart-bullet-renderer",this.chartTitle||void 0,{fontSizePx:n,appliedScaleFactor:a},s,i)}getEffectiveScaleFactor(){const{mode:t,factor:e}=y(this.scale);return"factor"===t?e:"auto"===t||"empty"===t?this.appliedScaleFactor:1}getFontStyles(){const t=this.getEffectiveScaleFactor();return this.componentStyle((e=>{var i,s,r,a;const n=(null===(i=e.global)||void 0===i?void 0:i.fontSizePx)||13.3333;return{"--bn-font-family":(null===(s=e.global)||void 0===s?void 0:s.fontFamily)||"'Noto Sans', sans-serif","--bn-font-size":n*t+"px","--bn-font-color":(null===(r=e.global)||void 0===r?void 0:r.fontColor)||"#000000","--bn-font-background":(null===(a=e.global)||void 0===a?void 0:a.fontBackgroundColor)||"#ffffff"}}))}getDataStructure(){const t={};for(const e of["ac","pp","fc","pl"])for(const i of[1,2,3,4])t[`${e}${i}`]={type:"number",isOptional:!0,description:""};const e={actual:this.prepareActual(),target:this.prepareTarget()};for(const[i,s]of Object.entries(e))null!==s&&void 0!==t[s.measure]&&(t[s.measure].description=`${i}: ${void 0!==s.label?s.label:s.measure}`);return{IBulletChartDataRow:Object.assign({operation:{type:"string",isOptional:!1,description:""},rowGroup:{type:"string",isOptional:!0,description:""},rowGroupIndex:{type:"number",isOptional:!0,description:""},category:{type:"string",isOptional:!1,description:""},categoryIndex:{type:"number",isOptional:!1,description:""},subCategory:{type:"string",isOptional:!0,description:""},subCategoryIndex:{type:"number",isOptional:!0,description:""}},t)}}chartTemplate(){const t=this.prepareActual(),e=this.prepareTarget(),i=M(this.ranges).ranges,s=this.prepareNormalize();return this.setBlockingError("ERR_bullet_measure_same",null!==t&&null!==e&&t.measure===e.measure?this.t(".bullet-measure-same",{measure:t.measure}):null),i.length>0&&"target"===s?this.errors.addOrReplace({id:"WARN_bullet_ranges_ignored",type:"warning",message:this.t(".bullet-ranges-ignored")}):this.errors.remove("WARN_bullet_ranges_ignored"),this.hasBlockingErrors()||null===t?null:r("bn-chart-bullet-renderer",{tableName:this.datasetName,dataVersion:this.dataVersion,chartTitle:this.chartTitle,actual:t,target:e,ranges:i,normalizeMode:s,showVariances:this.prepareShowVariances(),level:this.prepareLevel(),order:this.prepareOrder(),limit:this.prepareLimit(),labels:this.prepareLabels(),filter:this.filter,styles:this.prepareStyle(),i18n:this.prepareI18n(),containerWidth:b(this.element).width,ruleSetConfig:this.ruleSetConfig(),errors:this.errors,translator:this.translateForInner})}render(){return r(a,{key:"cdd2404977255a330652806671d1bea76c796769",style:this.getFontStyles()},r("div",{key:"0b8cfeb6209083f9144c5824bceecb9b02578f02",class:"container"},this.chartTemplate()))}get element(){return this}static get watchers(){return{filter:[{validateFilter:0}],actual:[{validateActual:0}],target:[{validateTarget:0}],ranges:[{validateRanges:0}],normalizeMode:[{validateNormalize:0}],variances:[{validateVariances:0}],level:[{validateLevel:0}],order:[{validateOrder:0}],orderDirection:[{validateOrderDirection:0}],limit:[{validateLimit:0}],labels:[{validateLabels:0}],scale:[{validateScale:0}]}}static get style(){return':host(.no-data){display:block;box-sizing:border-box;width:100%;height:100%}:host(.no-data)>div{float:none;width:100%;height:100%}:host(.no-data) .no-data~.no-data{display:none}.empty-state{box-sizing:border-box;display:flex;align-items:center;justify-content:center;float:none;width:100%;height:100%;min-height:3em;margin:0;padding:0.5em;overflow:hidden;border:0.1em dashed #ddd;color:#808080;font-family:var(--bn-font-family, "Noto Sans", sans-serif);font-size:var(--bn-font-size, 13.3333px);font-style:normal;text-align:center}:host{display:inline-block;position:relative;overflow:hidden;font-family:var(--bn-font-family, "Noto Sans", sans-serif);font-size:var(--bn-font-size, 13.3333px);color:var(--bn-font-color, #000000)}.container{display:flex;flex-direction:column}'}},[1,"bn-chart-bullet",{datasets:[513],selectedStyle:[513,"selected-style"],i18nNamespace:[513,"i18n-namespace"],ruleset:[513],chartTitle:[1,"chart-title"],filter:[1],actual:[1],target:[1],ranges:[1],normalizeMode:[1,"normalize"],variances:[1],level:[1],order:[1],orderDirection:[1,"order-direction"],limit:[2],labels:[1],scale:[1],datasetName:[32],dataVersion:[32],datasetMeta:[32],appliedScaleFactor:[32],getBaseline:[64],getLayoutState:[64]},void 0,{filter:[{validateFilter:0}],actual:[{validateActual:0}],target:[{validateTarget:0}],ranges:[{validateRanges:0}],normalizeMode:[{validateNormalize:0}],variances:[{validateVariances:0}],level:[{validateLevel:0}],order:[{validateOrder:0}],orderDirection:[{validateOrderDirection:0}],limit:[{validateLimit:0}],labels:[{validateLabels:0}],scale:[{validateScale:0}]}]),X=K,q=function(){"undefined"!=typeof customElements&&["bn-chart-bullet","bn-chart-bullet-renderer"].forEach((t=>{switch(t){case"bn-chart-bullet":customElements.get(n(t))||customElements.define(n(t),K);break;case"bn-chart-bullet-renderer":customElements.get(n(t))||L()}}))};export{X as BnChartBullet,q as defineCustomElement}
|
|
1
|
+
import{p as t,H as e,w as i,f as s,h as r,d as a,t as n}from"./p-BnmylmXF.js";import{h as l,a as o}from"./p-6242qMx1.js";import{o as u}from"./p-DdvG1D18.js";import{c as h}from"./p-TNX3alPU.js";import{a as d}from"./p-JofGXz75.js";import{C as c,A as p}from"./p-DFybNETX.js";import{o as v}from"./p-B6kka9sT.js";import{a as m,b as g,O as f}from"./p-j42D1yrQ.js";import{g as b}from"./p-Dsvjkuy3.js";import{p as y}from"./p-Xb6Ilq8u.js";import{b as _,i as w,c as j,h as A}from"./p-Dw3rv_Y9.js";import{w as O}from"./p-BrQCbmG0.js";import{w as R}from"./p-JG4Sx1lE.js";import{w as N}from"./p-CZzlLTQc.js";import{w as x}from"./p-D32TsLzd.js";import{r as E}from"./p-CmvpJzLd.js";import{w as S}from"./p-DRmphEA0.js";import{w as z}from"./p-CUoPUIej.js";import{w as D}from"./p-D_K7tYhY.js";import{r as T}from"./p-Dyzb4ika.js";import{p as k}from"./p-DUZCLRVu.js";import{s as L}from"./p-DakXa7Dp.js";import{d as U}from"./p-BFoRIqDi.js";const W=["measure","label","unit"];function F(t){const e=[],i=I(t,"measure",e);if(void 0===i||""===i.trim())return e.push("measure"),{config:null,unknownKeys:B(t,W),invalidFields:e};const s={measure:i.trim()};return s.label=I(t,"label",e),s.unit=I(t,"unit",e),{config:s,unknownKeys:B(t,W),invalidFields:e}}const $=["show","decimals"];function M(t,e){const i=[],s={show:e.show,decimals:e.decimals};return c.isExisting(t.show)&&("auto"===t.show||"none"===t.show?s.show=t.show:i.push("show")),c.isExisting(t.decimals)&&(c.isNumber(t.decimals)&&t.decimals>=0&&t.decimals<=4?s.decimals=Math.floor(t.decimals):i.push("decimals")),{config:s,unknownKeys:B(t,$),invalidFields:i}}function C(t){var e;const i=null!==(e=null==t?void 0:t.trim())&&void 0!==e?e:"";if(""===i||"null"===i)return{ranges:[],parseError:!1,issues:[]};let s;try{s=JSON.parse(i)}catch(t){return{ranges:[],parseError:!0,issues:[]}}if(!Array.isArray(s)||0===s.length)return{ranges:[],parseError:!0,issues:[]};if(!s.every((t=>c.isNumber(t)&&isFinite(t)&&t>0)))return{ranges:[],parseError:!0,issues:[]};const r=[];let a=s;const n=[...a].sort(((t,e)=>t-e));return n.some(((t,e)=>t!==a[e]))&&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 B(t,e){return Object.keys(t).filter((t=>!e.includes(t)))}function I(t,e,i){if(c.isExisting(t[e]))return c.isString(t[e])?t[e]:void i.push(e)}const V=["pl1","pp1","fc1"],G=t(class extends e{validateFilter(t){const e="ERR_filter";l(t)?this.errors.addOrReplace({id:e,type:"error",message:"filter: double backticks are not allowed."}):this.errors.remove(e)}validateActual(t){this.validateMeasureSpec("actual",t)}validateTarget(t){this.validateMeasureSpec("target",t)}validateRanges(t){const e="ERR_bullet_json_ranges",i="WARN_bullet_ranges",s=C(t);if(s.parseError)return this.setBlockingError(e,this.t(".bullet-prop-json",{prop:"ranges"})),void this.errors.remove(i);this.setBlockingError(e,null),s.issues.length>0?this.errors.addOrReplace({id:i,type:"warning",message:this.t(".bullet-ranges-invalid",{detail:s.issues.join("; ")})}):this.errors.remove(i)}validateNormalize(t){this.validateEnum("normalize","WARN_normalize",t,["target","none"],"target")}validateVariances(t){this.validateEnum("variances","WARN_variances",t,["auto","none"],"auto")}validateLevel(t){this.validateEnum("level","WARN_level",t,["auto","rowgroup","category","subcategory"],"auto")}validateOrder(t){const e="WARN_order",i=_(t).filter((t=>""!==t));0===i.length?this.errors.remove(e):this.errors.addOrReplace({id:e,type:"warning",message:`order: invalid value(s) '${i.join(", ")}'; using the dataset order.`})}validateOrderDirection(t){const e="WARN_orderDirection";w(t)||j(t)?this.errors.remove(e):this.errors.addOrReplace({id:e,type:"warning",message:`order-direction: invalid value '${t}' - expected asc/desc; using asc.`})}validateLimit(t){const e="WARN_limit";A(t)&&Number(t)>=0?this.errors.remove(e):this.errors.addOrReplace({id:e,type:"warning",message:`limit: invalid value '${t}' - expected a non-negative integer; using 0.`})}validateLabels(t){const e="ERR_bullet_json_labels",i="WARN_bullet_fields_labels",{data:s,parseError:r}=k(t,null);if(r)return this.setBlockingError(e,this.t(".bullet-prop-json",{prop:"labels"})),void this.errors.remove(i);this.setBlockingError(e,null),null!==s?this.reportSpecIssues(i,"labels",M(s,this.labelDefaults())):this.errors.remove(i)}validateScale(t){const e="WARN_scale";if(w(t))return void this.errors.remove(e);const{mode:i,factor:s}=y(t);"factor"===i&&(void 0===s||s<=0)?this.errors.addOrReplace({id:e,type:"warning",message:`scale: invalid value '${t}' - expected none/auto or a positive number.`}):this.errors.remove(e)}constructor(t){super(),!1!==t&&this.__registerHost(),this.__attachShadow(),this.datasetName="",this.dataVersion=0,this.datasetMeta=null,this.appliedScaleFactor=1,this.layoutObserver=null,this.activeErrors=new Set,this.chartTitle="",this.filter="",this.actual="",this.target="",this.ranges="",this.normalizeMode="target",this.variances="auto",this.level="auto",this.order="",this.orderDirection="",this.limit=0,this.labels="",this._autoScaleGuard=!1,this._lastScaledParentHeight=0,this.translateForInner=(t,e)=>this.t(t,e),D(this),O(this),N(this,(t=>{this.datasetName=(null==t?void 0:t.startsWith("$"))?t.substring(1):t||"",this.dataVersion=this.dataVersion+1}),((t,e)=>{this.datasetMeta=e})),this.errors=x(this),this.componentStyle=R(this),this.ruleSetConfig=S(this),this.t=z(this).t}componentWillLoad(){this.validateFilter(this.filter),this.validateActual(this.actual),this.validateTarget(this.target),this.validateRanges(this.ranges),this.validateNormalize(this.normalizeMode),this.validateVariances(this.variances),this.validateLevel(this.level),this.validateOrder(this.order),this.validateOrderDirection(this.orderDirection),this.validateLimit(this.limit),this.validateLabels(this.labels),this.validateScale(this.scale)}componentDidRender(){L(this.element,"bn-chart-bullet-renderer");const{mode:t}=y(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}=b(e);if(s<=0)return;this._lastScaledParentHeight=s;const r=this.componentStyle((t=>{var e;return(null===(e=t.global)||void 0===e?void 0:e.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=v(this.element,(()=>{if(this._autoScaleGuard)return;const{height:t}=b(this.element);t>0&&Math.abs(t-this._lastScaledParentHeight)>2&&(this._lastScaledParentHeight=t,s(this))})),requestAnimationFrame((()=>{requestAnimationFrame((()=>{if(this._autoScaleGuard)return;const{height:t}=b(this.element);this._lastScaledParentHeight=t,s(this)}))}))}disconnectedCallback(){var t;null===(t=this.layoutObserver)||void 0===t||t.disconnect(),this.layoutObserver=null}labelDefaults(){return{show:"auto",decimals:1}}setBlockingError(t,e){null===e?(this.errors.remove(t),this.activeErrors.delete(t)):(this.errors.addOrReplace({id:t,type:"error",message:e}),this.activeErrors.add(t))}hasBlockingErrors(){return this.activeErrors.size>0}validateMeasureSpec(t,e){var i;const s="ERR_bullet_json_"+t,r="ERR_bullet_measure_"+t,a="WARN_bullet_fields_"+t,{data:n,parseError:l}=k(e,"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 o=(null!==(i=n.measure)&&void 0!==i?i:"").trim(),u=T(o);"auto"===o.toLowerCase()||null!==u&&"scenario"===u.kind?this.setBlockingError(r,null):this.setBlockingError(r,this.t(".bullet-measure-invalid",{prop:t,measure:o})),this.reportSpecIssues(a,t,F(n))}validateEnum(t,e,i,s,r){w(i)||s.includes(i.trim().toLowerCase())?this.errors.remove(e):this.errors.addOrReplace({id:e,type:"warning",message:`${t}: invalid value '${i}' - expected ${s.join("/")}; using '${r}'.`})}reportSpecIssues(t,e,i){const s=[];null!==i&&i.invalidFields.length>0&&s.push("invalid: "+i.invalidFields.join(", ")),null!==i&&i.unknownKeys.length>0&&s.push("unknown: "+i.unknownKeys.join(", ")),s.length>0?this.errors.addOrReplace({id:t,type:"warning",message:`${e}: ignored sub-fields (${s.join("; ")}).`}):this.errors.remove(t)}prepareActual(){var t,e,i,s,r;const{data:a,parseError:n}=k(this.actual,"measure");if(n)return null;const l=null!==a?F(a).config:null;if(null===l||"auto"===l.measure.toLowerCase()){const r=null!==l,a=null!==(e=null===(t=this.datasetMeta)||void 0===t?void 0:t.availableScenarios)&&void 0!==e?e:[],n=null!==(s=a.includes("ac1")?"ac1":null!==(i=a.find((t=>t.startsWith("ac"))))&&void 0!==i?i: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=T(l.measure))||void 0===r?void 0:r.kind)?l:null}prepareTarget(){var t,e,i;const{data:s,parseError:r}=k(this.target,"measure");if(r)return null;const a=null!==s?F(s).config:null;if(null===a||"auto"===a.measure.toLowerCase()){const i=null!==a,s=null!==(e=null===(t=this.datasetMeta)||void 0===t?void 0:t.availableScenarios)&&void 0!==e?e:[],r=V.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"),i||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===(i=T(a.measure))||void 0===i?void 0:i.kind)?a:null}prepareNormalize(){var t;return"none"===(null===(t=this.normalizeMode)||void 0===t?void 0:t.trim().toLowerCase())?"none":"target"}prepareShowVariances(){var t;return"none"!==(null===(t=this.variances)||void 0===t?void 0:t.trim().toLowerCase())}prepareLevel(){var t,e;const i=null===(t=this.level)||void 0===t?void 0:t.trim().toLowerCase();if("rowgroup"===i)return p.ROWGROUP;if("category"===i)return p.CATEGORY;if("subcategory"===i)return p.SUBCATEGORY;const s=null===(e=this.datasetMeta)||void 0===e?void 0:e.suggestedLevel;if(void 0!==s&&""!==s){const t=p[s.toUpperCase()];if(void 0!==t)return t}return p.CATEGORY}prepareOrder(){var t,e,i,s;const r="auto"===(null===(t=this.order)||void 0===t?void 0:t.trim().toLowerCase());let a;w(this.order)||r?(null===(e=this.datasetMeta)||void 0===e?void 0:e.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=m[null===(i=this.orderDirection)||void 0===i?void 0:i.toUpperCase()])&&void 0!==s?s:m.ASC;if(w(a))return new g([f.CATEGORYINDEX],n);const l=a.split(",").map((t=>f[t.trim().toUpperCase()])).filter((t=>void 0!==t));return new g(l.length>0?l:[f.CATEGORYINDEX],n)}prepareLabels(){const t=this.labelDefaults(),{data:e,parseError:i}=k(this.labels,null);return i||null===e?{show:t.show,decimals:t.decimals}:M(e,t).config}prepareLimit(){const t=Math.floor(Number(this.limit)||0);return t>0?t:0}i18nLocalKeys(){return["no-data","target","axis.in"]}prepareI18n(){const t=new Map(this.i18nLocalKeys().map((t=>[t,this.t(".".concat(t))]))),e=new Map(o.map((t=>[t,this.t("global.".concat(t))])));return new Map([...e.entries(),...t.entries(),...E(this.ruleSetConfig("user"))])}prepareStyle(){const t=this.getEffectiveScaleFactor();return this.componentStyle((e=>{const i=e.global.fontSizePx*t;return{scaleFactors:e["bn-chart-bullet"].scaleFactors,fontStyles:{font:`${i}px ${e.global.fontFamily}`,size:i,color:e.global.fontColor,background:e.global.fontBackgroundColor,leading:1.8},axisStyles:e["bn-chart-bullet"].axisStyles,barStyles:e["bn-chart-bullet"].barStyles,varianceStyles:e["bn-chart-bullet"].varianceStyles,rangeColors:e["bn-chart-bullet"].rangeColors,padding:e["bn-chart-bullet"].padding}}))}async getBaseline(){return d(this.element,"bn-chart-bullet-renderer")}async getLayoutState(t){var e;const i=null!==(e=null==t?void 0:t.detail)&&void 0!==e?e:"summary",s=u(this.element),r=this.getEffectiveScaleFactor(),a=Number.isFinite(r)&&r>0?r:1,n=this.componentStyle((t=>{var e;return(null===(e=t.global)||void 0===e?void 0:e.fontSizePx)||13.3333}))*a;return h(this.element,"bn-chart-bullet-renderer",this.chartTitle||void 0,{fontSizePx:n,appliedScaleFactor:a},s,i)}getEffectiveScaleFactor(){const{mode:t,factor:e}=y(this.scale);return"factor"===t?e:"auto"===t||"empty"===t?this.appliedScaleFactor:1}getFontStyles(){const t=this.getEffectiveScaleFactor();return this.componentStyle((e=>{var i,s,r,a;const n=(null===(i=e.global)||void 0===i?void 0:i.fontSizePx)||13.3333;return{"--bn-font-family":(null===(s=e.global)||void 0===s?void 0:s.fontFamily)||"'Noto Sans', sans-serif","--bn-font-size":n*t+"px","--bn-font-color":(null===(r=e.global)||void 0===r?void 0:r.fontColor)||"#000000","--bn-font-background":(null===(a=e.global)||void 0===a?void 0:a.fontBackgroundColor)||"#ffffff"}}))}getDataStructure(){const t={};for(const e of["ac","pp","fc","pl"])for(const i of[1,2,3,4])t[`${e}${i}`]={type:"number",isOptional:!0,description:""};const e={actual:this.prepareActual(),target:this.prepareTarget()};for(const[i,s]of Object.entries(e))null!==s&&void 0!==t[s.measure]&&(t[s.measure].description=`${i}: ${void 0!==s.label?s.label:s.measure}`);return{IBulletChartDataRow:Object.assign({operation:{type:"string",isOptional:!1,description:""},rowGroup:{type:"string",isOptional:!0,description:""},rowGroupIndex:{type:"number",isOptional:!0,description:""},category:{type:"string",isOptional:!1,description:""},categoryIndex:{type:"number",isOptional:!1,description:""},subCategory:{type:"string",isOptional:!0,description:""},subCategoryIndex:{type:"number",isOptional:!0,description:""}},t)}}chartTemplate(){const t=this.prepareActual(),e=this.prepareTarget(),i=C(this.ranges).ranges,s=this.prepareNormalize();return this.setBlockingError("ERR_bullet_measure_same",null!==t&&null!==e&&t.measure===e.measure?this.t(".bullet-measure-same",{measure:t.measure}):null),i.length>0&&"target"===s?this.errors.addOrReplace({id:"WARN_bullet_ranges_ignored",type:"warning",message:this.t(".bullet-ranges-ignored")}):this.errors.remove("WARN_bullet_ranges_ignored"),this.hasBlockingErrors()||null===t?null:r("bn-chart-bullet-renderer",{tableName:this.datasetName,dataVersion:this.dataVersion,chartTitle:this.chartTitle,actual:t,target:e,ranges:i,normalizeMode:s,showVariances:this.prepareShowVariances(),level:this.prepareLevel(),order:this.prepareOrder(),limit:this.prepareLimit(),labels:this.prepareLabels(),filter:this.filter,styles:this.prepareStyle(),i18n:this.prepareI18n(),containerWidth:b(this.element).width,ruleSetConfig:this.ruleSetConfig(),errors:this.errors,translator:this.translateForInner})}render(){return r(a,{key:"cdd2404977255a330652806671d1bea76c796769",style:this.getFontStyles()},r("div",{key:"0b8cfeb6209083f9144c5824bceecb9b02578f02",class:"container"},this.chartTemplate()))}get element(){return this}static get watchers(){return{filter:[{validateFilter:0}],actual:[{validateActual:0}],target:[{validateTarget:0}],ranges:[{validateRanges:0}],normalizeMode:[{validateNormalize:0}],variances:[{validateVariances:0}],level:[{validateLevel:0}],order:[{validateOrder:0}],orderDirection:[{validateOrderDirection:0}],limit:[{validateLimit:0}],labels:[{validateLabels:0}],scale:[{validateScale:0}]}}static get style(){return':host(.no-data){display:block;box-sizing:border-box;width:100%;height:100%}:host(.no-data)>div{float:none;width:100%;height:100%}:host(.no-data) .no-data~.no-data{display:none}.empty-state{box-sizing:border-box;display:flex;align-items:center;justify-content:center;float:none;width:100%;height:100%;min-height:3em;margin:0;padding:0.5em;overflow:hidden;border:0.1em dashed #ddd;color:#808080;font-family:var(--bn-font-family, "Noto Sans", sans-serif);font-size:var(--bn-font-size, 13.3333px);font-style:normal;text-align:center}:host{display:inline-block;position:relative;overflow:hidden;font-family:var(--bn-font-family, "Noto Sans", sans-serif);font-size:var(--bn-font-size, 13.3333px);color:var(--bn-font-color, #000000)}.container{display:flex;flex-direction:column}'}},[1,"bn-chart-bullet",{datasets:[513],selectedStyle:[513,"selected-style"],i18nNamespace:[513,"i18n-namespace"],ruleset:[513],chartTitle:[1,"chart-title"],filter:[1],actual:[1],target:[1],ranges:[1],normalizeMode:[1,"normalize"],variances:[1],level:[1],order:[1],orderDirection:[1,"order-direction"],limit:[2],labels:[1],scale:[1],datasetName:[32],dataVersion:[32],datasetMeta:[32],appliedScaleFactor:[32],getBaseline:[64],getLayoutState:[64]},void 0,{filter:[{validateFilter:0}],actual:[{validateActual:0}],target:[{validateTarget:0}],ranges:[{validateRanges:0}],normalizeMode:[{validateNormalize:0}],variances:[{validateVariances:0}],level:[{validateLevel:0}],order:[{validateOrder:0}],orderDirection:[{validateOrderDirection:0}],limit:[{validateLimit:0}],labels:[{validateLabels:0}],scale:[{validateScale:0}]}]),X=G,q=function(){"undefined"!=typeof customElements&&["bn-chart-bullet","bn-chart-bullet-renderer"].forEach((t=>{switch(t){case"bn-chart-bullet":customElements.get(n(t))||customElements.define(n(t),G);break;case"bn-chart-bullet-renderer":customElements.get(n(t))||U()}}))};export{X as BnChartBullet,q as defineCustomElement}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{B as
|
|
1
|
+
import{B as r,d as o}from"./p-D3hr9wra.js";const s=r,a=o;export{s as BnChartScatterRenderer,a as defineCustomElement}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{p as t,H as e,w as s,f as i,h as a,a as r,t as n}from"./p-D6YGOYV1.js";import{h as o,a as l}from"./p-Cxx0YNnl.js";import{o as h}from"./p-BrJZUp-K.js";import{c as d}from"./p-kvYRImZT.js";import{a as c}from"./p-JofGXz75.js";import{g as u}from"./p-Dsvjkuy3.js";import{c as p}from"./p-C50Ge-4H.js";import{o as v}from"./p-B6kka9sT.js";import{p as m}from"./p-Xb6Ilq8u.js";import{i as f,h as y,j as g}from"./p-BKLq0Pbv.js";import{w as b}from"./p-Dq9dG0Kr.js";import{w as x}from"./p-9X5fVJqR.js";import{w}from"./p-BKA15uoz.js";import{w as _}from"./p-4vVbchX2.js";import{w as j}from"./p-Bd8cQiLx.js";import{w as L}from"./p-Bj3RWsEx.js";import{w as S}from"./p-uCpFBDF5.js";import{r as R,s as $}from"./p-BXXjh6We.js";import{f as A,c as N,d as E,e as k,p as F,t as O}from"./p-9mUU4itF.js";import{s as C}from"./p-DakXa7Dp.js";import{d as z}from"./p-Dxj_pf8s.js";const W={rowGroup:0,category:1,subCategory:2},B=t(class extends e{validateFilter(t){const e="ERR_filter";o(t)?this.errors.addOrReplace({id:e,type:"error",message:"filter: double backticks are not allowed."}):this.errors.remove(e)}validateX(t){this.validateAxisSpec("x",t)}validateY(t){this.validateAxisSpec("y",t)}validateIso(t){this.validateObjectSpec("iso",t,null,(t=>A(t)))}validateLevel(t){const e="WARN_level",s=["auto","category","subcategory"];f(t)||s.includes(t.trim().toLowerCase())?this.errors.remove(e):this.errors.addOrReplace({id:e,type:"warning",message:`level: invalid value '${t}' - expected ${s.join("/")}; using 'auto'.`})}validateSeriesLevel(t){const e="WARN_seriesLevel",s=["auto","rowgroup","category","none"];f(t)||s.includes(t.trim().toLowerCase())?this.errors.remove(e):this.errors.addOrReplace({id:e,type:"warning",message:`series-level: invalid value '${t}' - expected ${s.join("/")}; using 'auto'.`})}validateFacet(t){this.validateObjectSpec("facet",t,null,(t=>N(t)))}validateLabels(t){this.validateObjectSpec("labels",t,null,(t=>E(t,this.labelDefaults())))}validateLegend(t){this.validateObjectSpec("legend",t,null,(t=>k(t)))}validateAspect(t){const e="WARN_aspect";f(t)||null!==this.parseAspect(t)?this.errors.remove(e):this.errors.addOrReplace({id:e,type:"warning",message:`aspect: invalid value '${t}' - expected "w:h" (e.g. "16:9"); using the default.`})}validateLimit(t){const e="WARN_limit";y(t)&&Number(t)>=0?this.errors.remove(e):this.errors.addOrReplace({id:e,type:"warning",message:`limit: invalid value '${t}' - expected a non-negative integer; using 0.`})}validateScale(t){const e="WARN_scale";if(f(t))return void this.errors.remove(e);const{mode:s,factor:i}=m(t);"factor"===s&&(void 0===i||i<=0)?this.errors.addOrReplace({id:e,type:"warning",message:`scale: invalid value '${t}' - expected none/auto or a positive number.`}):this.errors.remove(e)}constructor(t){super(),!1!==t&&this.__registerHost(),this.__attachShadow(),this.datasetName="",this.dataVersion=0,this.datasetMeta=null,this.appliedScaleFactor=1,this.layoutObserver=null,this.activeErrors=new Set,this.chartTitle="",this.filter="",this.iso="",this.level="auto",this.seriesLevel="auto",this.facet="",this.labels="",this.legend="",this.aspect="16:9",this.limit=0,this._autoScaleGuard=!1,this._lastObservedWidth=0,this.translateForInner=(t,e)=>this.t(t,e),S(this),b(this),w(this,(t=>{this.datasetName=(null==t?void 0:t.startsWith("$"))?t.substring(1):t||"",this.dataVersion=this.dataVersion+1}),((t,e)=>{this.datasetMeta=e})),this.errors=_(this),this.componentStyle=x(this),this.ruleSetConfig=j(this),this.t=L(this).t}componentWillLoad(){this.validateFilter(this.filter),this.validateX(this.x),this.validateY(this.y),this.validateIso(this.iso),this.validateLevel(this.level),this.validateSeriesLevel(this.seriesLevel),this.validateFacet(this.facet),this.validateLabels(this.labels),this.validateLegend(this.legend),this.validateAspect(this.aspect),this.validateLimit(this.limit),this.validateScale(this.scale)}componentDidRender(){C(this.element,"bn-chart-scatter-renderer");const{mode:t}=m(this.scale);if("auto"!==t&&"empty"!==t)return this._autoScaleGuard=!1,void this.checkOverflow();if(this._autoScaleGuard)return this._autoScaleGuard=!1,void this.checkOverflow();const e=this.element,{width:i}=u(e);if(i<=0)return void this.checkOverflow();this._lastObservedWidth=i;const a=this.componentStyle((t=>{var e;return(null===(e=t.global)||void 0===e?void 0:e.fontSizePx)||13.3333})),r=e.scrollWidth,n=this.appliedScaleFactor;if(!Number.isFinite(r)||r<=i+1)return this.errors.remove("AUTO_scale"),void this.checkOverflow();const o=Math.max(.3,n*(i-1)/r);Math.abs(o-n)<.01||(e.style.setProperty("--bn-font-size",a*o+"px"),"empty"===t?this.errors.addOrReplace({id:"AUTO_scale",type:"warning",message:"Auto-scaled chart by factor "+o.toFixed(3)}):this.errors.remove("AUTO_scale"),this._autoScaleGuard=!0,s((()=>{this.appliedScaleFactor=o}))),this.checkOverflow()}checkOverflow(){p(this.element,"bn-chart-scatter-renderer",this.errors)}componentDidLoad(){this.layoutObserver=v(this.element,(()=>{if(this._autoScaleGuard)return;const{width:t}=u(this.element);t>0&&Math.abs(t-this._lastObservedWidth)>2?(this._lastObservedWidth=t,i(this)):this.checkOverflow()})),requestAnimationFrame((()=>{requestAnimationFrame((()=>{if(this._autoScaleGuard)return;const{width:t}=u(this.element);this._lastObservedWidth=t,i(this)}))}))}disconnectedCallback(){var t;null===(t=this.layoutObserver)||void 0===t||t.disconnect(),this.layoutObserver=null}labelDefaults(){return{points:"auto",values:!1,max:12}}setBlockingError(t,e){null===e?(this.errors.remove(t),this.activeErrors.delete(t)):(this.errors.addOrReplace({id:t,type:"error",message:e}),this.activeErrors.add(t))}hasBlockingErrors(){return this.activeErrors.size>0}validateAxisSpec(t,e){var s;const i="ERR_xy_json_"+t,a="ERR_xy_measure_"+t,r="WARN_xy_fields_"+t,n="x"===t||"y"===t||"size"===t,{data:o,parseError:l}=F(e,"measure");if(l)return this.setBlockingError(i,this.t(".xy-prop-json",{prop:t})),this.setBlockingError(a,null),void this.errors.remove(r);if(this.setBlockingError(i,null),null===o)return this.setBlockingError(a,n?this.t(".xy-measure-invalid",{prop:t,measure:""}):null),void this.errors.remove(r);const h="share"===t?null:O(o),d=null!==(s=o.measure)&&void 0!==s?s:"";g(d)?this.setBlockingError(a,null):this.setBlockingError(a,this.t(".xy-measure-invalid",{prop:t,measure:d})),this.reportSpecIssues(r,t,h)}validateObjectSpec(t,e,s,i){const a="ERR_xy_json_"+t,r="WARN_xy_fields_"+t,{data:n,parseError:o}=F(e,s);if(o)return this.setBlockingError(a,this.t(".xy-prop-json",{prop:t})),void this.errors.remove(r);this.setBlockingError(a,null),null!==n?this.reportSpecIssues(r,t,i(n)):this.errors.remove(r)}reportSpecIssues(t,e,s){const i=[];null!==s&&s.invalidFields.length>0&&i.push("invalid: "+s.invalidFields.join(", ")),null!==s&&s.unknownKeys.length>0&&i.push("unknown: "+s.unknownKeys.join(", ")),i.length>0?this.errors.addOrReplace({id:t,type:"warning",message:`${e}: ignored sub-fields (${i.join("; ")}).`}):this.errors.remove(t)}prepareAxis(t,e){const{data:s,parseError:i}=F(e,"measure");if(i||null===s)return null;const{config:a}=O(s);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}prepareIso(){const{data:t,parseError:e}=F(this.iso,null);return e||null===t?null:A(t).config}prepareLabels(){const t=this.labelDefaults(),{data:e,parseError:s}=F(this.labels,null);return s||null===e?{points:t.points,values:t.values,max:t.max}:E(e,t).config}prepareLegend(){const{data:t,parseError:e}=F(this.legend,null);return e||null===t?{show:!0,position:"right"}:k(t).config}prepareFacet(){const{data:t,parseError:e}=F(this.facet,null);return e||null===t?null:N(t).config}preparePointLevel(){var t,e;const s=null===(t=this.level)||void 0===t?void 0:t.trim().toLowerCase();if("category"===s)return"category";if("subcategory"===s)return"subCategory";const i=null===(e=this.datasetMeta)||void 0===e?void 0:e.suggestedLevel;return"rowGroup"===i||"category"===i||"subCategory"===i?i:"category"}prepareSeriesLevel(t){var e;const s=null===(e=this.seriesLevel)||void 0===e?void 0:e.trim().toLowerCase();return"none"===s?null:"rowgroup"===s?"rowGroup":"category"===s||"subCategory"===t?"category":"category"===t?"rowGroup":null}validateCrossProp(t,e){const s=new Set;for(const e of t){if(void 0===e)continue;const t=R(e);null!==t&&"scenario"===t.kind&&s.add($(t.slot))}this.setBlockingError("ERR_xy_family",s.size>1?this.t(".xy-family-mixed",{families:[...s].join(", ")}):null);const i=this.preparePointLevel(),a=this.prepareSeriesLevel(i),r=null!==e?"rowgroup"===e.level?"rowGroup":"category":null;let n=null;if(null!==a&&W[a]>=W[i]&&(n=`series '${a}' vs point '${i}'`),null!==r){const t=null!=a?a:i;W[r]>=W[t]&&(n=`facet '${r}' vs '${t}'`)}this.setBlockingError("ERR_xy_level_order",null!==n?this.t(".xy-level-order",{detail:n}):null)}parseAspect(t){const e=/^\s*(\d+(?:\.\d+)?)\s*:\s*(\d+(?:\.\d+)?)\s*$/.exec(null!=t?t:"");if(null===e)return null;const s=Number(e[1]),i=Number(e[2]);return s<=0||i<=0?null:s/i}prepareAspect(){var t;return null!==(t=this.parseAspect(this.aspect))&&void 0!==t?t:16/9}prepareLimit(){const t=Math.floor(Number(this.limit)||0);return t>0?t:0}i18nLocalKeys(){return["no-data","axis.in","legend.title"]}prepareI18n(){const t=new Map(this.i18nLocalKeys().map((t=>[t,this.t(".".concat(t))]))),e=new Map(l.map((t=>[t,this.t("global.".concat(t))])));return new Map([...e.entries(),...t.entries()])}prepareStyle(){const t=this.getEffectiveScaleFactor(),e=this.element.localName;return this.componentStyle((s=>{const i=s.global.fontSizePx*t;return{scaleFactors:s[e].scaleFactors,fontStyles:{font:`${i}px ${s.global.fontFamily}`,size:i,color:s.global.fontColor,background:s.global.fontBackgroundColor,leading:1.8},axisStyles:s[e].axisStyles,seriesColors:s[e].seriesColors,padding:s[e].padding}}))}async getBaseline(){return c(this.element,"bn-chart-scatter-renderer")}async getLayoutState(t){var e;const s=null!==(e=null==t?void 0:t.detail)&&void 0!==e?e:"summary",i=h(this.element),a=this.getEffectiveScaleFactor(),r=Number.isFinite(a)&&a>0?a:1,n=this.componentStyle((t=>{var e;return(null===(e=t.global)||void 0===e?void 0:e.fontSizePx)||13.3333}))*r;return d(this.element,"bn-chart-scatter-renderer",this.chartTitle||void 0,{fontSizePx:n,appliedScaleFactor:r},i,s)}getEffectiveScaleFactor(){const{mode:t,factor:e}=m(this.scale);return"factor"===t?e:"auto"===t||"empty"===t?this.appliedScaleFactor:1}getFontStyles(){const t=this.getEffectiveScaleFactor();return this.componentStyle((e=>{var s,i,a,r;const n=(null===(s=e.global)||void 0===s?void 0:s.fontSizePx)||13.3333;return{"--bn-font-family":(null===(i=e.global)||void 0===i?void 0:i.fontFamily)||"'Noto Sans', sans-serif","--bn-font-size":n*t+"px","--bn-font-color":(null===(a=e.global)||void 0===a?void 0:a.fontColor)||"#000000","--bn-font-background":(null===(r=e.global)||void 0===r?void 0:r.fontBackgroundColor)||"#ffffff"}}))}getDataStructure(){const t={};for(const e of["ac","pp","fc","pl"])for(const s of[1,2,3,4])t[`${e}${s}`]={type:"number",isOptional:!0,description:""};for(const[e,s]of Object.entries(this.mappedAxes())){if(null===s)continue;const i=R(s.measure);null!==i&&("scenario"===i.kind?t[i.slot].description=`${e}: ${"label"in s&&void 0!==s.label?s.label:s.measure}`:(t[i.measure.base].description=`${e}: ${s.measure} (base)`,t[i.measure.delta].description=`${e}: ${s.measure} (delta)`))}return{[this.dataStructureName()]:Object.assign({operation:{type:"string",isOptional:!1,description:""},rowGroup:{type:"string",isOptional:!0,description:""},rowGroupIndex:{type:"number",isOptional:!0,description:""},category:{type:"string",isOptional:!1,description:""},categoryIndex:{type:"number",isOptional:!1,description:""},subCategory:{type:"string",isOptional:!0,description:""},subCategoryIndex:{type:"number",isOptional:!0,description:""}},t)}}mappedAxes(){return{x:this.prepareAxis("x",this.x),y:this.prepareAxis("y",this.y)}}dataStructureName(){return"IScatterChartDataRow"}chartTemplate(){const t=this.prepareAxis("x",this.x),e=this.prepareAxis("y",this.y),s=this.prepareFacet();if(this.validateCrossProp([null==t?void 0:t.measure,null==e?void 0:e.measure],s),this.hasBlockingErrors()||null===t||null===e)return null;const i=this.preparePointLevel(),r=this.prepareI18n(),n=this.prepareStyle(),o=u(this.element).width;return a("bn-chart-scatter-renderer",{tableName:this.datasetName,dataVersion:this.dataVersion,chartTitle:this.chartTitle,x:t,y:e,iso:this.prepareIso(),labels:this.prepareLabels(),legend:this.prepareLegend(),facet:s,pointLevel:i,seriesLevel:this.prepareSeriesLevel(i),aspect:this.prepareAspect(),limit:this.prepareLimit(),filter:this.filter,styles:n,i18n:r,containerWidth:o,ruleSetConfig:this.ruleSetConfig(),errors:this.errors,translator:this.translateForInner})}render(){return a(r,{key:"4947af836a9c76b089bc07fb1f4df8c248aa4f62",style:this.getFontStyles()},a("div",{key:"16abbc30d255d224aefecf9e337d3b23d449828a",class:"container"},this.chartTemplate()))}get element(){return this}static get watchers(){return{filter:[{validateFilter:0}],x:[{validateX:0}],y:[{validateY:0}],iso:[{validateIso:0}],level:[{validateLevel:0}],seriesLevel:[{validateSeriesLevel:0}],facet:[{validateFacet:0}],labels:[{validateLabels:0}],legend:[{validateLegend:0}],aspect:[{validateAspect:0}],limit:[{validateLimit:0}],scale:[{validateScale:0}]}}static get style(){return':host(.no-data){display:block;box-sizing:border-box;width:100%;height:100%}:host(.no-data)>div{float:none;width:100%;height:100%}:host(.no-data) .no-data~.no-data{display:none}.empty-state{box-sizing:border-box;display:flex;align-items:center;justify-content:center;float:none;width:100%;height:100%;min-height:3em;margin:0;padding:0.5em;overflow:hidden;border:0.1em dashed #ddd;color:#808080;font-family:var(--bn-font-family, "Noto Sans", sans-serif);font-size:var(--bn-font-size, 13.3333px);font-style:normal;text-align:center}:host{display:inline-block;position:relative;overflow:hidden;font-family:var(--bn-font-family, "Noto Sans", sans-serif);font-size:var(--bn-font-size, 13.3333px);color:var(--bn-font-color, #000000)}.container{display:flex;flex-direction:column}'}},[1,"bn-chart-scatter",{datasets:[513],selectedStyle:[513,"selected-style"],i18nNamespace:[513,"i18n-namespace"],ruleset:[513],chartTitle:[1,"chart-title"],filter:[1],x:[1],y:[1],iso:[1],level:[1],seriesLevel:[1,"series-level"],facet:[1],labels:[1],legend:[1],aspect:[1],limit:[2],scale:[1],datasetName:[32],dataVersion:[32],datasetMeta:[32],appliedScaleFactor:[32],getBaseline:[64],getLayoutState:[64]},void 0,{filter:[{validateFilter:0}],x:[{validateX:0}],y:[{validateY:0}],iso:[{validateIso:0}],level:[{validateLevel:0}],seriesLevel:[{validateSeriesLevel:0}],facet:[{validateFacet:0}],labels:[{validateLabels:0}],legend:[{validateLegend:0}],aspect:[{validateAspect:0}],limit:[{validateLimit:0}],scale:[{validateScale:0}]}]),D=B,I=function(){"undefined"!=typeof customElements&&["bn-chart-scatter","bn-chart-scatter-renderer"].forEach((t=>{switch(t){case"bn-chart-scatter":customElements.get(n(t))||customElements.define(n(t),B);break;case"bn-chart-scatter-renderer":customElements.get(n(t))||z()}}))};export{D as BnChartScatter,I as defineCustomElement}
|
|
1
|
+
import{p as t,H as e,w as s,f as i,h as a,d as r,t as n}from"./p-BnmylmXF.js";import{h as o,a as l}from"./p-6242qMx1.js";import{o as h}from"./p-DdvG1D18.js";import{c as d}from"./p-TNX3alPU.js";import{a as c}from"./p-JofGXz75.js";import{g as u}from"./p-Dsvjkuy3.js";import{c as p}from"./p-C50Ge-4H.js";import{o as v}from"./p-B6kka9sT.js";import{p as m}from"./p-Xb6Ilq8u.js";import{i as f,h as y,j as g}from"./p-Dw3rv_Y9.js";import{w as b}from"./p-BrQCbmG0.js";import{w as x}from"./p-JG4Sx1lE.js";import{w}from"./p-CZzlLTQc.js";import{w as _}from"./p-D32TsLzd.js";import{w as L}from"./p-DRmphEA0.js";import{w as j}from"./p-CUoPUIej.js";import{w as S}from"./p-D_K7tYhY.js";import{r as R,s as $}from"./p-Dyzb4ika.js";import{f as A,c as N,d as E,e as k,p as D,t as C}from"./p-DUZCLRVu.js";import{s as z}from"./p-DakXa7Dp.js";import{d as F}from"./p-D3hr9wra.js";const O={rowGroup:0,category:1,subCategory:2},G=t(class extends e{validateFilter(t){const e="ERR_filter";o(t)?this.errors.addOrReplace({id:e,type:"error",message:"filter: double backticks are not allowed."}):this.errors.remove(e)}validateX(t){this.validateAxisSpec("x",t)}validateY(t){this.validateAxisSpec("y",t)}validateIso(t){this.validateObjectSpec("iso",t,null,(t=>A(t)))}validateLevel(t){const e="WARN_level",s=["auto","category","subcategory"];f(t)||s.includes(t.trim().toLowerCase())?this.errors.remove(e):this.errors.addOrReplace({id:e,type:"warning",message:`level: invalid value '${t}' - expected ${s.join("/")}; using 'auto'.`})}validateSeriesLevel(t){const e="WARN_seriesLevel",s=["auto","rowgroup","category","none"];f(t)||s.includes(t.trim().toLowerCase())?this.errors.remove(e):this.errors.addOrReplace({id:e,type:"warning",message:`series-level: invalid value '${t}' - expected ${s.join("/")}; using 'auto'.`})}validateFacet(t){this.validateObjectSpec("facet",t,null,(t=>N(t)))}validateLabels(t){this.validateObjectSpec("labels",t,null,(t=>E(t,this.labelDefaults())))}validateLegend(t){this.validateObjectSpec("legend",t,null,(t=>k(t)))}validateAspect(t){const e="WARN_aspect";f(t)||null!==this.parseAspect(t)?this.errors.remove(e):this.errors.addOrReplace({id:e,type:"warning",message:`aspect: invalid value '${t}' - expected "w:h" (e.g. "16:9"); using the default.`})}validateLimit(t){const e="WARN_limit";y(t)&&Number(t)>=0?this.errors.remove(e):this.errors.addOrReplace({id:e,type:"warning",message:`limit: invalid value '${t}' - expected a non-negative integer; using 0.`})}validateScale(t){const e="WARN_scale";if(f(t))return void this.errors.remove(e);const{mode:s,factor:i}=m(t);"factor"===s&&(void 0===i||i<=0)?this.errors.addOrReplace({id:e,type:"warning",message:`scale: invalid value '${t}' - expected none/auto or a positive number.`}):this.errors.remove(e)}constructor(t){super(),!1!==t&&this.__registerHost(),this.__attachShadow(),this.datasetName="",this.dataVersion=0,this.datasetMeta=null,this.appliedScaleFactor=1,this.layoutObserver=null,this.activeErrors=new Set,this.chartTitle="",this.filter="",this.iso="",this.level="auto",this.seriesLevel="auto",this.facet="",this.labels="",this.legend="",this.aspect="16:9",this.limit=0,this._autoScaleGuard=!1,this._lastObservedWidth=0,this.translateForInner=(t,e)=>this.t(t,e),S(this),b(this),w(this,(t=>{this.datasetName=(null==t?void 0:t.startsWith("$"))?t.substring(1):t||"",this.dataVersion=this.dataVersion+1}),((t,e)=>{this.datasetMeta=e})),this.errors=_(this),this.componentStyle=x(this),this.ruleSetConfig=L(this),this.t=j(this).t}componentWillLoad(){this.validateFilter(this.filter),this.validateX(this.x),this.validateY(this.y),this.validateIso(this.iso),this.validateLevel(this.level),this.validateSeriesLevel(this.seriesLevel),this.validateFacet(this.facet),this.validateLabels(this.labels),this.validateLegend(this.legend),this.validateAspect(this.aspect),this.validateLimit(this.limit),this.validateScale(this.scale)}componentDidRender(){z(this.element,"bn-chart-scatter-renderer");const{mode:t}=m(this.scale);if("auto"!==t&&"empty"!==t)return this._autoScaleGuard=!1,void this.checkOverflow();if(this._autoScaleGuard)return this._autoScaleGuard=!1,void this.checkOverflow();const e=this.element,{width:i}=u(e);if(i<=0)return void this.checkOverflow();this._lastObservedWidth=i;const a=this.componentStyle((t=>{var e;return(null===(e=t.global)||void 0===e?void 0:e.fontSizePx)||13.3333})),r=e.scrollWidth,n=this.appliedScaleFactor;if(!Number.isFinite(r)||r<=i+1)return this.errors.remove("AUTO_scale"),void this.checkOverflow();const o=Math.max(.3,n*(i-1)/r);Math.abs(o-n)<.01||(e.style.setProperty("--bn-font-size",a*o+"px"),"empty"===t?this.errors.addOrReplace({id:"AUTO_scale",type:"warning",message:"Auto-scaled chart by factor "+o.toFixed(3)}):this.errors.remove("AUTO_scale"),this._autoScaleGuard=!0,s((()=>{this.appliedScaleFactor=o}))),this.checkOverflow()}checkOverflow(){p(this.element,"bn-chart-scatter-renderer",this.errors)}componentDidLoad(){this.layoutObserver=v(this.element,(()=>{if(this._autoScaleGuard)return;const{width:t}=u(this.element);t>0&&Math.abs(t-this._lastObservedWidth)>2?(this._lastObservedWidth=t,i(this)):this.checkOverflow()})),requestAnimationFrame((()=>{requestAnimationFrame((()=>{if(this._autoScaleGuard)return;const{width:t}=u(this.element);this._lastObservedWidth=t,i(this)}))}))}disconnectedCallback(){var t;null===(t=this.layoutObserver)||void 0===t||t.disconnect(),this.layoutObserver=null}labelDefaults(){return{points:"auto",values:!1,max:12}}setBlockingError(t,e){null===e?(this.errors.remove(t),this.activeErrors.delete(t)):(this.errors.addOrReplace({id:t,type:"error",message:e}),this.activeErrors.add(t))}hasBlockingErrors(){return this.activeErrors.size>0}validateAxisSpec(t,e){var s;const i="ERR_xy_json_"+t,a="ERR_xy_measure_"+t,r="WARN_xy_fields_"+t,n="x"===t||"y"===t||"size"===t,{data:o,parseError:l}=D(e,"measure");if(l)return this.setBlockingError(i,this.t(".xy-prop-json",{prop:t})),this.setBlockingError(a,null),void this.errors.remove(r);if(this.setBlockingError(i,null),null===o)return this.setBlockingError(a,n?this.t(".xy-measure-invalid",{prop:t,measure:""}):null),void this.errors.remove(r);const h="share"===t?null:C(o),d=null!==(s=o.measure)&&void 0!==s?s:"";g(d)?this.setBlockingError(a,null):this.setBlockingError(a,this.t(".xy-measure-invalid",{prop:t,measure:d})),this.reportSpecIssues(r,t,h)}validateObjectSpec(t,e,s,i){const a="ERR_xy_json_"+t,r="WARN_xy_fields_"+t,{data:n,parseError:o}=D(e,s);if(o)return this.setBlockingError(a,this.t(".xy-prop-json",{prop:t})),void this.errors.remove(r);this.setBlockingError(a,null),null!==n?this.reportSpecIssues(r,t,i(n)):this.errors.remove(r)}reportSpecIssues(t,e,s){const i=[];null!==s&&s.invalidFields.length>0&&i.push("invalid: "+s.invalidFields.join(", ")),null!==s&&s.unknownKeys.length>0&&i.push("unknown: "+s.unknownKeys.join(", ")),i.length>0?this.errors.addOrReplace({id:t,type:"warning",message:`${e}: ignored sub-fields (${i.join("; ")}).`}):this.errors.remove(t)}prepareAxis(t,e){const{data:s,parseError:i}=D(e,"measure");if(i||null===s)return null;const{config:a}=C(s);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}prepareIso(){const{data:t,parseError:e}=D(this.iso,null);return e||null===t?null:A(t).config}prepareLabels(){const t=this.labelDefaults(),{data:e,parseError:s}=D(this.labels,null);return s||null===e?{points:t.points,values:t.values,max:t.max}:E(e,t).config}prepareLegend(){const{data:t,parseError:e}=D(this.legend,null);return e||null===t?{show:!0,position:"right"}:k(t).config}prepareFacet(){const{data:t,parseError:e}=D(this.facet,null);return e||null===t?null:N(t).config}preparePointLevel(){var t,e;const s=null===(t=this.level)||void 0===t?void 0:t.trim().toLowerCase();if("category"===s)return"category";if("subcategory"===s)return"subCategory";const i=null===(e=this.datasetMeta)||void 0===e?void 0:e.suggestedLevel;return"rowGroup"===i||"category"===i||"subCategory"===i?i:"category"}prepareSeriesLevel(t){var e;const s=null===(e=this.seriesLevel)||void 0===e?void 0:e.trim().toLowerCase();return"none"===s?null:"rowgroup"===s?"rowGroup":"category"===s||"subCategory"===t?"category":"category"===t?"rowGroup":null}validateCrossProp(t,e){const s=new Set;for(const e of t){if(void 0===e)continue;const t=R(e);null!==t&&"scenario"===t.kind&&s.add($(t.slot))}this.setBlockingError("ERR_xy_family",s.size>1?this.t(".xy-family-mixed",{families:[...s].join(", ")}):null);const i=this.preparePointLevel(),a=this.prepareSeriesLevel(i),r=null!==e?"rowgroup"===e.level?"rowGroup":"category":null;let n=null;if(null!==a&&O[a]>=O[i]&&(n=`series '${a}' vs point '${i}'`),null!==r){const t=null!=a?a:i;O[r]>=O[t]&&(n=`facet '${r}' vs '${t}'`)}this.setBlockingError("ERR_xy_level_order",null!==n?this.t(".xy-level-order",{detail:n}):null)}parseAspect(t){const e=/^\s*(\d+(?:\.\d+)?)\s*:\s*(\d+(?:\.\d+)?)\s*$/.exec(null!=t?t:"");if(null===e)return null;const s=Number(e[1]),i=Number(e[2]);return s<=0||i<=0?null:s/i}prepareAspect(){var t;return null!==(t=this.parseAspect(this.aspect))&&void 0!==t?t:16/9}prepareLimit(){const t=Math.floor(Number(this.limit)||0);return t>0?t:0}i18nLocalKeys(){return["no-data","axis.in","legend.title"]}prepareI18n(){const t=new Map(this.i18nLocalKeys().map((t=>[t,this.t(".".concat(t))]))),e=new Map(l.map((t=>[t,this.t("global.".concat(t))])));return new Map([...e.entries(),...t.entries()])}prepareStyle(){const t=this.getEffectiveScaleFactor(),e=this.element.localName;return this.componentStyle((s=>{const i=s.global.fontSizePx*t;return{scaleFactors:s[e].scaleFactors,fontStyles:{font:`${i}px ${s.global.fontFamily}`,size:i,color:s.global.fontColor,background:s.global.fontBackgroundColor,leading:1.8},axisStyles:s[e].axisStyles,seriesColors:s[e].seriesColors,padding:s[e].padding}}))}async getBaseline(){return c(this.element,"bn-chart-scatter-renderer")}async getLayoutState(t){var e;const s=null!==(e=null==t?void 0:t.detail)&&void 0!==e?e:"summary",i=h(this.element),a=this.getEffectiveScaleFactor(),r=Number.isFinite(a)&&a>0?a:1,n=this.componentStyle((t=>{var e;return(null===(e=t.global)||void 0===e?void 0:e.fontSizePx)||13.3333}))*r;return d(this.element,"bn-chart-scatter-renderer",this.chartTitle||void 0,{fontSizePx:n,appliedScaleFactor:r},i,s)}getEffectiveScaleFactor(){const{mode:t,factor:e}=m(this.scale);return"factor"===t?e:"auto"===t||"empty"===t?this.appliedScaleFactor:1}getFontStyles(){const t=this.getEffectiveScaleFactor();return this.componentStyle((e=>{var s,i,a,r;const n=(null===(s=e.global)||void 0===s?void 0:s.fontSizePx)||13.3333;return{"--bn-font-family":(null===(i=e.global)||void 0===i?void 0:i.fontFamily)||"'Noto Sans', sans-serif","--bn-font-size":n*t+"px","--bn-font-color":(null===(a=e.global)||void 0===a?void 0:a.fontColor)||"#000000","--bn-font-background":(null===(r=e.global)||void 0===r?void 0:r.fontBackgroundColor)||"#ffffff"}}))}getDataStructure(){const t={};for(const e of["ac","pp","fc","pl"])for(const s of[1,2,3,4])t[`${e}${s}`]={type:"number",isOptional:!0,description:""};for(const[e,s]of Object.entries(this.mappedAxes())){if(null===s)continue;const i=R(s.measure);null!==i&&("scenario"===i.kind?t[i.slot].description=`${e}: ${"label"in s&&void 0!==s.label?s.label:s.measure}`:(t[i.measure.base].description=`${e}: ${s.measure} (base)`,t[i.measure.delta].description=`${e}: ${s.measure} (delta)`))}return{[this.dataStructureName()]:Object.assign({operation:{type:"string",isOptional:!1,description:""},rowGroup:{type:"string",isOptional:!0,description:""},rowGroupIndex:{type:"number",isOptional:!0,description:""},category:{type:"string",isOptional:!1,description:""},categoryIndex:{type:"number",isOptional:!1,description:""},subCategory:{type:"string",isOptional:!0,description:""},subCategoryIndex:{type:"number",isOptional:!0,description:""}},t)}}mappedAxes(){return{x:this.prepareAxis("x",this.x),y:this.prepareAxis("y",this.y)}}dataStructureName(){return"IScatterChartDataRow"}chartTemplate(){const t=this.prepareAxis("x",this.x),e=this.prepareAxis("y",this.y),s=this.prepareFacet();if(this.validateCrossProp([null==t?void 0:t.measure,null==e?void 0:e.measure],s),this.hasBlockingErrors()||null===t||null===e)return null;const i=this.preparePointLevel(),r=this.prepareI18n(),n=this.prepareStyle(),o=u(this.element).width;return a("bn-chart-scatter-renderer",{tableName:this.datasetName,dataVersion:this.dataVersion,chartTitle:this.chartTitle,x:t,y:e,iso:this.prepareIso(),labels:this.prepareLabels(),legend:this.prepareLegend(),facet:s,pointLevel:i,seriesLevel:this.prepareSeriesLevel(i),aspect:this.prepareAspect(),limit:this.prepareLimit(),filter:this.filter,styles:n,i18n:r,containerWidth:o,ruleSetConfig:this.ruleSetConfig(),errors:this.errors,translator:this.translateForInner})}render(){return a(r,{key:"4947af836a9c76b089bc07fb1f4df8c248aa4f62",style:this.getFontStyles()},a("div",{key:"16abbc30d255d224aefecf9e337d3b23d449828a",class:"container"},this.chartTemplate()))}get element(){return this}static get watchers(){return{filter:[{validateFilter:0}],x:[{validateX:0}],y:[{validateY:0}],iso:[{validateIso:0}],level:[{validateLevel:0}],seriesLevel:[{validateSeriesLevel:0}],facet:[{validateFacet:0}],labels:[{validateLabels:0}],legend:[{validateLegend:0}],aspect:[{validateAspect:0}],limit:[{validateLimit:0}],scale:[{validateScale:0}]}}static get style(){return':host(.no-data){display:block;box-sizing:border-box;width:100%;height:100%}:host(.no-data)>div{float:none;width:100%;height:100%}:host(.no-data) .no-data~.no-data{display:none}.empty-state{box-sizing:border-box;display:flex;align-items:center;justify-content:center;float:none;width:100%;height:100%;min-height:3em;margin:0;padding:0.5em;overflow:hidden;border:0.1em dashed #ddd;color:#808080;font-family:var(--bn-font-family, "Noto Sans", sans-serif);font-size:var(--bn-font-size, 13.3333px);font-style:normal;text-align:center}:host{display:inline-block;position:relative;overflow:hidden;font-family:var(--bn-font-family, "Noto Sans", sans-serif);font-size:var(--bn-font-size, 13.3333px);color:var(--bn-font-color, #000000)}.container{display:flex;flex-direction:column}'}},[1,"bn-chart-scatter",{datasets:[513],selectedStyle:[513,"selected-style"],i18nNamespace:[513,"i18n-namespace"],ruleset:[513],chartTitle:[1,"chart-title"],filter:[1],x:[1],y:[1],iso:[1],level:[1],seriesLevel:[1,"series-level"],facet:[1],labels:[1],legend:[1],aspect:[1],limit:[2],scale:[1],datasetName:[32],dataVersion:[32],datasetMeta:[32],appliedScaleFactor:[32],getBaseline:[64],getLayoutState:[64]},void 0,{filter:[{validateFilter:0}],x:[{validateX:0}],y:[{validateY:0}],iso:[{validateIso:0}],level:[{validateLevel:0}],seriesLevel:[{validateSeriesLevel:0}],facet:[{validateFacet:0}],labels:[{validateLabels:0}],legend:[{validateLegend:0}],aspect:[{validateAspect:0}],limit:[{validateLimit:0}],scale:[{validateScale:0}]}]),I=G,W=function(){"undefined"!=typeof customElements&&["bn-chart-scatter","bn-chart-scatter-renderer"].forEach((t=>{switch(t){case"bn-chart-scatter":customElements.get(n(t))||customElements.define(n(t),G);break;case"bn-chart-scatter-renderer":customElements.get(n(t))||F()}}))};export{I as BnChartScatter,W as defineCustomElement}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{B as o,d as s}from"./p-
|
|
1
|
+
import{B as o,d as s}from"./p-Do4GqlMV.js";const p=o,r=s;export{p as BnChartStructureRenderer,r as defineCustomElement}
|