Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Multiple Droppable types #212

Closed
gabiseabra opened this issue Dec 1, 2017 · 4 comments
Closed

Multiple Droppable types #212

gabiseabra opened this issue Dec 1, 2017 · 4 comments

Comments

@gabiseabra
Copy link

Bug or feature request?

Feature request


There is currently no way to set multiple types, or a type wildcard that will accept Draggables of multiple any types. This could be added if there is a valid use case.

I'm building an editor with two possible operations for the main droppable element: You could "MOVE" an existing node or "CREATE" a new one by selecting from a list of possible node types. In addition to that, there is another droppable for deleting nodes that should only accept the "MOVE" type. Is that not a valid use case for accepting multiple draggable types?

@alexreardon
Copy link
Collaborator

Sounds reasonable. You could achieve this today by using the isDropDisabled prop and dynamically updating it based on what is dragging. This would allow you to infinitely complex conditional dropping including multi-types. For now it is my recommended suggestion as it is super flexible. The type prop is mostly for convenience.

@alexreardon
Copy link
Collaborator

Given that we support the isDropDisabled prop I think you could build the logic you are after without too much difficulty

@alexreardon
Copy link
Collaborator

For now the current recommendation is to use the isDropDisabled prop to achieve the affect you are after. Thanks for reaching out @gabiseabra !!

@N1kto
Copy link

N1kto commented Sep 3, 2018

Hello there!
First of all, my words of appreciation for creating such a nice lib. In another project we used ReactDND which is also cool, but too low-level/much boilerplate. This lib is super easy to setup and start using. Good work.

For mentioned straightforward setup and appealing behavior, we are using this lib in another project of ours. And here we have a case where having multiple types supported would very helpful.

So, we have 2 lists of items: 1st is "positive" things and the 2nd - "negative" things. Also there must be the 3rd list for "unimportant" things. It is meant to contain both "positive" and "negative" things inside upon user decision. However it is not allowed to drag-drop items from "positive" thing to "negative" ones and vice a versa, and it should be allowed to re-arrange items within the same list.

So, in this situation it would be very handy to have POSITIVE_THING, NEGATIVE_THING types for first 2 lists and for the "unimportant" items: ["POSITIVE_THING", "NEGATIVE_THING"].
Of course it should be possible to implement such behavior using isDropDisabled, but in this case it should be setup for all 3 lists: for positive items list - not to allow negative ones and the opposite for negative items list, and finally for "unimportant" to accept both.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants