-
Notifications
You must be signed in to change notification settings - Fork 983
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
Grid support #86
Grid support #86
Conversation
Hey @richmeij! First of all, a massive thank you for working on this 🙏 I haven't had too much time to review the code yet, but I played around with the storybook and this looks really, really cool. I'll provide more detailed feedback once I've had the chance to dig deeper 😄 |
Glad to help out, @clauderic! One thing that just occurred to me is that I'm unsure the current approach will play nice with React Virtualized and such. I'll have a look at that in the meantime. |
I believe it should play nice with windowing libraries based on your implementation, but don't quote me on that 😅 Two small things off the top of my mind:
|
Ok, I will have a look! Question: |
I mean in a grid. Something like this basicaly: http://greensock.com/?example=sortable-grid-using-draggable |
Yeah, that wouldnt be something that this PR accounts for yet. I'll have a look. |
This will be a very cool feature, i'm actually use react-dnd to sort a grid container but will make the switch to sortable-hoc as soon as this feature land! :) |
Is this feature available? I tried using axis='xy' and I got the next warning message : Failed prop type: Invalid prop Obviously it didn't work and could not sort any items |
@tecnolocoEdan It hasn't been merged yet, no. But feel free to clone the repo locally from this branch if you wish to play around with it ahead of time. |
@clauderic thanks for your response I really interested in this feature working in these awesome hoc's, i tried using this branch inside my project but i couldn't make it work. @richmeij is there any chance you could make an npm installable version of your branch? i tried to install it a few times but it seems that the src files weren't downloaded, also tried to take the files directly from the zip and didn't work either and no error message was displayed. |
@tecnolocoEdan Strange, it should just work like the master branch. Are you running |
@tecnolocoEdan, you'll need to run the following commands manually:
If you want to create a custom build, just run: This is something I'll be working on automating soon. |
Again thanks to both of you ( @richmeij & @clauderic ), you are really helpfull. Finally I made it work, it seems that the only thing missing on the branch of grid-support was a react-dom on the pakage.json, I was geting an error of a missing react-dom when I ran npm install, so I installed it manually just with npm install react-dom and I was able to use the es6 path built with npm run build on my project with no problem. I expect this info will be helpfull to you and others. |
Awesome! Works very well! 🙌👏 Is there perhaps a way to publish this version under a beta version number of so? Or how else to get this working in production? |
Feature: Grid support (addresses jdbence#4)
Added drag & drop support in a grid, as requested in #4.
I added a new axis option:
xy
. I kept this a string to stay backwards compatible. You mentioned it should probably be an array/object, and while I found no immediate need for that, that should be a fairly straightforward change.As you now have the option to (potentially) move over the x and y axis, I had to change most functions to explicitly work with x/y, width/height and top/left instead of using
dimension
andedge
. This resulted in slightly more verbose code, especially inanimateNodes()
, but I decided to keep it like this initially, so the changes are clear. We can always apply extra changes to make things more compact, if needed.I did make an effort to keep loops and calculations as effecient as possible.
Other changes: