diff --git a/src/DraggablePanel/DraggablePanel.tsx b/src/DraggablePanel/DraggablePanel.tsx index 14f88826..f7470e00 100644 --- a/src/DraggablePanel/DraggablePanel.tsx +++ b/src/DraggablePanel/DraggablePanel.tsx @@ -60,6 +60,11 @@ export interface DraggablePanelProps { * 当前是否是展开态 */ isExpand?: boolean; + /** + * 禁用拖动功能,指定一个选择器防止拖动初始化 + * @example e.g. `.body` + */ + cancel?: string; /** * 展开是否可以变更 * @param expand @@ -107,6 +112,7 @@ const Draggable: FC = memo( placement, resize, style, + cancel, position, onPositionChange, size, @@ -167,6 +173,7 @@ const Draggable: FC = memo( // 缩放 resize={resize} canResizing={resize !== false} + cancel={cancel} className={className} style={style} > diff --git a/src/DraggablePanel/FloatMode.tsx b/src/DraggablePanel/FloatMode.tsx index 2492e65b..062f37da 100644 --- a/src/DraggablePanel/FloatMode.tsx +++ b/src/DraggablePanel/FloatMode.tsx @@ -54,6 +54,11 @@ export interface FloatProps { onSizeDragging?: (delta: NumberSize, size?: Size) => void; canResizing?: boolean; + /** + * 禁用拖动功能,指定一个选择器防止拖动初始化 + * @example e.g. `.body` + */ + cancel?: string; /** * 面板位置 * 受控模式 @@ -98,6 +103,7 @@ export const FloatMode: FC = memo( resize, style, position, + cancel, onPositionChange, size, defaultSize: customizeDefaultSize, @@ -162,6 +168,7 @@ export const FloatMode: FC = memo( return (