react-arborist
react-arborist copied to clipboard
Adds cross-tree drag and drop functionality.
This PR adds the ability to drag and drop between multiple trees. It passes a reference to the drag tree on drop so you have access to what's being dropped. Works for both controlled and uncontrolled trees. I've updated the showcase demo pages to include a cross-tree demo and added some basic info into the readme.md.
There are some new tree properties, namely:
id?: string allowCrossTreeDrop?: boolean; allowCrossTreeDrag?: boolean;
and data handlers onCrossTreeAdd?: handlers.CrossTreeAddHandler<T>; onCrossTreeDelete?: handlers.CrossTreeDeleteHandler<T>;
I had to comment out the drop test code as drop now requires a reference to the initial drag tree.
Hope this code helps - it's probably not the most elegant but it does work and is reasonably comprehensive.