@bino-bi/bn-template-engine 1.0.0-next.49 → 1.0.0-next.51
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-0cad5598.entry.js +1 -0
- package/dist/bn-template-engine/{p-2de524d0.entry.js → p-150bdb68.entry.js} +1 -1
- package/dist/bn-template-engine/{p-Bxa4pX1M.js → p-Bvunba5p.js} +1 -1
- package/dist/bn-template-engine/p-NxJ6P79y.js +1 -0
- package/dist/bn-template-engine/{p-8fc90dc8.entry.js → p-b75a4b52.entry.js} +1 -1
- package/dist/bn-template-engine/{p-510d2ee6.entry.js → p-fdf42a77.entry.js} +1 -1
- package/dist/cjs/bn-annotation-layer_30.cjs.entry.js +1045 -63
- package/dist/cjs/bn-grid.cjs.entry.js +1 -1
- package/dist/cjs/bn-image.cjs.entry.js +1 -1
- package/dist/cjs/bn-template-engine.cjs.js +1 -1
- package/dist/cjs/bn-text.cjs.entry.js +2 -2
- package/dist/cjs/loader.cjs.js +1 -1
- package/dist/cjs/{withStyled-pkdctrK9.js → withStyled-BISQLGLe.js} +9 -0
- package/dist/cjs/{withTranslation-BIzTNYZM.js → withTranslation-B7T30EVU.js} +1 -1
- package/dist/collection/components/bn-annotation-layer/bn-annotation-layer.js +109 -11
- package/dist/collection/components/bn-annotation-layer/utils/marks.js +126 -4
- package/dist/collection/components/bn-annotation-layer/utils/matchPoint.js +2 -1
- package/dist/collection/components/bn-chart-structure/bn-chart-structure-renderer/bn-chart-structure-renderer.js +133 -0
- package/dist/collection/components/bn-chart-structure/bn-chart-structure.js +258 -2
- package/dist/collection/components/bn-chart-structure/utils/StructureChart.js +507 -27
- package/dist/collection/components/bn-chart-structure/utils/elements/Bar.js +3 -1
- package/dist/collection/components/bn-chart-structure/utils/elements/Label.js +12 -0
- package/dist/collection/components/bn-chart-structure/utils/elements/StackedBar.js +23 -8
- package/dist/collection/components/bn-chart-structure/utils/helper/ElementPositions.js +19 -3
- package/dist/collection/components/bn-chart-structure/utils/model/StructureChartComponentConfig.js +23 -0
- package/dist/collection/components/bn-context/bn-context.js +56 -1
- package/dist/collection/components/bn-layout-card/bn-layout-card.js +62 -2
- package/dist/collection/utils/formatter.js +13 -2
- package/dist/collection/utils/validate.js +9 -0
- package/dist/components/bn-annotation-layer.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-context.js +1 -1
- package/dist/components/bn-grid.js +1 -1
- package/dist/components/bn-image.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-page.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-BOwmXBm-.js +1 -0
- package/dist/components/p-Bs5V6Ibu.js +1 -0
- package/dist/components/{p-CVfmhtEW.js → p-CU9CdEBF.js} +1 -1
- package/dist/components/{p-Cc0gaLwp.js → p-CZSp0rSS.js} +1 -1
- package/dist/components/p-CcfvGlBq.js +1 -0
- package/dist/components/p-CiljAoC5.js +1 -0
- package/dist/components/p-D0v9GMIf.js +1 -0
- package/dist/components/{p-DBj1Yd3M.js → p-D65TnLS9.js} +1 -1
- package/dist/components/p-DKcw-1ot.js +1 -0
- package/dist/components/{p-k7heRDPP.js → p-DLmQ_mi7.js} +1 -1
- package/dist/components/p-DOKqRsAu.js +1 -0
- package/dist/components/p-Dpc8_R-Y.js +1 -0
- package/dist/components/p-LHIKI9Dp.js +1 -0
- package/dist/components/{p-Blre9f28.js → p-NdDdfez6.js} +1 -1
- package/dist/components/p-Zz3fAPcH.js +1 -0
- package/dist/components/{p-y12CmIFS.js → p-dSUX43yf.js} +1 -1
- package/dist/components/p-jEqo8YD5.js +1 -0
- package/dist/esm/bn-annotation-layer_30.entry.js +1045 -63
- package/dist/esm/bn-grid.entry.js +1 -1
- package/dist/esm/bn-image.entry.js +1 -1
- package/dist/esm/bn-template-engine.js +1 -1
- package/dist/esm/bn-text.entry.js +2 -2
- package/dist/esm/loader.js +1 -1
- package/dist/esm/{withStyled-B62R20Zx.js → withStyled-CrTxIZ0Q.js} +9 -0
- package/dist/esm/{withTranslation-BEseMLQ6.js → withTranslation-BtSJmx1J.js} +1 -1
- package/dist/schemas/stack.schema.json +42 -0
- package/dist/types/components/bn-annotation-layer/utils/marks.d.ts +53 -0
- package/dist/types/components/bn-annotation-layer/utils/matchPoint.d.ts +2 -0
- package/dist/types/components/bn-chart-structure/bn-chart-structure-renderer/bn-chart-structure-renderer.d.ts +11 -1
- package/dist/types/components/bn-chart-structure/bn-chart-structure.d.ts +49 -0
- package/dist/types/components/bn-chart-structure/utils/StructureChart.d.ts +45 -0
- package/dist/types/components/bn-chart-structure/utils/elements/Label.d.ts +4 -0
- package/dist/types/components/bn-chart-structure/utils/elements/StackedBar.d.ts +13 -1
- package/dist/types/components/bn-chart-structure/utils/helper/ElementPositions.d.ts +13 -1
- package/dist/types/components/bn-chart-structure/utils/model/StructureChartComponentConfig.d.ts +23 -0
- package/dist/types/components/bn-context/bn-context.d.ts +11 -0
- package/dist/types/components/bn-layout-card/bn-layout-card.d.ts +12 -0
- package/dist/types/components.d.ts +113 -2
- package/dist/types/schemas.d.ts +12 -0
- package/dist/types/utils/annotations.d.ts +1 -1
- package/dist/types/utils/formatter.d.ts +5 -0
- package/package.json +1 -1
- package/dist/bn-template-engine/p-BFl7OwcC.js +0 -1
- package/dist/bn-template-engine/p-c1d679af.entry.js +0 -1
- package/dist/components/p-B11cXOLy.js +0 -1
- package/dist/components/p-BVNOmHh4.js +0 -1
- package/dist/components/p-CHhxQoF9.js +0 -1
- package/dist/components/p-CO6bgquz.js +0 -1
- package/dist/components/p-CmvpJzLd.js +0 -1
- package/dist/components/p-CuUfiEu0.js +0 -1
- package/dist/components/p-DHloMyxV.js +0 -1
- package/dist/components/p-Dd1QOWDV.js +0 -1
- package/dist/components/p-HVN8BNWN.js +0 -1
- package/dist/components/p-x0W2_FAX.js +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
import{p as t,H as i,w as e,f as s,h as a,d as n,t as r}from"./p-BnmylmXF.js";import{h as o,a as l}from"./p-6242qMx1.js";import{k as h,v as c,a as d,o as p,i as u,f as v,h as m,n as g,p as f,m as y}from"./p-HVN8BNWN.js";import{w as b}from"./p-CZzlLTQc.js";import{w as S}from"./p-BrQCbmG0.js";import{i as x,w,a as A}from"./p-DBj1Yd3M.js";import{w as M}from"./p-Bp5Xj4-s.js";import{w as _}from"./p-CVfmhtEW.js";import{w as O}from"./p-JG4Sx1lE.js";import{V as N,r as D,F as T,v as L}from"./p-CmvpJzLd.js";import{w as k}from"./p-x0W2_FAX.js";import{w as W,r as F}from"./p-D32TsLzd.js";import{g as P}from"./p-Dsvjkuy3.js";import{r as R,f as j,p as C}from"./p-Xb6Ilq8u.js";import{o as U}from"./p-B6kka9sT.js";import{b as I,e as $,f as B,g as z,h as E}from"./p-DguYWLBj.js";import{D as G}from"./p-ja0FCkHB.js";import{L as V}from"./p-DY5fMUX8.js";import{o as H,m as X}from"./p-DdvG1D18.js";import{r as J,a as q}from"./p-CckAR27O.js";import{a as Y}from"./p-BXP6aagM.js";import{a as Q}from"./p-JofGXz75.js";import{s as Z}from"./p-DakXa7Dp.js";import{d as K}from"./p-DHloMyxV.js";const tt=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(x(t)||h(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(x(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";p(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";u(t)?this.errors.remove(i):"invalid"===R(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";u(t)?this.errors.remove(i):"invalid"===R(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";u(t)||v(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";!m(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=g(t);e.length>0?this.errors.addOrReplace({id:i,type:"warning",message:e.join("; ")}):this.errors.remove(i)}validateScaling(t){if(null==t||""===t||"none"===t||"auto"===t)return void this.errors.remove("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";u(t)||f(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";y(t)?this.errors.remove(i):this.errors.addOrReplace({id:i,type:"warning",message:"measureScale: invalid value '"+(null==t?void 0:""+t)+"' is not supported."})}validateDataFormatDigitsDecimal(t){this.validateDigits("dataFormatDigitsDecimal",t)}validateDataFormatDigitsPercent(t){this.validateDigits("dataFormatDigitsPercent",t)}validateDigits(t,i){const e="WARN_"+t;!m(i)||Number(i)<0||Number(i)>100?this.errors.addOrReplace({id:e,type:"warning",message:t+": invalid value '"+i+"' is not supported."}):this.errors.remove(e)}validateAxisLabelsStep(t){const i="WARN_axisLabelsStep";!m(t)||Number(t)<1?this.errors.addOrReplace({id:i,type:"warning",message:"axisLabelsStep: invalid value '"+t+"' is not supported."}):this.errors.remove(i)}validateAxisTitlePosition(t){const i="WARN_axisTitlePosition";u(t)||["left","right","none"].includes(t.trim().toLowerCase())?this.errors.remove(i):this.errors.addOrReplace({id:i,type:"warning",message:"axisTitlePosition: invalid value '"+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.dataFormatDigitsDecimal=1,this.dataFormatDigitsPercent=2,this.axisLabelsStep=1,this.scenarioSwitch=!1,this.axisTitlePosition="left",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 ≈ ${j(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 ≈ ${j(e)} percentage points.`}))}},_(this),S(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=W(this),M(this),this.componentStyle=O(this),this.ruleSetConfig=k(this),this.t=w(this).t,this.resolveInherited=A(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),this.validateDataFormatDigitsDecimal(this.dataFormatDigitsDecimal),this.validateDataFormatDigitsPercent(this.dataFormatDigitsPercent),this.validateAxisLabelsStep(this.axisLabelsStep),this.validateAxisTitlePosition(this.axisTitlePosition)}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=P(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 F(this.errors,null);const n=this.prepareVariances().some((t=>t.startsWith("dr"))),r="value"===R(this.unitScaling,this.pixelPerUnitGroupMap).kind,o=n&&"value"===R(this.percentageScaling,this.pixelPerUnitGroupMap).kind,{mode:l}=C(this.scale),h="auto"!==l&&"empty"!==l,c=[];a&&r&&c.push("unit-scaling"),a&&o&&c.push("percentage-scaling"),s&&h&&c.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)`),F(this.errors,`Chart exceeds available ${d.join(" and ")}. `+(c.length>0?`Adjust ${c.join(" / ")} or set to "auto".`:"Content does not fit even at minimum auto scaling; enlarge the container."),c.length>0)}componentDidRender(){Z(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}=P(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}=P(this.element);t>0&&Math.abs(t-this._lastObservedWidth)>2&&(this._lastObservedWidth=t,s(this))})),requestAnimationFrame((()=>{requestAnimationFrame((()=>{if(this._autoScaleGuard)return;const{width:t}=P(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}=P(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=P(this.element),i=this.prepareScenarios(),e=this.prepareSegments();this.canvasWidthSegmented=t.width/(i.length+this.prepareVariances().length||1),this._lastAppliedHeight=t.height;const s=Math.max(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()));if(h(a.value))return this.errors.remove("AUTO_scenarios"),[];const n="auto"===(null===(t=a.value)||void 0===t?void 0:t.trim().toLowerCase());return u(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())))}hidesScenarios(){const t=this.resolveInherited("scenarios",this.scenarios);return!t.inherited&&h(t.value)}prepareSegments(){const t=this.hidesScenarios()?[]:[[]],i=new Map;for(const e of this.prepareVariances()){const s=new N(e),a=`${s.type}:${s.delta}`,n=this.scenarioSwitch&&s.isValid?i.get(a):void 0;if(n){n.push(e);continue}const r=[e];t.push(r),s.isValid&&i.set(a,r)}return t}prepareAxisTitlePosition(){var t;const i=null===(t=this.axisTitlePosition)||void 0===t?void 0:t.trim().toLowerCase();return"right"===i||"none"===i?i:"left"}prepareAvg(){return this.showOverlayAvg}prepareMedian(){return this.showOverlayMedian}prepareVariances(){const t=this.resolveInherited("variances",this.variances).value;return u(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 N(i);if(t.isValid)for(const a of[t.base,t.delta])e.includes(a)||s.push(`'${i}' needs '${a}'`)}!this.hidesScenarios()&&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","date-format-short-year"].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(),...D(this.ruleSetConfig("user"))])}static describeScalingInput(t){return""===t?"not set":`invalid value "${t}"`}preparePixelPerUnit(){const i=R(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=R(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){if(this.syncSpaceLeft>-1)return this.syncSpaceLeft;const e="left"===this.prepareAxisTitlePosition()?[...this.prepareVariances(),this.chartTitle]:[];return T.getMaxWidthOfArrayItems([...e,...this.prepareScenarios()],t,i)}prepareChartTitle(t){return t>=1||this.hidesScenarios()?"":this.chartTitle}prepareDateInterval(){var t,i,e;const s="auto"===(null===(t=this.dateInterval)||void 0===t?void 0:t.trim().toLowerCase());return u(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}),G[this.datasetMeta.suggestedDateInterval.toUpperCase()]):s?G.AUTO:void 0:(this.errors.remove("AUTO_dateInterval"),G[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 I[null===(t=this.axisLabelsMode)||void 0===t?void 0:t.toUpperCase().replace("-","_")]}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 u(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(u(this.stack))return this.errors.remove("WARN_stack_dimensions_scenarios"),this.errors.remove("WARN_stack_scenarios_max"),null;try{const t=JSON.parse(this.stack),i=t.by,e="WARN_stack_dimensions_scenarios",s="WARN_stack_scenarios_max",a=this.prepareScenarios();return i===$.DIMENSIONS&&a.length>1&&!this.scenarioSwitch?this.errors.addOrReplace({id:e,type:"warning",message:`stack by dimensions: only the first scenario "${a[0]}" is used, the rest (${a.slice(1).join(", ")}) are discarded.`}):this.errors.remove(e),i===$.SCENARIOS&&a.length>4?this.errors.addOrReplace({id:s,type:"warning",message:`stack by scenarios: at most four scenarios are stacked, the rest (${a.slice(4).join(", ")}) are discarded. Use stack by dimensions for more series.`}):this.errors.remove(s),{by:i,mode:t.mode||z.ABSOLUTE,order:t.order||B.DATASET,notation:"scenario"===t.notation?"scenario":"none",legend:["right","both","none"].includes(t.legend)?t.legend:"left",percentMark:!0===t.percentMark}}catch(t){return this.errors.remove("WARN_stack_dimensions_scenarios"),this.errors.remove("WARN_stack_scenarios_max"),null}}prepareLineFullWidth(){return this.lineFullWidth}prepareChartMode(){var t;const i=null===(t=this.chartMode)||void 0===t?void 0:t.toLowerCase();return"line"===i?E.LINE:"auto"===i?E.AUTO:E.BAR}prepareMaxBars(){return Math.floor(Number(this.maxBars)||28)}chartTemplate(t,i){const e=this.prepareI18n(),s=this.prepareStyle(),n=P(this.element).width,r=this.preparePixelPerUnit(),o=this.preparePixelPerPercentage(),l=this.prepareStackConfig(),h=0===t.length,c=this.hidesScenarios()?L(t):this.prepareScenarios(),d=h&&(null==l?void 0:l.by)===$.DIMENSIONS&&!this.scenarioSwitch?c.slice(0,1):c;return a("bn-chart-time-renderer",{tableName:this.datasetName,dataVersion:this.dataVersion,chartTitle:this.prepareChartTitle(i),scenarios:d,variances:t.length>0?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(),dataFormatDigits:{percent:this.dataFormatDigitsPercent,decimal:this.dataFormatDigitsDecimal},axisLabelsStep:Math.max(1,Math.floor(Number(this.axisLabelsStep)||1)),scenarioSwitch:this.scenarioSwitch,axisTitlePosition:this.prepareAxisTitlePosition(),containerWidth:n,parentDimensions:this.prepareDimension(),ruleSetConfig:this.ruleSetConfig()})}async getBaseline(){return Q(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=H(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,c=this.prepareVariances(),d=Y(this.element,"bn-chart-time-renderer",this.prepareSegments().map((t=>t.length>0?t.join(","):"base")),r,n),p=null===(e=this.element.shadowRoot)||void 0===e?void 0:e.querySelector("bn-chart-time-renderer"),u={version:V,tag:this.element.localName,id:q(this.element),slot:null!==(s=this.element.getAttribute("slot"))&&void 0!==s?s:void 0,rect:X(this.element,r),em:{fontSizePx:h,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:c,barCount:d.barCount,chartMode:this.chartMode||void 0,hasNoData:0===d.barCount},diagnostics:J(this.element),scaling:this.resolveScalingInfo(h),baseline:d.baseline};return d.elements&&(u.elements=d.elements),u}resolveScalingInfo(t){var i,e;const s={},a=R(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=R(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(){this.checkVarianceScenarios(this.prepareVariances());const t=this.prepareSegments();0===t.length?this.errors.addOrReplace({id:"WARN_scenarios_none",type:"warning",message:"scenarios: none needs at least one variance, the chart is empty."}):this.errors.remove("WARN_scenarios_none");const i=this.getFontStyles();return a(n,{key:"c998214052bad19811135a7c48e669d6ebfdb8cc",style:i},a("div",{key:"8c877fda1575246a4cecc5610aa3b66d6b6f60ce",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}],dataFormatDigitsDecimal:[{validateDataFormatDigitsDecimal:0}],dataFormatDigitsPercent:[{validateDataFormatDigitsPercent:0}],axisLabelsStep:[{validateAxisLabelsStep:0}],axisTitlePosition:[{validateAxisTitlePosition: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"],dataFormatDigitsDecimal:[2,"data-format-digits-decimal"],dataFormatDigitsPercent:[2,"data-format-digits-percent"],axisLabelsStep:[2,"axis-labels-step"],scenarioSwitch:[4,"scenario-switch"],axisTitlePosition:[1,"axis-title-position"],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}],dataFormatDigitsDecimal:[{validateDataFormatDigitsDecimal:0}],dataFormatDigitsPercent:[{validateDataFormatDigitsPercent:0}],axisLabelsStep:[{validateAxisLabelsStep:0}],axisTitlePosition:[{validateAxisTitlePosition:0}]}]),it=tt,et=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),tt);break;case"bn-chart-time-renderer":customElements.get(r(t))||K()}}))};export{it as BnChartTime,et as defineCustomElement}
|
|
1
|
+
import{p as t,H as i,w as e,f as s,h as a,d as n,t as r}from"./p-BnmylmXF.js";import{h as o,a as l}from"./p-6242qMx1.js";import{k as h,v as c,a as d,o as p,i as u,f as v,h as m,n as g,p as f,m as b}from"./p-CcfvGlBq.js";import{w as y}from"./p-CZzlLTQc.js";import{w as S}from"./p-BrQCbmG0.js";import{i as x,w,a as A}from"./p-D65TnLS9.js";import{w as M}from"./p-Bp5Xj4-s.js";import{w as _}from"./p-CU9CdEBF.js";import{w as O}from"./p-JG4Sx1lE.js";import{r as T}from"./p-D0v9GMIf.js";import{w as D}from"./p-Bs5V6Ibu.js";import{w as N,r as L}from"./p-D32TsLzd.js";import{g as k}from"./p-Dsvjkuy3.js";import{r as W,f as F,p as P}from"./p-Xb6Ilq8u.js";import{o as j}from"./p-B6kka9sT.js";import{V as R,F as C,v as U}from"./p-Zz3fAPcH.js";import{b as I,e as $,f as B,g as z,h as E}from"./p-DguYWLBj.js";import{D as G}from"./p-ja0FCkHB.js";import{L as V}from"./p-DY5fMUX8.js";import{o as H,m as X}from"./p-DdvG1D18.js";import{r as q,a as J}from"./p-CckAR27O.js";import{a as Y}from"./p-BXP6aagM.js";import{a as Z}from"./p-JofGXz75.js";import{s as Q}from"./p-DakXa7Dp.js";import{d as K}from"./p-CiljAoC5.js";const tt=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(x(t)||h(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(x(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";p(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";u(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";u(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)}validateDateInterval(t){const i="WARN_dateInterval";u(t)||v(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";!m(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=g(t);e.length>0?this.errors.addOrReplace({id:i,type:"warning",message:e.join("; ")}):this.errors.remove(i)}validateScaling(t){if(null==t||""===t||"none"===t||"auto"===t)return void this.errors.remove("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";u(t)||f(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";b(t)?this.errors.remove(i):this.errors.addOrReplace({id:i,type:"warning",message:"measureScale: invalid value '"+(null==t?void 0:""+t)+"' is not supported."})}validateDataFormatDigitsDecimal(t){this.validateDigits("dataFormatDigitsDecimal",t)}validateDataFormatDigitsPercent(t){this.validateDigits("dataFormatDigitsPercent",t)}validateDigits(t,i){const e="WARN_"+t;!m(i)||Number(i)<0||Number(i)>100?this.errors.addOrReplace({id:e,type:"warning",message:t+": invalid value '"+i+"' is not supported."}):this.errors.remove(e)}validateAxisLabelsStep(t){const i="WARN_axisLabelsStep";!m(t)||Number(t)<1?this.errors.addOrReplace({id:i,type:"warning",message:"axisLabelsStep: invalid value '"+t+"' is not supported."}):this.errors.remove(i)}validateAxisTitlePosition(t){const i="WARN_axisTitlePosition";u(t)||["left","right","none"].includes(t.trim().toLowerCase())?this.errors.remove(i):this.errors.addOrReplace({id:i,type:"warning",message:"axisTitlePosition: invalid value '"+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.dataFormatDigitsDecimal=1,this.dataFormatDigitsPercent=2,this.axisLabelsStep=1,this.scenarioSwitch=!1,this.axisTitlePosition="left",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 ≈ ${F(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 ≈ ${F(e)} percentage points.`}))}},_(this),S(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=N(this),M(this),this.componentStyle=O(this),this.ruleSetConfig=D(this),this.t=w(this).t,this.resolveInherited=A(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),this.validateDataFormatDigitsDecimal(this.dataFormatDigitsDecimal),this.validateDataFormatDigitsPercent(this.dataFormatDigitsPercent),this.validateAxisLabelsStep(this.axisLabelsStep),this.validateAxisTitlePosition(this.axisTitlePosition)}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=k(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 L(this.errors,null);const n=this.prepareVariances().some((t=>t.startsWith("dr"))),r="value"===W(this.unitScaling,this.pixelPerUnitGroupMap).kind,o=n&&"value"===W(this.percentageScaling,this.pixelPerUnitGroupMap).kind,{mode:l}=P(this.scale),h="auto"!==l&&"empty"!==l,c=[];a&&r&&c.push("unit-scaling"),a&&o&&c.push("percentage-scaling"),s&&h&&c.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)`),L(this.errors,`Chart exceeds available ${d.join(" and ")}. `+(c.length>0?`Adjust ${c.join(" / ")} or set to "auto".`:"Content does not fit even at minimum auto scaling; enlarge the container."),c.length>0)}componentDidRender(){Q(this.element,"bn-chart-time-renderer");const{mode:t}=P(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}=k(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=j(this.element,(()=>{if(this._autoScaleGuard)return;const{width:t}=k(this.element);t>0&&Math.abs(t-this._lastObservedWidth)>2&&(this._lastObservedWidth=t,s(this))})),requestAnimationFrame((()=>{requestAnimationFrame((()=>{if(this._autoScaleGuard)return;const{width:t}=k(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}=k(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=k(this.element),i=this.prepareScenarios(),e=this.prepareSegments();this.canvasWidthSegmented=t.width/(i.length+this.prepareVariances().length||1),this._lastAppliedHeight=t.height;const s=Math.max(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()));if(h(a.value))return this.errors.remove("AUTO_scenarios"),[];const n="auto"===(null===(t=a.value)||void 0===t?void 0:t.trim().toLowerCase());return u(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())))}hidesScenarios(){const t=this.resolveInherited("scenarios",this.scenarios);return!t.inherited&&h(t.value)}prepareSegments(){const t=this.hidesScenarios()?[]:[[]],i=new Map;for(const e of this.prepareVariances()){const s=new R(e),a=`${s.type}:${s.delta}`,n=this.scenarioSwitch&&s.isValid?i.get(a):void 0;if(n){n.push(e);continue}const r=[e];t.push(r),s.isValid&&i.set(a,r)}return t}prepareAxisTitlePosition(){var t;const i=null===(t=this.axisTitlePosition)||void 0===t?void 0:t.trim().toLowerCase();return"right"===i||"none"===i?i:"left"}prepareAvg(){return this.showOverlayAvg}prepareMedian(){return this.showOverlayMedian}prepareVariances(){const t=this.resolveInherited("variances",this.variances).value;return u(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 R(i);if(t.isValid)for(const a of[t.base,t.delta])e.includes(a)||s.push(`'${i}' needs '${a}'`)}!this.hidesScenarios()&&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","date-format-short-year"].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=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)}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){if(this.syncSpaceLeft>-1)return this.syncSpaceLeft;const e="left"===this.prepareAxisTitlePosition()?[...this.prepareVariances(),this.chartTitle]:[];return C.getMaxWidthOfArrayItems([...e,...this.prepareScenarios()],t,i)}prepareChartTitle(t){return t>=1||this.hidesScenarios()?"":this.chartTitle}prepareDateInterval(){var t,i,e;const s="auto"===(null===(t=this.dateInterval)||void 0===t?void 0:t.trim().toLowerCase());return u(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}),G[this.datasetMeta.suggestedDateInterval.toUpperCase()]):s?G.AUTO:void 0:(this.errors.remove("AUTO_dateInterval"),G[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 I[null===(t=this.axisLabelsMode)||void 0===t?void 0:t.toUpperCase().replace("-","_")]}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 u(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(u(this.stack))return this.errors.remove("WARN_stack_dimensions_scenarios"),this.errors.remove("WARN_stack_scenarios_max"),null;try{const t=JSON.parse(this.stack),i=t.by,e="WARN_stack_dimensions_scenarios",s="WARN_stack_scenarios_max",a=this.prepareScenarios();return i===$.DIMENSIONS&&a.length>1&&!this.scenarioSwitch?this.errors.addOrReplace({id:e,type:"warning",message:`stack by dimensions: only the first scenario "${a[0]}" is used, the rest (${a.slice(1).join(", ")}) are discarded.`}):this.errors.remove(e),i===$.SCENARIOS&&a.length>4?this.errors.addOrReplace({id:s,type:"warning",message:`stack by scenarios: at most four scenarios are stacked, the rest (${a.slice(4).join(", ")}) are discarded. Use stack by dimensions for more series.`}):this.errors.remove(s),{by:i,mode:t.mode||z.ABSOLUTE,order:t.order||B.DATASET,notation:"scenario"===t.notation?"scenario":"none",legend:["right","both","none"].includes(t.legend)?t.legend:"left",percentMark:!0===t.percentMark}}catch(t){return this.errors.remove("WARN_stack_dimensions_scenarios"),this.errors.remove("WARN_stack_scenarios_max"),null}}prepareLineFullWidth(){return this.lineFullWidth}prepareChartMode(){var t;const i=null===(t=this.chartMode)||void 0===t?void 0:t.toLowerCase();return"line"===i?E.LINE:"auto"===i?E.AUTO:E.BAR}prepareMaxBars(){return Math.floor(Number(this.maxBars)||28)}chartTemplate(t,i){const e=this.prepareI18n(),s=this.prepareStyle(),n=k(this.element).width,r=this.preparePixelPerUnit(),o=this.preparePixelPerPercentage(),l=this.prepareStackConfig(),h=0===t.length,c=this.hidesScenarios()?U(t):this.prepareScenarios(),d=h&&(null==l?void 0:l.by)===$.DIMENSIONS&&!this.scenarioSwitch?c.slice(0,1):c;return a("bn-chart-time-renderer",{tableName:this.datasetName,dataVersion:this.dataVersion,chartTitle:this.prepareChartTitle(i),scenarios:d,variances:t.length>0?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(),dataFormatDigits:{percent:this.dataFormatDigitsPercent,decimal:this.dataFormatDigitsDecimal},axisLabelsStep:Math.max(1,Math.floor(Number(this.axisLabelsStep)||1)),scenarioSwitch:this.scenarioSwitch,axisTitlePosition:this.prepareAxisTitlePosition(),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=H(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,c=this.prepareVariances(),d=Y(this.element,"bn-chart-time-renderer",this.prepareSegments().map((t=>t.length>0?t.join(","):"base")),r,n),p=null===(e=this.element.shadowRoot)||void 0===e?void 0:e.querySelector("bn-chart-time-renderer"),u={version:V,tag:this.element.localName,id:J(this.element),slot:null!==(s=this.element.getAttribute("slot"))&&void 0!==s?s:void 0,rect:X(this.element,r),em:{fontSizePx:h,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:c,barCount:d.barCount,chartMode:this.chartMode||void 0,hasNoData:0===d.barCount},diagnostics:q(this.element),scaling:this.resolveScalingInfo(h),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 n=W(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}=P(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(){this.checkVarianceScenarios(this.prepareVariances());const t=this.prepareSegments();0===t.length?this.errors.addOrReplace({id:"WARN_scenarios_none",type:"warning",message:"scenarios: none needs at least one variance, the chart is empty."}):this.errors.remove("WARN_scenarios_none");const i=this.getFontStyles();return a(n,{key:"c998214052bad19811135a7c48e669d6ebfdb8cc",style:i},a("div",{key:"8c877fda1575246a4cecc5610aa3b66d6b6f60ce",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}],dataFormatDigitsDecimal:[{validateDataFormatDigitsDecimal:0}],dataFormatDigitsPercent:[{validateDataFormatDigitsPercent:0}],axisLabelsStep:[{validateAxisLabelsStep:0}],axisTitlePosition:[{validateAxisTitlePosition: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"],dataFormatDigitsDecimal:[2,"data-format-digits-decimal"],dataFormatDigitsPercent:[2,"data-format-digits-percent"],axisLabelsStep:[2,"axis-labels-step"],scenarioSwitch:[4,"scenario-switch"],axisTitlePosition:[1,"axis-title-position"],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}],dataFormatDigitsDecimal:[{validateDataFormatDigitsDecimal:0}],dataFormatDigitsPercent:[{validateDataFormatDigitsPercent:0}],axisLabelsStep:[{validateAxisLabelsStep:0}],axisTitlePosition:[{validateAxisTitlePosition:0}]}]),it=tt,et=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),tt);break;case"bn-chart-time-renderer":customElements.get(r(t))||K()}}))};export{it as BnChartTime,et as defineCustomElement}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{p as t,H as e,e as
|
|
1
|
+
import{p as t,H as e,e as o,f as n,h as i,d as a,t as s}from"./p-BnmylmXF.js";import{F as r}from"./p-Zz3fAPcH.js";import{S as c,e as l}from"./p-6242qMx1.js";import{L as p}from"./p-DY5fMUX8.js";import{m as u,t as m}from"./p-DdvG1D18.js";import{r as d,a as h,b,c as g}from"./p-CckAR27O.js";import{b as f}from"./p-VtNvNyZK.js";import{w as y}from"./p-BrQCbmG0.js";import{m as v}from"./p-JG4Sx1lE.js";import{w as x}from"./p-D32TsLzd.js";import{b as S}from"./p-DM7fwmH4.js";function w(t){if("function"==typeof getComputedStyle){const e=parseFloat(getComputedStyle(t).fontSize);if(Number.isFinite(e)&&e>0)return e}return c.global.fontSizePx}function j(t,e){var o;return{version:p,tag:t.localName,id:h(t),slot:null!==(o=t.getAttribute("slot"))&&void 0!==o?o:void 0,rect:u(t,e),em:{fontSizePx:w(t),appliedScaleFactor:1},regions:[],metadata:{},diagnostics:d(t)}}const L=["format","orientation","page-format","page-orientation","render-orientation","page-number"],P=(t,e,o)=>{const n=t[e];return"string"==typeof n?n:e in t?null:t.getAttribute(o)},D=t(class extends e{constructor(t){super(),!1!==t&&this.__registerHost(),this.__attachShadow(),this.bnNotationChange=o(this,"bnNotationChange",7),this.groupSeparator="",this.setsGroupSeparator=!1,this.assignedPageNumbers=new WeakMap,this.notationSubscriptions=[],y(this),this.errors=x(this)}setGroupSeparator(t){var e;r.groupSeparator=t?null!==(e={"thin-space":" ",space:" ",none:""}[t])&&void 0!==e?e:t:null,this.setsGroupSeparator=!!t}setLocale(t){this.stores.context.state.locale=t}connectedCallback(){this.stores=l(this.element),this.locale&&(this.stores.context.state.locale=this.locale),this.groupSeparator&&this.setGroupSeparator(this.groupSeparator);const t=()=>this.bnNotationChange.emit();this.notationSubscriptions=[this.stores.scalingGroups.on("set",t),this.stores.componentStyles.on("set",t)],this.syncPages(),this.pageObserver=new MutationObserver((()=>this.syncPages())),this.pageObserver.observe(this.element,{childList:!0,subtree:!0,attributes:!0,attributeFilter:L})}disconnectedCallback(){var t,e;this.setsGroupSeparator&&(r.groupSeparator=null,this.setsGroupSeparator=!1),this.notationSubscriptions.forEach((t=>t())),this.notationSubscriptions=[],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 o="bn-layout-page"===t.localName?t:t.querySelector("bn-footer");if(!o)return;const n=P(o,"pageNumber","page-number");if(null!==n&&n!==this.assignedPageNumbers.get(o))return;const i=""+(e+1);this.assignedPageNumbers.set(o,i),n!==i&&o.setAttribute("page-number",i)}));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 o;if(!t||document.querySelector("bn-context")!==this.element)return null===(o=this.pageSizeStyle)||void 0===o||o.remove(),void(this.pageSizeStyle=void 0);const n="bn-layout-page"===t.localName?S(P(t,"pageFormat","page-format"),P(t,"pageOrientation","page-orientation"),e):S(P(t,"format","format"),P(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!==n&&(this.pageSizeStyle.textContent=n)}async getLayoutState(t){var e,o;const n=null!==(e=null==t?void 0:t.detail)&&void 0!==e?e:"summary",i=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(i.map((t=>{var e,o,n;return null!==(n=null===(o=(e=t).componentOnReady)||void 0===o?void 0:o.call(e))&&void 0!==n?n:Promise.resolve()})));const a=this.element.getBoundingClientRect(),s={x:a.left,y:a.top},r=await Promise.all(i.map((async t=>{const e=t.getBoundingClientRect(),o={context:s,component:{x:e.left,y:e.top}};try{const e=t;return"function"==typeof e.getLayoutState?await e.getLayoutState({detail:n}):j(t,o)}catch(e){let n;try{n=j(t,o)}catch(e){const o={x:0,y:0,width:0,height:0};n={version:p,tag:t.localName,id:t.localName,rect:{context:Object.assign({},o),component:Object.assign({},o)},em:{fontSizePx:0,appliedScaleFactor:1},regions:[],metadata:{},diagnostics:[]}}return n.error=(e instanceof Error?e.message:e)+"",n}}))),c=b(i.map((t=>({tag:t.localName,explicitId:g(t)}))));return r.forEach(((t,e)=>{t.id=c[e]})),{version:p,generatedAt:(new Date).toISOString(),detail:n,context:{viewport:m(a),locale:null===(o=this.stores)||void 0===o?void 0:o.context.state.locale},components:r}}async getNotation(t){const e=Array.from(this.element.querySelectorAll("bn-component-style, bn-scaling-group"));return await Promise.all(e.map((t=>{var e,o;return null!==(o=null===(e=t.componentOnReady)||void 0===e?void 0:e.call(t))&&void 0!==o?o:Promise.resolve()}))),f(v(this.stores.componentStyles.state,t),this.stores.scalingGroups.state)}componentWillLoad(){}componentDidLoad(){}componentShouldUpdate(){}componentWillRender(){}componentDidRender(){}componentWillUpdate(){}componentDidUpdate(){}render(){return i(a,{key:"71bdc7dcbcadcae35b67f4d3fbb47e8ee204b3bb"},i("slot",{key:"c2fb4c85cb1a3b3af6ec013d0e558c0ef611358d"}))}get element(){return this}static get watchers(){return{groupSeparator:[{setGroupSeparator:0}],locale:[{setLocale:0}]}}static get style(){return":host{display:block}"}},[257,"bn-context",{locale:[1],i18nNamespace:[513,"i18n-namespace"],renderOrientation:[513,"render-orientation"],groupSeparator:[1,"group-separator"],getLayoutState:[64],getNotation:[64]},void 0,{groupSeparator:[{setGroupSeparator:0}],locale:[{setLocale:0}]}]),N=D,k=function(){"undefined"!=typeof customElements&&["bn-context"].forEach((t=>{"bn-context"===t&&(customElements.get(s(t))||customElements.define(s(t),D))}))};export{N as BnContext,k as defineCustomElement}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{p as t,H as i,h as e,d as o,t as l}from"./p-BnmylmXF.js";import{L as s}from"./p-DY5fMUX8.js";import{o as n,m as r}from"./p-DdvG1D18.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-BrQCbmG0.js";import{w as u}from"./p-CVfmhtEW.js";import{w as v}from"./p-JG4Sx1lE.js";import{w as f}from"./p-D32TsLzd.js";function p(t){if(!t||""===t.trim()||"[]"===t)return[];try{const i=JSON.parse(t);return Array.isArray(i)?i.map(((t,i)=>{var e,o,l;return"string"==typeof t?{label:t,id:i+""}:"object"==typeof t&&null!==t?{label:null!==(o=null!==(e=t.label)&&void 0!==e?e:t.name)&&void 0!==o?o:i+"",id:null!==(l=t.id)&&void 0!==l?l:i+""}:{label:t+"",id:i+""}})):[]}catch(t){return console.error("parseHeaders: failed to parse JSON",t),[]}}function g(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=[],o=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`):o.has(t.id)?e.push(`Header[${i}]: duplicate id '${t.id}'`):o.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"],C={top:"flex-start",center:"center",bottom:"flex-end",baseline:"flex-start"},S={left:"stretch",center:"center",right:"flex-end",baseline:"stretch"};function x(t){if(null===t||""===t.trim())return 1;const i=Number(t);return Number.isInteger(i)&&i>=1?i:void 0}function H(t,i,e){var o,l;const s=Array.from({length:t},(()=>Array(i))),n=[],r=[];for(let a=0;a<t;a++)for(let d=0;d<i;d++){const h=s[a][d];if(h){r.push({row:a,column:d,by:h});continue}const c=e(a,d),u=Math.min(null!==(o=null==c?void 0:c.rowSpan)&&void 0!==o?o:1,t-a);let v=1;const f=Math.min(null!==(l=null==c?void 0:c.columnSpan)&&void 0!==l?l:1,i-d);for(;v<f&&!s[a][d+v];)v++;const p={row:a,column:d,rowSpan:u,columnSpan:v};for(let t=a;t<a+u;t++)for(let i=d;i<d+v;i++)s[t][i]=p;n.push(p)}return{cells:n,covered:r}}const j=t=>Math.round(100*t)/100,R=new Set(["bn-asset","bn-component-style","bn-dataset","bn-datasource","bn-internationalization","bn-ruleset","bn-scaling-group"]),A=new Set(["bn-layout-card"]),O={top:"--bn-baseline-offset-top",left:"--bn-baseline-offset-left",right:"--bn-baseline-offset-right"},k=["row-span","column-span","cell-background"],z=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,o]of Object.entries(i)){if("string"!=typeof o)return;""!==o&&(e[t]=o)}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.cellAttributes={},this.placed=[],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.readCellAttributes(),this.checkCoveredSlots(),this.schedule()})),this.mutationObserver.observe(this.element,{childList:!0,subtree:!0,attributes:!0,attributeFilter:["slot",...k]}),null===(t=document.fonts)||void 0===t||t.addEventListener("loadingdone",this.schedule),this.readCellAttributes()}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,o,l){return null==e||""===e?(this.errors.remove(i),l):o.includes(e)?(this.errors.remove(i),e):(this.errors.addOrReplace({id:i,type:"error",message:`${t}: "${e}" is not one of ${o.join(", ")}.`}),l)}readCellAttributes(){const t={},i=[];for(const e of Array.from(this.element.children)){const o=e.getAttribute("slot");if(null===o)continue;const l=t=>{const l=x(e.getAttribute(t));return void 0===l&&i.push(`${t} of slot "${o}"`),null!=l?l:1},s={rowSpan:l("row-span"),columnSpan:l("column-span")},n=e.getAttribute("cell-background");n&&(s.background=n),(s.rowSpan>1||s.columnSpan>1||s.background)&&(t[o]=s)}i.length>0?this.errors.addOrReplace({id:"ERR_cellSpan",type:"error",message:i.join(", ")+": not a whole number from 1."}):this.errors.remove("ERR_cellSpan"),JSON.stringify(t)!==JSON.stringify(this.cellAttributes)&&(this.cellAttributes=t)}placeDataCells(){const{rows:t,columns:i}=this.gridConfig,e=(e,o)=>g(t[e],i[o]),{cells:o}=H(t.length,i.length,((t,i)=>this.cellAttributes[e(t,i)]));this.placed=o.map((t=>Object.assign(Object.assign({},t),{slot:e(t.row,t.column)}))),this.checkCoveredSlots()}checkCoveredSlots(){var t;const{rows:i,columns:e}=null!==(t=this.gridConfig)&&void 0!==t?t:{rows:[],columns:[]},o=(t,o)=>g(i[t],e[o]),{covered:l}=H(i.length,e.length,((t,i)=>this.cellAttributes[o(t,i)])),s=new Set(Array.from(this.element.children).map((t=>t.getAttribute("slot")))),n=l.filter((({row:t,column:i})=>s.has(o(t,i))));if(n.length>0){const t=n.map((({row:t,column:i,by:e})=>`"${o(t,i)}" (covered by "${o(e.row,e.column)}")`));this.errors.addOrReplace({id:"WARN_cellSpan",type:"warning",message:`a span covers the slot ${t.join(", ")}: its content is not shown.`})}else this.errors.remove("WARN_cellSpan")}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("*"))],o=e.find((t=>t.localName.startsWith("bn-")&&!R.has(t.localName)&&!A.has(t.localName))),l=o?e.find((t=>A.has(t.localName)&&t.contains(o))):void 0;return{visual:o,frame:l}}applyFrameOffsets(){this.frames.forEach(((t,i)=>{const e=this.offsets[i];Object.keys(O).forEach((i=>{const o=null==e?void 0:e[i];o?t.style.setProperty(O[i],o+"px"):t.style.removeProperty(O[i])}))}))}async align(){var t;const i=++this.run;if(!this.element.isConnected||!this.isBaselineMode())return;const e=this.placed,o=e.map((({slot:t})=>this.contentIn(t))),l=o.map((t=>t.visual));if(await Promise.all(l.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;l.forEach((t=>t&&this.observe(t)));const s=await Promise.all(l.map((t=>"function"==typeof(null==t?void 0:t.getBaseline)?t.getBaseline().catch((()=>({}))):Promise.resolve({}))));if(i!==this.run)return;const n=h(this.element),r=new Map;null===(t=this.element.shadowRoot)||void 0===t||t.querySelectorAll(".grid-slot").forEach((t=>{var i;r.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(e[i].slot,t)));const a=function(t,i,e){const o={};for(const i of t)o[i.slot]={};const l=(i,e,l,s,n)=>{var r,a;const d=new Map;for(const o of t)(null!==(r=o[e])&&void 0!==r?r:1)>1||d.set(o[i],[...null!==(a=d.get(o[i]))&&void 0!==a?a:[],o]);for(const t of d.values()){const i=t.map((t=>{const i=l(t);return void 0===i?void 0:i-s(t)})),e=i.filter((t=>void 0!==t)),r=e.length>0?Math.max(...e):0,a=i.map((t=>void 0===t?void 0:j(r-t))),d=Math.max(0,...a.filter((t=>void 0!==t)));t.forEach(((t,i)=>n(o[t.slot],a[i],d)))}};return i&&l("row","rowSpan",(t=>t.y),(t=>t.top),((t,i)=>{void 0===i?t.bottom=!0:t.top=i})),e&&l("column","columnSpan",(t=>t.x),(t=>t.left),((t,i,e)=>{void 0!==i&&(t.left=i);const o=j(e-(null!=i?i:0));o>0&&(t.right=o)})),o}(e.map((({slot:t,row:i,column:e,rowSpan:a,columnSpan:d},h)=>{const c=l[h],u=s[h],v=o[h].frame,f=null!=v?v:r.get(t),p=t=>parseFloat((null==f?void 0:f.style.getPropertyValue(t))||"0")||0,g={slot:t,row:i,column:e,rowSpan:a,columnSpan:d,top:p(v?O.top:"padding-top"),left:p(v?O.left:"margin-left")};if(c){const t=n.toLocal(c.getBoundingClientRect());void 0!==u.y&&(g.y=t.y+u.y),void 0!==u.x&&(g.x=t.x+u.x)}return g})),"baseline"===this.resolvedVertical,"baseline"===this.resolvedHorizontal);if(function(t,i){var e,o,l,s,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!==(o=i[c])&&void 0!==o?o:{};if(!!h.bottom!=!!u.bottom)return!1;if(Math.abs((null!==(l=h.top)&&void 0!==l?l:0)-(null!==(s=u.top)&&void 0!==s?s: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}(a,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=a,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,o,l;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,p={version:s,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:this.placed.length},diagnostics:a(this.element)},g=null===(o=this.element.shadowRoot)||void 0===o?void 0:o.querySelector(".grid-container");if(g&&p.regions.push({id:"grid",rect:r(g,c)}),"full"!==h||!g)return p;const m=[],b=t=>m.push(t),w=g.querySelector(".grid-title");return w&&b({kind:"gridTitle",label:(null===(l=w.textContent)||void 0===l?void 0:l.trim())||void 0,rect:r(w,c)}),g.querySelectorAll(".grid-header-col").forEach(((t,i)=>{var e,o;b({kind:"gridHeader",columnId:null===(e=f[i])||void 0===e?void 0:e.id,label:(null===(o=t.textContent)||void 0===o?void 0:o.trim())||void 0,rect:r(t,c)})})),g.querySelectorAll(".grid-header-row").forEach(((t,i)=>{var e,o;b({kind:"gridHeader",rowId:null===(e=v[i])||void 0===e?void 0:e.id,label:(null===(o=t.textContent)||void 0===o?void 0:o.trim())||void 0,rect:r(t,c)})})),g.querySelectorAll(".grid-cell").forEach(((t,i)=>{var e,o,l,s;const n=this.placed[i];b(Object.assign(Object.assign(Object.assign({kind:"gridCell",rowId:n?null===(e=v[n.row])||void 0===e?void 0:e.id:void 0,columnId:n?null===(o=f[n.column])||void 0===o?void 0:o.id:void 0,slot:null!==(s=null===(l=t.querySelector("slot"))||void 0===l?void 0:l.getAttribute("name"))&&void 0!==s?s:void 0},(null==n?void 0:n.rowSpan)>1?{rowSpan:n.rowSpan}:{}),(null==n?void 0:n.columnSpan)>1?{columnSpan:n.columnSpan}:{}),{rect:r(t,c)}))})),g.querySelectorAll(".grid-caption").forEach((t=>{var i,e,o,l;b({kind:"gridCaption",slot:null!==(o=null===(e=null===(i=t.parentElement)||void 0===i?void 0:i.querySelector("slot"))||void 0===e?void 0:e.getAttribute("name"))&&void 0!==o?o:void 0,label:(null===(l=t.textContent)||void 0===l?void 0:l.trim())||void 0,rect:r(t,c)})})),p.elements=m,p}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),this.readCellAttributes()}componentWillRender(){this.placeDataCells()}updateGridConfig(){this.gridConfig=function(t,i){return{rows:p(t),columns:p(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",o=this.shouldShowRowHeaders()?2:1,l=this.chartTitle?2:1;return this.gridConfig.columns.map(((s,n)=>{const r=n>0;return e("div",{key:"col-header-"+s.id,class:"grid-header grid-header-col",style:{"grid-column":o+n+"","grid-row":l+"","border-left":r?i:"none",padding:t.cellPadding+"px","padding-left":r?t.cellPadding+4+"px":t.cellPadding+"px"}},s.label)}))}renderDataCells(){const t=this.getGridStyle(),i=this.shouldShowBorders()?`${t.borderWidth}px solid ${t.borderColor}`:"none",o=this.shouldShowRowHeaders()?2:1,l=(this.chartTitle?1:0)+(this.shouldShowColumnHeaders()?1:0)+1,s=[],n=(t,i)=>i>1?`${t} / span ${i}`:t+"";return this.gridConfig.rows.length>0&&this.gridConfig.columns.length>0&&this.gridConfig.rows.forEach(((r,a)=>{if(this.shouldShowRowHeaders()){const o=a>0;s.push(e("div",{key:"row-header-"+r.id,class:"grid-header grid-header-row",style:{"grid-column":"1","grid-row":l+a+"","border-top":o?i:"none",padding:t.cellPadding+"px","padding-top":o?t.cellPadding+4+"px":t.cellPadding+"px"}},r.label))}this.placed.filter((t=>t.row===a)).forEach((({slot:r,column:d,rowSpan:h,columnSpan:c})=>{var u,v;const f=d>0,p=a>0,g=null!==(v=null===(u=this.cellAttributes[r])||void 0===u?void 0:u.background)&&void 0!==v?v:t.cellBackground&&"transparent"!==t.cellBackground?t.cellBackground:void 0;s.push(e("div",{key:"cell-"+r,class:"grid-cell","data-bn-fit-content":"",style:Object.assign(Object.assign({"grid-column":n(o+d,c),"grid-row":n(l+a,h),"border-left":f?i:"none","border-top":p?i:"none","padding-left":f?t.cellPadding+4+"px":"0","padding-top":p?t.cellPadding+4+"px":"0"},this.cellAlignStyle()),g?{"background-color":g}:{})},this.renderCellContent(r,t)))}))})),s}cellAlignStyle(){return"top"===this.resolvedVertical&&"left"===this.resolvedHorizontal?{}:{display:"flex","flex-direction":"column","justify-content":C[this.resolvedVertical],"align-items":S[this.resolvedHorizontal]}}renderCellContent(t,i){var o;const l=this.captions[t],s=void 0!==l?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"}},l):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"]=S[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===(o=this.offsets[t])||void 0===o?void 0:o.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"),[s,e("div",{class:"grid-slot","data-slot":t,style:n},e("slot",{name:t}))]}getFontStyles(){return this.componentStyle((t=>{var i,e,o,l;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===(o=t.global)||void 0===o?void 0:o.fontColor)||"#000000","--bn-font-background":(null===(l=t.global)||void 0===l?void 0:l.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(o,{key:"97d858fb6f5704dfd46638c8e5c6a74927e702e0",style:t?Object.assign(Object.assign({},this.getFontStyles()),{display:"block"}):this.getFontStyles()},e("div",{key:"1e218eac5865574fcb4572d1aaea60f1d87d8948",class:"grid-container",style:i},this.renderTitle(),this.renderColumnHeaders(),this.renderDataCells()),e("slot",{key:"aabefa01213c69c0303f1df06f5575973253677e"}))}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],cellAttributes:[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}]}]),$=z,M=function(){"undefined"!=typeof customElements&&["bn-grid"].forEach((t=>{"bn-grid"===t&&(customElements.get(l(t))||customElements.define(l(t),z))}))};export{$ as BnGrid,M as defineCustomElement}
|
|
1
|
+
import{p as t,H as i,h as e,d as o,t as l}from"./p-BnmylmXF.js";import{L as s}from"./p-DY5fMUX8.js";import{o as n,m as r}from"./p-DdvG1D18.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-BrQCbmG0.js";import{w as u}from"./p-CU9CdEBF.js";import{w as v}from"./p-JG4Sx1lE.js";import{w as f}from"./p-D32TsLzd.js";function p(t){if(!t||""===t.trim()||"[]"===t)return[];try{const i=JSON.parse(t);return Array.isArray(i)?i.map(((t,i)=>{var e,o,l;return"string"==typeof t?{label:t,id:i+""}:"object"==typeof t&&null!==t?{label:null!==(o=null!==(e=t.label)&&void 0!==e?e:t.name)&&void 0!==o?o:i+"",id:null!==(l=t.id)&&void 0!==l?l:i+""}:{label:t+"",id:i+""}})):[]}catch(t){return console.error("parseHeaders: failed to parse JSON",t),[]}}function g(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=[],o=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`):o.has(t.id)?e.push(`Header[${i}]: duplicate id '${t.id}'`):o.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"],C={top:"flex-start",center:"center",bottom:"flex-end",baseline:"flex-start"},S={left:"stretch",center:"center",right:"flex-end",baseline:"stretch"};function x(t){if(null===t||""===t.trim())return 1;const i=Number(t);return Number.isInteger(i)&&i>=1?i:void 0}function H(t,i,e){var o,l;const s=Array.from({length:t},(()=>Array(i))),n=[],r=[];for(let a=0;a<t;a++)for(let d=0;d<i;d++){const h=s[a][d];if(h){r.push({row:a,column:d,by:h});continue}const c=e(a,d),u=Math.min(null!==(o=null==c?void 0:c.rowSpan)&&void 0!==o?o:1,t-a);let v=1;const f=Math.min(null!==(l=null==c?void 0:c.columnSpan)&&void 0!==l?l:1,i-d);for(;v<f&&!s[a][d+v];)v++;const p={row:a,column:d,rowSpan:u,columnSpan:v};for(let t=a;t<a+u;t++)for(let i=d;i<d+v;i++)s[t][i]=p;n.push(p)}return{cells:n,covered:r}}const j=t=>Math.round(100*t)/100,R=new Set(["bn-asset","bn-component-style","bn-dataset","bn-datasource","bn-internationalization","bn-ruleset","bn-scaling-group"]),A=new Set(["bn-layout-card"]),O={top:"--bn-baseline-offset-top",left:"--bn-baseline-offset-left",right:"--bn-baseline-offset-right"},k=["row-span","column-span","cell-background"],z=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,o]of Object.entries(i)){if("string"!=typeof o)return;""!==o&&(e[t]=o)}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.cellAttributes={},this.placed=[],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.readCellAttributes(),this.checkCoveredSlots(),this.schedule()})),this.mutationObserver.observe(this.element,{childList:!0,subtree:!0,attributes:!0,attributeFilter:["slot",...k]}),null===(t=document.fonts)||void 0===t||t.addEventListener("loadingdone",this.schedule),this.readCellAttributes()}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,o,l){return null==e||""===e?(this.errors.remove(i),l):o.includes(e)?(this.errors.remove(i),e):(this.errors.addOrReplace({id:i,type:"error",message:`${t}: "${e}" is not one of ${o.join(", ")}.`}),l)}readCellAttributes(){const t={},i=[];for(const e of Array.from(this.element.children)){const o=e.getAttribute("slot");if(null===o)continue;const l=t=>{const l=x(e.getAttribute(t));return void 0===l&&i.push(`${t} of slot "${o}"`),null!=l?l:1},s={rowSpan:l("row-span"),columnSpan:l("column-span")},n=e.getAttribute("cell-background");n&&(s.background=n),(s.rowSpan>1||s.columnSpan>1||s.background)&&(t[o]=s)}i.length>0?this.errors.addOrReplace({id:"ERR_cellSpan",type:"error",message:i.join(", ")+": not a whole number from 1."}):this.errors.remove("ERR_cellSpan"),JSON.stringify(t)!==JSON.stringify(this.cellAttributes)&&(this.cellAttributes=t)}placeDataCells(){const{rows:t,columns:i}=this.gridConfig,e=(e,o)=>g(t[e],i[o]),{cells:o}=H(t.length,i.length,((t,i)=>this.cellAttributes[e(t,i)]));this.placed=o.map((t=>Object.assign(Object.assign({},t),{slot:e(t.row,t.column)}))),this.checkCoveredSlots()}checkCoveredSlots(){var t;const{rows:i,columns:e}=null!==(t=this.gridConfig)&&void 0!==t?t:{rows:[],columns:[]},o=(t,o)=>g(i[t],e[o]),{covered:l}=H(i.length,e.length,((t,i)=>this.cellAttributes[o(t,i)])),s=new Set(Array.from(this.element.children).map((t=>t.getAttribute("slot")))),n=l.filter((({row:t,column:i})=>s.has(o(t,i))));if(n.length>0){const t=n.map((({row:t,column:i,by:e})=>`"${o(t,i)}" (covered by "${o(e.row,e.column)}")`));this.errors.addOrReplace({id:"WARN_cellSpan",type:"warning",message:`a span covers the slot ${t.join(", ")}: its content is not shown.`})}else this.errors.remove("WARN_cellSpan")}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("*"))],o=e.find((t=>t.localName.startsWith("bn-")&&!R.has(t.localName)&&!A.has(t.localName))),l=o?e.find((t=>A.has(t.localName)&&t.contains(o))):void 0;return{visual:o,frame:l}}applyFrameOffsets(){this.frames.forEach(((t,i)=>{const e=this.offsets[i];Object.keys(O).forEach((i=>{const o=null==e?void 0:e[i];o?t.style.setProperty(O[i],o+"px"):t.style.removeProperty(O[i])}))}))}async align(){var t;const i=++this.run;if(!this.element.isConnected||!this.isBaselineMode())return;const e=this.placed,o=e.map((({slot:t})=>this.contentIn(t))),l=o.map((t=>t.visual));if(await Promise.all(l.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;l.forEach((t=>t&&this.observe(t)));const s=await Promise.all(l.map((t=>"function"==typeof(null==t?void 0:t.getBaseline)?t.getBaseline().catch((()=>({}))):Promise.resolve({}))));if(i!==this.run)return;const n=h(this.element),r=new Map;null===(t=this.element.shadowRoot)||void 0===t||t.querySelectorAll(".grid-slot").forEach((t=>{var i;r.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(e[i].slot,t)));const a=function(t,i,e){const o={};for(const i of t)o[i.slot]={};const l=(i,e,l,s,n)=>{var r,a;const d=new Map;for(const o of t)(null!==(r=o[e])&&void 0!==r?r:1)>1||d.set(o[i],[...null!==(a=d.get(o[i]))&&void 0!==a?a:[],o]);for(const t of d.values()){const i=t.map((t=>{const i=l(t);return void 0===i?void 0:i-s(t)})),e=i.filter((t=>void 0!==t)),r=e.length>0?Math.max(...e):0,a=i.map((t=>void 0===t?void 0:j(r-t))),d=Math.max(0,...a.filter((t=>void 0!==t)));t.forEach(((t,i)=>n(o[t.slot],a[i],d)))}};return i&&l("row","rowSpan",(t=>t.y),(t=>t.top),((t,i)=>{void 0===i?t.bottom=!0:t.top=i})),e&&l("column","columnSpan",(t=>t.x),(t=>t.left),((t,i,e)=>{void 0!==i&&(t.left=i);const o=j(e-(null!=i?i:0));o>0&&(t.right=o)})),o}(e.map((({slot:t,row:i,column:e,rowSpan:a,columnSpan:d},h)=>{const c=l[h],u=s[h],v=o[h].frame,f=null!=v?v:r.get(t),p=t=>parseFloat((null==f?void 0:f.style.getPropertyValue(t))||"0")||0,g={slot:t,row:i,column:e,rowSpan:a,columnSpan:d,top:p(v?O.top:"padding-top"),left:p(v?O.left:"margin-left")};if(c){const t=n.toLocal(c.getBoundingClientRect());void 0!==u.y&&(g.y=t.y+u.y),void 0!==u.x&&(g.x=t.x+u.x)}return g})),"baseline"===this.resolvedVertical,"baseline"===this.resolvedHorizontal);if(function(t,i){var e,o,l,s,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!==(o=i[c])&&void 0!==o?o:{};if(!!h.bottom!=!!u.bottom)return!1;if(Math.abs((null!==(l=h.top)&&void 0!==l?l:0)-(null!==(s=u.top)&&void 0!==s?s: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}(a,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=a,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,o,l;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,p={version:s,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:this.placed.length},diagnostics:a(this.element)},g=null===(o=this.element.shadowRoot)||void 0===o?void 0:o.querySelector(".grid-container");if(g&&p.regions.push({id:"grid",rect:r(g,c)}),"full"!==h||!g)return p;const m=[],b=t=>m.push(t),w=g.querySelector(".grid-title");return w&&b({kind:"gridTitle",label:(null===(l=w.textContent)||void 0===l?void 0:l.trim())||void 0,rect:r(w,c)}),g.querySelectorAll(".grid-header-col").forEach(((t,i)=>{var e,o;b({kind:"gridHeader",columnId:null===(e=f[i])||void 0===e?void 0:e.id,label:(null===(o=t.textContent)||void 0===o?void 0:o.trim())||void 0,rect:r(t,c)})})),g.querySelectorAll(".grid-header-row").forEach(((t,i)=>{var e,o;b({kind:"gridHeader",rowId:null===(e=v[i])||void 0===e?void 0:e.id,label:(null===(o=t.textContent)||void 0===o?void 0:o.trim())||void 0,rect:r(t,c)})})),g.querySelectorAll(".grid-cell").forEach(((t,i)=>{var e,o,l,s;const n=this.placed[i];b(Object.assign(Object.assign(Object.assign({kind:"gridCell",rowId:n?null===(e=v[n.row])||void 0===e?void 0:e.id:void 0,columnId:n?null===(o=f[n.column])||void 0===o?void 0:o.id:void 0,slot:null!==(s=null===(l=t.querySelector("slot"))||void 0===l?void 0:l.getAttribute("name"))&&void 0!==s?s:void 0},(null==n?void 0:n.rowSpan)>1?{rowSpan:n.rowSpan}:{}),(null==n?void 0:n.columnSpan)>1?{columnSpan:n.columnSpan}:{}),{rect:r(t,c)}))})),g.querySelectorAll(".grid-caption").forEach((t=>{var i,e,o,l;b({kind:"gridCaption",slot:null!==(o=null===(e=null===(i=t.parentElement)||void 0===i?void 0:i.querySelector("slot"))||void 0===e?void 0:e.getAttribute("name"))&&void 0!==o?o:void 0,label:(null===(l=t.textContent)||void 0===l?void 0:l.trim())||void 0,rect:r(t,c)})})),p.elements=m,p}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),this.readCellAttributes()}componentWillRender(){this.placeDataCells()}updateGridConfig(){this.gridConfig=function(t,i){return{rows:p(t),columns:p(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",o=this.shouldShowRowHeaders()?2:1,l=this.chartTitle?2:1;return this.gridConfig.columns.map(((s,n)=>{const r=n>0;return e("div",{key:"col-header-"+s.id,class:"grid-header grid-header-col",style:{"grid-column":o+n+"","grid-row":l+"","border-left":r?i:"none",padding:t.cellPadding+"px","padding-left":r?t.cellPadding+4+"px":t.cellPadding+"px"}},s.label)}))}renderDataCells(){const t=this.getGridStyle(),i=this.shouldShowBorders()?`${t.borderWidth}px solid ${t.borderColor}`:"none",o=this.shouldShowRowHeaders()?2:1,l=(this.chartTitle?1:0)+(this.shouldShowColumnHeaders()?1:0)+1,s=[],n=(t,i)=>i>1?`${t} / span ${i}`:t+"";return this.gridConfig.rows.length>0&&this.gridConfig.columns.length>0&&this.gridConfig.rows.forEach(((r,a)=>{if(this.shouldShowRowHeaders()){const o=a>0;s.push(e("div",{key:"row-header-"+r.id,class:"grid-header grid-header-row",style:{"grid-column":"1","grid-row":l+a+"","border-top":o?i:"none",padding:t.cellPadding+"px","padding-top":o?t.cellPadding+4+"px":t.cellPadding+"px"}},r.label))}this.placed.filter((t=>t.row===a)).forEach((({slot:r,column:d,rowSpan:h,columnSpan:c})=>{var u,v;const f=d>0,p=a>0,g=null!==(v=null===(u=this.cellAttributes[r])||void 0===u?void 0:u.background)&&void 0!==v?v:t.cellBackground&&"transparent"!==t.cellBackground?t.cellBackground:void 0;s.push(e("div",{key:"cell-"+r,class:"grid-cell","data-bn-fit-content":"",style:Object.assign(Object.assign({"grid-column":n(o+d,c),"grid-row":n(l+a,h),"border-left":f?i:"none","border-top":p?i:"none","padding-left":f?t.cellPadding+4+"px":"0","padding-top":p?t.cellPadding+4+"px":"0"},this.cellAlignStyle()),g?{"background-color":g}:{})},this.renderCellContent(r,t)))}))})),s}cellAlignStyle(){return"top"===this.resolvedVertical&&"left"===this.resolvedHorizontal?{}:{display:"flex","flex-direction":"column","justify-content":C[this.resolvedVertical],"align-items":S[this.resolvedHorizontal]}}renderCellContent(t,i){var o;const l=this.captions[t],s=void 0!==l?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"}},l):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"]=S[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===(o=this.offsets[t])||void 0===o?void 0:o.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"),[s,e("div",{class:"grid-slot","data-slot":t,style:n},e("slot",{name:t}))]}getFontStyles(){return this.componentStyle((t=>{var i,e,o,l;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===(o=t.global)||void 0===o?void 0:o.fontColor)||"#000000","--bn-font-background":(null===(l=t.global)||void 0===l?void 0:l.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(o,{key:"97d858fb6f5704dfd46638c8e5c6a74927e702e0",style:t?Object.assign(Object.assign({},this.getFontStyles()),{display:"block"}):this.getFontStyles()},e("div",{key:"1e218eac5865574fcb4572d1aaea60f1d87d8948",class:"grid-container",style:i},this.renderTitle(),this.renderColumnHeaders(),this.renderDataCells()),e("slot",{key:"aabefa01213c69c0303f1df06f5575973253677e"}))}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],cellAttributes:[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}]}]),$=z,M=function(){"undefined"!=typeof customElements&&["bn-grid"].forEach((t=>{"bn-grid"===t&&(customElements.get(l(t))||customElements.define(l(t),z))}))};export{$ as BnGrid,M as defineCustomElement}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{p as t,H as s,h as e,d as i,t as o}from"./p-BnmylmXF.js";import{w as n}from"./p-
|
|
1
|
+
import{p as t,H as s,h as e,d as i,t as o}from"./p-BnmylmXF.js";import{w as n}from"./p-CU9CdEBF.js";import{w as r}from"./p-BrQCbmG0.js";import{w as l}from"./p-JG4Sx1lE.js";import{g as m}from"./p-6242qMx1.js";import{w as a}from"./p-D32TsLzd.js";const c=t(class extends s{constructor(t){super(),!1!==t&&this.__registerHost(),this.__attachShadow(),n(this),r(this),this.errors=a(this),this.componentStyle=l(this)}connectedCallback(){this.stores=m(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]}]),d=c,f=function(){"undefined"!=typeof customElements&&["bn-image"].forEach((t=>{"bn-image"===t&&(customElements.get(o(t))||customElements.define(o(t),c))}))};export{d as BnImage,f 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-BnmylmXF.js";import{g as a}from"./p-6242qMx1.js";import{w as n}from"./p-BrQCbmG0.js";import{w as o}from"./p-JG4Sx1lE.js";import{w as l}from"./p-D32TsLzd.js";import{a as d}from"./p-D65TnLS9.js";import{t as c,a as h,b as m,c as u,C as b,d as p}from"./p-Dq4KMCDU.js";import{d as f}from"./p-DMAaBt7n.js";import{d as y}from"./p-4xaxuPVU.js";import{d as g}from"./p-2t-lysdb.js";import{d as v}from"./p-dSUX43yf.js";import{d as x}from"./p-DOKqRsAu.js";const w=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.cardOverlayArea="",this.cardGridGap="0",this.cardFitToContent=!1,this.cardShowBorder=!0,n(this),this.errors=l(this),this.componentStyle=o(this),this.resolveInherited=d(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 c(this.getTemplatePattern(t))}getRowCount(t){return h(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})))),this.overlayArea()?s("div",{style:{display:"flex",overflow:"hidden","grid-area":this.overlayArea(),"z-index":"1"}},s("slot",{name:"card-slot-"+e.length})):null)}overlayArea(){var t,e;const s=(null!==(t=this.cardOverlayArea)&&void 0!==t?t:"").trim();if(!/^\d+(\s*\/\s*\d+){3}$/.test(s))return;const[r,i,a,n]=s.split("/").map((t=>Number(t.trim()))),o=this.getRowCount(this.cardLayout),l=(null===(e=h(this.getTemplatePattern(this.cardLayout))[0])||void 0===e?void 0:e.length)||1;return r>=1&&i>=1&&a<=o+1&&n<=l+1&&r<a&&i<n?s:void 0}extractSlotNames(t){return m(t)}getTemplatePattern(t){return u(t,this.cardCustomTemplate)}componentWillRender(){var t;const e=this.cardLayout===b?p(this.cardCustomTemplate):void 0;e?this.errors.addOrReplace({id:"WARN_cardCustomTemplate",type:"warning",message:"cardCustomTemplate: "+e}):this.errors.remove("WARN_cardCustomTemplate"),""===(null!==(t=this.cardOverlayArea)&&void 0!==t?t:"").trim()||this.overlayArea()?this.errors.remove("WARN_cardOverlayArea"):this.errors.addOrReplace({id:"WARN_cardOverlayArea",type:"warning",message:`cardOverlayArea: '${this.cardOverlayArea}' is not 'row-start / column-start / row-end / column-end' in line numbers of the layout.`})}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:"ef0b6da39a573f162c096c21803e4d647b2817c2",styles:this.styles,"selected-style":this.selectedStyle,class:this.setCardClass()},s("div",{key:"9116df8c88198ebc922dc91d5f45a032a81d37d1",class:"cardtitle"},s("bn-title",{key:"6d9645d5229c3bf32ef944c1f296a55dbe4b3bee","i18n-namespace":null!==(t=this.i18nNamespace)&&void 0!==t?t:this.titleNamespace,ruleset:this.titleProp("ruleset"),"title-font-size":this.componentStyle((t=>{var e;return null===(e=null==t?void 0:t["bn-layout-card"])||void 0===e?void 0:e.titleFontSize})),"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:"65803497adad305f02874acf441867e9ba200945"},s("div",{key:"61a57b87b0ffb76c238b2e2facb7d5b855d5dc10",style:e,"data-bn-fit-content":this.cardFitToContent?this.getRowCount(this.cardLayout)+"":null},this.getSlots(r))),s("bn-footer",{key:"8589da921d0f8dac8e9a2af23315ded3a3ee3d51",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"],cardOverlayArea:[1,"card-overlay-area"],cardGridGap:[1,"card-grid-gap"],cardFitToContent:[4,"card-fit-to-content"],cardShowBorder:[4,"card-show-border"]}]),k=w,A=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),w);break;case"bn-body":customElements.get(i(t))||f();break;case"bn-card":customElements.get(i(t))||y();break;case"bn-footer":customElements.get(i(t))||g();break;case"bn-title":customElements.get(i(t))||v();break;case"bn-title-renderer":customElements.get(i(t))||x()}}))};export{k as BnLayoutCard,A as defineCustomElement}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{p as t,H as e,h as s,F as a,d as i,t as r}from"./p-BnmylmXF.js";import{s as n}from"./p-DM7fwmH4.js";import{w as o}from"./p-BrQCbmG0.js";import{w as l}from"./p-D32TsLzd.js";import{a as m,b as d,c as h,t as p,i as c,C as b,d as u}from"./p-Dq4KMCDU.js";import{d as f}from"./p-DMAaBt7n.js";import{d as g}from"./p-2t-lysdb.js";import{d as y}from"./p-DRU71K0s.js";import{d as k}from"./p-
|
|
1
|
+
import{p as t,H as e,h as s,F as a,d as i,t as r}from"./p-BnmylmXF.js";import{s as n}from"./p-DM7fwmH4.js";import{w as o}from"./p-BrQCbmG0.js";import{w as l}from"./p-D32TsLzd.js";import{a as m,b as d,c as h,t as p,i as c,C as b,d as u}from"./p-Dq4KMCDU.js";import{d as f}from"./p-DMAaBt7n.js";import{d as g}from"./p-2t-lysdb.js";import{d as y}from"./p-DRU71K0s.js";import{d as k}from"./p-CZSp0rSS.js";import{d as v}from"./p-dSUX43yf.js";import{d as x}from"./p-DOKqRsAu.js";const w=t(class extends e{constructor(t){super(),!1!==t&&this.__registerHost(),this.__attachShadow(),this.messageText="",this.messageImage="",this.titleBusinessUnit="",this.titleOrder="category",this.titleOrderDirection="asc",this.titleDateFormat="none",this.titleDateLink="none",this.footerDisplayPageNumber=!0,this.pageLayout="full",this.pageCustomTemplate='"a b" "c d"',this.pageGridGap="0",this.pageFitToContent=!1,o(this),this.errors=l(this)}getCommonStyles(){let t="100%";return!0===this.pageFitToContent&&(t="fit-content"),{display:"grid",height:t,width:"100%",gap:this.pageGridGap+"px"}}getRowCount(t){return m(this.getTemplateAreas(t)).length||1}getGridTemplateRows(t){const e=this.getRowCount(t);return this.pageFitToContent?Array(e).fill("auto").join(" "):Array(e).fill("minmax(0, 1fr)").join(" ")}getLayoutStyle(){return Object.assign(Object.assign({},this.getCommonStyles()),{"grid-template-areas":this.getTemplateAreas(this.pageLayout),"grid-template-columns":this.getGridTemplateColumns(this.pageLayout),"grid-template-rows":this.getGridTemplateRows(this.pageLayout)})}createDivAreaStyles(t){return t.map((t=>({display:"flex",overflow:"hidden","grid-area":t})))}getSlots(t){const e=this.createDivAreaStyles(t);return s(a,null,e.map(((t,e)=>s("div",{style:t},s("slot",{name:"slot-"+e})))))}extractSlotNames(t){return d(t)}getTemplateAreas(t){return h(t,this.pageCustomTemplate)}getGridTemplateColumns(t){return c(t)?p(this.getTemplateAreas(t)):"1fr"}mirror(t,e){null==e?this.element.hasAttribute(t)&&this.element.removeAttribute(t):this.element.getAttribute(t)!==e&&this.element.setAttribute(t,e)}componentWillRender(){this.mirror("page-format",this.pageFormat),this.mirror("page-orientation",this.pageOrientation);const t=this.pageLayout===b?u(this.pageCustomTemplate):void 0;t?this.errors.addOrReplace({id:"WARN_pageCustomTemplate",type:"warning",message:"pageCustomTemplate: "+t}):this.errors.remove("WARN_pageCustomTemplate")}rotation(){var t;const e=null===(t=this.element.closest("bn-context"))||void 0===t?void 0:t.getAttribute("render-orientation"),s=n(this.pageFormat,this.pageOrientation,e);if(s.turned)return{host:{width:s.width,height:s.height},page:{transform:"rotate(-90deg) translate(-100%)",transformOrigin:"top left"}}}render(){var t;const e=this.getLayoutStyle(),a=this.extractSlotNames(e["grid-template-areas"]),r=this.rotation();return s(i,{key:"290e6e8250c5f8bf53352886a810eeedd7548e57",style:null==r?void 0:r.host},s("bn-page",{key:"71b472107af79e9581e2097aae33c6b2808decbf",styles:this.styles,"selected-style":this.selectedStyle,format:this.pageFormat,orientation:this.pageOrientation,style:null==r?void 0:r.page},s("bn-message",{key:"99ac5c760476f95ff296077736849e6ddfd85120",text:this.messageText,image:this.messageImage}),s("bn-title",{key:"3af5ee4a7be905676a927397ff19cf062b291fb6","i18n-namespace":null!==(t=this.i18nNamespace)&&void 0!==t?t:this.titleNamespace,ruleset:this.ruleset,"business-unit":this.titleBusinessUnit,scenarios:this.titleScenarios,variances:this.titleVariances,order:this.titleOrder,"order-direction":this.titleOrderDirection,measures:this.titleMeasures,"date-start":this.titleDateStart,"date-end":this.titleDateEnd,"date-format":this.titleDateFormat,"date-link":this.titleDateLink}),s("bn-body",{key:"c91e9c708934499b855fe9e321bebb7aed31ab7c"},s("div",{key:"92d01a4bad8ae401e570fcee4a9bbdac42b31d81",style:e,"data-bn-fit-content":this.pageFitToContent?this.getRowCount(this.pageLayout)+"":null},this.getSlots(a)),s("slot",{key:"ac227c5985b827e91d139396915e3a104e44710b",name:"annotations"})),s("bn-footer",{key:"41dfc75b74a158a0e7cdb05456b03ae62cf6d6db",text:this.footerText,"page-number":this.pageNumber,"display-page-number":this.footerDisplayPageNumber})))}get element(){return this}static get style(){return':host{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:block;overflow:hidden}::slotted(*){flex:1 1 auto;min-width:0}'}},[257,"bn-layout-page",{styles:[1],selectedStyle:[1,"selected-style"],ruleset:[1],messageText:[1,"message-text"],messageImage:[1,"message-image"],titleBusinessUnit:[1,"title-business-unit"],titleScenarios:[1,"title-scenarios"],titleVariances:[1,"title-variances"],titleOrder:[1,"title-order"],titleOrderDirection:[1,"title-order-direction"],titleMeasures:[1,"title-measures"],titleDateStart:[1,"title-date-start"],titleDateEnd:[1,"title-date-end"],titleDateFormat:[1,"title-date-format"],titleDateLink:[1,"title-date-link"],titleNamespace:[1,"title-namespace"],i18nNamespace:[513,"i18n-namespace"],pageFormat:[1,"page-format"],pageOrientation:[1,"page-orientation"],pageNumber:[1,"page-number"],footerText:[1,"footer-text"],footerDisplayPageNumber:[4,"footer-display-page-number"],pageLayout:[1,"page-layout"],pageCustomTemplate:[1,"page-custom-template"],pageGridGap:[1,"page-grid-gap"],pageFitToContent:[4,"page-fit-to-content"]}]),D=w,j=function(){"undefined"!=typeof customElements&&["bn-layout-page","bn-body","bn-footer","bn-message","bn-page","bn-title","bn-title-renderer"].forEach((t=>{switch(t){case"bn-layout-page":customElements.get(r(t))||customElements.define(r(t),w);break;case"bn-body":customElements.get(r(t))||f();break;case"bn-footer":customElements.get(r(t))||g();break;case"bn-message":customElements.get(r(t))||y();break;case"bn-page":customElements.get(r(t))||k();break;case"bn-title":customElements.get(r(t))||v();break;case"bn-title-renderer":customElements.get(r(t))||x()}}))};export{D as BnLayoutPage,j as defineCustomElement}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{P as o,d as p}from"./p-
|
|
1
|
+
import{P as o,d as p}from"./p-CZSp0rSS.js";const r=o,s=p;export{r as BnPage,s as defineCustomElement}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{B as o,d as
|
|
1
|
+
import{B as o,d as p}from"./p-LHIKI9Dp.js";const s=o,r=p;export{s as BnTableRenderer,r as defineCustomElement}
|