element-plus
Version:
A Component Library for Vue 3
1 lines • 1.63 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,WACA,EAAA;AACA,EAAI,IAAA,WAAA,IAAe,QAAS,CAAA,WAAW,CAAG,EAAA;AACxC,IAAO,OAAA,WAAA,CAAA;AAAA,GACT;AACA,EAAO,OAAA;AAAA,IACL,KAAA,EAAO,CAAC,CAAC,WAAA;AAAA,IACT,GAAA,EAAK,CAAC,CAAC,WAAA;AAAA,GACT,CAAA;AACF,CAAA;AAEO,SAAS,aACd,CAAA,KAAA,EACA,IACA,EAAA,SAAA,EACA,QACA,EAAA;AAEA,EAAA,IAAA,CAAI,KAAO,IAAA,IAAA,GAAA,KAAA,CAAA,GAAA,KAAA,CAAA,WAAA,CAAY,GAAO,KAAA,IAAA,GAAO,CAAG,EAAA;AACtC,IAAO,OAAA,IAAA,CAAA;AAAA,GACT;AAGA,EAAA,IAAA,CAAI,uCAAW,WAAY,CAAA,KAAA,KAAS,QAAa,KAAA,CAAA,IAAK,OAAO,CAAG,EAAA;AAC9D,IAAO,OAAA,IAAA,CAAA;AAAA,GACT;AAEA,EAAO,OAAA,KAAA,CAAA;AACT;;;;"}