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 2.48 kB
import SplitUtils from"../utils/SplitUtils";import LayoutHelper from"./LayoutHelper";class ManageHandleBar{static showHandleIconOnOpen(l,i,n,e,t){var o,n=(null==l?void 0:l.children)||(null==(l=n[t])?void 0:l.children);n&&0<n.length&&(l=LayoutHelper.getSection(e,t,i),o=LayoutHelper.getSection(e,t,i-1),e=LayoutHelper.getSection(e,t,i+1),i=n[null==l?-1:l],l=n[null==o?-1:o],o=n[null==e?-1:e],i&&!l?(null!=(e=null==(n=i.nextElementSibling)?void 0:n.firstChild)&&e.classList.remove("disable"),null!=(l=null==n?void 0:n.children[1])&&l.classList.remove("horizontal"===t?"left-margin-fix":"top-margin-fix")):i&&!o?(null!=(n=null==(e=i.previousElementSibling)?void 0:e.lastChild)&&n.classList.remove("disable"),null!=(l=null==e?void 0:e.children[1])&&l.classList.remove("horizontal"===t?"right-margin-fix":"bottom-margin-fix")):(null!=(n=null==(o=null==i?void 0:i.nextElementSibling)?void 0:o.firstChild)&&n.classList.remove("disable"),null!=(e=null==o?void 0:o.children[1])&&e.classList.remove("horizontal"===t?"left-margin-fix":"top-margin-fix"),null!=(n=null==(l=null==i?void 0:i.previousElementSibling)?void 0:l.lastChild)&&n.classList.remove("disable"),null!=(o=null==l?void 0:l.children[1])&&o.classList.remove("horizontal"===t?"right-margin-fix":"bottom-margin-fix")))}static removeHandleIconOnClose(l,i,n,e,t){var o,a,n=(null==l?void 0:l.children)||(null==(n=n[t])?void 0:n.children);n&&0<n.length&&(o=LayoutHelper.getSection(e,t,i),a=LayoutHelper.getSection(e,t,i-1),e=LayoutHelper.getSection(e,t,i+1),o=n[null==o?-1:o],a=n[null==a?-1:a],n=n[null==e?-1:e],SplitUtils.isSectionOpen(l,i,t)||(o&&!a?(null!=(l=null==(e=o.nextElementSibling)?void 0:e.firstChild)&&l.classList.add("disable"),null!=(i=null==e?void 0:e.children[1])&&i.classList.add("horizontal"===t?"left-margin-fix":"top-margin-fix")):o&&!n?(null!=(l=null==(a=o.previousElementSibling)?void 0:a.lastChild)&&l.classList.add("disable"),null!=(e=null==a?void 0:a.children[1])&&e.classList.add("horizontal"===t?"right-margin-fix":"bottom-margin-fix")):(null!=(n=null==(i=null==o?void 0:o.nextElementSibling)?void 0:i.firstChild)&&n.classList.add("disable"),null!=(l=null==i?void 0:i.children[1])&&l.classList.add("horizontal"===t?"left-margin-fix":"top-margin-fix"),null!=(e=null==(a=null==o?void 0:o.previousElementSibling)?void 0:a.lastChild)&&e.classList.add("disable"),null!=(n=null==a?void 0:a.children[1])&&n.classList.add("horizontal"===t?"right-margin-fix":"bottom-margin-fix"))))}}export default ManageHandleBar;