Drag&Drop Drop List Dynamic Preview
还没有人认领这个 Issue。
- 主要语言
- TypeScript
- 星标
- 25k
- 派生
- 6.8k
- 平均合并
- 1 天 8 小时
- 30 天内合并 PR
- 91
描述
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
<img *cdkDragPreview src="https://upload.wikimedia.org/wikipedia/en/4/40/Star_Wars_Phantom_Menace_poster.jpg"> 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
贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
调研方向
从链接的 StackBlitz 复现和 Angular CDK 拖放预览行为开始。检查复现中如何使用 cdkDragPreview、cdkDragDropEntered 和 cdkDragDropExited,然后确定预览应如何在三个容器之间变化。当预览在进入和离开每个容器时都能可靠切换且不会出现大小错误时,即表示完成。
由索引模型根据 Issue 内容生成。
评估
- 技术栈
- angular, typescript
- 领域
- frontend
- Issue 类型
- 功能
- 难度
- 4/5
- 预计耗时
- 3-5 天
- 活跃度
- 停滞
- 描述清晰度
- 基本清楚
- 新手友好度
- 35/100