Comparing version 5.0.1 to 5.0.2
@@ -12,7 +12,7 @@ /** | ||
export declare type NodeDragEventParams<T = HTMLDivElement> = { | ||
event: React.MouseEvent<T>; | ||
event: React.DragEvent<T>; | ||
node: EventDataNode; | ||
}; | ||
export declare type NodeMouseEventHandler<T = HTMLSpanElement> = (e: React.MouseEvent<T>, node: EventDataNode) => void; | ||
export declare type NodeDragEventHandler<T = HTMLDivElement> = (e: React.MouseEvent<T>, node: NodeInstance, outsideTree?: boolean) => void; | ||
export declare type NodeDragEventHandler<T = HTMLDivElement> = (e: React.DragEvent<T>, node: NodeInstance, outsideTree?: boolean) => void; | ||
export interface TreeContextProps { | ||
@@ -19,0 +19,0 @@ prefixCls: string; |
@@ -18,6 +18,8 @@ import * as React from 'react'; | ||
} | ||
export declare type AllowDrop = (options: { | ||
export interface AllowDropOptions { | ||
dragNode: DataNode; | ||
dropNode: DataNode; | ||
dropPosition: -1 | 0 | 1; | ||
}) => boolean; | ||
} | ||
export declare type AllowDrop = (options: AllowDropOptions) => boolean; | ||
export interface TreeProps { | ||
@@ -186,8 +188,8 @@ prefixCls: string; | ||
*/ | ||
onNodeDragEnter: (event: React.MouseEvent<HTMLDivElement>, node: NodeInstance) => void; | ||
onNodeDragOver: (event: React.MouseEvent<HTMLDivElement>, node: NodeInstance) => void; | ||
onNodeDragEnter: (event: React.DragEvent<HTMLDivElement>, node: NodeInstance) => void; | ||
onNodeDragOver: (event: React.DragEvent<HTMLDivElement>, node: NodeInstance) => void; | ||
onNodeDragLeave: NodeDragEventHandler; | ||
onWindowDragEnd: (event: any) => void; | ||
onNodeDragEnd: NodeDragEventHandler; | ||
onNodeDrop: (event: React.MouseEvent<HTMLDivElement>, node: any, outsideTree?: boolean) => void; | ||
onNodeDrop: (event: React.DragEvent<HTMLDivElement>, node: any, outsideTree?: boolean) => void; | ||
cleanDragState: () => void; | ||
@@ -194,0 +196,0 @@ onNodeClick: NodeMouseEventHandler; |
@@ -117,2 +117,3 @@ import _toConsumableArray from "@babel/runtime/helpers/esm/toConsumableArray"; | ||
var abstractDragDataNode = dragNode.props.data; | ||
var abstractDropDataNode = abstractDropNodeEntity.node; | ||
@@ -122,2 +123,3 @@ var dropAllowed = true; | ||
if (isFirstChild(abstractDropNodeEntity) && abstractDropNodeEntity.level === 0 && clientY < top + height / 2 && allowDrop({ | ||
dragNode: abstractDragDataNode, | ||
dropNode: abstractDropDataNode, | ||
@@ -132,2 +134,3 @@ dropPosition: -1 | ||
if (allowDrop({ | ||
dragNode: abstractDragDataNode, | ||
dropNode: abstractDropDataNode, | ||
@@ -147,2 +150,3 @@ dropPosition: 0 | ||
if (allowDrop({ | ||
dragNode: abstractDragDataNode, | ||
dropNode: abstractDropDataNode, | ||
@@ -164,2 +168,3 @@ dropPosition: 1 | ||
if (allowDrop({ | ||
dragNode: abstractDragDataNode, | ||
dropNode: abstractDropDataNode, | ||
@@ -170,2 +175,3 @@ dropPosition: 0 | ||
} else if (allowDrop({ | ||
dragNode: abstractDragDataNode, | ||
dropNode: abstractDropDataNode, | ||
@@ -186,2 +192,3 @@ dropPosition: 1 | ||
if (allowDrop({ | ||
dragNode: abstractDragDataNode, | ||
dropNode: abstractDropDataNode, | ||
@@ -188,0 +195,0 @@ dropPosition: 1 |
@@ -12,7 +12,7 @@ /** | ||
export declare type NodeDragEventParams<T = HTMLDivElement> = { | ||
event: React.MouseEvent<T>; | ||
event: React.DragEvent<T>; | ||
node: EventDataNode; | ||
}; | ||
export declare type NodeMouseEventHandler<T = HTMLSpanElement> = (e: React.MouseEvent<T>, node: EventDataNode) => void; | ||
export declare type NodeDragEventHandler<T = HTMLDivElement> = (e: React.MouseEvent<T>, node: NodeInstance, outsideTree?: boolean) => void; | ||
export declare type NodeDragEventHandler<T = HTMLDivElement> = (e: React.DragEvent<T>, node: NodeInstance, outsideTree?: boolean) => void; | ||
export interface TreeContextProps { | ||
@@ -19,0 +19,0 @@ prefixCls: string; |
@@ -18,6 +18,8 @@ import * as React from 'react'; | ||
} | ||
export declare type AllowDrop = (options: { | ||
export interface AllowDropOptions { | ||
dragNode: DataNode; | ||
dropNode: DataNode; | ||
dropPosition: -1 | 0 | 1; | ||
}) => boolean; | ||
} | ||
export declare type AllowDrop = (options: AllowDropOptions) => boolean; | ||
export interface TreeProps { | ||
@@ -186,8 +188,8 @@ prefixCls: string; | ||
*/ | ||
onNodeDragEnter: (event: React.MouseEvent<HTMLDivElement>, node: NodeInstance) => void; | ||
onNodeDragOver: (event: React.MouseEvent<HTMLDivElement>, node: NodeInstance) => void; | ||
onNodeDragEnter: (event: React.DragEvent<HTMLDivElement>, node: NodeInstance) => void; | ||
onNodeDragOver: (event: React.DragEvent<HTMLDivElement>, node: NodeInstance) => void; | ||
onNodeDragLeave: NodeDragEventHandler; | ||
onWindowDragEnd: (event: any) => void; | ||
onNodeDragEnd: NodeDragEventHandler; | ||
onNodeDrop: (event: React.MouseEvent<HTMLDivElement>, node: any, outsideTree?: boolean) => void; | ||
onNodeDrop: (event: React.DragEvent<HTMLDivElement>, node: any, outsideTree?: boolean) => void; | ||
cleanDragState: () => void; | ||
@@ -194,0 +196,0 @@ onNodeClick: NodeMouseEventHandler; |
@@ -148,2 +148,3 @@ "use strict"; | ||
var abstractDragDataNode = dragNode.props.data; | ||
var abstractDropDataNode = abstractDropNodeEntity.node; | ||
@@ -153,2 +154,3 @@ var dropAllowed = true; | ||
if (isFirstChild(abstractDropNodeEntity) && abstractDropNodeEntity.level === 0 && clientY < top + height / 2 && allowDrop({ | ||
dragNode: abstractDragDataNode, | ||
dropNode: abstractDropDataNode, | ||
@@ -163,2 +165,3 @@ dropPosition: -1 | ||
if (allowDrop({ | ||
dragNode: abstractDragDataNode, | ||
dropNode: abstractDropDataNode, | ||
@@ -178,2 +181,3 @@ dropPosition: 0 | ||
if (allowDrop({ | ||
dragNode: abstractDragDataNode, | ||
dropNode: abstractDropDataNode, | ||
@@ -195,2 +199,3 @@ dropPosition: 1 | ||
if (allowDrop({ | ||
dragNode: abstractDragDataNode, | ||
dropNode: abstractDropDataNode, | ||
@@ -201,2 +206,3 @@ dropPosition: 0 | ||
} else if (allowDrop({ | ||
dragNode: abstractDragDataNode, | ||
dropNode: abstractDropDataNode, | ||
@@ -217,2 +223,3 @@ dropPosition: 1 | ||
if (allowDrop({ | ||
dragNode: abstractDragDataNode, | ||
dropNode: abstractDropDataNode, | ||
@@ -219,0 +226,0 @@ dropPosition: 1 |
{ | ||
"name": "rc-tree", | ||
"version": "5.0.1", | ||
"version": "5.0.2", | ||
"description": "tree ui component for react", | ||
@@ -5,0 +5,0 @@ "engines": { |
@@ -89,3 +89,3 @@ # rc-tree | ||
| virtual | Disable virtual scroll when `false` | boolean | - | | ||
| allowDrop | Whether to allow drop on node | ({ dropNode, dropPosition }) => boolean | - | | ||
| allowDrop | Whether to allow drop on node | ({ dragNode, dropNode, dropPosition }) => boolean | - | | ||
| dropIndicatorRender | The indicator to render when dragging | ({ dropPosition, dropLevelOffset, indent: number, prefixCls }) => ReactNode| - | | ||
@@ -142,2 +142,1 @@ | direction | Display direction of the tree, it may affect dragging behavior | `ltr` \| `rtl` | - | | ||
- [Angular Multi Select Tree](https://a5hik.github.io/angular-multi-select-tree/) | ||
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
329112
7093
141