jledentu / vue-finder

📁 A Vue.js component to display hierarchical data (like the MacOS X finder)
https://vue-finder.netlify.app
MIT License
160 stars 16 forks source link

Drag and drop validation #123

Open chasedeanda opened 4 years ago

chasedeanda commented 4 years ago

Great work on this component it is very clean and user friendly! I need to write some validation for handling drag and drop events.

Is there a way to reject a drop that would put the dragged element back in its original place?

jledentu commented 4 years ago

Hi! Thank you! I appreciate your feedback.

No, the move event doesn't provide a way to cancel a drop that happened. But the canDrop prop allows to prevent the dragOver event on some items:

const canDrop = (targetId, draggedId) => {
   // Return false if the dragged item cannot be dropped on the target item
};