element-plus
Version:
A Component Library for Vue 3
1 lines • 1.59 kB
Source Map (JSON)
{"version":3,"file":"usePanel.mjs","sources":["../../../../../../../packages/components/splitter/src/hooks/usePanel.ts"],"sourcesContent":["import { isObject } from '@element-plus/utils'\n\nimport type { PanelItemState } from '../type'\n\nexport function getCollapsible(\n collapsible: boolean | { start?: boolean; end?: boolean }\n) {\n if (collapsible && isObject(collapsible)) {\n return collapsible\n }\n return {\n start: !!collapsible,\n end: !!collapsible,\n }\n}\n\nexport function isCollapsible(\n panel: PanelItemState | null | undefined,\n size: number,\n nextPanel: PanelItemState | null | undefined,\n nextSize: number\n) {\n // If the current panel is collapsible and has size, then it can be collapsed\n if (panel?.collapsible.end && size > 0) {\n return true\n }\n\n // If the next panel is collapsible and has no size, but the current panel has size, then it can be collapsed\n if (nextPanel?.collapsible.start && nextSize === 0 && size > 0) {\n return true\n }\n\n return false\n}\n"],"names":[],"mappings":";;AAIO,SAAS,eACd,WAAA,EACA;AACA,EAAA,IAAI,WAAA,IAAe,QAAA,CAAS,WAAW,CAAA,EAAG;AACxC,IAAA,OAAO,WAAA;AAAA,EACT;AACA,EAAA,OAAO;AAAA,IACL,KAAA,EAAO,CAAC,CAAC,WAAA;AAAA,IACT,GAAA,EAAK,CAAC,CAAC;AAAA,GACT;AACF;AAEO,SAAS,aAAA,CACd,KAAA,EACA,IAAA,EACA,SAAA,EACA,QAAA,EACA;AAEA,EAAA,IAAA,CAAI,KAAA,IAAA,IAAA,GAAA,MAAA,GAAA,KAAA,CAAO,WAAA,CAAY,GAAA,KAAO,IAAA,GAAO,CAAA,EAAG;AACtC,IAAA,OAAO,IAAA;AAAA,EACT;AAGA,EAAA,IAAA,CAAI,uCAAW,WAAA,CAAY,KAAA,KAAS,QAAA,KAAa,CAAA,IAAK,OAAO,CAAA,EAAG;AAC9D,IAAA,OAAO,IAAA;AAAA,EACT;AAEA,EAAA,OAAO,KAAA;AACT;;;;"}