UNPKG

a-multilayout-splitter

Version:

A React package designed to facilitate the division of your views into distinct sections, offering effortless resizing and support for intricate layouts.

1 lines 969 B
class LayoutHelper{static mapElementPosition(e,t,n,r,i=!1){if(t[n]||e){let l=1;var a=(null==e?void 0:e.children)||(null==(e=t[n])?void 0:e.children);if(a&&(!r[n]||i))for(let e=0;e<a.length;e++){var o=a[e];"horizontal"!==n&&"vertical"!==n||o.classList.contains(this.PANE_CLASS)&&(r[n]=Object.assign(Object.assign({},r[n]),{[""+l]:""+e}),++l)}}else console.error("Wrapper not set. Call setWrapper before using mapElementPosition.")}static calculateRemainingSectionSize(e,t,l){if(!e[l])return console.error("Wrapper not set. Call setWrapper before using calculateRemainingSectionSize."),-1;var n,r=null==(e=e[l])?void 0:e.children;if(r&&0<r.length){let l=0;for(let e=0;e<r.length;e+=2)t.includes(e)||(n=r[e],l+=parseFloat(n.style.flexBasis.replace("%","")));return l}console.error("No elements found.")}static getSection(e,l,t){l=null==(e=null==e?void 0:e[l])?void 0:e[t];return null==l?null:parseInt(l)}}LayoutHelper.PANE_CLASS="a-split-pane";export default LayoutHelper;