solid-dnd icon indicating copy to clipboard operation
solid-dnd copied to clipboard

Nested drag and drop

Open martinpengellyphillips opened this issue 4 years ago • 16 comments

Would be good to have an example of nested drag and drop, as well as test and improve the API if necessary for this use case.

Imagine a classic filetree for example.

martinpengellyphillips avatar Oct 30 '21 19:10 martinpengellyphillips

See also someone experimenting with this type of interface: https://codesandbox.io/embed/solid-nested-dnd-prototype-uu5jm?file=/src/App.tsx&codemirror=1

martinpengellyphillips avatar Oct 31 '21 13:10 martinpengellyphillips

Hi, just here to express my interest in a file tree-style drag and drop demo. Unfortunately, the above link no longer seems to work/load. (I'm just futzing around with a side project - please don't take this as an obligation or time-sensitive issue!)

dharmaturtle avatar Feb 09 '22 14:02 dharmaturtle

Ah, that link was just an example of what someone was trying to do - not a working implementation for Solid DnD. I've updated the comment to be clearer.

I'll take a look at a Solid DnD example on the main site in the near future - but if you get something first, please feel free to share a PR.

martinpengellyphillips avatar Feb 10 '22 13:02 martinpengellyphillips

Really amazing project Martin.
Would really like to use your project and wondering if something like the link below can be made: I tried to do it with dnd-action and that package is not able to support it. Perhaps yours can.

https://svelte.dev/repl/1f3437021e76495e83746200ed002096?version=3.46.4

Desired Behaviour:

  1. Accordions can be reordered with dragndrop.
  2. Accordions cannot be dragndrop into subaccordions.
  3. Subaccordions can be reordered within same parent Accordion.
  4. Subaccordions can be dragndrop into other parent Accordions.
  5. When a subaccordion is dragndrop into other parent Accordions, it will be added to the new parent Accordion and removed from the accordion where it came from.

99bits avatar Mar 25 '22 17:03 99bits

Thanks for the kind words.

I haven't tried to do something similar yet. I'm sure the basic building blocks will make it possible in solid-dnd, but I'm also sure there will be things to figure out. In other words, I don't believe it will just work out of the box.

I would be curious about any attempt you make and where you hit issues that I might be able to address in the core. Meanwhile, I'm working on a related example which might uncover some better answer here.

By the way, I'm surprised https://github.com/isaacHagoel/solid-dnd-directive couldn't do it as based off same Svelte lib as in your example. What was the issue faced there?

martinpengellyphillips avatar Mar 27 '22 11:03 martinpengellyphillips

Hi Martin,

That example that I made was in Svelte using Isaac's dragndrop project. If you play with the example, you can see that draging a subaccordion into another accordion doesn't work as expected. The subaccordion should be removed from where it was dragged from and added into the new accordion.

I didn't try to use his solidjs because the svelte project is not working correctly.

99bits avatar Mar 28 '22 19:03 99bits

Ah, understood.

I'm making good progress on some improvements to solid dnd that might help for your use case. I'll post an update here once they are done.

martinpengellyphillips avatar Mar 28 '22 20:03 martinpengellyphillips

That would be amazing. A solid DnD to rule them all. Kudos

99bits avatar Mar 29 '22 05:03 99bits

0.5.0 has been released and should make implementing nested use cases easier as it supports seamless recreation of draggables/droppables during active drag (as well as a new closestCorners collision detector). You can see this working in the new multiple lists example on https://solid-dnd.com/

However, I will leave this issue open until I or someone else successfully implements a working nested example 😄

Note: 0.5.0 release contains breaking changes - see changelog for details.

martinpengellyphillips avatar Apr 30 '22 22:04 martinpengellyphillips

+1 on an example of nested dnd

HiperMaximus avatar Sep 10 '22 05:09 HiperMaximus

The "Board" example on the site now gives some example of nested in that both the columns and the items within them can be dragged and sorted independently. However, I'll leave this open as I also want to add a more specific nested example where items can be arbitrarily nested within each other.

martinpengellyphillips avatar Sep 11 '22 20:09 martinpengellyphillips

Any update on this? I'd love a nested example, currently trying to figure it out myself but no luck.

Adevien avatar Nov 21 '23 03:11 Adevien