Skip to content

[WIP] Implement drag and drop feature for widgets #2363

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

Closed
wants to merge 21 commits into from

Conversation

btel
Copy link
Contributor

@btel btel commented Apr 9, 2019

This is a PoC implementation of a drag and drop feature for widgets. So far we enable the dragging for Label widget and define a drop area in Box.

Features

This PR implements:

  • DraggableLabel,
  • drop zone for Box containers and subclasses
  • DropBox - wrapper to make arbitary widgets drop zones
  • DraggableBox - wrapper to maker abitrary widgets draggable
  • drop behaviour can be implemented using Python on_drop handlers
  • draggable widgets can set extra data on draganddrop events
  • Draggable and Droppable mixins on TS side to allow adding drop/drag behaviour to any widgets

Examples

All examples can be found in this notebook:

https://nbviewer.jupyter.org/github/jupyter-widgets/ipywidgets/blob/71cf58c6beafaafd98c7af92bf21c830236e0209/docs/source/examples/Drag%20and%20Drop%20examples.ipynb

Here is a basic example (note that the draggable Label is now called DraggableLabel):

dragable1

Here is a more advance example:

plot_builder

Theory

Here is a pure JS demo of drag and drop feature: https://jsfiddle.net/q935mp27/1/

and mozilla tutorial: https://developer.mozilla.org/en-US/docs/Web/API/HTML_Drag_and_Drop_API#The_basics

@btel btel changed the title Dragandrop widgets [WIP] Implement drag and drop feature for widgets Apr 9, 2019
@btel btel force-pushed the dragandrop_widgets branch from ae56cde to aa394c3 Compare April 10, 2019 08:40
@btel
Copy link
Contributor Author

btel commented Apr 11, 2019

Here is another example with draggable columns to create plot:

draggable_columns

And notebook to generate this example (based on this PR):

https://nbviewer.jupyter.org/gist/btel/e271d8788f674536b9c077520452e344

@SylvainCorlay SylvainCorlay added this to the Minor release milestone Jun 4, 2019
@wolfv
Copy link

wolfv commented Aug 4, 2019

here is another package that could serve as inspiration (from the React community)
https://github.com/atlassian/react-beautiful-dnd

@maartenbreddels
Copy link
Member

We have a similar issue open in ipyvuetify: widgetti/ipyvuetify#2
would be great to have compatibility between the two.

@jtpio jtpio mentioned this pull request Jan 7, 2020
@pbugnion
Copy link
Member

pbugnion commented Jan 9, 2020

Thanks very much, @btel . Looking forward to this getting merged!

I'm going to close this PR in favour of Wolf's rebased version (#2670) to avoid people commenting directly here.

@pbugnion pbugnion closed this Jan 9, 2020
@lock lock bot added the resolved-locked Closed issues are locked after 30 days inactivity. Please open a new issue for related discussion. label May 20, 2020
@lock lock bot locked as resolved and limited conversation to collaborators May 20, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
resolved-locked Closed issues are locked after 30 days inactivity. Please open a new issue for related discussion.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants