angular / angular/components

Drag&Drop Drop List Dynamic Preview

Đang mở
#16,769 7 bình luận 2 reaction 0 người được giao Xem trên GitHub
area: cdk/drag-drop feature P3
Ngôn ngữ chính
TypeScript
Star
25k
Fork
6.8k
Merge trung bình
1 ngày 8 giờ
Pull request đã merge (30 ngày)
91

Mô tả

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

Hướng dẫn đóng góp

Mở hướng dẫn đóng góp

Hướng nghiên cứu

Bắt đầu với bản tái hiện StackBlitz được liên kết và hành vi xem trước kéo và thả của Angular CDK. Xem lại cách cdkDragPreview, cdkDragDropEntered và cdkDragDropExited được sử dụng trong bản tái hiện, sau đó xác định xem bản xem trước sẽ thay đổi như thế nào giữa ba container. Hoàn tất khi bản xem trước chuyển đổi một cách đáng tin cậy khi đi vào và rời khỏi từng container mà không bị sai kích thước.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Đánh giá

Công nghệ
angular, typescript
Lĩnh vực
frontend
Loại issue
Tính năng
Độ khó
4/5
Thời gian dự kiến
3-5 ngày
Mức độ hoạt động
Đình trệ
Độ rõ ràng
Khá rõ ràng
Mức phù hợp với người mới
35/100

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.