angular / angular/components

Drag&Drop Drop List Dynamic Preview

Aperta
#16,769 7 commenti 2 reazioni 0 assegnatari Vedi su GitHub
area: cdk/drag-drop feature P3
Lingua principale
TypeScript
Stelle
25k
Fork
6.8k
Merge medio
1g 8h
PR unite (30g)
91

Descrizione

#### What are you trying to do?

I want to be able to change the drag and drop preview depending on which container you're dropping into.

In my stackblitz I have three different containers. The first and third one have regular drag and drop previews, but the second one I'd like to customize the drag and drop preview. Using
``` ``` works when dragging elements from the second container, but I'd like the preview to be dynamic depending on where you're dropping it.

For example, if you grab an item from the first container and drag it over the second, I'd like the preview to be the image. But it you drag that same item over the third, it should switch back to the regular preview.

#### What troubleshooting steps have you tried?

I've tried to manually do it using cdkDragDropEntered and cdkDragDropExited events but it did not work as expected. Especially with the differences in the width of the previews.

#### Reproduction

https://stackblitz.com/edit/angular-suzb2h

#### Environment

- Angular: latest
- CDK/Material: latest
- Browser(s): All
- Operating System (e.g. Windows, macOS, Ubuntu): All

Guida per i contributori

Apri la guida per i contributori

Direzione di ricerca

Inizia con la riproduzione StackBlitz collegata e con il comportamento dell'anteprima del trascinamento e rilascio di Angular CDK. Esamina come vengono usati cdkDragPreview, cdkDragDropEntered e cdkDragDropExited nella riproduzione, quindi determina come dovrebbe cambiare l'anteprima tra i tre contenitori. Il lavoro è completato quando l'anteprima cambia in modo affidabile entrando e uscendo da ciascun contenitore, senza dimensioni errate.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Valutazione

Stack tecnologico
angular, typescript
Ambito
frontend
Tipo di issue
Funzionalità
Difficoltà
4/5
Tempo stimato
3-5 giorni
Stato di attività
Ferma
Chiarezza
Abbastanza chiara
Idoneità per principianti
35/100

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.