-
Notifications
You must be signed in to change notification settings - Fork 0
feat: drag-and-drop chips in layout panel #111
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
Open
HendrikThePendric
wants to merge
41
commits into
master
Choose a base branch
from
feat/drag-and-drop-chips-in-layout-panel
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
feat: drag-and-drop chips in layout panel #111
HendrikThePendric
wants to merge
41
commits into
master
from
feat/drag-and-drop-chips-in-layout-panel
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
|
🚀 Deployed on https://pr-111.event-visualizer.netlify.dhis2.org |
…tor hook and implement correct sorting
5 tasks
edoardo
reviewed
Dec 15, 2025
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Implements DHIS2-20118
Description
This ports the DnD functionality of the chips from LL to EVER. I have attempted to clean things up a bit as follows:
DndContextProvideris the actual wrapper that defines the DnD behaviour and renders children in aDndContextDimensionDragOverlayis responsible for rendering the "drag-overlay", which is the representation of the element that is being draggedcollisionDetectoris the brains of the operation: it figures out which droppable container (i.e. chip/axis) is the "active" one (in dnd-kit language the is theoverone). It's now doing what we did before (in LL), which is to just check element overlaps, but when it doesn't detect an overlap it also check for the best "line end match". This is basically tov ensure we can drop at various empty spots in the axis, this can be just the axis itself, if there are not matches, but also let's you drop behind the last chip at a certain line.useOnDragEndhook is responsible for dispatching actions to the store, to update the layout when anOnDragEndevent takes place. It is used to populate theonDragEndprop of theDndContextdatafield of theuseSortable/useDroppablehooks:data.overlayItemPropsfield. This avoids having to compute things again in the drag-overlaydataattribute, likeaxis,dimensionId,insertAfter, andisEmptyAxis, see type definitions for more infouseOnDragEndtreats these types different and use a different reducer for each type.DimensionDragOverlayalready takes into account that it will need to render a different component when dragging a sidebar-itemInsertMarkercomponent, which serves two purposed as well. It renders the "insert marker" tot the DOM, but it also monitors the dragged-item-position and is responsible for controlling theinsertAfterprop of the sortable. This is not only used to position the marker but also by the sort reducers.Quality checklist
[*] I actually ended up writing a lot of tests for this, because I found a lot of bugs.
Screenshots
Screen.Recording.2025-12-18.at.17.16.25.mov