@bino-bi/bn-template-engine 1.0.0-alpha.8 → 1.0.0-alpha.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/bn-template-engine/bn-template-engine.esm.js +1 -1
- package/dist/bn-template-engine/p-3141c4a2.entry.js +1 -0
- package/dist/bn-template-engine/{p-825a07a8.entry.js → p-c86395b8.entry.js} +1 -1
- package/dist/cjs/bn-asset_20.cjs.entry.js +26 -20
- package/dist/cjs/bn-tree.cjs.entry.js +5 -1
- package/dist/collection/components/bn-chart-structure/bn-chart-structure.js +13 -10
- package/dist/collection/components/bn-chart-time/bn-chart-time.js +13 -10
- package/dist/collection/components/bn-tree/bn-tree.js +5 -1
- package/dist/components/bn-chart-structure.js +1 -1
- package/dist/components/bn-chart-time.js +1 -1
- package/dist/components/bn-tree.js +1 -1
- package/dist/esm/bn-asset_20.entry.js +26 -20
- package/dist/esm/bn-tree.entry.js +5 -1
- package/package.json +1 -1
- package/dist/bn-template-engine/p-0d41c5d8.entry.js +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as t,h as e,H as n,g as s}from"./p-B_d-jp99.js";import{b as r,i,w as o,a}from"./p-CnDq0oVa.js";import{w as l,a as c}from"./p-B4JfKvVT.js";import"./p-gFbbuhtl.js";const d=["*","/","+","-","x","÷","none"];function u(t){switch(t){case"*":case"x":return"×";case"/":case"÷":return"÷";case"+":return"+";case"-":return"−";default:return""}}function h(t,e,n){return t.find((t=>t.from===e&&t.to===n))}function f(t){return 2*(t-1)+1}function p(t){return 2*(t-1)+1}function g(t,e){const n=t.getBoundingClientRect(),s=n.left-e.left,r=n.top-e.top;return{left:s,top:r,width:n.width,height:n.height,centerX:s+n.width/2,centerY:r+n.height/2}}function v(t,e,n){switch(n){case"ltr":return e?{x:t.left+t.width,y:t.centerY}:{x:t.left,y:t.centerY};case"rtl":return e?{x:t.left,y:t.centerY}:{x:t.left+t.width,y:t.centerY};case"ttb":return e?{x:t.centerX,y:t.top+t.height}:{x:t.centerX,y:t.top};case"btt":return e?{x:t.centerX,y:t.top}:{x:t.centerX,y:t.top+t.height}}}function y(t,e,n,s,r=8){const i=-(s-1)*r/2+n*r;switch(e){case"ltr":return{x:t.left,y:t.centerY+i};case"rtl":return{x:t.left+t.width,y:t.centerY+i};case"ttb":return{x:t.centerX+i,y:t.top};case"btt":return{x:t.centerX+i,y:t.top+t.height}}}function m(t,e,n,s){switch(n){case"straight":return function(t,e){return{path:`M ${t.x} ${t.y} L ${e.x} ${e.y}`,midpoint:{x:(t.x+e.x)/2,y:(t.y+e.y)/2}}}(t,e);case"curved":return function(t,e,n){let s,r;if("ltr"===n||"rtl"===n){const n=(t.x+e.x)/2;s={x:n,y:t.y},r={x:n,y:e.y}}else{const n=(t.y+e.y)/2;s={x:t.x,y:n},r={x:e.x,y:n}}return{path:`M ${t.x} ${t.y} C ${s.x} ${s.y}, ${r.x} ${r.y}, ${e.x} ${e.y}`,midpoint:{x:.125*t.x+.375*s.x+.375*r.x+.125*e.x,y:.125*t.y+.375*s.y+.375*r.y+.125*e.y}}}(t,e,s);default:return function(t,e,n){let s,r;if("ltr"===n||"rtl"===n){const n=t.x+.7*(e.x-t.x);s=`M ${t.x} ${t.y} L ${n} ${t.y} L ${n} ${e.y} L ${e.x} ${e.y}`,r={x:n,y:(t.y+e.y)/2}}else{const n=t.y+.7*(e.y-t.y);s=`M ${t.x} ${t.y} L ${t.x} ${n} L ${e.x} ${n} L ${e.x} ${e.y}`,r={x:(t.x+e.x)/2,y:n}}return{path:s,midpoint:r}}(t,e,s)}}function b(t,e,n,s){const r=.7;switch(s){case"ltr":{const s=t.left+t.width;return{x:s+(Math.min(e.left,n.left)-s)*r,y:t.centerY}}case"rtl":{const s=t.left,i=Math.max(e.left+e.width,n.left+n.width);return{x:i+(s-i)*r,y:t.centerY}}case"ttb":{const s=t.top+t.height,i=Math.min(e.top,n.top);return{x:t.centerX,y:s+(i-s)*r}}case"btt":{const s=t.top,i=Math.max(e.top+e.height,n.top+n.height);return{x:t.centerX,y:i+(s-i)*r}}}}function $(t,e,n){var s,r;return Object.assign({stroke:null!==(s=null==n?void 0:n.color)&&void 0!==s?s:t,strokeWidth:null!==(r=null==n?void 0:n.width)&&void 0!==r?r:e},(null==n?void 0:n.dasharray)?{strokeDasharray:n.dasharray}:{})}const x=class{validateEdgesProp(t){const e="ERR_edges",n=function(t){const e=[];if(!t||""===t.trim())return e.push("edges: value is required"),e;let n;try{n=JSON.parse(t)}catch(t){return e.push("edges: invalid JSON structure"),e}if(!Array.isArray(n))return e.push("edges: must be an array"),e;if(0===n.length)return e.push("edges: array must not be empty"),e;const s=new Set,r=new Set;n.forEach(((t,n)=>{if("object"!=typeof t||null===t)return void e.push(`edges[${n}]: must be an object`);const i=t;if("string"!=typeof i.from||""===i.from.trim()?e.push(`edges[${n}]: 'from' is required and must be a non-empty string`):s.add(i.from),"string"!=typeof i.to||""===i.to.trim()?e.push(`edges[${n}]: 'to' is required and must be a non-empty string`):(s.add(i.to),r.add(i.to)),void 0!==i.operator&&("string"==typeof i.operator&&d.includes(i.operator)||e.push(`edges[${n}]: 'operator' must be one of: ${d.join(", ")}`)),void 0!==i.label&&"string"!=typeof i.label&&e.push(`edges[${n}]: 'label' must be a string`),void 0!==i.style)if("object"!=typeof i.style||null===i.style)e.push(`edges[${n}]: 'style' must be an object`);else{const t=i.style;void 0!==t.color&&"string"!=typeof t.color&&e.push(`edges[${n}]: 'style.color' must be a string`),void 0!==t.width&&"number"!=typeof t.width&&e.push(`edges[${n}]: 'style.width' must be a number`),void 0!==t.dasharray&&"string"!=typeof t.dasharray&&e.push(`edges[${n}]: 'style.dasharray' must be a string`)}}));const i=Array.from(s).filter((t=>!r.has(t)));return 0===i.length?e.push("edges: tree has no root node (circular reference detected)"):i.length>1&&e.push(`edges: tree has multiple root nodes: ${i.join(", ")}`),e}(t);n.length>0?(this.errors.addOrReplace({id:e,type:"error",message:`edges: ${n.join("; ")}`}),this.treeConfig=null):(this.errors.remove(e),this.treeConfig=function(t){if(!t||""===t.trim())return null;try{const e=JSON.parse(t);if(!Array.isArray(e))return null;const n=e,s=function(t){const e=new Map;for(const n of t){const t=e.get(n.from)||[];t.push(n.to),e.set(n.from,t)}return e}(n),r=function(t){const e=new Set;for(const n of t)e.add(n.from),e.add(n.to);return e}(n),i=function(t,e){const n=new Set;for(const e of t)n.add(e.to);const s=Array.from(e).filter((t=>!n.has(t)));return 1===s.length?s[0]:null}(n,r);return{edges:n,adjacencyList:s,rootNode:i,allNodes:r}}catch(t){return console.error("parseTreeConfig: failed to parse tree configuration",t),null}}(t)),this.recalculateLayout()}validateDirection(t){const e="ERR_direction",n=["ltr","rtl","ttb","btt"];n.includes(t)?this.errors.remove(e):this.errors.addOrReplace({id:e,type:"warning",message:`direction: invalid value '${t}', must be one of: ${n.join(", ")}`}),this.recalculateLayout()}validateLevelSpacing(t){const e="ERR_levelSpacing";!r(t)||t<0?this.errors.addOrReplace({id:e,type:"warning",message:`level-spacing: invalid value '${t}', must be a non-negative number`}):this.errors.remove(e),this.recalculateLayout()}validateNodeSpacing(t){const e="ERR_nodeSpacing";!r(t)||t<0?this.errors.addOrReplace({id:e,type:"warning",message:`node-spacing: invalid value '${t}', must be a non-negative number`}):this.errors.remove(e),this.recalculateLayout()}validateEdgeStyle(t){const e="ERR_edgeStyle",n=["straight","orthogonal","curved"];n.includes(t)?this.errors.remove(e):this.errors.addOrReplace({id:e,type:"warning",message:`edge-style: invalid value '${t}', must be one of: ${n.join(", ")}`})}validateShowOperators(t){const e="ERR_showOperators";i(t)?this.errors.remove(e):this.errors.addOrReplace({id:e,type:"warning",message:`show-operators: invalid value '${t}', must be 'true' or 'false'`})}constructor(e){t(this,e),this.treeConfig=null,this.layout=null,this.nodeRects=new Map,this.svgWidth=0,this.svgHeight=0,this.resizeObserver=null,this.gridContainer=null,this.direction="ltr",this.levelSpacing=60,this.nodeSpacing=20,this.edgeStyle="orthogonal",this.showOperators="true",o(this),l(this),this.errors=c(this),this.componentStyle=a(this)}getTreeStyle(){return this.componentStyle((t=>({edgeColor:t["bn-tree"].edgeColor,edgeWidth:t["bn-tree"].edgeWidth,operatorCircleRadius:t["bn-tree"].operatorCircleRadius,operatorFontSize:t.global.fontSizePx*t["bn-tree"].operatorFontSizeScale,operatorColor:t["bn-tree"].operatorColor})))}componentWillLoad(){this.validateEdgesProp(this.edges),this.validateDirection(this.direction),this.validateLevelSpacing(this.levelSpacing),this.validateNodeSpacing(this.nodeSpacing),this.validateEdgeStyle(this.edgeStyle),this.validateShowOperators(this.showOperators)}componentDidLoad(){this.setupResizeObserver(),this.updateNodeRects()}disconnectedCallback(){this.resizeObserver&&(this.resizeObserver.disconnect(),this.resizeObserver=null)}setupResizeObserver(){var t;this.gridContainer=null===(t=this.element.shadowRoot)||void 0===t?void 0:t.querySelector(".tree-grid"),this.gridContainer&&(this.resizeObserver=new ResizeObserver((()=>{this.updateNodeRects()})),this.resizeObserver.observe(this.gridContainer),this.element.querySelectorAll("[slot]").forEach((t=>{this.resizeObserver.observe(t)})))}recalculateLayout(){this.layout=this.treeConfig?function(t,e,n,s){if(!t.rootNode)return{positions:new Map,gridTemplateColumns:"",gridTemplateRows:"",maxLevel:0,maxIndex:0};const r=function(t){const e=new Map;if(!t.rootNode)return e;const n=[{node:t.rootNode,level:0}],s=new Set;for(;n.length>0;){const{node:r,level:i}=n.shift();if(s.has(r))continue;s.add(r),e.set(r,i);const o=t.adjacencyList.get(r)||[];for(const t of o)s.has(t)||n.push({node:t,level:i+1})}return e}(t),i=function(t){const e=new Map;if(!t.rootNode)return e;let n=0;return function s(r){const i=e.get(r);if(i)return i;const o=t.adjacencyList.get(r)||[];if(0===o.length){const t={startIndex:n,endIndex:n};return e.set(r,t),n++,t}let a=1/0,l=-1/0;for(const t of o){const e=s(t);a=Math.min(a,e.startIndex),l=Math.max(l,e.endIndex)}const c={startIndex:a,endIndex:l};return e.set(r,c),c}(t.rootNode),e}(t),o=function(t,e,n,s){var r,i;const o=new Map,a=Math.max(...Array.from(e.values()));for(const l of t.allNodes){const t=null!==(r=e.get(l))&&void 0!==r?r:0,c=null!==(i=n.get(l))&&void 0!==i?i:{startIndex:0,endIndex:0};let d,u,h;switch(s){case"ltr":d=t+1,u=c.startIndex+1,h=c.endIndex-c.startIndex+1;break;case"rtl":d=a-t+1,u=c.startIndex+1,h=c.endIndex-c.startIndex+1;break;case"ttb":u=t+1,d=c.startIndex+1,h=1;break;case"btt":u=a-t+1,d=c.startIndex+1,h=1}o.set(l,{nodeId:l,level:t,index:c.startIndex,gridColumn:d,gridRow:u,gridRowSpan:h})}return o}(t,r,i,e),a=Math.max(...Array.from(r.values())),l=Math.max(...Array.from(i.values()).map((t=>t.endIndex))),{gridTemplateColumns:c,gridTemplateRows:d}=function(t,e,n,s,r){const i=t+1,o=e+1;if("ltr"===n||"rtl"===n){const t=[];for(let e=0;e<i;e++)t.push("auto"),e<i-1&&t.push(`${s}px`);const e=[];for(let t=0;t<o;t++)e.push("auto"),t<o-1&&e.push(`${r}px`);return{gridTemplateColumns:t.join(" "),gridTemplateRows:e.join(" ")}}{const t=[];for(let e=0;e<i;e++)t.push("auto"),e<i-1&&t.push(`${s}px`);const e=[];for(let t=0;t<o;t++)e.push("auto"),t<o-1&&e.push(`${r}px`);return{gridTemplateColumns:e.join(" "),gridTemplateRows:t.join(" ")}}}(a,l,e,n,s);return{positions:o,gridTemplateColumns:c,gridTemplateRows:d,maxLevel:a,maxIndex:l}}(this.treeConfig,this.direction,this.levelSpacing,this.nodeSpacing):null}updateNodeRects(){if(!this.treeConfig||!this.gridContainer)return;const t=this.gridContainer.getBoundingClientRect(),e=new Map;for(const n of this.treeConfig.allNodes){const s=this.element.querySelector(`[slot="${n}"]`);s&&e.set(n,g(s,t))}this.nodeRects=e,this.svgWidth=t.width,this.svgHeight=t.height}getSlotStyle(t){if(!this.layout)return{};const e=this.layout.positions.get(t);return e?"ltr"===this.direction||"rtl"===this.direction?{"grid-column":String(f(e.gridColumn)),"grid-row":`${p(e.gridRow)} / span ${n=e.gridRowSpan,n<=1?1:2*(n-1)+1}`,"align-self":"center"}:{"grid-row":String(p(e.gridRow)),"grid-column":String(f(e.gridColumn)),"justify-self":"center"}:{};var n}renderEdges(){var t;if(!this.treeConfig||0===this.nodeRects.size)return null;const n=this.getTreeStyle(),s=[],r=[],i=new Map;for(const t of this.treeConfig.edges){const e=i.get(t.to)||[];e.push(t.from),i.set(t.to,e)}for(const t of this.treeConfig.edges){const r=this.nodeRects.get(t.from),o=this.nodeRects.get(t.to);if(!r||!o)continue;const a=v(r,!0,this.direction),l=i.get(t.to)||[];let c;if(l.length>1){const e=l.indexOf(t.from);c=y(o,this.direction,e,l.length)}else c=v(o,!1,this.direction);const{path:d}=m(a,c,this.edgeStyle,this.direction),u=$(n.edgeColor,n.edgeWidth,t.style);s.push(e("path",{key:`edge-${t.from}-${t.to}`,d,fill:"none",stroke:u.stroke,"stroke-width":u.strokeWidth,"stroke-dasharray":u.strokeDasharray}))}if("true"===this.showOperators)for(const[s,i]of this.treeConfig.adjacencyList.entries()){const o=this.nodeRects.get(s);if(o)for(let a=0;a<i.length-1;a++){const l=i[a],c=i[a+1],d=h(this.treeConfig.edges,s,l);if(!(null==d?void 0:d.operator)||"none"===d.operator)continue;const f=this.nodeRects.get(l),p=this.nodeRects.get(c);if(!f||!p)continue;const g=null!==(t=d.label)&&void 0!==t?t:u(d.operator),v=b(o,f,p,this.direction);r.push(e("g",{key:`operator-${s}-${l}`,class:"operator-group"},e("circle",{cx:v.x,cy:v.y,r:n.operatorCircleRadius,fill:"white",stroke:n.edgeColor,"stroke-width":n.edgeWidth}),e("text",{x:v.x,y:v.y,"text-anchor":"middle","dominant-baseline":"central",style:{fontSize:`${n.operatorFontSize}px`,fill:n.operatorColor,fontWeight:"bold"}},g)))}}return e("svg",{class:"edge-layer",width:this.svgWidth,height:this.svgHeight,style:{position:"absolute",top:"0",left:"0",pointerEvents:"none"}},s,r)}renderSlots(){return this.treeConfig&&this.layout?Array.from(this.treeConfig.allNodes).map((t=>e("div",{key:t,class:"tree-node",style:this.getSlotStyle(t)},e("slot",{name:t})))):null}getFontStyles(){return this.componentStyle((t=>{var e,n,s,r;return{"--bn-font-family":(null===(e=t.global)||void 0===e?void 0:e.fontFamily)||"'Noto Sans', sans-serif","--bn-font-size":`${(null===(n=t.global)||void 0===n?void 0:n.fontSizePx)||13.3333}px`,"--bn-font-color":(null===(s=t.global)||void 0===s?void 0:s.fontColor)||"#000000","--bn-font-background":(null===(r=t.global)||void 0===r?void 0:r.fontBackgroundColor)||"#ffffff"}}))}render(){const t=this.getFontStyles();return e(n,{style:t},this.treeConfig&&this.layout?e("div",{class:"tree-container"},e("div",{class:"tree-grid",style:{display:"grid","grid-template-columns":this.layout.gridTemplateColumns,"grid-template-rows":this.layout.gridTemplateRows,position:"relative"}},this.renderEdges(),this.renderSlots())):e("div",{class:"tree-container tree-error"},e("slot",null)))}get element(){return s(this)}static get watchers(){return{edges:[{validateEdgesProp:0}],direction:[{validateDirection:0}],levelSpacing:[{validateLevelSpacing:0}],nodeSpacing:[{validateNodeSpacing:0}],edgeStyle:[{validateEdgeStyle:0}],showOperators:[{validateShowOperators:0}]}}};x.style=':host{display:inline-block;position:relative;font-family:var(--bn-font-family, "Noto Sans", sans-serif);font-size:var(--bn-font-size, 13.3333px);color:var(--bn-font-color, #000000)}.tree-container{position:relative;display:inline-block}.tree-grid{position:relative;display:grid;align-items:center}.tree-node{position:relative;z-index:1;border:1px solid #404040;background:var(--bn-font-background, white)}.edge-layer{position:absolute;top:0;left:0;z-index:0;pointer-events:none;overflow:visible}.tree-error{display:flex;flex-wrap:wrap;gap:20px}';export{x as bn_tree}
|
|
1
|
+
import{r as t,h as e,H as n,g as s}from"./p-B_d-jp99.js";import{b as r,i,w as o,a}from"./p-CnDq0oVa.js";import{w as l,a as c}from"./p-B4JfKvVT.js";import"./p-gFbbuhtl.js";const d=["*","/","+","-","x","÷","none"];function u(t){switch(t){case"*":case"x":return"×";case"/":case"÷":return"÷";case"+":return"+";case"-":return"−";default:return""}}function h(t,e,n){return t.find((t=>t.from===e&&t.to===n))}function f(t){return 2*(t-1)+1}function p(t){return 2*(t-1)+1}function g(t,e){const n=t.getBoundingClientRect(),s=n.left-e.left,r=n.top-e.top;return{left:s,top:r,width:n.width,height:n.height,centerX:s+n.width/2,centerY:r+n.height/2}}function v(t,e,n){switch(n){case"ltr":return e?{x:t.left+t.width,y:t.centerY}:{x:t.left,y:t.centerY};case"rtl":return e?{x:t.left,y:t.centerY}:{x:t.left+t.width,y:t.centerY};case"ttb":return e?{x:t.centerX,y:t.top+t.height}:{x:t.centerX,y:t.top};case"btt":return e?{x:t.centerX,y:t.top}:{x:t.centerX,y:t.top+t.height}}}function y(t,e,n,s,r=8){const i=-(s-1)*r/2+n*r;switch(e){case"ltr":return{x:t.left,y:t.centerY+i};case"rtl":return{x:t.left+t.width,y:t.centerY+i};case"ttb":return{x:t.centerX+i,y:t.top};case"btt":return{x:t.centerX+i,y:t.top+t.height}}}function m(t,e,n,s){switch(n){case"straight":return function(t,e){return{path:`M ${t.x} ${t.y} L ${e.x} ${e.y}`,midpoint:{x:(t.x+e.x)/2,y:(t.y+e.y)/2}}}(t,e);case"curved":return function(t,e,n){let s,r;if("ltr"===n||"rtl"===n){const n=(t.x+e.x)/2;s={x:n,y:t.y},r={x:n,y:e.y}}else{const n=(t.y+e.y)/2;s={x:t.x,y:n},r={x:e.x,y:n}}return{path:`M ${t.x} ${t.y} C ${s.x} ${s.y}, ${r.x} ${r.y}, ${e.x} ${e.y}`,midpoint:{x:.125*t.x+.375*s.x+.375*r.x+.125*e.x,y:.125*t.y+.375*s.y+.375*r.y+.125*e.y}}}(t,e,s);default:return function(t,e,n){let s,r;if("ltr"===n||"rtl"===n){const n=t.x+.7*(e.x-t.x);s=`M ${t.x} ${t.y} L ${n} ${t.y} L ${n} ${e.y} L ${e.x} ${e.y}`,r={x:n,y:(t.y+e.y)/2}}else{const n=t.y+.7*(e.y-t.y);s=`M ${t.x} ${t.y} L ${t.x} ${n} L ${e.x} ${n} L ${e.x} ${e.y}`,r={x:(t.x+e.x)/2,y:n}}return{path:s,midpoint:r}}(t,e,s)}}function b(t,e,n,s){const r=.7;switch(s){case"ltr":{const s=t.left+t.width;return{x:s+(Math.min(e.left,n.left)-s)*r,y:t.centerY}}case"rtl":{const s=t.left,i=Math.max(e.left+e.width,n.left+n.width);return{x:i+(s-i)*r,y:t.centerY}}case"ttb":{const s=t.top+t.height,i=Math.min(e.top,n.top);return{x:t.centerX,y:s+(i-s)*r}}case"btt":{const s=t.top,i=Math.max(e.top+e.height,n.top+n.height);return{x:t.centerX,y:i+(s-i)*r}}}}function $(t,e,n){var s,r;return Object.assign({stroke:null!==(s=null==n?void 0:n.color)&&void 0!==s?s:t,strokeWidth:null!==(r=null==n?void 0:n.width)&&void 0!==r?r:e},(null==n?void 0:n.dasharray)?{strokeDasharray:n.dasharray}:{})}const x=class{validateEdgesProp(t){const e="ERR_edges",n=function(t){const e=[];if(!t||""===t.trim())return e.push("edges: value is required"),e;let n;try{n=JSON.parse(t)}catch(t){return e.push("edges: invalid JSON structure"),e}if(!Array.isArray(n))return e.push("edges: must be an array"),e;if(0===n.length)return e.push("edges: array must not be empty"),e;const s=new Set,r=new Set;n.forEach(((t,n)=>{if("object"!=typeof t||null===t)return void e.push(`edges[${n}]: must be an object`);const i=t;if("string"!=typeof i.from||""===i.from.trim()?e.push(`edges[${n}]: 'from' is required and must be a non-empty string`):s.add(i.from),"string"!=typeof i.to||""===i.to.trim()?e.push(`edges[${n}]: 'to' is required and must be a non-empty string`):(s.add(i.to),r.add(i.to)),void 0!==i.operator&&("string"==typeof i.operator&&d.includes(i.operator)||e.push(`edges[${n}]: 'operator' must be one of: ${d.join(", ")}`)),void 0!==i.label&&"string"!=typeof i.label&&e.push(`edges[${n}]: 'label' must be a string`),void 0!==i.style)if("object"!=typeof i.style||null===i.style)e.push(`edges[${n}]: 'style' must be an object`);else{const t=i.style;void 0!==t.color&&"string"!=typeof t.color&&e.push(`edges[${n}]: 'style.color' must be a string`),void 0!==t.width&&"number"!=typeof t.width&&e.push(`edges[${n}]: 'style.width' must be a number`),void 0!==t.dasharray&&"string"!=typeof t.dasharray&&e.push(`edges[${n}]: 'style.dasharray' must be a string`)}}));const i=Array.from(s).filter((t=>!r.has(t)));return 0===i.length?e.push("edges: tree has no root node (circular reference detected)"):i.length>1&&e.push(`edges: tree has multiple root nodes: ${i.join(", ")}`),e}(t);n.length>0?(this.errors.addOrReplace({id:e,type:"error",message:`edges: ${n.join("; ")}`}),this.treeConfig=null):(this.errors.remove(e),this.treeConfig=function(t){if(!t||""===t.trim())return null;try{const e=JSON.parse(t);if(!Array.isArray(e))return null;const n=e,s=function(t){const e=new Map;for(const n of t){const t=e.get(n.from)||[];t.push(n.to),e.set(n.from,t)}return e}(n),r=function(t){const e=new Set;for(const n of t)e.add(n.from),e.add(n.to);return e}(n),i=function(t,e){const n=new Set;for(const e of t)n.add(e.to);const s=Array.from(e).filter((t=>!n.has(t)));return 1===s.length?s[0]:null}(n,r);return{edges:n,adjacencyList:s,rootNode:i,allNodes:r}}catch(t){return console.error("parseTreeConfig: failed to parse tree configuration",t),null}}(t)),this.recalculateLayout()}validateDirection(t){const e="ERR_direction",n=["ltr","rtl","ttb","btt"];n.includes(t)?this.errors.remove(e):this.errors.addOrReplace({id:e,type:"warning",message:`direction: invalid value '${t}', must be one of: ${n.join(", ")}`}),this.recalculateLayout()}validateLevelSpacing(t){const e="ERR_levelSpacing";!r(t)||t<0?this.errors.addOrReplace({id:e,type:"warning",message:`level-spacing: invalid value '${t}', must be a non-negative number`}):this.errors.remove(e),this.recalculateLayout()}validateNodeSpacing(t){const e="ERR_nodeSpacing";!r(t)||t<0?this.errors.addOrReplace({id:e,type:"warning",message:`node-spacing: invalid value '${t}', must be a non-negative number`}):this.errors.remove(e),this.recalculateLayout()}validateEdgeStyle(t){const e="ERR_edgeStyle",n=["straight","orthogonal","curved"];n.includes(t)?this.errors.remove(e):this.errors.addOrReplace({id:e,type:"warning",message:`edge-style: invalid value '${t}', must be one of: ${n.join(", ")}`})}validateShowOperators(t){const e="ERR_showOperators";i(t)?this.errors.remove(e):this.errors.addOrReplace({id:e,type:"warning",message:`show-operators: invalid value '${t}', must be 'true' or 'false'`})}constructor(e){t(this,e),this.treeConfig=null,this.layout=null,this.nodeRects=new Map,this.svgWidth=0,this.svgHeight=0,this.resizeObserver=null,this.gridContainer=null,this.direction="ltr",this.levelSpacing=60,this.nodeSpacing=20,this.edgeStyle="orthogonal",this.showOperators="true",o(this),l(this),this.errors=c(this),this.componentStyle=a(this)}getTreeStyle(){return this.componentStyle((t=>({edgeColor:t["bn-tree"].edgeColor,edgeWidth:t["bn-tree"].edgeWidth,operatorCircleRadius:t["bn-tree"].operatorCircleRadius,operatorFontSize:t.global.fontSizePx*t["bn-tree"].operatorFontSizeScale,operatorColor:t["bn-tree"].operatorColor})))}componentWillLoad(){this.validateEdgesProp(this.edges),this.validateDirection(this.direction),this.validateLevelSpacing(this.levelSpacing),this.validateNodeSpacing(this.nodeSpacing),this.validateEdgeStyle(this.edgeStyle),this.validateShowOperators(this.showOperators)}componentDidLoad(){this.setupResizeObserver(),requestAnimationFrame((()=>{this.updateNodeRects()}))}disconnectedCallback(){this.resizeObserver&&(this.resizeObserver.disconnect(),this.resizeObserver=null)}setupResizeObserver(){var t;this.gridContainer=null===(t=this.element.shadowRoot)||void 0===t?void 0:t.querySelector(".tree-grid"),this.gridContainer&&(this.resizeObserver=new ResizeObserver((()=>{this.updateNodeRects()})),this.resizeObserver.observe(this.gridContainer),this.element.querySelectorAll("[slot]").forEach((t=>{this.resizeObserver.observe(t)})))}recalculateLayout(){this.layout=this.treeConfig?function(t,e,n,s){if(!t.rootNode)return{positions:new Map,gridTemplateColumns:"",gridTemplateRows:"",maxLevel:0,maxIndex:0};const r=function(t){const e=new Map;if(!t.rootNode)return e;const n=[{node:t.rootNode,level:0}],s=new Set;for(;n.length>0;){const{node:r,level:i}=n.shift();if(s.has(r))continue;s.add(r),e.set(r,i);const o=t.adjacencyList.get(r)||[];for(const t of o)s.has(t)||n.push({node:t,level:i+1})}return e}(t),i=function(t){const e=new Map;if(!t.rootNode)return e;let n=0;return function s(r){const i=e.get(r);if(i)return i;const o=t.adjacencyList.get(r)||[];if(0===o.length){const t={startIndex:n,endIndex:n};return e.set(r,t),n++,t}let a=1/0,l=-1/0;for(const t of o){const e=s(t);a=Math.min(a,e.startIndex),l=Math.max(l,e.endIndex)}const c={startIndex:a,endIndex:l};return e.set(r,c),c}(t.rootNode),e}(t),o=function(t,e,n,s){var r,i;const o=new Map,a=Math.max(...Array.from(e.values()));for(const l of t.allNodes){const t=null!==(r=e.get(l))&&void 0!==r?r:0,c=null!==(i=n.get(l))&&void 0!==i?i:{startIndex:0,endIndex:0};let d,u,h;switch(s){case"ltr":d=t+1,u=c.startIndex+1,h=c.endIndex-c.startIndex+1;break;case"rtl":d=a-t+1,u=c.startIndex+1,h=c.endIndex-c.startIndex+1;break;case"ttb":u=t+1,d=c.startIndex+1,h=1;break;case"btt":u=a-t+1,d=c.startIndex+1,h=1}o.set(l,{nodeId:l,level:t,index:c.startIndex,gridColumn:d,gridRow:u,gridRowSpan:h})}return o}(t,r,i,e),a=Math.max(...Array.from(r.values())),l=Math.max(...Array.from(i.values()).map((t=>t.endIndex))),{gridTemplateColumns:c,gridTemplateRows:d}=function(t,e,n,s,r){const i=t+1,o=e+1;if("ltr"===n||"rtl"===n){const t=[];for(let e=0;e<i;e++)t.push("auto"),e<i-1&&t.push(`${s}px`);const e=[];for(let t=0;t<o;t++)e.push("auto"),t<o-1&&e.push(`${r}px`);return{gridTemplateColumns:t.join(" "),gridTemplateRows:e.join(" ")}}{const t=[];for(let e=0;e<i;e++)t.push("auto"),e<i-1&&t.push(`${s}px`);const e=[];for(let t=0;t<o;t++)e.push("auto"),t<o-1&&e.push(`${r}px`);return{gridTemplateColumns:e.join(" "),gridTemplateRows:t.join(" ")}}}(a,l,e,n,s);return{positions:o,gridTemplateColumns:c,gridTemplateRows:d,maxLevel:a,maxIndex:l}}(this.treeConfig,this.direction,this.levelSpacing,this.nodeSpacing):null}updateNodeRects(){if(!this.treeConfig||!this.gridContainer)return;const t=this.gridContainer.getBoundingClientRect(),e=new Map;for(const n of this.treeConfig.allNodes){const s=this.element.querySelector(`[slot="${n}"]`);s&&e.set(n,g(s,t))}this.nodeRects=e,this.svgWidth=t.width,this.svgHeight=t.height}getSlotStyle(t){if(!this.layout)return{};const e=this.layout.positions.get(t);return e?"ltr"===this.direction||"rtl"===this.direction?{"grid-column":String(f(e.gridColumn)),"grid-row":`${p(e.gridRow)} / span ${n=e.gridRowSpan,n<=1?1:2*(n-1)+1}`,"align-self":"center"}:{"grid-row":String(p(e.gridRow)),"grid-column":String(f(e.gridColumn)),"justify-self":"center"}:{};var n}renderEdges(){var t;if(!this.treeConfig||0===this.nodeRects.size)return null;const n=this.getTreeStyle(),s=[],r=[],i=new Map;for(const t of this.treeConfig.edges){const e=i.get(t.to)||[];e.push(t.from),i.set(t.to,e)}for(const t of this.treeConfig.edges){const r=this.nodeRects.get(t.from),o=this.nodeRects.get(t.to);if(!r||!o)continue;const a=v(r,!0,this.direction),l=i.get(t.to)||[];let c;if(l.length>1){const e=l.indexOf(t.from);c=y(o,this.direction,e,l.length)}else c=v(o,!1,this.direction);const{path:d}=m(a,c,this.edgeStyle,this.direction),u=$(n.edgeColor,n.edgeWidth,t.style);s.push(e("path",{key:`edge-${t.from}-${t.to}`,d,fill:"none",stroke:u.stroke,"stroke-width":u.strokeWidth,"stroke-dasharray":u.strokeDasharray}))}if("true"===this.showOperators)for(const[s,i]of this.treeConfig.adjacencyList.entries()){const o=this.nodeRects.get(s);if(o)for(let a=0;a<i.length-1;a++){const l=i[a],c=i[a+1],d=h(this.treeConfig.edges,s,l);if(!(null==d?void 0:d.operator)||"none"===d.operator)continue;const f=this.nodeRects.get(l),p=this.nodeRects.get(c);if(!f||!p)continue;const g=null!==(t=d.label)&&void 0!==t?t:u(d.operator),v=b(o,f,p,this.direction);r.push(e("g",{key:`operator-${s}-${l}`,class:"operator-group"},e("circle",{cx:v.x,cy:v.y,r:n.operatorCircleRadius,fill:"white",stroke:n.edgeColor,"stroke-width":n.edgeWidth}),e("text",{x:v.x,y:v.y,"text-anchor":"middle","dominant-baseline":"central",style:{fontSize:`${n.operatorFontSize}px`,fill:n.operatorColor,fontWeight:"bold"}},g)))}}return e("svg",{class:"edge-layer",width:this.svgWidth,height:this.svgHeight,style:{position:"absolute",top:"0",left:"0",pointerEvents:"none"}},s,r)}renderSlots(){return this.treeConfig&&this.layout?Array.from(this.treeConfig.allNodes).map((t=>e("div",{key:t,class:"tree-node",style:this.getSlotStyle(t)},e("slot",{name:t})))):null}getFontStyles(){return this.componentStyle((t=>{var e,n,s,r;return{"--bn-font-family":(null===(e=t.global)||void 0===e?void 0:e.fontFamily)||"'Noto Sans', sans-serif","--bn-font-size":`${(null===(n=t.global)||void 0===n?void 0:n.fontSizePx)||13.3333}px`,"--bn-font-color":(null===(s=t.global)||void 0===s?void 0:s.fontColor)||"#000000","--bn-font-background":(null===(r=t.global)||void 0===r?void 0:r.fontBackgroundColor)||"#ffffff"}}))}render(){const t=this.getFontStyles();return e(n,{style:t},this.treeConfig&&this.layout?e("div",{class:"tree-container"},e("div",{class:"tree-grid",style:{display:"grid","grid-template-columns":this.layout.gridTemplateColumns,"grid-template-rows":this.layout.gridTemplateRows,position:"relative"}},this.renderEdges(),this.renderSlots())):e("div",{class:"tree-container tree-error"},e("slot",null)))}get element(){return s(this)}static get watchers(){return{edges:[{validateEdgesProp:0}],direction:[{validateDirection:0}],levelSpacing:[{validateLevelSpacing:0}],nodeSpacing:[{validateNodeSpacing:0}],edgeStyle:[{validateEdgeStyle:0}],showOperators:[{validateShowOperators:0}]}}};x.style=':host{display:inline-block;position:relative;font-family:var(--bn-font-family, "Noto Sans", sans-serif);font-size:var(--bn-font-size, 13.3333px);color:var(--bn-font-color, #000000)}.tree-container{position:relative;display:inline-block}.tree-grid{position:relative;display:grid;align-items:center}.tree-node{position:relative;z-index:1;border:1px solid #404040;background:var(--bn-font-background, white)}.edge-layer{position:absolute;top:0;left:0;z-index:0;pointer-events:none;overflow:visible}.tree-error{display:flex;flex-wrap:wrap;gap:20px}';export{x as bn_tree}
|
|
@@ -284,7 +284,8 @@ const Chart$1 = class Chart {
|
|
|
284
284
|
}
|
|
285
285
|
validateUnitScaling(newValue) {
|
|
286
286
|
const errId = "ERR_unitScaling";
|
|
287
|
-
|
|
287
|
+
const isAuto = (newValue === null || newValue === void 0 ? void 0 : newValue.toString().trim().toLowerCase()) === "auto";
|
|
288
|
+
if (!isAuto && !withStyled.isValidNumber(newValue) && !this.pixelPerUnitGroupMap.has(newValue)) {
|
|
288
289
|
this.errors.addOrReplace({
|
|
289
290
|
id: errId,
|
|
290
291
|
type: "warning",
|
|
@@ -629,15 +630,17 @@ const Chart$1 = class Chart {
|
|
|
629
630
|
this.checkWidthOverflow();
|
|
630
631
|
}
|
|
631
632
|
componentDidLoad() {
|
|
632
|
-
//
|
|
633
|
-
//
|
|
634
|
-
//
|
|
635
|
-
//
|
|
633
|
+
// If the initial parentDimensions measurement returned 0 (common inside
|
|
634
|
+
// cards/slots whose width isn't known before first paint), defer re-check
|
|
635
|
+
// to a requestAnimationFrame so the browser has completed at least one
|
|
636
|
+
// full layout pass before we re-measure.
|
|
636
637
|
if (this.canvasWidthSegmented <= 0) {
|
|
637
|
-
|
|
638
|
-
|
|
639
|
-
|
|
640
|
-
|
|
638
|
+
requestAnimationFrame(() => {
|
|
639
|
+
const { width } = scaling.getParentDimensions(this.element);
|
|
640
|
+
if (width > 0) {
|
|
641
|
+
index.forceUpdate(this);
|
|
642
|
+
}
|
|
643
|
+
});
|
|
641
644
|
}
|
|
642
645
|
}
|
|
643
646
|
/**
|
|
@@ -991,7 +994,7 @@ const Chart$1 = class Chart {
|
|
|
991
994
|
scenariosArray = [...scenariosArray, ...variancesArray];
|
|
992
995
|
}
|
|
993
996
|
const fontStyles = this.getFontStyles();
|
|
994
|
-
return (index.h(index.Host, { key: '
|
|
997
|
+
return (index.h(index.Host, { key: 'e74f31b521664a59111304c6f5df3b4ec568e34e', style: fontStyles }, index.h("div", { key: '8c65b4db7868346e8db983553ad6e1ab8e2c656c', class: "container" }, scenariosArray.map(this.chartTemplate))));
|
|
995
998
|
}
|
|
996
999
|
get element() { return index.getElement(this); }
|
|
997
1000
|
static get watchers() { return {
|
|
@@ -1328,7 +1331,8 @@ const Chart = class {
|
|
|
1328
1331
|
}
|
|
1329
1332
|
validateUnitScaling(newValue) {
|
|
1330
1333
|
const errId = "ERR_unitScaling";
|
|
1331
|
-
|
|
1334
|
+
const isAuto = (newValue === null || newValue === void 0 ? void 0 : newValue.toString().trim().toLowerCase()) === "auto";
|
|
1335
|
+
if (!isAuto && !withStyled.isValidNumber(newValue) && !this.pixelPerUnitGroupMap.has(newValue)) {
|
|
1332
1336
|
this.errors.addOrReplace({
|
|
1333
1337
|
id: errId,
|
|
1334
1338
|
type: "warning",
|
|
@@ -1810,15 +1814,17 @@ const Chart = class {
|
|
|
1810
1814
|
}
|
|
1811
1815
|
}
|
|
1812
1816
|
componentDidLoad() {
|
|
1813
|
-
//
|
|
1814
|
-
//
|
|
1815
|
-
//
|
|
1816
|
-
//
|
|
1817
|
+
// If the initial parentDimensions measurement returned 0 (common inside
|
|
1818
|
+
// cards/slots whose width isn't known before first paint), defer re-check
|
|
1819
|
+
// to a requestAnimationFrame so the browser has completed at least one
|
|
1820
|
+
// full layout pass before we re-measure.
|
|
1817
1821
|
if (this.canvasWidthSegmented <= 0) {
|
|
1818
|
-
|
|
1819
|
-
|
|
1820
|
-
|
|
1821
|
-
|
|
1822
|
+
requestAnimationFrame(() => {
|
|
1823
|
+
const { width } = scaling.getParentDimensions(this.element);
|
|
1824
|
+
if (width > 0) {
|
|
1825
|
+
index.forceUpdate(this);
|
|
1826
|
+
}
|
|
1827
|
+
});
|
|
1822
1828
|
}
|
|
1823
1829
|
}
|
|
1824
1830
|
prepareDimension() {
|
|
@@ -2214,7 +2220,7 @@ const Chart = class {
|
|
|
2214
2220
|
scenariosArray = [...scenariosArray, ...variancesArray];
|
|
2215
2221
|
}
|
|
2216
2222
|
const fontStyles = this.getFontStyles();
|
|
2217
|
-
return (index.h(index.Host, { key: '
|
|
2223
|
+
return (index.h(index.Host, { key: '7844e63a4b52baffd9d82cc5063df5623c7fd2ae', style: fontStyles }, index.h("div", { key: '5e1ac0a43a1e2176a122f1ac1211963a92b6e782', class: "container" }, scenariosArray.map(this.chartTemplate))));
|
|
2218
2224
|
}
|
|
2219
2225
|
get element() { return index.getElement(this); }
|
|
2220
2226
|
static get watchers() { return {
|
|
@@ -765,7 +765,11 @@ const ChartTree = class {
|
|
|
765
765
|
}
|
|
766
766
|
componentDidLoad() {
|
|
767
767
|
this.setupResizeObserver();
|
|
768
|
-
|
|
768
|
+
// Defer DOM measurement to after the browser has completed layout.
|
|
769
|
+
// getBoundingClientRect() can return zeros if called before first paint.
|
|
770
|
+
requestAnimationFrame(() => {
|
|
771
|
+
this.updateNodeRects();
|
|
772
|
+
});
|
|
769
773
|
}
|
|
770
774
|
disconnectedCallback() {
|
|
771
775
|
if (this.resizeObserver) {
|
|
@@ -61,7 +61,8 @@ export class Chart {
|
|
|
61
61
|
}
|
|
62
62
|
validateUnitScaling(newValue) {
|
|
63
63
|
const errId = "ERR_unitScaling";
|
|
64
|
-
|
|
64
|
+
const isAuto = (newValue === null || newValue === void 0 ? void 0 : newValue.toString().trim().toLowerCase()) === "auto";
|
|
65
|
+
if (!isAuto && !isValidNumber(newValue) && !this.pixelPerUnitGroupMap.has(newValue)) {
|
|
65
66
|
this.errors.addOrReplace({
|
|
66
67
|
id: errId,
|
|
67
68
|
type: "warning",
|
|
@@ -405,15 +406,17 @@ export class Chart {
|
|
|
405
406
|
this.checkWidthOverflow();
|
|
406
407
|
}
|
|
407
408
|
componentDidLoad() {
|
|
408
|
-
//
|
|
409
|
-
//
|
|
410
|
-
//
|
|
411
|
-
//
|
|
409
|
+
// If the initial parentDimensions measurement returned 0 (common inside
|
|
410
|
+
// cards/slots whose width isn't known before first paint), defer re-check
|
|
411
|
+
// to a requestAnimationFrame so the browser has completed at least one
|
|
412
|
+
// full layout pass before we re-measure.
|
|
412
413
|
if (this.canvasWidthSegmented <= 0) {
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
414
|
+
requestAnimationFrame(() => {
|
|
415
|
+
const { width } = getParentDimensions(this.element);
|
|
416
|
+
if (width > 0) {
|
|
417
|
+
forceUpdate(this);
|
|
418
|
+
}
|
|
419
|
+
});
|
|
417
420
|
}
|
|
418
421
|
}
|
|
419
422
|
/**
|
|
@@ -767,7 +770,7 @@ export class Chart {
|
|
|
767
770
|
scenariosArray = [...scenariosArray, ...variancesArray];
|
|
768
771
|
}
|
|
769
772
|
const fontStyles = this.getFontStyles();
|
|
770
|
-
return (h(Host, { key: '
|
|
773
|
+
return (h(Host, { key: 'e74f31b521664a59111304c6f5df3b4ec568e34e', style: fontStyles }, h("div", { key: '8c65b4db7868346e8db983553ad6e1ab8e2c656c', class: "container" }, scenariosArray.map(this.chartTemplate))));
|
|
771
774
|
}
|
|
772
775
|
static get is() { return "bn-chart-structure"; }
|
|
773
776
|
static get encapsulation() { return "shadow"; }
|
|
@@ -98,7 +98,8 @@ export class Chart {
|
|
|
98
98
|
}
|
|
99
99
|
validateUnitScaling(newValue) {
|
|
100
100
|
const errId = "ERR_unitScaling";
|
|
101
|
-
|
|
101
|
+
const isAuto = (newValue === null || newValue === void 0 ? void 0 : newValue.toString().trim().toLowerCase()) === "auto";
|
|
102
|
+
if (!isAuto && !isValidNumber(newValue) && !this.pixelPerUnitGroupMap.has(newValue)) {
|
|
102
103
|
this.errors.addOrReplace({
|
|
103
104
|
id: errId,
|
|
104
105
|
type: "warning",
|
|
@@ -579,15 +580,17 @@ export class Chart {
|
|
|
579
580
|
}
|
|
580
581
|
}
|
|
581
582
|
componentDidLoad() {
|
|
582
|
-
//
|
|
583
|
-
//
|
|
584
|
-
//
|
|
585
|
-
//
|
|
583
|
+
// If the initial parentDimensions measurement returned 0 (common inside
|
|
584
|
+
// cards/slots whose width isn't known before first paint), defer re-check
|
|
585
|
+
// to a requestAnimationFrame so the browser has completed at least one
|
|
586
|
+
// full layout pass before we re-measure.
|
|
586
587
|
if (this.canvasWidthSegmented <= 0) {
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
588
|
+
requestAnimationFrame(() => {
|
|
589
|
+
const { width } = getParentDimensions(this.element);
|
|
590
|
+
if (width > 0) {
|
|
591
|
+
forceUpdate(this);
|
|
592
|
+
}
|
|
593
|
+
});
|
|
591
594
|
}
|
|
592
595
|
}
|
|
593
596
|
prepareDimension() {
|
|
@@ -983,7 +986,7 @@ export class Chart {
|
|
|
983
986
|
scenariosArray = [...scenariosArray, ...variancesArray];
|
|
984
987
|
}
|
|
985
988
|
const fontStyles = this.getFontStyles();
|
|
986
|
-
return (h(Host, { key: '
|
|
989
|
+
return (h(Host, { key: '7844e63a4b52baffd9d82cc5063df5623c7fd2ae', style: fontStyles }, h("div", { key: '5e1ac0a43a1e2176a122f1ac1211963a92b6e782', class: "container" }, scenariosArray.map(this.chartTemplate))));
|
|
987
990
|
}
|
|
988
991
|
static get is() { return "bn-chart-time"; }
|
|
989
992
|
static get encapsulation() { return "shadow"; }
|
|
@@ -167,7 +167,11 @@ export class ChartTree {
|
|
|
167
167
|
}
|
|
168
168
|
componentDidLoad() {
|
|
169
169
|
this.setupResizeObserver();
|
|
170
|
-
|
|
170
|
+
// Defer DOM measurement to after the browser has completed layout.
|
|
171
|
+
// getBoundingClientRect() can return zeros if called before first paint.
|
|
172
|
+
requestAnimationFrame(() => {
|
|
173
|
+
this.updateNodeRects();
|
|
174
|
+
});
|
|
171
175
|
}
|
|
172
176
|
disconnectedCallback() {
|
|
173
177
|
if (this.resizeObserver) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{proxyCustomElement as t,HTMLElement as i,writeTask as e,forceUpdate as s,h as a,Host as r,transformTag as n}from"@stencil/core/internal/client";import{v as o,a as l,h as c,j as h,b as d,c as p,k as u,l as v,m,n as g,i as f}from"./validate.js";import{w as y,g as b,p as S}from"./scaling.js";import{w,a as O}from"./withHasError.js";import{w as k}from"./withTranslation.js";import{a as _}from"./context-protocol.js";import{w as x}from"./withStyled.js";import{w as R}from"./withComponentStyle.js";import{i as A,w as T}from"./withInheritedProps.js";import{A as E,b as N,O as U,g as M,h as L,i as C}from"./Order.js";import{d as D}from"./ibcs-chart-structure2.js";const P=t(class extends i{validateScenario(t){const i="ERR_scenarios";if(A(t))return void this.errors.remove(i);const e=o(t);e.length>0?this.errors.addOrReplace({id:i,type:"warning",message:"scenarios: invalid value(s) '"+JSON.stringify(e)+"' are not supported."}):this.errors.remove(i)}validateVariances(t){const i="ERR_variances";if(A(t))return void this.errors.remove(i);const e=l(t);e.length>0?this.errors.addOrReplace({id:i,type:"warning",message:"variances: invalid value(s) '"+JSON.stringify(e)+"' are not supported."}):this.errors.remove(i)}validateUnitScaling(t){const i="ERR_unitScaling";c(t)||this.pixelPerUnitGroupMap.has(t)?this.errors.remove(i):this.errors.addOrReplace({id:i,type:"warning",message:"unitScaling: invalid value(s) '"+t+"' are not supported."})}validatePercentageScaling(t){const i="ERR_percentageScaling";c(t)||this.pixelPerUnitGroupMap.has(t)?this.errors.remove(i):this.errors.addOrReplace({id:i,type:"warning",message:"percentageScaling: invalid value(s) '"+t+"' are not supported."})}validateLevel(t){const i="ERR_level";h(t)?this.errors.remove(i):this.errors.addOrReplace({id:i,type:"warning",message:"level: invalid value(s) '"+t+"' are not supported."})}validateOrderList(t){const i="ERR_order";if(A(t))return void this.errors.remove(i);const e=d(t);e.length>0?this.errors.addOrReplace({id:i,type:"warning",message:"order: invalid value(s) '"+JSON.stringify(e)+"' are not supported."}):this.errors.remove(i)}validateOrderDirection(t){const i="ERR_orderDirection";A(t)||p(t)?this.errors.remove(i):this.errors.addOrReplace({id:i,type:"warning",message:"orderDirection: invalid value '"+(null==t?void 0:""+t)+"' is not supported."})}validateLimit(t){const i="ERR_limit";u(t)?this.errors.remove(i):this.errors.addOrReplace({id:i,type:"warning",message:"limit: invalid value '"+(null==t?void 0:""+t)+"' is not supported."})}validateShowCategories(t){const i="ERR_showCategories";v(t)?this.errors.remove(i):this.errors.addOrReplace({id:i,type:"warning",message:"showCategories: invalid value(s) '"+(null==t?void 0:""+t)+"' are not supported."})}validateMeasureScale(t){const i="ERR_measureScale";m(t)?this.errors.remove(i):this.errors.addOrReplace({id:i,type:"warning",message:"measureScale: invalid value '"+(null==t?void 0:""+t)+"' is not supported."})}validateShowMeasureScale(t){const i="ERR_grouped";v(t)?this.errors.remove(i):this.errors.addOrReplace({id:i,type:"warning",message:"showMeasureScale: invalid value(s) '"+(null==t?void 0:""+t)+"' are not supported."})}validateStack(t){const i="ERR_stack",e=g(t);e.length>0?this.errors.addOrReplace({id:i,type:"warning",message:e.join("; ")}):this.errors.remove(i)}validateScaling(t){if(null==t||""===t||"none"===t||"auto"===t)return void this.errors.remove("ERR_scale");const i=Number(t);isNaN(i)||i<=0?this.errors.addOrReplace({id:"ERR_scale",type:"warning",message:`Invalid scale value: "${t}". Use "none", "auto", or a positive number.`}):this.errors.remove("ERR_scale")}constructor(t){super(),!1!==t&&this.__registerHost(),this.__attachShadow(),this.data=[],this.datasetMeta=null,this.appliedScaleFactor=1,this.chartTitle="",this.filter="",this.limit=0,this.showCategories="true",this.measureScale="greatest",this.showMeasureScale="false",this.measureUnit="",this.stack="",this.scenariosArray=[""],this.pixelPerUnitGroupMap=new Map,this._autoScaleGuard=!1,x(this),w(this),y(this,((t,i)=>{this.data=i||[]}),((t,i)=>{this.datasetMeta=i})),this.chartTemplate=this.chartTemplate.bind(this),this.errors=O(this),this.componentStyle=R(this),this.t=k(this).t,this.resolveInherited=T(this,[{propName:"scenarios",ancestorAttr:"title-scenarios"},{propName:"variances",ancestorAttr:"title-variances"},{propName:"order",ancestorAttr:"title-order"},{propName:"orderDirection",ancestorAttr:"title-order-direction"}])}componentWillLoad(){this.validateScenario(this.scenarios),this.validateVariances(this.variances),this.validateUnitScaling(this.unitScaling),this.validateLevel(this.level),this.validateOrderDirection(this.orderDirection),this.validateOrderList(this.order),this.validateShowCategories(this.showCategories),this.validateMeasureScale(this.measureScale),this.validateShowMeasureScale(this.showMeasureScale),this.validateStack(this.stack),this.validateScaling(this.scale)}componentDidRender(){var t,i;const{mode:s}=S(this.scale);if("auto"!==s&&"empty"!==s)return this._autoScaleGuard=!1,void this.checkWidthOverflow();if(this._autoScaleGuard)return this._autoScaleGuard=!1,void this.checkWidthOverflow();const a=this.element,{height:r}=b(a);if(r<=0)return void this.checkWidthOverflow();const n=this.componentStyle((t=>{var i;return(null===(i=t.global)||void 0===i?void 0:i.fontSizePx)||13.3333}));a.style.setProperty("--bn-font-size",n+"px");const o=null===(t=a.shadowRoot)||void 0===t?void 0:t.querySelector(".container"),l=null!==(i=null==o?void 0:o.scrollHeight)&&void 0!==i?i:a.scrollHeight;if(l<=r+1)return this.errors.remove("AUTO_scale"),1!==this.appliedScaleFactor&&(this._autoScaleGuard=!0,e((()=>{this.appliedScaleFactor=1}))),void this.checkWidthOverflow();const c=(r-1)/l;a.style.setProperty("--bn-font-size",n*c+"px"),"empty"===s?this.errors.addOrReplace({id:"AUTO_scale",type:"warning",message:"Auto-scaled chart by factor "+c.toFixed(3)}):this.errors.remove("AUTO_scale"),Math.abs(c-this.appliedScaleFactor)>.001&&(this._autoScaleGuard=!0,e((()=>{this.appliedScaleFactor=c}))),this.checkWidthOverflow()}componentDidLoad(){if(this.canvasWidthSegmented<=0){const{width:t}=b(this.element);t>0&&s(this)}}checkWidthOverflow(){var t;const i="WARN_overflow",e=((null!==(t=this.unitScaling)&&void 0!==t?t:"")+"").trim().toLowerCase();if(""===e||"auto"===e)return void this.errors.remove(i);const s=b(this.element);s.width>0&&this.element.scrollWidth>s.width+1?this.errors.addOrReplace({id:i,type:"error",message:`Chart exceeds available width (${this.element.scrollWidth}px > ${Math.round(s.width)}px). Reduce unit-scaling or set to "auto".`}):this.errors.remove(i)}prepareDimension(){const t=b(this.element);return this.canvasWidthSegmented=t.width/this.scenariosArray.length,{width:this.canvasWidthSegmented,height:t.height}}prepareScenarios(){var t,i,e,s;const a=this.resolveInherited("scenarios",this.scenarios);if(void 0!==a)return this.errors.remove("AUTO_scenarios"),a.split(",").map((t=>t.trim()));const r="auto"===(null===(t=this.scenarios)||void 0===t?void 0:t.trim().toLowerCase());return f(this.scenarios)||r?(null===(e=null===(i=this.datasetMeta)||void 0===i?void 0:i.availableScenarios)||void 0===e?void 0:e.length)>0?(r?this.errors.remove("AUTO_scenarios"):this.errors.addOrReplace({id:"AUTO_scenarios",type:"warning",message:"scenarios: not set, auto-detected: "+this.datasetMeta.availableScenarios.join(",")}),this.datasetMeta.availableScenarios):[]:(this.errors.remove("AUTO_scenarios"),null===(s=this.scenarios)||void 0===s?void 0:s.split(",").map((t=>t.trim())))}prepareVariances(){var t;const i=this.resolveInherited("variances",this.variances);return void 0!==i?i.split(",").map((t=>t.trim())):f(this.variances)?[]:null===(t=this.variances)||void 0===t?void 0:t.split(",").map((t=>t.trim()))}prepareHideCategories(t){return t>=1||"true"!==this.showCategories}prepareI18n(){const t=_,i=new Map([].map((t=>[t,this.t(".".concat(t))]))),e=new Map(t.map((t=>[t,this.t("global.".concat(t))])));return new Map([...e.entries(),...i.entries()])}preparePixelPerUnit(){var t;if(this.pixelPerUnitGroupMap.has(this.unitScaling))return this.errors.remove("AUTO_unitScaling"),this.pixelPerUnitGroupMap.get(this.unitScaling);if("auto"===(null===(t=this.unitScaling)||void 0===t?void 0:(""+t).trim().toLowerCase()))return this.errors.remove("AUTO_unitScaling"),0;const i=Number(this.unitScaling);return!isNaN(i)&&i>0?(this.errors.remove("AUTO_unitScaling"),i):(this.errors.addOrReplace({id:"AUTO_unitScaling",type:"warning",message:"unit-scaling: not set, auto-calculated to fit available space."}),0)}preparePixelPerPercentage(){return this.pixelPerUnitGroupMap.has(this.percentageScaling)?this.pixelPerUnitGroupMap.get(this.percentageScaling):100*Number(this.percentageScaling)}prepareLevel(){var t,i,e;const s="auto"===(null===(t=this.level)||void 0===t?void 0:t.trim().toLowerCase());return f(this.level)||s?(null===(i=this.datasetMeta)||void 0===i?void 0:i.suggestedLevel)?(s?this.errors.remove("AUTO_level"):this.errors.addOrReplace({id:"AUTO_level",type:"warning",message:"level: not set, auto-detected: "+this.datasetMeta.suggestedLevel}),E[this.datasetMeta.suggestedLevel.toUpperCase()]):void 0:(this.errors.remove("AUTO_level"),E[null===(e=this.level)||void 0===e?void 0:e.toUpperCase()])}prepareOrder(){var t;const i=this.resolveInherited("order",this.order),e=this.resolveInherited("orderDirection",this.orderDirection),s=null!=i?i:this.order,a=null!=e?e:this.orderDirection,r="auto"===(null==s?void 0:s.trim().toLowerCase());let n;return f(s)||r?(null===(t=this.datasetMeta)||void 0===t?void 0:t.suggestedOrder)?(r?this.errors.remove("AUTO_order"):this.errors.addOrReplace({id:"AUTO_order",type:"warning",message:"order: not set, auto-detected: "+this.datasetMeta.suggestedOrder}),n=this.datasetMeta.suggestedOrder):n=s:(this.errors.remove("AUTO_order"),n=s),{hierarchy:null==n?void 0:n.split(",").map((t=>U[null==t?void 0:t.toUpperCase()])),direction:N[null==a?void 0:a.toUpperCase()]}}prepareStyle(){const t=this.getEffectiveScaleFactor();return this.componentStyle((i=>{const e=i.global.fontSizePx*t;return{scaleFactors:{scenarioOffset:i["bn-chart-structure"].scaleFactors.scenarioOffset,scenarioLabelToBar:i["bn-chart-structure"].scaleFactors.scenarioLabelToBar,labelToBar:i["bn-chart-structure"].scaleFactors.labelToBar,labelToAxis:i["bn-chart-structure"].scaleFactors.labelToAxis,needleWidth:i["bn-chart-structure"].scaleFactors.needleWidth,needleHeadWidth:i["bn-chart-structure"].scaleFactors.needleHeadWidth,barWidth:i["bn-chart-structure"].scaleFactors.barWidth,varianceAxisLineWidth:i["bn-chart-structure"].scaleFactors.varianceAxisLineWidth,axisLineWidth:i["bn-chart-structure"].scaleFactors.axisLineWidth,auxiliaryLineWidth:i["bn-chart-structure"].scaleFactors.auxiliaryLineWidth,scenarioLineWidth:i["bn-chart-structure"].scaleFactors.scenarioLineWidth,markerWidth:i["bn-chart-structure"].scaleFactors.markerWidth,markerOffset:i["bn-chart-structure"].scaleFactors.markerOffset,categoryWidth:i["bn-chart-structure"].scaleFactors.categoryWidth,axisTickLength:i["bn-chart-structure"].scaleFactors.axisTickLength},fontStyles:{font:`${e}px ${i.global.fontFamily}`,size:e,color:i.global.fontColor,background:i.global.fontBackgroundColor,leading:1.8},axisStyles:i["bn-chart-structure"].axisStyles,barStyles:i["bn-chart-structure"].barStyles,varianceStyles:i["bn-chart-structure"].varianceStyles,padding:i["bn-chart-structure"].padding,pattern:null}}))}prepareChartTitle(t){return t>=1?"":this.chartTitle}prepareStackConfig(){if(f(this.stack))return this.errors.remove("WARN_stack_dimensions_scenarios"),null;try{const t=JSON.parse(this.stack),i=t.by,e="WARN_stack_dimensions_scenarios";if(i===M.DIMENSIONS){const t=this.prepareScenarios();t.length>1?this.errors.addOrReplace({id:e,type:"warning",message:`stack by dimensions: only the first scenario "${t[0]}" is used, the rest (${t.slice(1).join(", ")}) are discarded.`}):this.errors.remove(e)}else this.errors.remove(e);return{by:i,mode:t.mode||C.ABSOLUTE,order:t.order||L.DATASET}}catch(t){return this.errors.remove("WARN_stack_dimensions_scenarios"),null}}prepareFilter(){return 0===this.filter.length?"":this.filter}prepareLimit(){return Math.floor(Number(this.limit)||0)}getDataStructure(){return{IStructureChartDataRow:{operation:{type:"string",isOptional:!1,description:""},rowGroup:{type:"string",isOptional:!1,description:""},rowGroupIndex:{type:"number",isOptional:!1,description:""},category:{type:"string",isOptional:!1,description:""},categoryIndex:{type:"number",isOptional:!1,description:""},subCategory:{type:"string",isOptional:!1,description:""},subCategoryIndex:{type:"number",isOptional:!1,description:""},columnGroup:{type:"string",isOptional:!1,description:""},columnGroupIndex:{type:"number",isOptional:!1,description:""},columnSubGroup:{type:"string",isOptional:!1,description:""},columnSubGroupIndex:{type:"number",isOptional:!1,description:""},ac1:{type:"number",isOptional:!1,description:""},ac2:{type:"number",isOptional:!1,description:""},ac3:{type:"number",isOptional:!1,description:""},ac4:{type:"number",isOptional:!1,description:""},pp1:{type:"number",isOptional:!1,description:""},pp2:{type:"number",isOptional:!1,description:""},pp3:{type:"number",isOptional:!1,description:""},pp4:{type:"number",isOptional:!1,description:""},fc1:{type:"number",isOptional:!1,description:""},fc2:{type:"number",isOptional:!1,description:""},fc3:{type:"number",isOptional:!1,description:""},fc4:{type:"number",isOptional:!1,description:""},pl1:{type:"number",isOptional:!1,description:""},pl2:{type:"number",isOptional:!1,description:""},pl3:{type:"number",isOptional:!1,description:""},pl4:{type:"number",isOptional:!1,description:""}}}}prepareMeasureScale(){return f(this.measureScale)?"GREATEST":["_","k","M","G","T","P","E","Z","Y","m","μ","n","p","P","f","a","z","y"].includes(this.measureScale.trim())||"LEAST"===this.measureScale.trim().toUpperCase()?this.measureScale.trim():"GREATEST"}prepareShowMeasureScale(t){return 0===t&&"true"===this.showMeasureScale}prepareMeasureUnit(){return""===this.measureUnit||null==this.measureUnit?"":this.measureUnit}chartTemplate(t,i){const e=this.getEffectiveScaleFactor(),s=this.preparePixelPerUnit(),r=this.preparePixelPerPercentage(),n=this.prepareStackConfig(),o=this.prepareScenarios(),l=(null==n?void 0:n.by)===M.DIMENSIONS?o.slice(0,1):o;return a("ibcs-chart-structure",{data:this.data,chartTitle:this.prepareChartTitle(i),scenarios:l,variances:[t],hideCategories:this.prepareHideCategories(i),pixelPerUnit:s>0?s*e:0,pixelPerPercentage:r>0?r*e:0,limit:this.prepareLimit(),styles:this.prepareStyle(),i18n:this.prepareI18n(),order:this.prepareOrder(),level:this.prepareLevel(),filter:this.prepareFilter(),"measure-scale":this.prepareMeasureScale(),"measure-unit":this.prepareMeasureUnit(),showMeasureScale:this.prepareShowMeasureScale(i),stackConfig:n,parentDimensions:this.prepareDimension()})}getEffectiveScaleFactor(){const{mode:t,factor:i}=S(this.scale);return"factor"===t?i:"auto"===t||"empty"===t?this.appliedScaleFactor:1}getFontStyles(){const t=this.getEffectiveScaleFactor();return this.componentStyle((i=>{var e,s,a,r;const n=(null===(e=i.global)||void 0===e?void 0:e.fontSizePx)||13.3333;return{"--bn-font-family":(null===(s=i.global)||void 0===s?void 0:s.fontFamily)||"'Noto Sans', sans-serif","--bn-font-size":n*t+"px","--bn-font-color":(null===(a=i.global)||void 0===a?void 0:a.fontColor)||"#000000","--bn-font-background":(null===(r=i.global)||void 0===r?void 0:r.fontBackgroundColor)||"#ffffff"}}))}render(){let t=[""];const i=this.prepareVariances();i.length>0&&(t=[...t,...i]);const e=this.getFontStyles();return a(r,{key:"9c71155a82140c2020a830247c62d668fb10959e",style:e},a("div",{key:"5d9402429fd36aa3b9615f13a5038bc38d825173",class:"container"},t.map(this.chartTemplate)))}get element(){return this}static get watchers(){return{scenarios:[{validateScenario:0}],variances:[{validateVariances:0}],unitScaling:[{validateUnitScaling:0}],percentageScaling:[{validatePercentageScaling:0}],level:[{validateLevel:0}],order:[{validateOrderList:0}],orderDirection:[{validateOrderDirection:0}],limit:[{validateLimit:0}],showCategories:[{validateShowCategories:0}],measureScale:[{validateMeasureScale:0}],showMeasureScale:[{validateShowMeasureScale:0}],stack:[{validateStack:0}],scale:[{validateScaling:0}]}}static get style(){return':host{display:inline-block;position:relative;overflow:hidden}.container{display:flex;flex-direction:row}.background-image{display:flex;flex-wrap:wrap;justify-content:flex-end}.categories{text-align:right;font-size:var(--bn-font-size, 1em);font-family:var(--bn-font-family, "Noto Sans", "Helvetica Neue", Helvetica, sans-serif);color:var(--bn-font-color, black)}.label-bg{fill:var(--bn-font-background, white);opacity:0.7}.label-text{text-align:right;font-size:var(--bn-font-size, 1em);font-family:var(--bn-font-family, "Noto Sans", "Helvetica Neue", Helvetica, sans-serif);color:var(--bn-font-color, black)}.axis-title{text-align:center;font-family:var(--bn-font-family, "Noto Sans", "Helvetica Neue", Helvetica, sans-serif);color:var(--bn-font-color, black)}.axis-ac{stroke:black;stroke-width:0.1em}.axis-pp{stroke:grey;stroke-width:0.1em}.axis-fc{stroke:black;stroke-dasharray:2;stroke-width:0.1em}.axis-pl{stroke:white;stroke-width:0.1em;outline-offset:0em;outline:0.1em solid black}canvas{image-rendering:-moz-crisp-edges;image-rendering:-webkit-crisp-edges;image-rendering:pixelated;image-rendering:crisp-edges}.measure{font-weight:bold}span{display:inline-block}.hidePatternContainer{height:0;width:0}div{float:left}.warning{font-size:0.8em;font-style:italic}.footer{margin:0.2em;font-size:0.6em}.footer-hide{margin:0.2em;font-size:0.6em;opacity:0}'}},[1,"bn-chart-structure",{chartTitle:[1,"chart-title"],filter:[1],scenarios:[1],variances:[1],unitScaling:[8,"unit-scaling"],percentageScaling:[8,"percentage-scaling"],level:[1],order:[1],orderDirection:[1,"order-direction"],limit:[2],showCategories:[1,"show-categories"],measureScale:[1,"measure-scale"],showMeasureScale:[1,"show-measure-scale"],measureUnit:[1,"measure-unit"],stack:[1],scale:[1],data:[32],datasetMeta:[32],appliedScaleFactor:[32]},void 0,{scenarios:[{validateScenario:0}],variances:[{validateVariances:0}],unitScaling:[{validateUnitScaling:0}],percentageScaling:[{validatePercentageScaling:0}],level:[{validateLevel:0}],order:[{validateOrderList:0}],orderDirection:[{validateOrderDirection:0}],limit:[{validateLimit:0}],showCategories:[{validateShowCategories:0}],measureScale:[{validateMeasureScale:0}],showMeasureScale:[{validateShowMeasureScale:0}],stack:[{validateStack:0}],scale:[{validateScaling:0}]}]),W=P,z=function(){"undefined"!=typeof customElements&&["bn-chart-structure","ibcs-chart-structure"].forEach((t=>{switch(t){case"bn-chart-structure":customElements.get(n(t))||customElements.define(n(t),P);break;case"ibcs-chart-structure":customElements.get(n(t))||D()}}))};export{W as BnChartStructure,z as defineCustomElement}
|
|
1
|
+
import{proxyCustomElement as t,HTMLElement as i,writeTask as e,forceUpdate as s,h as a,Host as r,transformTag as n}from"@stencil/core/internal/client";import{v as o,a as l,h as c,j as h,b as d,c as p,k as u,l as v,m,n as g,i as f}from"./validate.js";import{w as y,g as b,p as S}from"./scaling.js";import{w,a as O}from"./withHasError.js";import{w as k}from"./withTranslation.js";import{a as _}from"./context-protocol.js";import{w as x}from"./withStyled.js";import{w as R}from"./withComponentStyle.js";import{i as A,w as T}from"./withInheritedProps.js";import{A as E,b as N,O as U,g as M,h as L,i as C}from"./Order.js";import{d as D}from"./ibcs-chart-structure2.js";const P=t(class extends i{validateScenario(t){const i="ERR_scenarios";if(A(t))return void this.errors.remove(i);const e=o(t);e.length>0?this.errors.addOrReplace({id:i,type:"warning",message:"scenarios: invalid value(s) '"+JSON.stringify(e)+"' are not supported."}):this.errors.remove(i)}validateVariances(t){const i="ERR_variances";if(A(t))return void this.errors.remove(i);const e=l(t);e.length>0?this.errors.addOrReplace({id:i,type:"warning",message:"variances: invalid value(s) '"+JSON.stringify(e)+"' are not supported."}):this.errors.remove(i)}validateUnitScaling(t){const i="ERR_unitScaling";"auto"===(null==t?void 0:(""+t).trim().toLowerCase())||c(t)||this.pixelPerUnitGroupMap.has(t)?this.errors.remove(i):this.errors.addOrReplace({id:i,type:"warning",message:"unitScaling: invalid value(s) '"+t+"' are not supported."})}validatePercentageScaling(t){const i="ERR_percentageScaling";c(t)||this.pixelPerUnitGroupMap.has(t)?this.errors.remove(i):this.errors.addOrReplace({id:i,type:"warning",message:"percentageScaling: invalid value(s) '"+t+"' are not supported."})}validateLevel(t){const i="ERR_level";h(t)?this.errors.remove(i):this.errors.addOrReplace({id:i,type:"warning",message:"level: invalid value(s) '"+t+"' are not supported."})}validateOrderList(t){const i="ERR_order";if(A(t))return void this.errors.remove(i);const e=d(t);e.length>0?this.errors.addOrReplace({id:i,type:"warning",message:"order: invalid value(s) '"+JSON.stringify(e)+"' are not supported."}):this.errors.remove(i)}validateOrderDirection(t){const i="ERR_orderDirection";A(t)||p(t)?this.errors.remove(i):this.errors.addOrReplace({id:i,type:"warning",message:"orderDirection: invalid value '"+(null==t?void 0:""+t)+"' is not supported."})}validateLimit(t){const i="ERR_limit";u(t)?this.errors.remove(i):this.errors.addOrReplace({id:i,type:"warning",message:"limit: invalid value '"+(null==t?void 0:""+t)+"' is not supported."})}validateShowCategories(t){const i="ERR_showCategories";v(t)?this.errors.remove(i):this.errors.addOrReplace({id:i,type:"warning",message:"showCategories: invalid value(s) '"+(null==t?void 0:""+t)+"' are not supported."})}validateMeasureScale(t){const i="ERR_measureScale";m(t)?this.errors.remove(i):this.errors.addOrReplace({id:i,type:"warning",message:"measureScale: invalid value '"+(null==t?void 0:""+t)+"' is not supported."})}validateShowMeasureScale(t){const i="ERR_grouped";v(t)?this.errors.remove(i):this.errors.addOrReplace({id:i,type:"warning",message:"showMeasureScale: invalid value(s) '"+(null==t?void 0:""+t)+"' are not supported."})}validateStack(t){const i="ERR_stack",e=g(t);e.length>0?this.errors.addOrReplace({id:i,type:"warning",message:e.join("; ")}):this.errors.remove(i)}validateScaling(t){if(null==t||""===t||"none"===t||"auto"===t)return void this.errors.remove("ERR_scale");const i=Number(t);isNaN(i)||i<=0?this.errors.addOrReplace({id:"ERR_scale",type:"warning",message:`Invalid scale value: "${t}". Use "none", "auto", or a positive number.`}):this.errors.remove("ERR_scale")}constructor(t){super(),!1!==t&&this.__registerHost(),this.__attachShadow(),this.data=[],this.datasetMeta=null,this.appliedScaleFactor=1,this.chartTitle="",this.filter="",this.limit=0,this.showCategories="true",this.measureScale="greatest",this.showMeasureScale="false",this.measureUnit="",this.stack="",this.scenariosArray=[""],this.pixelPerUnitGroupMap=new Map,this._autoScaleGuard=!1,x(this),w(this),y(this,((t,i)=>{this.data=i||[]}),((t,i)=>{this.datasetMeta=i})),this.chartTemplate=this.chartTemplate.bind(this),this.errors=O(this),this.componentStyle=R(this),this.t=k(this).t,this.resolveInherited=T(this,[{propName:"scenarios",ancestorAttr:"title-scenarios"},{propName:"variances",ancestorAttr:"title-variances"},{propName:"order",ancestorAttr:"title-order"},{propName:"orderDirection",ancestorAttr:"title-order-direction"}])}componentWillLoad(){this.validateScenario(this.scenarios),this.validateVariances(this.variances),this.validateUnitScaling(this.unitScaling),this.validateLevel(this.level),this.validateOrderDirection(this.orderDirection),this.validateOrderList(this.order),this.validateShowCategories(this.showCategories),this.validateMeasureScale(this.measureScale),this.validateShowMeasureScale(this.showMeasureScale),this.validateStack(this.stack),this.validateScaling(this.scale)}componentDidRender(){var t,i;const{mode:s}=S(this.scale);if("auto"!==s&&"empty"!==s)return this._autoScaleGuard=!1,void this.checkWidthOverflow();if(this._autoScaleGuard)return this._autoScaleGuard=!1,void this.checkWidthOverflow();const a=this.element,{height:r}=b(a);if(r<=0)return void this.checkWidthOverflow();const n=this.componentStyle((t=>{var i;return(null===(i=t.global)||void 0===i?void 0:i.fontSizePx)||13.3333}));a.style.setProperty("--bn-font-size",n+"px");const o=null===(t=a.shadowRoot)||void 0===t?void 0:t.querySelector(".container"),l=null!==(i=null==o?void 0:o.scrollHeight)&&void 0!==i?i:a.scrollHeight;if(l<=r+1)return this.errors.remove("AUTO_scale"),1!==this.appliedScaleFactor&&(this._autoScaleGuard=!0,e((()=>{this.appliedScaleFactor=1}))),void this.checkWidthOverflow();const c=(r-1)/l;a.style.setProperty("--bn-font-size",n*c+"px"),"empty"===s?this.errors.addOrReplace({id:"AUTO_scale",type:"warning",message:"Auto-scaled chart by factor "+c.toFixed(3)}):this.errors.remove("AUTO_scale"),Math.abs(c-this.appliedScaleFactor)>.001&&(this._autoScaleGuard=!0,e((()=>{this.appliedScaleFactor=c}))),this.checkWidthOverflow()}componentDidLoad(){this.canvasWidthSegmented<=0&&requestAnimationFrame((()=>{const{width:t}=b(this.element);t>0&&s(this)}))}checkWidthOverflow(){var t;const i="WARN_overflow",e=((null!==(t=this.unitScaling)&&void 0!==t?t:"")+"").trim().toLowerCase();if(""===e||"auto"===e)return void this.errors.remove(i);const s=b(this.element);s.width>0&&this.element.scrollWidth>s.width+1?this.errors.addOrReplace({id:i,type:"error",message:`Chart exceeds available width (${this.element.scrollWidth}px > ${Math.round(s.width)}px). Reduce unit-scaling or set to "auto".`}):this.errors.remove(i)}prepareDimension(){const t=b(this.element);return this.canvasWidthSegmented=t.width/this.scenariosArray.length,{width:this.canvasWidthSegmented,height:t.height}}prepareScenarios(){var t,i,e,s;const a=this.resolveInherited("scenarios",this.scenarios);if(void 0!==a)return this.errors.remove("AUTO_scenarios"),a.split(",").map((t=>t.trim()));const r="auto"===(null===(t=this.scenarios)||void 0===t?void 0:t.trim().toLowerCase());return f(this.scenarios)||r?(null===(e=null===(i=this.datasetMeta)||void 0===i?void 0:i.availableScenarios)||void 0===e?void 0:e.length)>0?(r?this.errors.remove("AUTO_scenarios"):this.errors.addOrReplace({id:"AUTO_scenarios",type:"warning",message:"scenarios: not set, auto-detected: "+this.datasetMeta.availableScenarios.join(",")}),this.datasetMeta.availableScenarios):[]:(this.errors.remove("AUTO_scenarios"),null===(s=this.scenarios)||void 0===s?void 0:s.split(",").map((t=>t.trim())))}prepareVariances(){var t;const i=this.resolveInherited("variances",this.variances);return void 0!==i?i.split(",").map((t=>t.trim())):f(this.variances)?[]:null===(t=this.variances)||void 0===t?void 0:t.split(",").map((t=>t.trim()))}prepareHideCategories(t){return t>=1||"true"!==this.showCategories}prepareI18n(){const t=_,i=new Map([].map((t=>[t,this.t(".".concat(t))]))),e=new Map(t.map((t=>[t,this.t("global.".concat(t))])));return new Map([...e.entries(),...i.entries()])}preparePixelPerUnit(){var t;if(this.pixelPerUnitGroupMap.has(this.unitScaling))return this.errors.remove("AUTO_unitScaling"),this.pixelPerUnitGroupMap.get(this.unitScaling);if("auto"===(null===(t=this.unitScaling)||void 0===t?void 0:(""+t).trim().toLowerCase()))return this.errors.remove("AUTO_unitScaling"),0;const i=Number(this.unitScaling);return!isNaN(i)&&i>0?(this.errors.remove("AUTO_unitScaling"),i):(this.errors.addOrReplace({id:"AUTO_unitScaling",type:"warning",message:"unit-scaling: not set, auto-calculated to fit available space."}),0)}preparePixelPerPercentage(){return this.pixelPerUnitGroupMap.has(this.percentageScaling)?this.pixelPerUnitGroupMap.get(this.percentageScaling):100*Number(this.percentageScaling)}prepareLevel(){var t,i,e;const s="auto"===(null===(t=this.level)||void 0===t?void 0:t.trim().toLowerCase());return f(this.level)||s?(null===(i=this.datasetMeta)||void 0===i?void 0:i.suggestedLevel)?(s?this.errors.remove("AUTO_level"):this.errors.addOrReplace({id:"AUTO_level",type:"warning",message:"level: not set, auto-detected: "+this.datasetMeta.suggestedLevel}),E[this.datasetMeta.suggestedLevel.toUpperCase()]):void 0:(this.errors.remove("AUTO_level"),E[null===(e=this.level)||void 0===e?void 0:e.toUpperCase()])}prepareOrder(){var t;const i=this.resolveInherited("order",this.order),e=this.resolveInherited("orderDirection",this.orderDirection),s=null!=i?i:this.order,a=null!=e?e:this.orderDirection,r="auto"===(null==s?void 0:s.trim().toLowerCase());let n;return f(s)||r?(null===(t=this.datasetMeta)||void 0===t?void 0:t.suggestedOrder)?(r?this.errors.remove("AUTO_order"):this.errors.addOrReplace({id:"AUTO_order",type:"warning",message:"order: not set, auto-detected: "+this.datasetMeta.suggestedOrder}),n=this.datasetMeta.suggestedOrder):n=s:(this.errors.remove("AUTO_order"),n=s),{hierarchy:null==n?void 0:n.split(",").map((t=>U[null==t?void 0:t.toUpperCase()])),direction:N[null==a?void 0:a.toUpperCase()]}}prepareStyle(){const t=this.getEffectiveScaleFactor();return this.componentStyle((i=>{const e=i.global.fontSizePx*t;return{scaleFactors:{scenarioOffset:i["bn-chart-structure"].scaleFactors.scenarioOffset,scenarioLabelToBar:i["bn-chart-structure"].scaleFactors.scenarioLabelToBar,labelToBar:i["bn-chart-structure"].scaleFactors.labelToBar,labelToAxis:i["bn-chart-structure"].scaleFactors.labelToAxis,needleWidth:i["bn-chart-structure"].scaleFactors.needleWidth,needleHeadWidth:i["bn-chart-structure"].scaleFactors.needleHeadWidth,barWidth:i["bn-chart-structure"].scaleFactors.barWidth,varianceAxisLineWidth:i["bn-chart-structure"].scaleFactors.varianceAxisLineWidth,axisLineWidth:i["bn-chart-structure"].scaleFactors.axisLineWidth,auxiliaryLineWidth:i["bn-chart-structure"].scaleFactors.auxiliaryLineWidth,scenarioLineWidth:i["bn-chart-structure"].scaleFactors.scenarioLineWidth,markerWidth:i["bn-chart-structure"].scaleFactors.markerWidth,markerOffset:i["bn-chart-structure"].scaleFactors.markerOffset,categoryWidth:i["bn-chart-structure"].scaleFactors.categoryWidth,axisTickLength:i["bn-chart-structure"].scaleFactors.axisTickLength},fontStyles:{font:`${e}px ${i.global.fontFamily}`,size:e,color:i.global.fontColor,background:i.global.fontBackgroundColor,leading:1.8},axisStyles:i["bn-chart-structure"].axisStyles,barStyles:i["bn-chart-structure"].barStyles,varianceStyles:i["bn-chart-structure"].varianceStyles,padding:i["bn-chart-structure"].padding,pattern:null}}))}prepareChartTitle(t){return t>=1?"":this.chartTitle}prepareStackConfig(){if(f(this.stack))return this.errors.remove("WARN_stack_dimensions_scenarios"),null;try{const t=JSON.parse(this.stack),i=t.by,e="WARN_stack_dimensions_scenarios";if(i===M.DIMENSIONS){const t=this.prepareScenarios();t.length>1?this.errors.addOrReplace({id:e,type:"warning",message:`stack by dimensions: only the first scenario "${t[0]}" is used, the rest (${t.slice(1).join(", ")}) are discarded.`}):this.errors.remove(e)}else this.errors.remove(e);return{by:i,mode:t.mode||C.ABSOLUTE,order:t.order||L.DATASET}}catch(t){return this.errors.remove("WARN_stack_dimensions_scenarios"),null}}prepareFilter(){return 0===this.filter.length?"":this.filter}prepareLimit(){return Math.floor(Number(this.limit)||0)}getDataStructure(){return{IStructureChartDataRow:{operation:{type:"string",isOptional:!1,description:""},rowGroup:{type:"string",isOptional:!1,description:""},rowGroupIndex:{type:"number",isOptional:!1,description:""},category:{type:"string",isOptional:!1,description:""},categoryIndex:{type:"number",isOptional:!1,description:""},subCategory:{type:"string",isOptional:!1,description:""},subCategoryIndex:{type:"number",isOptional:!1,description:""},columnGroup:{type:"string",isOptional:!1,description:""},columnGroupIndex:{type:"number",isOptional:!1,description:""},columnSubGroup:{type:"string",isOptional:!1,description:""},columnSubGroupIndex:{type:"number",isOptional:!1,description:""},ac1:{type:"number",isOptional:!1,description:""},ac2:{type:"number",isOptional:!1,description:""},ac3:{type:"number",isOptional:!1,description:""},ac4:{type:"number",isOptional:!1,description:""},pp1:{type:"number",isOptional:!1,description:""},pp2:{type:"number",isOptional:!1,description:""},pp3:{type:"number",isOptional:!1,description:""},pp4:{type:"number",isOptional:!1,description:""},fc1:{type:"number",isOptional:!1,description:""},fc2:{type:"number",isOptional:!1,description:""},fc3:{type:"number",isOptional:!1,description:""},fc4:{type:"number",isOptional:!1,description:""},pl1:{type:"number",isOptional:!1,description:""},pl2:{type:"number",isOptional:!1,description:""},pl3:{type:"number",isOptional:!1,description:""},pl4:{type:"number",isOptional:!1,description:""}}}}prepareMeasureScale(){return f(this.measureScale)?"GREATEST":["_","k","M","G","T","P","E","Z","Y","m","μ","n","p","P","f","a","z","y"].includes(this.measureScale.trim())||"LEAST"===this.measureScale.trim().toUpperCase()?this.measureScale.trim():"GREATEST"}prepareShowMeasureScale(t){return 0===t&&"true"===this.showMeasureScale}prepareMeasureUnit(){return""===this.measureUnit||null==this.measureUnit?"":this.measureUnit}chartTemplate(t,i){const e=this.getEffectiveScaleFactor(),s=this.preparePixelPerUnit(),r=this.preparePixelPerPercentage(),n=this.prepareStackConfig(),o=this.prepareScenarios(),l=(null==n?void 0:n.by)===M.DIMENSIONS?o.slice(0,1):o;return a("ibcs-chart-structure",{data:this.data,chartTitle:this.prepareChartTitle(i),scenarios:l,variances:[t],hideCategories:this.prepareHideCategories(i),pixelPerUnit:s>0?s*e:0,pixelPerPercentage:r>0?r*e:0,limit:this.prepareLimit(),styles:this.prepareStyle(),i18n:this.prepareI18n(),order:this.prepareOrder(),level:this.prepareLevel(),filter:this.prepareFilter(),"measure-scale":this.prepareMeasureScale(),"measure-unit":this.prepareMeasureUnit(),showMeasureScale:this.prepareShowMeasureScale(i),stackConfig:n,parentDimensions:this.prepareDimension()})}getEffectiveScaleFactor(){const{mode:t,factor:i}=S(this.scale);return"factor"===t?i:"auto"===t||"empty"===t?this.appliedScaleFactor:1}getFontStyles(){const t=this.getEffectiveScaleFactor();return this.componentStyle((i=>{var e,s,a,r;const n=(null===(e=i.global)||void 0===e?void 0:e.fontSizePx)||13.3333;return{"--bn-font-family":(null===(s=i.global)||void 0===s?void 0:s.fontFamily)||"'Noto Sans', sans-serif","--bn-font-size":n*t+"px","--bn-font-color":(null===(a=i.global)||void 0===a?void 0:a.fontColor)||"#000000","--bn-font-background":(null===(r=i.global)||void 0===r?void 0:r.fontBackgroundColor)||"#ffffff"}}))}render(){let t=[""];const i=this.prepareVariances();i.length>0&&(t=[...t,...i]);const e=this.getFontStyles();return a(r,{key:"e74f31b521664a59111304c6f5df3b4ec568e34e",style:e},a("div",{key:"8c65b4db7868346e8db983553ad6e1ab8e2c656c",class:"container"},t.map(this.chartTemplate)))}get element(){return this}static get watchers(){return{scenarios:[{validateScenario:0}],variances:[{validateVariances:0}],unitScaling:[{validateUnitScaling:0}],percentageScaling:[{validatePercentageScaling:0}],level:[{validateLevel:0}],order:[{validateOrderList:0}],orderDirection:[{validateOrderDirection:0}],limit:[{validateLimit:0}],showCategories:[{validateShowCategories:0}],measureScale:[{validateMeasureScale:0}],showMeasureScale:[{validateShowMeasureScale:0}],stack:[{validateStack:0}],scale:[{validateScaling:0}]}}static get style(){return':host{display:inline-block;position:relative;overflow:hidden}.container{display:flex;flex-direction:row}.background-image{display:flex;flex-wrap:wrap;justify-content:flex-end}.categories{text-align:right;font-size:var(--bn-font-size, 1em);font-family:var(--bn-font-family, "Noto Sans", "Helvetica Neue", Helvetica, sans-serif);color:var(--bn-font-color, black)}.label-bg{fill:var(--bn-font-background, white);opacity:0.7}.label-text{text-align:right;font-size:var(--bn-font-size, 1em);font-family:var(--bn-font-family, "Noto Sans", "Helvetica Neue", Helvetica, sans-serif);color:var(--bn-font-color, black)}.axis-title{text-align:center;font-family:var(--bn-font-family, "Noto Sans", "Helvetica Neue", Helvetica, sans-serif);color:var(--bn-font-color, black)}.axis-ac{stroke:black;stroke-width:0.1em}.axis-pp{stroke:grey;stroke-width:0.1em}.axis-fc{stroke:black;stroke-dasharray:2;stroke-width:0.1em}.axis-pl{stroke:white;stroke-width:0.1em;outline-offset:0em;outline:0.1em solid black}canvas{image-rendering:-moz-crisp-edges;image-rendering:-webkit-crisp-edges;image-rendering:pixelated;image-rendering:crisp-edges}.measure{font-weight:bold}span{display:inline-block}.hidePatternContainer{height:0;width:0}div{float:left}.warning{font-size:0.8em;font-style:italic}.footer{margin:0.2em;font-size:0.6em}.footer-hide{margin:0.2em;font-size:0.6em;opacity:0}'}},[1,"bn-chart-structure",{chartTitle:[1,"chart-title"],filter:[1],scenarios:[1],variances:[1],unitScaling:[8,"unit-scaling"],percentageScaling:[8,"percentage-scaling"],level:[1],order:[1],orderDirection:[1,"order-direction"],limit:[2],showCategories:[1,"show-categories"],measureScale:[1,"measure-scale"],showMeasureScale:[1,"show-measure-scale"],measureUnit:[1,"measure-unit"],stack:[1],scale:[1],data:[32],datasetMeta:[32],appliedScaleFactor:[32]},void 0,{scenarios:[{validateScenario:0}],variances:[{validateVariances:0}],unitScaling:[{validateUnitScaling:0}],percentageScaling:[{validatePercentageScaling:0}],level:[{validateLevel:0}],order:[{validateOrderList:0}],orderDirection:[{validateOrderDirection:0}],limit:[{validateLimit:0}],showCategories:[{validateShowCategories:0}],measureScale:[{validateMeasureScale:0}],showMeasureScale:[{validateShowMeasureScale:0}],stack:[{validateStack:0}],scale:[{validateScaling:0}]}]),W=P,z=function(){"undefined"!=typeof customElements&&["bn-chart-structure","ibcs-chart-structure"].forEach((t=>{switch(t){case"bn-chart-structure":customElements.get(n(t))||customElements.define(n(t),P);break;case"ibcs-chart-structure":customElements.get(n(t))||D()}}))};export{W as BnChartStructure,z as defineCustomElement}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{proxyCustomElement as i,HTMLElement as t,writeTask as e,forceUpdate as s,h as a,Host as r,transformTag as n}from"@stencil/core/internal/client";import{v as o,a as l,h as d,k as h,j as c,b as p,c as u,f as v,n as m,o as g,l as y,m as f,i as S}from"./validate.js";import{w,g as b,p as O}from"./scaling.js";import{w as x,a as M}from"./withHasError.js";import{w as R}from"./withTranslation.js";import{a as _}from"./context-protocol.js";import{w as A}from"./withStyled.js";import{w as L}from"./withComponentStyle.js";import{i as T,w as E}from"./withInheritedProps.js";import{b as C,O as I,c as U,g as k,h as W,i as N,C as D}from"./Order.js";import{F}from"./ibcsRuleSet.js";import{D as j}from"./DateStringFactory.js";import{d as P}from"./ibcs-chart-time2.js";var G;!function(i){i.ROWGROUP="rowGroup",i.ROWGROUPINDEX="rowGroupIndex",i.CATEGORY="category",i.CATEGORYINDEX="categoryIndex",i.SUBCATEGORY="subCategory",i.SUBCATEGORYINDEX="subCategoryIndex"}(G||(G={}));const B=i(class extends t{validateScenario(i){const t="ERR_scenarios";if(T(i))return void this.errors.remove(t);const e=o(i);e.length>0?this.errors.addOrReplace({id:t,type:"warning",message:"scenarios: invalid value(s) '"+JSON.stringify(e)+"' are not supported."}):this.errors.remove(t)}validateVariances(i){const t="ERR_variances";if(T(i))return void this.errors.remove(t);const e=l(i);e.length>0?this.errors.addOrReplace({id:t,type:"warning",message:"variances: invalid value(s) '"+JSON.stringify(e)+"' are not supported."}):this.errors.remove(t)}validateLeftSync(i){const t="ERR_syncSpaceLeft";d(i)?this.errors.remove(t):this.errors.addOrReplace({id:t,type:"warning",message:"syncSpaceLeft: invalid value(s) '"+i+"' are not supported."})}validateLimit(i){const t="ERR_limit";h(i)?this.errors.remove(t):this.errors.addOrReplace({id:t,type:"warning",message:"limit: invalid value '"+(null==i?void 0:""+i)+"' is not supported."})}validateUnitScaling(i){const t="ERR_unitScaling";d(i)||this.pixelPerUnitGroupMap.has(i)?this.errors.remove(t):this.errors.addOrReplace({id:t,type:"warning",message:"unitScaling: invalid value(s) '"+i+"' are not supported."})}validatePercentageScaling(i){const t="ERR_percentageScaling";d(i)||this.pixelPerUnitGroupMap.has(i)?this.errors.remove(t):this.errors.addOrReplace({id:t,type:"warning",message:"percentageScaling: invalid value(s) '"+i+"' are not supported."})}validateLevel(i){const t="ERR_level";c(i)?this.errors.remove(t):this.errors.addOrReplace({id:t,type:"warning",message:"level: invalid value(s) '"+i+"' are not supported."})}validateOrderList(i){const t="ERR_order";if(T(i))return void this.errors.remove(t);const e=p(i);e.length>0?this.errors.addOrReplace({id:t,type:"warning",message:"order: invalid value(s) '"+JSON.stringify(e)+"' are not supported."}):this.errors.remove(t)}validateOrderDirection(i){const t="ERR_orderDirection";T(i)||u(i)?this.errors.remove(t):this.errors.addOrReplace({id:t,type:"warning",message:"orderDirection: invalid value '"+(null==i?void 0:""+i)+"' is not supported."})}validateDateInterval(i){const t="ERR_dateInterval";v(i)?this.errors.remove(t):this.errors.addOrReplace({id:t,type:"warning",message:"dateInterval: invalid value '"+(null==i?void 0:""+i)+"' is not supported."})}validateChartMode(i){const t="ERR_chartMode";["bar","line","auto"].includes(null==i?void 0:i.toLowerCase())?this.errors.remove(t):this.errors.addOrReplace({id:t,type:"warning",message:"chartMode: invalid value '"+(null==i?void 0:""+i)+"' is not supported. Valid values are: bar, line, auto."})}validateMaxBars(i){const t="ERR_maxBars";!h(i)||i<1?this.errors.addOrReplace({id:t,type:"warning",message:"maxBars: invalid value '"+(null==i?void 0:""+i)+"' is not supported. Must be a positive integer."}):this.errors.remove(t)}validateStack(i){const t="ERR_stack",e=m(i);e.length>0?this.errors.addOrReplace({id:t,type:"warning",message:e.join("; ")}):this.errors.remove(t)}validateScaling(i){if(null==i||""===i||"none"===i||"auto"===i)return void this.errors.remove("ERR_scale");const t=Number(i);isNaN(t)||t<=0?this.errors.addOrReplace({id:"ERR_scale",type:"warning",message:`Invalid scale value: "${i}". Use "none", "auto", or a positive number.`}):this.errors.remove("ERR_scale")}validateAxisLabelsMode(i){const t="ERR_axisLabelsMode";g(i)?this.errors.remove(t):this.errors.addOrReplace({id:t,type:"warning",message:"axisLabelsMode: invalid value '"+(null==i?void 0:""+i)+"' is not supported."})}validateLineFullWidth(i){const t="ERR_lineFullWidth";y(i)?this.errors.remove(t):this.errors.addOrReplace({id:t,type:"warning",message:"lineFullWidth: invalid value(s) '"+(null==i?void 0:""+i)+"' are not supported."})}validateShowCategories(i){const t="ERR_showCategories";y(i)?this.errors.remove(t):this.errors.addOrReplace({id:t,type:"warning",message:"showCategories: invalid value(s) '"+(null==i?void 0:""+i)+"' are not supported."})}validateMeasureScale(i){const t="ERR_measureScale";f(i)?this.errors.remove(t):this.errors.addOrReplace({id:t,type:"warning",message:"measureScale: invalid value '"+(null==i?void 0:""+i)+"' is not supported."})}validateShowMeasureScale(i){const t="ERR_grouped";y(i)?this.errors.remove(t):this.errors.addOrReplace({id:t,type:"warning",message:"showMeasureScale: invalid value(s) '"+(null==i?void 0:""+i)+"' are not supported."})}validateShowOverlayAvg(i){const t="ERR_grouped";y(i)?this.errors.remove(t):this.errors.addOrReplace({id:t,type:"warning",message:"showOverlayAvg: invalid value(s) '"+(null==i?void 0:""+i)+"' are not supported."})}validateShowOverlayMedian(i){const t="ERR_grouped";y(i)?this.errors.remove(t):this.errors.addOrReplace({id:t,type:"warning",message:"showOverlayMedian: invalid value(s) '"+(null==i?void 0:""+i)+"' are not supported."})}constructor(i){super(),!1!==i&&this.__registerHost(),this.__attachShadow(),this.data=[],this.datasetMeta=null,this.appliedScaleFactor=1,this.chartTitle="",this.filter="",this.syncSpaceLeft=-1,this.limit=0,this.chartMode="bar",this.maxBars=28,this.stack="",this.intervalSpanLimit=28,this.lineFullWidth="true",this.showCategories="true",this.measureScale="greatest",this.showMeasureScale="false",this.showOverlayAvg="true",this.showOverlayMedian="false",this.measureUnit="",this.pixelPerUnitGroupMap=new Map,this._autoScaleGuard=!1,A(this),x(this),w(this,((i,t)=>{this.data=t||[]}),((i,t)=>{this.datasetMeta=t})),this.chartTemplate=this.chartTemplate.bind(this),this.errors=M(this),this.componentStyle=L(this),this.t=R(this).t,this.resolveInherited=E(this,[{propName:"scenarios",ancestorAttr:"title-scenarios"},{propName:"variances",ancestorAttr:"title-variances"},{propName:"order",ancestorAttr:"title-order"},{propName:"orderDirection",ancestorAttr:"title-order-direction"}])}componentWillLoad(){this.validateScenario(this.scenarios),this.validateVariances(this.variances),this.validateUnitScaling(this.unitScaling),this.validateLimit(this.limit),this.validateLevel(this.level),this.validateOrderDirection(this.orderDirection),this.validateOrderList(this.order),this.validateLeftSync(this.syncSpaceLeft),this.validateDateInterval(this.dateInterval),this.validateAxisLabelsMode(this.axisLabelsMode),this.validateLineFullWidth(this.lineFullWidth),this.validateShowCategories(this.showCategories),this.validateMeasureScale(this.measureScale),this.validateShowMeasureScale(this.showMeasureScale),this.validateShowOverlayAvg(this.showOverlayAvg),this.validateShowOverlayMedian(this.showOverlayMedian),this.validateChartMode(this.chartMode),this.validateMaxBars(this.maxBars),this.validateStack(this.stack),this.validateScaling(this.scale)}componentDidRender(){var i,t;const{mode:s}=O(this.scale);if("auto"!==s&&"empty"!==s){this._autoScaleGuard=!1;const i=b(this.element),t="WARN_overflow";return void(i.width>0&&this.element.scrollWidth>i.width+1?this.errors.addOrReplace({id:t,type:"warning",message:"Chart exceeds available space and will be cut off. Check unit-scaling value."}):this.errors.remove(t))}if(this._autoScaleGuard)return void(this._autoScaleGuard=!1);const a=this.element,{width:r}=b(a);if(r<=0)return;const n=this.componentStyle((i=>{var t;return(null===(t=i.global)||void 0===t?void 0:t.fontSizePx)||13.3333}));a.style.setProperty("--bn-font-size",n+"px");const o=null===(i=a.shadowRoot)||void 0===i?void 0:i.querySelector(".container"),l=null!==(t=null==o?void 0:o.scrollWidth)&&void 0!==t?t:a.scrollWidth;if(l<=r+1)return this.errors.remove("AUTO_scale"),void(1!==this.appliedScaleFactor&&(this._autoScaleGuard=!0,e((()=>{this.appliedScaleFactor=1}))));const d=(r-1)/l;a.style.setProperty("--bn-font-size",n*d+"px"),"empty"===s?this.errors.addOrReplace({id:"AUTO_scale",type:"warning",message:"Auto-scaled chart by factor "+d.toFixed(3)}):this.errors.remove("AUTO_scale"),Math.abs(d-this.appliedScaleFactor)>.001&&(this._autoScaleGuard=!0,e((()=>{this.appliedScaleFactor=d})))}componentDidLoad(){if(this.canvasWidthSegmented<=0){const{width:i}=b(this.element);i>0&&s(this)}}prepareDimension(){const i=b(this.element),t=this.prepareScenarios(),e=this.prepareVariances();return this.canvasWidthSegmented=i.width/(t.length+e.length||1),{width:this.canvasWidthSegmented,height:i.height}}prepareScenarios(){var i,t,e,s;const a=this.resolveInherited("scenarios",this.scenarios);if(void 0!==a)return this.errors.remove("AUTO_scenarios"),a.split(",").map((i=>i.trim()));const r="auto"===(null===(i=this.scenarios)||void 0===i?void 0:i.trim().toLowerCase());return S(this.scenarios)||r?(null===(e=null===(t=this.datasetMeta)||void 0===t?void 0:t.availableScenarios)||void 0===e?void 0:e.length)>0?(r?this.errors.remove("AUTO_scenarios"):this.errors.addOrReplace({id:"AUTO_scenarios",type:"warning",message:"scenarios: not set, auto-detected: "+this.datasetMeta.availableScenarios.join(",")}),this.datasetMeta.availableScenarios):[]:(this.errors.remove("AUTO_scenarios"),null===(s=this.scenarios)||void 0===s?void 0:s.split(",").map((i=>i.trim())))}prepareAvg(){return"true"===this.showOverlayAvg}prepareMedian(){return"true"===this.showOverlayMedian}prepareVariances(){var i;const t=this.resolveInherited("variances",this.variances);return void 0!==t?t.split(",").map((i=>i.trim())):S(this.variances)?[]:null===(i=this.variances)||void 0===i?void 0:i.split(",").map((i=>i.trim()))}prepareHideAxisLabels(i){return i>=1||"true"!==this.showCategories}prepareI18n(){const i=_,t=new Map([].map((i=>[i,this.t(".".concat(i))]))),e=new Map(i.map((i=>[i,this.t("global.".concat(i))])));return new Map([...e.entries(),...t.entries()])}preparePixelPerUnit(){var i;if(this.pixelPerUnitGroupMap.has(this.unitScaling))return this.errors.remove("AUTO_unitScaling"),this.pixelPerUnitGroupMap.get(this.unitScaling);if("auto"===(null===(i=this.unitScaling)||void 0===i?void 0:(""+i).trim().toLowerCase()))return this.errors.remove("AUTO_unitScaling"),0;const t=Number(this.unitScaling);return!isNaN(t)&&t>0?(this.errors.remove("AUTO_unitScaling"),t):(this.errors.addOrReplace({id:"AUTO_unitScaling",type:"warning",message:"unit-scaling: not set, auto-calculated to fit available space."}),0)}preparePixelPerPercentage(){return this.pixelPerUnitGroupMap.has(this.percentageScaling)?this.pixelPerUnitGroupMap.get(this.percentageScaling):100*Number(this.percentageScaling)}prepareLevel(){var i,t,e;const s="auto"===(null===(i=this.level)||void 0===i?void 0:i.trim().toLowerCase());return S(this.level)||s?(null===(t=this.datasetMeta)||void 0===t?void 0:t.suggestedLevel)?(s?this.errors.remove("AUTO_level"):this.errors.addOrReplace({id:"AUTO_level",type:"warning",message:"level: not set, auto-detected: "+this.datasetMeta.suggestedLevel}),G[this.datasetMeta.suggestedLevel.toUpperCase()]):void 0:(this.errors.remove("AUTO_level"),G[null===(e=this.level)||void 0===e?void 0:e.toUpperCase()])}prepareOrder(){var i,t,e;const s=this.resolveInherited("order",this.order),a=this.resolveInherited("orderDirection",this.orderDirection),r=null!=s?s:this.order,n=null!=a?a:this.orderDirection;let o=(S(this.level)||"auto"===(null===(i=this.level)||void 0===i?void 0:i.trim().toLowerCase()))&&(null===(t=this.datasetMeta)||void 0===t?void 0:t.suggestedLevel)?this.datasetMeta.suggestedLevel:this.level;const l="auto"===(null==r?void 0:r.trim().toLowerCase());return S(r)||l?(null===(e=this.datasetMeta)||void 0===e?void 0:e.suggestedLevel)&&(l?this.errors.remove("AUTO_order"):this.errors.addOrReplace({id:"AUTO_order",type:"warning",message:"order: not set, auto-detected: "+o})):(this.errors.remove("AUTO_order"),"levelindex"===(null==r?void 0:r.toLocaleLowerCase())&&(o+="Index")),{hierarchy:[I[null==o?void 0:o.toUpperCase()]],direction:C[null==n?void 0:n.toUpperCase()]}}prepareStyle(){const i=this.getEffectiveScaleFactor();return this.componentStyle((t=>{const e=t.global.fontSizePx*i;return{scaleFactors:{scenarioOffset:t["bn-chart-time"].scaleFactors.scenarioOffset,scenarioLabelToColumn:t["bn-chart-time"].scaleFactors.scenarioLabelToColumn,labelToColumn:.3,labelToColum:t["bn-chart-time"].scaleFactors.labelToColum,labelToAxis:t["bn-chart-time"].scaleFactors.labelToAxis,needleWidth:t["bn-chart-time"].scaleFactors.needleWidth,needleHeadWidth:t["bn-chart-time"].scaleFactors.needleHeadWidth,columnWidth:t["bn-chart-time"].scaleFactors.columnWidth,varianceAxisLineWidth:t["bn-chart-time"].scaleFactors.varianceAxisLineWidth,axisLineWidth:t["bn-chart-time"].scaleFactors.axisLineWidth,auxiliaryLineWidth:t["bn-chart-time"].scaleFactors.auxiliaryLineWidth,scenarioLineWidth:t["bn-chart-time"].scaleFactors.scenarioLineWidth,markerWidth:t["bn-chart-time"].scaleFactors.markerWidth,markerOffset:t["bn-chart-time"].scaleFactors.markerOffset,categoryWidth:t["bn-chart-time"].scaleFactors.categoryWidth,axisTickLength:t["bn-chart-time"].scaleFactors.axisTickLength},fontStyles:{font:`${e}px ${t.global.fontFamily}`,size:e,color:t.global.fontColor,background:t.global.fontBackgroundColor,leading:1.8},axisStyles:t["bn-chart-time"].axisStyles,barStyles:t["bn-chart-time"].barStyles,varianceStyles:t["bn-chart-time"].varianceStyles,stackColors:t["bn-chart-time"].stackColors,padding:t["bn-chart-time"].padding,pattern:null}}))}prepareLeftSideOffset(i,t){return this.syncSpaceLeft>-1?this.syncSpaceLeft:F.getMaxWidthOfArrayItems([...this.prepareVariances(),...this.prepareScenarios(),this.chartTitle],i,t)}prepareChartTitle(i){return i>=1?"":this.chartTitle}prepareLimit(){return Math.floor(Number(this.limit)||0)}prepareDateInterval(){var i,t,e;const s="auto"===(null===(i=this.dateInterval)||void 0===i?void 0:i.trim().toLowerCase());return S(this.dateInterval)||s?(null===(t=this.datasetMeta)||void 0===t?void 0:t.suggestedDateInterval)?(s?this.errors.remove("AUTO_dateInterval"):this.errors.addOrReplace({id:"AUTO_dateInterval",type:"warning",message:"dateInterval: not set, auto-detected: "+this.datasetMeta.suggestedDateInterval}),j[this.datasetMeta.suggestedDateInterval.toUpperCase()]):s?j.AUTO:void 0:(this.errors.remove("AUTO_dateInterval"),j[null===(e=this.dateInterval)||void 0===e?void 0:e.toUpperCase()])}prepareIntervalSpanLimit(){return this.intervalSpanLimit}prepareAxisLabelsMode(){var i;return U[null===(i=this.axisLabelsMode)||void 0===i?void 0:i.toUpperCase()]}prepareFilter(){return 0===this.filter.length?"":this.filter}getDataStructure(){return{ITimeChartDataRow:{setName:{type:"string",isOptional:!1,description:""},date:{type:"string",isOptional:!1,description:""},operation:{type:"string",isOptional:!1,description:""},rowGroup:{type:"string",isOptional:!1,description:""},rowGroupIndex:{type:"number",isOptional:!1,description:""},category:{type:"string",isOptional:!1,description:""},categoryIndex:{type:"number",isOptional:!1,description:""},subCategory:{type:"string",isOptional:!1,description:""},subCategoryIndex:{type:"number",isOptional:!1,description:""},columnGroup:{type:"string",isOptional:!1,description:""},columnGroupIndex:{type:"number",isOptional:!1,description:""},columnSubGroup:{type:"string",isOptional:!1,description:""},columnSubGroupIndex:{type:"number",isOptional:!1,description:""},ac1:{type:"number",isOptional:!1,description:""},ac2:{type:"number",isOptional:!1,description:""},ac3:{type:"number",isOptional:!1,description:""},ac4:{type:"number",isOptional:!1,description:""},pp1:{type:"number",isOptional:!1,description:""},pp2:{type:"number",isOptional:!1,description:""},pp3:{type:"number",isOptional:!1,description:""},pp4:{type:"number",isOptional:!1,description:""},fc1:{type:"number",isOptional:!1,description:""},fc2:{type:"number",isOptional:!1,description:""},fc3:{type:"number",isOptional:!1,description:""},fc4:{type:"number",isOptional:!1,description:""},pl1:{type:"number",isOptional:!1,description:""},pl2:{type:"number",isOptional:!1,description:""},pl3:{type:"number",isOptional:!1,description:""},pl4:{type:"number",isOptional:!1,description:""}}}}prepareMeasureScale(){return S(this.measureScale)?"GREATEST":["_","k","M","G","T","P","E","Z","Y","m","μ","n","p","P","f","a","z","y"].includes(this.measureScale.trim())||"LEAST"===this.measureScale.trim().toUpperCase()?this.measureScale.trim():"GREATEST"}prepareShowMeasureScale(i){return 0===i&&"true"===this.showMeasureScale}prepareMeasureUnit(){return""===this.measureUnit||null==this.measureUnit?"":this.measureUnit}prepareStackConfig(){if(S(this.stack))return this.errors.remove("WARN_stack_dimensions_scenarios"),null;try{const i=JSON.parse(this.stack),t=i.by,e="WARN_stack_dimensions_scenarios";if(t===k.DIMENSIONS){const i=this.prepareScenarios();i.length>1?this.errors.addOrReplace({id:e,type:"warning",message:`stack by dimensions: only the first scenario "${i[0]}" is used, the rest (${i.slice(1).join(", ")}) are discarded.`}):this.errors.remove(e)}else this.errors.remove(e);return{by:t,mode:i.mode||N.ABSOLUTE,order:i.order||W.DATASET}}catch(i){return this.errors.remove("WARN_stack_dimensions_scenarios"),null}}prepareLineFullWidth(){return"true"===this.lineFullWidth}prepareChartMode(){var i;const t=null===(i=this.chartMode)||void 0===i?void 0:i.toLowerCase();return"line"===t?D.LINE:"auto"===t?D.AUTO:D.BAR}prepareMaxBars(){return Math.floor(Number(this.maxBars)||28)}chartTemplate(i,t){const e=this.prepareI18n(),s=this.prepareStyle(),r=b(this.element).width,n=this.getEffectiveScaleFactor(),o=this.preparePixelPerUnit(),l=this.preparePixelPerPercentage(),d=this.prepareStackConfig(),h=this.prepareScenarios(),c=(null==d?void 0:d.by)===k.DIMENSIONS?h.slice(0,1):h;return a("ibcs-chart-time",{data:this.data,chartTitle:this.prepareChartTitle(t),scenarios:c,variances:[i],hideAxisLabels:this.prepareHideAxisLabels(t),pixelPerUnit:o>0?o*n:0,pixelPerPercentage:l>0?l*n:0,limit:this.prepareLimit(),leftSideOffsetForHorizontalSync:this.prepareLeftSideOffset(e,s),styles:s,i18n:e,order:this.prepareOrder(),level:this.prepareLevel(),dateInterval:this.prepareDateInterval(),intervalSpanLimit:this.prepareIntervalSpanLimit(),axisLabelsMode:this.prepareAxisLabelsMode(),filter:this.prepareFilter(),"measure-scale":this.prepareMeasureScale(),"measure-unit":this.prepareMeasureUnit(),showOverlayAvg:this.prepareAvg(),showOverlayMedian:this.prepareMedian(),showMeasureScale:this.prepareShowMeasureScale(t),chartMode:this.prepareChartMode(),maxBars:this.prepareMaxBars(),stackConfig:d,lineFullWidth:this.prepareLineFullWidth(),containerWidth:r,parentDimensions:this.prepareDimension()})}getEffectiveScaleFactor(){const{mode:i,factor:t}=O(this.scale);return"factor"===i?t:"auto"===i||"empty"===i?this.appliedScaleFactor:1}getFontStyles(){const i=this.getEffectiveScaleFactor();return this.componentStyle((t=>{var e,s,a,r;const n=(null===(e=t.global)||void 0===e?void 0:e.fontSizePx)||13.3333;return{"--bn-font-family":(null===(s=t.global)||void 0===s?void 0:s.fontFamily)||"'Noto Sans', sans-serif","--bn-font-size":n*i+"px","--bn-font-color":(null===(a=t.global)||void 0===a?void 0:a.fontColor)||"#000000","--bn-font-background":(null===(r=t.global)||void 0===r?void 0:r.fontBackgroundColor)||"#ffffff"}}))}render(){let i=[""];const t=this.prepareVariances();t.length>0&&(i=[...i,...t]);const e=this.getFontStyles();return a(r,{key:"317b1048224d8b5ede5dc4868d2d927c9c7cfee9",style:e},a("div",{key:"3168861fc4440ea67103140c33c4aa84ac0bf245",class:"container"},i.map(this.chartTemplate)))}get element(){return this}static get watchers(){return{scenarios:[{validateScenario:0}],variances:[{validateVariances:0}],syncSpaceLeft:[{validateLeftSync:0}],limit:[{validateLimit:0}],unitScaling:[{validateUnitScaling:0}],percentageScaling:[{validatePercentageScaling:0}],level:[{validateLevel:0}],order:[{validateOrderList:0}],orderDirection:[{validateOrderDirection:0}],dateInterval:[{validateDateInterval:0}],chartMode:[{validateChartMode:0}],maxBars:[{validateMaxBars:0}],stack:[{validateStack:0}],scale:[{validateScaling:0}],axisLabelsMode:[{validateAxisLabelsMode:0}],lineFullWidth:[{validateLineFullWidth:0}],showCategories:[{validateShowCategories:0}],measureScale:[{validateMeasureScale:0}],showMeasureScale:[{validateShowMeasureScale:0}],showOverlayAvg:[{validateShowOverlayAvg:0}],showOverlayMedian:[{validateShowOverlayMedian:0}]}}static get style(){return":host{display:inline-block;position:relative;overflow:visible;}.container{display:flex;flex-direction:column-reverse}.background-image{display:flex;flex-wrap:wrap;justify-content:flex-end}"}},[1,"bn-chart-time",{chartTitle:[1,"chart-title"],filter:[1],scenarios:[1],variances:[1],syncSpaceLeft:[2,"sync-space-left"],limit:[2],unitScaling:[8,"unit-scaling"],percentageScaling:[8,"percentage-scaling"],level:[1],order:[1],orderDirection:[1,"order-direction"],dateInterval:[1,"date-interval"],chartMode:[1,"chart-mode"],maxBars:[2,"max-bars"],stack:[1],scale:[1],intervalSpanLimit:[2,"interval-span-limit"],axisLabelsMode:[1,"axis-labels-mode"],lineFullWidth:[1,"line-full-width"],showCategories:[1,"show-categories"],measureScale:[1,"measure-scale"],showMeasureScale:[1,"show-measure-scale"],showOverlayAvg:[1,"show-overlay-avg"],showOverlayMedian:[1,"show-overlay-median"],measureUnit:[1,"measure-unit"],data:[32],datasetMeta:[32],appliedScaleFactor:[32]},void 0,{scenarios:[{validateScenario:0}],variances:[{validateVariances:0}],syncSpaceLeft:[{validateLeftSync:0}],limit:[{validateLimit:0}],unitScaling:[{validateUnitScaling:0}],percentageScaling:[{validatePercentageScaling:0}],level:[{validateLevel:0}],order:[{validateOrderList:0}],orderDirection:[{validateOrderDirection:0}],dateInterval:[{validateDateInterval:0}],chartMode:[{validateChartMode:0}],maxBars:[{validateMaxBars:0}],stack:[{validateStack:0}],scale:[{validateScaling:0}],axisLabelsMode:[{validateAxisLabelsMode:0}],lineFullWidth:[{validateLineFullWidth:0}],showCategories:[{validateShowCategories:0}],measureScale:[{validateMeasureScale:0}],showMeasureScale:[{validateShowMeasureScale:0}],showOverlayAvg:[{validateShowOverlayAvg:0}],showOverlayMedian:[{validateShowOverlayMedian:0}]}]),z=B,V=function(){"undefined"!=typeof customElements&&["bn-chart-time","ibcs-chart-time"].forEach((i=>{switch(i){case"bn-chart-time":customElements.get(n(i))||customElements.define(n(i),B);break;case"ibcs-chart-time":customElements.get(n(i))||P()}}))};export{z as BnChartTime,V as defineCustomElement}
|
|
1
|
+
import{proxyCustomElement as i,HTMLElement as t,writeTask as e,forceUpdate as s,h as a,Host as r,transformTag as n}from"@stencil/core/internal/client";import{v as o,a as l,h as d,k as h,j as c,b as p,c as u,f as v,n as m,o as g,l as y,m as f,i as S}from"./validate.js";import{w,g as b,p as O}from"./scaling.js";import{w as x,a as M}from"./withHasError.js";import{w as R}from"./withTranslation.js";import{a as _}from"./context-protocol.js";import{w as A}from"./withStyled.js";import{w as L}from"./withComponentStyle.js";import{i as T,w as E}from"./withInheritedProps.js";import{b as C,O as I,c as U,g as k,h as W,i as N,C as D}from"./Order.js";import{F}from"./ibcsRuleSet.js";import{D as j}from"./DateStringFactory.js";import{d as P}from"./ibcs-chart-time2.js";var G;!function(i){i.ROWGROUP="rowGroup",i.ROWGROUPINDEX="rowGroupIndex",i.CATEGORY="category",i.CATEGORYINDEX="categoryIndex",i.SUBCATEGORY="subCategory",i.SUBCATEGORYINDEX="subCategoryIndex"}(G||(G={}));const B=i(class extends t{validateScenario(i){const t="ERR_scenarios";if(T(i))return void this.errors.remove(t);const e=o(i);e.length>0?this.errors.addOrReplace({id:t,type:"warning",message:"scenarios: invalid value(s) '"+JSON.stringify(e)+"' are not supported."}):this.errors.remove(t)}validateVariances(i){const t="ERR_variances";if(T(i))return void this.errors.remove(t);const e=l(i);e.length>0?this.errors.addOrReplace({id:t,type:"warning",message:"variances: invalid value(s) '"+JSON.stringify(e)+"' are not supported."}):this.errors.remove(t)}validateLeftSync(i){const t="ERR_syncSpaceLeft";d(i)?this.errors.remove(t):this.errors.addOrReplace({id:t,type:"warning",message:"syncSpaceLeft: invalid value(s) '"+i+"' are not supported."})}validateLimit(i){const t="ERR_limit";h(i)?this.errors.remove(t):this.errors.addOrReplace({id:t,type:"warning",message:"limit: invalid value '"+(null==i?void 0:""+i)+"' is not supported."})}validateUnitScaling(i){const t="ERR_unitScaling";"auto"===(null==i?void 0:(""+i).trim().toLowerCase())||d(i)||this.pixelPerUnitGroupMap.has(i)?this.errors.remove(t):this.errors.addOrReplace({id:t,type:"warning",message:"unitScaling: invalid value(s) '"+i+"' are not supported."})}validatePercentageScaling(i){const t="ERR_percentageScaling";d(i)||this.pixelPerUnitGroupMap.has(i)?this.errors.remove(t):this.errors.addOrReplace({id:t,type:"warning",message:"percentageScaling: invalid value(s) '"+i+"' are not supported."})}validateLevel(i){const t="ERR_level";c(i)?this.errors.remove(t):this.errors.addOrReplace({id:t,type:"warning",message:"level: invalid value(s) '"+i+"' are not supported."})}validateOrderList(i){const t="ERR_order";if(T(i))return void this.errors.remove(t);const e=p(i);e.length>0?this.errors.addOrReplace({id:t,type:"warning",message:"order: invalid value(s) '"+JSON.stringify(e)+"' are not supported."}):this.errors.remove(t)}validateOrderDirection(i){const t="ERR_orderDirection";T(i)||u(i)?this.errors.remove(t):this.errors.addOrReplace({id:t,type:"warning",message:"orderDirection: invalid value '"+(null==i?void 0:""+i)+"' is not supported."})}validateDateInterval(i){const t="ERR_dateInterval";v(i)?this.errors.remove(t):this.errors.addOrReplace({id:t,type:"warning",message:"dateInterval: invalid value '"+(null==i?void 0:""+i)+"' is not supported."})}validateChartMode(i){const t="ERR_chartMode";["bar","line","auto"].includes(null==i?void 0:i.toLowerCase())?this.errors.remove(t):this.errors.addOrReplace({id:t,type:"warning",message:"chartMode: invalid value '"+(null==i?void 0:""+i)+"' is not supported. Valid values are: bar, line, auto."})}validateMaxBars(i){const t="ERR_maxBars";!h(i)||i<1?this.errors.addOrReplace({id:t,type:"warning",message:"maxBars: invalid value '"+(null==i?void 0:""+i)+"' is not supported. Must be a positive integer."}):this.errors.remove(t)}validateStack(i){const t="ERR_stack",e=m(i);e.length>0?this.errors.addOrReplace({id:t,type:"warning",message:e.join("; ")}):this.errors.remove(t)}validateScaling(i){if(null==i||""===i||"none"===i||"auto"===i)return void this.errors.remove("ERR_scale");const t=Number(i);isNaN(t)||t<=0?this.errors.addOrReplace({id:"ERR_scale",type:"warning",message:`Invalid scale value: "${i}". Use "none", "auto", or a positive number.`}):this.errors.remove("ERR_scale")}validateAxisLabelsMode(i){const t="ERR_axisLabelsMode";g(i)?this.errors.remove(t):this.errors.addOrReplace({id:t,type:"warning",message:"axisLabelsMode: invalid value '"+(null==i?void 0:""+i)+"' is not supported."})}validateLineFullWidth(i){const t="ERR_lineFullWidth";y(i)?this.errors.remove(t):this.errors.addOrReplace({id:t,type:"warning",message:"lineFullWidth: invalid value(s) '"+(null==i?void 0:""+i)+"' are not supported."})}validateShowCategories(i){const t="ERR_showCategories";y(i)?this.errors.remove(t):this.errors.addOrReplace({id:t,type:"warning",message:"showCategories: invalid value(s) '"+(null==i?void 0:""+i)+"' are not supported."})}validateMeasureScale(i){const t="ERR_measureScale";f(i)?this.errors.remove(t):this.errors.addOrReplace({id:t,type:"warning",message:"measureScale: invalid value '"+(null==i?void 0:""+i)+"' is not supported."})}validateShowMeasureScale(i){const t="ERR_grouped";y(i)?this.errors.remove(t):this.errors.addOrReplace({id:t,type:"warning",message:"showMeasureScale: invalid value(s) '"+(null==i?void 0:""+i)+"' are not supported."})}validateShowOverlayAvg(i){const t="ERR_grouped";y(i)?this.errors.remove(t):this.errors.addOrReplace({id:t,type:"warning",message:"showOverlayAvg: invalid value(s) '"+(null==i?void 0:""+i)+"' are not supported."})}validateShowOverlayMedian(i){const t="ERR_grouped";y(i)?this.errors.remove(t):this.errors.addOrReplace({id:t,type:"warning",message:"showOverlayMedian: invalid value(s) '"+(null==i?void 0:""+i)+"' are not supported."})}constructor(i){super(),!1!==i&&this.__registerHost(),this.__attachShadow(),this.data=[],this.datasetMeta=null,this.appliedScaleFactor=1,this.chartTitle="",this.filter="",this.syncSpaceLeft=-1,this.limit=0,this.chartMode="bar",this.maxBars=28,this.stack="",this.intervalSpanLimit=28,this.lineFullWidth="true",this.showCategories="true",this.measureScale="greatest",this.showMeasureScale="false",this.showOverlayAvg="true",this.showOverlayMedian="false",this.measureUnit="",this.pixelPerUnitGroupMap=new Map,this._autoScaleGuard=!1,A(this),x(this),w(this,((i,t)=>{this.data=t||[]}),((i,t)=>{this.datasetMeta=t})),this.chartTemplate=this.chartTemplate.bind(this),this.errors=M(this),this.componentStyle=L(this),this.t=R(this).t,this.resolveInherited=E(this,[{propName:"scenarios",ancestorAttr:"title-scenarios"},{propName:"variances",ancestorAttr:"title-variances"},{propName:"order",ancestorAttr:"title-order"},{propName:"orderDirection",ancestorAttr:"title-order-direction"}])}componentWillLoad(){this.validateScenario(this.scenarios),this.validateVariances(this.variances),this.validateUnitScaling(this.unitScaling),this.validateLimit(this.limit),this.validateLevel(this.level),this.validateOrderDirection(this.orderDirection),this.validateOrderList(this.order),this.validateLeftSync(this.syncSpaceLeft),this.validateDateInterval(this.dateInterval),this.validateAxisLabelsMode(this.axisLabelsMode),this.validateLineFullWidth(this.lineFullWidth),this.validateShowCategories(this.showCategories),this.validateMeasureScale(this.measureScale),this.validateShowMeasureScale(this.showMeasureScale),this.validateShowOverlayAvg(this.showOverlayAvg),this.validateShowOverlayMedian(this.showOverlayMedian),this.validateChartMode(this.chartMode),this.validateMaxBars(this.maxBars),this.validateStack(this.stack),this.validateScaling(this.scale)}componentDidRender(){var i,t;const{mode:s}=O(this.scale);if("auto"!==s&&"empty"!==s){this._autoScaleGuard=!1;const i=b(this.element),t="WARN_overflow";return void(i.width>0&&this.element.scrollWidth>i.width+1?this.errors.addOrReplace({id:t,type:"warning",message:"Chart exceeds available space and will be cut off. Check unit-scaling value."}):this.errors.remove(t))}if(this._autoScaleGuard)return void(this._autoScaleGuard=!1);const a=this.element,{width:r}=b(a);if(r<=0)return;const n=this.componentStyle((i=>{var t;return(null===(t=i.global)||void 0===t?void 0:t.fontSizePx)||13.3333}));a.style.setProperty("--bn-font-size",n+"px");const o=null===(i=a.shadowRoot)||void 0===i?void 0:i.querySelector(".container"),l=null!==(t=null==o?void 0:o.scrollWidth)&&void 0!==t?t:a.scrollWidth;if(l<=r+1)return this.errors.remove("AUTO_scale"),void(1!==this.appliedScaleFactor&&(this._autoScaleGuard=!0,e((()=>{this.appliedScaleFactor=1}))));const d=(r-1)/l;a.style.setProperty("--bn-font-size",n*d+"px"),"empty"===s?this.errors.addOrReplace({id:"AUTO_scale",type:"warning",message:"Auto-scaled chart by factor "+d.toFixed(3)}):this.errors.remove("AUTO_scale"),Math.abs(d-this.appliedScaleFactor)>.001&&(this._autoScaleGuard=!0,e((()=>{this.appliedScaleFactor=d})))}componentDidLoad(){this.canvasWidthSegmented<=0&&requestAnimationFrame((()=>{const{width:i}=b(this.element);i>0&&s(this)}))}prepareDimension(){const i=b(this.element),t=this.prepareScenarios(),e=this.prepareVariances();return this.canvasWidthSegmented=i.width/(t.length+e.length||1),{width:this.canvasWidthSegmented,height:i.height}}prepareScenarios(){var i,t,e,s;const a=this.resolveInherited("scenarios",this.scenarios);if(void 0!==a)return this.errors.remove("AUTO_scenarios"),a.split(",").map((i=>i.trim()));const r="auto"===(null===(i=this.scenarios)||void 0===i?void 0:i.trim().toLowerCase());return S(this.scenarios)||r?(null===(e=null===(t=this.datasetMeta)||void 0===t?void 0:t.availableScenarios)||void 0===e?void 0:e.length)>0?(r?this.errors.remove("AUTO_scenarios"):this.errors.addOrReplace({id:"AUTO_scenarios",type:"warning",message:"scenarios: not set, auto-detected: "+this.datasetMeta.availableScenarios.join(",")}),this.datasetMeta.availableScenarios):[]:(this.errors.remove("AUTO_scenarios"),null===(s=this.scenarios)||void 0===s?void 0:s.split(",").map((i=>i.trim())))}prepareAvg(){return"true"===this.showOverlayAvg}prepareMedian(){return"true"===this.showOverlayMedian}prepareVariances(){var i;const t=this.resolveInherited("variances",this.variances);return void 0!==t?t.split(",").map((i=>i.trim())):S(this.variances)?[]:null===(i=this.variances)||void 0===i?void 0:i.split(",").map((i=>i.trim()))}prepareHideAxisLabels(i){return i>=1||"true"!==this.showCategories}prepareI18n(){const i=_,t=new Map([].map((i=>[i,this.t(".".concat(i))]))),e=new Map(i.map((i=>[i,this.t("global.".concat(i))])));return new Map([...e.entries(),...t.entries()])}preparePixelPerUnit(){var i;if(this.pixelPerUnitGroupMap.has(this.unitScaling))return this.errors.remove("AUTO_unitScaling"),this.pixelPerUnitGroupMap.get(this.unitScaling);if("auto"===(null===(i=this.unitScaling)||void 0===i?void 0:(""+i).trim().toLowerCase()))return this.errors.remove("AUTO_unitScaling"),0;const t=Number(this.unitScaling);return!isNaN(t)&&t>0?(this.errors.remove("AUTO_unitScaling"),t):(this.errors.addOrReplace({id:"AUTO_unitScaling",type:"warning",message:"unit-scaling: not set, auto-calculated to fit available space."}),0)}preparePixelPerPercentage(){return this.pixelPerUnitGroupMap.has(this.percentageScaling)?this.pixelPerUnitGroupMap.get(this.percentageScaling):100*Number(this.percentageScaling)}prepareLevel(){var i,t,e;const s="auto"===(null===(i=this.level)||void 0===i?void 0:i.trim().toLowerCase());return S(this.level)||s?(null===(t=this.datasetMeta)||void 0===t?void 0:t.suggestedLevel)?(s?this.errors.remove("AUTO_level"):this.errors.addOrReplace({id:"AUTO_level",type:"warning",message:"level: not set, auto-detected: "+this.datasetMeta.suggestedLevel}),G[this.datasetMeta.suggestedLevel.toUpperCase()]):void 0:(this.errors.remove("AUTO_level"),G[null===(e=this.level)||void 0===e?void 0:e.toUpperCase()])}prepareOrder(){var i,t,e;const s=this.resolveInherited("order",this.order),a=this.resolveInherited("orderDirection",this.orderDirection),r=null!=s?s:this.order,n=null!=a?a:this.orderDirection;let o=(S(this.level)||"auto"===(null===(i=this.level)||void 0===i?void 0:i.trim().toLowerCase()))&&(null===(t=this.datasetMeta)||void 0===t?void 0:t.suggestedLevel)?this.datasetMeta.suggestedLevel:this.level;const l="auto"===(null==r?void 0:r.trim().toLowerCase());return S(r)||l?(null===(e=this.datasetMeta)||void 0===e?void 0:e.suggestedLevel)&&(l?this.errors.remove("AUTO_order"):this.errors.addOrReplace({id:"AUTO_order",type:"warning",message:"order: not set, auto-detected: "+o})):(this.errors.remove("AUTO_order"),"levelindex"===(null==r?void 0:r.toLocaleLowerCase())&&(o+="Index")),{hierarchy:[I[null==o?void 0:o.toUpperCase()]],direction:C[null==n?void 0:n.toUpperCase()]}}prepareStyle(){const i=this.getEffectiveScaleFactor();return this.componentStyle((t=>{const e=t.global.fontSizePx*i;return{scaleFactors:{scenarioOffset:t["bn-chart-time"].scaleFactors.scenarioOffset,scenarioLabelToColumn:t["bn-chart-time"].scaleFactors.scenarioLabelToColumn,labelToColumn:.3,labelToColum:t["bn-chart-time"].scaleFactors.labelToColum,labelToAxis:t["bn-chart-time"].scaleFactors.labelToAxis,needleWidth:t["bn-chart-time"].scaleFactors.needleWidth,needleHeadWidth:t["bn-chart-time"].scaleFactors.needleHeadWidth,columnWidth:t["bn-chart-time"].scaleFactors.columnWidth,varianceAxisLineWidth:t["bn-chart-time"].scaleFactors.varianceAxisLineWidth,axisLineWidth:t["bn-chart-time"].scaleFactors.axisLineWidth,auxiliaryLineWidth:t["bn-chart-time"].scaleFactors.auxiliaryLineWidth,scenarioLineWidth:t["bn-chart-time"].scaleFactors.scenarioLineWidth,markerWidth:t["bn-chart-time"].scaleFactors.markerWidth,markerOffset:t["bn-chart-time"].scaleFactors.markerOffset,categoryWidth:t["bn-chart-time"].scaleFactors.categoryWidth,axisTickLength:t["bn-chart-time"].scaleFactors.axisTickLength},fontStyles:{font:`${e}px ${t.global.fontFamily}`,size:e,color:t.global.fontColor,background:t.global.fontBackgroundColor,leading:1.8},axisStyles:t["bn-chart-time"].axisStyles,barStyles:t["bn-chart-time"].barStyles,varianceStyles:t["bn-chart-time"].varianceStyles,stackColors:t["bn-chart-time"].stackColors,padding:t["bn-chart-time"].padding,pattern:null}}))}prepareLeftSideOffset(i,t){return this.syncSpaceLeft>-1?this.syncSpaceLeft:F.getMaxWidthOfArrayItems([...this.prepareVariances(),...this.prepareScenarios(),this.chartTitle],i,t)}prepareChartTitle(i){return i>=1?"":this.chartTitle}prepareLimit(){return Math.floor(Number(this.limit)||0)}prepareDateInterval(){var i,t,e;const s="auto"===(null===(i=this.dateInterval)||void 0===i?void 0:i.trim().toLowerCase());return S(this.dateInterval)||s?(null===(t=this.datasetMeta)||void 0===t?void 0:t.suggestedDateInterval)?(s?this.errors.remove("AUTO_dateInterval"):this.errors.addOrReplace({id:"AUTO_dateInterval",type:"warning",message:"dateInterval: not set, auto-detected: "+this.datasetMeta.suggestedDateInterval}),j[this.datasetMeta.suggestedDateInterval.toUpperCase()]):s?j.AUTO:void 0:(this.errors.remove("AUTO_dateInterval"),j[null===(e=this.dateInterval)||void 0===e?void 0:e.toUpperCase()])}prepareIntervalSpanLimit(){return this.intervalSpanLimit}prepareAxisLabelsMode(){var i;return U[null===(i=this.axisLabelsMode)||void 0===i?void 0:i.toUpperCase()]}prepareFilter(){return 0===this.filter.length?"":this.filter}getDataStructure(){return{ITimeChartDataRow:{setName:{type:"string",isOptional:!1,description:""},date:{type:"string",isOptional:!1,description:""},operation:{type:"string",isOptional:!1,description:""},rowGroup:{type:"string",isOptional:!1,description:""},rowGroupIndex:{type:"number",isOptional:!1,description:""},category:{type:"string",isOptional:!1,description:""},categoryIndex:{type:"number",isOptional:!1,description:""},subCategory:{type:"string",isOptional:!1,description:""},subCategoryIndex:{type:"number",isOptional:!1,description:""},columnGroup:{type:"string",isOptional:!1,description:""},columnGroupIndex:{type:"number",isOptional:!1,description:""},columnSubGroup:{type:"string",isOptional:!1,description:""},columnSubGroupIndex:{type:"number",isOptional:!1,description:""},ac1:{type:"number",isOptional:!1,description:""},ac2:{type:"number",isOptional:!1,description:""},ac3:{type:"number",isOptional:!1,description:""},ac4:{type:"number",isOptional:!1,description:""},pp1:{type:"number",isOptional:!1,description:""},pp2:{type:"number",isOptional:!1,description:""},pp3:{type:"number",isOptional:!1,description:""},pp4:{type:"number",isOptional:!1,description:""},fc1:{type:"number",isOptional:!1,description:""},fc2:{type:"number",isOptional:!1,description:""},fc3:{type:"number",isOptional:!1,description:""},fc4:{type:"number",isOptional:!1,description:""},pl1:{type:"number",isOptional:!1,description:""},pl2:{type:"number",isOptional:!1,description:""},pl3:{type:"number",isOptional:!1,description:""},pl4:{type:"number",isOptional:!1,description:""}}}}prepareMeasureScale(){return S(this.measureScale)?"GREATEST":["_","k","M","G","T","P","E","Z","Y","m","μ","n","p","P","f","a","z","y"].includes(this.measureScale.trim())||"LEAST"===this.measureScale.trim().toUpperCase()?this.measureScale.trim():"GREATEST"}prepareShowMeasureScale(i){return 0===i&&"true"===this.showMeasureScale}prepareMeasureUnit(){return""===this.measureUnit||null==this.measureUnit?"":this.measureUnit}prepareStackConfig(){if(S(this.stack))return this.errors.remove("WARN_stack_dimensions_scenarios"),null;try{const i=JSON.parse(this.stack),t=i.by,e="WARN_stack_dimensions_scenarios";if(t===k.DIMENSIONS){const i=this.prepareScenarios();i.length>1?this.errors.addOrReplace({id:e,type:"warning",message:`stack by dimensions: only the first scenario "${i[0]}" is used, the rest (${i.slice(1).join(", ")}) are discarded.`}):this.errors.remove(e)}else this.errors.remove(e);return{by:t,mode:i.mode||N.ABSOLUTE,order:i.order||W.DATASET}}catch(i){return this.errors.remove("WARN_stack_dimensions_scenarios"),null}}prepareLineFullWidth(){return"true"===this.lineFullWidth}prepareChartMode(){var i;const t=null===(i=this.chartMode)||void 0===i?void 0:i.toLowerCase();return"line"===t?D.LINE:"auto"===t?D.AUTO:D.BAR}prepareMaxBars(){return Math.floor(Number(this.maxBars)||28)}chartTemplate(i,t){const e=this.prepareI18n(),s=this.prepareStyle(),r=b(this.element).width,n=this.getEffectiveScaleFactor(),o=this.preparePixelPerUnit(),l=this.preparePixelPerPercentage(),d=this.prepareStackConfig(),h=this.prepareScenarios(),c=(null==d?void 0:d.by)===k.DIMENSIONS?h.slice(0,1):h;return a("ibcs-chart-time",{data:this.data,chartTitle:this.prepareChartTitle(t),scenarios:c,variances:[i],hideAxisLabels:this.prepareHideAxisLabels(t),pixelPerUnit:o>0?o*n:0,pixelPerPercentage:l>0?l*n:0,limit:this.prepareLimit(),leftSideOffsetForHorizontalSync:this.prepareLeftSideOffset(e,s),styles:s,i18n:e,order:this.prepareOrder(),level:this.prepareLevel(),dateInterval:this.prepareDateInterval(),intervalSpanLimit:this.prepareIntervalSpanLimit(),axisLabelsMode:this.prepareAxisLabelsMode(),filter:this.prepareFilter(),"measure-scale":this.prepareMeasureScale(),"measure-unit":this.prepareMeasureUnit(),showOverlayAvg:this.prepareAvg(),showOverlayMedian:this.prepareMedian(),showMeasureScale:this.prepareShowMeasureScale(t),chartMode:this.prepareChartMode(),maxBars:this.prepareMaxBars(),stackConfig:d,lineFullWidth:this.prepareLineFullWidth(),containerWidth:r,parentDimensions:this.prepareDimension()})}getEffectiveScaleFactor(){const{mode:i,factor:t}=O(this.scale);return"factor"===i?t:"auto"===i||"empty"===i?this.appliedScaleFactor:1}getFontStyles(){const i=this.getEffectiveScaleFactor();return this.componentStyle((t=>{var e,s,a,r;const n=(null===(e=t.global)||void 0===e?void 0:e.fontSizePx)||13.3333;return{"--bn-font-family":(null===(s=t.global)||void 0===s?void 0:s.fontFamily)||"'Noto Sans', sans-serif","--bn-font-size":n*i+"px","--bn-font-color":(null===(a=t.global)||void 0===a?void 0:a.fontColor)||"#000000","--bn-font-background":(null===(r=t.global)||void 0===r?void 0:r.fontBackgroundColor)||"#ffffff"}}))}render(){let i=[""];const t=this.prepareVariances();t.length>0&&(i=[...i,...t]);const e=this.getFontStyles();return a(r,{key:"7844e63a4b52baffd9d82cc5063df5623c7fd2ae",style:e},a("div",{key:"5e1ac0a43a1e2176a122f1ac1211963a92b6e782",class:"container"},i.map(this.chartTemplate)))}get element(){return this}static get watchers(){return{scenarios:[{validateScenario:0}],variances:[{validateVariances:0}],syncSpaceLeft:[{validateLeftSync:0}],limit:[{validateLimit:0}],unitScaling:[{validateUnitScaling:0}],percentageScaling:[{validatePercentageScaling:0}],level:[{validateLevel:0}],order:[{validateOrderList:0}],orderDirection:[{validateOrderDirection:0}],dateInterval:[{validateDateInterval:0}],chartMode:[{validateChartMode:0}],maxBars:[{validateMaxBars:0}],stack:[{validateStack:0}],scale:[{validateScaling:0}],axisLabelsMode:[{validateAxisLabelsMode:0}],lineFullWidth:[{validateLineFullWidth:0}],showCategories:[{validateShowCategories:0}],measureScale:[{validateMeasureScale:0}],showMeasureScale:[{validateShowMeasureScale:0}],showOverlayAvg:[{validateShowOverlayAvg:0}],showOverlayMedian:[{validateShowOverlayMedian:0}]}}static get style(){return":host{display:inline-block;position:relative;overflow:visible;}.container{display:flex;flex-direction:column-reverse}.background-image{display:flex;flex-wrap:wrap;justify-content:flex-end}"}},[1,"bn-chart-time",{chartTitle:[1,"chart-title"],filter:[1],scenarios:[1],variances:[1],syncSpaceLeft:[2,"sync-space-left"],limit:[2],unitScaling:[8,"unit-scaling"],percentageScaling:[8,"percentage-scaling"],level:[1],order:[1],orderDirection:[1,"order-direction"],dateInterval:[1,"date-interval"],chartMode:[1,"chart-mode"],maxBars:[2,"max-bars"],stack:[1],scale:[1],intervalSpanLimit:[2,"interval-span-limit"],axisLabelsMode:[1,"axis-labels-mode"],lineFullWidth:[1,"line-full-width"],showCategories:[1,"show-categories"],measureScale:[1,"measure-scale"],showMeasureScale:[1,"show-measure-scale"],showOverlayAvg:[1,"show-overlay-avg"],showOverlayMedian:[1,"show-overlay-median"],measureUnit:[1,"measure-unit"],data:[32],datasetMeta:[32],appliedScaleFactor:[32]},void 0,{scenarios:[{validateScenario:0}],variances:[{validateVariances:0}],syncSpaceLeft:[{validateLeftSync:0}],limit:[{validateLimit:0}],unitScaling:[{validateUnitScaling:0}],percentageScaling:[{validatePercentageScaling:0}],level:[{validateLevel:0}],order:[{validateOrderList:0}],orderDirection:[{validateOrderDirection:0}],dateInterval:[{validateDateInterval:0}],chartMode:[{validateChartMode:0}],maxBars:[{validateMaxBars:0}],stack:[{validateStack:0}],scale:[{validateScaling:0}],axisLabelsMode:[{validateAxisLabelsMode:0}],lineFullWidth:[{validateLineFullWidth:0}],showCategories:[{validateShowCategories:0}],measureScale:[{validateMeasureScale:0}],showMeasureScale:[{validateShowMeasureScale:0}],showOverlayAvg:[{validateShowOverlayAvg:0}],showOverlayMedian:[{validateShowOverlayMedian:0}]}]),z=B,V=function(){"undefined"!=typeof customElements&&["bn-chart-time","ibcs-chart-time"].forEach((i=>{switch(i){case"bn-chart-time":customElements.get(n(i))||customElements.define(n(i),B);break;case"ibcs-chart-time":customElements.get(n(i))||P()}}))};export{z as BnChartTime,V as defineCustomElement}
|