angular / angular/components

Drag&Drop Drop List Dynamic Preview

Ouverte
#16,769 7 commentaires 2 réactions 0 personnes assignées Voir sur GitHub
area: cdk/drag-drop feature P3
Langage dominant
TypeScript
Étoiles
25k
Forks
6.8k
Merge moyen
1 j 8 h
PR mergées (30 j)
91

Description

#### 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

Guide de contribution

Ouvrir le guide de contribution

Piste de recherche

Commencez par la reproduction StackBlitz liée et le comportement de prévisualisation du glisser-dé-déposer de Angular CDK. Examinez comment cdkDragPreview, cdkDragDropEntered et cdkDragDropExited sont utilisés dans la reproduction, puis déterminez comment la prévisualisation doit changer entre les trois conteneurs. C'est terminé lorsque la prévisualisation change de manière fiable lors de l'entrée dans chaque conteneur et de sa sortie, sans dimension incorrecte.

Rédigé par le modèle d'indexation à partir du texte de l'issue.

Évaluation

Stack technique
angular, typescript
Domaine
frontend
Type d'issue
Fonctionnalité
Difficulté
4/5
Temps estimé
3-5 jours
Activité
À l'abandon
Clarté
Plutôt claire
Accessibilité débutants
35/100

Recevez les nouvelles issues par e-mail

Un résumé court des issues GitHub adaptées aux débutants.