feat(drag-drop): prevent a item be removed when it into another container
See original GitHub issueFeature Description
CDK(V9) provide [cdkDropListEnterPredicate]
to prevent a item into another container, provide (cdkDropListDropped)
to determine how to do when user drop the item.
I found when user drag the item into another container but not to release, the item is removed in origin container. When I release it, I didn’t add (cdkDropListDropped)
, so the item is recovered. But what I want is the item can into another container but not to be removed in any time.
In summary, can you provide (cdkDragLeaved)
to determine how to deal with the item when the item into another container?
Use Case
Just imaging you are ordering foods from menu in the restaurant. You need to drag the food into your shopping cart. But the item of the menu should’t be removed.
Issue Analytics
- State:
- Created 3 years ago
- Reactions:9
- Comments:12 (2 by maintainers)
Top Results From Across the Web
Angular drag and drop: Items should not remove from ...
Now, I am trying to not to remove a dropped item from a container, but it should be dropped into another container. enter...
Read more >Drag and Drop | Angular Material
There are cases where draggable items can be dragged out of one list into another, however the user shouldn't be able to sort...
Read more >Drag and Drop | Angular Material
Emits when the user removes an item from the container by dragging it into another container. lockAxis: 'x' | 'y'. Locks the position...
Read more >Minecraft invisible block command - Seba Online
Mar 02, 2019 · 13 Command Blocks Unlike most of the other entries on this list, command blocks are not actual items that...
Read more >ng2-dragula | Simple drag and drop with ... - Valor Software
By default, dropping an element outside of any known containers will keep the element in the last place it went over. You can...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Hi @Mr-Eve. great issue! thanks. I think what you are trying to achieve should be partially possible already by just not using the move or transfer utilities the drag-drop provides, but rather by “copying” the element. For example:
The only problem I see here is that the drag placeholder from the menu list is temporarily removed when the item is being dragged over the
Shopping cart
drop list. cc. @crisbeto@Mr-Eve is what you want a copy feature? something like here?
https://stackblitz.com/edit/angular-krmecd (from #13906)
Check https://github.com/angular/components/issues/13906