@bino-bi/bn-template-engine 1.0.0-next.32 → 1.0.0-next.34
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-66ed6259.entry.js +1 -0
- package/dist/bn-template-engine/p-789bfd06.entry.js +1 -0
- package/dist/bn-template-engine/{p-BTbeDWM9.js → p-CAvWZ3a5.js} +1 -1
- package/dist/bn-template-engine/p-_SKPuKfK.js +1 -0
- package/dist/bn-template-engine/p-dc12ff1b.entry.js +1 -0
- package/dist/bn-template-engine/p-dec6837c.entry.js +1 -0
- package/dist/cjs/bn-annotation-layer_30.cjs.entry.js +76 -28
- package/dist/cjs/bn-grid.cjs.entry.js +52 -15
- package/dist/cjs/bn-image.cjs.entry.js +1 -1
- package/dist/cjs/bn-text.cjs.entry.js +2 -2
- package/dist/cjs/{withStyled-Ds3e64Nz.js → withStyled-eHD8Yt2K.js} +6 -1
- package/dist/cjs/{withTranslation-Cjvvs3gL.js → withTranslation-yJ-j0lsu.js} +1 -1
- package/dist/collection/components/bn-chart-structure/bn-chart-structure.js +2 -2
- package/dist/collection/components/bn-chart-structure/utils/model/DataPoint.js +5 -2
- package/dist/collection/components/bn-chart-time/bn-chart-time.js +2 -2
- package/dist/collection/components/bn-chart-time/utils/model/DataPoint.js +5 -2
- package/dist/collection/components/bn-grid/bn-grid.js +51 -14
- package/dist/collection/components/bn-layout-card/bn-layout-card.css +8 -0
- package/dist/collection/components/bn-layout-card/bn-layout-card.js +2 -2
- package/dist/collection/components/bn-layout-page/bn-layout-page.js +2 -2
- package/dist/collection/components/bn-table/bn-table-renderer/bn-table-renderer.js +1 -1
- package/dist/collection/components/bn-table/bn-table.js +2 -2
- package/dist/collection/components/bn-table/utils/factories/tableDataSetFactory.js +23 -6
- package/dist/collection/components/bn-table/utils/helper/DataQuery.js +15 -6
- package/dist/collection/components/bn-title/bn-title.js +2 -2
- package/dist/collection/utils/constants.js +5 -0
- package/dist/collection/utils/model/VarianceScenario.js +21 -2
- package/dist/collection/utils/xy/VarianceMeasure.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-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-0gehv1XG.js → p-4BanAktr.js} +1 -1
- package/dist/components/{p-BoUkFdpu.js → p-B3F_c9GB.js} +1 -1
- package/dist/components/{p-CtBM3KFY.js → p-B4pmO5QQ.js} +1 -1
- package/dist/components/{p-DyO09Jk6.js → p-B7UDMyar.js} +1 -1
- package/dist/components/{p-CxPSvrcF.js → p-BNWZoAip.js} +1 -1
- package/dist/components/p-BT2WH_CP.js +1 -0
- package/dist/components/{p-BPJsmv3o.js → p-BVnYDfb8.js} +1 -1
- package/dist/components/p-BWRE5w0i.js +1 -0
- package/dist/components/{p-DPLcGhVt.js → p-BXt0ers2.js} +1 -1
- package/dist/components/{p-BpCL2bfw.js → p-BldMZbAf.js} +1 -1
- package/dist/components/p-BtH2oezK.js +1 -0
- package/dist/components/{p-CMM8vtHW.js → p-C-oNdJj9.js} +1 -1
- package/dist/components/{p-D5-dYgK_.js → p-CJtE8Pyr.js} +1 -1
- package/dist/components/p-CLkpoHdg.js +1 -0
- package/dist/components/{p-z56_ZQ42.js → p-CPC9Vkmg.js} +1 -1
- package/dist/components/p-CYqHwYgQ.js +1 -0
- package/dist/components/{p-DYG9FH_u.js → p-CYv_8LrR.js} +1 -1
- package/dist/components/p-Ckl1aEvn.js +1 -0
- package/dist/components/p-D5LDmR4u.js +1 -0
- package/dist/components/{p-COqIkH1M.js → p-DHAoxu6M.js} +1 -1
- package/dist/components/{p-DdGnuNtc.js → p-DLLljAll.js} +1 -1
- package/dist/components/p-DdG2Ylar.js +1 -0
- package/dist/components/{p-LZ9lAY8T.js → p-Dn3DJxQQ.js} +1 -1
- package/dist/components/{p-BohXdw3-.js → p-GrpYAVHb.js} +1 -1
- package/dist/components/p-M6hn0BuZ.js +1 -0
- package/dist/components/{p-Dlb4ncGF.js → p-VIw66ez1.js} +1 -1
- package/dist/components/p-nHZ8466v.js +1 -0
- package/dist/esm/bn-annotation-layer_30.entry.js +76 -28
- package/dist/esm/bn-grid.entry.js +52 -15
- package/dist/esm/bn-image.entry.js +1 -1
- package/dist/esm/bn-text.entry.js +2 -2
- package/dist/esm/{withStyled-B-cbWCe2.js → withStyled-Cxua0iTP.js} +6 -1
- package/dist/esm/{withTranslation-_8q-7Y9C.js → withTranslation-BeAbw2--.js} +1 -1
- package/dist/types/components/bn-chart-structure/bn-chart-structure.d.ts +1 -0
- package/dist/types/components/bn-chart-time/bn-chart-time.d.ts +4 -1
- package/dist/types/components/bn-grid/bn-grid.d.ts +6 -2
- package/dist/types/components/bn-layout-card/bn-layout-card.d.ts +4 -3
- package/dist/types/components/bn-layout-page/bn-layout-page.d.ts +4 -3
- package/dist/types/components/bn-table/bn-table.d.ts +4 -1
- package/dist/types/components/bn-table/utils/elements/Cell.d.ts +2 -0
- package/dist/types/components/bn-table/utils/factories/tableDataSetFactory.d.ts +4 -0
- package/dist/types/components/bn-table/utils/helper/DataQuery.d.ts +3 -3
- package/dist/types/components/bn-title/bn-title.d.ts +1 -1
- package/dist/types/components.d.ts +12 -12
- package/dist/types/utils/constants.d.ts +6 -1
- package/dist/types/utils/model/VarianceScenario.d.ts +13 -1
- package/package.json +1 -1
- package/dist/bn-template-engine/p-225cd474.entry.js +0 -1
- package/dist/bn-template-engine/p-58b10778.entry.js +0 -1
- package/dist/bn-template-engine/p-9f3cbc5f.entry.js +0 -1
- package/dist/bn-template-engine/p-BjR3nkhl.js +0 -1
- package/dist/bn-template-engine/p-ce39e111.entry.js +0 -1
- package/dist/components/p-B2jqpOF9.js +0 -1
- package/dist/components/p-BQMKgvEC.js +0 -1
- package/dist/components/p-BpsXOtoW.js +0 -1
- package/dist/components/p-CDoSPw-I.js +0 -1
- package/dist/components/p-CujsXn-l.js +0 -1
- package/dist/components/p-D4FY_yoG.js +0 -1
- package/dist/components/p-oJjMz8JF.js +0 -1
- package/dist/components/p-xpguaboj.js +0 -1
- package/dist/components/p-yH-XxIy9.js +0 -1
- package/dist/components/p-zf8cTH63.js +0 -1
|
@@ -0,0 +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-CHZ50kEY.js";import{w as h,a as c}from"./p-CJfJQT0m.js";import{w as u,a as v}from"./p-_SKPuKfK.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}
|
|
@@ -2,8 +2,8 @@
|
|
|
2
2
|
|
|
3
3
|
var index = require('./index-DGis1BzT.js');
|
|
4
4
|
var withHasError = require('./withHasError-3kR2tdhJ.js');
|
|
5
|
-
var withStyled = require('./withStyled-
|
|
6
|
-
var withTranslation = require('./withTranslation-
|
|
5
|
+
var withStyled = require('./withStyled-eHD8Yt2K.js');
|
|
6
|
+
var withTranslation = require('./withTranslation-yJ-j0lsu.js');
|
|
7
7
|
var withBodyObserver = require('./withBodyObserver-B1_hmuUz.js');
|
|
8
8
|
var localFrame = require('./localFrame-P5SDUOto.js');
|
|
9
9
|
var index$1 = require('./index.cjs.js');
|
|
@@ -2552,11 +2552,15 @@ class VarianceScenario {
|
|
|
2552
2552
|
this.base = "";
|
|
2553
2553
|
/** Subtrahend scenario (the value subtracted), e.g. `"pl1"` */
|
|
2554
2554
|
this.delta = "";
|
|
2555
|
-
/**
|
|
2555
|
+
/**
|
|
2556
|
+
* Sentiment direction: `"pos"` (favorable), `"neg"` (unfavorable), `"neu"` (neutral),
|
|
2557
|
+
* `"op"` (follows the row operation) or `"opinv"` (inverse of `"op"`). See {@link resolveSentiment}.
|
|
2558
|
+
*/
|
|
2556
2559
|
this.direction = "";
|
|
2557
2560
|
this.isValid = false;
|
|
2558
2561
|
/** Capture groups: [1]=type (d|dr), [2]=base scenario, [3]=delta scenario, [4]=sentiment */
|
|
2559
|
-
|
|
2562
|
+
// not anchored on purpose, some callers pass a joined list; opinv must come before op
|
|
2563
|
+
const scenarioTestRegex = /(d|dr)(pl\d|ac\d|fc\d|pp\d)_(pl\d|ac\d|fc\d|pp\d)_(pos|neg|neu|opinv|op)/;
|
|
2560
2564
|
if (scenarioTestRegex.test(scenario)) {
|
|
2561
2565
|
const tokens = scenarioTestRegex.exec(scenario);
|
|
2562
2566
|
if (tokens != null) {
|
|
@@ -2569,6 +2573,21 @@ class VarianceScenario {
|
|
|
2569
2573
|
}
|
|
2570
2574
|
}
|
|
2571
2575
|
}
|
|
2576
|
+
/**
|
|
2577
|
+
* Resolves a variance sentiment to `"pos"`, `"neg"` or `"neu"` for one row.
|
|
2578
|
+
*
|
|
2579
|
+
* `"op"` colours by the contribution to the result: on a `"-"` row it acts like `"neg"`,
|
|
2580
|
+
* on every other row (`"+"`, `"="`) like `"pos"`. `"opinv"` is the inverse.
|
|
2581
|
+
* When the values are already signed by their operation (`signedValues`, e.g. sum/list
|
|
2582
|
+
* tables and charts), `"op"` always acts like `"pos"` and `"opinv"` like `"neg"`.
|
|
2583
|
+
*/
|
|
2584
|
+
function resolveSentiment(direction, operation, signedValues) {
|
|
2585
|
+
if (direction !== "op" && direction !== "opinv") {
|
|
2586
|
+
return direction;
|
|
2587
|
+
}
|
|
2588
|
+
const subtracts = !signedValues && operation === "-";
|
|
2589
|
+
return (direction === "op") !== subtracts ? "pos" : "neg";
|
|
2590
|
+
}
|
|
2572
2591
|
|
|
2573
2592
|
const FAMILIES = ["ac", "pp", "fc", "pl"];
|
|
2574
2593
|
const SLOT_BY_COLOR_INDEX = { 10: "ac", 20: "pp", 30: "fc", 50: "pl" };
|
|
@@ -15176,7 +15195,7 @@ const Chart$1 = class Chart {
|
|
|
15176
15195
|
scenariosArray = [...scenariosArray, ...variancesArray];
|
|
15177
15196
|
}
|
|
15178
15197
|
const fontStyles = this.getFontStyles();
|
|
15179
|
-
return (index.h(index.Host, { key: '
|
|
15198
|
+
return (index.h(index.Host, { key: '467a851c6547b300c71a38e812bfea4718f27775', style: fontStyles }, index.h("div", { key: '4b5078608132e047a9404987c65c46f43037c043', class: "container" }, scenariosArray.map(this.chartTemplate))));
|
|
15180
15199
|
}
|
|
15181
15200
|
get element() { return index.getElement(this); }
|
|
15182
15201
|
static get watchers() { return {
|
|
@@ -15831,10 +15850,12 @@ let DataPoint$1 = class DataPoint {
|
|
|
15831
15850
|
this.value = value;
|
|
15832
15851
|
this.scenario = scenario;
|
|
15833
15852
|
this.pixelPerUnit = pixelPerUnit || 1;
|
|
15834
|
-
|
|
15853
|
+
// chart values are signed by their operation, so op acts like pos and opinv like neg
|
|
15854
|
+
const direction = typeof variance === "string" ? resolveSentiment(variance, null, true) : variance;
|
|
15855
|
+
if (direction === "neg" || direction === Scenario$1.NEG) {
|
|
15835
15856
|
this.variance = Scenario$1.NEG;
|
|
15836
15857
|
}
|
|
15837
|
-
else if (
|
|
15858
|
+
else if (direction === "pos" || direction === Scenario$1.POS) {
|
|
15838
15859
|
this.variance = Scenario$1.POS;
|
|
15839
15860
|
}
|
|
15840
15861
|
else {
|
|
@@ -19908,7 +19929,7 @@ const Chart = class {
|
|
|
19908
19929
|
scenariosArray = [...scenariosArray, ...variancesArray];
|
|
19909
19930
|
}
|
|
19910
19931
|
const fontStyles = this.getFontStyles();
|
|
19911
|
-
return (index.h(index.Host, { key: '
|
|
19932
|
+
return (index.h(index.Host, { key: '37085b275bb92d716a31f79f15b9f2517f1c596b', style: fontStyles }, index.h("div", { key: '93e9eacc22334da1deed871db640d6fd4aafb153', class: "container" }, scenariosArray.map(this.chartTemplate))));
|
|
19912
19933
|
}
|
|
19913
19934
|
get element() { return index.getElement(this); }
|
|
19914
19935
|
static get watchers() { return {
|
|
@@ -20391,10 +20412,12 @@ class DataPoint {
|
|
|
20391
20412
|
this.value = value;
|
|
20392
20413
|
this.scenario = scenario;
|
|
20393
20414
|
this.pixelPerUnit = pixelPerUnit || 1;
|
|
20394
|
-
|
|
20415
|
+
// chart values are signed by their operation, so op acts like pos and opinv like neg
|
|
20416
|
+
const direction = typeof variance === "string" ? resolveSentiment(variance, null, true) : variance;
|
|
20417
|
+
if (direction === "neg" || direction === Scenario.NEG) {
|
|
20395
20418
|
this.variance = Scenario.NEG;
|
|
20396
20419
|
}
|
|
20397
|
-
else if (
|
|
20420
|
+
else if (direction === "pos" || direction === Scenario.POS) {
|
|
20398
20421
|
this.variance = Scenario.POS;
|
|
20399
20422
|
}
|
|
20400
20423
|
else {
|
|
@@ -25826,7 +25849,7 @@ function templateProblem(customTemplate) {
|
|
|
25826
25849
|
return undefined;
|
|
25827
25850
|
}
|
|
25828
25851
|
|
|
25829
|
-
const bnLayoutCardCss = () => `: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: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}`;
|
|
25852
|
+
const bnLayoutCardCss = () => `: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)}`;
|
|
25830
25853
|
|
|
25831
25854
|
const LayoutCard = class {
|
|
25832
25855
|
constructor(hostRef) {
|
|
@@ -26046,7 +26069,7 @@ const LayoutCard = class {
|
|
|
26046
26069
|
var _a;
|
|
26047
26070
|
const style = this.getLayoutStyle();
|
|
26048
26071
|
const arrOfSlots = this.extractSlotNames(style["grid-template-areas"]);
|
|
26049
|
-
return (index.h("bn-card", { key: '
|
|
26072
|
+
return (index.h("bn-card", { key: 'f9d135554b1ab8a8bee9bb4f7084e465e495e180', styles: this.styles, "selected-style": this.selectedStyle, class: this.setCardClass() }, index.h("div", { key: '54766941aa09df561453f620bd2ecd16f9fd3526', class: "cardtitle" }, index.h("bn-title", { key: 'ce2dc7bd84943a6b97068441d9da85a150271227', "i18n-namespace": (_a = this.i18nNamespace) !== null && _a !== void 0 ? _a : this.titleNamespace, ruleset: this.titleProp("ruleset"), "business-unit": this.titleBusinessUnit, scenarios: this.titleProp("titleScenarios"), variances: this.titleProp("titleVariances"), order: this.titleProp("titleOrder"), "order-direction": this.titleProp("titleOrderDirection"), measures: this.titleMeasures, "date-start": this.titleDateStart, "date-end": this.titleDateEnd, "date-format": this.titleDateFormat, "date-link": this.titleDateLink }), this.titleImage != null && this.titleImage !== "" ? (index.h("img", { class: "image", src: this.prepareTitleImage(this.titleImage) })) : ("")), index.h("bn-body", { key: 'b692bf5149c7c34288b612b7179779030ef2031c' }, index.h("div", { key: '2650ddbbae89f6e63fdeba3f65513446eb22a96f', style: style, "data-bn-fit-content": this.cardFitToContent ? String(this.getRowCount(this.cardLayout)) : null }, this.getSlots(arrOfSlots))), index.h("bn-footer", { key: 'd924118be1d48c4f80b8e6d39f90aa1e2b3a1ff2', text: this.footerText, "page-number": "0", "display-page-number": "false" })));
|
|
26050
26073
|
}
|
|
26051
26074
|
get element() { return index.getElement(this); }
|
|
26052
26075
|
};
|
|
@@ -26282,7 +26305,7 @@ const LayoutPage = class {
|
|
|
26282
26305
|
const style = this.getLayoutStyle();
|
|
26283
26306
|
const arrOfSlots = this.extractSlotNames(style["grid-template-areas"]);
|
|
26284
26307
|
const rotation = this.rotation();
|
|
26285
|
-
return (index.h(index.Host, { key: '
|
|
26308
|
+
return (index.h(index.Host, { key: '290e6e8250c5f8bf53352886a810eeedd7548e57', style: rotation === null || rotation === void 0 ? void 0 : rotation.host }, index.h("bn-page", { key: '71b472107af79e9581e2097aae33c6b2808decbf', styles: this.styles, "selected-style": this.selectedStyle, format: this.pageFormat, orientation: this.pageOrientation, style: rotation === null || rotation === void 0 ? void 0 : rotation.page }, index.h("bn-message", { key: '99ac5c760476f95ff296077736849e6ddfd85120', text: this.messageText, image: this.messageImage }), index.h("bn-title", { key: '3af5ee4a7be905676a927397ff19cf062b291fb6', "i18n-namespace": (_a = this.i18nNamespace) !== null && _a !== void 0 ? _a : 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 }), index.h("bn-body", { key: 'c91e9c708934499b855fe9e321bebb7aed31ab7c' }, index.h("div", { key: '92d01a4bad8ae401e570fcee4a9bbdac42b31d81', style: style, "data-bn-fit-content": this.pageFitToContent ? String(this.getRowCount(this.pageLayout)) : null }, this.getSlots(arrOfSlots)), index.h("slot", { key: 'ac227c5985b827e91d139396915e3a104e44710b', name: "annotations" })), index.h("bn-footer", { key: '41dfc75b74a158a0e7cdb05456b03ae62cf6d6db', text: this.footerText, "page-number": this.pageNumber, "display-page-number": this.footerDisplayPageNumber }))));
|
|
26286
26309
|
}
|
|
26287
26310
|
get element() { return index.getElement(this); }
|
|
26288
26311
|
};
|
|
@@ -28015,7 +28038,7 @@ const Table$1 = class Table {
|
|
|
28015
28038
|
render() {
|
|
28016
28039
|
const fontStyles = this.getFontStyles();
|
|
28017
28040
|
const effectiveFactor = this.getEffectiveScaleFactor();
|
|
28018
|
-
return (index.h(index.Host, { key: '
|
|
28041
|
+
return (index.h(index.Host, { key: '2c70b811354760fd12ac968f7ed3ace210b104a7', style: fontStyles }, index.h("div", { key: '992b077e5e627d067d1199d0ff8434d2216fa107' }, index.h("bn-table-renderer", { key: 'f765e647c7f3d303ba7297f54d9b3a387ed4c160', tableName: this.datasetName, dataVersion: this.dataVersion, sumTitle: this.prepareSumTitle(), scenarios: this.prepareScenarios(), scenariosDataFormat: this.prepareDataFormat(), grouped: this.prepareGrouped(), limit: this.prepareLimit(), showGroupTitle: this.prepareShowGroupTitle(), thereof: this.prepareThereOf(), partof: this.preparePartOf(), order: this.prepareOrder(), categorythereof: this.prepareColumnThereOf(), attributeColumns: this.prepareAttributes(), type: this.prepareTableType(), categoryWidth: this.prepareCategoryWidth(), dataFormatDigits: this.prepareDataFormatDigits(), i18n: this.prepareI18n(), i18nMode: this.prepareI18nMode(), measureScale: this.prepareMeasureScale(), measureType: this.prepareMeasureType(), measureUnit: this.prepareMeasureUnit(), showMeasureScale: this.prepareShowMeasureScale(), filter: this.prepareFilter(), barColumns: this.prepareBarColumns(), interval: this.prepareInterval(), barColumnMaxWidth: this.prepareBarColumnWidth(), unitScaling: this.prepareUnitScaling(), percentageScaling: this.preparePercentageScaling(), reportAutoScaling: this.handleAutoScalingReport, errors: this.errors, scaleFactor: effectiveFactor, ruleSetConfig: this.ruleSetConfig(), selectedStyle: this.selectedStyle }))));
|
|
28019
28042
|
}
|
|
28020
28043
|
get element() { return index.getElement(this); }
|
|
28021
28044
|
static get watchers() { return {
|
|
@@ -28914,7 +28937,11 @@ class DataQuery {
|
|
|
28914
28937
|
const restScenarios = this.exctractScenarioNames(scenarios)
|
|
28915
28938
|
.map((name) => `SUM(${name}) as ${name}`)
|
|
28916
28939
|
.join(", ");
|
|
28917
|
-
|
|
28940
|
+
// a REST row of only "-" rows counts as "-" for the op sentiment; not named operation, so it stays hidden
|
|
28941
|
+
const restOperation = TableType.OPT === this.config.type || TableType.OPTNOTOTAL === this.config.type
|
|
28942
|
+
? `, CASE WHEN MAX(transformOperator(operation)) = -1 THEN '-' ELSE '+' END as restOperation`
|
|
28943
|
+
: "";
|
|
28944
|
+
querys.push(`SELECT ${QueryColumnNames.ROWNR}, 1 as ${QueryColumnNames.ROWGROUPINDEX} , 'ENTRY' as ${QueryColumnNames.TYPE}, 'NO_GROUP' as ${QueryColumnNames.ROWGROUP}, ${this.bind(String((_a = rowGroupEntry.rowGroup) !== null && _a !== void 0 ? _a : ""))} as restRowGroup, 'REST' as ${QueryColumnNames.CATEGORY}${restOperation} ${restScenarios.length > 0 ? ", " + restScenarios : ""} FROM` +
|
|
28918
28945
|
` (SELECT ROWNUM() AS ${QueryColumnNames.ROWNR}, ${querys.length} as ${QueryColumnNames.ROWGROUPINDEX} , 'ENTRY' as ${QueryColumnNames.TYPE}, ${this.bind(String(rowGroupEntry.rowGroup || "NO_GROUP"))} as ${QueryColumnNames.ROWGROUP}, ${groups.select()} ${scenarios.length > 0 ? ",".concat(scenarios) : ""} FROM ${this.fromExpr} ${queryWhereSection} GROUP BY ${groups} ORDER BY ${order[0]})` +
|
|
28919
28946
|
` t WHERE t.rowNr > ${this.config.limit}`);
|
|
28920
28947
|
}
|
|
@@ -29471,9 +29498,9 @@ class DataQuery {
|
|
|
29471
29498
|
/**
|
|
29472
29499
|
* Translates a scenario identifier into a SQL aggregation expression.
|
|
29473
29500
|
*
|
|
29474
|
-
* - **OPT/OPTNOTOTAL types**:
|
|
29475
|
-
*
|
|
29476
|
-
* `
|
|
29501
|
+
* - **OPT/OPTNOTOTAL types**: Entry rows are summed without `transformOperator`, they
|
|
29502
|
+
* show unsigned values. Sum rows (`isSumRow`) apply the operation sign to scenarios,
|
|
29503
|
+
* variances and the `dr_*` denominator alike.
|
|
29477
29504
|
* - **Other types**: Each value is multiplied by `transformOperator(operation)` which
|
|
29478
29505
|
* converts the `"+"` / `"-"` operation field into +1 / -1, so rows with negative
|
|
29479
29506
|
* operation are subtracted from the aggregate.
|
|
@@ -29485,11 +29512,16 @@ class DataQuery {
|
|
|
29485
29512
|
const scenarios = new VarianceScenario(scenario);
|
|
29486
29513
|
if (TableType.OPT === type || TableType.OPTNOTOTAL === type) {
|
|
29487
29514
|
if (scenarios.isValid) {
|
|
29515
|
+
// sum rows show signed scenario values, so their variances must be signed too
|
|
29516
|
+
const sign = isSumRow ? " * transformOperator(operation)" : "";
|
|
29517
|
+
const variance = isSumRow
|
|
29518
|
+
? `SUM((${scenarios.base} - ${scenarios.delta})${sign}) as ${scenario}`
|
|
29519
|
+
: `SUM(${scenarios.base} - ${scenarios.delta}) as ${scenario}`;
|
|
29488
29520
|
if (scenarios.type === "dr") {
|
|
29489
|
-
return
|
|
29521
|
+
return `${variance}, SUM(${scenarios.delta}${sign}) as dr_${scenarios.delta}`;
|
|
29490
29522
|
}
|
|
29491
29523
|
else {
|
|
29492
|
-
return
|
|
29524
|
+
return variance;
|
|
29493
29525
|
}
|
|
29494
29526
|
}
|
|
29495
29527
|
if (isSumRow) {
|
|
@@ -30010,6 +30042,8 @@ class TableDataSetFactory {
|
|
|
30010
30042
|
this.hasBlankRowGroup = false;
|
|
30011
30043
|
/** The interval columns stand for dates, so a cell of one has a date. */
|
|
30012
30044
|
this.dateBuckets = false;
|
|
30045
|
+
/** opt/optnototal tables show entry values without their operation sign. */
|
|
30046
|
+
this.unsignedEntries = false;
|
|
30013
30047
|
}
|
|
30014
30048
|
/** The underline class of a scenario column: the one of the style slot its colorIndex selects. */
|
|
30015
30049
|
underlineClass(type) {
|
|
@@ -30141,6 +30175,7 @@ class TableDataSetFactory {
|
|
|
30141
30175
|
let iGroupIndex = -1; // index used in detailRow JSON to count the current group
|
|
30142
30176
|
const dataQuery = new DataQuery(config, i18n);
|
|
30143
30177
|
this.dateBuckets = isDateInterval(config.interval);
|
|
30178
|
+
this.unsignedEntries = TableType.OPT === config.type || TableType.OPTNOTOTAL === config.type;
|
|
30144
30179
|
const queryData = dataQuery.execute(db, fromExpr); // collection of all query results
|
|
30145
30180
|
this.hasBlankRowGroup = dataQuery.hasBlankRowGroup;
|
|
30146
30181
|
// Calculate column statistics for bar columns
|
|
@@ -30270,8 +30305,10 @@ class TableDataSetFactory {
|
|
|
30270
30305
|
* @param columnStatsMap
|
|
30271
30306
|
*/
|
|
30272
30307
|
createRow(i18nMode, i18n, scenariosUnitType, groupData, iGroupIndex, iRowIndex, categoryWidth, measureScale, barColumns, columnStatsMap, waterfallResult) {
|
|
30273
|
-
var _a;
|
|
30308
|
+
var _a, _b, _c;
|
|
30274
30309
|
const result = [];
|
|
30310
|
+
// thereof and partof rows have no operation, they take the one of the row above
|
|
30311
|
+
let operation;
|
|
30275
30312
|
for (const rawDataRow of groupData) {
|
|
30276
30313
|
iRowIndex += 1;
|
|
30277
30314
|
// create next table row
|
|
@@ -30280,11 +30317,12 @@ class TableDataSetFactory {
|
|
|
30280
30317
|
const subCategory = rawDataRow[QueryColumnNames.SUBCATEGORY];
|
|
30281
30318
|
const type = rawDataRow[QueryColumnNames.TYPE];
|
|
30282
30319
|
const isSecondElement = rawDataRow[QueryColumnNames.ROWNR] >= 2;
|
|
30320
|
+
operation = ((_b = (_a = rawDataRow.operation) !== null && _a !== void 0 ? _a : rawDataRow.restOperation) !== null && _b !== void 0 ? _b : operation);
|
|
30283
30321
|
const detailsRow = this.createDetailRow(type, iRowIndex, iGroupIndex, groupData.length);
|
|
30284
30322
|
detailsRow.key = this.rowKey(rawDataRow);
|
|
30285
30323
|
for (const scenario of this.normalizedHeader) {
|
|
30286
30324
|
const value = this.getRawDataRowElement(rawDataRow, scenario);
|
|
30287
|
-
const isBarChart = (
|
|
30325
|
+
const isBarChart = (_c = barColumns === null || barColumns === void 0 ? void 0 : barColumns.includes(scenario.type)) !== null && _c !== void 0 ? _c : false;
|
|
30288
30326
|
const columnStats = isBarChart ? columnStatsMap === null || columnStatsMap === void 0 ? void 0 : columnStatsMap.get(scenario.type) : undefined;
|
|
30289
30327
|
// waterfall geometry only exists for plain scenario columns (no ## composites)
|
|
30290
30328
|
const waterfall = isBarChart &&
|
|
@@ -30293,9 +30331,14 @@ class TableDataSetFactory {
|
|
|
30293
30331
|
scenario.name === scenario.type
|
|
30294
30332
|
? waterfallResult === null || waterfallResult === void 0 ? void 0 : waterfallResult.get(rawDataRow, scenario.type)
|
|
30295
30333
|
: undefined;
|
|
30296
|
-
detailsRow.createElement(this.translateSumCellLabel(i18nMode, i18n, value, groupName, subCategory, type, scenario.type), scenario.type, this.createColumnType(scenario), this.setCellType(scenario.type, scenariosUnitType), this.translateCellPrefix(i18n, type, scenario.type), this.translateScenarioCSS(scenario.type, value), isSecondElement, categoryWidth, measureScale === null || measureScale === void 0 ? void 0 : measureScale.value, isBarChart, columnStats, 1, waterfall);
|
|
30334
|
+
detailsRow.createElement(this.translateSumCellLabel(i18nMode, i18n, value, groupName, subCategory, type, scenario.type), scenario.type, this.createColumnType(scenario), this.setCellType(scenario.type, scenariosUnitType), 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);
|
|
30335
|
+
const cell = detailsRow.elements[detailsRow.elements.length - 1];
|
|
30297
30336
|
if (this.dateBuckets && scenario.bucket !== undefined) {
|
|
30298
|
-
|
|
30337
|
+
cell.date = pointDate(scenario.bucket);
|
|
30338
|
+
}
|
|
30339
|
+
const varianceScenario = new VarianceScenario(scenario.type);
|
|
30340
|
+
if (varianceScenario.isValid) {
|
|
30341
|
+
cell.direction = this.resolveDirection(varianceScenario, operation);
|
|
30299
30342
|
}
|
|
30300
30343
|
}
|
|
30301
30344
|
result.push(detailsRow);
|
|
@@ -30436,7 +30479,7 @@ class TableDataSetFactory {
|
|
|
30436
30479
|
* @param scenario
|
|
30437
30480
|
* @param value
|
|
30438
30481
|
*/
|
|
30439
|
-
translateScenarioCSS(scenario, value) {
|
|
30482
|
+
translateScenarioCSS(scenario, value, operation) {
|
|
30440
30483
|
if (this.attributesByAlias.has(scenario)) {
|
|
30441
30484
|
return "attribute";
|
|
30442
30485
|
}
|
|
@@ -30446,10 +30489,15 @@ class TableDataSetFactory {
|
|
|
30446
30489
|
prefix = "neg";
|
|
30447
30490
|
}
|
|
30448
30491
|
if (scenarios.isValid) {
|
|
30449
|
-
|
|
30492
|
+
const direction = this.resolveDirection(scenarios, operation);
|
|
30493
|
+
return prefix + "_" + direction + (scenarios.type === "dr" ? " relative_variance" : "");
|
|
30450
30494
|
}
|
|
30451
30495
|
return scenario;
|
|
30452
30496
|
}
|
|
30497
|
+
/** Sentiment of a variance on a row with the given operation: `op`/`opinv` become pos or neg. */
|
|
30498
|
+
resolveDirection(scenarios, operation) {
|
|
30499
|
+
return resolveSentiment(scenarios.direction, operation, !this.unsignedEntries);
|
|
30500
|
+
}
|
|
30453
30501
|
setCellType(scenario, scenariosUnitType) {
|
|
30454
30502
|
if (scenario === "category") {
|
|
30455
30503
|
return "";
|
|
@@ -31147,7 +31195,7 @@ const BnTableRenderer = class {
|
|
|
31147
31195
|
: {})), cell.prefix != null ? (index.h("span", { class: cell.cssStyle + " " + cell.prefixStyle }, cell.drawPrefix())) : (""), cell.isBarChart &&
|
|
31148
31196
|
cell.columnStats &&
|
|
31149
31197
|
cell.value !== withStyled.NOT_AVAILABLE &&
|
|
31150
|
-
(cell.waterfall !== undefined || row.type !== TableRowType.SUM) ? (cell.waterfall !== undefined ? (index.h(WaterfallBar, { value: cell.value, scenario: cell.key, columnStats: cell.columnStats, height: 18 * this.scaleFactor, isRelative: false, isPositiveGood: cell.
|
|
31198
|
+
(cell.waterfall !== undefined || row.type !== TableRowType.SUM) ? (cell.waterfall !== undefined ? (index.h(WaterfallBar, { value: cell.value, scenario: cell.key, columnStats: cell.columnStats, height: 18 * this.scaleFactor, isRelative: false, isPositiveGood: cell.direction === "pos", measureScale: cell.measureScale, locale: locale, columnWidthEm: this.barColumnMaxWidth, styles: this.barChartStyles, waterfall: cell.waterfall })) : (index.h(CellBarChart, { value: cell.value, scenario: cell.key, columnStats: cell.columnStats, height: 18 * this.scaleFactor, isRelative: cell.key.startsWith("dr"), isPositiveGood: cell.direction === "pos",
|
|
31151
31199
|
// percentage points: the fraction times 100, no measure scale
|
|
31152
31200
|
measureScale: cell.type === "percentpoint" ? 0.01 : cell.measureScale, locale: locale, percentDigits: this.componentDataFormatDigits.percent, columnWidthEm: this.barColumnMaxWidth, styles: this.barChartStyles }))) : (cell.draw(this.componentDataFormatDigits, locale)))))))))));
|
|
31153
31201
|
};
|
|
@@ -31662,7 +31710,7 @@ const Title$1 = class Title {
|
|
|
31662
31710
|
}
|
|
31663
31711
|
render() {
|
|
31664
31712
|
const fontStyles = this.getFontStyles();
|
|
31665
|
-
return (index.h(index.Host, { key: '
|
|
31713
|
+
return (index.h(index.Host, { key: '3fab16c08a9023801ce8d6cf2bea9a87945fd1d0', style: fontStyles }, index.h("bn-title-renderer", { key: '056569256646abf17f0aaf4151f5add7065439a4', businessUnit: this.prepareBusinessUnit(), scenarios: this.prepareScenarios(), measures: this.prepareMeasures(), timeperiod: this.prepareTitleTimePeriod(), order: this.prepareTitleOrder(), i18n: this.prepareI18n(), "i18n-mode": this.prepareI18nMode(), locale: this.prepareLocale(), ruleSetConfig: this.ruleSetConfig() })));
|
|
31666
31714
|
}
|
|
31667
31715
|
get element() { return index.getElement(this); }
|
|
31668
31716
|
static get watchers() { return {
|
|
@@ -4,7 +4,7 @@ var index = require('./index-DGis1BzT.js');
|
|
|
4
4
|
var index$1 = require('./index.cjs.js');
|
|
5
5
|
var localFrame = require('./localFrame-P5SDUOto.js');
|
|
6
6
|
var withHasError = require('./withHasError-3kR2tdhJ.js');
|
|
7
|
-
var withStyled = require('./withStyled-
|
|
7
|
+
var withStyled = require('./withStyled-eHD8Yt2K.js');
|
|
8
8
|
|
|
9
9
|
/**
|
|
10
10
|
* Header configuration types and parsing utilities for bn-grid component.
|
|
@@ -245,6 +245,17 @@ const CONFIG_ELEMENTS = new Set([
|
|
|
245
245
|
"bn-ruleset",
|
|
246
246
|
"bn-scaling-group",
|
|
247
247
|
]);
|
|
248
|
+
/**
|
|
249
|
+
* Frames around a component: a cell aligns on what is inside them, and moves
|
|
250
|
+
* the content inside the frame, so the title of the frame stays in place.
|
|
251
|
+
*/
|
|
252
|
+
const FRAME_ELEMENTS = new Set(["bn-layout-card"]);
|
|
253
|
+
/** The CSS properties a frame reads to move its content, by offset side. */
|
|
254
|
+
const FRAME_OFFSET_PROPERTIES = {
|
|
255
|
+
top: "--bn-baseline-offset-top",
|
|
256
|
+
left: "--bn-baseline-offset-left",
|
|
257
|
+
right: "--bn-baseline-offset-right",
|
|
258
|
+
};
|
|
248
259
|
/** A pass that keeps changing the offsets stops after this many: a component whose baseline follows its width could chase it. */
|
|
249
260
|
const MAX_ADJUSTMENTS = 5;
|
|
250
261
|
const Grid = class {
|
|
@@ -316,6 +327,8 @@ const Grid = class {
|
|
|
316
327
|
this.captions = {};
|
|
317
328
|
/** Per slot: how far the baseline pass moved the content. */
|
|
318
329
|
this.offsets = {};
|
|
330
|
+
/** Per slot: the frame around its component, from the last baseline pass. */
|
|
331
|
+
this.frames = new Map();
|
|
319
332
|
this.observed = new WeakSet();
|
|
320
333
|
this.scheduled = false;
|
|
321
334
|
this.run = 0;
|
|
@@ -397,6 +410,7 @@ const Grid = class {
|
|
|
397
410
|
this.run++;
|
|
398
411
|
if (Object.keys(this.offsets).length > 0)
|
|
399
412
|
this.offsets = {};
|
|
413
|
+
this.applyFrameOffsets();
|
|
400
414
|
return;
|
|
401
415
|
}
|
|
402
416
|
if (this.scheduled)
|
|
@@ -461,16 +475,30 @@ const Grid = class {
|
|
|
461
475
|
isBaselineMode() {
|
|
462
476
|
return this.resolvedVertical === "baseline" || this.resolvedHorizontal === "baseline";
|
|
463
477
|
}
|
|
464
|
-
/** The first visual component in a slot, or the slotted element itself. */
|
|
465
|
-
|
|
466
|
-
var _a;
|
|
478
|
+
/** The first visual component in a slot, or the slotted element itself, and the frame around it. */
|
|
479
|
+
contentIn(slot) {
|
|
467
480
|
const slotted = Array.from(this.element.children).find((child) => child.getAttribute("slot") === slot);
|
|
468
481
|
if (!slotted)
|
|
469
|
-
return
|
|
470
|
-
const
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
482
|
+
return {};
|
|
483
|
+
const all = [slotted, ...Array.from(slotted.querySelectorAll("*"))];
|
|
484
|
+
const visual = all.find((el) => el.localName.startsWith("bn-") && !CONFIG_ELEMENTS.has(el.localName) && !FRAME_ELEMENTS.has(el.localName));
|
|
485
|
+
const frame = visual
|
|
486
|
+
? all.find((el) => FRAME_ELEMENTS.has(el.localName) && el.contains(visual))
|
|
487
|
+
: undefined;
|
|
488
|
+
return { visual, frame };
|
|
489
|
+
}
|
|
490
|
+
/** Writes the offsets of framed slots onto their frames, and removes them when a slot has none. */
|
|
491
|
+
applyFrameOffsets() {
|
|
492
|
+
this.frames.forEach((frame, slot) => {
|
|
493
|
+
const offset = this.offsets[slot];
|
|
494
|
+
Object.keys(FRAME_OFFSET_PROPERTIES).forEach((side) => {
|
|
495
|
+
const value = offset === null || offset === void 0 ? void 0 : offset[side];
|
|
496
|
+
if (value)
|
|
497
|
+
frame.style.setProperty(FRAME_OFFSET_PROPERTIES[side], `${value}px`);
|
|
498
|
+
else
|
|
499
|
+
frame.style.removeProperty(FRAME_OFFSET_PROPERTIES[side]);
|
|
500
|
+
});
|
|
501
|
+
});
|
|
474
502
|
}
|
|
475
503
|
async align() {
|
|
476
504
|
var _a;
|
|
@@ -479,7 +507,8 @@ const Grid = class {
|
|
|
479
507
|
return;
|
|
480
508
|
const { rows, columns } = this.gridConfig;
|
|
481
509
|
const slots = rows.flatMap((row, rowIndex) => columns.map((column, columnIndex) => ({ slot: getSlotName(row, column), row: rowIndex, column: columnIndex })));
|
|
482
|
-
const
|
|
510
|
+
const contents = slots.map(({ slot }) => this.contentIn(slot));
|
|
511
|
+
const visuals = contents.map((content) => content.visual);
|
|
483
512
|
await Promise.all(visuals.map((visual) => { var _a; return (_a = visual === null || visual === void 0 ? void 0 : visual.componentOnReady) === null || _a === void 0 ? void 0 : _a.call(visual); }));
|
|
484
513
|
if (run !== this.run)
|
|
485
514
|
return;
|
|
@@ -494,13 +523,18 @@ const Grid = class {
|
|
|
494
523
|
var _a;
|
|
495
524
|
wrappers.set((_a = el.getAttribute("data-slot")) !== null && _a !== void 0 ? _a : "", el);
|
|
496
525
|
});
|
|
526
|
+
this.frames = new Map();
|
|
527
|
+
contents.forEach(({ frame }, index) => frame && this.frames.set(slots[index].slot, frame));
|
|
497
528
|
const cells = slots.map(({ slot, row, column }, index) => {
|
|
498
529
|
const visual = visuals[index];
|
|
499
530
|
const baseline = baselines[index];
|
|
500
531
|
// what is drawn now, not what is in the state: a render can still be pending
|
|
501
|
-
const
|
|
502
|
-
const
|
|
503
|
-
const
|
|
532
|
+
const cardFrame = contents[index].frame;
|
|
533
|
+
const holder = cardFrame !== null && cardFrame !== void 0 ? cardFrame : wrappers.get(slot);
|
|
534
|
+
const applied = (property) => parseFloat((holder === null || holder === void 0 ? void 0 : holder.style.getPropertyValue(property)) || "0") || 0;
|
|
535
|
+
const cell = cardFrame
|
|
536
|
+
? { slot, row, column, top: applied(FRAME_OFFSET_PROPERTIES.top), left: applied(FRAME_OFFSET_PROPERTIES.left) }
|
|
537
|
+
: { slot, row, column, top: applied("padding-top"), left: applied("margin-left") };
|
|
504
538
|
if (visual) {
|
|
505
539
|
const box = frame.toLocal(visual.getBoundingClientRect());
|
|
506
540
|
if (baseline.y !== undefined)
|
|
@@ -523,6 +557,7 @@ const Grid = class {
|
|
|
523
557
|
}
|
|
524
558
|
this.adjustments++;
|
|
525
559
|
this.offsets = next;
|
|
560
|
+
this.applyFrameOffsets();
|
|
526
561
|
// check once more after the new offsets are drawn; the status stays held until then
|
|
527
562
|
this.schedule();
|
|
528
563
|
}
|
|
@@ -767,6 +802,7 @@ const Grid = class {
|
|
|
767
802
|
* moves it onto the baseline. Without alignment the wrapper is a plain block.
|
|
768
803
|
*/
|
|
769
804
|
renderCellContent(slotName, style) {
|
|
805
|
+
var _a;
|
|
770
806
|
const text = this.captions[slotName];
|
|
771
807
|
const caption = text !== undefined ? (index.h("div", { class: "grid-caption", style: {
|
|
772
808
|
"font-size": `${style.captionFontSize}px`,
|
|
@@ -793,7 +829,8 @@ const Grid = class {
|
|
|
793
829
|
else if (this.resolvedVertical === "bottom") {
|
|
794
830
|
wrapper["margin-top"] = "auto";
|
|
795
831
|
}
|
|
796
|
-
|
|
832
|
+
// a frame moves its own content; the wrapper only moves a component without a frame
|
|
833
|
+
const offset = this.frames.has(slotName) ? { bottom: (_a = this.offsets[slotName]) === null || _a === void 0 ? void 0 : _a.bottom } : this.offsets[slotName];
|
|
797
834
|
if (offset === null || offset === void 0 ? void 0 : offset.bottom)
|
|
798
835
|
wrapper["margin-top"] = "auto";
|
|
799
836
|
if (offset === null || offset === void 0 ? void 0 : offset.top)
|
|
@@ -824,7 +861,7 @@ const Grid = class {
|
|
|
824
861
|
// would only be as wide as their content, and charts measure that width.
|
|
825
862
|
const fill = this.resolvedWidth === "equal";
|
|
826
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 });
|
|
827
|
-
return (index.h(index.Host, { key: '
|
|
864
|
+
return (index.h(index.Host, { key: '643b4d675bac89c542618e7d6ec5f2c0ef8d6d6c', style: fill ? Object.assign(Object.assign({}, this.getFontStyles()), { display: "block" }) : this.getFontStyles() }, index.h("div", { key: '4bc671a6868b313c809f37aeb2f32ca30c7e9142', class: "grid-container", style: gridContainerStyle }, this.renderTitle(), this.renderColumnHeaders(), this.renderDataCells()), index.h("slot", { key: '5e66d95c65a0bad59d3816cf0009bb88fbe53f9c' })));
|
|
828
865
|
}
|
|
829
866
|
get element() { return index.getElement(this); }
|
|
830
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 withStyled = require('./withStyled-
|
|
4
|
+
var withStyled = require('./withStyled-eHD8Yt2K.js');
|
|
5
5
|
var withHasError = require('./withHasError-3kR2tdhJ.js');
|
|
6
6
|
|
|
7
7
|
const bnImageCss = () => `:host{display:inline-block;position:relative;overflow:hidden}img{max-width:100%;height:auto}`;
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
3
|
var index = require('./index-DGis1BzT.js');
|
|
4
|
-
var withTranslation = require('./withTranslation-
|
|
4
|
+
var withTranslation = require('./withTranslation-yJ-j0lsu.js');
|
|
5
5
|
var withHasError = require('./withHasError-3kR2tdhJ.js');
|
|
6
|
-
var withStyled = require('./withStyled-
|
|
6
|
+
var withStyled = require('./withStyled-eHD8Yt2K.js');
|
|
7
7
|
|
|
8
8
|
const NAME = "[A-Za-z_$\\u00C0-\\uFFFF][\\w$\\u00C0-\\uFFFF]*";
|
|
9
9
|
const STRING = `'[^'\\\\]*'|"[^"\\\\]*"`;
|
|
@@ -161,12 +161,17 @@ exports.Scenarios = void 0;
|
|
|
161
161
|
* - POS: favorable variance (green in IBCS)
|
|
162
162
|
* - NEG: unfavorable variance (red in IBCS)
|
|
163
163
|
* - NEU: neutral / no directional meaning
|
|
164
|
+
* - OP: follows the row operation, like POS on "+" and "=" rows, like NEG on "-" rows
|
|
165
|
+
* (only in opt/optnototal tables, elsewhere the values are signed and OP equals POS)
|
|
166
|
+
* - OPINV: the inverse of OP
|
|
164
167
|
*/
|
|
165
168
|
var Sentiments;
|
|
166
169
|
(function (Sentiments) {
|
|
167
170
|
Sentiments["POS"] = "pos";
|
|
168
171
|
Sentiments["NEG"] = "neg";
|
|
169
172
|
Sentiments["NEU"] = "neu";
|
|
173
|
+
Sentiments["OP"] = "op";
|
|
174
|
+
Sentiments["OPINV"] = "opinv";
|
|
170
175
|
})(Sentiments || (Sentiments = {}));
|
|
171
176
|
/** Number display format: DECIMAL for absolute values, PERCENT for ratio columns. */
|
|
172
177
|
exports.DataFormat = void 0;
|
|
@@ -984,7 +989,7 @@ function relativeVariance(difference, reference) {
|
|
|
984
989
|
* pos/neg coloring. The regex is anchored, so partial matches inside a
|
|
985
990
|
* longer token are rejected.
|
|
986
991
|
*/
|
|
987
|
-
const VARIANCE_MEASURE_REGEX = /^(dr|d)((?:ac|pp|fc|pl)[1-4])_((?:ac|pp|fc|pl)[1-4])(?:_(pos|neg|neu))?$/;
|
|
992
|
+
const VARIANCE_MEASURE_REGEX = /^(dr|d)((?:ac|pp|fc|pl)[1-4])_((?:ac|pp|fc|pl)[1-4])(?:_(pos|neg|neu|op|opinv))?$/;
|
|
988
993
|
class VarianceMeasure {
|
|
989
994
|
constructor(
|
|
990
995
|
/** `"d"` = absolute, `"dr"` = relative (fraction of delta). */
|
|
@@ -1011,7 +1011,7 @@ export class Chart {
|
|
|
1011
1011
|
scenariosArray = [...scenariosArray, ...variancesArray];
|
|
1012
1012
|
}
|
|
1013
1013
|
const fontStyles = this.getFontStyles();
|
|
1014
|
-
return (h(Host, { key: '
|
|
1014
|
+
return (h(Host, { key: '467a851c6547b300c71a38e812bfea4718f27775', style: fontStyles }, h("div", { key: '4b5078608132e047a9404987c65c46f43037c043', class: "container" }, scenariosArray.map(this.chartTemplate))));
|
|
1015
1015
|
}
|
|
1016
1016
|
static get is() { return "bn-chart-structure"; }
|
|
1017
1017
|
static get encapsulation() { return "shadow"; }
|
|
@@ -1189,7 +1189,7 @@ export class Chart {
|
|
|
1189
1189
|
"name": "example",
|
|
1190
1190
|
"text": "variances=\"drac1_pl1_pos\""
|
|
1191
1191
|
}],
|
|
1192
|
-
"text": "Comma-separated list of variance definitions. Each variance adds\na separate sub-chart next to the main bar chart.\n\n**Pattern:** `d<base>_<comparison>_<sentiment>` (absolute)\nor `dr<base>_<comparison>_<sentiment>` (relative / percentage).\n\n- `base` / `comparison`: scenario names that must also appear in `scenarios`.\n- `sentiment`: `pos` (positive is good), `neg` (negative is good), `neu` (neutral).\n\nWhen empty, no variance charts are shown."
|
|
1192
|
+
"text": "Comma-separated list of variance definitions. Each variance adds\na separate sub-chart next to the main bar chart.\n\n**Pattern:** `d<base>_<comparison>_<sentiment>` (absolute)\nor `dr<base>_<comparison>_<sentiment>` (relative / percentage).\n\n- `base` / `comparison`: scenario names that must also appear in `scenarios`.\n- `sentiment`: `pos` (positive is good), `neg` (negative is good), `neu` (neutral).\n `op` acts like `pos` and `opinv` like `neg`, because chart values carry their operation sign.\n\nWhen empty, no variance charts are shown."
|
|
1193
1193
|
},
|
|
1194
1194
|
"getter": false,
|
|
1195
1195
|
"setter": false,
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { Scenario } from "./index";
|
|
2
|
+
import { resolveSentiment } from "../../../../utils/model/VarianceScenario";
|
|
2
3
|
/**
|
|
3
4
|
* A single renderable data point in a structural (categorical) bar chart.
|
|
4
5
|
*
|
|
@@ -14,10 +15,12 @@ export class DataPoint {
|
|
|
14
15
|
this.value = value;
|
|
15
16
|
this.scenario = scenario;
|
|
16
17
|
this.pixelPerUnit = pixelPerUnit || 1;
|
|
17
|
-
|
|
18
|
+
// chart values are signed by their operation, so op acts like pos and opinv like neg
|
|
19
|
+
const direction = typeof variance === "string" ? resolveSentiment(variance, null, true) : variance;
|
|
20
|
+
if (direction === "neg" || direction === Scenario.NEG) {
|
|
18
21
|
this.variance = Scenario.NEG;
|
|
19
22
|
}
|
|
20
|
-
else if (
|
|
23
|
+
else if (direction === "pos" || direction === Scenario.POS) {
|
|
21
24
|
this.variance = Scenario.POS;
|
|
22
25
|
}
|
|
23
26
|
else {
|