@bino-bi/bn-template-engine 1.0.0-next.30 → 1.0.0-next.32

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.
Files changed (145) hide show
  1. package/dist/bn-template-engine/bn-template-engine.esm.js +1 -1
  2. package/dist/bn-template-engine/{p-64803a42.entry.js → p-14d021be.entry.js} +1 -1
  3. package/dist/bn-template-engine/p-225cd474.entry.js +1 -0
  4. package/dist/bn-template-engine/p-58b10778.entry.js +1 -0
  5. package/dist/bn-template-engine/{p-40ba7f43.entry.js → p-7d475277.entry.js} +1 -1
  6. package/dist/bn-template-engine/p-9f3cbc5f.entry.js +1 -0
  7. package/dist/bn-template-engine/p-BNCLKXjM.js +1 -0
  8. package/dist/bn-template-engine/{p-B8AjeKja.js → p-BTbeDWM9.js} +1 -1
  9. package/dist/bn-template-engine/{p-Z2rUaSh_.js → p-BjR3nkhl.js} +1 -1
  10. package/dist/bn-template-engine/p-CHZ50kEY.js +1 -0
  11. package/dist/bn-template-engine/p-CJfJQT0m.js +1 -0
  12. package/dist/bn-template-engine/p-ce39e111.entry.js +1 -0
  13. package/dist/cjs/bn-annotation-layer_30.cjs.entry.js +191 -68
  14. package/dist/cjs/bn-grid.cjs.entry.js +465 -34
  15. package/dist/cjs/bn-image.cjs.entry.js +2 -2
  16. package/dist/cjs/bn-internationalization.cjs.entry.js +2 -2
  17. package/dist/cjs/bn-ruleset.cjs.entry.js +2 -2
  18. package/dist/cjs/bn-template-engine.cjs.js +1 -1
  19. package/dist/cjs/bn-text.cjs.entry.js +3 -3
  20. package/dist/cjs/loader.cjs.js +1 -1
  21. package/dist/cjs/{diagnostics-C4Ggts3w.js → localFrame-P5SDUOto.js} +90 -1
  22. package/dist/cjs/{withBodyObserver-BK4idxqG.js → withBodyObserver-B1_hmuUz.js} +1 -1
  23. package/dist/cjs/{withHasError-CqvcS23z.js → withHasError-3kR2tdhJ.js} +4 -0
  24. package/dist/cjs/{withStyled-70D4Isgt.js → withStyled-Ds3e64Nz.js} +1 -1
  25. package/dist/cjs/{withTranslation-C6Pye2CM.js → withTranslation-Cjvvs3gL.js} +2 -2
  26. package/dist/collection/components/bn-chart-bubble/bn-chart-bubble.js +32 -2
  27. package/dist/collection/components/bn-chart-bullet/bn-chart-bullet.js +32 -2
  28. package/dist/collection/components/bn-chart-bullet/utils/BulletChart.js +3 -1
  29. package/dist/collection/components/bn-chart-scatter/bn-chart-scatter.js +32 -2
  30. package/dist/collection/components/bn-chart-structure/bn-chart-structure-renderer/bn-chart-structure-renderer.js +1 -1
  31. package/dist/collection/components/bn-chart-structure/bn-chart-structure.js +33 -2
  32. package/dist/collection/components/bn-chart-time/bn-chart-time-renderer/bn-chart-time-renderer.js +1 -1
  33. package/dist/collection/components/bn-chart-time/bn-chart-time.js +33 -2
  34. package/dist/collection/components/bn-grid/bn-grid.js +454 -26
  35. package/dist/collection/components/bn-grid/utils/cellLayout.js +111 -0
  36. package/dist/collection/components/bn-table/bn-table.js +39 -2
  37. package/dist/collection/stores/componentStyles.js +4 -0
  38. package/dist/collection/utils/layoutState/baseline.js +67 -0
  39. package/dist/collection/utils/layoutState/index.js +2 -0
  40. package/dist/collection/utils/layoutState/localFrame.js +87 -0
  41. package/dist/collection/utils/layoutState/svgChartElements.js +6 -2
  42. package/dist/collection/utils/xy/XYFrame.js +3 -1
  43. package/dist/components/bn-annotation-layer.js +1 -1
  44. package/dist/components/bn-annotation-list.js +1 -1
  45. package/dist/components/bn-asset.js +1 -1
  46. package/dist/components/bn-body.js +1 -1
  47. package/dist/components/bn-card.js +1 -1
  48. package/dist/components/bn-chart-bubble-renderer.js +1 -1
  49. package/dist/components/bn-chart-bubble.js +1 -1
  50. package/dist/components/bn-chart-bullet-renderer.js +1 -1
  51. package/dist/components/bn-chart-bullet.js +1 -1
  52. package/dist/components/bn-chart-scatter-renderer.js +1 -1
  53. package/dist/components/bn-chart-scatter.js +1 -1
  54. package/dist/components/bn-chart-structure-renderer.js +1 -1
  55. package/dist/components/bn-chart-structure.js +1 -1
  56. package/dist/components/bn-chart-time-renderer.js +1 -1
  57. package/dist/components/bn-chart-time.js +1 -1
  58. package/dist/components/bn-component-style.js +1 -1
  59. package/dist/components/bn-context.js +1 -1
  60. package/dist/components/bn-dataset.js +1 -1
  61. package/dist/components/bn-datasource.js +1 -1
  62. package/dist/components/bn-footer.js +1 -1
  63. package/dist/components/bn-grid.js +1 -1
  64. package/dist/components/bn-image.js +1 -1
  65. package/dist/components/bn-internationalization.js +1 -1
  66. package/dist/components/bn-layout-card.js +1 -1
  67. package/dist/components/bn-layout-page.js +1 -1
  68. package/dist/components/bn-message.js +1 -1
  69. package/dist/components/bn-page.js +1 -1
  70. package/dist/components/bn-ruleset.js +1 -1
  71. package/dist/components/bn-scaling-group.js +1 -1
  72. package/dist/components/bn-table-renderer.js +1 -1
  73. package/dist/components/bn-table.js +1 -1
  74. package/dist/components/bn-text.js +1 -1
  75. package/dist/components/bn-title.js +1 -1
  76. package/dist/components/bn-tree.js +1 -1
  77. package/dist/components/p-0gehv1XG.js +1 -0
  78. package/dist/components/{p-Bs-YxJEt.js → p-8a2-IS-y.js} +1 -1
  79. package/dist/components/p-B2jqpOF9.js +1 -0
  80. package/dist/components/{p-BWBHlztH.js → p-BPJsmv3o.js} +1 -1
  81. package/dist/components/{p-BXrPfAvP.js → p-BVtD8O36.js} +1 -1
  82. package/dist/components/p-BcOud3dQ.js +1 -0
  83. package/dist/components/{p-DsOaqeTN.js → p-BoUkFdpu.js} +1 -1
  84. package/dist/components/p-BohXdw3-.js +1 -0
  85. package/dist/components/p-C6XrNN2m.js +1 -0
  86. package/dist/components/{p-Dm55bMs2.js → p-CDoSPw-I.js} +1 -1
  87. package/dist/components/p-CMCnX0iM.js +1 -0
  88. package/dist/components/{p-Ds_BSK8v.js → p-ClGOhg6P.js} +1 -1
  89. package/dist/components/p-CujsXn-l.js +1 -0
  90. package/dist/components/{p-Ba9PUiBp.js → p-D4FY_yoG.js} +1 -1
  91. package/dist/components/{p-DIyUaSBg.js → p-D6cWoDk1.js} +1 -1
  92. package/dist/components/p-D7X69xMg.js +1 -0
  93. package/dist/components/{p-B1nL0yOa.js → p-DSkyHSIL.js} +1 -1
  94. package/dist/components/{p-BSV_vyqs.js → p-De82WP7z.js} +1 -1
  95. package/dist/components/p-DyO09Jk6.js +1 -0
  96. package/dist/components/{p-WzaayhTX.js → p-Ku08TQL1.js} +1 -1
  97. package/dist/components/p-t4xPltK2.js +1 -0
  98. package/dist/components/{p-ey23VlID.js → p-yH-XxIy9.js} +1 -1
  99. package/dist/components/{p-X9hpquOX.js → p-z56_ZQ42.js} +1 -1
  100. package/dist/components/{p-B7uwck1J.js → p-zf8cTH63.js} +1 -1
  101. package/dist/esm/bn-annotation-layer_30.entry.js +140 -17
  102. package/dist/esm/bn-grid.entry.js +456 -25
  103. package/dist/esm/bn-image.entry.js +2 -2
  104. package/dist/esm/bn-internationalization.entry.js +2 -2
  105. package/dist/esm/bn-ruleset.entry.js +2 -2
  106. package/dist/esm/bn-template-engine.js +1 -1
  107. package/dist/esm/bn-text.entry.js +3 -3
  108. package/dist/esm/loader.js +1 -1
  109. package/dist/esm/{diagnostics-Cyqy1zDT.js → localFrame-IW84cmdb.js} +90 -2
  110. package/dist/esm/{withBodyObserver-JcRB9OPQ.js → withBodyObserver-CAnnvrE_.js} +1 -1
  111. package/dist/esm/{withHasError-l3cMN-oP.js → withHasError-Cj_MzZ8Q.js} +4 -0
  112. package/dist/esm/{withStyled-DGOiR00Q.js → withStyled-B-cbWCe2.js} +1 -1
  113. package/dist/esm/{withTranslation-BpO8BC5B.js → withTranslation-_8q-7Y9C.js} +2 -2
  114. package/dist/schemas/theme.schema.json +14 -0
  115. package/dist/types/components/bn-chart-bubble/bn-chart-bubble.d.ts +6 -1
  116. package/dist/types/components/bn-chart-bullet/bn-chart-bullet.d.ts +6 -1
  117. package/dist/types/components/bn-chart-scatter/bn-chart-scatter.d.ts +6 -1
  118. package/dist/types/components/bn-chart-structure/bn-chart-structure.d.ts +6 -1
  119. package/dist/types/components/bn-chart-time/bn-chart-time.d.ts +6 -1
  120. package/dist/types/components/bn-grid/bn-grid.d.ts +79 -3
  121. package/dist/types/components/bn-grid/utils/cellLayout.d.ts +47 -0
  122. package/dist/types/components/bn-table/bn-table.d.ts +8 -1
  123. package/dist/types/components.d.ts +94 -7
  124. package/dist/types/stores/componentStyles.d.ts +6 -0
  125. package/dist/types/utils/layoutState/baseline.d.ts +17 -0
  126. package/dist/types/utils/layoutState/index.d.ts +2 -0
  127. package/dist/types/utils/layoutState/localFrame.d.ts +17 -0
  128. package/dist/types/utils/layoutState/svgChartElements.d.ts +3 -1
  129. package/dist/types/utils/layoutState/types.d.ts +12 -2
  130. package/package.json +1 -1
  131. package/dist/bn-template-engine/p-132ad556.entry.js +0 -1
  132. package/dist/bn-template-engine/p-17d71782.entry.js +0 -1
  133. package/dist/bn-template-engine/p-467871f3.entry.js +0 -1
  134. package/dist/bn-template-engine/p-CrT83eO4.js +0 -1
  135. package/dist/bn-template-engine/p-D_DzKxRV.js +0 -1
  136. package/dist/bn-template-engine/p-c41c0a1b.entry.js +0 -1
  137. package/dist/bn-template-engine/p-yc69rwuH.js +0 -1
  138. package/dist/components/p-BDS_jiow.js +0 -1
  139. package/dist/components/p-BIIDTtcR.js +0 -1
  140. package/dist/components/p-BVKLCz2k.js +0 -1
  141. package/dist/components/p-CkW23yp2.js +0 -1
  142. package/dist/components/p-DUHp_9X-.js +0 -1
  143. package/dist/components/p-Dq1AzGKX.js +0 -1
  144. package/dist/components/p-U3zkcEJZ.js +0 -1
  145. package/dist/components/p-jbp6YiHf.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,o as n,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-BjR3nkhl.js";function g(t){if(!t||""===t.trim()||"[]"===t)return[];try{const i=JSON.parse(t);return Array.isArray(i)?i.map(((t,i)=>{var e,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 f(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"]),$=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.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++,void(Object.keys(this.offsets).length>0&&(this.offsets={}));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}visualIn(t){var i;const e=Array.from(this.element.children).find((i=>i.getAttribute("slot")===t));if(!e)return;const s=t=>t.localName.startsWith("bn-")&&!S.has(t.localName);return s(e)?e:null!==(i=Array.from(e.querySelectorAll("*")).find(s))&&void 0!==i?i:void 0}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:f(t,e),row:i,column:s}))))),n=o.map((({slot:t})=>this.visualIn(t)));if(await Promise.all(n.map((t=>{var i;return null===(i=null==t?void 0:t.componentOnReady)||void 0===i?void 0:i.call(t)}))),i!==this.run)return;n.forEach((t=>t&&this.observe(t)));const r=await Promise.all(n.map((t=>"function"==typeof(null==t?void 0:t.getBaseline)?t.getBaseline().catch((()=>({}))):Promise.resolve({}))));if(i!==this.run)return;const a=l(this.element),d=new Map;null===(t=this.element.shadowRoot)||void 0===t||t.querySelectorAll(".grid-slot").forEach((t=>{var i;d.set(null!==(i=t.getAttribute("data-slot"))&&void 0!==i?i:"",t)}));const h=function(t,i,e){const s={};for(const i of t)s[i.slot]={};const o=(i,e,o,l)=>{var n;const r=new Map;for(const e of t)r.set(e[i],[...null!==(n=r.get(e[i]))&&void 0!==n?n:[],e]);for(const t of r.values()){const i=t.map((t=>{const i=e(t);return void 0===i?void 0:i-o(t)})),n=i.filter((t=>void 0!==t)),r=n.length>0?Math.max(...n):0,a=i.map((t=>void 0===t?void 0:C(r-t))),d=Math.max(0,...a.filter((t=>void 0!==t)));t.forEach(((t,i)=>l(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=n[s],l=r[s],h=d.get(t),c=t=>parseFloat((null==h?void 0:h.style.getPropertyValue(t))||"0")||0,u={slot:t,row:i,column:e,top:c("padding-top"),left:c("margin-left")};if(o){const t=a.toLocal(o.getBoundingClientRect());void 0!==l.y&&(u.y=t.y+l.y),void 0!==l.x&&(u.x=t.x+l.x)}return u})),"baseline"===this.resolvedVertical,"baseline"===this.resolvedHorizontal);if(function(t,i){var e,s,o,l,n,r,a,d;const h=new Set([...Object.keys(t),...Object.keys(i)]);for(const c of h){const h=null!==(e=t[c])&&void 0!==e?e:{},u=null!==(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!==(l=u.top)&&void 0!==l?l:0))>=.5)return!1;if(Math.abs((null!==(n=h.left)&&void 0!==n?n:0)-(null!==(r=u.left)&&void 0!==r?r:0))>=.5)return!1;if(Math.abs((null!==(a=h.right)&&void 0!==a?a:0)-(null!==(d=u.right)&&void 0!==d?d:0))>=.5)return!1}return!0}(h,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=h,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,l;const h=null!==(i=null==t?void 0:t.detail)&&void 0!==i?i:"summary",c=n(this.element),u=this.componentStyle((t=>{var i;return(null===(i=t.global)||void 0===i?void 0:i.fontSizePx)||13.3333})),{rows:v,columns:g}=this.gridConfig,f={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:g.length,cellCount:v.length*g.length},diagnostics:r(this.element)},p=null===(s=this.element.shadowRoot)||void 0===s?void 0:s.querySelector(".grid-container");if(p&&f.regions.push({id:"grid",rect:a(p,c)}),"full"!==h||!p)return f;const b=[],m=t=>b.push(t),y=p.querySelector(".grid-title");return y&&m({kind:"gridTitle",label:(null===(l=y.textContent)||void 0===l?void 0:l.trim())||void 0,rect:a(y,c)}),p.querySelectorAll(".grid-header-col").forEach(((t,i)=>{var e,s;m({kind:"gridHeader",columnId:null===(e=g[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,l;m({kind:"gridCell",rowId:g.length>0?null===(e=v[Math.floor(i/g.length)])||void 0===e?void 0:e.id:void 0,columnId:g.length>0?null===(s=g[i%g.length])||void 0===s?void 0:s.id:void 0,slot:null!==(l=null===(o=t.querySelector("slot"))||void 0===o?void 0:o.getAttribute("name"))&&void 0!==l?l: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)})})),f.elements=b,f}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:g(this.rowHeaders),columns:g(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(((l,n)=>{const r=n>0;return i("div",{key:`col-header-${l.id}`,class:"grid-header grid-header-col",style:{"grid-column":String(s+n),"grid-row":String(o),"border-left":r?e:"none",padding:`${t.cellPadding}px`,"padding-left":r?`${t.cellPadding+4}px`:`${t.cellPadding}px`}},l.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,l=[];return this.gridConfig.rows.length>0&&this.gridConfig.columns.length>0&&this.gridConfig.rows.forEach(((n,r)=>{if(this.shouldShowRowHeaders()){const s=r>0;l.push(i("div",{key:`row-header-${n.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`}},n.label))}this.gridConfig.columns.forEach(((a,d)=>{const h=f(n,a),c=d>0,u=r>0;l.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)))}))})),l}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){const s=this.captions[t],o=void 0!==s?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"}},s):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 n=this.offsets[t];return(null==n?void 0:n.bottom)&&(l["margin-top"]="auto"),(null==n?void 0:n.top)&&(l["padding-top"]=`${n.top}px`),(null==n?void 0:n.left)&&(l["margin-left"]=`${n.left}px`),(null==n?void 0:n.right)&&(l["margin-right"]=`${n.right}px`),[o,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:"3fcfe5d215a02a65652c00e37a2873377b708043",style:t?Object.assign(Object.assign({},this.getFontStyles()),{display:"block"}):this.getFontStyles()},i("div",{key:"55a2ae64a80a2f660601eaddbb5bd6e90e224796",class:"grid-container",style:s},this.renderTitle(),this.renderColumnHeaders(),this.renderDataCells()),i("slot",{key:"1c47b472d38b8e12a42e7f1609466681cdde98f3"}))}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}]}}};$.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{$ as bn_grid}