angular / angular/components

Allow to create cdkDragPreview from the drag drop service

未关闭
#16,111 3 条评论 3 个 reaction 已指派 0 人 在 GitHub 查看
area: cdk/drag-drop feature P3
主要语言
TypeScript
星标
25k
派生
6.8k
平均合并
1 天 8 小时
30 天内合并 PR
91

描述

#### Feature Description

Allow the creation of cdkDragPreview elements outside of a cdkDropList.

#### Use Case

I would like to be able to drag an element Base from a zone A to a zone B, with a preview without losing the place Base was in.

On the event `dragstart` a call to DragDrop (for example) would allow me to duplicate Base or another template element passed to the creation method.
That element Preview would be draggable and would follow the cursor. Base would act as a cdkDragPlaceholder and preview as a cdkDragPreview.

On the event `drop`, I would handle myself what needs to be done. In my case, I only want to get the position of the event, which I can easily do as it's native.
Ideally, we would keep a reference to the element Base to be able to delete it at that point.

I can see difficulties on what to do of Preview or Base by default here. Should Base disappear and Preview stay at the end of the body? Should Preview get nested somewhere where it got dropped? I have no answers here.

I see this as a follow-up to #14261, in that it is a purely cdk request for all DOM nodes.

Thank you

贡献指南

打开贡献指南

调研方向

首先阅读 issue 中描述的 drag-drop service,以及 cdkDragPreview、cdkDragPlaceholder、cdkDropList、dragstart 和 drop 入口点。确定 cdkDropList 外部 Base 和 Preview 的预期生命周期与所有权,包括 drop 后应发生什么。对于所述用例,明确界定 API 行为和清理规则并提供支持,即表示完成。

由索引模型根据 Issue 内容生成。

评估

技术栈
angular, typescript
领域
frontend
Issue 类型
功能
难度
5/5
预计耗时
一周以上
活跃度
停滞
描述清晰度
需要澄清
新手友好度
25/100

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。