-
-
Notifications
You must be signed in to change notification settings - Fork 545
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
[5.x] Ability to drag/drop sets between replicators #10361
base: 5.x
Are you sure you want to change the base?
[5.x] Ability to drag/drop sets between replicators #10361
Conversation
Love this idea! From a UX perspective, it might be a good idea to add some sort of indicator if a set can be placed in another replicator. Like in your demo above, you can't move an image set into a text-only replicator. But this is not apparent to the user. So that's quite confusing. |
This is ready for review! @aerni Following your suggestion I added the not-allowed cursors, but I think you probably meant something more, like highlighting the compatible replicators? I tried to come up with a nice UI for that but couldn't figure out anything that a) was obvious but not too obtrusive and b) worked well with nested replicators. I’ll wait for Jack and the team to review and see if they have any suggestions. |
The not-allowed cursor is already a good hint. But yeah, would probably reduce the opacity on the replicators or something like that. Let's see what Jack thinks. |
This would be slick, and I tried it, but if you're dragging between nested replicators and the parent isn't compatible that will fade out, fading out the nested ones as well. |
@jacksleight This looks fantastic! I've been dreaming about this exact feature, just for asset fields. Do you see some sort of overlap between such a feature and the additions in your PR, in terms of code re-use? Or would this be better off in a separate implementation over in asset land? |
@daun I think you could totally make use of some of the additions here. Only about a half of this is replicator specific, the other half is general changes to the global sortable list component that allows:
|
@jacksleight Nice! I'll wait until this one gets merged then, and see what I can re-use if/when I give it a try. |
This PR adds the ability to drag and drop sets between different replicators:
CleanShot.2024-07-04.at.10.57.24.mp4
Notes
group
prop that tells it which instance to share, and agroupValidator
function that's used to decide whether the item is valid in the target container.input
event emitted from the sortable list component has different data, allowing the parent component to decide how to handle the changes.move
helper function has been moved to globals and renamed/split up so that functionality can be used elsewhere.scope
feature. That has decent but not full browser support right now.Other Changes
I’ve made a couple of changes that are not strictly drag-and-drop related, but were required to implement this nicely:
configHash()
method on theField
class (only called when needed).Bard
object without setting a field. This meant that the field could be null when generating the config hash, resulting in blink keys that are pretty meaningless. Rather than allowing null I thought it made more sense to adjust the test.