element-plus
Version:
A Component Library for Vue 3
1 lines • 1.31 kB
Source Map (JSON)
{"version":3,"file":"usePanel.mjs","names":[],"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"],"mappings":";;;AAIA,SAAgB,eACd,aACA;AACA,KAAI,eAAe,SAAS,YAAY,CACtC,QAAO;AAET,QAAO;EACL,OAAO,CAAC,CAAC;EACT,KAAK,CAAC,CAAC;EACR;;AAGH,SAAgB,cACd,OACA,MACA,WACA,UACA;AAEA,KAAI,OAAO,YAAY,OAAO,OAAO,EACnC,QAAO;AAIT,KAAI,WAAW,YAAY,SAAS,aAAa,KAAK,OAAO,EAC3D,QAAO;AAGT,QAAO"}