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

feat(grid): add an ability to drop elements from outside of a grid #980

Merged
merged 1 commit into from
Sep 9, 2019

Conversation

daynin
Copy link
Collaborator

@daynin daynin commented Aug 15, 2019

  • add isDroppable flag for grids
  • add onDrop callback for getting an element position after dropping
  • add documentation
  • add an example

Relates to: #586

@daynin
Copy link
Collaborator Author

daynin commented Sep 2, 2019

@n1ghtmare @josesaranda @mankinchi @jeremymlane hi! You said here #985 you want to help the project. So could you review this PR pls? And you can mention me in your PRs, I'll review them too

Copy link

@josesaranda josesaranda left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That is ok! Great!

Copy link

@josesaranda josesaranda left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I installed and tested your code. It's ok for me! Congrats!

Copy link
Collaborator

@n1ghtmare n1ghtmare left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Awesome feature, great job, really. I hope my comments are helpful. Let me know if you need my help.

lib/GridItem.jsx Show resolved Hide resolved
lib/ReactGridLayout.jsx Outdated Show resolved Hide resolved
test/examples/0-showcase.jsx Outdated Show resolved Hide resolved
- add isDroppable flag for grids
- add onDrop callback for getting an element position after dropping
- add documentation
- add an example
@mankinchi
Copy link

@n1ghtmare sorry I'm new to review code on github. Can you show me how?

@n1ghtmare
Copy link
Collaborator

@mankinchi Sure thing. First look at the top of this pull request. You will see several tabs, the first one being "Conversation" which is the one we're on now. The next one is "Commits", click on it and select the commit that you want to review (in this case it's just one). You'll now see the commit and the changes. Go through them (through the actual code) and leave a comment on any line that you feel needs a comment/clarification/suggestion or whatever. You might not have any comments of course. Once you're done, in the upper right corner you'll see "Review Changes". Click it and select the option you need. Approve accordingly.

I hope this helps. Let me know if you need more clarifications.

@mankinchi
Copy link

@n1ghtmare thanks. I am able to fetch and checkout this PR branch but couldn't get the server to run. I'm using npm run dev but it only return the showcase page. How can I check the example page? If I'm running npm run view-example, I got problem with /dist/xxx file not found. Can you show me how? I think we also need to provide a guide on how to start run/build the project locally

@mankinchi
Copy link

Ok figured out the reason why. I think this is out of the scope of this task but not sure whether we can address it here. The build-example is pumping out common.bundle.js but all of the example is looking for common.js, which causes the example to fail. Changing in template.ejs make it works

Copy link

@mankinchi mankinchi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think the code is quite nice. However, I'm having problem seeing onDragStart & onDragStop is being used when you drop the droppableItem. I mean it make senses to do it, but I think we would want to have a separate callback for it.

@daynin
Copy link
Collaborator Author

daynin commented Sep 3, 2019

@mankinchi

I mean it make senses to do it, but I think we would want to have a separate callback for it.

Thank you for your comment! But I think it's ok to use the same method for doing the same thing. This code uses onDragStart for dragging simulation, that's why we need to reuse it here

@daynin
Copy link
Collaborator Author

daynin commented Sep 5, 2019

@STRML check it pls. If it's ok, I'll merge it

@daynin daynin merged commit 56eb5c8 into react-grid-layout:master Sep 9, 2019
@daynin daynin deleted the droppable branch September 9, 2019 07:21
@daynin daynin mentioned this pull request Sep 9, 2019
3 tasks
lib/GridItem.jsx Show resolved Hide resolved

if (!this.currentNode) {
// eslint-disable-next-line react/no-find-dom-node
this.currentNode = ((ReactDOM.findDOMNode(this): any): HTMLElement);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Any chance this won't exist?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@STRML no, I think it's impossible

this.currentNode = ((ReactDOM.findDOMNode(this): any): HTMLElement);
}

if (!dragging) {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would be nice to refactor this out of CWRP

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@STRML if you don't mind I'll refactor it here #990

@@ -0,0 +1,134 @@
import React from "react";
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should be numbered 15, not 16

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@STRML fixed #993

@STRML
Copy link
Collaborator

STRML commented Sep 9, 2019

See comments above - forgot to hit the "submit review" button :(

@mankinchi
Copy link

will this be pushed to npm soon or it requires the fixes for @STRML's comment first?

@STRML STRML added this to the 0.17.0 milestone Oct 22, 2019
@violabg
Copy link

violabg commented Nov 27, 2019

Hi I think you should update @types/react-grid-layout too, since is at 0.16.7 version and doesn't have any drop related typings.
Thank for this feature.

@STRML
Copy link
Collaborator

STRML commented Nov 27, 2019 via email

@mikefordweb
Copy link

mikefordweb commented Apr 30, 2020

  • add isDroppable flag for grids
  • add onDrop callback for getting an element position after dropping
  • add documentation
  • add an example

Relates to: #586

How can I do this??

@mathiastm
Copy link

Hi,
Did someone can tell me where I can find this exemple please ?
I really need that...

@kryptoscan
Copy link

Anyway you can combine widgets into one widget with tabs?

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

Successfully merging this pull request may close these issues.

9 participants