-
Notifications
You must be signed in to change notification settings - Fork 987
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
feat: Support for dragging items between Lists #138
Conversation
jdbence
commented
Feb 5, 2017
•
edited
Loading
edited
- Changed stories port to 8082 so it can be used online
- Add stories for horizontal, vertical and grid lists
- Add labels to storybook list items so they can be differentiated
@jdbence This looks great! A couple of questions -
|
|
It is really interesting feature will it be merged soon? |
I've had the chance to test this PR out, and it does work fairly well 👍 Still need to carefully review the implementation though, I glanced quickly at it and had a few questions/suggestions for improvements. Stay tuned. |
Thank you for posting this PR (and for the original HoC!), saved me a bunch of time! here's a small tweak I had to make to this PR code for it to work better for my project. i had to change the list.rect.center distance check, to use a list.rect closest edge formula i think this is due to the fact that my lists had wildly different dimensions, and they're stacked vertically, rather than horizontally https://gist.github.com/jakedowns/ed421ee3ee57af869fabb594531e6182 i'll try to post a public fork with all my mods if i get a chance to refactor and clean it up. |
@jakedowns Do you think it could be added to this PR with a prop like |
@jakedowns Correct, different sized containers will need to check distance with closest edge instead of center. I will update this PR to use similar formula. @oyeanuj We won't need to send a prop since detection will work in both scenarios. |
@jdbence note: I had to update my gist, the overlap check was causing issues. nearest-edge check alone seems to suffice: https://gist.github.com/jakedowns/ed421ee3ee57af869fabb594531e6182/revisions it has the nice added effect of making the list hopping happen based on cursor position, rather than the helper element's boundingClientRect. although, maybe that's a good case for something that could be a toggleable option via a prop. |
@jakedowns Yup, I'm only doing the closest edge check since overlap would return the first one found based on order not distance. |
@jakedowns Can you verify the fix works with your use case? |
@jdbence great job, only a question: could SortableGroup be implemented using higher-order components like others? |
@kalimantos |
@jdbence yes you're right! i just made a test and it works great, but when i add the prop "useDragHandle" it brokes up after the handleMove is called. The error given to console is |
@kalimantos Let me know if the latest changes fix your issue. |
@jdbence thank you for the fast support, sadly it doesn't fix my problem, but i understand what you're doing. I think the problem is that
then use it in "startDragging" method instead of "closest"
and now works |
@kalimantos that's correct, searching descendants will work. Hopefully someone makes a PR so the |
@jdbence awesome, thanks a lot |
Great work, @jdbence! @clauderic Any idea when this PR will be merged? We can't wait to use this feature. |
Thanks for the great work, just tried out and it works flawlessly on a desktop. However, it does not seem to drop the item onto a different list in the "grid mode" on mobile. Can you confirm this? Again, thanks a lot for the great work, this is exactly what I've been looking for. |
@nicubarbaros as far as I am aware the only way that react-beautiful-dnd supports this is by having multiple lists that sit side by side as columns... which does not solve my particular problem since my items can sometimes span multiple columns at once. |
react-beautiful-dnd doesn't support virtualization, and I had a lot more issues using it out of the box in terms of getting the styles to work. It would be really nice to see this continue. @sbrichardson how is your branch working? @clauderic would you be open to a PR if it was redone and some people helped test and get it into shape? |
since react-beautiful-dnd is not supporting wrapped lists I will use the closed pr here :/ atlassian/react-beautiful-dnd#316 |
oh, no, pr and pr and pr, hope |
Too bad this still isn't supported, right? :( |
I made it work today with two lists and without modifying the library by forwarding events from the source list to the target list. I will post some snippets tomorrow. |
The component that controls both lists keeps track of their refs and provides the source list the ref of the target list.
The crucial part of
|
wooo! @denyo thanks for your share, you are holy strong. |
I had a similar requirement. In my use case the top list was sortable when dragging from the top or bottom list. The bottom list was not sortable. I solved it by swapping the |
What ever happened to this? |
@bfeeley It seems like it was closed due to there being a couple of quality work-arounds provided by @denyo and @slrubinstein above. |
That's great @slrubinstein ! Do you have the same example with the ability to drag n drop between both lists? |
@gregoryforel Hi, I don't, but I think if the two lists are part of the same collection you should be able to drag between them. Sorry I can't build it out right now. |
Thanks!
…On Mon, 3 Feb 2020 at 19:43, Steve Rubinstein ***@***.***> wrote:
@gregoryforel </~https://github.com/gregoryforel> Hi, I don't, but I think
if the two lists are part of the same collection you should be able to drag
between them. Sorry I can't build it out right now.
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#138?email_source=notifications&email_token=ABDT6MSBKHATDJHBWDI24HTRBBQWVA5CNFSM4C65XYVKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEKU54WI#issuecomment-581557849>,
or unsubscribe
</~https://github.com/notifications/unsubscribe-auth/ABDT6MRU2Z5E3367SV4NWU3RBBQWVANCNFSM4C65XYVA>
.
|
Just in case anyone else is trying to find a solution, react-sortablejs works with dragging between multiple lists. |
thanks @lochstar ! Are there things that |
Hi! Would anyone here be able to provide a sample codepen using @denyo's approach? I tried implementing it a few weeks ago and failed. I kept using react-beautiful-dnd but I find myself wanting to switch again considering it also doesn't support centered lists. I'm also wondering if this approach works with touches (on mobile) and if there's a way of "unlocking" the target list when the element starts entering it (instead of the mouse pointer as I think it is in the example gif). Thanks! |
so what now, is there some demo? |
+1 |
3 similar comments
+1 |
+1 |
+1 |
why it is closed? I don't know react-sortable-hoc support it or not... |
Do we have demo for this one? Thanks in advance. |
Implementation looks great. Do we have sandbox link for this? I am asking this because I am looking for solution and not sure when this PR will be merged. I wanted to understand this as I have requirement to drag items from one list to another, two lists will be vertically side by side unlike yours. Thanks in advance. |
Based on the ideas provided by @denyo , I implemented this feature successfully! , here is the sandbox link: https://codesandbox.io/s/clever-neumann-gvqtv, hope it helps. CC: @rashmimh |