@bino-bi/bn-template-engine 1.0.0-next.34 → 1.0.0-next.35
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-4ef6683e.entry.js +1 -0
- package/dist/bn-template-engine/{p-7d475277.entry.js → p-5a64f90f.entry.js} +1 -1
- package/dist/bn-template-engine/{p-789bfd06.entry.js → p-93b8387f.entry.js} +1 -1
- package/dist/bn-template-engine/{p-66ed6259.entry.js → p-9a61f59d.entry.js} +1 -1
- package/dist/bn-template-engine/p-BVU4bIsi.js +1 -0
- package/dist/bn-template-engine/{p-CJfJQT0m.js → p-D0tNATZq.js} +1 -1
- package/dist/bn-template-engine/p-DF9sfwBN.js +1 -0
- package/dist/bn-template-engine/{p-CAvWZ3a5.js → p-DyupX-Z-.js} +1 -1
- package/dist/bn-template-engine/{p-14d021be.entry.js → p-b0dfc113.entry.js} +1 -1
- package/dist/bn-template-engine/{p-dec6837c.entry.js → p-eea538f1.entry.js} +1 -1
- package/dist/bn-template-engine/{p-CHZ50kEY.js → p-qpZjVnX5.js} +1 -1
- package/dist/cjs/bn-annotation-layer_30.cjs.entry.js +206 -48
- package/dist/cjs/bn-grid.cjs.entry.js +3 -3
- package/dist/cjs/bn-image.cjs.entry.js +2 -2
- package/dist/cjs/bn-internationalization.cjs.entry.js +2 -2
- package/dist/cjs/bn-ruleset.cjs.entry.js +2 -2
- package/dist/cjs/bn-text.cjs.entry.js +3 -3
- package/dist/cjs/{localFrame-P5SDUOto.js → localFrame-U3Qs0psw.js} +1 -1
- package/dist/cjs/{withBodyObserver-B1_hmuUz.js → withBodyObserver-S-FGHpAX.js} +1 -1
- package/dist/cjs/{withHasError-3kR2tdhJ.js → withHasError-BkBrsCpI.js} +8 -7
- package/dist/cjs/{withStyled-eHD8Yt2K.js → withStyled-DfE0aW7D.js} +63 -3
- package/dist/cjs/{withTranslation-yJ-j0lsu.js → withTranslation-0gkn9xoC.js} +2 -2
- package/dist/collection/components/bn-table/bn-table-renderer/bn-table-renderer.js +9 -2
- package/dist/collection/components/bn-table/bn-table.js +19 -10
- package/dist/collection/components/bn-table/utils/Table.js +34 -8
- package/dist/collection/components/bn-table/utils/elements/CellBarChart.js +84 -13
- package/dist/collection/components/bn-table/utils/helper/DataQuery.js +57 -10
- package/dist/collection/components/bn-table/utils/helper/barColumnGeometry.js +5 -5
- package/dist/collection/stores/ruleSets.js +8 -7
- package/dist/collection/utils/ibcsRuleSet.js +2 -1
- package/dist/collection/utils/model/Order.js +49 -2
- package/dist/collection/utils/validate.js +11 -1
- package/dist/components/bn-annotation-layer.js +1 -1
- package/dist/components/bn-annotation-list.js +1 -1
- package/dist/components/bn-asset.js +1 -1
- package/dist/components/bn-body.js +1 -1
- package/dist/components/bn-card.js +1 -1
- package/dist/components/bn-chart-bubble-renderer.js +1 -1
- package/dist/components/bn-chart-bubble.js +1 -1
- package/dist/components/bn-chart-bullet-renderer.js +1 -1
- package/dist/components/bn-chart-bullet.js +1 -1
- package/dist/components/bn-chart-scatter-renderer.js +1 -1
- package/dist/components/bn-chart-scatter.js +1 -1
- package/dist/components/bn-chart-structure-renderer.js +1 -1
- package/dist/components/bn-chart-structure.js +1 -1
- package/dist/components/bn-chart-time-renderer.js +1 -1
- package/dist/components/bn-chart-time.js +1 -1
- package/dist/components/bn-component-style.js +1 -1
- package/dist/components/bn-context.js +1 -1
- package/dist/components/bn-dataset.js +1 -1
- package/dist/components/bn-datasource.js +1 -1
- package/dist/components/bn-footer.js +1 -1
- package/dist/components/bn-grid.js +1 -1
- package/dist/components/bn-image.js +1 -1
- package/dist/components/bn-internationalization.js +1 -1
- package/dist/components/bn-layout-card.js +1 -1
- package/dist/components/bn-layout-page.js +1 -1
- package/dist/components/bn-message.js +1 -1
- package/dist/components/bn-page.js +1 -1
- package/dist/components/bn-ruleset.js +1 -1
- package/dist/components/bn-scaling-group.js +1 -1
- package/dist/components/bn-table-renderer.js +1 -1
- package/dist/components/bn-table.js +1 -1
- package/dist/components/bn-text.js +1 -1
- package/dist/components/bn-title-renderer.js +1 -1
- package/dist/components/bn-title.js +1 -1
- package/dist/components/bn-tree.js +1 -1
- package/dist/components/p-16rjcQ0t.js +1 -0
- package/dist/components/{p-8a2-IS-y.js → p-2eicD9rF.js} +1 -1
- package/dist/components/p-4vVbchX2.js +1 -0
- package/dist/components/{p-VIw66ez1.js → p-7ieJFBUk.js} +1 -1
- package/dist/components/{p-Dn3DJxQQ.js → p-9mUU4itF.js} +1 -1
- package/dist/components/{p-D5LDmR4u.js → p-B5tixDPM.js} +1 -1
- package/dist/components/p-BPGLOHUe.js +1 -0
- package/dist/components/{p-B3F_c9GB.js → p-BU_53KVT.js} +1 -1
- package/dist/components/p-BW842XlW.js +1 -0
- package/dist/components/p-BXXjh6We.js +1 -0
- package/dist/components/{p-C-oNdJj9.js → p-BXg3v5AO.js} +1 -1
- package/dist/components/{p-B7UDMyar.js → p-BhEdmPjm.js} +1 -1
- package/dist/components/{p-nHZ8466v.js → p-BmOWXYHF.js} +1 -1
- package/dist/components/{p-DLLljAll.js → p-Bo_R7f_T.js} +1 -1
- package/dist/components/{p-DdG2Ylar.js → p-BqUB56k1.js} +1 -1
- package/dist/components/{p-DHAoxu6M.js → p-BzjGUtYh.js} +1 -1
- package/dist/components/{p-BtH2oezK.js → p-C-KX1_tw.js} +1 -1
- package/dist/components/{p-BldMZbAf.js → p-C3gYq-HU.js} +1 -1
- package/dist/components/{p-CPC9Vkmg.js → p-CQVAHG6w.js} +1 -1
- package/dist/components/{p-4BanAktr.js → p-C_6KHDYv.js} +1 -1
- package/dist/components/{p-ClGOhg6P.js → p-Cel0a6ma.js} +1 -1
- package/dist/components/{p-Ku08TQL1.js → p-Chuj-LpI.js} +1 -1
- package/dist/components/{p-M6hn0BuZ.js → p-CniN8ALm.js} +1 -1
- package/dist/components/{p-BcOud3dQ.js → p-DDvWTgk1.js} +1 -1
- package/dist/components/p-DJUffGeB.js +1 -0
- package/dist/components/p-DQl2K2Xl.js +1 -0
- package/dist/components/p-DT04Cka0.js +1 -0
- package/dist/components/{p-BVnYDfb8.js → p-DTmqMQpw.js} +1 -1
- package/dist/components/{p-DSkyHSIL.js → p-DaOm9YwQ.js} +1 -1
- package/dist/components/p-DjPWZfry.js +1 -0
- package/dist/components/{p-BXt0ers2.js → p-Dm6EAaJ9.js} +1 -1
- package/dist/components/p-Do4oPrkE.js +1 -0
- package/dist/components/{p-DEHnizot.js → p-Dq9dG0Kr.js} +1 -1
- package/dist/components/{p-D6cWoDk1.js → p-M2k_I8lv.js} +1 -1
- package/dist/components/{p-B4pmO5QQ.js → p-NBaq67dL.js} +1 -1
- package/dist/components/p-OquycEMA.js +1 -0
- package/dist/components/{p-CJtE8Pyr.js → p-eWxolPDU.js} +1 -1
- package/dist/components/{p-De82WP7z.js → p-fKJx8WtW.js} +1 -1
- package/dist/components/{p-xhiPDAZa.js → p-sLbQ7yZ1.js} +1 -1
- package/dist/components/{p-GrpYAVHb.js → p-sar8m7th.js} +1 -1
- package/dist/components/{p-CYqHwYgQ.js → p-tkB96Ena.js} +1 -1
- package/dist/esm/bn-annotation-layer_30.entry.js +206 -48
- package/dist/esm/bn-grid.entry.js +3 -3
- package/dist/esm/bn-image.entry.js +2 -2
- package/dist/esm/bn-internationalization.entry.js +2 -2
- package/dist/esm/bn-ruleset.entry.js +2 -2
- package/dist/esm/bn-text.entry.js +3 -3
- package/dist/esm/{localFrame-IW84cmdb.js → localFrame-BNWPPaQa.js} +1 -1
- package/dist/esm/{withBodyObserver-CAnnvrE_.js → withBodyObserver-AHQAUV85.js} +1 -1
- package/dist/esm/{withHasError-Cj_MzZ8Q.js → withHasError-B6Lvj9Cq.js} +8 -7
- package/dist/esm/{withStyled-Cxua0iTP.js → withStyled-CIoJ86RM.js} +61 -4
- package/dist/esm/{withTranslation-BeAbw2--.js → withTranslation-BX9T3dfm.js} +2 -2
- package/dist/types/components/bn-table/bn-table.d.ts +17 -4
- package/dist/types/components/bn-table/utils/Table.d.ts +2 -0
- package/dist/types/components/bn-table/utils/elements/CellBarChart.d.ts +1 -1
- package/dist/types/components/bn-table/utils/helper/DataQuery.d.ts +8 -0
- package/dist/types/components/bn-table/utils/helper/barColumnGeometry.d.ts +3 -2
- package/dist/types/components.d.ts +4 -4
- package/dist/types/stores/ruleSets.d.ts +2 -1
- package/dist/types/utils/ibcsRuleSet.d.ts +2 -1
- package/dist/types/utils/model/Order.d.ts +18 -1
- package/dist/types/utils/validate.d.ts +2 -0
- package/package.json +1 -1
- package/dist/bn-template-engine/p-BNCLKXjM.js +0 -1
- package/dist/bn-template-engine/p-_SKPuKfK.js +0 -1
- package/dist/bn-template-engine/p-dc12ff1b.entry.js +0 -1
- package/dist/components/p-BNWZoAip.js +0 -1
- package/dist/components/p-BT2WH_CP.js +0 -1
- package/dist/components/p-BVtD8O36.js +0 -1
- package/dist/components/p-BWRE5w0i.js +0 -1
- package/dist/components/p-C6XrNN2m.js +0 -1
- package/dist/components/p-CGI6XIaK.js +0 -1
- package/dist/components/p-CLkpoHdg.js +0 -1
- package/dist/components/p-CYv_8LrR.js +0 -1
- package/dist/components/p-Ckl1aEvn.js +0 -1
- package/dist/components/p-CurWSJkH.js +0 -1
- package/dist/components/p-D7X69xMg.js +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
import{p as t,H as i,w as e,f as s,h as a,a as r,t as n}from"./p-D6YGOYV1.js";import{h as o,a as l}from"./p-BcOud3dQ.js";import{v as c,a as h,i as d,k as p,b as u,c as v,h as m,l as g,m as f}from"./p-CYv_8LrR.js";import{w as b}from"./p-BVtD8O36.js";import{w as y}from"./p-DEHnizot.js";import{i as S,w,a as O}from"./p-B3F_c9GB.js";import{w as A}from"./p-D7X69xMg.js";import{w as k}from"./p-DLLljAll.js";import{w as x}from"./p-C6XrNN2m.js";import{r as _}from"./p-M6hn0BuZ.js";import{w as N}from"./p-BWRE5w0i.js";import{w as T,r as D}from"./p-CGI6XIaK.js";import{g as U}from"./p-DD1zlev_.js";import{r as W,f as j,p as M}from"./p-Xb6Ilq8u.js";import{o as L}from"./p-B6kka9sT.js";import{A as R,e as C,f as z,g as $}from"./p-D5LDmR4u.js";import{a as P,O as E}from"./p-BNWZoAip.js";import{LAYOUT_STATE_VERSION as F}from"./index.js";import{o as I,m as G}from"./p-DSkyHSIL.js";import{r as B,a as H}from"./p-CckAR27O.js";import{a as V}from"./p-GrpYAVHb.js";import{a as Y}from"./p-t4xPltK2.js";import{s as X}from"./p-DakXa7Dp.js";import{d as q}from"./p-CYqHwYgQ.js";const J=t(class t extends i{validateFilter(t){const i="ERR_filter";o(t)?this.errors.addOrReplace({id:i,type:"error",message:"filter: double backticks are not allowed."}):this.errors.remove(i)}validateScenario(t){const i="WARN_scenarios";if(S(t))return void this.errors.remove(i);const e=c(t);e.length>0?this.errors.addOrReplace({id:i,type:"warning",message:"scenarios: invalid value(s) '"+JSON.stringify(e)+"' are not supported."}):this.errors.remove(i)}validateVariances(t){const i="WARN_variances";if(S(t))return void this.errors.remove(i);const e=h(t);e.length>0?this.errors.addOrReplace({id:i,type:"warning",message:"variances: invalid value(s) '"+JSON.stringify(e)+"' are not supported."}):this.errors.remove(i)}validateUnitScaling(t){const i="WARN_unitScaling";d(t)?this.errors.remove(i):"invalid"===W(t,this.pixelPerUnitGroupMap).kind?this.errors.addOrReplace({id:i,type:"warning",message:"unitScaling: invalid value(s) '"+t+"' are not supported."}):this.errors.remove(i)}validatePercentageScaling(t){const i="WARN_percentageScaling";d(t)?this.errors.remove(i):"invalid"===W(t,this.pixelPerUnitGroupMap).kind?this.errors.addOrReplace({id:i,type:"warning",message:"percentageScaling: invalid value(s) '"+t+"' are not supported."}):this.errors.remove(i)}validateLevel(t){const i="WARN_level";d(t)||p(t)?this.errors.remove(i):this.errors.addOrReplace({id:i,type:"warning",message:"level: invalid value(s) '"+t+"' are not supported."})}validateOrderList(t){const i="WARN_order";if(S(t))return void this.errors.remove(i);const e=u(t);e.length>0?this.errors.addOrReplace({id:i,type:"warning",message:"order: invalid value(s) '"+JSON.stringify(e)+"' are not supported."}):this.errors.remove(i)}validateOrderDirection(t){const i="WARN_orderDirection";S(t)||d(t)||v(t)?this.errors.remove(i):this.errors.addOrReplace({id:i,type:"warning",message:"orderDirection: invalid value '"+(null==t?void 0:""+t)+"' is not supported."})}validateLimit(t){const i="WARN_limit";m(t)?this.errors.remove(i):this.errors.addOrReplace({id:i,type:"warning",message:"limit: invalid value '"+(null==t?void 0:""+t)+"' is not supported."})}validateMeasureScale(t){const i="WARN_measureScale";g(t)?this.errors.remove(i):this.errors.addOrReplace({id:i,type:"warning",message:"measureScale: invalid value '"+(null==t?void 0:""+t)+"' is not supported."})}validateStack(t){const i="WARN_stack",e=f(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("WARN_scale");const i=Number(t);isNaN(i)||i<=0?this.errors.addOrReplace({id:"WARN_scale",type:"warning",message:`Invalid scale value: "${t}". Use "none", "auto", or a positive number.`}):this.errors.remove("WARN_scale")}constructor(i){super(),!1!==i&&this.__registerHost(),this.__attachShadow(),this.datasetName="",this.dataVersion=0,this.datasetMeta=null,this.appliedScaleFactor=1,this.layoutObserver=null,this._lastScaledParentHeight=0,this.chartTitle="",this.filter="",this.limit=0,this.showCategories=!0,this.measureScale="greatest",this.showMeasureScale=!1,this.measureUnit="",this.stack="",this.pixelPerUnitGroupMap=new Map,this._autoScaleGuard=!1,this.autoUnitWarningActive=!1,this.autoPctWarningActive=!1,this.handleAutoScalingReport=i=>{var e,s,a,r,n,o;this.lastAutoScalingReport={unit:null!==(e=i.unit)&&void 0!==e?e:null===(s=this.lastAutoScalingReport)||void 0===s?void 0:s.unit,percentage:null!==(a=i.percentage)&&void 0!==a?a:null===(r=this.lastAutoScalingReport)||void 0===r?void 0:r.percentage};const l=(t,i)=>void 0===i||Math.abs(t-i)>.001*Math.abs(t),c=this.getEffectiveFontPx();if(void 0!==i.unit&&i.unit>0&&this.autoUnitWarningActive){const e=c/i.unit;l(e,this.lastReportedUnitsPerEm)&&(this.lastReportedUnitsPerEm=e,this.errors.addOrReplace({id:"AUTO_unitScaling",type:"warning",message:`unit-scaling: ${t.describeScalingInput(((null!==(n=this.unitScaling)&&void 0!==n?n:"")+"").trim())}, auto-fitted to 1 em ≈ ${j(e)} units.`}))}if(void 0!==i.percentage&&i.percentage>0&&this.autoPctWarningActive){const e=100*c/i.percentage;l(e,this.lastReportedPpPerEm)&&(this.lastReportedPpPerEm=e,this.errors.addOrReplace({id:"AUTO_percentageScaling",type:"warning",message:`percentage-scaling: ${t.describeScalingInput(((null!==(o=this.percentageScaling)&&void 0!==o?o:"")+"").trim())}, auto-fitted to 1 em ≈ ${j(e)} percentage points.`}))}},k(this),y(this),b(this,(t=>{this.datasetName=(null==t?void 0:t.startsWith("$"))?t.substring(1):t||"",this.dataVersion=this.dataVersion+1}),((t,i)=>{this.datasetMeta=i})),this.chartTemplate=this.chartTemplate.bind(this),this.errors=T(this),A(this),this.componentStyle=x(this),this.ruleSetConfig=N(this),this.t=w(this).t,this.resolveInherited=O(this,[{propName:"scenarios",ancestorAttr:"title-scenarios"},{propName:"variances",ancestorAttr:"title-variances"},{propName:"order",ancestorAttr:"title-order"},{propName:"orderDirection",ancestorAttr:"title-order-direction"}],this.errors)}componentWillLoad(){this.validateFilter(this.filter),this.validateScenario(this.scenarios),this.validateVariances(this.variances),this.validateUnitScaling(this.unitScaling),this.validateLevel(this.level),this.validateOrderDirection(this.orderDirection),this.validateOrderList(this.order),this.validateMeasureScale(this.measureScale),this.validateStack(this.stack),this.validateScaling(this.scale)}componentDidRender(){X(this.element,"bn-chart-structure-renderer");const{mode:t}=M(this.scale);if("auto"!==t&&"empty"!==t)return this._autoScaleGuard=!1,void this.checkOverflow();if(this._autoScaleGuard)return this._autoScaleGuard=!1,void this.checkOverflow();const i=this.element,{height:s}=U(i);if(s<=0)return void this.checkOverflow();this._lastScaledParentHeight=s;const a=this.componentStyle((t=>{var i;return(null===(i=t.global)||void 0===i?void 0:i.fontSizePx)||13.3333})),r=i.scrollHeight,n=this.appliedScaleFactor;if(r<=s+1)return this.errors.remove("AUTO_scale"),void this.checkOverflow();const o=Math.max(.3,n*(s-1)/r);Math.abs(o-n)<.01||(i.style.setProperty("--bn-font-size",a*o+"px"),"empty"===t?this.errors.addOrReplace({id:"AUTO_scale",type:"warning",message:"Auto-scaled chart by factor "+o.toFixed(3)}):this.errors.remove("AUTO_scale"),this._autoScaleGuard=!0,e((()=>{this.appliedScaleFactor=o}))),this.checkOverflow()}componentDidLoad(){this.layoutObserver=L(this.element,(()=>{if(this._autoScaleGuard)return;const{height:t}=U(this.element);t>0&&Math.abs(t-this._lastScaledParentHeight)>2&&(this._lastScaledParentHeight=t,s(this))})),requestAnimationFrame((()=>{requestAnimationFrame((()=>{if(this._autoScaleGuard)return;const{height:t}=U(this.element);this._lastScaledParentHeight=t,s(this)}))}))}disconnectedCallback(){var t;null===(t=this.layoutObserver)||void 0===t||t.disconnect(),this.layoutObserver=null}measureContentWidth(){var t;const i=null===(t=this.element.shadowRoot)||void 0===t?void 0:t.querySelectorAll("bn-chart-structure-renderer");let e=0,s=!1;return null==i||i.forEach((t=>{var i,a,r;const n=parseFloat(null!==(r=null===(a=null===(i=t.shadowRoot)||void 0===i?void 0:i.querySelector("svg#drawCanvas"))||void 0===a?void 0:a.getAttribute("width"))&&void 0!==r?r:"");Number.isNaN(n)||(e+=n,s=!0)})),s?Math.max(Math.floor(e),this.element.scrollWidth):this.element.scrollWidth}checkOverflow(){const t=U(this.element),i=this.measureContentWidth(),e=this.element.scrollHeight,s=t.width>0&&i>t.width+1,a=t.height>0&&e>t.height+1;if(!s&&!a)return void D(this.errors,null);const r=this.prepareVariances().some((t=>t.startsWith("dr"))),n="value"===W(this.unitScaling,this.pixelPerUnitGroupMap).kind,o=r&&"value"===W(this.percentageScaling,this.pixelPerUnitGroupMap).kind,{mode:l}=M(this.scale),c="auto"!==l&&"empty"!==l,h=[];s&&n&&h.push("unit-scaling"),s&&o&&h.push("percentage-scaling"),a&&c&&h.push("scale");const d=[];s&&d.push(`width (${Math.round(i)}px > ${Math.round(t.width)}px)`),a&&d.push(`height (${Math.round(e)}px > ${Math.round(t.height)}px)`),D(this.errors,`Chart exceeds available ${d.join(" and ")}. `+(h.length>0?`Adjust ${h.join(" / ")} or set to "auto".`:"Content does not fit even at minimum auto scaling; enlarge the container."),h.length>0)}prepareDimension(){const t=U(this.element),i=this.prepareVariances();return this.canvasWidthSegmented=t.width/(1+i.length),{width:this.canvasWidthSegmented,height:t.height}}prepareScenarios(){var t,i,e,s;const a=this.resolveInherited("scenarios",this.scenarios);if(a.inherited)return this.errors.remove("AUTO_scenarios"),a.value.split(",").map((t=>t.trim()));const r="auto"===(null===(t=a.value)||void 0===t?void 0:t.trim().toLowerCase());return d(a.value)||r?(null===(e=null===(i=this.datasetMeta)||void 0===i?void 0:i.availableScenarios)||void 0===e?void 0:e.length)>0?(r||a.unresolved?this.errors.remove("AUTO_scenarios"):this.errors.addOrReplace({id:"AUTO_scenarios",type:"warning",message:"scenarios: not set, auto-detected: "+this.datasetMeta.availableScenarios.join(",")}),this.datasetMeta.availableScenarios):[]:(this.errors.remove("AUTO_scenarios"),null===(s=a.value)||void 0===s?void 0:s.split(",").map((t=>t.trim())))}prepareVariances(){const t=this.resolveInherited("variances",this.variances).value;return d(t)?[]:null==t?void 0:t.split(",").map((t=>t.trim()))}prepareHideCategories(t){return t>=1||!this.showCategories}prepareI18n(){const t=l,i=new Map(["no-data","REST"].map((t=>[t,this.t(".".concat(t))]))),e=new Map(t.map((t=>[t,this.t("global.".concat(t))])));return new Map([...e.entries(),...i.entries(),..._(this.ruleSetConfig("user"))])}static describeScalingInput(t){return""===t?"not set":`invalid value "${t}"`}preparePixelPerUnit(){const i=W(this.unitScaling,this.pixelPerUnitGroupMap);return"value"===i.kind?(this.errors.remove("AUTO_unitScaling"),this.autoUnitWarningActive=!1,this.lastReportedUnitsPerEm=void 0,this.getEffectiveFontPx()/i.value):"auto"===i.kind?(this.errors.remove("AUTO_unitScaling"),this.autoUnitWarningActive=!1,this.lastReportedUnitsPerEm=void 0,0):(this.autoUnitWarningActive=!0,this.errors.addOrReplace({id:"AUTO_unitScaling",type:"warning",message:`unit-scaling: ${t.describeScalingInput(i.raw)}, auto-calculated to fit available space.`}),0)}preparePixelPerPercentage(){const i=W(this.percentageScaling,this.pixelPerUnitGroupMap);return"value"===i.kind?(this.errors.remove("AUTO_percentageScaling"),this.autoPctWarningActive=!1,this.lastReportedPpPerEm=void 0,100*this.getEffectiveFontPx()/i.value):"auto"===i.kind?(this.errors.remove("AUTO_percentageScaling"),this.autoPctWarningActive=!1,this.lastReportedPpPerEm=void 0,0):(this.autoPctWarningActive=!0,this.errors.addOrReplace({id:"AUTO_percentageScaling",type:"warning",message:`percentage-scaling: ${t.describeScalingInput(i.raw)}, auto-calculated to fit available space.`}),0)}prepareLevel(){var t,i,e;const s="auto"===(null===(t=this.level)||void 0===t?void 0:t.trim().toLowerCase());return d(this.level)||s?(null===(i=this.datasetMeta)||void 0===i?void 0:i.suggestedLevel)?(s?this.errors.remove("AUTO_level"):this.errors.addOrReplace({id:"AUTO_level",type:"warning",message:"level: not set, auto-detected: "+this.datasetMeta.suggestedLevel}),R[this.datasetMeta.suggestedLevel.toUpperCase()]):void 0:(this.errors.remove("AUTO_level"),R[null===(e=this.level)||void 0===e?void 0:e.toUpperCase()])}prepareOrder(){var t;const i=this.resolveInherited("order",this.order),e=i.value,s=this.resolveInherited("orderDirection",this.orderDirection).value,a="auto"===(null==e?void 0:e.trim().toLowerCase());let r;return d(e)||a?(null===(t=this.datasetMeta)||void 0===t?void 0:t.suggestedOrder)?(a||i.unresolved?this.errors.remove("AUTO_order"):this.errors.addOrReplace({id:"AUTO_order",type:"warning",message:"order: not set, auto-detected: "+this.datasetMeta.suggestedOrder}),r=this.datasetMeta.suggestedOrder):r=e:(this.errors.remove("AUTO_order"),r=e),{hierarchy:null==r?void 0:r.split(",").map((t=>E[null==t?void 0:t.toUpperCase()])),direction:P[null==s?void 0:s.toUpperCase()]}}prepareStyle(){const t=this.getEffectiveScaleFactor();return this.componentStyle((i=>{const e=i.global.fontSizePx*t;return{scaleFactors:{scenarioOffset:i["bn-chart-structure"].scaleFactors.scenarioOffset,scenarioLabelToBar:i["bn-chart-structure"].scaleFactors.scenarioLabelToBar,labelToBar:i["bn-chart-structure"].scaleFactors.labelToBar,labelToAxis:i["bn-chart-structure"].scaleFactors.labelToAxis,needleWidth:i["bn-chart-structure"].scaleFactors.needleWidth,needleHeadWidth:i["bn-chart-structure"].scaleFactors.needleHeadWidth,barWidth:i["bn-chart-structure"].scaleFactors.barWidth,varianceAxisLineWidth:i["bn-chart-structure"].scaleFactors.varianceAxisLineWidth,axisLineWidth:i["bn-chart-structure"].scaleFactors.axisLineWidth,auxiliaryLineWidth:i["bn-chart-structure"].scaleFactors.auxiliaryLineWidth,scenarioLineWidth:i["bn-chart-structure"].scaleFactors.scenarioLineWidth,markerWidth:i["bn-chart-structure"].scaleFactors.markerWidth,markerOffset:i["bn-chart-structure"].scaleFactors.markerOffset,categoryWidth:i["bn-chart-structure"].scaleFactors.categoryWidth,axisTickLength:i["bn-chart-structure"].scaleFactors.axisTickLength},fontStyles:{font:`${e}px ${i.global.fontFamily}`,family:i.global.fontFamily,size:e,color:i.global.fontColor,background:i.global.fontBackgroundColor,leading:1.8},axisStyles:i["bn-chart-structure"].axisStyles,barStyles:i["bn-chart-structure"].barStyles,varianceStyles:i["bn-chart-structure"].varianceStyles,stackColors:i["bn-chart-structure"].stackColors,padding:i["bn-chart-structure"].padding,pattern:null}}))}prepareChartTitle(t){return t>=1?"":this.chartTitle}prepareStackConfig(){if(d(this.stack))return this.errors.remove("WARN_stack_dimensions_scenarios"),null;try{const t=JSON.parse(this.stack),i=t.by,e="WARN_stack_dimensions_scenarios";if(i===C.DIMENSIONS){const t=this.prepareScenarios();t.length>1?this.errors.addOrReplace({id:e,type:"warning",message:`stack by dimensions: only the first scenario "${t[0]}" is used, the rest (${t.slice(1).join(", ")}) are discarded.`}):this.errors.remove(e)}else this.errors.remove(e);return{by:i,mode:t.mode||$.ABSOLUTE,order:t.order||z.DATASET}}catch(t){return this.errors.remove("WARN_stack_dimensions_scenarios"),null}}prepareFilter(){return 0===this.filter.length?"":this.filter}prepareLimit(){return Math.floor(Number(this.limit)||0)}getDataStructure(){return{IStructureChartDataRow:{operation:{type:"string",isOptional:!1,description:""},rowGroup:{type:"string",isOptional:!1,description:""},rowGroupIndex:{type:"number",isOptional:!1,description:""},category:{type:"string",isOptional:!1,description:""},categoryIndex:{type:"number",isOptional:!1,description:""},subCategory:{type:"string",isOptional:!1,description:""},subCategoryIndex:{type:"number",isOptional:!1,description:""},columnGroup:{type:"string",isOptional:!1,description:""},columnGroupIndex:{type:"number",isOptional:!1,description:""},columnSubGroup:{type:"string",isOptional:!1,description:""},columnSubGroupIndex:{type:"number",isOptional:!1,description:""},ac1:{type:"number",isOptional:!1,description:""},ac2:{type:"number",isOptional:!1,description:""},ac3:{type:"number",isOptional:!1,description:""},ac4:{type:"number",isOptional:!1,description:""},pp1:{type:"number",isOptional:!1,description:""},pp2:{type:"number",isOptional:!1,description:""},pp3:{type:"number",isOptional:!1,description:""},pp4:{type:"number",isOptional:!1,description:""},fc1:{type:"number",isOptional:!1,description:""},fc2:{type:"number",isOptional:!1,description:""},fc3:{type:"number",isOptional:!1,description:""},fc4:{type:"number",isOptional:!1,description:""},pl1:{type:"number",isOptional:!1,description:""},pl2:{type:"number",isOptional:!1,description:""},pl3:{type:"number",isOptional:!1,description:""},pl4:{type:"number",isOptional:!1,description:""}}}}prepareMeasureScale(){return d(this.measureScale)?"GREATEST":["_","k","M","G","T","P","E","Z","Y","m","μ","n","p","P","f","a","z","y"].includes(this.measureScale.trim())||"LEAST"===this.measureScale.trim().toUpperCase()?this.measureScale.trim():"GREATEST"}prepareShowMeasureScale(t){return 0===t&&this.showMeasureScale}prepareMeasureUnit(){return""===this.measureUnit||null==this.measureUnit?"":this.measureUnit}chartTemplate(t,i){const e=this.preparePixelPerUnit(),s=this.preparePixelPerPercentage(),r=this.prepareStackConfig(),n=this.prepareScenarios(),o=(null==r?void 0:r.by)===C.DIMENSIONS?n.slice(0,1):n;return a("bn-chart-structure-renderer",{tableName:this.datasetName,dataVersion:this.dataVersion,chartTitle:this.prepareChartTitle(i),scenarios:o,variances:[t],hideCategories:this.prepareHideCategories(i),pixelPerUnit:e,pixelPerPercentage:s,reportAutoScaling:this.handleAutoScalingReport,errors:this.errors,limit:this.prepareLimit(),styles:this.prepareStyle(),i18n:this.prepareI18n(),order:this.prepareOrder(),level:this.prepareLevel(),filter:this.prepareFilter(),"measure-scale":this.prepareMeasureScale(),"measure-unit":this.prepareMeasureUnit(),showMeasureScale:this.prepareShowMeasureScale(i),stackConfig:r,parentDimensions:this.prepareDimension(),ruleSetConfig:this.ruleSetConfig()})}async getBaseline(){return Y(this.element,"bn-chart-structure-renderer")}async getLayoutState(t){var i,e,s,a;const r=null!==(i=null==t?void 0:t.detail)&&void 0!==i?i:"summary",n=I(this.element),o=this.getEffectiveScaleFactor(),l=Number.isFinite(o)&&o>0?o:1,c=this.componentStyle((t=>{var i;return(null===(i=t.global)||void 0===i?void 0:i.fontSizePx)||13.3333}))*l,h=this.prepareVariances(),d=V(this.element,"bn-chart-structure-renderer",["base",...h],n,r),p=null===(e=this.element.shadowRoot)||void 0===e?void 0:e.querySelector("bn-chart-structure-renderer"),u={version:F,tag:this.element.localName,id:H(this.element),slot:null!==(s=this.element.getAttribute("slot"))&&void 0!==s?s:void 0,rect:G(this.element,n),em:{fontSizePx:c,appliedScaleFactor:l},regions:d.regions,metadata:{title:this.chartTitle||void 0,scenarios:null!==(a=null==p?void 0:p.scenarios)&&void 0!==a?a:[],variances:h,barCount:d.barCount,hasNoData:0===d.barCount},diagnostics:B(this.element),scaling:this.resolveScalingInfo(c),baseline:d.baseline};return d.elements&&(u.elements=d.elements),u}resolveScalingInfo(t){var i,e;const s={},a=W(this.unitScaling,this.pixelPerUnitGroupMap);if("value"===a.kind)s.unitMode="fixed",s.unitsPerEm=a.value,s.unitPxPerUnit=t/a.value;else{s.unitMode="auto";const e=null===(i=this.lastAutoScalingReport)||void 0===i?void 0:i.unit;void 0!==e&&e>0&&(s.unitPxPerUnit=e,s.unitsPerEm=t/e)}const r=W(this.percentageScaling,this.pixelPerUnitGroupMap);if("value"===r.kind)s.percentageMode="fixed",s.percentagePointsPerEm=r.value,s.percentagePxPerPoint=t/r.value;else{s.percentageMode="auto";const i=null===(e=this.lastAutoScalingReport)||void 0===e?void 0:e.percentage;void 0!==i&&i>0&&(s.percentagePxPerPoint=i/100,s.percentagePointsPerEm=100*t/i)}return s}getEffectiveScaleFactor(){const{mode:t,factor:i}=M(this.scale);return"factor"===t?i:"auto"===t||"empty"===t?this.appliedScaleFactor:1}getEffectiveFontPx(){return this.componentStyle((t=>{var i;return(null===(i=t.global)||void 0===i?void 0:i.fontSizePx)||13.3333}))*this.getEffectiveScaleFactor()}getFontStyles(){const t=this.getEffectiveScaleFactor();return this.componentStyle((i=>{var e,s,a,r;const n=(null===(e=i.global)||void 0===e?void 0:e.fontSizePx)||13.3333;return{"--bn-font-family":(null===(s=i.global)||void 0===s?void 0:s.fontFamily)||"'Noto Sans', sans-serif","--bn-font-size":n*t+"px","--bn-font-color":(null===(a=i.global)||void 0===a?void 0:a.fontColor)||"#000000","--bn-font-background":(null===(r=i.global)||void 0===r?void 0:r.fontBackgroundColor)||"#ffffff"}}))}render(){let t=[""];const i=this.prepareVariances();i.length>0&&(t=[...t,...i]);const e=this.getFontStyles();return a(r,{key:"467a851c6547b300c71a38e812bfea4718f27775",style:e},a("div",{key:"4b5078608132e047a9404987c65c46f43037c043",class:"container"},t.map(this.chartTemplate)))}get element(){return this}static get watchers(){return{filter:[{validateFilter:0}],scenarios:[{validateScenario:0}],variances:[{validateVariances:0}],unitScaling:[{validateUnitScaling:0}],percentageScaling:[{validatePercentageScaling:0}],level:[{validateLevel:0}],order:[{validateOrderList:0}],orderDirection:[{validateOrderDirection:0}],limit:[{validateLimit:0}],measureScale:[{validateMeasureScale:0}],stack:[{validateStack:0}],scale:[{validateScaling:0}]}}static get style(){return':host(.no-data){display:block;box-sizing:border-box;width:100%;height:100%}:host(.no-data)>div{float:none;width:100%;height:100%}:host(.no-data) .no-data~.no-data{display:none}.empty-state{box-sizing:border-box;display:flex;align-items:center;justify-content:center;float:none;width:100%;height:100%;min-height:3em;margin:0;padding:0.5em;overflow:hidden;border:0.1em dashed #ddd;color:#808080;font-family:var(--bn-font-family, "Noto Sans", sans-serif);font-size:var(--bn-font-size, 13.3333px);font-style:normal;text-align:center}:host{display:inline-block;position:relative;overflow:hidden;font-family:var(--bn-font-family, "Noto Sans", sans-serif);font-size:var(--bn-font-size, 13.3333px);color:var(--bn-font-color, #000000)}.container{display:flex;flex-direction:row}.background-image{display:flex;flex-wrap:wrap;justify-content:flex-end}.categories{text-align:right;font-size:var(--bn-font-size, 1em);font-family:var(--bn-font-family, "Noto Sans", "Helvetica Neue", Helvetica, sans-serif);color:var(--bn-font-color, black)}.label-bg{fill:var(--bn-font-background, white);opacity:0.7}.label-text{text-align:right;font-size:var(--bn-font-size, 1em);font-family:var(--bn-font-family, "Noto Sans", "Helvetica Neue", Helvetica, sans-serif);color:var(--bn-font-color, black)}.axis-title{text-align:center;font-family:var(--bn-font-family, "Noto Sans", "Helvetica Neue", Helvetica, sans-serif);color:var(--bn-font-color, black)}.axis-ac{stroke:black;stroke-width:0.1em}.axis-pp{stroke:grey;stroke-width:0.1em}.axis-fc{stroke:black;stroke-dasharray:2;stroke-width:0.1em}.axis-pl{stroke:white;stroke-width:0.1em;outline-offset:0em;outline:0.1em solid black}canvas{image-rendering:-moz-crisp-edges;image-rendering:-webkit-crisp-edges;image-rendering:pixelated;image-rendering:crisp-edges}.measure{font-weight:bold}span{display:inline-block}.hidePatternContainer{height:0;width:0}div{float:left}svg#drawCanvas{display:block}.footer{margin:0.2em;font-size:0.6em}.footer-hide{margin:0.2em;font-size:0.6em;opacity:0}'}},[1,"bn-chart-structure",{datasets:[513],selectedStyle:[513,"selected-style"],i18nNamespace:[513,"i18n-namespace"],chartTitle:[1,"chart-title"],ruleset:[513],filter:[1],scenarios:[1],variances:[1],unitScaling:[8,"unit-scaling"],percentageScaling:[8,"percentage-scaling"],level:[1],order:[1],orderDirection:[1,"order-direction"],limit:[2],showCategories:[4,"show-categories"],measureScale:[1,"measure-scale"],showMeasureScale:[4,"show-measure-scale"],measureUnit:[1,"measure-unit"],stack:[1],scale:[1],datasetName:[32],dataVersion:[32],datasetMeta:[32],appliedScaleFactor:[32],getBaseline:[64],getLayoutState:[64]},void 0,{filter:[{validateFilter:0}],scenarios:[{validateScenario:0}],variances:[{validateVariances:0}],unitScaling:[{validateUnitScaling:0}],percentageScaling:[{validatePercentageScaling:0}],level:[{validateLevel:0}],order:[{validateOrderList:0}],orderDirection:[{validateOrderDirection:0}],limit:[{validateLimit:0}],measureScale:[{validateMeasureScale:0}],stack:[{validateStack:0}],scale:[{validateScaling:0}]}]),Z=J,K=function(){"undefined"!=typeof customElements&&["bn-chart-structure","bn-chart-structure-renderer"].forEach((t=>{switch(t){case"bn-chart-structure":customElements.get(n(t))||customElements.define(n(t),J);break;case"bn-chart-structure-renderer":customElements.get(n(t))||q()}}))};export{Z as BnChartStructure,K as defineCustomElement}
|
|
1
|
+
import{p as t,H as i,w as e,f as s,h as a,a as r,t as n}from"./p-D6YGOYV1.js";import{h as o,a as l}from"./p-DDvWTgk1.js";import{v as c,a as h,i as d,k as p,b as u,c as v,h as m,l as g,m as f}from"./p-DT04Cka0.js";import{w as y}from"./p-DJUffGeB.js";import{w as b}from"./p-Dq9dG0Kr.js";import{i as S,w,a as O}from"./p-BU_53KVT.js";import{w as k}from"./p-DQl2K2Xl.js";import{w as x}from"./p-Bo_R7f_T.js";import{w as A}from"./p-DjPWZfry.js";import{r as _}from"./p-CniN8ALm.js";import{w as N}from"./p-OquycEMA.js";import{w as T,r as D}from"./p-4vVbchX2.js";import{g as U}from"./p-DD1zlev_.js";import{r as j,f as W,p as M}from"./p-Xb6Ilq8u.js";import{o as R}from"./p-B6kka9sT.js";import{A as L,e as C,f as z,g as P}from"./p-B5tixDPM.js";import{a as $,O as E}from"./p-16rjcQ0t.js";import{LAYOUT_STATE_VERSION as F}from"./index.js";import{o as G,m as I}from"./p-DaOm9YwQ.js";import{r as B,a as V}from"./p-CckAR27O.js";import{a as H}from"./p-sar8m7th.js";import{a as q}from"./p-t4xPltK2.js";import{s as J}from"./p-DakXa7Dp.js";import{d as K}from"./p-tkB96Ena.js";const X=t(class t extends i{validateFilter(t){const i="ERR_filter";o(t)?this.errors.addOrReplace({id:i,type:"error",message:"filter: double backticks are not allowed."}):this.errors.remove(i)}validateScenario(t){const i="WARN_scenarios";if(S(t))return void this.errors.remove(i);const e=c(t);e.length>0?this.errors.addOrReplace({id:i,type:"warning",message:"scenarios: invalid value(s) '"+JSON.stringify(e)+"' are not supported."}):this.errors.remove(i)}validateVariances(t){const i="WARN_variances";if(S(t))return void this.errors.remove(i);const e=h(t);e.length>0?this.errors.addOrReplace({id:i,type:"warning",message:"variances: invalid value(s) '"+JSON.stringify(e)+"' are not supported."}):this.errors.remove(i)}validateUnitScaling(t){const i="WARN_unitScaling";d(t)?this.errors.remove(i):"invalid"===j(t,this.pixelPerUnitGroupMap).kind?this.errors.addOrReplace({id:i,type:"warning",message:"unitScaling: invalid value(s) '"+t+"' are not supported."}):this.errors.remove(i)}validatePercentageScaling(t){const i="WARN_percentageScaling";d(t)?this.errors.remove(i):"invalid"===j(t,this.pixelPerUnitGroupMap).kind?this.errors.addOrReplace({id:i,type:"warning",message:"percentageScaling: invalid value(s) '"+t+"' are not supported."}):this.errors.remove(i)}validateLevel(t){const i="WARN_level";d(t)||p(t)?this.errors.remove(i):this.errors.addOrReplace({id:i,type:"warning",message:"level: invalid value(s) '"+t+"' are not supported."})}validateOrderList(t){const i="WARN_order";if(S(t))return void this.errors.remove(i);const e=u(t);e.length>0?this.errors.addOrReplace({id:i,type:"warning",message:"order: invalid value(s) '"+JSON.stringify(e)+"' are not supported."}):this.errors.remove(i)}validateOrderDirection(t){const i="WARN_orderDirection";S(t)||d(t)||v(t)?this.errors.remove(i):this.errors.addOrReplace({id:i,type:"warning",message:"orderDirection: invalid value '"+(null==t?void 0:""+t)+"' is not supported."})}validateLimit(t){const i="WARN_limit";m(t)?this.errors.remove(i):this.errors.addOrReplace({id:i,type:"warning",message:"limit: invalid value '"+(null==t?void 0:""+t)+"' is not supported."})}validateMeasureScale(t){const i="WARN_measureScale";g(t)?this.errors.remove(i):this.errors.addOrReplace({id:i,type:"warning",message:"measureScale: invalid value '"+(null==t?void 0:""+t)+"' is not supported."})}validateStack(t){const i="WARN_stack",e=f(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("WARN_scale");const i=Number(t);isNaN(i)||i<=0?this.errors.addOrReplace({id:"WARN_scale",type:"warning",message:`Invalid scale value: "${t}". Use "none", "auto", or a positive number.`}):this.errors.remove("WARN_scale")}constructor(i){super(),!1!==i&&this.__registerHost(),this.__attachShadow(),this.datasetName="",this.dataVersion=0,this.datasetMeta=null,this.appliedScaleFactor=1,this.layoutObserver=null,this._lastScaledParentHeight=0,this.chartTitle="",this.filter="",this.limit=0,this.showCategories=!0,this.measureScale="greatest",this.showMeasureScale=!1,this.measureUnit="",this.stack="",this.pixelPerUnitGroupMap=new Map,this._autoScaleGuard=!1,this.autoUnitWarningActive=!1,this.autoPctWarningActive=!1,this.handleAutoScalingReport=i=>{var e,s,a,r,n,o;this.lastAutoScalingReport={unit:null!==(e=i.unit)&&void 0!==e?e:null===(s=this.lastAutoScalingReport)||void 0===s?void 0:s.unit,percentage:null!==(a=i.percentage)&&void 0!==a?a:null===(r=this.lastAutoScalingReport)||void 0===r?void 0:r.percentage};const l=(t,i)=>void 0===i||Math.abs(t-i)>.001*Math.abs(t),c=this.getEffectiveFontPx();if(void 0!==i.unit&&i.unit>0&&this.autoUnitWarningActive){const e=c/i.unit;l(e,this.lastReportedUnitsPerEm)&&(this.lastReportedUnitsPerEm=e,this.errors.addOrReplace({id:"AUTO_unitScaling",type:"warning",message:`unit-scaling: ${t.describeScalingInput(((null!==(n=this.unitScaling)&&void 0!==n?n:"")+"").trim())}, auto-fitted to 1 em ≈ ${W(e)} units.`}))}if(void 0!==i.percentage&&i.percentage>0&&this.autoPctWarningActive){const e=100*c/i.percentage;l(e,this.lastReportedPpPerEm)&&(this.lastReportedPpPerEm=e,this.errors.addOrReplace({id:"AUTO_percentageScaling",type:"warning",message:`percentage-scaling: ${t.describeScalingInput(((null!==(o=this.percentageScaling)&&void 0!==o?o:"")+"").trim())}, auto-fitted to 1 em ≈ ${W(e)} percentage points.`}))}},x(this),b(this),y(this,(t=>{this.datasetName=(null==t?void 0:t.startsWith("$"))?t.substring(1):t||"",this.dataVersion=this.dataVersion+1}),((t,i)=>{this.datasetMeta=i})),this.chartTemplate=this.chartTemplate.bind(this),this.errors=T(this),k(this),this.componentStyle=A(this),this.ruleSetConfig=N(this),this.t=w(this).t,this.resolveInherited=O(this,[{propName:"scenarios",ancestorAttr:"title-scenarios"},{propName:"variances",ancestorAttr:"title-variances"},{propName:"order",ancestorAttr:"title-order"},{propName:"orderDirection",ancestorAttr:"title-order-direction"}],this.errors)}componentWillLoad(){this.validateFilter(this.filter),this.validateScenario(this.scenarios),this.validateVariances(this.variances),this.validateUnitScaling(this.unitScaling),this.validateLevel(this.level),this.validateOrderDirection(this.orderDirection),this.validateOrderList(this.order),this.validateMeasureScale(this.measureScale),this.validateStack(this.stack),this.validateScaling(this.scale)}componentDidRender(){J(this.element,"bn-chart-structure-renderer");const{mode:t}=M(this.scale);if("auto"!==t&&"empty"!==t)return this._autoScaleGuard=!1,void this.checkOverflow();if(this._autoScaleGuard)return this._autoScaleGuard=!1,void this.checkOverflow();const i=this.element,{height:s}=U(i);if(s<=0)return void this.checkOverflow();this._lastScaledParentHeight=s;const a=this.componentStyle((t=>{var i;return(null===(i=t.global)||void 0===i?void 0:i.fontSizePx)||13.3333})),r=i.scrollHeight,n=this.appliedScaleFactor;if(r<=s+1)return this.errors.remove("AUTO_scale"),void this.checkOverflow();const o=Math.max(.3,n*(s-1)/r);Math.abs(o-n)<.01||(i.style.setProperty("--bn-font-size",a*o+"px"),"empty"===t?this.errors.addOrReplace({id:"AUTO_scale",type:"warning",message:"Auto-scaled chart by factor "+o.toFixed(3)}):this.errors.remove("AUTO_scale"),this._autoScaleGuard=!0,e((()=>{this.appliedScaleFactor=o}))),this.checkOverflow()}componentDidLoad(){this.layoutObserver=R(this.element,(()=>{if(this._autoScaleGuard)return;const{height:t}=U(this.element);t>0&&Math.abs(t-this._lastScaledParentHeight)>2&&(this._lastScaledParentHeight=t,s(this))})),requestAnimationFrame((()=>{requestAnimationFrame((()=>{if(this._autoScaleGuard)return;const{height:t}=U(this.element);this._lastScaledParentHeight=t,s(this)}))}))}disconnectedCallback(){var t;null===(t=this.layoutObserver)||void 0===t||t.disconnect(),this.layoutObserver=null}measureContentWidth(){var t;const i=null===(t=this.element.shadowRoot)||void 0===t?void 0:t.querySelectorAll("bn-chart-structure-renderer");let e=0,s=!1;return null==i||i.forEach((t=>{var i,a,r;const n=parseFloat(null!==(r=null===(a=null===(i=t.shadowRoot)||void 0===i?void 0:i.querySelector("svg#drawCanvas"))||void 0===a?void 0:a.getAttribute("width"))&&void 0!==r?r:"");Number.isNaN(n)||(e+=n,s=!0)})),s?Math.max(Math.floor(e),this.element.scrollWidth):this.element.scrollWidth}checkOverflow(){const t=U(this.element),i=this.measureContentWidth(),e=this.element.scrollHeight,s=t.width>0&&i>t.width+1,a=t.height>0&&e>t.height+1;if(!s&&!a)return void D(this.errors,null);const r=this.prepareVariances().some((t=>t.startsWith("dr"))),n="value"===j(this.unitScaling,this.pixelPerUnitGroupMap).kind,o=r&&"value"===j(this.percentageScaling,this.pixelPerUnitGroupMap).kind,{mode:l}=M(this.scale),c="auto"!==l&&"empty"!==l,h=[];s&&n&&h.push("unit-scaling"),s&&o&&h.push("percentage-scaling"),a&&c&&h.push("scale");const d=[];s&&d.push(`width (${Math.round(i)}px > ${Math.round(t.width)}px)`),a&&d.push(`height (${Math.round(e)}px > ${Math.round(t.height)}px)`),D(this.errors,`Chart exceeds available ${d.join(" and ")}. `+(h.length>0?`Adjust ${h.join(" / ")} or set to "auto".`:"Content does not fit even at minimum auto scaling; enlarge the container."),h.length>0)}prepareDimension(){const t=U(this.element),i=this.prepareVariances();return this.canvasWidthSegmented=t.width/(1+i.length),{width:this.canvasWidthSegmented,height:t.height}}prepareScenarios(){var t,i,e,s;const a=this.resolveInherited("scenarios",this.scenarios);if(a.inherited)return this.errors.remove("AUTO_scenarios"),a.value.split(",").map((t=>t.trim()));const r="auto"===(null===(t=a.value)||void 0===t?void 0:t.trim().toLowerCase());return d(a.value)||r?(null===(e=null===(i=this.datasetMeta)||void 0===i?void 0:i.availableScenarios)||void 0===e?void 0:e.length)>0?(r||a.unresolved?this.errors.remove("AUTO_scenarios"):this.errors.addOrReplace({id:"AUTO_scenarios",type:"warning",message:"scenarios: not set, auto-detected: "+this.datasetMeta.availableScenarios.join(",")}),this.datasetMeta.availableScenarios):[]:(this.errors.remove("AUTO_scenarios"),null===(s=a.value)||void 0===s?void 0:s.split(",").map((t=>t.trim())))}prepareVariances(){const t=this.resolveInherited("variances",this.variances).value;return d(t)?[]:null==t?void 0:t.split(",").map((t=>t.trim()))}prepareHideCategories(t){return t>=1||!this.showCategories}prepareI18n(){const t=l,i=new Map(["no-data","REST"].map((t=>[t,this.t(".".concat(t))]))),e=new Map(t.map((t=>[t,this.t("global.".concat(t))])));return new Map([...e.entries(),...i.entries(),..._(this.ruleSetConfig("user"))])}static describeScalingInput(t){return""===t?"not set":`invalid value "${t}"`}preparePixelPerUnit(){const i=j(this.unitScaling,this.pixelPerUnitGroupMap);return"value"===i.kind?(this.errors.remove("AUTO_unitScaling"),this.autoUnitWarningActive=!1,this.lastReportedUnitsPerEm=void 0,this.getEffectiveFontPx()/i.value):"auto"===i.kind?(this.errors.remove("AUTO_unitScaling"),this.autoUnitWarningActive=!1,this.lastReportedUnitsPerEm=void 0,0):(this.autoUnitWarningActive=!0,this.errors.addOrReplace({id:"AUTO_unitScaling",type:"warning",message:`unit-scaling: ${t.describeScalingInput(i.raw)}, auto-calculated to fit available space.`}),0)}preparePixelPerPercentage(){const i=j(this.percentageScaling,this.pixelPerUnitGroupMap);return"value"===i.kind?(this.errors.remove("AUTO_percentageScaling"),this.autoPctWarningActive=!1,this.lastReportedPpPerEm=void 0,100*this.getEffectiveFontPx()/i.value):"auto"===i.kind?(this.errors.remove("AUTO_percentageScaling"),this.autoPctWarningActive=!1,this.lastReportedPpPerEm=void 0,0):(this.autoPctWarningActive=!0,this.errors.addOrReplace({id:"AUTO_percentageScaling",type:"warning",message:`percentage-scaling: ${t.describeScalingInput(i.raw)}, auto-calculated to fit available space.`}),0)}prepareLevel(){var t,i,e;const s="auto"===(null===(t=this.level)||void 0===t?void 0:t.trim().toLowerCase());return d(this.level)||s?(null===(i=this.datasetMeta)||void 0===i?void 0:i.suggestedLevel)?(s?this.errors.remove("AUTO_level"):this.errors.addOrReplace({id:"AUTO_level",type:"warning",message:"level: not set, auto-detected: "+this.datasetMeta.suggestedLevel}),L[this.datasetMeta.suggestedLevel.toUpperCase()]):void 0:(this.errors.remove("AUTO_level"),L[null===(e=this.level)||void 0===e?void 0:e.toUpperCase()])}prepareOrder(){var t;const i=this.resolveInherited("order",this.order),e=i.value,s=this.resolveInherited("orderDirection",this.orderDirection).value,a="auto"===(null==e?void 0:e.trim().toLowerCase());let r;return d(e)||a?(null===(t=this.datasetMeta)||void 0===t?void 0:t.suggestedOrder)?(a||i.unresolved?this.errors.remove("AUTO_order"):this.errors.addOrReplace({id:"AUTO_order",type:"warning",message:"order: not set, auto-detected: "+this.datasetMeta.suggestedOrder}),r=this.datasetMeta.suggestedOrder):r=e:(this.errors.remove("AUTO_order"),r=e),{hierarchy:null==r?void 0:r.split(",").map((t=>E[null==t?void 0:t.toUpperCase()])),direction:$[null==s?void 0:s.toUpperCase()]}}prepareStyle(){const t=this.getEffectiveScaleFactor();return this.componentStyle((i=>{const e=i.global.fontSizePx*t;return{scaleFactors:{scenarioOffset:i["bn-chart-structure"].scaleFactors.scenarioOffset,scenarioLabelToBar:i["bn-chart-structure"].scaleFactors.scenarioLabelToBar,labelToBar:i["bn-chart-structure"].scaleFactors.labelToBar,labelToAxis:i["bn-chart-structure"].scaleFactors.labelToAxis,needleWidth:i["bn-chart-structure"].scaleFactors.needleWidth,needleHeadWidth:i["bn-chart-structure"].scaleFactors.needleHeadWidth,barWidth:i["bn-chart-structure"].scaleFactors.barWidth,varianceAxisLineWidth:i["bn-chart-structure"].scaleFactors.varianceAxisLineWidth,axisLineWidth:i["bn-chart-structure"].scaleFactors.axisLineWidth,auxiliaryLineWidth:i["bn-chart-structure"].scaleFactors.auxiliaryLineWidth,scenarioLineWidth:i["bn-chart-structure"].scaleFactors.scenarioLineWidth,markerWidth:i["bn-chart-structure"].scaleFactors.markerWidth,markerOffset:i["bn-chart-structure"].scaleFactors.markerOffset,categoryWidth:i["bn-chart-structure"].scaleFactors.categoryWidth,axisTickLength:i["bn-chart-structure"].scaleFactors.axisTickLength},fontStyles:{font:`${e}px ${i.global.fontFamily}`,family:i.global.fontFamily,size:e,color:i.global.fontColor,background:i.global.fontBackgroundColor,leading:1.8},axisStyles:i["bn-chart-structure"].axisStyles,barStyles:i["bn-chart-structure"].barStyles,varianceStyles:i["bn-chart-structure"].varianceStyles,stackColors:i["bn-chart-structure"].stackColors,padding:i["bn-chart-structure"].padding,pattern:null}}))}prepareChartTitle(t){return t>=1?"":this.chartTitle}prepareStackConfig(){if(d(this.stack))return this.errors.remove("WARN_stack_dimensions_scenarios"),null;try{const t=JSON.parse(this.stack),i=t.by,e="WARN_stack_dimensions_scenarios";if(i===C.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||P.ABSOLUTE,order:t.order||z.DATASET}}catch(t){return this.errors.remove("WARN_stack_dimensions_scenarios"),null}}prepareFilter(){return 0===this.filter.length?"":this.filter}prepareLimit(){return Math.floor(Number(this.limit)||0)}getDataStructure(){return{IStructureChartDataRow:{operation:{type:"string",isOptional:!1,description:""},rowGroup:{type:"string",isOptional:!1,description:""},rowGroupIndex:{type:"number",isOptional:!1,description:""},category:{type:"string",isOptional:!1,description:""},categoryIndex:{type:"number",isOptional:!1,description:""},subCategory:{type:"string",isOptional:!1,description:""},subCategoryIndex:{type:"number",isOptional:!1,description:""},columnGroup:{type:"string",isOptional:!1,description:""},columnGroupIndex:{type:"number",isOptional:!1,description:""},columnSubGroup:{type:"string",isOptional:!1,description:""},columnSubGroupIndex:{type:"number",isOptional:!1,description:""},ac1:{type:"number",isOptional:!1,description:""},ac2:{type:"number",isOptional:!1,description:""},ac3:{type:"number",isOptional:!1,description:""},ac4:{type:"number",isOptional:!1,description:""},pp1:{type:"number",isOptional:!1,description:""},pp2:{type:"number",isOptional:!1,description:""},pp3:{type:"number",isOptional:!1,description:""},pp4:{type:"number",isOptional:!1,description:""},fc1:{type:"number",isOptional:!1,description:""},fc2:{type:"number",isOptional:!1,description:""},fc3:{type:"number",isOptional:!1,description:""},fc4:{type:"number",isOptional:!1,description:""},pl1:{type:"number",isOptional:!1,description:""},pl2:{type:"number",isOptional:!1,description:""},pl3:{type:"number",isOptional:!1,description:""},pl4:{type:"number",isOptional:!1,description:""}}}}prepareMeasureScale(){return d(this.measureScale)?"GREATEST":["_","k","M","G","T","P","E","Z","Y","m","μ","n","p","P","f","a","z","y"].includes(this.measureScale.trim())||"LEAST"===this.measureScale.trim().toUpperCase()?this.measureScale.trim():"GREATEST"}prepareShowMeasureScale(t){return 0===t&&this.showMeasureScale}prepareMeasureUnit(){return""===this.measureUnit||null==this.measureUnit?"":this.measureUnit}chartTemplate(t,i){const e=this.preparePixelPerUnit(),s=this.preparePixelPerPercentage(),r=this.prepareStackConfig(),n=this.prepareScenarios(),o=(null==r?void 0:r.by)===C.DIMENSIONS?n.slice(0,1):n;return a("bn-chart-structure-renderer",{tableName:this.datasetName,dataVersion:this.dataVersion,chartTitle:this.prepareChartTitle(i),scenarios:o,variances:[t],hideCategories:this.prepareHideCategories(i),pixelPerUnit:e,pixelPerPercentage:s,reportAutoScaling:this.handleAutoScalingReport,errors:this.errors,limit:this.prepareLimit(),styles:this.prepareStyle(),i18n:this.prepareI18n(),order:this.prepareOrder(),level:this.prepareLevel(),filter:this.prepareFilter(),"measure-scale":this.prepareMeasureScale(),"measure-unit":this.prepareMeasureUnit(),showMeasureScale:this.prepareShowMeasureScale(i),stackConfig:r,parentDimensions:this.prepareDimension(),ruleSetConfig:this.ruleSetConfig()})}async getBaseline(){return q(this.element,"bn-chart-structure-renderer")}async getLayoutState(t){var i,e,s,a;const r=null!==(i=null==t?void 0:t.detail)&&void 0!==i?i:"summary",n=G(this.element),o=this.getEffectiveScaleFactor(),l=Number.isFinite(o)&&o>0?o:1,c=this.componentStyle((t=>{var i;return(null===(i=t.global)||void 0===i?void 0:i.fontSizePx)||13.3333}))*l,h=this.prepareVariances(),d=H(this.element,"bn-chart-structure-renderer",["base",...h],n,r),p=null===(e=this.element.shadowRoot)||void 0===e?void 0:e.querySelector("bn-chart-structure-renderer"),u={version:F,tag:this.element.localName,id:V(this.element),slot:null!==(s=this.element.getAttribute("slot"))&&void 0!==s?s:void 0,rect:I(this.element,n),em:{fontSizePx:c,appliedScaleFactor:l},regions:d.regions,metadata:{title:this.chartTitle||void 0,scenarios:null!==(a=null==p?void 0:p.scenarios)&&void 0!==a?a:[],variances:h,barCount:d.barCount,hasNoData:0===d.barCount},diagnostics:B(this.element),scaling:this.resolveScalingInfo(c),baseline:d.baseline};return d.elements&&(u.elements=d.elements),u}resolveScalingInfo(t){var i,e;const s={},a=j(this.unitScaling,this.pixelPerUnitGroupMap);if("value"===a.kind)s.unitMode="fixed",s.unitsPerEm=a.value,s.unitPxPerUnit=t/a.value;else{s.unitMode="auto";const e=null===(i=this.lastAutoScalingReport)||void 0===i?void 0:i.unit;void 0!==e&&e>0&&(s.unitPxPerUnit=e,s.unitsPerEm=t/e)}const r=j(this.percentageScaling,this.pixelPerUnitGroupMap);if("value"===r.kind)s.percentageMode="fixed",s.percentagePointsPerEm=r.value,s.percentagePxPerPoint=t/r.value;else{s.percentageMode="auto";const i=null===(e=this.lastAutoScalingReport)||void 0===e?void 0:e.percentage;void 0!==i&&i>0&&(s.percentagePxPerPoint=i/100,s.percentagePointsPerEm=100*t/i)}return s}getEffectiveScaleFactor(){const{mode:t,factor:i}=M(this.scale);return"factor"===t?i:"auto"===t||"empty"===t?this.appliedScaleFactor:1}getEffectiveFontPx(){return this.componentStyle((t=>{var i;return(null===(i=t.global)||void 0===i?void 0:i.fontSizePx)||13.3333}))*this.getEffectiveScaleFactor()}getFontStyles(){const t=this.getEffectiveScaleFactor();return this.componentStyle((i=>{var e,s,a,r;const n=(null===(e=i.global)||void 0===e?void 0:e.fontSizePx)||13.3333;return{"--bn-font-family":(null===(s=i.global)||void 0===s?void 0:s.fontFamily)||"'Noto Sans', sans-serif","--bn-font-size":n*t+"px","--bn-font-color":(null===(a=i.global)||void 0===a?void 0:a.fontColor)||"#000000","--bn-font-background":(null===(r=i.global)||void 0===r?void 0:r.fontBackgroundColor)||"#ffffff"}}))}render(){let t=[""];const i=this.prepareVariances();i.length>0&&(t=[...t,...i]);const e=this.getFontStyles();return a(r,{key:"467a851c6547b300c71a38e812bfea4718f27775",style:e},a("div",{key:"4b5078608132e047a9404987c65c46f43037c043",class:"container"},t.map(this.chartTemplate)))}get element(){return this}static get watchers(){return{filter:[{validateFilter:0}],scenarios:[{validateScenario:0}],variances:[{validateVariances:0}],unitScaling:[{validateUnitScaling:0}],percentageScaling:[{validatePercentageScaling:0}],level:[{validateLevel:0}],order:[{validateOrderList:0}],orderDirection:[{validateOrderDirection:0}],limit:[{validateLimit:0}],measureScale:[{validateMeasureScale:0}],stack:[{validateStack:0}],scale:[{validateScaling:0}]}}static get style(){return':host(.no-data){display:block;box-sizing:border-box;width:100%;height:100%}:host(.no-data)>div{float:none;width:100%;height:100%}:host(.no-data) .no-data~.no-data{display:none}.empty-state{box-sizing:border-box;display:flex;align-items:center;justify-content:center;float:none;width:100%;height:100%;min-height:3em;margin:0;padding:0.5em;overflow:hidden;border:0.1em dashed #ddd;color:#808080;font-family:var(--bn-font-family, "Noto Sans", sans-serif);font-size:var(--bn-font-size, 13.3333px);font-style:normal;text-align:center}:host{display:inline-block;position:relative;overflow:hidden;font-family:var(--bn-font-family, "Noto Sans", sans-serif);font-size:var(--bn-font-size, 13.3333px);color:var(--bn-font-color, #000000)}.container{display:flex;flex-direction:row}.background-image{display:flex;flex-wrap:wrap;justify-content:flex-end}.categories{text-align:right;font-size:var(--bn-font-size, 1em);font-family:var(--bn-font-family, "Noto Sans", "Helvetica Neue", Helvetica, sans-serif);color:var(--bn-font-color, black)}.label-bg{fill:var(--bn-font-background, white);opacity:0.7}.label-text{text-align:right;font-size:var(--bn-font-size, 1em);font-family:var(--bn-font-family, "Noto Sans", "Helvetica Neue", Helvetica, sans-serif);color:var(--bn-font-color, black)}.axis-title{text-align:center;font-family:var(--bn-font-family, "Noto Sans", "Helvetica Neue", Helvetica, sans-serif);color:var(--bn-font-color, black)}.axis-ac{stroke:black;stroke-width:0.1em}.axis-pp{stroke:grey;stroke-width:0.1em}.axis-fc{stroke:black;stroke-dasharray:2;stroke-width:0.1em}.axis-pl{stroke:white;stroke-width:0.1em;outline-offset:0em;outline:0.1em solid black}canvas{image-rendering:-moz-crisp-edges;image-rendering:-webkit-crisp-edges;image-rendering:pixelated;image-rendering:crisp-edges}.measure{font-weight:bold}span{display:inline-block}.hidePatternContainer{height:0;width:0}div{float:left}svg#drawCanvas{display:block}.footer{margin:0.2em;font-size:0.6em}.footer-hide{margin:0.2em;font-size:0.6em;opacity:0}'}},[1,"bn-chart-structure",{datasets:[513],selectedStyle:[513,"selected-style"],i18nNamespace:[513,"i18n-namespace"],chartTitle:[1,"chart-title"],ruleset:[513],filter:[1],scenarios:[1],variances:[1],unitScaling:[8,"unit-scaling"],percentageScaling:[8,"percentage-scaling"],level:[1],order:[1],orderDirection:[1,"order-direction"],limit:[2],showCategories:[4,"show-categories"],measureScale:[1,"measure-scale"],showMeasureScale:[4,"show-measure-scale"],measureUnit:[1,"measure-unit"],stack:[1],scale:[1],datasetName:[32],dataVersion:[32],datasetMeta:[32],appliedScaleFactor:[32],getBaseline:[64],getLayoutState:[64]},void 0,{filter:[{validateFilter:0}],scenarios:[{validateScenario:0}],variances:[{validateVariances:0}],unitScaling:[{validateUnitScaling:0}],percentageScaling:[{validatePercentageScaling:0}],level:[{validateLevel:0}],order:[{validateOrderList:0}],orderDirection:[{validateOrderDirection:0}],limit:[{validateLimit:0}],measureScale:[{validateMeasureScale:0}],stack:[{validateStack:0}],scale:[{validateScaling:0}]}]),Y=X,Q=function(){"undefined"!=typeof customElements&&["bn-chart-structure","bn-chart-structure-renderer"].forEach((t=>{switch(t){case"bn-chart-structure":customElements.get(n(t))||customElements.define(n(t),X);break;case"bn-chart-structure-renderer":customElements.get(n(t))||K()}}))};export{Y as BnChartStructure,Q as defineCustomElement}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{B as o,d as s}from"./p-
|
|
1
|
+
import{B as o,d as s}from"./p-BmOWXYHF.js";const m=o,p=s;export{m as BnChartTimeRenderer,p as defineCustomElement}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{p as t,H as i,w as e,f as s,h as a,a as n,t as r}from"./p-D6YGOYV1.js";import{h as o,a as l}from"./p-BcOud3dQ.js";import{v as h,a as d,n as c,i as p,f as u,h as v,m,o as g,l as f}from"./p-CYv_8LrR.js";import{w as y}from"./p-BVtD8O36.js";import{w as b}from"./p-DEHnizot.js";import{i as S,w,a as x}from"./p-B3F_c9GB.js";import{w as O}from"./p-D7X69xMg.js";import{w as M}from"./p-DLLljAll.js";import{w as A}from"./p-C6XrNN2m.js";import{V as _,r as L,F as N}from"./p-M6hn0BuZ.js";import{w as T}from"./p-BWRE5w0i.js";import{w as k,r as W}from"./p-CGI6XIaK.js";import{g as I}from"./p-DD1zlev_.js";import{r as j,f as R,p as C}from"./p-Xb6Ilq8u.js";import{o as U}from"./p-B6kka9sT.js";import{b as D,e as $,f as F,g as B,h as P}from"./p-D5LDmR4u.js";import{D as E}from"./p-xhiPDAZa.js";import{LAYOUT_STATE_VERSION as z}from"./index.js";import{o as G,m as V}from"./p-DSkyHSIL.js";import{r as H,a as X}from"./p-CckAR27O.js";import{a as Y}from"./p-GrpYAVHb.js";import{a as Z}from"./p-t4xPltK2.js";import{s as q}from"./p-DakXa7Dp.js";import{d as J}from"./p-nHZ8466v.js";const K=t(class t extends i{validateFilter(t){const i="ERR_filter";o(t)?this.errors.addOrReplace({id:i,type:"error",message:"filter: double backticks are not allowed."}):this.errors.remove(i)}validateScenario(t){const i="WARN_scenarios";if(S(t))return void this.errors.remove(i);const e=h(t);e.length>0?this.errors.addOrReplace({id:i,type:"warning",message:"scenarios: invalid value(s) '"+JSON.stringify(e)+"' are not supported."}):this.errors.remove(i)}validateVariances(t){const i="WARN_variances";if(S(t))return void this.errors.remove(i);const e=d(t);e.length>0?this.errors.addOrReplace({id:i,type:"warning",message:"variances: invalid value(s) '"+JSON.stringify(e)+"' are not supported."}):this.errors.remove(i)}validateLeftSync(t){const i="WARN_syncSpaceLeft";c(t)?this.errors.remove(i):this.errors.addOrReplace({id:i,type:"warning",message:"syncSpaceLeft: invalid value(s) '"+t+"' are not supported."})}validateUnitScaling(t){const i="WARN_unitScaling";p(t)?this.errors.remove(i):"invalid"===j(t,this.pixelPerUnitGroupMap).kind?this.errors.addOrReplace({id:i,type:"warning",message:"unitScaling: invalid value(s) '"+t+"' are not supported."}):this.errors.remove(i)}validatePercentageScaling(t){const i="WARN_percentageScaling";p(t)?this.errors.remove(i):"invalid"===j(t,this.pixelPerUnitGroupMap).kind?this.errors.addOrReplace({id:i,type:"warning",message:"percentageScaling: invalid value(s) '"+t+"' are not supported."}):this.errors.remove(i)}validateDateInterval(t){const i="WARN_dateInterval";p(t)||u(t)?this.errors.remove(i):this.errors.addOrReplace({id:i,type:"warning",message:"dateInterval: invalid value '"+(null==t?void 0:""+t)+"' is not supported."})}validateChartMode(t){const i="WARN_chartMode";["bar","line","auto"].includes(null==t?void 0:t.toLowerCase())?this.errors.remove(i):this.errors.addOrReplace({id:i,type:"warning",message:"chartMode: invalid value '"+(null==t?void 0:""+t)+"' is not supported. Valid values are: bar, line, auto."})}validateMaxBars(t){const i="WARN_maxBars";!v(t)||t<1?this.errors.addOrReplace({id:i,type:"warning",message:"maxBars: invalid value '"+(null==t?void 0:""+t)+"' is not supported. Must be a positive integer."}):this.errors.remove(i)}validateStack(t){const i="WARN_stack",e=m(t);e.length>0?this.errors.addOrReplace({id:i,type:"warning",message:e.join("; ")}):this.errors.remove(i)}validateScaling(t){if(null==t||""===t||"none"===t||"auto"===t)return void this.errors.remove("WARN_scale");const i=Number(t);isNaN(i)||i<=0?this.errors.addOrReplace({id:"WARN_scale",type:"warning",message:`Invalid scale value: "${t}". Use "none", "auto", or a positive number.`}):this.errors.remove("WARN_scale")}validateAxisLabelsMode(t){const i="WARN_axisLabelsMode";p(t)||g(t)?this.errors.remove(i):this.errors.addOrReplace({id:i,type:"warning",message:"axisLabelsMode: invalid value '"+(null==t?void 0:""+t)+"' is not supported."})}validateMeasureScale(t){const i="WARN_measureScale";f(t)?this.errors.remove(i):this.errors.addOrReplace({id:i,type:"warning",message:"measureScale: invalid value '"+(null==t?void 0:""+t)+"' is not supported."})}constructor(i){super(),!1!==i&&this.__registerHost(),this.__attachShadow(),this.datasetName="",this.dataVersion=0,this.datasetMeta=null,this.appliedScaleFactor=1,this.layoutObserver=null,this.chartTitle="",this.filter="",this.syncSpaceLeft=-1,this.chartMode="bar",this.maxBars=28,this.stack="",this.intervalSpanLimit=28,this.lineFullWidth=!0,this.showCategories=!0,this.measureScale="greatest",this.showMeasureScale=!1,this.showOverlayAvg=!0,this.showOverlayMedian=!1,this.measureUnit="",this.pixelPerUnitGroupMap=new Map,this._autoScaleGuard=!1,this._lastObservedWidth=0,this._settleTimer=null,this._lastAppliedHeight=0,this.autoUnitWarningActive=!1,this.autoPctWarningActive=!1,this.handleAutoScalingReport=i=>{var e,s,a,n,r,o;this.lastAutoScalingReport={unit:null!==(e=i.unit)&&void 0!==e?e:null===(s=this.lastAutoScalingReport)||void 0===s?void 0:s.unit,percentage:null!==(a=i.percentage)&&void 0!==a?a:null===(n=this.lastAutoScalingReport)||void 0===n?void 0:n.percentage};const l=(t,i)=>void 0===i||Math.abs(t-i)>.001*Math.abs(t),h=this.getEffectiveFontPx();if(void 0!==i.unit&&i.unit>0&&this.autoUnitWarningActive){const e=h/i.unit;l(e,this.lastReportedUnitsPerEm)&&(this.lastReportedUnitsPerEm=e,this.errors.addOrReplace({id:"AUTO_unitScaling",type:"warning",message:`unit-scaling: ${t.describeScalingInput(((null!==(r=this.unitScaling)&&void 0!==r?r:"")+"").trim())}, auto-fitted to 1 em ≈ ${R(e)} units.`}))}if(void 0!==i.percentage&&i.percentage>0&&this.autoPctWarningActive){const e=100*h/i.percentage;l(e,this.lastReportedPpPerEm)&&(this.lastReportedPpPerEm=e,this.errors.addOrReplace({id:"AUTO_percentageScaling",type:"warning",message:`percentage-scaling: ${t.describeScalingInput(((null!==(o=this.percentageScaling)&&void 0!==o?o:"")+"").trim())}, auto-fitted to 1 em ≈ ${R(e)} percentage points.`}))}},M(this),b(this),y(this,(t=>{this.datasetName=(null==t?void 0:t.startsWith("$"))?t.substring(1):t||"",this.dataVersion=this.dataVersion+1}),((t,i)=>{this.datasetMeta=i})),this.chartTemplate=this.chartTemplate.bind(this),this.errors=k(this),O(this),this.componentStyle=A(this),this.ruleSetConfig=T(this),this.t=w(this).t,this.resolveInherited=x(this,[{propName:"scenarios",ancestorAttr:"title-scenarios"},{propName:"variances",ancestorAttr:"title-variances"}],this.errors)}componentWillLoad(){this.validateFilter(this.filter),this.validateScenario(this.scenarios),this.validateVariances(this.variances),this.validateUnitScaling(this.unitScaling),this.validateLeftSync(this.syncSpaceLeft),this.validateDateInterval(this.dateInterval),this.validateAxisLabelsMode(this.axisLabelsMode),this.validateMeasureScale(this.measureScale),this.validateChartMode(this.chartMode),this.validateMaxBars(this.maxBars),this.validateStack(this.stack),this.validateScaling(this.scale)}measureContentWidth(){var t;const i=null===(t=this.element.shadowRoot)||void 0===t?void 0:t.querySelectorAll("bn-chart-time-renderer");let e=0,s=!1;return null==i||i.forEach((t=>{var i,a,n;const r=parseFloat(null!==(n=null===(a=null===(i=t.shadowRoot)||void 0===i?void 0:i.querySelector("svg#drawCanvas"))||void 0===a?void 0:a.getAttribute("width"))&&void 0!==n?n:"");Number.isNaN(r)||(e=Math.max(e,r),s=!0)})),s?Math.max(Math.floor(e),this.element.scrollWidth):this.element.scrollWidth}measureContentHeight(){var t;const i=null===(t=this.element.shadowRoot)||void 0===t?void 0:t.querySelectorAll("bn-chart-time-renderer");let e=0,s=!1;return null==i||i.forEach((t=>{var i,a,n;const r=parseFloat(null!==(n=null===(a=null===(i=t.shadowRoot)||void 0===i?void 0:i.querySelector("svg#drawCanvas"))||void 0===a?void 0:a.getAttribute("height"))&&void 0!==n?n:"");Number.isNaN(r)||(e+=r,s=!0)})),s?Math.max(Math.floor(e),this.element.scrollHeight):this.element.scrollHeight}checkOverflow(){const t=I(this.element),i=this.measureContentWidth(),e=this.measureContentHeight(),s=t.width>0&&i>t.width+1,a=t.height>0&&e>t.height+1;if(!s&&!a)return void W(this.errors,null);const n=this.prepareVariances().some((t=>t.startsWith("dr"))),r="value"===j(this.unitScaling,this.pixelPerUnitGroupMap).kind,o=n&&"value"===j(this.percentageScaling,this.pixelPerUnitGroupMap).kind,{mode:l}=C(this.scale),h="auto"!==l&&"empty"!==l,d=[];a&&r&&d.push("unit-scaling"),a&&o&&d.push("percentage-scaling"),s&&h&&d.push("scale");const c=[];s&&c.push(`width (${Math.round(i)}px > ${Math.round(t.width)}px)`),a&&c.push(`height (${Math.round(e)}px > ${Math.round(t.height)}px)`),W(this.errors,`Chart exceeds available ${c.join(" and ")}. `+(d.length>0?`Adjust ${d.join(" / ")} or set to "auto".`:"Content does not fit even at minimum auto scaling; enlarge the container."),d.length>0)}componentDidRender(){q(this.element,"bn-chart-time-renderer");const{mode:t}=C(this.scale);if("auto"!==t&&"empty"!==t)return this._autoScaleGuard=!1,void this.checkOverflow();if(this._autoScaleGuard)return this._autoScaleGuard=!1,void this.checkOverflow();const i=this.element,{width:s}=I(i);if(s<=0)return void this.checkOverflow();this._lastObservedWidth=s;const a=this.componentStyle((t=>{var i;return(null===(i=t.global)||void 0===i?void 0:i.fontSizePx)||13.3333})),n=i.scrollWidth,r=this.appliedScaleFactor;if(n<=s+1)return this.errors.remove("AUTO_scale"),void this.checkOverflow();const o=Math.max(.3,r*(s-1)/n);Math.abs(o-r)<.01||(i.style.setProperty("--bn-font-size",a*o+"px"),"empty"===t?this.errors.addOrReplace({id:"AUTO_scale",type:"warning",message:"Auto-scaled chart by factor "+o.toFixed(3)}):this.errors.remove("AUTO_scale"),this._autoScaleGuard=!0,e((()=>{this.appliedScaleFactor=o}))),this.checkOverflow()}componentDidLoad(){this.layoutObserver=U(this.element,(()=>{if(this._autoScaleGuard)return;const{width:t}=I(this.element);t>0&&Math.abs(t-this._lastObservedWidth)>2&&(this._lastObservedWidth=t,s(this))})),requestAnimationFrame((()=>{requestAnimationFrame((()=>{if(this._autoScaleGuard)return;const{width:t}=I(this.element);this._lastObservedWidth=t,s(this)}))})),this.settleParentHeight()}settleParentHeight(){const t=[150,400,1e3,2500],i=()=>{if(this._settleTimer=null,!this.element.isConnected)return;const{height:e}=I(this.element);e>0&&Math.abs(e-this._lastAppliedHeight)>8&&!this._autoScaleGuard&&s(this);const a=t.shift();void 0!==a&&(this._settleTimer=setTimeout(i,a))};this._settleTimer=setTimeout(i,t.shift())}disconnectedCallback(){var t;null===(t=this.layoutObserver)||void 0===t||t.disconnect(),this.layoutObserver=null,null!=this._settleTimer&&(clearTimeout(this._settleTimer),this._settleTimer=null)}prepareDimension(){const t=I(this.element),i=this.prepareScenarios(),e=this.prepareVariances();this.canvasWidthSegmented=t.width/(i.length+e.length||1),this._lastAppliedHeight=t.height;const s=1+e.length,a=this.showMeasureScale?this.getEffectiveFontPx():0;return{width:this.canvasWidthSegmented,height:Math.max(0,t.height-a)/s}}prepareScenarios(){var t,i,e,s;const a=this.resolveInherited("scenarios",this.scenarios);if(a.inherited)return this.errors.remove("AUTO_scenarios"),a.value.split(",").map((t=>t.trim()));const n="auto"===(null===(t=a.value)||void 0===t?void 0:t.trim().toLowerCase());return p(a.value)||n?(null===(e=null===(i=this.datasetMeta)||void 0===i?void 0:i.availableScenarios)||void 0===e?void 0:e.length)>0?(n||a.unresolved?this.errors.remove("AUTO_scenarios"):this.errors.addOrReplace({id:"AUTO_scenarios",type:"warning",message:"scenarios: not set, auto-detected: "+this.datasetMeta.availableScenarios.join(",")}),this.datasetMeta.availableScenarios):[]:(this.errors.remove("AUTO_scenarios"),null===(s=a.value)||void 0===s?void 0:s.split(",").map((t=>t.trim())))}prepareAvg(){return this.showOverlayAvg}prepareMedian(){return this.showOverlayMedian}prepareVariances(){const t=this.resolveInherited("variances",this.variances).value;return p(t)?[]:null==t?void 0:t.split(",").map((t=>t.trim()))}checkVarianceScenarios(t){const i="WARN_variances_scenario",e=this.prepareScenarios(),s=[];for(const i of t){const t=new _(i);if(t.isValid)for(const a of[t.base,t.delta])e.includes(a)||s.push(`'${i}' needs '${a}'`)}e.length>0&&s.length>0?this.errors.addOrReplace({id:i,type:"warning",message:`variances: ${s.join(", ")}, which is not in scenarios (${e.join(", ")}). The variance has no values.`}):this.errors.remove(i)}prepareHideAxisLabels(t){return t>=1||!this.showCategories}prepareI18n(){const t=l,i=new Map(["no-data"].map((t=>[t,this.t(".".concat(t))]))),e=new Map(t.map((t=>[t,this.t("global.".concat(t))])));return new Map([...e.entries(),...i.entries(),...L(this.ruleSetConfig("user"))])}static describeScalingInput(t){return""===t?"not set":`invalid value "${t}"`}preparePixelPerUnit(){const i=j(this.unitScaling,this.pixelPerUnitGroupMap);return"value"===i.kind?(this.errors.remove("AUTO_unitScaling"),this.autoUnitWarningActive=!1,this.lastReportedUnitsPerEm=void 0,this.getEffectiveFontPx()/i.value):"auto"===i.kind?(this.errors.remove("AUTO_unitScaling"),this.autoUnitWarningActive=!1,this.lastReportedUnitsPerEm=void 0,0):(this.autoUnitWarningActive=!0,this.errors.addOrReplace({id:"AUTO_unitScaling",type:"warning",message:`unit-scaling: ${t.describeScalingInput(i.raw)}, auto-calculated to fit available space.`}),0)}preparePixelPerPercentage(){const i=j(this.percentageScaling,this.pixelPerUnitGroupMap);return"value"===i.kind?(this.errors.remove("AUTO_percentageScaling"),this.autoPctWarningActive=!1,this.lastReportedPpPerEm=void 0,100*this.getEffectiveFontPx()/i.value):"auto"===i.kind?(this.errors.remove("AUTO_percentageScaling"),this.autoPctWarningActive=!1,this.lastReportedPpPerEm=void 0,0):(this.autoPctWarningActive=!0,this.errors.addOrReplace({id:"AUTO_percentageScaling",type:"warning",message:`percentage-scaling: ${t.describeScalingInput(i.raw)}, auto-calculated to fit available space.`}),0)}prepareStyle(){const t=this.getEffectiveScaleFactor();return this.componentStyle((i=>{const e=i.global.fontSizePx*t;return{scaleFactors:{scenarioOffset:i["bn-chart-time"].scaleFactors.scenarioOffset,scenarioLabelToColumn:i["bn-chart-time"].scaleFactors.scenarioLabelToColumn,labelToColumn:i["bn-chart-time"].scaleFactors.labelToColumn,labelToAxis:i["bn-chart-time"].scaleFactors.labelToAxis,needleWidth:i["bn-chart-time"].scaleFactors.needleWidth,needleHeadWidth:i["bn-chart-time"].scaleFactors.needleHeadWidth,columnWidth:i["bn-chart-time"].scaleFactors.columnWidth,varianceAxisLineWidth:i["bn-chart-time"].scaleFactors.varianceAxisLineWidth,axisLineWidth:i["bn-chart-time"].scaleFactors.axisLineWidth,auxiliaryLineWidth:i["bn-chart-time"].scaleFactors.auxiliaryLineWidth,scenarioLineWidth:i["bn-chart-time"].scaleFactors.scenarioLineWidth,markerWidth:i["bn-chart-time"].scaleFactors.markerWidth,markerOffset:i["bn-chart-time"].scaleFactors.markerOffset,categoryWidth:i["bn-chart-time"].scaleFactors.categoryWidth,axisTickLength:i["bn-chart-time"].scaleFactors.axisTickLength},fontStyles:{font:`${e}px ${i.global.fontFamily}`,family:i.global.fontFamily,size:e,color:i.global.fontColor,background:i.global.fontBackgroundColor,leading:1.8},axisStyles:i["bn-chart-time"].axisStyles,barStyles:i["bn-chart-time"].barStyles,varianceStyles:i["bn-chart-time"].varianceStyles,stackColors:i["bn-chart-time"].stackColors,padding:i["bn-chart-time"].padding,pattern:null,locale:"de"}}))}prepareLeftSideOffset(t,i){return this.syncSpaceLeft>-1?this.syncSpaceLeft:N.getMaxWidthOfArrayItems([...this.prepareVariances(),...this.prepareScenarios(),this.chartTitle],t,i)}prepareChartTitle(t){return t>=1?"":this.chartTitle}prepareDateInterval(){var t,i,e;const s="auto"===(null===(t=this.dateInterval)||void 0===t?void 0:t.trim().toLowerCase());return p(this.dateInterval)||s?(null===(i=this.datasetMeta)||void 0===i?void 0:i.suggestedDateInterval)?(s?this.errors.remove("AUTO_dateInterval"):this.errors.addOrReplace({id:"AUTO_dateInterval",type:"warning",message:"dateInterval: not set, auto-detected: "+this.datasetMeta.suggestedDateInterval}),E[this.datasetMeta.suggestedDateInterval.toUpperCase()]):s?E.AUTO:void 0:(this.errors.remove("AUTO_dateInterval"),E[null===(e=this.dateInterval)||void 0===e?void 0:e.toUpperCase()])}prepareIntervalSpanLimit(){const t=Number(this.intervalSpanLimit);return t>0?t:28}prepareAxisLabelsMode(){var t;return D[null===(t=this.axisLabelsMode)||void 0===t?void 0:t.toUpperCase()]}prepareFilter(){return 0===this.filter.length?"":this.filter}getDataStructure(){return{ITimeChartDataRow:{setName:{type:"string",isOptional:!1,description:""},date:{type:"string",isOptional:!1,description:""},operation:{type:"string",isOptional:!1,description:""},rowGroup:{type:"string",isOptional:!1,description:""},rowGroupIndex:{type:"number",isOptional:!1,description:""},category:{type:"string",isOptional:!1,description:""},categoryIndex:{type:"number",isOptional:!1,description:""},subCategory:{type:"string",isOptional:!1,description:""},subCategoryIndex:{type:"number",isOptional:!1,description:""},columnGroup:{type:"string",isOptional:!1,description:""},columnGroupIndex:{type:"number",isOptional:!1,description:""},columnSubGroup:{type:"string",isOptional:!1,description:""},columnSubGroupIndex:{type:"number",isOptional:!1,description:""},ac1:{type:"number",isOptional:!1,description:""},ac2:{type:"number",isOptional:!1,description:""},ac3:{type:"number",isOptional:!1,description:""},ac4:{type:"number",isOptional:!1,description:""},pp1:{type:"number",isOptional:!1,description:""},pp2:{type:"number",isOptional:!1,description:""},pp3:{type:"number",isOptional:!1,description:""},pp4:{type:"number",isOptional:!1,description:""},fc1:{type:"number",isOptional:!1,description:""},fc2:{type:"number",isOptional:!1,description:""},fc3:{type:"number",isOptional:!1,description:""},fc4:{type:"number",isOptional:!1,description:""},pl1:{type:"number",isOptional:!1,description:""},pl2:{type:"number",isOptional:!1,description:""},pl3:{type:"number",isOptional:!1,description:""},pl4:{type:"number",isOptional:!1,description:""}}}}prepareMeasureScale(){return p(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&&this.showMeasureScale}prepareMeasureUnit(){return""===this.measureUnit||null==this.measureUnit?"":this.measureUnit}prepareStackConfig(){if(p(this.stack))return this.errors.remove("WARN_stack_dimensions_scenarios"),null;try{const t=JSON.parse(this.stack),i=t.by,e="WARN_stack_dimensions_scenarios";if(i===$.DIMENSIONS){const t=this.prepareScenarios();t.length>1?this.errors.addOrReplace({id:e,type:"warning",message:`stack by dimensions: only the first scenario "${t[0]}" is used, the rest (${t.slice(1).join(", ")}) are discarded.`}):this.errors.remove(e)}else this.errors.remove(e);return{by:i,mode:t.mode||B.ABSOLUTE,order:t.order||F.DATASET}}catch(t){return this.errors.remove("WARN_stack_dimensions_scenarios"),null}}prepareLineFullWidth(){return this.lineFullWidth}prepareChartMode(){var t;const i=null===(t=this.chartMode)||void 0===t?void 0:t.toLowerCase();return"line"===i?P.LINE:"auto"===i?P.AUTO:P.BAR}prepareMaxBars(){return Math.floor(Number(this.maxBars)||28)}chartTemplate(t,i){const e=this.prepareI18n(),s=this.prepareStyle(),n=I(this.element).width,r=this.preparePixelPerUnit(),o=this.preparePixelPerPercentage(),l=this.prepareStackConfig(),h=this.prepareScenarios(),d=(null==l?void 0:l.by)===$.DIMENSIONS?h.slice(0,1):h;return a("bn-chart-time-renderer",{tableName:this.datasetName,dataVersion:this.dataVersion,chartTitle:this.prepareChartTitle(i),scenarios:d,variances:[t],hideAxisLabels:this.prepareHideAxisLabels(i),pixelPerUnit:r,pixelPerPercentage:o,reportAutoScaling:this.handleAutoScalingReport,errors:this.errors,leftSideOffsetForHorizontalSync:this.prepareLeftSideOffset(e,s),styles:s,i18n:e,dateInterval:this.prepareDateInterval(),intervalSpanLimit:this.prepareIntervalSpanLimit(),axisLabelsMode:this.prepareAxisLabelsMode(),filter:this.prepareFilter(),"measure-scale":this.prepareMeasureScale(),"measure-unit":this.prepareMeasureUnit(),showOverlayAvg:this.prepareAvg(),showOverlayMedian:this.prepareMedian(),showMeasureScale:this.prepareShowMeasureScale(i),chartMode:this.prepareChartMode(),maxBars:this.prepareMaxBars(),stackConfig:l,lineFullWidth:this.prepareLineFullWidth(),containerWidth:n,parentDimensions:this.prepareDimension(),ruleSetConfig:this.ruleSetConfig()})}async getBaseline(){return Z(this.element,"bn-chart-time-renderer")}async getLayoutState(t){var i,e,s,a;const n=null!==(i=null==t?void 0:t.detail)&&void 0!==i?i:"summary",r=G(this.element),o=this.getEffectiveScaleFactor(),l=Number.isFinite(o)&&o>0?o:1,h=this.componentStyle((t=>{var i;return(null===(i=t.global)||void 0===i?void 0:i.fontSizePx)||13.3333}))*l,d=this.prepareVariances(),c=Y(this.element,"bn-chart-time-renderer",["base",...d],r,n),p=null===(e=this.element.shadowRoot)||void 0===e?void 0:e.querySelector("bn-chart-time-renderer"),u={version:z,tag:this.element.localName,id:X(this.element),slot:null!==(s=this.element.getAttribute("slot"))&&void 0!==s?s:void 0,rect:V(this.element,r),em:{fontSizePx:h,appliedScaleFactor:l},regions:c.regions,metadata:{title:this.chartTitle||void 0,scenarios:null!==(a=null==p?void 0:p.scenarios)&&void 0!==a?a:[],variances:d,barCount:c.barCount,chartMode:this.chartMode||void 0,hasNoData:0===c.barCount},diagnostics:H(this.element),scaling:this.resolveScalingInfo(h),baseline:c.baseline};return c.elements&&(u.elements=c.elements),u}resolveScalingInfo(t){var i,e;const s={},a=j(this.unitScaling,this.pixelPerUnitGroupMap);if("value"===a.kind)s.unitMode="fixed",s.unitsPerEm=a.value,s.unitPxPerUnit=t/a.value;else{s.unitMode="auto";const e=null===(i=this.lastAutoScalingReport)||void 0===i?void 0:i.unit;void 0!==e&&e>0&&(s.unitPxPerUnit=e,s.unitsPerEm=t/e)}const n=j(this.percentageScaling,this.pixelPerUnitGroupMap);if("value"===n.kind)s.percentageMode="fixed",s.percentagePointsPerEm=n.value,s.percentagePxPerPoint=t/n.value;else{s.percentageMode="auto";const i=null===(e=this.lastAutoScalingReport)||void 0===e?void 0:e.percentage;void 0!==i&&i>0&&(s.percentagePxPerPoint=i/100,s.percentagePointsPerEm=100*t/i)}return s}getEffectiveScaleFactor(){const{mode:t,factor:i}=C(this.scale);return"factor"===t?i:"auto"===t||"empty"===t?this.appliedScaleFactor:1}getEffectiveFontPx(){return this.componentStyle((t=>{var i;return(null===(i=t.global)||void 0===i?void 0:i.fontSizePx)||13.3333}))*this.getEffectiveScaleFactor()}getFontStyles(){const t=this.getEffectiveScaleFactor();return this.componentStyle((i=>{var e,s,a,n;const r=(null===(e=i.global)||void 0===e?void 0:e.fontSizePx)||13.3333;return{"--bn-font-family":(null===(s=i.global)||void 0===s?void 0:s.fontFamily)||"'Noto Sans', sans-serif","--bn-font-size":r*t+"px","--bn-font-color":(null===(a=i.global)||void 0===a?void 0:a.fontColor)||"#000000","--bn-font-background":(null===(n=i.global)||void 0===n?void 0:n.fontBackgroundColor)||"#ffffff"}}))}render(){let t=[""];const i=this.prepareVariances();this.checkVarianceScenarios(i),i.length>0&&(t=[...t,...i]);const e=this.getFontStyles();return a(n,{key:"37085b275bb92d716a31f79f15b9f2517f1c596b",style:e},a("div",{key:"93e9eacc22334da1deed871db640d6fd4aafb153",class:"container"},t.map(this.chartTemplate)))}get element(){return this}static get watchers(){return{filter:[{validateFilter:0}],scenarios:[{validateScenario:0}],variances:[{validateVariances:0}],syncSpaceLeft:[{validateLeftSync:0}],unitScaling:[{validateUnitScaling:0}],percentageScaling:[{validatePercentageScaling:0}],dateInterval:[{validateDateInterval:0}],chartMode:[{validateChartMode:0}],maxBars:[{validateMaxBars:0}],stack:[{validateStack:0}],scale:[{validateScaling:0}],axisLabelsMode:[{validateAxisLabelsMode:0}],measureScale:[{validateMeasureScale:0}]}}static get style(){return':host(.no-data){display:block;box-sizing:border-box;width:100%;height:100%}:host(.no-data)>div{float:none;width:100%;height:100%}:host(.no-data) .no-data~.no-data{display:none}.empty-state{box-sizing:border-box;display:flex;align-items:center;justify-content:center;float:none;width:100%;height:100%;min-height:3em;margin:0;padding:0.5em;overflow:hidden;border:0.1em dashed #ddd;color:#808080;font-family:var(--bn-font-family, "Noto Sans", sans-serif);font-size:var(--bn-font-size, 13.3333px);font-style:normal;text-align:center}:host{display:inline-block;position:relative;overflow:hidden;font-family:var(--bn-font-family, "Noto Sans", sans-serif);font-size:var(--bn-font-size, 13.3333px);color:var(--bn-font-color, #000000)}.container{display:flex;flex-direction:column-reverse}.background-image{display:flex;flex-wrap:wrap;justify-content:flex-end}'}},[1,"bn-chart-time",{datasets:[513],selectedStyle:[513,"selected-style"],i18nNamespace:[513,"i18n-namespace"],ruleset:[513],chartTitle:[1,"chart-title"],filter:[1],scenarios:[1],variances:[1],syncSpaceLeft:[2,"sync-space-left"],unitScaling:[8,"unit-scaling"],percentageScaling:[8,"percentage-scaling"],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:[4,"line-full-width"],showCategories:[4,"show-categories"],measureScale:[1,"measure-scale"],showMeasureScale:[4,"show-measure-scale"],showOverlayAvg:[4,"show-overlay-avg"],showOverlayMedian:[4,"show-overlay-median"],measureUnit:[1,"measure-unit"],datasetName:[32],dataVersion:[32],datasetMeta:[32],appliedScaleFactor:[32],getBaseline:[64],getLayoutState:[64]},void 0,{filter:[{validateFilter:0}],scenarios:[{validateScenario:0}],variances:[{validateVariances:0}],syncSpaceLeft:[{validateLeftSync:0}],unitScaling:[{validateUnitScaling:0}],percentageScaling:[{validatePercentageScaling:0}],dateInterval:[{validateDateInterval:0}],chartMode:[{validateChartMode:0}],maxBars:[{validateMaxBars:0}],stack:[{validateStack:0}],scale:[{validateScaling:0}],axisLabelsMode:[{validateAxisLabelsMode:0}],measureScale:[{validateMeasureScale:0}]}]),Q=K,tt=function(){"undefined"!=typeof customElements&&["bn-chart-time","bn-chart-time-renderer"].forEach((t=>{switch(t){case"bn-chart-time":customElements.get(r(t))||customElements.define(r(t),K);break;case"bn-chart-time-renderer":customElements.get(r(t))||J()}}))};export{Q as BnChartTime,tt as defineCustomElement}
|
|
1
|
+
import{p as t,H as i,w as e,f as s,h as a,a as n,t as r}from"./p-D6YGOYV1.js";import{h as o,a as l}from"./p-DDvWTgk1.js";import{v as h,a as d,n as c,i as p,f as u,h as v,m,o as g,l as f}from"./p-DT04Cka0.js";import{w as y}from"./p-DJUffGeB.js";import{w as b}from"./p-Dq9dG0Kr.js";import{i as S,w,a as x}from"./p-BU_53KVT.js";import{w as O}from"./p-DQl2K2Xl.js";import{w as M}from"./p-Bo_R7f_T.js";import{w as A}from"./p-DjPWZfry.js";import{V as _,r as T,F as N}from"./p-CniN8ALm.js";import{w as L}from"./p-OquycEMA.js";import{w as k,r as W}from"./p-4vVbchX2.js";import{g as j}from"./p-DD1zlev_.js";import{r as U,f as C,p as D}from"./p-Xb6Ilq8u.js";import{o as I}from"./p-B6kka9sT.js";import{b as R,e as $,f as F,g as P,h as B}from"./p-B5tixDPM.js";import{D as E}from"./p-sLbQ7yZ1.js";import{LAYOUT_STATE_VERSION as z}from"./index.js";import{o as G,m as V}from"./p-DaOm9YwQ.js";import{r as H,a as q}from"./p-CckAR27O.js";import{a as X}from"./p-sar8m7th.js";import{a as Y}from"./p-t4xPltK2.js";import{s as J}from"./p-DakXa7Dp.js";import{d as K}from"./p-BmOWXYHF.js";const Q=t(class t extends i{validateFilter(t){const i="ERR_filter";o(t)?this.errors.addOrReplace({id:i,type:"error",message:"filter: double backticks are not allowed."}):this.errors.remove(i)}validateScenario(t){const i="WARN_scenarios";if(S(t))return void this.errors.remove(i);const e=h(t);e.length>0?this.errors.addOrReplace({id:i,type:"warning",message:"scenarios: invalid value(s) '"+JSON.stringify(e)+"' are not supported."}):this.errors.remove(i)}validateVariances(t){const i="WARN_variances";if(S(t))return void this.errors.remove(i);const e=d(t);e.length>0?this.errors.addOrReplace({id:i,type:"warning",message:"variances: invalid value(s) '"+JSON.stringify(e)+"' are not supported."}):this.errors.remove(i)}validateLeftSync(t){const i="WARN_syncSpaceLeft";c(t)?this.errors.remove(i):this.errors.addOrReplace({id:i,type:"warning",message:"syncSpaceLeft: invalid value(s) '"+t+"' are not supported."})}validateUnitScaling(t){const i="WARN_unitScaling";p(t)?this.errors.remove(i):"invalid"===U(t,this.pixelPerUnitGroupMap).kind?this.errors.addOrReplace({id:i,type:"warning",message:"unitScaling: invalid value(s) '"+t+"' are not supported."}):this.errors.remove(i)}validatePercentageScaling(t){const i="WARN_percentageScaling";p(t)?this.errors.remove(i):"invalid"===U(t,this.pixelPerUnitGroupMap).kind?this.errors.addOrReplace({id:i,type:"warning",message:"percentageScaling: invalid value(s) '"+t+"' are not supported."}):this.errors.remove(i)}validateDateInterval(t){const i="WARN_dateInterval";p(t)||u(t)?this.errors.remove(i):this.errors.addOrReplace({id:i,type:"warning",message:"dateInterval: invalid value '"+(null==t?void 0:""+t)+"' is not supported."})}validateChartMode(t){const i="WARN_chartMode";["bar","line","auto"].includes(null==t?void 0:t.toLowerCase())?this.errors.remove(i):this.errors.addOrReplace({id:i,type:"warning",message:"chartMode: invalid value '"+(null==t?void 0:""+t)+"' is not supported. Valid values are: bar, line, auto."})}validateMaxBars(t){const i="WARN_maxBars";!v(t)||t<1?this.errors.addOrReplace({id:i,type:"warning",message:"maxBars: invalid value '"+(null==t?void 0:""+t)+"' is not supported. Must be a positive integer."}):this.errors.remove(i)}validateStack(t){const i="WARN_stack",e=m(t);e.length>0?this.errors.addOrReplace({id:i,type:"warning",message:e.join("; ")}):this.errors.remove(i)}validateScaling(t){if(null==t||""===t||"none"===t||"auto"===t)return void this.errors.remove("WARN_scale");const i=Number(t);isNaN(i)||i<=0?this.errors.addOrReplace({id:"WARN_scale",type:"warning",message:`Invalid scale value: "${t}". Use "none", "auto", or a positive number.`}):this.errors.remove("WARN_scale")}validateAxisLabelsMode(t){const i="WARN_axisLabelsMode";p(t)||g(t)?this.errors.remove(i):this.errors.addOrReplace({id:i,type:"warning",message:"axisLabelsMode: invalid value '"+(null==t?void 0:""+t)+"' is not supported."})}validateMeasureScale(t){const i="WARN_measureScale";f(t)?this.errors.remove(i):this.errors.addOrReplace({id:i,type:"warning",message:"measureScale: invalid value '"+(null==t?void 0:""+t)+"' is not supported."})}constructor(i){super(),!1!==i&&this.__registerHost(),this.__attachShadow(),this.datasetName="",this.dataVersion=0,this.datasetMeta=null,this.appliedScaleFactor=1,this.layoutObserver=null,this.chartTitle="",this.filter="",this.syncSpaceLeft=-1,this.chartMode="bar",this.maxBars=28,this.stack="",this.intervalSpanLimit=28,this.lineFullWidth=!0,this.showCategories=!0,this.measureScale="greatest",this.showMeasureScale=!1,this.showOverlayAvg=!0,this.showOverlayMedian=!1,this.measureUnit="",this.pixelPerUnitGroupMap=new Map,this._autoScaleGuard=!1,this._lastObservedWidth=0,this._settleTimer=null,this._lastAppliedHeight=0,this.autoUnitWarningActive=!1,this.autoPctWarningActive=!1,this.handleAutoScalingReport=i=>{var e,s,a,n,r,o;this.lastAutoScalingReport={unit:null!==(e=i.unit)&&void 0!==e?e:null===(s=this.lastAutoScalingReport)||void 0===s?void 0:s.unit,percentage:null!==(a=i.percentage)&&void 0!==a?a:null===(n=this.lastAutoScalingReport)||void 0===n?void 0:n.percentage};const l=(t,i)=>void 0===i||Math.abs(t-i)>.001*Math.abs(t),h=this.getEffectiveFontPx();if(void 0!==i.unit&&i.unit>0&&this.autoUnitWarningActive){const e=h/i.unit;l(e,this.lastReportedUnitsPerEm)&&(this.lastReportedUnitsPerEm=e,this.errors.addOrReplace({id:"AUTO_unitScaling",type:"warning",message:`unit-scaling: ${t.describeScalingInput(((null!==(r=this.unitScaling)&&void 0!==r?r:"")+"").trim())}, auto-fitted to 1 em ≈ ${C(e)} units.`}))}if(void 0!==i.percentage&&i.percentage>0&&this.autoPctWarningActive){const e=100*h/i.percentage;l(e,this.lastReportedPpPerEm)&&(this.lastReportedPpPerEm=e,this.errors.addOrReplace({id:"AUTO_percentageScaling",type:"warning",message:`percentage-scaling: ${t.describeScalingInput(((null!==(o=this.percentageScaling)&&void 0!==o?o:"")+"").trim())}, auto-fitted to 1 em ≈ ${C(e)} percentage points.`}))}},M(this),b(this),y(this,(t=>{this.datasetName=(null==t?void 0:t.startsWith("$"))?t.substring(1):t||"",this.dataVersion=this.dataVersion+1}),((t,i)=>{this.datasetMeta=i})),this.chartTemplate=this.chartTemplate.bind(this),this.errors=k(this),O(this),this.componentStyle=A(this),this.ruleSetConfig=L(this),this.t=w(this).t,this.resolveInherited=x(this,[{propName:"scenarios",ancestorAttr:"title-scenarios"},{propName:"variances",ancestorAttr:"title-variances"}],this.errors)}componentWillLoad(){this.validateFilter(this.filter),this.validateScenario(this.scenarios),this.validateVariances(this.variances),this.validateUnitScaling(this.unitScaling),this.validateLeftSync(this.syncSpaceLeft),this.validateDateInterval(this.dateInterval),this.validateAxisLabelsMode(this.axisLabelsMode),this.validateMeasureScale(this.measureScale),this.validateChartMode(this.chartMode),this.validateMaxBars(this.maxBars),this.validateStack(this.stack),this.validateScaling(this.scale)}measureContentWidth(){var t;const i=null===(t=this.element.shadowRoot)||void 0===t?void 0:t.querySelectorAll("bn-chart-time-renderer");let e=0,s=!1;return null==i||i.forEach((t=>{var i,a,n;const r=parseFloat(null!==(n=null===(a=null===(i=t.shadowRoot)||void 0===i?void 0:i.querySelector("svg#drawCanvas"))||void 0===a?void 0:a.getAttribute("width"))&&void 0!==n?n:"");Number.isNaN(r)||(e=Math.max(e,r),s=!0)})),s?Math.max(Math.floor(e),this.element.scrollWidth):this.element.scrollWidth}measureContentHeight(){var t;const i=null===(t=this.element.shadowRoot)||void 0===t?void 0:t.querySelectorAll("bn-chart-time-renderer");let e=0,s=!1;return null==i||i.forEach((t=>{var i,a,n;const r=parseFloat(null!==(n=null===(a=null===(i=t.shadowRoot)||void 0===i?void 0:i.querySelector("svg#drawCanvas"))||void 0===a?void 0:a.getAttribute("height"))&&void 0!==n?n:"");Number.isNaN(r)||(e+=r,s=!0)})),s?Math.max(Math.floor(e),this.element.scrollHeight):this.element.scrollHeight}checkOverflow(){const t=j(this.element),i=this.measureContentWidth(),e=this.measureContentHeight(),s=t.width>0&&i>t.width+1,a=t.height>0&&e>t.height+1;if(!s&&!a)return void W(this.errors,null);const n=this.prepareVariances().some((t=>t.startsWith("dr"))),r="value"===U(this.unitScaling,this.pixelPerUnitGroupMap).kind,o=n&&"value"===U(this.percentageScaling,this.pixelPerUnitGroupMap).kind,{mode:l}=D(this.scale),h="auto"!==l&&"empty"!==l,d=[];a&&r&&d.push("unit-scaling"),a&&o&&d.push("percentage-scaling"),s&&h&&d.push("scale");const c=[];s&&c.push(`width (${Math.round(i)}px > ${Math.round(t.width)}px)`),a&&c.push(`height (${Math.round(e)}px > ${Math.round(t.height)}px)`),W(this.errors,`Chart exceeds available ${c.join(" and ")}. `+(d.length>0?`Adjust ${d.join(" / ")} or set to "auto".`:"Content does not fit even at minimum auto scaling; enlarge the container."),d.length>0)}componentDidRender(){J(this.element,"bn-chart-time-renderer");const{mode:t}=D(this.scale);if("auto"!==t&&"empty"!==t)return this._autoScaleGuard=!1,void this.checkOverflow();if(this._autoScaleGuard)return this._autoScaleGuard=!1,void this.checkOverflow();const i=this.element,{width:s}=j(i);if(s<=0)return void this.checkOverflow();this._lastObservedWidth=s;const a=this.componentStyle((t=>{var i;return(null===(i=t.global)||void 0===i?void 0:i.fontSizePx)||13.3333})),n=i.scrollWidth,r=this.appliedScaleFactor;if(n<=s+1)return this.errors.remove("AUTO_scale"),void this.checkOverflow();const o=Math.max(.3,r*(s-1)/n);Math.abs(o-r)<.01||(i.style.setProperty("--bn-font-size",a*o+"px"),"empty"===t?this.errors.addOrReplace({id:"AUTO_scale",type:"warning",message:"Auto-scaled chart by factor "+o.toFixed(3)}):this.errors.remove("AUTO_scale"),this._autoScaleGuard=!0,e((()=>{this.appliedScaleFactor=o}))),this.checkOverflow()}componentDidLoad(){this.layoutObserver=I(this.element,(()=>{if(this._autoScaleGuard)return;const{width:t}=j(this.element);t>0&&Math.abs(t-this._lastObservedWidth)>2&&(this._lastObservedWidth=t,s(this))})),requestAnimationFrame((()=>{requestAnimationFrame((()=>{if(this._autoScaleGuard)return;const{width:t}=j(this.element);this._lastObservedWidth=t,s(this)}))})),this.settleParentHeight()}settleParentHeight(){const t=[150,400,1e3,2500],i=()=>{if(this._settleTimer=null,!this.element.isConnected)return;const{height:e}=j(this.element);e>0&&Math.abs(e-this._lastAppliedHeight)>8&&!this._autoScaleGuard&&s(this);const a=t.shift();void 0!==a&&(this._settleTimer=setTimeout(i,a))};this._settleTimer=setTimeout(i,t.shift())}disconnectedCallback(){var t;null===(t=this.layoutObserver)||void 0===t||t.disconnect(),this.layoutObserver=null,null!=this._settleTimer&&(clearTimeout(this._settleTimer),this._settleTimer=null)}prepareDimension(){const t=j(this.element),i=this.prepareScenarios(),e=this.prepareVariances();this.canvasWidthSegmented=t.width/(i.length+e.length||1),this._lastAppliedHeight=t.height;const s=1+e.length,a=this.showMeasureScale?this.getEffectiveFontPx():0;return{width:this.canvasWidthSegmented,height:Math.max(0,t.height-a)/s}}prepareScenarios(){var t,i,e,s;const a=this.resolveInherited("scenarios",this.scenarios);if(a.inherited)return this.errors.remove("AUTO_scenarios"),a.value.split(",").map((t=>t.trim()));const n="auto"===(null===(t=a.value)||void 0===t?void 0:t.trim().toLowerCase());return p(a.value)||n?(null===(e=null===(i=this.datasetMeta)||void 0===i?void 0:i.availableScenarios)||void 0===e?void 0:e.length)>0?(n||a.unresolved?this.errors.remove("AUTO_scenarios"):this.errors.addOrReplace({id:"AUTO_scenarios",type:"warning",message:"scenarios: not set, auto-detected: "+this.datasetMeta.availableScenarios.join(",")}),this.datasetMeta.availableScenarios):[]:(this.errors.remove("AUTO_scenarios"),null===(s=a.value)||void 0===s?void 0:s.split(",").map((t=>t.trim())))}prepareAvg(){return this.showOverlayAvg}prepareMedian(){return this.showOverlayMedian}prepareVariances(){const t=this.resolveInherited("variances",this.variances).value;return p(t)?[]:null==t?void 0:t.split(",").map((t=>t.trim()))}checkVarianceScenarios(t){const i="WARN_variances_scenario",e=this.prepareScenarios(),s=[];for(const i of t){const t=new _(i);if(t.isValid)for(const a of[t.base,t.delta])e.includes(a)||s.push(`'${i}' needs '${a}'`)}e.length>0&&s.length>0?this.errors.addOrReplace({id:i,type:"warning",message:`variances: ${s.join(", ")}, which is not in scenarios (${e.join(", ")}). The variance has no values.`}):this.errors.remove(i)}prepareHideAxisLabels(t){return t>=1||!this.showCategories}prepareI18n(){const t=l,i=new Map(["no-data"].map((t=>[t,this.t(".".concat(t))]))),e=new Map(t.map((t=>[t,this.t("global.".concat(t))])));return new Map([...e.entries(),...i.entries(),...T(this.ruleSetConfig("user"))])}static describeScalingInput(t){return""===t?"not set":`invalid value "${t}"`}preparePixelPerUnit(){const i=U(this.unitScaling,this.pixelPerUnitGroupMap);return"value"===i.kind?(this.errors.remove("AUTO_unitScaling"),this.autoUnitWarningActive=!1,this.lastReportedUnitsPerEm=void 0,this.getEffectiveFontPx()/i.value):"auto"===i.kind?(this.errors.remove("AUTO_unitScaling"),this.autoUnitWarningActive=!1,this.lastReportedUnitsPerEm=void 0,0):(this.autoUnitWarningActive=!0,this.errors.addOrReplace({id:"AUTO_unitScaling",type:"warning",message:`unit-scaling: ${t.describeScalingInput(i.raw)}, auto-calculated to fit available space.`}),0)}preparePixelPerPercentage(){const i=U(this.percentageScaling,this.pixelPerUnitGroupMap);return"value"===i.kind?(this.errors.remove("AUTO_percentageScaling"),this.autoPctWarningActive=!1,this.lastReportedPpPerEm=void 0,100*this.getEffectiveFontPx()/i.value):"auto"===i.kind?(this.errors.remove("AUTO_percentageScaling"),this.autoPctWarningActive=!1,this.lastReportedPpPerEm=void 0,0):(this.autoPctWarningActive=!0,this.errors.addOrReplace({id:"AUTO_percentageScaling",type:"warning",message:`percentage-scaling: ${t.describeScalingInput(i.raw)}, auto-calculated to fit available space.`}),0)}prepareStyle(){const t=this.getEffectiveScaleFactor();return this.componentStyle((i=>{const e=i.global.fontSizePx*t;return{scaleFactors:{scenarioOffset:i["bn-chart-time"].scaleFactors.scenarioOffset,scenarioLabelToColumn:i["bn-chart-time"].scaleFactors.scenarioLabelToColumn,labelToColumn:i["bn-chart-time"].scaleFactors.labelToColumn,labelToAxis:i["bn-chart-time"].scaleFactors.labelToAxis,needleWidth:i["bn-chart-time"].scaleFactors.needleWidth,needleHeadWidth:i["bn-chart-time"].scaleFactors.needleHeadWidth,columnWidth:i["bn-chart-time"].scaleFactors.columnWidth,varianceAxisLineWidth:i["bn-chart-time"].scaleFactors.varianceAxisLineWidth,axisLineWidth:i["bn-chart-time"].scaleFactors.axisLineWidth,auxiliaryLineWidth:i["bn-chart-time"].scaleFactors.auxiliaryLineWidth,scenarioLineWidth:i["bn-chart-time"].scaleFactors.scenarioLineWidth,markerWidth:i["bn-chart-time"].scaleFactors.markerWidth,markerOffset:i["bn-chart-time"].scaleFactors.markerOffset,categoryWidth:i["bn-chart-time"].scaleFactors.categoryWidth,axisTickLength:i["bn-chart-time"].scaleFactors.axisTickLength},fontStyles:{font:`${e}px ${i.global.fontFamily}`,family:i.global.fontFamily,size:e,color:i.global.fontColor,background:i.global.fontBackgroundColor,leading:1.8},axisStyles:i["bn-chart-time"].axisStyles,barStyles:i["bn-chart-time"].barStyles,varianceStyles:i["bn-chart-time"].varianceStyles,stackColors:i["bn-chart-time"].stackColors,padding:i["bn-chart-time"].padding,pattern:null,locale:"de"}}))}prepareLeftSideOffset(t,i){return this.syncSpaceLeft>-1?this.syncSpaceLeft:N.getMaxWidthOfArrayItems([...this.prepareVariances(),...this.prepareScenarios(),this.chartTitle],t,i)}prepareChartTitle(t){return t>=1?"":this.chartTitle}prepareDateInterval(){var t,i,e;const s="auto"===(null===(t=this.dateInterval)||void 0===t?void 0:t.trim().toLowerCase());return p(this.dateInterval)||s?(null===(i=this.datasetMeta)||void 0===i?void 0:i.suggestedDateInterval)?(s?this.errors.remove("AUTO_dateInterval"):this.errors.addOrReplace({id:"AUTO_dateInterval",type:"warning",message:"dateInterval: not set, auto-detected: "+this.datasetMeta.suggestedDateInterval}),E[this.datasetMeta.suggestedDateInterval.toUpperCase()]):s?E.AUTO:void 0:(this.errors.remove("AUTO_dateInterval"),E[null===(e=this.dateInterval)||void 0===e?void 0:e.toUpperCase()])}prepareIntervalSpanLimit(){const t=Number(this.intervalSpanLimit);return t>0?t:28}prepareAxisLabelsMode(){var t;return R[null===(t=this.axisLabelsMode)||void 0===t?void 0:t.toUpperCase()]}prepareFilter(){return 0===this.filter.length?"":this.filter}getDataStructure(){return{ITimeChartDataRow:{setName:{type:"string",isOptional:!1,description:""},date:{type:"string",isOptional:!1,description:""},operation:{type:"string",isOptional:!1,description:""},rowGroup:{type:"string",isOptional:!1,description:""},rowGroupIndex:{type:"number",isOptional:!1,description:""},category:{type:"string",isOptional:!1,description:""},categoryIndex:{type:"number",isOptional:!1,description:""},subCategory:{type:"string",isOptional:!1,description:""},subCategoryIndex:{type:"number",isOptional:!1,description:""},columnGroup:{type:"string",isOptional:!1,description:""},columnGroupIndex:{type:"number",isOptional:!1,description:""},columnSubGroup:{type:"string",isOptional:!1,description:""},columnSubGroupIndex:{type:"number",isOptional:!1,description:""},ac1:{type:"number",isOptional:!1,description:""},ac2:{type:"number",isOptional:!1,description:""},ac3:{type:"number",isOptional:!1,description:""},ac4:{type:"number",isOptional:!1,description:""},pp1:{type:"number",isOptional:!1,description:""},pp2:{type:"number",isOptional:!1,description:""},pp3:{type:"number",isOptional:!1,description:""},pp4:{type:"number",isOptional:!1,description:""},fc1:{type:"number",isOptional:!1,description:""},fc2:{type:"number",isOptional:!1,description:""},fc3:{type:"number",isOptional:!1,description:""},fc4:{type:"number",isOptional:!1,description:""},pl1:{type:"number",isOptional:!1,description:""},pl2:{type:"number",isOptional:!1,description:""},pl3:{type:"number",isOptional:!1,description:""},pl4:{type:"number",isOptional:!1,description:""}}}}prepareMeasureScale(){return p(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&&this.showMeasureScale}prepareMeasureUnit(){return""===this.measureUnit||null==this.measureUnit?"":this.measureUnit}prepareStackConfig(){if(p(this.stack))return this.errors.remove("WARN_stack_dimensions_scenarios"),null;try{const t=JSON.parse(this.stack),i=t.by,e="WARN_stack_dimensions_scenarios";if(i===$.DIMENSIONS){const t=this.prepareScenarios();t.length>1?this.errors.addOrReplace({id:e,type:"warning",message:`stack by dimensions: only the first scenario "${t[0]}" is used, the rest (${t.slice(1).join(", ")}) are discarded.`}):this.errors.remove(e)}else this.errors.remove(e);return{by:i,mode:t.mode||P.ABSOLUTE,order:t.order||F.DATASET}}catch(t){return this.errors.remove("WARN_stack_dimensions_scenarios"),null}}prepareLineFullWidth(){return this.lineFullWidth}prepareChartMode(){var t;const i=null===(t=this.chartMode)||void 0===t?void 0:t.toLowerCase();return"line"===i?B.LINE:"auto"===i?B.AUTO:B.BAR}prepareMaxBars(){return Math.floor(Number(this.maxBars)||28)}chartTemplate(t,i){const e=this.prepareI18n(),s=this.prepareStyle(),n=j(this.element).width,r=this.preparePixelPerUnit(),o=this.preparePixelPerPercentage(),l=this.prepareStackConfig(),h=this.prepareScenarios(),d=(null==l?void 0:l.by)===$.DIMENSIONS?h.slice(0,1):h;return a("bn-chart-time-renderer",{tableName:this.datasetName,dataVersion:this.dataVersion,chartTitle:this.prepareChartTitle(i),scenarios:d,variances:[t],hideAxisLabels:this.prepareHideAxisLabels(i),pixelPerUnit:r,pixelPerPercentage:o,reportAutoScaling:this.handleAutoScalingReport,errors:this.errors,leftSideOffsetForHorizontalSync:this.prepareLeftSideOffset(e,s),styles:s,i18n:e,dateInterval:this.prepareDateInterval(),intervalSpanLimit:this.prepareIntervalSpanLimit(),axisLabelsMode:this.prepareAxisLabelsMode(),filter:this.prepareFilter(),"measure-scale":this.prepareMeasureScale(),"measure-unit":this.prepareMeasureUnit(),showOverlayAvg:this.prepareAvg(),showOverlayMedian:this.prepareMedian(),showMeasureScale:this.prepareShowMeasureScale(i),chartMode:this.prepareChartMode(),maxBars:this.prepareMaxBars(),stackConfig:l,lineFullWidth:this.prepareLineFullWidth(),containerWidth:n,parentDimensions:this.prepareDimension(),ruleSetConfig:this.ruleSetConfig()})}async getBaseline(){return Y(this.element,"bn-chart-time-renderer")}async getLayoutState(t){var i,e,s,a;const n=null!==(i=null==t?void 0:t.detail)&&void 0!==i?i:"summary",r=G(this.element),o=this.getEffectiveScaleFactor(),l=Number.isFinite(o)&&o>0?o:1,h=this.componentStyle((t=>{var i;return(null===(i=t.global)||void 0===i?void 0:i.fontSizePx)||13.3333}))*l,d=this.prepareVariances(),c=X(this.element,"bn-chart-time-renderer",["base",...d],r,n),p=null===(e=this.element.shadowRoot)||void 0===e?void 0:e.querySelector("bn-chart-time-renderer"),u={version:z,tag:this.element.localName,id:q(this.element),slot:null!==(s=this.element.getAttribute("slot"))&&void 0!==s?s:void 0,rect:V(this.element,r),em:{fontSizePx:h,appliedScaleFactor:l},regions:c.regions,metadata:{title:this.chartTitle||void 0,scenarios:null!==(a=null==p?void 0:p.scenarios)&&void 0!==a?a:[],variances:d,barCount:c.barCount,chartMode:this.chartMode||void 0,hasNoData:0===c.barCount},diagnostics:H(this.element),scaling:this.resolveScalingInfo(h),baseline:c.baseline};return c.elements&&(u.elements=c.elements),u}resolveScalingInfo(t){var i,e;const s={},a=U(this.unitScaling,this.pixelPerUnitGroupMap);if("value"===a.kind)s.unitMode="fixed",s.unitsPerEm=a.value,s.unitPxPerUnit=t/a.value;else{s.unitMode="auto";const e=null===(i=this.lastAutoScalingReport)||void 0===i?void 0:i.unit;void 0!==e&&e>0&&(s.unitPxPerUnit=e,s.unitsPerEm=t/e)}const n=U(this.percentageScaling,this.pixelPerUnitGroupMap);if("value"===n.kind)s.percentageMode="fixed",s.percentagePointsPerEm=n.value,s.percentagePxPerPoint=t/n.value;else{s.percentageMode="auto";const i=null===(e=this.lastAutoScalingReport)||void 0===e?void 0:e.percentage;void 0!==i&&i>0&&(s.percentagePxPerPoint=i/100,s.percentagePointsPerEm=100*t/i)}return s}getEffectiveScaleFactor(){const{mode:t,factor:i}=D(this.scale);return"factor"===t?i:"auto"===t||"empty"===t?this.appliedScaleFactor:1}getEffectiveFontPx(){return this.componentStyle((t=>{var i;return(null===(i=t.global)||void 0===i?void 0:i.fontSizePx)||13.3333}))*this.getEffectiveScaleFactor()}getFontStyles(){const t=this.getEffectiveScaleFactor();return this.componentStyle((i=>{var e,s,a,n;const r=(null===(e=i.global)||void 0===e?void 0:e.fontSizePx)||13.3333;return{"--bn-font-family":(null===(s=i.global)||void 0===s?void 0:s.fontFamily)||"'Noto Sans', sans-serif","--bn-font-size":r*t+"px","--bn-font-color":(null===(a=i.global)||void 0===a?void 0:a.fontColor)||"#000000","--bn-font-background":(null===(n=i.global)||void 0===n?void 0:n.fontBackgroundColor)||"#ffffff"}}))}render(){let t=[""];const i=this.prepareVariances();this.checkVarianceScenarios(i),i.length>0&&(t=[...t,...i]);const e=this.getFontStyles();return a(n,{key:"37085b275bb92d716a31f79f15b9f2517f1c596b",style:e},a("div",{key:"93e9eacc22334da1deed871db640d6fd4aafb153",class:"container"},t.map(this.chartTemplate)))}get element(){return this}static get watchers(){return{filter:[{validateFilter:0}],scenarios:[{validateScenario:0}],variances:[{validateVariances:0}],syncSpaceLeft:[{validateLeftSync:0}],unitScaling:[{validateUnitScaling:0}],percentageScaling:[{validatePercentageScaling:0}],dateInterval:[{validateDateInterval:0}],chartMode:[{validateChartMode:0}],maxBars:[{validateMaxBars:0}],stack:[{validateStack:0}],scale:[{validateScaling:0}],axisLabelsMode:[{validateAxisLabelsMode:0}],measureScale:[{validateMeasureScale:0}]}}static get style(){return':host(.no-data){display:block;box-sizing:border-box;width:100%;height:100%}:host(.no-data)>div{float:none;width:100%;height:100%}:host(.no-data) .no-data~.no-data{display:none}.empty-state{box-sizing:border-box;display:flex;align-items:center;justify-content:center;float:none;width:100%;height:100%;min-height:3em;margin:0;padding:0.5em;overflow:hidden;border:0.1em dashed #ddd;color:#808080;font-family:var(--bn-font-family, "Noto Sans", sans-serif);font-size:var(--bn-font-size, 13.3333px);font-style:normal;text-align:center}:host{display:inline-block;position:relative;overflow:hidden;font-family:var(--bn-font-family, "Noto Sans", sans-serif);font-size:var(--bn-font-size, 13.3333px);color:var(--bn-font-color, #000000)}.container{display:flex;flex-direction:column-reverse}.background-image{display:flex;flex-wrap:wrap;justify-content:flex-end}'}},[1,"bn-chart-time",{datasets:[513],selectedStyle:[513,"selected-style"],i18nNamespace:[513,"i18n-namespace"],ruleset:[513],chartTitle:[1,"chart-title"],filter:[1],scenarios:[1],variances:[1],syncSpaceLeft:[2,"sync-space-left"],unitScaling:[8,"unit-scaling"],percentageScaling:[8,"percentage-scaling"],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:[4,"line-full-width"],showCategories:[4,"show-categories"],measureScale:[1,"measure-scale"],showMeasureScale:[4,"show-measure-scale"],showOverlayAvg:[4,"show-overlay-avg"],showOverlayMedian:[4,"show-overlay-median"],measureUnit:[1,"measure-unit"],datasetName:[32],dataVersion:[32],datasetMeta:[32],appliedScaleFactor:[32],getBaseline:[64],getLayoutState:[64]},void 0,{filter:[{validateFilter:0}],scenarios:[{validateScenario:0}],variances:[{validateVariances:0}],syncSpaceLeft:[{validateLeftSync:0}],unitScaling:[{validateUnitScaling:0}],percentageScaling:[{validatePercentageScaling:0}],dateInterval:[{validateDateInterval:0}],chartMode:[{validateChartMode:0}],maxBars:[{validateMaxBars:0}],stack:[{validateStack:0}],scale:[{validateScaling:0}],axisLabelsMode:[{validateAxisLabelsMode:0}],measureScale:[{validateMeasureScale:0}]}]),Z=Q,tt=function(){"undefined"!=typeof customElements&&["bn-chart-time","bn-chart-time-renderer"].forEach((t=>{switch(t){case"bn-chart-time":customElements.get(r(t))||customElements.define(r(t),Q);break;case"bn-chart-time-renderer":customElements.get(r(t))||K()}}))};export{Z as BnChartTime,tt as defineCustomElement}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{p as t,H as s,h as e,a as o,t as n}from"./p-D6YGOYV1.js";import{w as r}from"./p-
|
|
1
|
+
import{p as t,H as s,h as e,a as o,t as n}from"./p-D6YGOYV1.js";import{w as r}from"./p-Do4oPrkE.js";import{g as i,u as m}from"./p-DDvWTgk1.js";import{w as p}from"./p-Dq9dG0Kr.js";import{w as a}from"./p-4vVbchX2.js";const c=t(class extends s{constructor(t){super(),!1!==t&&this.__registerHost(),this.name="_default",p(this),this.errors=a(this),r(this,(t=>{this.stores||(this.stores=i(this.element));try{const s=JSON.parse(t);this.stores.componentStyles.set(this.name,s),this.errors.remove("ERR_body");const e=m(s);e.length>0?this.errors.addOrReplace({id:"ERR_keys",type:"error",message:"Unknown style keys, they are ignored: "+e.join(", ")}):this.errors.remove("ERR_keys")}catch(t){this.errors.addOrReplace({id:"ERR_body",type:"error",message:"bn-component-style: Failed to parse JSON body - "+t.message}),console.error(t)}}))}render(){return e(o,{key:"443fd52bc75e267b8699e29f754a15130f444315"})}get element(){return this}static get style(){return"bn-component-style{display:none}"}},[0,"bn-component-style",{name:[1]}]),y=c,h=function(){"undefined"!=typeof customElements&&["bn-component-style"].forEach((t=>{"bn-component-style"===t&&(customElements.get(n(t))||customElements.define(n(t),c))}))};export{y as BnComponentStyle,h as defineCustomElement}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{p as t,H as e,f as n,h as o,a,t as i}from"./p-D6YGOYV1.js";import{S as r,e as s}from"./p-
|
|
1
|
+
import{p as t,H as e,f as n,h as o,a,t as i}from"./p-D6YGOYV1.js";import{S as r,e as s}from"./p-DDvWTgk1.js";import{LAYOUT_STATE_VERSION as c}from"./index.js";import{m as l,t as d}from"./p-DaOm9YwQ.js";import{r as m,a as p,b as u,c as b}from"./p-CckAR27O.js";import{w as h}from"./p-Dq9dG0Kr.js";import{w as g}from"./p-4vVbchX2.js";import{b as f}from"./p-DM7fwmH4.js";function y(t){if("function"==typeof getComputedStyle){const e=parseFloat(getComputedStyle(t).fontSize);if(Number.isFinite(e)&&e>0)return e}return r.global.fontSizePx}function v(t,e){var n;return{version:c,tag:t.localName,id:p(t),slot:null!==(n=t.getAttribute("slot"))&&void 0!==n?n:void 0,rect:l(t,e),em:{fontSizePx:y(t),appliedScaleFactor:1},regions:[],metadata:{},diagnostics:m(t)}}const x=["format","orientation","page-format","page-orientation","render-orientation","page-number"],w=(t,e,n)=>{const o=t[e];return"string"==typeof o?o:e in t?null:t.getAttribute(n)},S=t(class extends e{constructor(t){super(),!1!==t&&this.__registerHost(),this.__attachShadow(),this.assignedPageNumbers=new WeakMap,h(this),this.errors=g(this)}setLocale(t){this.stores.context.state.locale=t}connectedCallback(){this.stores=s(this.element),this.locale&&(this.stores.context.state.locale=this.locale),this.syncPages(),this.pageObserver=new MutationObserver((()=>this.syncPages())),this.pageObserver.observe(this.element,{childList:!0,subtree:!0,attributes:!0,attributeFilter:x})}disconnectedCallback(){var t,e;null===(t=this.pageObserver)||void 0===t||t.disconnect(),null===(e=this.pageSizeStyle)||void 0===e||e.remove(),this.pageSizeStyle=void 0}syncPages(){const t=Array.from(this.element.querySelectorAll("bn-page, bn-layout-page"));t.forEach(((t,e)=>{const n="bn-layout-page"===t.localName?t:t.querySelector("bn-footer");if(!n)return;const o=w(n,"pageNumber","page-number");if(null!==o&&o!==this.assignedPageNumbers.get(n))return;const a=""+(e+1);this.assignedPageNumbers.set(n,a),o!==a&&n.setAttribute("page-number",a)}));const e=this.element.getAttribute("render-orientation");void 0!==this.lastRenderOrientation&&this.lastRenderOrientation!==e&&t.filter((t=>"bn-layout-page"===t.localName)).forEach((t=>n(t))),this.lastRenderOrientation=e,this.writePageSize(t[0],e)}writePageSize(t,e){var n;if(!t||document.querySelector("bn-context")!==this.element)return null===(n=this.pageSizeStyle)||void 0===n||n.remove(),void(this.pageSizeStyle=void 0);const o="bn-layout-page"===t.localName?f(w(t,"pageFormat","page-format"),w(t,"pageOrientation","page-orientation"),e):f(w(t,"format","format"),w(t,"orientation","orientation"));this.pageSizeStyle||(this.pageSizeStyle=document.createElement("style"),this.pageSizeStyle.setAttribute("data-bn-page-size",""),document.head.append(this.pageSizeStyle)),this.pageSizeStyle.textContent!==o&&(this.pageSizeStyle.textContent=o)}async getLayoutState(t){var e,n;const o=null!==(e=null==t?void 0:t.detail)&&void 0!==e?e:"summary",a=Array.from(this.element.querySelectorAll("bn-annotation-layer, bn-annotation-list, bn-body, bn-card, bn-chart-bubble, bn-chart-bullet, bn-chart-scatter, bn-chart-structure, bn-chart-time, bn-footer, bn-grid, bn-image, bn-layout-card, bn-layout-page, bn-message, bn-page, bn-table, bn-text, bn-title, bn-tree"));await Promise.all(a.map((t=>{var e,n,o;return null!==(o=null===(n=(e=t).componentOnReady)||void 0===n?void 0:n.call(e))&&void 0!==o?o:Promise.resolve()})));const i=this.element.getBoundingClientRect(),r={x:i.left,y:i.top},s=await Promise.all(a.map((async t=>{const e=t.getBoundingClientRect(),n={context:r,component:{x:e.left,y:e.top}};try{const e=t;return"function"==typeof e.getLayoutState?await e.getLayoutState({detail:o}):v(t,n)}catch(e){let o;try{o=v(t,n)}catch(e){const n={x:0,y:0,width:0,height:0};o={version:c,tag:t.localName,id:t.localName,rect:{context:Object.assign({},n),component:Object.assign({},n)},em:{fontSizePx:0,appliedScaleFactor:1},regions:[],metadata:{},diagnostics:[]}}return o.error=(e instanceof Error?e.message:e)+"",o}}))),l=u(a.map((t=>({tag:t.localName,explicitId:b(t)}))));return s.forEach(((t,e)=>{t.id=l[e]})),{version:c,generatedAt:(new Date).toISOString(),detail:o,context:{viewport:d(i),locale:null===(n=this.stores)||void 0===n?void 0:n.context.state.locale},components:s}}componentWillLoad(){}componentDidLoad(){}componentShouldUpdate(){}componentWillRender(){}componentDidRender(){}componentWillUpdate(){}componentDidUpdate(){}render(){return o(a,{key:"a50946d9cb100a1644a2c758af7854900826c5ce"},o("slot",{key:"c02525871433af7bb15f39c62c1417365a28d931"}))}get element(){return this}static get watchers(){return{locale:[{setLocale:0}]}}static get style(){return":host{display:block}"}},[257,"bn-context",{locale:[1],i18nNamespace:[513,"i18n-namespace"],renderOrientation:[513,"render-orientation"],getLayoutState:[64]},void 0,{locale:[{setLocale:0}]}]),j=S,D=function(){"undefined"!=typeof customElements&&["bn-context"].forEach((t=>{"bn-context"===t&&(customElements.get(i(t))||customElements.define(i(t),S))}))};export{j as BnContext,D as defineCustomElement}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{g as t,p as s,H as i,h,a as e,t as r}from"./p-D6YGOYV1.js";import{g as n,c as
|
|
1
|
+
import{g as t,p as s,H as i,h,a as e,t as r}from"./p-D6YGOYV1.js";import{g as n,c as o,h as a}from"./p-DDvWTgk1.js";import{r as l,w as c}from"./p-Dq9dG0Kr.js";import{w as u}from"./p-Do4oPrkE.js";import{w as d}from"./p-4vVbchX2.js";import{d as f,c as p}from"./p-CYwd_ZNM.js";import{e as m}from"./p-ClruFZD_.js";const v=["ac1","ac2","ac3","ac4","pp1","pp2","pp3","pp4","fc1","fc2","fc3","fc4","pl1","pl2","pl3","pl4"],y=["rowGroup","category","subCategory","columnGroup","columnSubGroup"];function R(t){return"number"==typeof t&&!isNaN(t)&&isFinite(t)}function g(t){const s=Array.from(t);return{distinctValues:s,count:s.length,hasData:s.length>0}}const E=s(class extends i{constructor(s){super(),!1!==s&&this.__registerHost(),this.datasources="",this.static=!1,this.raw=!0,this.refreshInterval=0,this.lastBodyHash=null,this.lastViewQuery=null,this.nameShared=!1,this.currentUrl=null,this.pollTimerId=null,this.abortController=null,this.firstLoadPending=!1,this.onNameShared=t=>{const s=this.nameShared;this.nameShared=t,t?this.errors.addOrReplace({id:"ERR_name",type:"error",message:`name: "${this.name}" is used by more than one dataset or datasource.`}):(this.errors.remove("ERR_name"),s&&this.reload())},this.holdStatus=c(this),this.errors=d(this),((s,i)=>{let h,e=[],r=[];const a=t=>{let s;try{s=h.db.db.exec(`SELECT * FROM \`${t}\``)}catch(t){s=[]}i()},c=()=>{e.forEach((t=>t())),e=[],r.forEach((t=>{t&&(e.push(h.db.subscribe(t,(()=>a(t)))),a(t))}))},u=new MutationObserver((i=>{i.forEach((i=>{"datasources"===i.attributeName&&(r=(t(s).getAttribute("datasources")||"").split(","),c())}))})),d=s.connectedCallback;s.connectedCallback=()=>{const i=t(s);h=n(i),r=(i.getAttribute("datasources")||"").split(","),c(),u.observe(i,{attributes:!0,attributeFilter:["datasources"]}),l(d,s)};const f=s.disconnectedCallback;s.disconnectedCallback=()=>{u.disconnect(),e.forEach((t=>t())),e=[],o(t(s)),l(f,s)}})(this,(()=>{this.executeQuery()})),u(this,(t=>this.sync(t)))}sync(t){if(this.stores=n(this.element),!this.releaseName&&this.name&&(this.releaseName=this.stores.db.claim(this.name,this.onNameShared)),this.src){if(this.src===this.currentUrl)return;return this.currentUrl=this.src,this.lastBodyHash=null,this.query="",this.errors.remove("ERR_sql"),this.errors.remove("ERR_body"),this.firstLoadPending=!0,this.holdStatus(this.fetchAndStore(this.src)),void this.startPolling()}let s,i;if(null!==this.currentUrl&&(this.cancelInFlight(),this.currentUrl=null),this.errors.remove("ERR_src"),!this.raw&&this.static&&""!==t.trim())try{const h=f(t);s=h.hash,i=h.json}catch(t){return this.errors.addOrReplace({id:"ERR_body",type:"error",message:"Body: "+m(t)}),void(this.lastBodyHash=null)}else s=p(t),i=t;s!==this.lastBodyHash&&(this.lastBodyHash=s,this.errors.remove("ERR_body"),this.query=i,this.executeQuery())}executeQuery(){var t,s;if(this.stores||(this.stores=n(this.element)),this.query||this.errors.remove("ERR_sql"),!this.name)return;if(!(this.query||this.static&&null===this.currentUrl))return;const i=this.stores.db.db;let h;if(this.static){try{h=""===this.query.trim()?[]:null!==(t=JSON.parse(this.query))&&void 0!==t?t:[],Array.isArray(h)?this.errors.remove("ERR_body"):this.errors.addOrReplace({id:"ERR_body",type:"error",message:"Body: not a JSON array."})}catch(t){this.errors.addOrReplace({id:"ERR_body",type:"error",message:"Body: "+m(t)}),h=[]}i.tables[this.name]={data:Array.isArray(h)?h:[]},this.registered=i.tables[this.name],this.dropViewStatements(),this.errors.remove("ERR_sql")}else{if(this.lastViewQuery!==this.query){try{i.exec(`DROP VIEW \`${this.name}\``)}catch(t){}null!=i.tables[this.name]&&delete i.tables[this.name],i.views&&null!=i.views[this.name]&&delete i.views[this.name];try{if(a(this.query))throw Error("double backticks are not allowed.");i.exec(`CREATE VIEW \`${this.name}\` AS ${this.query}`),this.registered=i.tables[this.name],i.resetSqlCache(),this.lastViewQuery=this.query}catch(t){return console.error("bn-dataset: failed to register SQL view",t,this.query),this.errors.addOrReplace({id:"ERR_sql",type:"error",message:"SQL: "+(t instanceof Error?t.message:t)}),i.resetSqlCache(),this.lastViewQuery=null,h=[],void this.publish(h)}}else null===(s=i.tables[this.name])||void 0===s||delete s.select;try{h=i.exec(`SELECT * FROM \`${this.name}\``),this.errors.remove("ERR_sql")}catch(t){if(void 0===this.latestResult)return;return this.errors.addOrReplace({id:"ERR_sql",type:"error",message:"SQL: "+(t instanceof Error?t.message:t)}),void this.publish([])}}this.publish(h)}publish(t){this.latestResult!==t?(this.latestResult=t,this.stores.db.notify(this.name),this.publishedMeta=function(t){const s={};for(const t of y)s[t]=new Set;const i={};for(const t of v)i[t]={hasData:!1,min:null,max:null};const h=new Set;let e=null,r=null;const n=Array.isArray(t)?t:[];for(let t=0;t<n.length;t++){const o=n[t];if(null==o)continue;for(const t of y){const i=o[t];null!=i&&""!==i&&s[t].add(i+"")}for(const t of v){const s=o[t];if(R(s)){const h=i[t];h.hasData=!0,(null===h.min||s<h.min)&&(h.min=s),(null===h.max||s>h.max)&&(h.max=s)}}const a=o.date;if(null!=a&&""!==a){const t=a+"";h.add(t),(null===e||t<e)&&(e=t),(null===r||t>r)&&(r=t)}}const o=v.map((t=>({key:t,hasData:i[t].hasData,min:i[t].min,max:i[t].max}))),a=o.filter((t=>t.hasData)).map((t=>t.key)),l=g(s.rowGroup),c=g(s.category),u=g(s.subCategory),d=g(s.columnGroup),f=g(s.columnSubGroup),p={min:e,max:r,hasData:h.size>0,distinctCount:h.size};let m="category";return u.hasData?m="subCategory":c.hasData?m="category":l.hasData&&(m="rowGroup"),{rowCount:n.length,scenarios:o,availableScenarios:a,rowGroup:l,category:c,subCategory:u,columnGroup:d,columnSubGroup:f,dateRange:p,suggestedLevel:m,suggestedOrder:m,suggestedDateInterval:p.hasData?"auto":null,calculatedAt:Date.now()}}(t),this.stores.datasetsMeta.set(this.name,this.publishedMeta)):this.stores.db.notify(this.name)}nameUpdated(t,s){var i;this.unregister(s),this.name&&this.element.isConnected&&this.sync(null!==(i=this.element.textContent)&&void 0!==i?i:"")}onIntervalChange(){this.currentUrl&&this.startPolling()}onSrcChange(){var t;this.element.isConnected&&this.sync(null!==(t=this.element.textContent)&&void 0!==t?t:"")}disconnectedCallback(){this.cancelInFlight(),this.unregister(this.name)}unregister(t){var s,i,h;const e=null===(i=null===(s=this.stores)||void 0===s?void 0:s.db)||void 0===i?void 0:i.db;e&&null!==this.lastViewQuery&&e.resetSqlCache(),null===(h=this.releaseName)||void 0===h||h.call(this),this.releaseName=void 0;const r=null!=(null==e?void 0:e.tables[t])&&e.tables[t]!==this.registered;if(r&&void 0!==this.publishedMeta&&this.stores.datasetsMeta.get(t)===this.publishedMeta&&this.stores.datasetsMeta.set(t,null),this.publishedMeta=void 0,this.registered=void 0,this.lastBodyHash=null,this.lastViewQuery=null,this.currentUrl=null,this.latestResult=void 0,e&&t&&!r){try{e.exec(`DROP VIEW \`${t}\``)}catch(t){}null!=e.tables[t]&&delete e.tables[t],e.views&&null!=e.views[t]&&delete e.views[t],this.stores.datasetsMeta.set(t,null),this.stores.db.notify(t)}}async fetchAndStore(t){var s,i;null===(s=this.abortController)||void 0===s||s.abort(),this.abortController=new AbortController,this.stores||(this.stores=n(this.element));try{const s=await fetch(t,{signal:this.abortController.signal});if(!s.ok)throw Error("HTTP "+s.status);const h=null!==(i=await s.json())&&void 0!==i?i:[];if(!Array.isArray(h))throw Error("not a JSON array.");const e=this.stores.db.db;e.tables[this.name]={data:h},this.registered=e.tables[this.name],this.dropViewStatements(),this.errors.remove("ERR_src"),this.publish(h)}catch(t){if(t instanceof DOMException&&"AbortError"===t.name)return;this.errors.addOrReplace({id:"ERR_src",type:"error",message:"src: "+m(t)});const s=this.stores.db.db;s.tables[this.name]={data:[]},this.registered=s.tables[this.name],this.dropViewStatements(),this.publish([])}this.firstLoadPending=!1}reload(){var t;null!==this.lastViewQuery&&this.stores.db.db.resetSqlCache(),this.lastBodyHash=null,this.lastViewQuery=null,this.currentUrl=null,this.latestResult=void 0,this.sync(null!==(t=this.element.textContent)&&void 0!==t?t:"")}dropViewStatements(){null!==this.lastViewQuery&&this.stores.db.db.resetSqlCache(),this.lastViewQuery=null}clearPollTimer(){null!==this.pollTimerId&&(clearInterval(this.pollTimerId),this.pollTimerId=null)}cancelInFlight(){var t;this.clearPollTimer(),null===(t=this.abortController)||void 0===t||t.abort(),this.abortController=null}startPolling(){this.clearPollTimer(),this.currentUrl&&this.refreshInterval>0&&(this.pollTimerId=setInterval((()=>{this.currentUrl&&!this.firstLoadPending&&this.fetchAndStore(this.currentUrl)}),1e3*this.refreshInterval))}render(){return h(e,{key:"9a491c13d9ad8fba5da3c30f502a027a5ae1c606"})}get element(){return this}static get watchers(){return{name:[{nameUpdated:0}],refreshInterval:[{onIntervalChange:0}],src:[{onSrcChange:0}]}}static get style(){return"bn-dataset{display:none}"}},[0,"bn-dataset",{name:[1],datasources:[1],static:[4],raw:[4],refreshInterval:[2,"refresh-interval"],src:[1]},void 0,{name:[{nameUpdated:0}],refreshInterval:[{onIntervalChange:0}],src:[{onSrcChange:0}]}]),b=E,w=function(){"undefined"!=typeof customElements&&["bn-dataset"].forEach((t=>{"bn-dataset"===t&&(customElements.get(r(t))||customElements.define(r(t),E))}))};export{b as BnDataset,w as defineCustomElement}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{p as t,H as s,h as i,a as h,t as r}from"./p-D6YGOYV1.js";import{w as e}from"./p-
|
|
1
|
+
import{p as t,H as s,h as i,a as h,t as r}from"./p-D6YGOYV1.js";import{w as e}from"./p-Do4oPrkE.js";import{g as n,c as a}from"./p-DDvWTgk1.js";import{w as l}from"./p-Dq9dG0Kr.js";import{w as o}from"./p-4vVbchX2.js";import{c as d,d as c}from"./p-CYwd_ZNM.js";import{e as u}from"./p-ClruFZD_.js";const m=t(class extends s{constructor(t){super(),!1!==t&&this.__registerHost(),this.raw=!0,this.refreshInterval=0,this.lastHash=null,this.nameShared=!1,this.currentUrl=null,this.pollTimerId=null,this.abortController=null,this.firstLoadPending=!1,this.onNameShared=t=>{const s=this.nameShared;this.nameShared=t,t?this.errors.addOrReplace({id:"ERR_name",type:"error",message:`name: "${this.name}" is used by more than one dataset or datasource.`}):(this.errors.remove("ERR_name"),s&&this.reload())},this.holdStatus=l(this),this.errors=o(this),e(this,(t=>this.sync(t)))}sync(t){var s;if(this.stores=n(this.element),!this.releaseName&&this.name&&(this.releaseName=this.stores.db.claim(this.name,this.onNameShared)),this.src){if(this.src===this.currentUrl)return;return this.currentUrl=this.src,this.lastHash=null,this.errors.remove("ERR_body"),this.firstLoadPending=!0,this.holdStatus(this.fetchAndStore(this.src)),void this.startPolling()}null!==this.currentUrl&&(this.cancelInFlight(),this.currentUrl=null),this.errors.remove("ERR_src");try{let i,h;if(this.raw||""===t.trim())i=d(t),h=t;else{const s=c(t);i=s.hash,h=s.json}if(i===this.lastHash)return;this.lastHash=i;const r=""===h.trim()?[]:null!==(s=JSON.parse(h))&&void 0!==s?s:[];Array.isArray(r)?this.errors.remove("ERR_body"):this.errors.addOrReplace({id:"ERR_body",type:"error",message:"Body: not a JSON array."}),this.publish(r)}catch(t){this.lastHash=null,this.errors.addOrReplace({id:"ERR_body",type:"error",message:"Body: "+u(t)}),this.publish([])}}reload(){var t;this.lastHash=null,this.currentUrl=null,this.sync(null!==(t=this.element.textContent)&&void 0!==t?t:"")}publish(t){const s=this.stores.db.db;s.tables[this.name]={data:Array.isArray(t)?t:[]},this.registered=s.tables[this.name],this.stores.db.notify(this.name)}onIntervalChange(){this.currentUrl&&this.startPolling()}onSrcChange(){var t;this.element.isConnected&&this.sync(null!==(t=this.element.textContent)&&void 0!==t?t:"")}nameUpdated(t,s){var i;this.unregister(s),this.name&&this.element.isConnected&&this.sync(null!==(i=this.element.textContent)&&void 0!==i?i:"")}disconnectedCallback(){this.cancelInFlight(),this.unregister(this.name),a(this.element)}unregister(t){var s,i,h;null===(s=this.releaseName)||void 0===s||s.call(this),this.releaseName=void 0,this.lastHash=null,this.currentUrl=null;const r=null===(h=null===(i=this.stores)||void 0===i?void 0:i.db)||void 0===h?void 0:h.db,e=null!=(null==r?void 0:r.tables[t])&&r.tables[t]!==this.registered;this.registered=void 0,r&&t&&!e&&(null!=r.tables[t]&&delete r.tables[t],r.views&&null!=r.views[t]&&delete r.views[t],this.stores.db.notify(t))}async fetchAndStore(t){var s,i;null===(s=this.abortController)||void 0===s||s.abort(),this.abortController=new AbortController,this.stores||(this.stores=n(this.element));try{const s=await fetch(t,{signal:this.abortController.signal});if(!s.ok)throw Error("HTTP "+s.status);const h=null!==(i=await s.json())&&void 0!==i?i:[];if(!Array.isArray(h))throw Error("not a JSON array.");this.errors.remove("ERR_src"),this.publish(h)}catch(t){if(t instanceof DOMException&&"AbortError"===t.name)return;this.errors.addOrReplace({id:"ERR_src",type:"error",message:"src: "+u(t)}),this.publish([])}this.firstLoadPending=!1}clearPollTimer(){null!==this.pollTimerId&&(clearInterval(this.pollTimerId),this.pollTimerId=null)}cancelInFlight(){var t;this.clearPollTimer(),null===(t=this.abortController)||void 0===t||t.abort(),this.abortController=null}startPolling(){this.clearPollTimer(),this.currentUrl&&this.refreshInterval>0&&(this.pollTimerId=setInterval((()=>{this.currentUrl&&!this.firstLoadPending&&this.fetchAndStore(this.currentUrl)}),1e3*this.refreshInterval))}render(){return i(h,{key:"323018b2b642f9905874f94010c75b19bebde639"})}get element(){return this}static get watchers(){return{refreshInterval:[{onIntervalChange:0}],src:[{onSrcChange:0}],name:[{nameUpdated:0}]}}static get style(){return"bn-datasource{display:none}"}},[0,"bn-datasource",{name:[1],raw:[4],refreshInterval:[2,"refresh-interval"],src:[1]},void 0,{refreshInterval:[{onIntervalChange:0}],src:[{onSrcChange:0}],name:[{nameUpdated:0}]}]),v=m,p=function(){"undefined"!=typeof customElements&&["bn-datasource"].forEach((t=>{"bn-datasource"===t&&(customElements.get(r(t))||customElements.define(r(t),m))}))};export{v as BnDatasource,p as defineCustomElement}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{F as o,d as s}from"./p-
|
|
1
|
+
import{F as o,d as s}from"./p-fKJx8WtW.js";const t=o,p=s;export{t as BnFooter,p as defineCustomElement}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{p as t,H as i,h as e,a as l,t as s}from"./p-D6YGOYV1.js";import{LAYOUT_STATE_VERSION as o}from"./index.js";import{o as n,m as r}from"./p-DSkyHSIL.js";import{r as a,a as d}from"./p-CckAR27O.js";import{l as h}from"./p-CMCnX0iM.js";import{w as c}from"./p-DEHnizot.js";import{w as u}from"./p-DLLljAll.js";import{w as v}from"./p-C6XrNN2m.js";import{w as f}from"./p-CGI6XIaK.js";function g(t){if(!t||""===t.trim()||"[]"===t)return[];try{const i=JSON.parse(t);return Array.isArray(i)?i.map(((t,i)=>{var e,l,s;return"string"==typeof t?{label:t,id:i+""}:"object"==typeof t&&null!==t?{label:null!==(l=null!==(e=t.label)&&void 0!==e?e:t.name)&&void 0!==l?l:i+"",id:null!==(s=t.id)&&void 0!==s?s:i+""}:{label:t+"",id:i+""}})):[]}catch(t){return console.error("parseHeaders: failed to parse JSON",t),[]}}function p(t,i){return`${t.id}-${i.id}`}function m(t){if(!t||""===t.trim()||"[]"===t)return[];try{const i=JSON.parse(t);if(!Array.isArray(i))return["Headers must be an array"];const e=[],l=new Set;return i.forEach(((t,i)=>{"object"==typeof t&&null!==t&&void 0!==t.id&&("string"!=typeof t.id?e.push(`Header[${i}]: 'id' must be a string`):l.has(t.id)?e.push(`Header[${i}]: duplicate id '${t.id}'`):l.add(t.id),void 0!==t.label&&"string"!=typeof t.label&&e.push(`Header[${i}]: 'label' must be a string`))})),e}catch(t){return console.error("validateHeadersJson: failed to parse JSON",t),["Invalid JSON structure"]}}const b=["auto","equal"],w=["top","center","bottom","baseline"],y=["left","center","right","baseline"],x={top:"flex-start",center:"center",bottom:"flex-end",baseline:"flex-start"},C={left:"stretch",center:"center",right:"flex-end",baseline:"stretch"},H=t=>Math.round(100*t)/100,S=new Set(["bn-asset","bn-component-style","bn-dataset","bn-datasource","bn-internationalization","bn-ruleset","bn-scaling-group"]),j=new Set(["bn-layout-card"]),R={top:"--bn-baseline-offset-top",left:"--bn-baseline-offset-left",right:"--bn-baseline-offset-right"},A=t(class extends i{validateRowHeaders(t){const i="ERR_rowHeaders",e=m(t);e.length>0?this.errors.addOrReplace({id:i,type:"error",message:"row-headers: "+e.join("; ")}):this.errors.remove(i),this.updateGridConfig()}validateColumnHeaders(t){const i="ERR_columnHeaders",e=m(t);e.length>0?this.errors.addOrReplace({id:i,type:"error",message:"column-headers: "+e.join("; ")}):this.errors.remove(i),this.updateGridConfig()}validateCellHeight(t){this.resolvedHeight=this.validateChoice("cell-height","ERR_cellHeight",t,b,"auto")}validateCellWidth(t){this.resolvedWidth=this.validateChoice("cell-width","ERR_cellWidth",t,b,"auto")}validateCellVerticalAlign(t){this.resolvedVertical=this.validateChoice("cell-vertical-align","ERR_cellVerticalAlign",t,w,"top"),this.schedule()}validateCellHorizontalAlign(t){this.resolvedHorizontal=this.validateChoice("cell-horizontal-align","ERR_cellHorizontalAlign",t,y,"left"),this.schedule()}validateCellCaptions(t){const i=function(t){if(void 0===t||""===t.trim())return{};let i;try{i=JSON.parse(t)}catch(t){return}if("object"!=typeof i||null===i||Array.isArray(i))return;const e={};for(const[t,l]of Object.entries(i)){if("string"!=typeof l)return;""!==l&&(e[t]=l)}return e}(t);i?this.errors.remove("ERR_cellCaptions"):this.errors.addOrReplace({id:"ERR_cellCaptions",type:"error",message:"cell-captions: not a JSON object from slot name to text."}),this.captions=null!=i?i:{}}constructor(t){super(),!1!==t&&this.__registerHost(),this.__attachShadow(),this.gridConfig={rows:[],columns:[]},this.resolvedHeight="auto",this.resolvedWidth="auto",this.resolvedVertical="top",this.resolvedHorizontal="left",this.captions={},this.offsets={},this.frames=new Map,this.observed=new WeakSet,this.scheduled=!1,this.run=0,this.adjustments=0,this.chartTitle="",this.rowHeaders="[]",this.columnHeaders="[]",this.showRowHeaders=!0,this.showColumnHeaders=!0,this.showBorders=!0,this.rowHeaderWidth="auto",this.cellGap="0px",this.cellHeight="auto",this.cellWidth="auto",this.cellVerticalAlign="top",this.cellHorizontalAlign="left",this.cellCaptions="",this.schedule=()=>{if(!this.isBaselineMode())return this.run++,Object.keys(this.offsets).length>0&&(this.offsets={}),void this.applyFrameOffsets();this.scheduled||(this.scheduled=!0,this.holdStatus(new Promise((t=>{requestAnimationFrame((()=>{this.scheduled=!1,this.align().catch((t=>console.error("bn-grid: aligning the baselines failed",t))).finally(t)}))}))))},u(this),this.holdStatus=c(this),this.errors=f(this),this.componentStyle=v(this)}connectedCallback(){var t;this.observed=new WeakSet,this.resizeObserver=new ResizeObserver(this.schedule),this.mutationObserver=new MutationObserver(this.schedule),this.mutationObserver.observe(this.element,{childList:!0,subtree:!0,attributes:!0,attributeFilter:["slot"]}),null===(t=document.fonts)||void 0===t||t.addEventListener("loadingdone",this.schedule)}disconnectedCallback(){var t,i,e;null===(t=this.resizeObserver)||void 0===t||t.disconnect(),null===(i=this.mutationObserver)||void 0===i||i.disconnect(),null===(e=document.fonts)||void 0===e||e.removeEventListener("loadingdone",this.schedule),this.run++}componentDidRender(){this.schedule()}validateChoice(t,i,e,l,s){return null==e||""===e?(this.errors.remove(i),s):l.includes(e)?(this.errors.remove(i),e):(this.errors.addOrReplace({id:i,type:"error",message:`${t}: "${e}" is not one of ${l.join(", ")}.`}),s)}isBaselineMode(){return"baseline"===this.resolvedVertical||"baseline"===this.resolvedHorizontal}contentIn(t){const i=Array.from(this.element.children).find((i=>i.getAttribute("slot")===t));if(!i)return{};const e=[i,...Array.from(i.querySelectorAll("*"))],l=e.find((t=>t.localName.startsWith("bn-")&&!S.has(t.localName)&&!j.has(t.localName))),s=l?e.find((t=>j.has(t.localName)&&t.contains(l))):void 0;return{visual:l,frame:s}}applyFrameOffsets(){this.frames.forEach(((t,i)=>{const e=this.offsets[i];Object.keys(R).forEach((i=>{const l=null==e?void 0:e[i];l?t.style.setProperty(R[i],l+"px"):t.style.removeProperty(R[i])}))}))}async align(){var t;const i=++this.run;if(!this.element.isConnected||!this.isBaselineMode())return;const{rows:e,columns:l}=this.gridConfig,s=e.flatMap(((t,i)=>l.map(((e,l)=>({slot:p(t,e),row:i,column:l}))))),o=s.map((({slot:t})=>this.contentIn(t))),n=o.map((t=>t.visual));if(await Promise.all(n.map((t=>{var i;return null===(i=null==t?void 0:t.componentOnReady)||void 0===i?void 0:i.call(t)}))),i!==this.run)return;n.forEach((t=>t&&this.observe(t)));const r=await Promise.all(n.map((t=>"function"==typeof(null==t?void 0:t.getBaseline)?t.getBaseline().catch((()=>({}))):Promise.resolve({}))));if(i!==this.run)return;const a=h(this.element),d=new Map;null===(t=this.element.shadowRoot)||void 0===t||t.querySelectorAll(".grid-slot").forEach((t=>{var i;d.set(null!==(i=t.getAttribute("data-slot"))&&void 0!==i?i:"",t)})),this.frames=new Map,o.forEach((({frame:t},i)=>t&&this.frames.set(s[i].slot,t)));const c=function(t,i,e){const l={};for(const i of t)l[i.slot]={};const s=(i,e,s,o)=>{var n;const r=new Map;for(const e of t)r.set(e[i],[...null!==(n=r.get(e[i]))&&void 0!==n?n:[],e]);for(const t of r.values()){const i=t.map((t=>{const i=e(t);return void 0===i?void 0:i-s(t)})),n=i.filter((t=>void 0!==t)),r=n.length>0?Math.max(...n):0,a=i.map((t=>void 0===t?void 0:H(r-t))),d=Math.max(0,...a.filter((t=>void 0!==t)));t.forEach(((t,i)=>o(l[t.slot],a[i],d)))}};return i&&s("row",(t=>t.y),(t=>t.top),((t,i)=>{void 0===i?t.bottom=!0:t.top=i})),e&&s("column",(t=>t.x),(t=>t.left),((t,i,e)=>{void 0!==i&&(t.left=i);const l=H(e-(null!=i?i:0));l>0&&(t.right=l)})),l}(s.map((({slot:t,row:i,column:e},l)=>{const s=n[l],h=r[l],c=o[l].frame,u=null!=c?c:d.get(t),v=t=>parseFloat((null==u?void 0:u.style.getPropertyValue(t))||"0")||0,f=c?{slot:t,row:i,column:e,top:v(R.top),left:v(R.left)}:{slot:t,row:i,column:e,top:v("padding-top"),left:v("margin-left")};if(s){const t=a.toLocal(s.getBoundingClientRect());void 0!==h.y&&(f.y=t.y+h.y),void 0!==h.x&&(f.x=t.x+h.x)}return f})),"baseline"===this.resolvedVertical,"baseline"===this.resolvedHorizontal);if(function(t,i){var e,l,s,o,n,r,a,d;const h=new Set([...Object.keys(t),...Object.keys(i)]);for(const c of h){const h=null!==(e=t[c])&&void 0!==e?e:{},u=null!==(l=i[c])&&void 0!==l?l:{};if(!!h.bottom!=!!u.bottom)return!1;if(Math.abs((null!==(s=h.top)&&void 0!==s?s:0)-(null!==(o=u.top)&&void 0!==o?o:0))>=.5)return!1;if(Math.abs((null!==(n=h.left)&&void 0!==n?n:0)-(null!==(r=u.left)&&void 0!==r?r:0))>=.5)return!1;if(Math.abs((null!==(a=h.right)&&void 0!==a?a:0)-(null!==(d=u.right)&&void 0!==d?d:0))>=.5)return!1}return!0}(c,this.offsets))this.adjustments=0;else{if(this.adjustments>=5)return console.warn("bn-grid: the baselines did not settle; the cells keep their last alignment."),void(this.adjustments=0);this.adjustments++,this.offsets=c,this.applyFrameOffsets(),this.schedule()}}observe(t){var i;this.observed.has(t)||(this.observed.add(t),null===(i=this.resizeObserver)||void 0===i||i.observe(t));const e=t=>{var i;t&&(this.observed.has(t)||(this.observed.add(t),null===(i=this.mutationObserver)||void 0===i||i.observe(t,{childList:!0,subtree:!0,attributes:!0,attributeFilter:["x1","y1","x2","y2","x","y","width","height","transform","style","class"]})),t.querySelectorAll("*").forEach((t=>e(t.shadowRoot))))};e(t.shadowRoot)}async getLayoutState(t){var i,e,l,s;const h=null!==(i=null==t?void 0:t.detail)&&void 0!==i?i:"summary",c=n(this.element),u=this.componentStyle((t=>{var i;return(null===(i=t.global)||void 0===i?void 0:i.fontSizePx)||13.3333})),{rows:v,columns:f}=this.gridConfig,g={version:o,tag:this.element.localName,id:d(this.element),slot:null!==(e=this.element.getAttribute("slot"))&&void 0!==e?e:void 0,rect:r(this.element,c),em:{fontSizePx:u,appliedScaleFactor:1},regions:[],metadata:{title:this.chartTitle||void 0,rowCount:v.length,columnCount:f.length,cellCount:v.length*f.length},diagnostics:a(this.element)},p=null===(l=this.element.shadowRoot)||void 0===l?void 0:l.querySelector(".grid-container");if(p&&g.regions.push({id:"grid",rect:r(p,c)}),"full"!==h||!p)return g;const m=[],b=t=>m.push(t),w=p.querySelector(".grid-title");return w&&b({kind:"gridTitle",label:(null===(s=w.textContent)||void 0===s?void 0:s.trim())||void 0,rect:r(w,c)}),p.querySelectorAll(".grid-header-col").forEach(((t,i)=>{var e,l;b({kind:"gridHeader",columnId:null===(e=f[i])||void 0===e?void 0:e.id,label:(null===(l=t.textContent)||void 0===l?void 0:l.trim())||void 0,rect:r(t,c)})})),p.querySelectorAll(".grid-header-row").forEach(((t,i)=>{var e,l;b({kind:"gridHeader",rowId:null===(e=v[i])||void 0===e?void 0:e.id,label:(null===(l=t.textContent)||void 0===l?void 0:l.trim())||void 0,rect:r(t,c)})})),p.querySelectorAll(".grid-cell").forEach(((t,i)=>{var e,l,s,o;b({kind:"gridCell",rowId:f.length>0?null===(e=v[Math.floor(i/f.length)])||void 0===e?void 0:e.id:void 0,columnId:f.length>0?null===(l=f[i%f.length])||void 0===l?void 0:l.id:void 0,slot:null!==(o=null===(s=t.querySelector("slot"))||void 0===s?void 0:s.getAttribute("name"))&&void 0!==o?o:void 0,rect:r(t,c)})})),p.querySelectorAll(".grid-caption").forEach((t=>{var i,e,l,s;b({kind:"gridCaption",slot:null!==(l=null===(e=null===(i=t.parentElement)||void 0===i?void 0:i.querySelector("slot"))||void 0===e?void 0:e.getAttribute("name"))&&void 0!==l?l:void 0,label:(null===(s=t.textContent)||void 0===s?void 0:s.trim())||void 0,rect:r(t,c)})})),g.elements=m,g}getGridStyle(){return this.componentStyle((t=>t["bn-grid"]))}componentWillLoad(){this.validateRowHeaders(this.rowHeaders),this.validateColumnHeaders(this.columnHeaders),this.validateCellHeight(this.cellHeight),this.validateCellWidth(this.cellWidth),this.validateCellVerticalAlign(this.cellVerticalAlign),this.validateCellHorizontalAlign(this.cellHorizontalAlign),this.validateCellCaptions(this.cellCaptions)}updateGridConfig(){this.gridConfig=function(t,i){return{rows:g(t),columns:g(i)}}(this.rowHeaders,this.columnHeaders)}shouldShowRowHeaders(){return this.showRowHeaders&&this.gridConfig.rows.length>0}shouldShowColumnHeaders(){return this.showColumnHeaders&&this.gridConfig.columns.length>0}shouldShowBorders(){return this.showBorders}getGridTemplateColumns(){const t=[];this.shouldShowRowHeaders()&&t.push(this.rowHeaderWidth);const i=this.gridConfig.columns.length||1;for(let e=0;e<i;e++)t.push("equal"===this.resolvedWidth?"minmax(0, 1fr)":"auto");return t.join(" ")}getGridTemplateRows(){const t=[];this.chartTitle&&t.push("auto"),this.shouldShowColumnHeaders()&&t.push("auto");const i=this.gridConfig.rows.length||1;for(let e=0;e<i;e++)t.push("equal"===this.resolvedHeight?"1fr":"auto");return t.join(" ")}renderTitle(){if(!this.chartTitle)return null;const t=(this.shouldShowRowHeaders()?1:0)+this.gridConfig.columns.length;return e("div",{class:"grid-title",style:{"grid-column":"1 / span "+t,"grid-row":"1"}},this.chartTitle)}renderColumnHeaders(){if(!this.shouldShowColumnHeaders())return null;const t=this.getGridStyle(),i=this.shouldShowBorders()?`${t.borderWidth}px solid ${t.borderColor}`:"none",l=this.shouldShowRowHeaders()?2:1,s=this.chartTitle?2:1;return this.gridConfig.columns.map(((o,n)=>{const r=n>0;return e("div",{key:"col-header-"+o.id,class:"grid-header grid-header-col",style:{"grid-column":l+n+"","grid-row":s+"","border-left":r?i:"none",padding:t.cellPadding+"px","padding-left":r?t.cellPadding+4+"px":t.cellPadding+"px"}},o.label)}))}renderDataCells(){const t=this.getGridStyle(),i=this.shouldShowBorders()?`${t.borderWidth}px solid ${t.borderColor}`:"none",l=this.shouldShowRowHeaders()?2:1,s=(this.chartTitle?1:0)+(this.shouldShowColumnHeaders()?1:0)+1,o=[];return this.gridConfig.rows.length>0&&this.gridConfig.columns.length>0&&this.gridConfig.rows.forEach(((n,r)=>{if(this.shouldShowRowHeaders()){const l=r>0;o.push(e("div",{key:"row-header-"+n.id,class:"grid-header grid-header-row",style:{"grid-column":"1","grid-row":s+r+"","border-top":l?i:"none",padding:t.cellPadding+"px","padding-top":l?t.cellPadding+4+"px":t.cellPadding+"px"}},n.label))}this.gridConfig.columns.forEach(((a,d)=>{const h=p(n,a),c=d>0,u=r>0;o.push(e("div",{key:"cell-"+h,class:"grid-cell",style:Object.assign({"grid-column":l+d+"","grid-row":s+r+"","border-left":c?i:"none","border-top":u?i:"none","padding-left":c?t.cellPadding+4+"px":"0","padding-top":u?t.cellPadding+4+"px":"0"},this.cellAlignStyle())},this.renderCellContent(h,t)))}))})),o}cellAlignStyle(){return"top"===this.resolvedVertical&&"left"===this.resolvedHorizontal?{}:{display:"flex","flex-direction":"column","justify-content":x[this.resolvedVertical],"align-items":C[this.resolvedHorizontal]}}renderCellContent(t,i){var l;const s=this.captions[t],o=void 0!==s?e("div",{class:"grid-caption",style:{"font-size":i.captionFontSize+"px","font-weight":i.captionFontWeight+"",color:i.captionColor,"margin-bottom":i.captionGap+"px","align-self":"flex-start"}},s):null,n={};"top"===this.resolvedVertical&&"left"===this.resolvedHorizontal||(n["align-self"]="stretch","center"!==this.resolvedHorizontal&&"right"!==this.resolvedHorizontal||(n.display="flex",n["flex-direction"]="column",n["align-items"]=C[this.resolvedHorizontal])),"center"===this.resolvedVertical?(n["margin-top"]="auto",n["margin-bottom"]="auto"):"bottom"===this.resolvedVertical&&(n["margin-top"]="auto");const r=this.frames.has(t)?{bottom:null===(l=this.offsets[t])||void 0===l?void 0:l.bottom}:this.offsets[t];return(null==r?void 0:r.bottom)&&(n["margin-top"]="auto"),(null==r?void 0:r.top)&&(n["padding-top"]=r.top+"px"),(null==r?void 0:r.left)&&(n["margin-left"]=r.left+"px"),(null==r?void 0:r.right)&&(n["margin-right"]=r.right+"px"),[o,e("div",{class:"grid-slot","data-slot":t,style:n},e("slot",{name:t}))]}getFontStyles(){return this.componentStyle((t=>{var i,e,l,s;return{"--bn-font-family":(null===(i=t.global)||void 0===i?void 0:i.fontFamily)||"'Noto Sans', sans-serif","--bn-font-size":((null===(e=t.global)||void 0===e?void 0:e.fontSizePx)||13.3333)+"px","--bn-font-color":(null===(l=t.global)||void 0===l?void 0:l.fontColor)||"#000000","--bn-font-background":(null===(s=t.global)||void 0===s?void 0:s.fontBackgroundColor)||"#ffffff"}}))}render(){const t="equal"===this.resolvedWidth,i=Object.assign(Object.assign({display:t?"grid":"inline-grid"},t?{width:"100%"}:{}),{"grid-template-columns":this.getGridTemplateColumns(),"grid-template-rows":this.getGridTemplateRows(),gap:this.cellGap});return e(l,{key:"643b4d675bac89c542618e7d6ec5f2c0ef8d6d6c",style:t?Object.assign(Object.assign({},this.getFontStyles()),{display:"block"}):this.getFontStyles()},e("div",{key:"4bc671a6868b313c809f37aeb2f32ca30c7e9142",class:"grid-container",style:i},this.renderTitle(),this.renderColumnHeaders(),this.renderDataCells()),e("slot",{key:"5e66d95c65a0bad59d3816cf0009bb88fbe53f9c"}))}get element(){return this}static get watchers(){return{rowHeaders:[{validateRowHeaders:0}],columnHeaders:[{validateColumnHeaders:0}],cellHeight:[{validateCellHeight:0}],cellWidth:[{validateCellWidth:0}],cellVerticalAlign:[{validateCellVerticalAlign:0}],cellHorizontalAlign:[{validateCellHorizontalAlign:0}],cellCaptions:[{validateCellCaptions:0}]}}static get style(){return':host{display:inline-block;font-family:var(--bn-font-family, "Noto Sans", sans-serif);font-size:var(--bn-font-size, 13.3333px);color:var(--bn-font-color, #000000)}.grid-container{display:inline-grid;box-sizing:border-box}.grid-title{font-weight:normal;padding-bottom:8px}.grid-header{display:flex;align-items:flex-end;box-sizing:border-box}.grid-header-row{justify-content:flex-end;padding-right:8px}.grid-header-col{white-space:nowrap;justify-content:flex-start}.grid-cell{position:relative;box-sizing:border-box}'}},[257,"bn-grid",{selectedStyle:[513,"selected-style"],chartTitle:[1,"chart-title"],rowHeaders:[1,"row-headers"],columnHeaders:[1,"column-headers"],showRowHeaders:[4,"show-row-headers"],showColumnHeaders:[4,"show-column-headers"],i18nNamespace:[513,"i18n-namespace"],showBorders:[4,"show-borders"],rowHeaderWidth:[1,"row-header-width"],cellGap:[1,"cell-gap"],cellHeight:[1,"cell-height"],cellWidth:[1,"cell-width"],cellVerticalAlign:[1,"cell-vertical-align"],cellHorizontalAlign:[1,"cell-horizontal-align"],cellCaptions:[1,"cell-captions"],gridConfig:[32],resolvedHeight:[32],resolvedWidth:[32],resolvedVertical:[32],resolvedHorizontal:[32],captions:[32],offsets:[32],getLayoutState:[64]},void 0,{rowHeaders:[{validateRowHeaders:0}],columnHeaders:[{validateColumnHeaders:0}],cellHeight:[{validateCellHeight:0}],cellWidth:[{validateCellWidth:0}],cellVerticalAlign:[{validateCellVerticalAlign:0}],cellHorizontalAlign:[{validateCellHorizontalAlign:0}],cellCaptions:[{validateCellCaptions:0}]}]),O=A,k=function(){"undefined"!=typeof customElements&&["bn-grid"].forEach((t=>{"bn-grid"===t&&(customElements.get(s(t))||customElements.define(s(t),A))}))};export{O as BnGrid,k as defineCustomElement}
|
|
1
|
+
import{p as t,H as i,h as e,a as l,t as s}from"./p-D6YGOYV1.js";import{LAYOUT_STATE_VERSION as o}from"./index.js";import{o as n,m as r}from"./p-DaOm9YwQ.js";import{r as a,a as d}from"./p-CckAR27O.js";import{l as h}from"./p-CMCnX0iM.js";import{w as c}from"./p-Dq9dG0Kr.js";import{w as u}from"./p-Bo_R7f_T.js";import{w as v}from"./p-DjPWZfry.js";import{w as f}from"./p-4vVbchX2.js";function g(t){if(!t||""===t.trim()||"[]"===t)return[];try{const i=JSON.parse(t);return Array.isArray(i)?i.map(((t,i)=>{var e,l,s;return"string"==typeof t?{label:t,id:i+""}:"object"==typeof t&&null!==t?{label:null!==(l=null!==(e=t.label)&&void 0!==e?e:t.name)&&void 0!==l?l:i+"",id:null!==(s=t.id)&&void 0!==s?s:i+""}:{label:t+"",id:i+""}})):[]}catch(t){return console.error("parseHeaders: failed to parse JSON",t),[]}}function p(t,i){return`${t.id}-${i.id}`}function m(t){if(!t||""===t.trim()||"[]"===t)return[];try{const i=JSON.parse(t);if(!Array.isArray(i))return["Headers must be an array"];const e=[],l=new Set;return i.forEach(((t,i)=>{"object"==typeof t&&null!==t&&void 0!==t.id&&("string"!=typeof t.id?e.push(`Header[${i}]: 'id' must be a string`):l.has(t.id)?e.push(`Header[${i}]: duplicate id '${t.id}'`):l.add(t.id),void 0!==t.label&&"string"!=typeof t.label&&e.push(`Header[${i}]: 'label' must be a string`))})),e}catch(t){return console.error("validateHeadersJson: failed to parse JSON",t),["Invalid JSON structure"]}}const b=["auto","equal"],w=["top","center","bottom","baseline"],y=["left","center","right","baseline"],x={top:"flex-start",center:"center",bottom:"flex-end",baseline:"flex-start"},C={left:"stretch",center:"center",right:"flex-end",baseline:"stretch"},H=t=>Math.round(100*t)/100,j=new Set(["bn-asset","bn-component-style","bn-dataset","bn-datasource","bn-internationalization","bn-ruleset","bn-scaling-group"]),R=new Set(["bn-layout-card"]),S={top:"--bn-baseline-offset-top",left:"--bn-baseline-offset-left",right:"--bn-baseline-offset-right"},O=t(class extends i{validateRowHeaders(t){const i="ERR_rowHeaders",e=m(t);e.length>0?this.errors.addOrReplace({id:i,type:"error",message:"row-headers: "+e.join("; ")}):this.errors.remove(i),this.updateGridConfig()}validateColumnHeaders(t){const i="ERR_columnHeaders",e=m(t);e.length>0?this.errors.addOrReplace({id:i,type:"error",message:"column-headers: "+e.join("; ")}):this.errors.remove(i),this.updateGridConfig()}validateCellHeight(t){this.resolvedHeight=this.validateChoice("cell-height","ERR_cellHeight",t,b,"auto")}validateCellWidth(t){this.resolvedWidth=this.validateChoice("cell-width","ERR_cellWidth",t,b,"auto")}validateCellVerticalAlign(t){this.resolvedVertical=this.validateChoice("cell-vertical-align","ERR_cellVerticalAlign",t,w,"top"),this.schedule()}validateCellHorizontalAlign(t){this.resolvedHorizontal=this.validateChoice("cell-horizontal-align","ERR_cellHorizontalAlign",t,y,"left"),this.schedule()}validateCellCaptions(t){const i=function(t){if(void 0===t||""===t.trim())return{};let i;try{i=JSON.parse(t)}catch(t){return}if("object"!=typeof i||null===i||Array.isArray(i))return;const e={};for(const[t,l]of Object.entries(i)){if("string"!=typeof l)return;""!==l&&(e[t]=l)}return e}(t);i?this.errors.remove("ERR_cellCaptions"):this.errors.addOrReplace({id:"ERR_cellCaptions",type:"error",message:"cell-captions: not a JSON object from slot name to text."}),this.captions=null!=i?i:{}}constructor(t){super(),!1!==t&&this.__registerHost(),this.__attachShadow(),this.gridConfig={rows:[],columns:[]},this.resolvedHeight="auto",this.resolvedWidth="auto",this.resolvedVertical="top",this.resolvedHorizontal="left",this.captions={},this.offsets={},this.frames=new Map,this.observed=new WeakSet,this.scheduled=!1,this.run=0,this.adjustments=0,this.chartTitle="",this.rowHeaders="[]",this.columnHeaders="[]",this.showRowHeaders=!0,this.showColumnHeaders=!0,this.showBorders=!0,this.rowHeaderWidth="auto",this.cellGap="0px",this.cellHeight="auto",this.cellWidth="auto",this.cellVerticalAlign="top",this.cellHorizontalAlign="left",this.cellCaptions="",this.schedule=()=>{if(!this.isBaselineMode())return this.run++,Object.keys(this.offsets).length>0&&(this.offsets={}),void this.applyFrameOffsets();this.scheduled||(this.scheduled=!0,this.holdStatus(new Promise((t=>{requestAnimationFrame((()=>{this.scheduled=!1,this.align().catch((t=>console.error("bn-grid: aligning the baselines failed",t))).finally(t)}))}))))},u(this),this.holdStatus=c(this),this.errors=f(this),this.componentStyle=v(this)}connectedCallback(){var t;this.observed=new WeakSet,this.resizeObserver=new ResizeObserver(this.schedule),this.mutationObserver=new MutationObserver(this.schedule),this.mutationObserver.observe(this.element,{childList:!0,subtree:!0,attributes:!0,attributeFilter:["slot"]}),null===(t=document.fonts)||void 0===t||t.addEventListener("loadingdone",this.schedule)}disconnectedCallback(){var t,i,e;null===(t=this.resizeObserver)||void 0===t||t.disconnect(),null===(i=this.mutationObserver)||void 0===i||i.disconnect(),null===(e=document.fonts)||void 0===e||e.removeEventListener("loadingdone",this.schedule),this.run++}componentDidRender(){this.schedule()}validateChoice(t,i,e,l,s){return null==e||""===e?(this.errors.remove(i),s):l.includes(e)?(this.errors.remove(i),e):(this.errors.addOrReplace({id:i,type:"error",message:`${t}: "${e}" is not one of ${l.join(", ")}.`}),s)}isBaselineMode(){return"baseline"===this.resolvedVertical||"baseline"===this.resolvedHorizontal}contentIn(t){const i=Array.from(this.element.children).find((i=>i.getAttribute("slot")===t));if(!i)return{};const e=[i,...Array.from(i.querySelectorAll("*"))],l=e.find((t=>t.localName.startsWith("bn-")&&!j.has(t.localName)&&!R.has(t.localName))),s=l?e.find((t=>R.has(t.localName)&&t.contains(l))):void 0;return{visual:l,frame:s}}applyFrameOffsets(){this.frames.forEach(((t,i)=>{const e=this.offsets[i];Object.keys(S).forEach((i=>{const l=null==e?void 0:e[i];l?t.style.setProperty(S[i],l+"px"):t.style.removeProperty(S[i])}))}))}async align(){var t;const i=++this.run;if(!this.element.isConnected||!this.isBaselineMode())return;const{rows:e,columns:l}=this.gridConfig,s=e.flatMap(((t,i)=>l.map(((e,l)=>({slot:p(t,e),row:i,column:l}))))),o=s.map((({slot:t})=>this.contentIn(t))),n=o.map((t=>t.visual));if(await Promise.all(n.map((t=>{var i;return null===(i=null==t?void 0:t.componentOnReady)||void 0===i?void 0:i.call(t)}))),i!==this.run)return;n.forEach((t=>t&&this.observe(t)));const r=await Promise.all(n.map((t=>"function"==typeof(null==t?void 0:t.getBaseline)?t.getBaseline().catch((()=>({}))):Promise.resolve({}))));if(i!==this.run)return;const a=h(this.element),d=new Map;null===(t=this.element.shadowRoot)||void 0===t||t.querySelectorAll(".grid-slot").forEach((t=>{var i;d.set(null!==(i=t.getAttribute("data-slot"))&&void 0!==i?i:"",t)})),this.frames=new Map,o.forEach((({frame:t},i)=>t&&this.frames.set(s[i].slot,t)));const c=function(t,i,e){const l={};for(const i of t)l[i.slot]={};const s=(i,e,s,o)=>{var n;const r=new Map;for(const e of t)r.set(e[i],[...null!==(n=r.get(e[i]))&&void 0!==n?n:[],e]);for(const t of r.values()){const i=t.map((t=>{const i=e(t);return void 0===i?void 0:i-s(t)})),n=i.filter((t=>void 0!==t)),r=n.length>0?Math.max(...n):0,a=i.map((t=>void 0===t?void 0:H(r-t))),d=Math.max(0,...a.filter((t=>void 0!==t)));t.forEach(((t,i)=>o(l[t.slot],a[i],d)))}};return i&&s("row",(t=>t.y),(t=>t.top),((t,i)=>{void 0===i?t.bottom=!0:t.top=i})),e&&s("column",(t=>t.x),(t=>t.left),((t,i,e)=>{void 0!==i&&(t.left=i);const l=H(e-(null!=i?i:0));l>0&&(t.right=l)})),l}(s.map((({slot:t,row:i,column:e},l)=>{const s=n[l],h=r[l],c=o[l].frame,u=null!=c?c:d.get(t),v=t=>parseFloat((null==u?void 0:u.style.getPropertyValue(t))||"0")||0,f=c?{slot:t,row:i,column:e,top:v(S.top),left:v(S.left)}:{slot:t,row:i,column:e,top:v("padding-top"),left:v("margin-left")};if(s){const t=a.toLocal(s.getBoundingClientRect());void 0!==h.y&&(f.y=t.y+h.y),void 0!==h.x&&(f.x=t.x+h.x)}return f})),"baseline"===this.resolvedVertical,"baseline"===this.resolvedHorizontal);if(function(t,i){var e,l,s,o,n,r,a,d;const h=new Set([...Object.keys(t),...Object.keys(i)]);for(const c of h){const h=null!==(e=t[c])&&void 0!==e?e:{},u=null!==(l=i[c])&&void 0!==l?l:{};if(!!h.bottom!=!!u.bottom)return!1;if(Math.abs((null!==(s=h.top)&&void 0!==s?s:0)-(null!==(o=u.top)&&void 0!==o?o:0))>=.5)return!1;if(Math.abs((null!==(n=h.left)&&void 0!==n?n:0)-(null!==(r=u.left)&&void 0!==r?r:0))>=.5)return!1;if(Math.abs((null!==(a=h.right)&&void 0!==a?a:0)-(null!==(d=u.right)&&void 0!==d?d:0))>=.5)return!1}return!0}(c,this.offsets))this.adjustments=0;else{if(this.adjustments>=5)return console.warn("bn-grid: the baselines did not settle; the cells keep their last alignment."),void(this.adjustments=0);this.adjustments++,this.offsets=c,this.applyFrameOffsets(),this.schedule()}}observe(t){var i;this.observed.has(t)||(this.observed.add(t),null===(i=this.resizeObserver)||void 0===i||i.observe(t));const e=t=>{var i;t&&(this.observed.has(t)||(this.observed.add(t),null===(i=this.mutationObserver)||void 0===i||i.observe(t,{childList:!0,subtree:!0,attributes:!0,attributeFilter:["x1","y1","x2","y2","x","y","width","height","transform","style","class"]})),t.querySelectorAll("*").forEach((t=>e(t.shadowRoot))))};e(t.shadowRoot)}async getLayoutState(t){var i,e,l,s;const h=null!==(i=null==t?void 0:t.detail)&&void 0!==i?i:"summary",c=n(this.element),u=this.componentStyle((t=>{var i;return(null===(i=t.global)||void 0===i?void 0:i.fontSizePx)||13.3333})),{rows:v,columns:f}=this.gridConfig,g={version:o,tag:this.element.localName,id:d(this.element),slot:null!==(e=this.element.getAttribute("slot"))&&void 0!==e?e:void 0,rect:r(this.element,c),em:{fontSizePx:u,appliedScaleFactor:1},regions:[],metadata:{title:this.chartTitle||void 0,rowCount:v.length,columnCount:f.length,cellCount:v.length*f.length},diagnostics:a(this.element)},p=null===(l=this.element.shadowRoot)||void 0===l?void 0:l.querySelector(".grid-container");if(p&&g.regions.push({id:"grid",rect:r(p,c)}),"full"!==h||!p)return g;const m=[],b=t=>m.push(t),w=p.querySelector(".grid-title");return w&&b({kind:"gridTitle",label:(null===(s=w.textContent)||void 0===s?void 0:s.trim())||void 0,rect:r(w,c)}),p.querySelectorAll(".grid-header-col").forEach(((t,i)=>{var e,l;b({kind:"gridHeader",columnId:null===(e=f[i])||void 0===e?void 0:e.id,label:(null===(l=t.textContent)||void 0===l?void 0:l.trim())||void 0,rect:r(t,c)})})),p.querySelectorAll(".grid-header-row").forEach(((t,i)=>{var e,l;b({kind:"gridHeader",rowId:null===(e=v[i])||void 0===e?void 0:e.id,label:(null===(l=t.textContent)||void 0===l?void 0:l.trim())||void 0,rect:r(t,c)})})),p.querySelectorAll(".grid-cell").forEach(((t,i)=>{var e,l,s,o;b({kind:"gridCell",rowId:f.length>0?null===(e=v[Math.floor(i/f.length)])||void 0===e?void 0:e.id:void 0,columnId:f.length>0?null===(l=f[i%f.length])||void 0===l?void 0:l.id:void 0,slot:null!==(o=null===(s=t.querySelector("slot"))||void 0===s?void 0:s.getAttribute("name"))&&void 0!==o?o:void 0,rect:r(t,c)})})),p.querySelectorAll(".grid-caption").forEach((t=>{var i,e,l,s;b({kind:"gridCaption",slot:null!==(l=null===(e=null===(i=t.parentElement)||void 0===i?void 0:i.querySelector("slot"))||void 0===e?void 0:e.getAttribute("name"))&&void 0!==l?l:void 0,label:(null===(s=t.textContent)||void 0===s?void 0:s.trim())||void 0,rect:r(t,c)})})),g.elements=m,g}getGridStyle(){return this.componentStyle((t=>t["bn-grid"]))}componentWillLoad(){this.validateRowHeaders(this.rowHeaders),this.validateColumnHeaders(this.columnHeaders),this.validateCellHeight(this.cellHeight),this.validateCellWidth(this.cellWidth),this.validateCellVerticalAlign(this.cellVerticalAlign),this.validateCellHorizontalAlign(this.cellHorizontalAlign),this.validateCellCaptions(this.cellCaptions)}updateGridConfig(){this.gridConfig=function(t,i){return{rows:g(t),columns:g(i)}}(this.rowHeaders,this.columnHeaders)}shouldShowRowHeaders(){return this.showRowHeaders&&this.gridConfig.rows.length>0}shouldShowColumnHeaders(){return this.showColumnHeaders&&this.gridConfig.columns.length>0}shouldShowBorders(){return this.showBorders}getGridTemplateColumns(){const t=[];this.shouldShowRowHeaders()&&t.push(this.rowHeaderWidth);const i=this.gridConfig.columns.length||1;for(let e=0;e<i;e++)t.push("equal"===this.resolvedWidth?"minmax(0, 1fr)":"auto");return t.join(" ")}getGridTemplateRows(){const t=[];this.chartTitle&&t.push("auto"),this.shouldShowColumnHeaders()&&t.push("auto");const i=this.gridConfig.rows.length||1;for(let e=0;e<i;e++)t.push("equal"===this.resolvedHeight?"1fr":"auto");return t.join(" ")}renderTitle(){if(!this.chartTitle)return null;const t=(this.shouldShowRowHeaders()?1:0)+this.gridConfig.columns.length;return e("div",{class:"grid-title",style:{"grid-column":"1 / span "+t,"grid-row":"1"}},this.chartTitle)}renderColumnHeaders(){if(!this.shouldShowColumnHeaders())return null;const t=this.getGridStyle(),i=this.shouldShowBorders()?`${t.borderWidth}px solid ${t.borderColor}`:"none",l=this.shouldShowRowHeaders()?2:1,s=this.chartTitle?2:1;return this.gridConfig.columns.map(((o,n)=>{const r=n>0;return e("div",{key:"col-header-"+o.id,class:"grid-header grid-header-col",style:{"grid-column":l+n+"","grid-row":s+"","border-left":r?i:"none",padding:t.cellPadding+"px","padding-left":r?t.cellPadding+4+"px":t.cellPadding+"px"}},o.label)}))}renderDataCells(){const t=this.getGridStyle(),i=this.shouldShowBorders()?`${t.borderWidth}px solid ${t.borderColor}`:"none",l=this.shouldShowRowHeaders()?2:1,s=(this.chartTitle?1:0)+(this.shouldShowColumnHeaders()?1:0)+1,o=[];return this.gridConfig.rows.length>0&&this.gridConfig.columns.length>0&&this.gridConfig.rows.forEach(((n,r)=>{if(this.shouldShowRowHeaders()){const l=r>0;o.push(e("div",{key:"row-header-"+n.id,class:"grid-header grid-header-row",style:{"grid-column":"1","grid-row":s+r+"","border-top":l?i:"none",padding:t.cellPadding+"px","padding-top":l?t.cellPadding+4+"px":t.cellPadding+"px"}},n.label))}this.gridConfig.columns.forEach(((a,d)=>{const h=p(n,a),c=d>0,u=r>0;o.push(e("div",{key:"cell-"+h,class:"grid-cell",style:Object.assign({"grid-column":l+d+"","grid-row":s+r+"","border-left":c?i:"none","border-top":u?i:"none","padding-left":c?t.cellPadding+4+"px":"0","padding-top":u?t.cellPadding+4+"px":"0"},this.cellAlignStyle())},this.renderCellContent(h,t)))}))})),o}cellAlignStyle(){return"top"===this.resolvedVertical&&"left"===this.resolvedHorizontal?{}:{display:"flex","flex-direction":"column","justify-content":x[this.resolvedVertical],"align-items":C[this.resolvedHorizontal]}}renderCellContent(t,i){var l;const s=this.captions[t],o=void 0!==s?e("div",{class:"grid-caption",style:{"font-size":i.captionFontSize+"px","font-weight":i.captionFontWeight+"",color:i.captionColor,"margin-bottom":i.captionGap+"px","align-self":"flex-start"}},s):null,n={};"top"===this.resolvedVertical&&"left"===this.resolvedHorizontal||(n["align-self"]="stretch","center"!==this.resolvedHorizontal&&"right"!==this.resolvedHorizontal||(n.display="flex",n["flex-direction"]="column",n["align-items"]=C[this.resolvedHorizontal])),"center"===this.resolvedVertical?(n["margin-top"]="auto",n["margin-bottom"]="auto"):"bottom"===this.resolvedVertical&&(n["margin-top"]="auto");const r=this.frames.has(t)?{bottom:null===(l=this.offsets[t])||void 0===l?void 0:l.bottom}:this.offsets[t];return(null==r?void 0:r.bottom)&&(n["margin-top"]="auto"),(null==r?void 0:r.top)&&(n["padding-top"]=r.top+"px"),(null==r?void 0:r.left)&&(n["margin-left"]=r.left+"px"),(null==r?void 0:r.right)&&(n["margin-right"]=r.right+"px"),[o,e("div",{class:"grid-slot","data-slot":t,style:n},e("slot",{name:t}))]}getFontStyles(){return this.componentStyle((t=>{var i,e,l,s;return{"--bn-font-family":(null===(i=t.global)||void 0===i?void 0:i.fontFamily)||"'Noto Sans', sans-serif","--bn-font-size":((null===(e=t.global)||void 0===e?void 0:e.fontSizePx)||13.3333)+"px","--bn-font-color":(null===(l=t.global)||void 0===l?void 0:l.fontColor)||"#000000","--bn-font-background":(null===(s=t.global)||void 0===s?void 0:s.fontBackgroundColor)||"#ffffff"}}))}render(){const t="equal"===this.resolvedWidth,i=Object.assign(Object.assign({display:t?"grid":"inline-grid"},t?{width:"100%"}:{}),{"grid-template-columns":this.getGridTemplateColumns(),"grid-template-rows":this.getGridTemplateRows(),gap:this.cellGap});return e(l,{key:"643b4d675bac89c542618e7d6ec5f2c0ef8d6d6c",style:t?Object.assign(Object.assign({},this.getFontStyles()),{display:"block"}):this.getFontStyles()},e("div",{key:"4bc671a6868b313c809f37aeb2f32ca30c7e9142",class:"grid-container",style:i},this.renderTitle(),this.renderColumnHeaders(),this.renderDataCells()),e("slot",{key:"5e66d95c65a0bad59d3816cf0009bb88fbe53f9c"}))}get element(){return this}static get watchers(){return{rowHeaders:[{validateRowHeaders:0}],columnHeaders:[{validateColumnHeaders:0}],cellHeight:[{validateCellHeight:0}],cellWidth:[{validateCellWidth:0}],cellVerticalAlign:[{validateCellVerticalAlign:0}],cellHorizontalAlign:[{validateCellHorizontalAlign:0}],cellCaptions:[{validateCellCaptions:0}]}}static get style(){return':host{display:inline-block;font-family:var(--bn-font-family, "Noto Sans", sans-serif);font-size:var(--bn-font-size, 13.3333px);color:var(--bn-font-color, #000000)}.grid-container{display:inline-grid;box-sizing:border-box}.grid-title{font-weight:normal;padding-bottom:8px}.grid-header{display:flex;align-items:flex-end;box-sizing:border-box}.grid-header-row{justify-content:flex-end;padding-right:8px}.grid-header-col{white-space:nowrap;justify-content:flex-start}.grid-cell{position:relative;box-sizing:border-box}'}},[257,"bn-grid",{selectedStyle:[513,"selected-style"],chartTitle:[1,"chart-title"],rowHeaders:[1,"row-headers"],columnHeaders:[1,"column-headers"],showRowHeaders:[4,"show-row-headers"],showColumnHeaders:[4,"show-column-headers"],i18nNamespace:[513,"i18n-namespace"],showBorders:[4,"show-borders"],rowHeaderWidth:[1,"row-header-width"],cellGap:[1,"cell-gap"],cellHeight:[1,"cell-height"],cellWidth:[1,"cell-width"],cellVerticalAlign:[1,"cell-vertical-align"],cellHorizontalAlign:[1,"cell-horizontal-align"],cellCaptions:[1,"cell-captions"],gridConfig:[32],resolvedHeight:[32],resolvedWidth:[32],resolvedVertical:[32],resolvedHorizontal:[32],captions:[32],offsets:[32],getLayoutState:[64]},void 0,{rowHeaders:[{validateRowHeaders:0}],columnHeaders:[{validateColumnHeaders:0}],cellHeight:[{validateCellHeight:0}],cellWidth:[{validateCellWidth:0}],cellVerticalAlign:[{validateCellVerticalAlign:0}],cellHorizontalAlign:[{validateCellHorizontalAlign:0}],cellCaptions:[{validateCellCaptions:0}]}]),A=O,k=function(){"undefined"!=typeof customElements&&["bn-grid"].forEach((t=>{"bn-grid"===t&&(customElements.get(s(t))||customElements.define(s(t),O))}))};export{A as BnGrid,k as defineCustomElement}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{p as t,H as s,h as e,a as i,t as o}from"./p-D6YGOYV1.js";import{w as n}from"./p-
|
|
1
|
+
import{p as t,H as s,h as e,a as i,t as o}from"./p-D6YGOYV1.js";import{w as n}from"./p-Bo_R7f_T.js";import{w as r}from"./p-Dq9dG0Kr.js";import{w as l}from"./p-DjPWZfry.js";import{g as a}from"./p-DDvWTgk1.js";import{w as c}from"./p-4vVbchX2.js";const f=t(class extends s{constructor(t){super(),!1!==t&&this.__registerHost(),this.__attachShadow(),n(this),r(this),this.errors=c(this),this.componentStyle=l(this)}connectedCallback(){this.stores=a(this.element)}getFontStyles(){return this.componentStyle((t=>{var s,e,i,o;return{"--bn-font-family":(null===(s=t.global)||void 0===s?void 0:s.fontFamily)||"'Noto Sans', sans-serif","--bn-font-size":((null===(e=t.global)||void 0===e?void 0:e.fontSizePx)||13.3333)+"px","--bn-font-color":(null===(i=t.global)||void 0===i?void 0:i.fontColor)||"#000000","--bn-font-background":(null===(o=t.global)||void 0===o?void 0:o.fontBackgroundColor)||"#ffffff"}}))}prepareAssetUrl(t){if(null==t||""===t)return"";const s=this.stores.assets.state;return t.startsWith("asset:")?s[t.substring(6)]:s[t]||t}render(){return e(i,{key:"b303581057c183cc27eb13cfdc389c6b008e9172",style:this.getFontStyles()},null!=this.source&&""!==this.source?e("img",{src:this.prepareAssetUrl(this.source)}):"")}get element(){return this}static get style(){return":host{display:inline-block;position:relative;overflow:hidden}img{max-width:100%;height:auto}"}},[1,"bn-image",{selectedStyle:[513,"selected-style"],source:[1]}]),m=f,h=function(){"undefined"!=typeof customElements&&["bn-image"].forEach((t=>{"bn-image"===t&&(customElements.get(o(t))||customElements.define(o(t),f))}))};export{m as BnImage,h as defineCustomElement}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{p as t,H as s,h as e,a as
|
|
1
|
+
import{p as t,H as s,h as e,a as o,t as i}from"./p-D6YGOYV1.js";import{w as n}from"./p-Do4oPrkE.js";import{g as r,b as a,R as c}from"./p-DDvWTgk1.js";import{e as m}from"./p-ClruFZD_.js";import{w as h}from"./p-Dq9dG0Kr.js";import{w as b}from"./p-4vVbchX2.js";const p=t(class extends s{constructor(t){super(),!1!==t&&this.__registerHost(),this.namespace="_system",h(this),this.errors=b(this),n(this,(t=>{if(this.stores||(this.stores=r(this.element)),""!==t.trim())try{const s=JSON.parse(t);if(null===s||"object"!=typeof s||Array.isArray(s))throw Error("not a JSON object.");const e=a(s);for(const[t,s]of Object.entries(c))t in e&&!(s in e)&&(e[s]=e[t]);const o=this.namespace||"_system",i=Object.assign({},this.stores.internationalization.get(o));i[this.code]=Object.assign(Object.assign({},i[this.code]),e),this.stores.internationalization.set(o,i),this.errors.remove("ERR_body")}catch(t){this.errors.addOrReplace({id:"ERR_body",type:"error",message:"Body: "+m(t)})}else this.errors.remove("ERR_body")}))}render(){return e(o,{key:"7e7454bf0b02ea746a736daaabb09c9ff52b3775"})}get element(){return this}static get style(){return"bn-internationalization{display:none}"}},[0,"bn-internationalization",{code:[1],namespace:[1]}]),f=p,l=function(){"undefined"!=typeof customElements&&["bn-internationalization"].forEach((t=>{"bn-internationalization"===t&&(customElements.get(i(t))||customElements.define(i(t),p))}))};export{f as BnInternationalization,l as defineCustomElement}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{p as t,H as e,h as s,F as
|
|
1
|
+
import{p as t,H as e,h as s,F as r,t as i}from"./p-D6YGOYV1.js";import{g as a}from"./p-DDvWTgk1.js";import{w as n}from"./p-Dq9dG0Kr.js";import{w as o}from"./p-4vVbchX2.js";import{a as l}from"./p-BU_53KVT.js";import{t as d,a as c,b as m,c as h,C as b,d as p}from"./p-Dq4KMCDU.js";import{d as f}from"./p-Chuj-LpI.js";import{d as u}from"./p-2eicD9rF.js";import{d as g}from"./p-fKJx8WtW.js";import{d as y}from"./p-BqUB56k1.js";import{d as x}from"./p-C3gYq-HU.js";const k=t(class extends e{constructor(t){super(),!1!==t&&this.__registerHost(),this.__attachShadow(),this.titleImage="",this.titleBusinessUnit="",this.titleOrder="category",this.titleOrderDirection="asc",this.titleDateFormat="none",this.titleDateLink="none",this.footerText="",this.cardLayout="full",this.cardCustomTemplate='"a b" "c d"',this.cardGridGap="0",this.cardFitToContent=!1,this.cardShowBorder=!0,n(this),this.errors=o(this),this.resolveInherited=l(this,[{propName:"titleScenarios",ancestorAttr:"title-scenarios"},{propName:"titleVariances",ancestorAttr:"title-variances"},{propName:"titleOrder",ancestorAttr:"title-order"},{propName:"titleOrderDirection",ancestorAttr:"title-order-direction"},{propName:"ruleset",ancestorAttr:"ruleset"}])}connectedCallback(){this.stores=a(this.element)}getCommonStyles(){let t="100%";return!0===this.cardFitToContent&&(t="fit-content"),{display:"grid",height:t,width:"100%",gap:this.cardGridGap+"px"}}getGridTemplateColumns(t){return d(this.getTemplatePattern(t))}getRowCount(t){return c(this.getTemplatePattern(t)).length||1}getGridTemplateRows(t){const e=this.getRowCount(t);return this.cardFitToContent?Array(e).fill("auto").join(" "):Array(e).fill("minmax(0, 1fr)").join(" ")}getLayoutStyle(){return Object.assign(Object.assign({},this.getCommonStyles()),{"grid-template-areas":this.getTemplatePattern(this.cardLayout),"grid-template-columns":this.getGridTemplateColumns(this.cardLayout),"grid-template-rows":this.getGridTemplateRows(this.cardLayout)})}createDivAreaStyles(t){return t.map((t=>({display:"flex",overflow:"hidden","grid-area":t})))}getSlots(t){const e=this.createDivAreaStyles(t);return s(r,null,e.map(((t,e)=>s("div",{style:t},s("slot",{name:"card-slot-"+e})))))}extractSlotNames(t){return m(t)}getTemplatePattern(t){return h(t,this.cardCustomTemplate)}componentWillRender(){const t=this.cardLayout===b?p(this.cardCustomTemplate):void 0;t?this.errors.addOrReplace({id:"WARN_cardCustomTemplate",type:"warning",message:"cardCustomTemplate: "+t}):this.errors.remove("WARN_cardCustomTemplate")}setCardClass(){return!0===this.cardShowBorder?"card_box border":"card_box"}titleProp(t){return this.resolveInherited(t,this[t],"").value}prepareTitleImage(t){if(null==t||""===t)return"";const e=this.stores.assets.state;return t.startsWith("asset:")?e[t.substring(6)]:e[t]||t}render(){var t;const e=this.getLayoutStyle(),r=this.extractSlotNames(e["grid-template-areas"]);return s("bn-card",{key:"f9d135554b1ab8a8bee9bb4f7084e465e495e180",styles:this.styles,"selected-style":this.selectedStyle,class:this.setCardClass()},s("div",{key:"54766941aa09df561453f620bd2ecd16f9fd3526",class:"cardtitle"},s("bn-title",{key:"ce2dc7bd84943a6b97068441d9da85a150271227","i18n-namespace":null!==(t=this.i18nNamespace)&&void 0!==t?t:this.titleNamespace,ruleset:this.titleProp("ruleset"),"business-unit":this.titleBusinessUnit,scenarios:this.titleProp("titleScenarios"),variances:this.titleProp("titleVariances"),order:this.titleProp("titleOrder"),"order-direction":this.titleProp("titleOrderDirection"),measures:this.titleMeasures,"date-start":this.titleDateStart,"date-end":this.titleDateEnd,"date-format":this.titleDateFormat,"date-link":this.titleDateLink}),null!=this.titleImage&&""!==this.titleImage?s("img",{class:"image",src:this.prepareTitleImage(this.titleImage)}):""),s("bn-body",{key:"b692bf5149c7c34288b612b7179779030ef2031c"},s("div",{key:"2650ddbbae89f6e63fdeba3f65513446eb22a96f",style:e,"data-bn-fit-content":this.cardFitToContent?this.getRowCount(this.cardLayout)+"":null},this.getSlots(r))),s("bn-footer",{key:"d924118be1d48c4f80b8e6d39f90aa1e2b3a1ff2",text:this.footerText,"page-number":"0","display-page-number":"false"}))}get element(){return this}static get style(){return':host{--bn-baseline-offset-top:0px;--bn-baseline-offset-left:0px;--bn-baseline-offset-right:0px;background:var(--bn-font-background, white);color:var(--bn-font-color, black);font-family:var(--bn-font-family, "Noto Sans", sans-serif);font-size:var(--bn-font-size, 13.3333px);display:flex;flex-direction:column;width:100%;height:100%;overflow:hidden}.cardtitle{display:inline-flex}::slotted(*){flex:1 1 auto;min-width:0}.image{margin-right:0.5em;margin-top:0.5em;z-index:2;background-color:transparent;border:transparent;height:4em;width:auto;display:inline}bn-body{box-sizing:border-box;padding:var(--bn-baseline-offset-top) var(--bn-baseline-offset-right) 0 var(--bn-baseline-offset-left)}'}},[257,"bn-layout-card",{styles:[1],selectedStyle:[1,"selected-style"],ruleset:[1],titleImage:[1,"title-image"],titleBusinessUnit:[1,"title-business-unit"],titleScenarios:[1,"title-scenarios"],titleVariances:[1,"title-variances"],titleOrder:[1,"title-order"],titleOrderDirection:[1,"title-order-direction"],titleMeasures:[1,"title-measures"],titleDateStart:[1,"title-date-start"],titleDateEnd:[1,"title-date-end"],titleDateFormat:[1,"title-date-format"],titleDateLink:[1,"title-date-link"],titleNamespace:[1,"title-namespace"],i18nNamespace:[513,"i18n-namespace"],footerText:[1,"footer-text"],cardLayout:[1,"card-layout"],cardCustomTemplate:[1,"card-custom-template"],cardGridGap:[1,"card-grid-gap"],cardFitToContent:[4,"card-fit-to-content"],cardShowBorder:[4,"card-show-border"]}]),v=k,w=function(){"undefined"!=typeof customElements&&["bn-layout-card","bn-body","bn-card","bn-footer","bn-title","bn-title-renderer"].forEach((t=>{switch(t){case"bn-layout-card":customElements.get(i(t))||customElements.define(i(t),k);break;case"bn-body":customElements.get(i(t))||f();break;case"bn-card":customElements.get(i(t))||u();break;case"bn-footer":customElements.get(i(t))||g();break;case"bn-title":customElements.get(i(t))||y();break;case"bn-title-renderer":customElements.get(i(t))||x()}}))};export{v as BnLayoutCard,w as defineCustomElement}
|