import {tAlign, tDirection} from "./type.base"; import {PlainPopperPlacements} from "./PlainPopperPlacements"; /** * 解析placement * @author 韦胜健 * @date 2022/4/6 10:43 */ export function decodePlacement(placement?: typeof PlainPopperPlacements.TYPE | null) { let placementArgs = (placement || 'bottom-start')?.split('-'); let direction: tDirection = placementArgs[0] as any; let align: tAlign = placementArgs[1] as any || 'center'; const isVertical = direction === 'top' || direction === 'bottom'; return { direction, align, isVertical, }; }