機能要望:Pass depth prop in canDrop callback
chris-oms opened this issue · comments
I need to set a maximum nested depth, but in order to do that I need the depth
prop to be passed through in the canDrop callback. Is this something that could be added?
@chris-oms Thank you for your request!
Since the canDrop callback is not intended for a specific use case, only minimal parameters are passed.
Therefore, you should use these parameters to create your own custom functions.
I have created a sample for this use case, please refer to the demo below.
https://codesandbox.io/s/maximum-depth-feature-62-rwie5?file=/src/App.jsx
Here I have created a custom function called getDepth
and used it in the canDrop
callback.
In this demo, Folder 2-1 and Folder 2-2 have a depth of 2, and you cannot drop into a folder with a depth greater than 1.
Once again, thank you for your prompt reply and solution. This works perfectly, many thanks!