@bino-bi/bn-template-engine 1.0.0-next.43 → 1.0.0-next.45
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-ddf6cd92.entry.js → p-1b002bd5.entry.js} +1 -1
- package/dist/bn-template-engine/{p-ce764078.entry.js → p-48871742.entry.js} +1 -1
- package/dist/bn-template-engine/{p-a4b76176.entry.js → p-750b2c82.entry.js} +1 -1
- package/dist/cjs/bn-annotation-layer_30.cjs.entry.js +78 -42
- package/dist/cjs/bn-grid.cjs.entry.js +2 -2
- package/dist/cjs/bn-text.cjs.entry.js +1 -1
- package/dist/cjs/{withTranslation-FxXGUB3H.js → withTranslation-1qTs5Fi7.js} +5 -2
- package/dist/collection/components/bn-grid/bn-grid.js +2 -2
- package/dist/collection/components/bn-table/bn-table-renderer/bn-table-renderer.css +9 -0
- package/dist/collection/components/bn-table/utils/elements/TableRow.js +15 -5
- package/dist/collection/components/bn-table/utils/factories/tableDataSetFactory.js +8 -6
- package/dist/collection/components/bn-table/utils/helper/DataQuery.js +50 -28
- package/dist/collection/components/bn-tree/bn-tree.js +4 -1
- package/dist/collection/utils/parentDimensions.js +5 -2
- package/dist/components/bn-chart-bubble.js +1 -1
- package/dist/components/bn-chart-bullet.js +1 -1
- package/dist/components/bn-chart-scatter.js +1 -1
- package/dist/components/bn-chart-structure.js +1 -1
- package/dist/components/bn-chart-time.js +1 -1
- package/dist/components/bn-grid.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-tree.js +1 -1
- package/dist/components/p-B2bvM2Ig.js +1 -0
- package/dist/components/p-C50Ge-4H.js +1 -0
- package/dist/esm/bn-annotation-layer_30.entry.js +78 -42
- package/dist/esm/bn-grid.entry.js +2 -2
- package/dist/esm/bn-text.entry.js +1 -1
- package/dist/esm/{withTranslation-Daq2JXkv.js → withTranslation-C1gL7wSU.js} +5 -2
- package/dist/types/components/bn-table/utils/helper/DataQuery.d.ts +10 -0
- package/package.json +1 -1
- package/dist/components/p-D2Epww9R.js +0 -1
- package/dist/components/p-DX9_keF-.js +0 -1
- /package/dist/bn-template-engine/{p-BjozxTTW.js → p-DVE0-sOv.js} +0 -0
- /package/dist/components/{p-DD1zlev_.js → p-Dsvjkuy3.js} +0 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as t,f as n,h as i,a as o,g as s}from"./p-CCZcKl0Q.js";import{w as e,a,g as l,p as r,s as d}from"./p-
|
|
1
|
+
import{r as t,f as n,h as i,a as o,g as s}from"./p-CCZcKl0Q.js";import{w as e,a,g as l,p as r,s as d}from"./p-DVE0-sOv.js";import{w as c,a as u}from"./p-D0tNATZq.js";import{w as v,a as f}from"./p-EcC0qLtU.js";const h="[A-Za-z_$\\u00C0-\\uFFFF][\\w$\\u00C0-\\uFFFF]*",p="'[^'\\\\]*'|\"[^\"\\\\]*\"",g=`(?:this\\.)?data(?:\\.(${h})|\\[\\s*(${p})\\s*\\])\\[\\s*(\\d+)\\s*\\]\\.(${h})`,b=new RegExp(`\\$\\{\\s*(?:${g}|t\\(\\s*(${p})\\s*(?:,\\s*\\{([^{}]*)\\}\\s*)?\\))\\s*\\}`,"g"),m=new RegExp(`\\s*(?:(${h})|(${p}))\\s*:\\s*(?:(${p})|(-?\\d+(?:\\.\\d+)?)|(${g}))\\s*(?:,|$)`,"y"),$=t=>String(t).replace(/[&<>"'\t\n\f\r ]/g,(t=>`&#${t.charCodeAt(0)};`)),w=(t,n)=>"object"==typeof t&&null!==t&&Object.prototype.hasOwnProperty.call(t,n)?t[n]:void 0,y=t=>t.slice(1,-1);const N=class{constructor(i){t(this,i),this.refit=()=>{n(this)},this.data={},v(this),c(this),this.errors=u(this),this.t=e(this).t,a(this,((t,n)=>{this.data=""===t?{}:Object.assign(Object.assign({},this.data),{[t]:n})})),this.componentStyle=f(this)}connectedCallback(){var t;null===(t=document.fonts)||void 0===t||t.addEventListener("loadingdone",this.refit)}disconnectedCallback(){var t;null===(t=document.fonts)||void 0===t||t.removeEventListener("loadingdone",this.refit)}validateValue(t){"string"!=typeof t||""===t?this.errors.addOrReplace({id:"WARN_value",type:"warning",message:"Empty value"}):this.errors.remove("WARN_value")}validateScaling(t){if(null==t||""===t||"none"===t||"auto"===t)return void this.errors.remove("WARN_scale");const n=Number(t);isNaN(n)||n<=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")}componentWillLoad(){this.validateValue(this.value),this.validateScaling(this.scale)}prepareStyle(){return this.componentStyle((t=>{var n,i,o,s,e,a,l,r,d,c,u,v,f,h,p,g,b,m,$,w,y,N;return{fontStyles:{font:`${null!==(s=null!==(i=null===(n=t["bn-text"])||void 0===n?void 0:n.fontSizePx)&&void 0!==i?i:null===(o=t.global)||void 0===o?void 0:o.fontSizePx)&&void 0!==s?s:13.3333}px ${null!==(r=null!==(a=null===(e=t["bn-text"])||void 0===e?void 0:e.fontFamily)&&void 0!==a?a:null===(l=t.global)||void 0===l?void 0:l.fontFamily)&&void 0!==r?r:"'Noto Sans', sans-serif"}`,size:null!==(v=null!==(c=null===(d=t["bn-text"])||void 0===d?void 0:d.fontSizePx)&&void 0!==c?c:null===(u=t.global)||void 0===u?void 0:u.fontSizePx)&&void 0!==v?v:13.3333,color:null!==(g=null!==(h=null===(f=t["bn-text"])||void 0===f?void 0:f.fontColor)&&void 0!==h?h:null===(p=t.global)||void 0===p?void 0:p.fontColor)&&void 0!==g?g:"#000000",background:null!==(w=null!==(m=null===(b=t["bn-text"])||void 0===b?void 0:b.fontBackgroundColor)&&void 0!==m?m:null===($=t.global)||void 0===$?void 0:$.fontBackgroundColor)&&void 0!==w?w:"#ffffff",leading:null!==(N=null===(y=t["bn-text"])||void 0===y?void 0:y.leading)&&void 0!==N?N:1.8}}}))}applyScaling(t){const n=this.element,{mode:i,factor:o}=r(this.scale),{width:s,height:e}=l(n),a=n.scrollHeight>n.clientHeight+1?n.clientHeight:e,d=s,c=d>0&&n.scrollWidth>d+1,u=a>0&&n.scrollHeight>a+1,v=c||u;if(d<=0&&a<=0)return;if("none"===i){if(v){const t=[];c&&t.push(`w:${n.scrollWidth}>${Math.round(d)}`),u&&t.push(`h:${n.scrollHeight}>${Math.round(a)}`),this.errors.addOrReplace({id:"WARN_overflow",type:"warning",message:`Content overflows container (${t.join(", ")})`})}else this.errors.remove("WARN_overflow");return}if("factor"===i){if(v){const t=[];c&&t.push(`w:${n.scrollWidth}>${Math.round(d)}`),u&&t.push(`h:${n.scrollHeight}>${Math.round(a)}`),this.errors.addOrReplace({id:"WARN_overflow",type:"warning",message:`Content overflows with factor ${o} (${t.join(", ")})`})}else this.errors.remove("WARN_overflow");return}n.style.setProperty("--bn-font-size",`${t}px`);const f=n.scrollWidth,h=n.scrollHeight,p=n.clientHeight,g=h>p+1?p:e,b=d<=0||f<=d+1,m=g<=0||h<=g+1;if(b&&m)return void this.errors.remove("AUTO_scale");const $=Math.min(1,!b&&d>0?d/f:1,!m&&g>0?g/h:1);n.style.setProperty("--bn-font-size",t*$+"px"),"empty"===i?this.errors.addOrReplace({id:"AUTO_scale",type:"warning",message:`Auto-scaled font by factor ${$.toFixed(3)}`}):this.errors.remove("AUTO_scale")}componentDidRender(){var t;const{html:n,unknown:i}=function(t,n,i){const o=[],s=t=>{o.includes(t)||o.push(t)},e=(t,i,o,e,a)=>{const l=w(w(w(n,null!=i?i:y(o)),String(Number(e))),a);return void 0===l&&s(t),l};return{html:t.replace(b,((t,n,o,a,l,r,d)=>{const c=t.slice(2,-1).trim();try{if(void 0===r){const t=e(c,n,o,a,l);return null==t?"":$(t)}const s=void 0===d?void 0:(t=>{const n={};for(m.lastIndex=0;""!==t.slice(m.lastIndex).trim();){const i=m.exec(t);if(!i)return null;const[,o,s,a,l,r,d,c,u,v]=i;n[null!=o?o:y(s)]=void 0!==a?y(a):void 0!==l?Number(l):e(r,d,c,u,v)}return n})(d);return null===s?t:$(i(y(r),s))}catch(t){return s(c),""}})),unknown:o}}(null!==(t=this.value)&&void 0!==t?t:"",this.data,this.t);i.length>0?this.errors.addOrReplace({id:"WARN_value_path",type:"warning",message:`Unknown template path: ${i.join(", ")}`}):this.errors.remove("WARN_value_path"),this.container.innerHTML=d(n),this.applyScaling(this.prepareStyle().fontStyles.size)}render(){const{fontStyles:t}=this.prepareStyle(),{mode:n,factor:s}=r(this.scale),e="factor"===n?t.size*s+"px":`${t.size}px`,a={"--bn-font-family":t.font.substring(t.font.indexOf("px ")+3),"--bn-font-size":e,"--bn-font-color":t.color,"--bn-font-background":t.background};return i(o,{key:"47eaf1468ffc8b8de7e77f2b0aff4b927f8b0471",style:a},i("div",{key:"1f592c2fd0a4af77047c56ee043f6bdd84dfb2d2"},i("span",{key:"ecad3e6ea36dfa495ef78183fc6c3979eb9d5be2",class:"container",ref:t=>{this.container=t}})))}get element(){return s(this)}static get watchers(){return{value:[{validateValue:0}],scale:[{validateScaling:0}]}}};N.style=':host{padding:0.5em;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);background-color:var(--bn-font-background, white)}span.container p{margin:0}';export{N as bn_text}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as t,h as i,a as e,g as s}from"./p-CCZcKl0Q.js";import{LAYOUT_STATE_VERSION as o}from"./index.esm.js";import{l as n,o as l,r,m as a,a as d}from"./p-qpZjVnX5.js";import{w as h,a as c}from"./p-D0tNATZq.js";import{w as u,a as v}from"./p-EcC0qLtU.js";function f(t){if(!t||""===t.trim()||"[]"===t)return[];try{const i=JSON.parse(t);return Array.isArray(i)?i.map(((t,i)=>{var e,s,o;return"string"==typeof t?{label:t,id:String(i)}:"object"==typeof t&&null!==t?{label:null!==(s=null!==(e=t.label)&&void 0!==e?e:t.name)&&void 0!==s?s:String(i),id:null!==(o=t.id)&&void 0!==o?o:String(i)}:{label:String(t),id:String(i)}})):[]}catch(t){return console.error("parseHeaders: failed to parse JSON",t),[]}}function g(t,i){return`${t.id}-${i.id}`}function p(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=[],s=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`):s.has(t.id)?e.push(`Header[${i}]: duplicate id '${t.id}'`):s.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"],m=["top","center","bottom","baseline"],y=["left","center","right","baseline"],w={top:"flex-start",center:"center",bottom:"flex-end",baseline:"flex-start"},x={left:"stretch",center:"center",right:"flex-end",baseline:"stretch"},C=t=>Math.round(100*t)/100,S=new Set(["bn-asset","bn-component-style","bn-dataset","bn-datasource","bn-internationalization","bn-ruleset","bn-scaling-group"]),$=new Set(["bn-layout-card"]),H={top:"--bn-baseline-offset-top",left:"--bn-baseline-offset-left",right:"--bn-baseline-offset-right"},j=class{validateRowHeaders(t){const i="ERR_rowHeaders",e=p(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=p(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,m,"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,s]of Object.entries(i)){if("string"!=typeof s)return;""!==s&&(e[t]=s)}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(i){t(this,i),this.gridConfig={rows:[],columns:[]},this.resolvedHeight="auto",this.resolvedWidth="auto",this.resolvedVertical="top",this.resolvedHorizontal="left",this.captions={},this.offsets={},this.frames=new Map,this.observed=new WeakSet,this.scheduled=!1,this.run=0,this.adjustments=0,this.chartTitle="",this.rowHeaders="[]",this.columnHeaders="[]",this.showRowHeaders=!0,this.showColumnHeaders=!0,this.showBorders=!0,this.rowHeaderWidth="auto",this.cellGap="0px",this.cellHeight="auto",this.cellWidth="auto",this.cellVerticalAlign="top",this.cellHorizontalAlign="left",this.cellCaptions="",this.schedule=()=>{if(!this.isBaselineMode())return this.run++,Object.keys(this.offsets).length>0&&(this.offsets={}),void this.applyFrameOffsets();this.scheduled||(this.scheduled=!0,this.holdStatus(new Promise((t=>{requestAnimationFrame((()=>{this.scheduled=!1,this.align().catch((t=>console.error("bn-grid: aligning the baselines failed",t))).finally(t)}))}))))},u(this),this.holdStatus=h(this),this.errors=c(this),this.componentStyle=v(this)}connectedCallback(){var t;this.observed=new WeakSet,this.resizeObserver=new ResizeObserver(this.schedule),this.mutationObserver=new MutationObserver(this.schedule),this.mutationObserver.observe(this.element,{childList:!0,subtree:!0,attributes:!0,attributeFilter:["slot"]}),null===(t=document.fonts)||void 0===t||t.addEventListener("loadingdone",this.schedule)}disconnectedCallback(){var t,i,e;null===(t=this.resizeObserver)||void 0===t||t.disconnect(),null===(i=this.mutationObserver)||void 0===i||i.disconnect(),null===(e=document.fonts)||void 0===e||e.removeEventListener("loadingdone",this.schedule),this.run++}componentDidRender(){this.schedule()}validateChoice(t,i,e,s,o){return null==e||""===e?(this.errors.remove(i),o):s.includes(e)?(this.errors.remove(i),e):(this.errors.addOrReplace({id:i,type:"error",message:`${t}: "${e}" is not one of ${s.join(", ")}.`}),o)}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("*"))],s=e.find((t=>t.localName.startsWith("bn-")&&!S.has(t.localName)&&!$.has(t.localName))),o=s?e.find((t=>$.has(t.localName)&&t.contains(s))):void 0;return{visual:s,frame:o}}applyFrameOffsets(){this.frames.forEach(((t,i)=>{const e=this.offsets[i];Object.keys(H).forEach((i=>{const s=null==e?void 0:e[i];s?t.style.setProperty(H[i],`${s}px`):t.style.removeProperty(H[i])}))}))}async align(){var t;const i=++this.run;if(!this.element.isConnected||!this.isBaselineMode())return;const{rows:e,columns:s}=this.gridConfig,o=e.flatMap(((t,i)=>s.map(((e,s)=>({slot:g(t,e),row:i,column:s}))))),l=o.map((({slot:t})=>this.contentIn(t))),r=l.map((t=>t.visual));if(await Promise.all(r.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;r.forEach((t=>t&&this.observe(t)));const a=await Promise.all(r.map((t=>"function"==typeof(null==t?void 0:t.getBaseline)?t.getBaseline().catch((()=>({}))):Promise.resolve({}))));if(i!==this.run)return;const d=n(this.element),h=new Map;null===(t=this.element.shadowRoot)||void 0===t||t.querySelectorAll(".grid-slot").forEach((t=>{var i;h.set(null!==(i=t.getAttribute("data-slot"))&&void 0!==i?i:"",t)})),this.frames=new Map,l.forEach((({frame:t},i)=>t&&this.frames.set(o[i].slot,t)));const c=function(t,i,e){const s={};for(const i of t)s[i.slot]={};const o=(i,e,o,n)=>{var l;const r=new Map;for(const e of t)r.set(e[i],[...null!==(l=r.get(e[i]))&&void 0!==l?l:[],e]);for(const t of r.values()){const i=t.map((t=>{const i=e(t);return void 0===i?void 0:i-o(t)})),l=i.filter((t=>void 0!==t)),r=l.length>0?Math.max(...l):0,a=i.map((t=>void 0===t?void 0:C(r-t))),d=Math.max(0,...a.filter((t=>void 0!==t)));t.forEach(((t,i)=>n(s[t.slot],a[i],d)))}};return i&&o("row",(t=>t.y),(t=>t.top),((t,i)=>{void 0===i?t.bottom=!0:t.top=i})),e&&o("column",(t=>t.x),(t=>t.left),((t,i,e)=>{void 0!==i&&(t.left=i);const s=C(e-(null!=i?i:0));s>0&&(t.right=s)})),s}(o.map((({slot:t,row:i,column:e},s)=>{const o=r[s],n=a[s],c=l[s].frame,u=null!=c?c:h.get(t),v=t=>parseFloat((null==u?void 0:u.style.getPropertyValue(t))||"0")||0,f=c?{slot:t,row:i,column:e,top:v(H.top),left:v(H.left)}:{slot:t,row:i,column:e,top:v("padding-top"),left:v("margin-left")};if(o){const t=d.toLocal(o.getBoundingClientRect());void 0!==n.y&&(f.y=t.y+n.y),void 0!==n.x&&(f.x=t.x+n.x)}return f})),"baseline"===this.resolvedVertical,"baseline"===this.resolvedHorizontal);if(function(t,i){var e,s,o,n,l,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!==(s=i[c])&&void 0!==s?s:{};if(Boolean(h.bottom)!==Boolean(u.bottom))return!1;if(Math.abs((null!==(o=h.top)&&void 0!==o?o:0)-(null!==(n=u.top)&&void 0!==n?n:0))>=.5)return!1;if(Math.abs((null!==(l=h.left)&&void 0!==l?l:0)-(null!==(r=u.left)&&void 0!==r?r:0))>=.5)return!1;if(Math.abs((null!==(a=h.right)&&void 0!==a?a:0)-(null!==(d=u.right)&&void 0!==d?d:0))>=.5)return!1}return!0}(c,this.offsets))this.adjustments=0;else{if(this.adjustments>=5)return console.warn("bn-grid: the baselines did not settle; the cells keep their last alignment."),void(this.adjustments=0);this.adjustments++,this.offsets=c,this.applyFrameOffsets(),this.schedule()}}observe(t){var i;this.observed.has(t)||(this.observed.add(t),null===(i=this.resizeObserver)||void 0===i||i.observe(t));const e=t=>{var i;t&&(this.observed.has(t)||(this.observed.add(t),null===(i=this.mutationObserver)||void 0===i||i.observe(t,{childList:!0,subtree:!0,attributes:!0,attributeFilter:["x1","y1","x2","y2","x","y","width","height","transform","style","class"]})),t.querySelectorAll("*").forEach((t=>e(t.shadowRoot))))};e(t.shadowRoot)}async getLayoutState(t){var i,e,s,n;const h=null!==(i=null==t?void 0:t.detail)&&void 0!==i?i:"summary",c=l(this.element),u=this.componentStyle((t=>{var i;return(null===(i=t.global)||void 0===i?void 0:i.fontSizePx)||13.3333})),{rows:v,columns:f}=this.gridConfig,g={version:o,tag:this.element.localName,id:d(this.element),slot:null!==(e=this.element.getAttribute("slot"))&&void 0!==e?e:void 0,rect:a(this.element,c),em:{fontSizePx:u,appliedScaleFactor:1},regions:[],metadata:{title:this.chartTitle||void 0,rowCount:v.length,columnCount:f.length,cellCount:v.length*f.length},diagnostics:r(this.element)},p=null===(s=this.element.shadowRoot)||void 0===s?void 0:s.querySelector(".grid-container");if(p&&g.regions.push({id:"grid",rect:a(p,c)}),"full"!==h||!p)return g;const b=[],m=t=>b.push(t),y=p.querySelector(".grid-title");return y&&m({kind:"gridTitle",label:(null===(n=y.textContent)||void 0===n?void 0:n.trim())||void 0,rect:a(y,c)}),p.querySelectorAll(".grid-header-col").forEach(((t,i)=>{var e,s;m({kind:"gridHeader",columnId:null===(e=f[i])||void 0===e?void 0:e.id,label:(null===(s=t.textContent)||void 0===s?void 0:s.trim())||void 0,rect:a(t,c)})})),p.querySelectorAll(".grid-header-row").forEach(((t,i)=>{var e,s;m({kind:"gridHeader",rowId:null===(e=v[i])||void 0===e?void 0:e.id,label:(null===(s=t.textContent)||void 0===s?void 0:s.trim())||void 0,rect:a(t,c)})})),p.querySelectorAll(".grid-cell").forEach(((t,i)=>{var e,s,o,n;m({kind:"gridCell",rowId:f.length>0?null===(e=v[Math.floor(i/f.length)])||void 0===e?void 0:e.id:void 0,columnId:f.length>0?null===(s=f[i%f.length])||void 0===s?void 0:s.id:void 0,slot:null!==(n=null===(o=t.querySelector("slot"))||void 0===o?void 0:o.getAttribute("name"))&&void 0!==n?n:void 0,rect:a(t,c)})})),p.querySelectorAll(".grid-caption").forEach((t=>{var i,e,s,o;m({kind:"gridCaption",slot:null!==(s=null===(e=null===(i=t.parentElement)||void 0===i?void 0:i.querySelector("slot"))||void 0===e?void 0:e.getAttribute("name"))&&void 0!==s?s:void 0,label:(null===(o=t.textContent)||void 0===o?void 0:o.trim())||void 0,rect:a(t,c)})})),g.elements=b,g}getGridStyle(){return this.componentStyle((t=>t["bn-grid"]))}componentWillLoad(){this.validateRowHeaders(this.rowHeaders),this.validateColumnHeaders(this.columnHeaders),this.validateCellHeight(this.cellHeight),this.validateCellWidth(this.cellWidth),this.validateCellVerticalAlign(this.cellVerticalAlign),this.validateCellHorizontalAlign(this.cellHorizontalAlign),this.validateCellCaptions(this.cellCaptions)}updateGridConfig(){var t;this.gridConfig=(t=this.columnHeaders,{rows:f(this.rowHeaders),columns:f(t)})}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 i("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(),e=this.shouldShowBorders()?`${t.borderWidth}px solid ${t.borderColor}`:"none",s=this.shouldShowRowHeaders()?2:1,o=this.chartTitle?2:1;return this.gridConfig.columns.map(((n,l)=>{const r=l>0;return i("div",{key:`col-header-${n.id}`,class:"grid-header grid-header-col",style:{"grid-column":String(s+l),"grid-row":String(o),"border-left":r?e:"none",padding:`${t.cellPadding}px`,"padding-left":r?`${t.cellPadding+4}px`:`${t.cellPadding}px`}},n.label)}))}renderDataCells(){const t=this.getGridStyle(),e=this.shouldShowBorders()?`${t.borderWidth}px solid ${t.borderColor}`:"none",s=this.shouldShowRowHeaders()?2:1,o=(this.chartTitle?1:0)+(this.shouldShowColumnHeaders()?1:0)+1,n=[];return this.gridConfig.rows.length>0&&this.gridConfig.columns.length>0&&this.gridConfig.rows.forEach(((l,r)=>{if(this.shouldShowRowHeaders()){const s=r>0;n.push(i("div",{key:`row-header-${l.id}`,class:"grid-header grid-header-row",style:{"grid-column":"1","grid-row":String(o+r),"border-top":s?e:"none",padding:`${t.cellPadding}px`,"padding-top":s?`${t.cellPadding+4}px`:`${t.cellPadding}px`}},l.label))}this.gridConfig.columns.forEach(((a,d)=>{const h=g(l,a),c=d>0,u=r>0;n.push(i("div",{key:`cell-${h}`,class:"grid-cell",style:Object.assign({"grid-column":String(s+d),"grid-row":String(o+r),"border-left":c?e:"none","border-top":u?e:"none","padding-left":c?`${t.cellPadding+4}px`:"0","padding-top":u?`${t.cellPadding+4}px`:"0"},this.cellAlignStyle())},this.renderCellContent(h,t)))}))})),n}cellAlignStyle(){return"top"===this.resolvedVertical&&"left"===this.resolvedHorizontal?{}:{display:"flex","flex-direction":"column","justify-content":w[this.resolvedVertical],"align-items":x[this.resolvedHorizontal]}}renderCellContent(t,e){var s;const o=this.captions[t],n=void 0!==o?i("div",{class:"grid-caption",style:{"font-size":`${e.captionFontSize}px`,"font-weight":String(e.captionFontWeight),color:e.captionColor,"margin-bottom":`${e.captionGap}px`,"align-self":"flex-start"}},o):null,l={};"top"===this.resolvedVertical&&"left"===this.resolvedHorizontal||(l["align-self"]="stretch","center"!==this.resolvedHorizontal&&"right"!==this.resolvedHorizontal||(l.display="flex",l["flex-direction"]="column",l["align-items"]=x[this.resolvedHorizontal])),"center"===this.resolvedVertical?(l["margin-top"]="auto",l["margin-bottom"]="auto"):"bottom"===this.resolvedVertical&&(l["margin-top"]="auto");const r=this.frames.has(t)?{bottom:null===(s=this.offsets[t])||void 0===s?void 0:s.bottom}:this.offsets[t];return(null==r?void 0:r.bottom)&&(l["margin-top"]="auto"),(null==r?void 0:r.top)&&(l["padding-top"]=`${r.top}px`),(null==r?void 0:r.left)&&(l["margin-left"]=`${r.left}px`),(null==r?void 0:r.right)&&(l["margin-right"]=`${r.right}px`),[n,i("div",{class:"grid-slot","data-slot":t,style:l},i("slot",{name:t}))]}getFontStyles(){return this.componentStyle((t=>{var i,e,s,o;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===(s=t.global)||void 0===s?void 0:s.fontColor)||"#000000","--bn-font-background":(null===(o=t.global)||void 0===o?void 0:o.fontBackgroundColor)||"#ffffff"}}))}render(){const t="equal"===this.resolvedWidth,s=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 i(e,{key:"643b4d675bac89c542618e7d6ec5f2c0ef8d6d6c",style:t?Object.assign(Object.assign({},this.getFontStyles()),{display:"block"}):this.getFontStyles()},i("div",{key:"4bc671a6868b313c809f37aeb2f32ca30c7e9142",class:"grid-container",style:s},this.renderTitle(),this.renderColumnHeaders(),this.renderDataCells()),i("slot",{key:"5e66d95c65a0bad59d3816cf0009bb88fbe53f9c"}))}get element(){return s(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}]}}};j.style=':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}';export{j as bn_grid}
|
|
1
|
+
import{r as t,h as i,a as e,g as s}from"./p-CCZcKl0Q.js";import{LAYOUT_STATE_VERSION as o}from"./index.esm.js";import{l as n,o as l,r,m as a,a as d}from"./p-qpZjVnX5.js";import{w as h,a as c}from"./p-D0tNATZq.js";import{w as u,a as v}from"./p-EcC0qLtU.js";function f(t){if(!t||""===t.trim()||"[]"===t)return[];try{const i=JSON.parse(t);return Array.isArray(i)?i.map(((t,i)=>{var e,s,o;return"string"==typeof t?{label:t,id:String(i)}:"object"==typeof t&&null!==t?{label:null!==(s=null!==(e=t.label)&&void 0!==e?e:t.name)&&void 0!==s?s:String(i),id:null!==(o=t.id)&&void 0!==o?o:String(i)}:{label:String(t),id:String(i)}})):[]}catch(t){return console.error("parseHeaders: failed to parse JSON",t),[]}}function g(t,i){return`${t.id}-${i.id}`}function p(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=[],s=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`):s.has(t.id)?e.push(`Header[${i}]: duplicate id '${t.id}'`):s.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"],m=["top","center","bottom","baseline"],y=["left","center","right","baseline"],w={top:"flex-start",center:"center",bottom:"flex-end",baseline:"flex-start"},x={left:"stretch",center:"center",right:"flex-end",baseline:"stretch"},C=t=>Math.round(100*t)/100,S=new Set(["bn-asset","bn-component-style","bn-dataset","bn-datasource","bn-internationalization","bn-ruleset","bn-scaling-group"]),$=new Set(["bn-layout-card"]),H={top:"--bn-baseline-offset-top",left:"--bn-baseline-offset-left",right:"--bn-baseline-offset-right"},j=class{validateRowHeaders(t){const i="ERR_rowHeaders",e=p(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=p(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,m,"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,s]of Object.entries(i)){if("string"!=typeof s)return;""!==s&&(e[t]=s)}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(i){t(this,i),this.gridConfig={rows:[],columns:[]},this.resolvedHeight="auto",this.resolvedWidth="auto",this.resolvedVertical="top",this.resolvedHorizontal="left",this.captions={},this.offsets={},this.frames=new Map,this.observed=new WeakSet,this.scheduled=!1,this.run=0,this.adjustments=0,this.chartTitle="",this.rowHeaders="[]",this.columnHeaders="[]",this.showRowHeaders=!0,this.showColumnHeaders=!0,this.showBorders=!0,this.rowHeaderWidth="auto",this.cellGap="0px",this.cellHeight="auto",this.cellWidth="auto",this.cellVerticalAlign="top",this.cellHorizontalAlign="left",this.cellCaptions="",this.schedule=()=>{if(!this.isBaselineMode())return this.run++,Object.keys(this.offsets).length>0&&(this.offsets={}),void this.applyFrameOffsets();this.scheduled||(this.scheduled=!0,this.holdStatus(new Promise((t=>{requestAnimationFrame((()=>{this.scheduled=!1,this.align().catch((t=>console.error("bn-grid: aligning the baselines failed",t))).finally(t)}))}))))},u(this),this.holdStatus=h(this),this.errors=c(this),this.componentStyle=v(this)}connectedCallback(){var t;this.observed=new WeakSet,this.resizeObserver=new ResizeObserver(this.schedule),this.mutationObserver=new MutationObserver(this.schedule),this.mutationObserver.observe(this.element,{childList:!0,subtree:!0,attributes:!0,attributeFilter:["slot"]}),null===(t=document.fonts)||void 0===t||t.addEventListener("loadingdone",this.schedule)}disconnectedCallback(){var t,i,e;null===(t=this.resizeObserver)||void 0===t||t.disconnect(),null===(i=this.mutationObserver)||void 0===i||i.disconnect(),null===(e=document.fonts)||void 0===e||e.removeEventListener("loadingdone",this.schedule),this.run++}componentDidRender(){this.schedule()}validateChoice(t,i,e,s,o){return null==e||""===e?(this.errors.remove(i),o):s.includes(e)?(this.errors.remove(i),e):(this.errors.addOrReplace({id:i,type:"error",message:`${t}: "${e}" is not one of ${s.join(", ")}.`}),o)}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("*"))],s=e.find((t=>t.localName.startsWith("bn-")&&!S.has(t.localName)&&!$.has(t.localName))),o=s?e.find((t=>$.has(t.localName)&&t.contains(s))):void 0;return{visual:s,frame:o}}applyFrameOffsets(){this.frames.forEach(((t,i)=>{const e=this.offsets[i];Object.keys(H).forEach((i=>{const s=null==e?void 0:e[i];s?t.style.setProperty(H[i],`${s}px`):t.style.removeProperty(H[i])}))}))}async align(){var t;const i=++this.run;if(!this.element.isConnected||!this.isBaselineMode())return;const{rows:e,columns:s}=this.gridConfig,o=e.flatMap(((t,i)=>s.map(((e,s)=>({slot:g(t,e),row:i,column:s}))))),l=o.map((({slot:t})=>this.contentIn(t))),r=l.map((t=>t.visual));if(await Promise.all(r.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;r.forEach((t=>t&&this.observe(t)));const a=await Promise.all(r.map((t=>"function"==typeof(null==t?void 0:t.getBaseline)?t.getBaseline().catch((()=>({}))):Promise.resolve({}))));if(i!==this.run)return;const d=n(this.element),h=new Map;null===(t=this.element.shadowRoot)||void 0===t||t.querySelectorAll(".grid-slot").forEach((t=>{var i;h.set(null!==(i=t.getAttribute("data-slot"))&&void 0!==i?i:"",t)})),this.frames=new Map,l.forEach((({frame:t},i)=>t&&this.frames.set(o[i].slot,t)));const c=function(t,i,e){const s={};for(const i of t)s[i.slot]={};const o=(i,e,o,n)=>{var l;const r=new Map;for(const e of t)r.set(e[i],[...null!==(l=r.get(e[i]))&&void 0!==l?l:[],e]);for(const t of r.values()){const i=t.map((t=>{const i=e(t);return void 0===i?void 0:i-o(t)})),l=i.filter((t=>void 0!==t)),r=l.length>0?Math.max(...l):0,a=i.map((t=>void 0===t?void 0:C(r-t))),d=Math.max(0,...a.filter((t=>void 0!==t)));t.forEach(((t,i)=>n(s[t.slot],a[i],d)))}};return i&&o("row",(t=>t.y),(t=>t.top),((t,i)=>{void 0===i?t.bottom=!0:t.top=i})),e&&o("column",(t=>t.x),(t=>t.left),((t,i,e)=>{void 0!==i&&(t.left=i);const s=C(e-(null!=i?i:0));s>0&&(t.right=s)})),s}(o.map((({slot:t,row:i,column:e},s)=>{const o=r[s],n=a[s],c=l[s].frame,u=null!=c?c:h.get(t),v=t=>parseFloat((null==u?void 0:u.style.getPropertyValue(t))||"0")||0,f=c?{slot:t,row:i,column:e,top:v(H.top),left:v(H.left)}:{slot:t,row:i,column:e,top:v("padding-top"),left:v("margin-left")};if(o){const t=d.toLocal(o.getBoundingClientRect());void 0!==n.y&&(f.y=t.y+n.y),void 0!==n.x&&(f.x=t.x+n.x)}return f})),"baseline"===this.resolvedVertical,"baseline"===this.resolvedHorizontal);if(function(t,i){var e,s,o,n,l,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!==(s=i[c])&&void 0!==s?s:{};if(Boolean(h.bottom)!==Boolean(u.bottom))return!1;if(Math.abs((null!==(o=h.top)&&void 0!==o?o:0)-(null!==(n=u.top)&&void 0!==n?n:0))>=.5)return!1;if(Math.abs((null!==(l=h.left)&&void 0!==l?l:0)-(null!==(r=u.left)&&void 0!==r?r:0))>=.5)return!1;if(Math.abs((null!==(a=h.right)&&void 0!==a?a:0)-(null!==(d=u.right)&&void 0!==d?d:0))>=.5)return!1}return!0}(c,this.offsets))this.adjustments=0;else{if(this.adjustments>=5)return console.warn("bn-grid: the baselines did not settle; the cells keep their last alignment."),void(this.adjustments=0);this.adjustments++,this.offsets=c,this.applyFrameOffsets(),this.schedule()}}observe(t){var i;this.observed.has(t)||(this.observed.add(t),null===(i=this.resizeObserver)||void 0===i||i.observe(t));const e=t=>{var i;t&&(this.observed.has(t)||(this.observed.add(t),null===(i=this.mutationObserver)||void 0===i||i.observe(t,{childList:!0,subtree:!0,attributes:!0,attributeFilter:["x1","y1","x2","y2","x","y","width","height","transform","style","class"]})),t.querySelectorAll("*").forEach((t=>e(t.shadowRoot))))};e(t.shadowRoot)}async getLayoutState(t){var i,e,s,n;const h=null!==(i=null==t?void 0:t.detail)&&void 0!==i?i:"summary",c=l(this.element),u=this.componentStyle((t=>{var i;return(null===(i=t.global)||void 0===i?void 0:i.fontSizePx)||13.3333})),{rows:v,columns:f}=this.gridConfig,g={version:o,tag:this.element.localName,id:d(this.element),slot:null!==(e=this.element.getAttribute("slot"))&&void 0!==e?e:void 0,rect:a(this.element,c),em:{fontSizePx:u,appliedScaleFactor:1},regions:[],metadata:{title:this.chartTitle||void 0,rowCount:v.length,columnCount:f.length,cellCount:v.length*f.length},diagnostics:r(this.element)},p=null===(s=this.element.shadowRoot)||void 0===s?void 0:s.querySelector(".grid-container");if(p&&g.regions.push({id:"grid",rect:a(p,c)}),"full"!==h||!p)return g;const b=[],m=t=>b.push(t),y=p.querySelector(".grid-title");return y&&m({kind:"gridTitle",label:(null===(n=y.textContent)||void 0===n?void 0:n.trim())||void 0,rect:a(y,c)}),p.querySelectorAll(".grid-header-col").forEach(((t,i)=>{var e,s;m({kind:"gridHeader",columnId:null===(e=f[i])||void 0===e?void 0:e.id,label:(null===(s=t.textContent)||void 0===s?void 0:s.trim())||void 0,rect:a(t,c)})})),p.querySelectorAll(".grid-header-row").forEach(((t,i)=>{var e,s;m({kind:"gridHeader",rowId:null===(e=v[i])||void 0===e?void 0:e.id,label:(null===(s=t.textContent)||void 0===s?void 0:s.trim())||void 0,rect:a(t,c)})})),p.querySelectorAll(".grid-cell").forEach(((t,i)=>{var e,s,o,n;m({kind:"gridCell",rowId:f.length>0?null===(e=v[Math.floor(i/f.length)])||void 0===e?void 0:e.id:void 0,columnId:f.length>0?null===(s=f[i%f.length])||void 0===s?void 0:s.id:void 0,slot:null!==(n=null===(o=t.querySelector("slot"))||void 0===o?void 0:o.getAttribute("name"))&&void 0!==n?n:void 0,rect:a(t,c)})})),p.querySelectorAll(".grid-caption").forEach((t=>{var i,e,s,o;m({kind:"gridCaption",slot:null!==(s=null===(e=null===(i=t.parentElement)||void 0===i?void 0:i.querySelector("slot"))||void 0===e?void 0:e.getAttribute("name"))&&void 0!==s?s:void 0,label:(null===(o=t.textContent)||void 0===o?void 0:o.trim())||void 0,rect:a(t,c)})})),g.elements=b,g}getGridStyle(){return this.componentStyle((t=>t["bn-grid"]))}componentWillLoad(){this.validateRowHeaders(this.rowHeaders),this.validateColumnHeaders(this.columnHeaders),this.validateCellHeight(this.cellHeight),this.validateCellWidth(this.cellWidth),this.validateCellVerticalAlign(this.cellVerticalAlign),this.validateCellHorizontalAlign(this.cellHorizontalAlign),this.validateCellCaptions(this.cellCaptions)}updateGridConfig(){var t;this.gridConfig=(t=this.columnHeaders,{rows:f(this.rowHeaders),columns:f(t)})}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 i("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(),e=this.shouldShowBorders()?`${t.borderWidth}px solid ${t.borderColor}`:"none",s=this.shouldShowRowHeaders()?2:1,o=this.chartTitle?2:1;return this.gridConfig.columns.map(((n,l)=>{const r=l>0;return i("div",{key:`col-header-${n.id}`,class:"grid-header grid-header-col",style:{"grid-column":String(s+l),"grid-row":String(o),"border-left":r?e:"none",padding:`${t.cellPadding}px`,"padding-left":r?`${t.cellPadding+4}px`:`${t.cellPadding}px`}},n.label)}))}renderDataCells(){const t=this.getGridStyle(),e=this.shouldShowBorders()?`${t.borderWidth}px solid ${t.borderColor}`:"none",s=this.shouldShowRowHeaders()?2:1,o=(this.chartTitle?1:0)+(this.shouldShowColumnHeaders()?1:0)+1,n=[];return this.gridConfig.rows.length>0&&this.gridConfig.columns.length>0&&this.gridConfig.rows.forEach(((l,r)=>{if(this.shouldShowRowHeaders()){const s=r>0;n.push(i("div",{key:`row-header-${l.id}`,class:"grid-header grid-header-row",style:{"grid-column":"1","grid-row":String(o+r),"border-top":s?e:"none",padding:`${t.cellPadding}px`,"padding-top":s?`${t.cellPadding+4}px`:`${t.cellPadding}px`}},l.label))}this.gridConfig.columns.forEach(((a,d)=>{const h=g(l,a),c=d>0,u=r>0;n.push(i("div",{key:`cell-${h}`,class:"grid-cell","data-bn-fit-content":"",style:Object.assign({"grid-column":String(s+d),"grid-row":String(o+r),"border-left":c?e:"none","border-top":u?e:"none","padding-left":c?`${t.cellPadding+4}px`:"0","padding-top":u?`${t.cellPadding+4}px`:"0"},this.cellAlignStyle())},this.renderCellContent(h,t)))}))})),n}cellAlignStyle(){return"top"===this.resolvedVertical&&"left"===this.resolvedHorizontal?{}:{display:"flex","flex-direction":"column","justify-content":w[this.resolvedVertical],"align-items":x[this.resolvedHorizontal]}}renderCellContent(t,e){var s;const o=this.captions[t],n=void 0!==o?i("div",{class:"grid-caption",style:{"font-size":`${e.captionFontSize}px`,"font-weight":String(e.captionFontWeight),color:e.captionColor,"margin-bottom":`${e.captionGap}px`,"align-self":"flex-start"}},o):null,l={};"top"===this.resolvedVertical&&"left"===this.resolvedHorizontal||(l["align-self"]="stretch","center"!==this.resolvedHorizontal&&"right"!==this.resolvedHorizontal||(l.display="flex",l["flex-direction"]="column",l["align-items"]=x[this.resolvedHorizontal])),"center"===this.resolvedVertical?(l["margin-top"]="auto",l["margin-bottom"]="auto"):"bottom"===this.resolvedVertical&&(l["margin-top"]="auto");const r=this.frames.has(t)?{bottom:null===(s=this.offsets[t])||void 0===s?void 0:s.bottom}:this.offsets[t];return(null==r?void 0:r.bottom)&&(l["margin-top"]="auto"),(null==r?void 0:r.top)&&(l["padding-top"]=`${r.top}px`),(null==r?void 0:r.left)&&(l["margin-left"]=`${r.left}px`),(null==r?void 0:r.right)&&(l["margin-right"]=`${r.right}px`),[n,i("div",{class:"grid-slot","data-slot":t,style:l},i("slot",{name:t}))]}getFontStyles(){return this.componentStyle((t=>{var i,e,s,o;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===(s=t.global)||void 0===s?void 0:s.fontColor)||"#000000","--bn-font-background":(null===(o=t.global)||void 0===o?void 0:o.fontBackgroundColor)||"#ffffff"}}))}render(){const t="equal"===this.resolvedWidth,s=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 i(e,{key:"df0d9a7bacea1a58c3280db1c8bff5d79c21fd9b",style:t?Object.assign(Object.assign({},this.getFontStyles()),{display:"block"}):this.getFontStyles()},i("div",{key:"63007962f57a49273ad2670d17bcc0035532f303",class:"grid-container",style:s},this.renderTitle(),this.renderColumnHeaders(),this.renderDataCells()),i("slot",{key:"877653c214c2c888079753b6ab2a0e8a8daab59e"}))}get element(){return s(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}]}}};j.style=':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}';export{j as bn_grid}
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
var index = require('./index-DGis1BzT.js');
|
|
4
4
|
var withHasError = require('./withHasError-BkBrsCpI.js');
|
|
5
5
|
var withStyled = require('./withStyled-BZb6snOx.js');
|
|
6
|
-
var withTranslation = require('./withTranslation-
|
|
6
|
+
var withTranslation = require('./withTranslation-1qTs5Fi7.js');
|
|
7
7
|
var withBodyObserver = require('./withBodyObserver-S-FGHpAX.js');
|
|
8
8
|
var localFrame = require('./localFrame-U3Qs0psw.js');
|
|
9
9
|
var index$1 = require('./index.cjs.js');
|
|
@@ -28378,12 +28378,21 @@ class TableRow {
|
|
|
28378
28378
|
cssStyle = cellStyle !== null && cellStyle !== void 0 ? cellStyle : scenario;
|
|
28379
28379
|
}
|
|
28380
28380
|
if (this.type === withStyled.TableRowType.PARTELEMENT) {
|
|
28381
|
-
|
|
28382
|
-
|
|
28381
|
+
const variance = new VarianceScenario(scenario);
|
|
28382
|
+
if (variance.isValid && Number.isFinite(value)) {
|
|
28383
|
+
// the change of a share: percentage points, or the relative change in percent. It has no sentiment
|
|
28384
|
+
cellType = variance.type === "d" ? "percentpoint" : "percent";
|
|
28385
|
+
cssStyle = (cellStyle !== null && cellStyle !== void 0 ? cellStyle : "").replace(/^(pos|neg)_\w+/, "$1_neu");
|
|
28383
28386
|
}
|
|
28384
|
-
|
|
28385
|
-
|
|
28386
|
-
|
|
28387
|
+
else {
|
|
28388
|
+
// a share without a total has no change either
|
|
28389
|
+
if (cellType === "percent" || variance.isValid) {
|
|
28390
|
+
value = "-";
|
|
28391
|
+
}
|
|
28392
|
+
if (scenario !== "category" && scenario !== "operation") {
|
|
28393
|
+
cellType = "percent";
|
|
28394
|
+
cssStyle = "";
|
|
28395
|
+
}
|
|
28387
28396
|
}
|
|
28388
28397
|
}
|
|
28389
28398
|
if (value === "-" || (value === withStyled.NOT_AVAILABLE && cellType === "percent")) {
|
|
@@ -29568,12 +29577,8 @@ class DataQuery {
|
|
|
29568
29577
|
const queries = [];
|
|
29569
29578
|
const sumGroupQueries = [];
|
|
29570
29579
|
const res = [];
|
|
29571
|
-
const scenarios = this.
|
|
29572
|
-
|
|
29573
|
-
.toString();
|
|
29574
|
-
const scenariosSUMQuery = this.config.scenarios
|
|
29575
|
-
.map((s) => this.translateScenarioSQL(s, true, this.config.type))
|
|
29576
|
-
.toString();
|
|
29580
|
+
const scenarios = this.scenariosSQL(false);
|
|
29581
|
+
const scenariosSUMQuery = this.scenariosSQL(true);
|
|
29577
29582
|
const relativeScenarios = this.getRelativeScenarios();
|
|
29578
29583
|
const attributesSQL = this.config.attributes.map((attribute) => this.translateAttributeSQL(attribute)).toString();
|
|
29579
29584
|
const groups = new QueryGroups(this.config);
|
|
@@ -29689,7 +29694,8 @@ class DataQuery {
|
|
|
29689
29694
|
drillQueries.forEach((query) => {
|
|
29690
29695
|
resDrill.push(...this.exec(query));
|
|
29691
29696
|
});
|
|
29692
|
-
|
|
29697
|
+
// two relative variances on one reference name its dr_* alias twice
|
|
29698
|
+
const scenarioNames = [...new Set(this.exctractScenarioNames(scenarios))];
|
|
29693
29699
|
const rowGroupSumResultRows = [];
|
|
29694
29700
|
sumGroupQueries.forEach(function (query) {
|
|
29695
29701
|
rowGroupSumResultRows.push(...db.exec(query, params));
|
|
@@ -29697,21 +29703,29 @@ class DataQuery {
|
|
|
29697
29703
|
const rowGroupSumResultMap = new Map();
|
|
29698
29704
|
rowGroupSumResultRows.forEach((row) => rowGroupSumResultMap.set(row[QueryColumnNames.ROWGROUP], row));
|
|
29699
29705
|
resDrill = this.reduceResDrillByCategoryGroups(resDrill, scenarioNames);
|
|
29700
|
-
resDrill.forEach(
|
|
29701
|
-
|
|
29702
|
-
try {
|
|
29703
|
-
drillItem[key] =
|
|
29704
|
-
drillItem[key] /
|
|
29705
|
-
rowGroupSumResultMap.get(drillItem[QueryColumnNames.ROWGROUP])[key];
|
|
29706
|
-
}
|
|
29707
|
-
catch (err) {
|
|
29708
|
-
console.error("DataQuery: partOf drill row calculation failed", key, err);
|
|
29709
|
-
drillItem[key] = Number.NaN;
|
|
29710
|
-
}
|
|
29711
|
-
});
|
|
29706
|
+
resDrill.forEach((drillItem) => {
|
|
29707
|
+
this.toShares(drillItem, rowGroupSumResultMap.get(drillItem[QueryColumnNames.ROWGROUP]), scenarioNames);
|
|
29712
29708
|
});
|
|
29713
29709
|
this.injectDrillRowsToResultRows(resDrill, res);
|
|
29714
29710
|
}
|
|
29711
|
+
/**
|
|
29712
|
+
* Turns the values of a partof row into shares of its total. A variance becomes the change of the
|
|
29713
|
+
* share (percentage points), not the share of the variance.
|
|
29714
|
+
*/
|
|
29715
|
+
toShares(part, totals, names) {
|
|
29716
|
+
var _a;
|
|
29717
|
+
const share = (key) => part[key] / (totals ? totals[key] : Number.NaN);
|
|
29718
|
+
const changes = new Map();
|
|
29719
|
+
for (const name of names) {
|
|
29720
|
+
const variance = new VarianceScenario(name);
|
|
29721
|
+
if (variance.isValid) {
|
|
29722
|
+
changes.set(name, share(variance.base) - share(variance.delta));
|
|
29723
|
+
}
|
|
29724
|
+
}
|
|
29725
|
+
for (const name of names) {
|
|
29726
|
+
part[name] = (_a = changes.get(name)) !== null && _a !== void 0 ? _a : share(name);
|
|
29727
|
+
}
|
|
29728
|
+
}
|
|
29715
29729
|
/**
|
|
29716
29730
|
* Generates a REST row that aggregates all data rows beyond the configured limit.
|
|
29717
29731
|
* Only emitted when a limit is set and the group has more rows than the limit.
|
|
@@ -30067,12 +30081,8 @@ class DataQuery {
|
|
|
30067
30081
|
}
|
|
30068
30082
|
const separator = "##";
|
|
30069
30083
|
const bucketSource = `(SELECT *, ${intervalBucketSQL(this.config.interval)} as __interval FROM ${this.fromExpr}) as p`;
|
|
30070
|
-
const scenarios = this.
|
|
30071
|
-
|
|
30072
|
-
.toString();
|
|
30073
|
-
const scenariosSUMQuery = this.config.scenarios
|
|
30074
|
-
.map((s) => this.translateScenarioSQL(s, true, this.config.type))
|
|
30075
|
-
.toString();
|
|
30084
|
+
const scenarios = this.scenariosSQL(false);
|
|
30085
|
+
const scenariosSUMQuery = this.scenariosSQL(true);
|
|
30076
30086
|
// two relative variances on one reference name its dr_* alias twice, it must be summed once
|
|
30077
30087
|
const entryAliases = [...new Set(this.exctractScenarioNames(scenarios))];
|
|
30078
30088
|
const relativeScenarios = this.getRelativeScenarios();
|
|
@@ -30298,9 +30308,7 @@ class DataQuery {
|
|
|
30298
30308
|
const totals = this.config.grouped
|
|
30299
30309
|
? groupTotalsByKey.get(`${partRow.rowGroup}${separator}${bucketKey}`)
|
|
30300
30310
|
: sumTotalsByBucket.get(bucketKey);
|
|
30301
|
-
|
|
30302
|
-
partRow[alias] = partRow[alias] / (totals ? totals[alias] : Number.NaN);
|
|
30303
|
-
}
|
|
30311
|
+
this.toShares(partRow, totals, entryAliases);
|
|
30304
30312
|
finalizeBucketRow(partRow);
|
|
30305
30313
|
for (const segment of res) {
|
|
30306
30314
|
for (const row of segment) {
|
|
@@ -30329,6 +30337,29 @@ class DataQuery {
|
|
|
30329
30337
|
}
|
|
30330
30338
|
return whereClause + `)`;
|
|
30331
30339
|
}
|
|
30340
|
+
/**
|
|
30341
|
+
* The select list of the scenarios. A partof row needs both sides of every variance, also when they
|
|
30342
|
+
* are not shown. Those come without their `_cnt`, so the NaN detection of the other rows does not change.
|
|
30343
|
+
*/
|
|
30344
|
+
scenariosSQL(isSumRow) {
|
|
30345
|
+
const shown = this.config.scenarios;
|
|
30346
|
+
const sql = shown.map((s) => this.translateScenarioSQL(s, isSumRow, this.config.type));
|
|
30347
|
+
if (this.checkConfigForPartOf() && this.config.type !== withStyled.TableType.LIST) {
|
|
30348
|
+
const hidden = new Set();
|
|
30349
|
+
for (const scenario of shown) {
|
|
30350
|
+
const variance = new VarianceScenario(scenario);
|
|
30351
|
+
if (variance.isValid) {
|
|
30352
|
+
hidden.add(variance.base).add(variance.delta);
|
|
30353
|
+
}
|
|
30354
|
+
}
|
|
30355
|
+
for (const scenario of hidden) {
|
|
30356
|
+
if (!shown.includes(scenario)) {
|
|
30357
|
+
sql.push(this.translateScenarioSQL(scenario, isSumRow, this.config.type).split(", COUNT(")[0]);
|
|
30358
|
+
}
|
|
30359
|
+
}
|
|
30360
|
+
}
|
|
30361
|
+
return sql.toString();
|
|
30362
|
+
}
|
|
30332
30363
|
/** Collects all relative variance scenarios and maps each to its denominator column name. */
|
|
30333
30364
|
getRelativeScenarios() {
|
|
30334
30365
|
const relativeScenarios = new Map();
|
|
@@ -31077,13 +31108,15 @@ class TableDataSetFactory {
|
|
|
31077
31108
|
scenario.name === scenario.type
|
|
31078
31109
|
? waterfallResult === null || waterfallResult === void 0 ? void 0 : waterfallResult.get(rawDataRow, scenario.type)
|
|
31079
31110
|
: undefined;
|
|
31080
|
-
|
|
31081
|
-
|
|
31082
|
-
|
|
31083
|
-
new VarianceScenario(scenario.type).isValid &&
|
|
31084
|
-
(waterfallResult === null || waterfallResult === void 0 ? void 0 : waterfallResult.has(scenario.type)));
|
|
31111
|
+
const isShareChange = type === withStyled.TableRowType.PARTELEMENT && new VarianceScenario(scenario.type).isValid;
|
|
31112
|
+
// the change of a share is in percentage points, it has no place on the axis of the column
|
|
31113
|
+
const isBarChart = isBarColumn && !isShareChange;
|
|
31085
31114
|
const columnStats = isBarChart ? columnStatsMap === null || columnStatsMap === void 0 ? void 0 : columnStatsMap.get(scenario.type) : undefined;
|
|
31086
|
-
detailsRow.createElement(
|
|
31115
|
+
detailsRow.createElement(
|
|
31116
|
+
// percent values have no share, so there is no change of a share either
|
|
31117
|
+
isShareChange && scenariosUnitType === withStyled.DataFormat.PERCENT
|
|
31118
|
+
? "-"
|
|
31119
|
+
: this.translateSumCellLabel(i18nMode, i18n, value, groupName, subCategory, type, scenario.type), scenario.type, this.createColumnType(scenario), this.setCellType(scenario.type, scenariosUnitType), moved ? null : this.translateCellPrefix(i18n, type, scenario.type), this.translateScenarioCSS(scenario.type, value, operation), isSecondElement, categoryWidth, measureScale === null || measureScale === void 0 ? void 0 : measureScale.value, isBarChart, columnStats, 1, waterfall);
|
|
31087
31120
|
const cell = detailsRow.elements[detailsRow.elements.length - 1];
|
|
31088
31121
|
if (this.dateBuckets && scenario.bucket !== undefined) {
|
|
31089
31122
|
cell.date = pointDate(scenario.bucket);
|
|
@@ -31827,7 +31860,7 @@ class TableDrillGroupAdapter {
|
|
|
31827
31860
|
}
|
|
31828
31861
|
}
|
|
31829
31862
|
|
|
31830
|
-
const bnTableRendererCss = () => `: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{position:relative;display:inline-block}table{background-color:var(--bn-font-background, white);font-size:var(--bn-font-size, 1em);color:var(--bn-font-color, black);font-family:var(--bn-font-family, "Noto Sans", "Helvetica Neue", Helvetica, sans-serif);border-spacing:0.3em 0}thead{border-style:none}tr:first-child td{border-top:none;padding-top:0.5em}td.ac1,td.ac2,td.ac3,td.ac4,td.pp1,td.pp2,td.pp3,td.pp4,td.pl1,td.pl2,td.pl3,td.pl4,td.fc1,td.fc2,td.fc3,td.fc4,td.share,td.variance,td.pos_pos,td.pos_neg,td.neg_pos,td.neg_neg,td.pos_neutral,td.neg_neutral,td.zero{text-align:right}.category-w100{min-width:100em;max-width:100em}.category-w50{min-width:50em;max-width:50em}.category-w25{min-width:25em;max-width:25em}.category-w20{min-width:20em;max-width:20em}.category-w15{min-width:15em;max-width:15em}.category-w10{min-width:10em;max-width:10em}.category-w5{min-width:5em;max-width:5em}.prefix-second{color:transparent;font-style:normal}.prefix-first{font-style:normal}th{border-bottom:0.1em solid black;text-align:right;font-weight:normal;vertical-align:text-top}td.columnGroup,th.columnGroup{font-size:0.6em}td.columnSubGroup,th.columnSubGroup{font-size:0.6em;border-spacing:0em 0;font-style:italic}td.base,th.base{font-style:normal}th.ofit,td.ofit,tr.ofit,th.partof,td.partof,tr.partof{font-size:0.6em;font-style:italic}td.ofit,td.partof{font-size:0.6em;font-style:italic}th.ofit td,tr.ofit td,th.partof td,tr.partof td{border-top:0em solid black;padding-left:1em}th.ofit share,th.partof share,tr.share td{border-top:0em solid black}th.share,tr.share,td.share{font-size:0.6em;font-style:italic}th.barColumn{text-align:center}td.block-start,th.block-start{border-left:var(--bn-block-gap, 0) solid transparent;clip-path:inset(-100em -100em -100em var(--bn-block-gap, 0))}.category-w100.block-start{min-width:calc(100em + var(--bn-block-gap, 0px));max-width:calc(100em + var(--bn-block-gap, 0px))}.category-w50.block-start{min-width:calc(50em + var(--bn-block-gap, 0px));max-width:calc(50em + var(--bn-block-gap, 0px))}.category-w25.block-start{min-width:calc(25em + var(--bn-block-gap, 0px));max-width:calc(25em + var(--bn-block-gap, 0px))}.category-w20.block-start{min-width:calc(20em + var(--bn-block-gap, 0px));max-width:calc(20em + var(--bn-block-gap, 0px))}.category-w15.block-start{min-width:calc(15em + var(--bn-block-gap, 0px));max-width:calc(15em + var(--bn-block-gap, 0px))}.category-w10.block-start{min-width:calc(10em + var(--bn-block-gap, 0px));max-width:calc(10em + var(--bn-block-gap, 0px))}.category-w5.block-start{min-width:calc(5em + var(--bn-block-gap, 0px));max-width:calc(5em + var(--bn-block-gap, 0px))}th.filler{border-bottom:0em solid black;text-align:right}td.filler{border-top:0em none !important;border-bottom:0em none;text-align:right}th.group{text-align:center;border-spacing:1em 0}th.headerlabel{border-bottom:0em none black;padding-bottom:0em}th.intervalGroup{border-bottom:0.1em solid black;text-align:center}td.variance:after{content:"%"}td.relative_variance{font-style:italic}td.percent{font-style:italic;text-align:right}td.decimal,td.percentpoint{text-align:right}td.pos_pos{color:#008f96}td.neg_pos{color:#ff0000}td.pos_neg{color:#ff0000}td.neg_neg{color:#008f96}td.pos_pos:before{content:"+"}td.pos_neg:before{content:"+"}td.pos_neu:before{content:"+"}th.ac1,th.ac2,th.ac3,th.ac4{padding-top:0em;border-bottom:0.3em solid black}th.pp1,th.pp2,th.pp3,th.pp4{padding-top:0em;border-bottom:0.3em solid grey}th.pl1,th.pl2,th.pl3,th.pl4{padding-top:0em;border-bottom:0.3em double black}th.fc1,th.fc2,th.fc3,th.fc4{border-bottom:0.3em solid;border-image:repeating-linear-gradient(-45deg, white, white, black, white, white 0.3em) 2}td.colsum{font-weight:bold}th.colsum{padding-top:0em;font-weight:bold}tr.sum td{border-top:0.1em solid black;font-weight:bold;padding-bottom:0.5em}table.grouped-list tr.sum td{padding-bottom:1em}tr.ofit-above td[class^=category]{padding-left:1em}tr.ofit-sum td{border-top:0.1em solid black;font-weight:bold}tr.sum td.pos_pos,tr.sum td.pos_neg,tr.sum td.neg_pos,tr.sum td.neg_neg,tr.ofit-sum td.pos_pos,tr.ofit-sum td.pos_neg,tr.ofit-sum td.neg_pos,tr.ofit-sum td.neg_neg{color:inherit}tr.groupheader td{border-top:0em dotted #ddd;padding-top:0.5em;font-weight:bold;font-style:italic}tr.begingroup td{border-top:0em dotted #ddd;padding-top:0.5em}th.begin-group{padding-left:0.75em}th.end-group{padding-left:0.75em}td{box-sizing:border-box;-webkit-box-sizing:border-box;border-top:0.1em solid #ddd;padding-left:0.5em;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.table-footer{font-size:0.6em}.cell-bar-chart{display:inline-block;vertical-align:middle}.bar-chart-empty{color:#999}td:has(.variance-waterfall){overflow:visible}td:has(.cell-bar-chart){padding:0 0.25em;vertical-align:middle}tr.ofit td:has(.cell-bar-chart),tr.partof td:has(.cell-bar-chart),tr.share td:has(.cell-bar-chart){padding:0 0.4166666667em}td:has(.cell-bar-chart).pos_pos:before,td:has(.cell-bar-chart).pos_neg:before,td:has(.cell-bar-chart).pos_neu:before{content:none}td:has(.cell-bar-chart).variance:after{content:none}`;
|
|
31863
|
+
const bnTableRendererCss = () => `: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{position:relative;display:inline-block}table{background-color:var(--bn-font-background, white);font-size:var(--bn-font-size, 1em);color:var(--bn-font-color, black);font-family:var(--bn-font-family, "Noto Sans", "Helvetica Neue", Helvetica, sans-serif);border-spacing:0.3em 0}thead{border-style:none}tr:first-child td{border-top:none;padding-top:0.5em}td.ac1,td.ac2,td.ac3,td.ac4,td.pp1,td.pp2,td.pp3,td.pp4,td.pl1,td.pl2,td.pl3,td.pl4,td.fc1,td.fc2,td.fc3,td.fc4,td.share,td.variance,td.pos_pos,td.pos_neg,td.neg_pos,td.neg_neg,td.pos_neutral,td.neg_neutral,td.zero{text-align:right}.category-w100{min-width:100em;max-width:100em}.category-w50{min-width:50em;max-width:50em}.category-w25{min-width:25em;max-width:25em}.category-w20{min-width:20em;max-width:20em}.category-w15{min-width:15em;max-width:15em}.category-w10{min-width:10em;max-width:10em}.category-w5{min-width:5em;max-width:5em}.prefix-second{color:transparent;font-style:normal}.prefix-first{font-style:normal}th{border-bottom:0.1em solid black;text-align:right;font-weight:normal;vertical-align:text-top}td.columnGroup,th.columnGroup{font-size:0.6em}td.columnSubGroup,th.columnSubGroup{font-size:0.6em;border-spacing:0em 0;font-style:italic}td.base,th.base{font-style:normal}th.ofit,td.ofit,tr.ofit,th.partof,td.partof,tr.partof{font-size:0.6em;font-style:italic}td.ofit,td.partof{font-size:0.6em;font-style:italic}th.ofit td,tr.ofit td,th.partof td,tr.partof td{border-top:0em solid black;padding-left:1em}th.ofit share,th.partof share,tr.share td{border-top:0em solid black}tr.partof td.percentpoint{font-style:italic}tr.partof td.percentpoint:after{content:"%p"}th.share,tr.share,td.share{font-size:0.6em;font-style:italic}th.barColumn{text-align:center}td.block-start,th.block-start{border-left:var(--bn-block-gap, 0) solid transparent;clip-path:inset(-100em -100em -100em var(--bn-block-gap, 0))}.category-w100.block-start{min-width:calc(100em + var(--bn-block-gap, 0px));max-width:calc(100em + var(--bn-block-gap, 0px))}.category-w50.block-start{min-width:calc(50em + var(--bn-block-gap, 0px));max-width:calc(50em + var(--bn-block-gap, 0px))}.category-w25.block-start{min-width:calc(25em + var(--bn-block-gap, 0px));max-width:calc(25em + var(--bn-block-gap, 0px))}.category-w20.block-start{min-width:calc(20em + var(--bn-block-gap, 0px));max-width:calc(20em + var(--bn-block-gap, 0px))}.category-w15.block-start{min-width:calc(15em + var(--bn-block-gap, 0px));max-width:calc(15em + var(--bn-block-gap, 0px))}.category-w10.block-start{min-width:calc(10em + var(--bn-block-gap, 0px));max-width:calc(10em + var(--bn-block-gap, 0px))}.category-w5.block-start{min-width:calc(5em + var(--bn-block-gap, 0px));max-width:calc(5em + var(--bn-block-gap, 0px))}th.filler{border-bottom:0em solid black;text-align:right}td.filler{border-top:0em none !important;border-bottom:0em none;text-align:right}th.group{text-align:center;border-spacing:1em 0}th.headerlabel{border-bottom:0em none black;padding-bottom:0em}th.intervalGroup{border-bottom:0.1em solid black;text-align:center}td.variance:after{content:"%"}td.relative_variance{font-style:italic}td.percent{font-style:italic;text-align:right}td.decimal,td.percentpoint{text-align:right}td.pos_pos{color:#008f96}td.neg_pos{color:#ff0000}td.pos_neg{color:#ff0000}td.neg_neg{color:#008f96}td.pos_pos:before{content:"+"}td.pos_neg:before{content:"+"}td.pos_neu:before{content:"+"}th.ac1,th.ac2,th.ac3,th.ac4{padding-top:0em;border-bottom:0.3em solid black}th.pp1,th.pp2,th.pp3,th.pp4{padding-top:0em;border-bottom:0.3em solid grey}th.pl1,th.pl2,th.pl3,th.pl4{padding-top:0em;border-bottom:0.3em double black}th.fc1,th.fc2,th.fc3,th.fc4{border-bottom:0.3em solid;border-image:repeating-linear-gradient(-45deg, white, white, black, white, white 0.3em) 2}td.colsum{font-weight:bold}th.colsum{padding-top:0em;font-weight:bold}tr.sum td{border-top:0.1em solid black;font-weight:bold;padding-bottom:0.5em}table.grouped-list tr.sum td{padding-bottom:1em}tr.ofit-above td[class^=category]{padding-left:1em}tr.ofit-sum td{border-top:0.1em solid black;font-weight:bold}tr.sum td.pos_pos,tr.sum td.pos_neg,tr.sum td.neg_pos,tr.sum td.neg_neg,tr.ofit-sum td.pos_pos,tr.ofit-sum td.pos_neg,tr.ofit-sum td.neg_pos,tr.ofit-sum td.neg_neg{color:inherit}tr.groupheader td{border-top:0em dotted #ddd;padding-top:0.5em;font-weight:bold;font-style:italic}tr.begingroup td{border-top:0em dotted #ddd;padding-top:0.5em}th.begin-group{padding-left:0.75em}th.end-group{padding-left:0.75em}td{box-sizing:border-box;-webkit-box-sizing:border-box;border-top:0.1em solid #ddd;padding-left:0.5em;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.table-footer{font-size:0.6em}.cell-bar-chart{display:inline-block;vertical-align:middle}.bar-chart-empty{color:#999}td:has(.variance-waterfall){overflow:visible}td:has(.cell-bar-chart){padding:0 0.25em;vertical-align:middle}tr.ofit td:has(.cell-bar-chart),tr.partof td:has(.cell-bar-chart),tr.share td:has(.cell-bar-chart){padding:0 0.4166666667em}td:has(.cell-bar-chart).pos_pos:before,td:has(.cell-bar-chart).pos_neg:before,td:has(.cell-bar-chart).pos_neu:before{content:none}td:has(.cell-bar-chart).variance:after{content:none}`;
|
|
31831
31864
|
|
|
31832
31865
|
/** Extra gap before the first column of a block, in table em. */
|
|
31833
31866
|
const BLOCK_GAP_EM = 0.6;
|
|
@@ -34282,7 +34315,10 @@ const ChartTree = class {
|
|
|
34282
34315
|
if (!this.treeConfig || !this.layout) {
|
|
34283
34316
|
return null;
|
|
34284
34317
|
}
|
|
34285
|
-
return Array.from(this.treeConfig.allNodes).map((nodeId) => (
|
|
34318
|
+
return Array.from(this.treeConfig.allNodes).map((nodeId) => (
|
|
34319
|
+
// data-bn-fit-content: a node is as high as its content, so no height in it is a limit
|
|
34320
|
+
// for that content (see findConstrainedHeight in utils/parentDimensions)
|
|
34321
|
+
index.h("div", { key: nodeId, class: "tree-node", "data-bn-fit-content": "", style: this.getSlotStyle(nodeId) }, index.h("slot", { name: nodeId }))));
|
|
34286
34322
|
}
|
|
34287
34323
|
getFontStyles() {
|
|
34288
34324
|
return this.componentStyle(($) => {
|
|
@@ -779,7 +779,7 @@ const Grid = class {
|
|
|
779
779
|
const slotName = getSlotName(row, col);
|
|
780
780
|
const isNotFirstCol = colIndex > 0;
|
|
781
781
|
const isNotFirstRow = rowIndex > 0;
|
|
782
|
-
cells.push(index.h("div", { key: `cell-${slotName}`, class: "grid-cell", style: Object.assign({ "grid-column": String(startCol + colIndex), "grid-row": String(startRow + rowIndex), "border-left": isNotFirstCol ? borderStyle : "none", "border-top": isNotFirstRow ? borderStyle : "none", "padding-left": isNotFirstCol ? `${style.cellPadding + 4}px` : "0", "padding-top": isNotFirstRow ? `${style.cellPadding + 4}px` : "0" }, this.cellAlignStyle()) }, this.renderCellContent(slotName, style)));
|
|
782
|
+
cells.push(index.h("div", { key: `cell-${slotName}`, class: "grid-cell", "data-bn-fit-content": "", style: Object.assign({ "grid-column": String(startCol + colIndex), "grid-row": String(startRow + rowIndex), "border-left": isNotFirstCol ? borderStyle : "none", "border-top": isNotFirstRow ? borderStyle : "none", "padding-left": isNotFirstCol ? `${style.cellPadding + 4}px` : "0", "padding-top": isNotFirstRow ? `${style.cellPadding + 4}px` : "0" }, this.cellAlignStyle()) }, this.renderCellContent(slotName, style)));
|
|
783
783
|
});
|
|
784
784
|
});
|
|
785
785
|
}
|
|
@@ -861,7 +861,7 @@ const Grid = class {
|
|
|
861
861
|
// would only be as wide as their content, and charts measure that width.
|
|
862
862
|
const fill = this.resolvedWidth === "equal";
|
|
863
863
|
const gridContainerStyle = Object.assign(Object.assign({ display: fill ? "grid" : "inline-grid" }, (fill ? { width: "100%" } : {})), { "grid-template-columns": this.getGridTemplateColumns(), "grid-template-rows": this.getGridTemplateRows(), gap: this.cellGap });
|
|
864
|
-
return (index.h(index.Host, { key: '
|
|
864
|
+
return (index.h(index.Host, { key: 'df0d9a7bacea1a58c3280db1c8bff5d79c21fd9b', style: fill ? Object.assign(Object.assign({}, this.getFontStyles()), { display: "block" }) : this.getFontStyles() }, index.h("div", { key: '63007962f57a49273ad2670d17bcc0035532f303', class: "grid-container", style: gridContainerStyle }, this.renderTitle(), this.renderColumnHeaders(), this.renderDataCells()), index.h("slot", { key: '877653c214c2c888079753b6ab2a0e8a8daab59e' })));
|
|
865
865
|
}
|
|
866
866
|
get element() { return index.getElement(this); }
|
|
867
867
|
static get watchers() { return {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
3
|
var index = require('./index-DGis1BzT.js');
|
|
4
|
-
var withTranslation = require('./withTranslation-
|
|
4
|
+
var withTranslation = require('./withTranslation-1qTs5Fi7.js');
|
|
5
5
|
var withHasError = require('./withHasError-BkBrsCpI.js');
|
|
6
6
|
var withStyled = require('./withStyled-BZb6snOx.js');
|
|
7
7
|
|
|
@@ -170,14 +170,17 @@ function getVisualParent(element) {
|
|
|
170
170
|
* height as a last resort.
|
|
171
171
|
*
|
|
172
172
|
* Ancestors inside a fit-content layout region (marked with
|
|
173
|
-
* `data-bn-fit-content` by bn-layout-page / bn-layout-card
|
|
173
|
+
* `data-bn-fit-content` by bn-layout-page / bn-layout-card, and by every
|
|
174
|
+
* cell of bn-grid and node of bn-tree) are skipped
|
|
174
175
|
* even when they clip overflow: their height is derived from their own
|
|
175
176
|
* content - including the measuring component itself - so using it for
|
|
176
177
|
* auto-scaling creates a feedback loop where the chart inflates the cell
|
|
177
178
|
* and then reads the inflated cell back as "available height". The marker
|
|
178
179
|
* value carries the grid's row count; the constraint found above the
|
|
179
180
|
* fit-content region is divided by it, approximating the equal-share cell
|
|
180
|
-
* height the same layout would produce with fit-to-content disabled.
|
|
181
|
+
* height the same layout would produce with fit-to-content disabled. A grid
|
|
182
|
+
* cell and a tree node carry no row count: their content gets the same
|
|
183
|
+
* height with and without a card around it.
|
|
181
184
|
*/
|
|
182
185
|
function findConstrainedHeight(element, debug = false) {
|
|
183
186
|
let current = findLayoutParent(element);
|
|
@@ -557,7 +557,7 @@ export class Grid {
|
|
|
557
557
|
const slotName = getSlotName(row, col);
|
|
558
558
|
const isNotFirstCol = colIndex > 0;
|
|
559
559
|
const isNotFirstRow = rowIndex > 0;
|
|
560
|
-
cells.push(h("div", { key: `cell-${slotName}`, class: "grid-cell", style: Object.assign({ "grid-column": String(startCol + colIndex), "grid-row": String(startRow + rowIndex), "border-left": isNotFirstCol ? borderStyle : "none", "border-top": isNotFirstRow ? borderStyle : "none", "padding-left": isNotFirstCol ? `${style.cellPadding + 4}px` : "0", "padding-top": isNotFirstRow ? `${style.cellPadding + 4}px` : "0" }, this.cellAlignStyle()) }, this.renderCellContent(slotName, style)));
|
|
560
|
+
cells.push(h("div", { key: `cell-${slotName}`, class: "grid-cell", "data-bn-fit-content": "", style: Object.assign({ "grid-column": String(startCol + colIndex), "grid-row": String(startRow + rowIndex), "border-left": isNotFirstCol ? borderStyle : "none", "border-top": isNotFirstRow ? borderStyle : "none", "padding-left": isNotFirstCol ? `${style.cellPadding + 4}px` : "0", "padding-top": isNotFirstRow ? `${style.cellPadding + 4}px` : "0" }, this.cellAlignStyle()) }, this.renderCellContent(slotName, style)));
|
|
561
561
|
});
|
|
562
562
|
});
|
|
563
563
|
}
|
|
@@ -639,7 +639,7 @@ export class Grid {
|
|
|
639
639
|
// would only be as wide as their content, and charts measure that width.
|
|
640
640
|
const fill = this.resolvedWidth === "equal";
|
|
641
641
|
const gridContainerStyle = Object.assign(Object.assign({ display: fill ? "grid" : "inline-grid" }, (fill ? { width: "100%" } : {})), { "grid-template-columns": this.getGridTemplateColumns(), "grid-template-rows": this.getGridTemplateRows(), gap: this.cellGap });
|
|
642
|
-
return (h(Host, { key: '
|
|
642
|
+
return (h(Host, { key: 'df0d9a7bacea1a58c3280db1c8bff5d79c21fd9b', style: fill ? Object.assign(Object.assign({}, this.getFontStyles()), { display: "block" }) : this.getFontStyles() }, h("div", { key: '63007962f57a49273ad2670d17bcc0035532f303', class: "grid-container", style: gridContainerStyle }, this.renderTitle(), this.renderColumnHeaders(), this.renderDataCells()), h("slot", { key: '877653c214c2c888079753b6ab2a0e8a8daab59e' })));
|
|
643
643
|
}
|
|
644
644
|
static get is() { return "bn-grid"; }
|
|
645
645
|
static get encapsulation() { return "shadow"; }
|
|
@@ -183,6 +183,15 @@ tr.share td {
|
|
|
183
183
|
border-top: 0em solid black;
|
|
184
184
|
}
|
|
185
185
|
|
|
186
|
+
/* the variance of a partof row is a change of the share, in percentage points */
|
|
187
|
+
tr.partof td.percentpoint {
|
|
188
|
+
font-style: italic;
|
|
189
|
+
}
|
|
190
|
+
|
|
191
|
+
tr.partof td.percentpoint:after {
|
|
192
|
+
content: "%p";
|
|
193
|
+
}
|
|
194
|
+
|
|
186
195
|
th.share,
|
|
187
196
|
tr.share,
|
|
188
197
|
td.share {
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { TableRowType } from "../model";
|
|
2
2
|
import { Cell } from "./Cell";
|
|
3
3
|
import { NOT_AVAILABLE } from "../../../../utils/relativeVariance";
|
|
4
|
+
import { VarianceScenario } from "../../../../utils/model/VarianceScenario";
|
|
4
5
|
/**
|
|
5
6
|
* Represents a single row in an IBCS table, containing an ordered list of Cells.
|
|
6
7
|
*
|
|
@@ -65,12 +66,21 @@ export class TableRow {
|
|
|
65
66
|
cssStyle = cellStyle !== null && cellStyle !== void 0 ? cellStyle : scenario;
|
|
66
67
|
}
|
|
67
68
|
if (this.type === TableRowType.PARTELEMENT) {
|
|
68
|
-
|
|
69
|
-
|
|
69
|
+
const variance = new VarianceScenario(scenario);
|
|
70
|
+
if (variance.isValid && Number.isFinite(value)) {
|
|
71
|
+
// the change of a share: percentage points, or the relative change in percent. It has no sentiment
|
|
72
|
+
cellType = variance.type === "d" ? "percentpoint" : "percent";
|
|
73
|
+
cssStyle = (cellStyle !== null && cellStyle !== void 0 ? cellStyle : "").replace(/^(pos|neg)_\w+/, "$1_neu");
|
|
70
74
|
}
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
75
|
+
else {
|
|
76
|
+
// a share without a total has no change either
|
|
77
|
+
if (cellType === "percent" || variance.isValid) {
|
|
78
|
+
value = "-";
|
|
79
|
+
}
|
|
80
|
+
if (scenario !== "category" && scenario !== "operation") {
|
|
81
|
+
cellType = "percent";
|
|
82
|
+
cssStyle = "";
|
|
83
|
+
}
|
|
74
84
|
}
|
|
75
85
|
}
|
|
76
86
|
if (value === "-" || (value === NOT_AVAILABLE && cellType === "percent")) {
|
|
@@ -337,13 +337,15 @@ export class TableDataSetFactory {
|
|
|
337
337
|
scenario.name === scenario.type
|
|
338
338
|
? waterfallResult === null || waterfallResult === void 0 ? void 0 : waterfallResult.get(rawDataRow, scenario.type)
|
|
339
339
|
: undefined;
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
new VarianceScenario(scenario.type).isValid &&
|
|
344
|
-
(waterfallResult === null || waterfallResult === void 0 ? void 0 : waterfallResult.has(scenario.type)));
|
|
340
|
+
const isShareChange = type === TableRowType.PARTELEMENT && new VarianceScenario(scenario.type).isValid;
|
|
341
|
+
// the change of a share is in percentage points, it has no place on the axis of the column
|
|
342
|
+
const isBarChart = isBarColumn && !isShareChange;
|
|
345
343
|
const columnStats = isBarChart ? columnStatsMap === null || columnStatsMap === void 0 ? void 0 : columnStatsMap.get(scenario.type) : undefined;
|
|
346
|
-
detailsRow.createElement(
|
|
344
|
+
detailsRow.createElement(
|
|
345
|
+
// percent values have no share, so there is no change of a share either
|
|
346
|
+
isShareChange && scenariosUnitType === DataFormat.PERCENT
|
|
347
|
+
? "-"
|
|
348
|
+
: this.translateSumCellLabel(i18nMode, i18n, value, groupName, subCategory, type, scenario.type), scenario.type, this.createColumnType(scenario), this.setCellType(scenario.type, scenariosUnitType), moved ? null : this.translateCellPrefix(i18n, type, scenario.type), this.translateScenarioCSS(scenario.type, value, operation), isSecondElement, categoryWidth, measureScale === null || measureScale === void 0 ? void 0 : measureScale.value, isBarChart, columnStats, 1, waterfall);
|
|
347
349
|
const cell = detailsRow.elements[detailsRow.elements.length - 1];
|
|
348
350
|
if (this.dateBuckets && scenario.bucket !== undefined) {
|
|
349
351
|
cell.date = pointDate(scenario.bucket);
|