Skip to content

Childless Nodes #402

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

Merged
merged 5 commits into from
Oct 7, 2018
Merged

Childless Nodes #402

merged 5 commits into from
Oct 7, 2018

Conversation

ksaxberg
Copy link
Contributor

@ksaxberg ksaxberg commented Sep 25, 2018

Let me know if there is any additional information you need, either in this PR or about these changes!

We're looking to utilize this awesome package, but we need an additional feature. The filesystem theme is great, but you can preview dropping a file into another file. This drop is rejected, which is nice, but we shouldn't really allow users to preview a file being underneath another file. The custom hover implementation is awesome, and adding a little more control over the hover state would allow us to use the package to the fullest extent.

Did some digging to try and figure out where this change would be sensible. Having a parameter to the SortableTree would be nice, and it needs to be called over in the dndManager. So I added the canNodeHaveChildren property function, which defaults to true.

Preview of Example

Here's a quick gif preview of using the new story with "people" nodes as not being able to have children, but other nodes being able to.

childless-nodes

@coveralls
Copy link

coveralls commented Sep 25, 2018

Coverage Status

Coverage decreased (-0.7%) to 74.649% when pulling 01147fb on ksaxberg:childless-nodes into ff980d8 on frontend-collective:master.

@wuweiweiwu wuweiweiwu self-assigned this Sep 27, 2018
Copy link
Member

@wuweiweiwu wuweiweiwu left a comment

Choose a reason for hiding this comment

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

LGTM! Will merge after documentation is added to the README @ksaxberg

@ksaxberg
Copy link
Contributor Author

ksaxberg commented Oct 4, 2018

@wuweiweiwu Added a quick blurb to the README about the new prop:

Function to determine whether a node can have children, useful for preventing hover preview when you have a canDrop condition. Default is set to a function that returns true. Functions should be of type (node): bool.

Thanks for pointing out that I missed adding it to the README!

@wuweiweiwu
Copy link
Member

Awesome! thanks again @ksaxberg

@wuweiweiwu wuweiweiwu merged commit af8bc63 into frontend-collective:master Oct 7, 2018
@wuweiweiwu
Copy link
Member

Will update the thread when it released

@ksaxberg ksaxberg deleted the childless-nodes branch October 8, 2018 00:12
@grydstedt
Copy link

@wuweiweiwu how often do you do releases? Thanks

@wuweiweiwu
Copy link
Member

@grydstedt @ksaxberg released in 2.3.0!!!

@ksaxberg
Copy link
Contributor Author

Thanks!

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.

4 participants