minop1205 / react-dnd-treeview

A draggable / droppable React-based treeview component. You can use render props to create each node freely.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Add missing indexes to canDrop

kristian-puccio opened this issue · comments

Is your feature request related to a problem? Please describe.
I want to re-enact a feature like insertDroppableFirst but rather than forcing the order post drop not allowing dropping a non droppable item before the list of droppables (ie folders).

Describe the solution you'd like
If the canDrop function included all the data that onDrop has relativeIndex and destinationIndex then I would have all the data required to enforce the ordering.

Describe alternatives you've considered
insertDroppableFirst but that allows the drop and then re-orders.

Additional context
I believe according to the docs canDrop should have the same parameters as onDrop.

This callback takes the same parameters as the onDrop callback, but the first parameter specifies the current tree.

Oh I'll have a go at making a PR for you.

Thanks!