@joker.front/ui
Version:
Joker-UI | Official native UI component library for Joker Framework. Minimalist design with full-scene components, responsive layout & dynamic interactions. Access dev docs, API references & real-world case studies on official site.
28 lines (27 loc) • 788 B
TypeScript
/**
* 使元素可在其父容器内拖拽的工具函数
* @param element - 要变为可拖拽的DOM元素
* @param options - 可选配置对象
* @returns 包含取消拖拽功能的对象
*/
export declare function makeElementDraggable(element: HTMLElement, options?: DraggableOptions): {
destroy(): void;
resize: () => void;
};
interface Position {
x: number;
y: number;
}
export interface DraggableOptions {
containerSelector?: string;
useTransform?: boolean;
draggingClass?: string;
preventDefault?: boolean;
stopPropagation?: boolean;
onDragStart?: (pos: Position) => void;
onDrag?: (pos: Position) => void;
onDragEnd?: (pos: Position) => void;
moveBarEl?: string | HTMLElement;
allowOutOfBounds?: boolean;
}
export {};