Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: support cancel property in rnd #202

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions src/DraggablePanel/DraggablePanel.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,11 @@ export interface DraggablePanelProps {
* 当前是否是展开态
*/
isExpand?: boolean;
/**
* 禁用拖动功能,指定一个选择器防止拖动初始化
* @example e.g. `.body`
*/
cancel?: string;
/**
* 展开是否可以变更
* @param expand
Expand Down Expand Up @@ -107,6 +112,7 @@ const Draggable: FC<DraggablePanelProps> = memo(
placement,
resize,
style,
cancel,
position,
onPositionChange,
size,
Expand Down Expand Up @@ -167,6 +173,7 @@ const Draggable: FC<DraggablePanelProps> = memo(
// 缩放
resize={resize}
canResizing={resize !== false}
cancel={cancel}
className={className}
style={style}
>
Expand Down
7 changes: 7 additions & 0 deletions src/DraggablePanel/FloatMode.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,11 @@ export interface FloatProps {
onSizeDragging?: (delta: NumberSize, size?: Size) => void;

canResizing?: boolean;
/**
* 禁用拖动功能,指定一个选择器防止拖动初始化
* @example e.g. `.body`
*/
cancel?: string;
/**
* 面板位置
* 受控模式
Expand Down Expand Up @@ -98,6 +103,7 @@ export const FloatMode: FC<FloatProps> = memo(
resize,
style,
position,
cancel,
onPositionChange,
size,
defaultSize: customizeDefaultSize,
Expand Down Expand Up @@ -162,6 +168,7 @@ export const FloatMode: FC<FloatProps> = memo(
return (
<Rnd
position={position}
cancel={cancel}
resizeHandleClasses={resizeHandleClassNames}
default={
{
Expand Down