[CdkDrag]: Allow out of scope binding with drop container
- 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ả
#### Bug, feature request, or proposal: proposal
#### What is the expected behavior?
`CdkDrag` accepts `CdkDropListContainer` as an `@Input` (in addition to the current injection logic)
#### What is the current behavior?
`CdkDrag` accepts `CdkDropListContainer` from DI (optional) or through direct assignment.
#### What is the use-case or motivation for changing an existing behavior?
When `CdkDropListContainer` comes from DI it requires the drop container to be a direct parent of the drag element.
When working with dynamic content (table, tree, select, or any "portal like" components) it is sometimes not possible to have the container and the drag element in a parent/descendant relationship.
For example: In a `CdkTable` dragging a header cell left/right having the header row as the drop container. The row and cell are not defined as parent/descendant in the template and the view creators will not pass the proper injectables in such case.
The current implementation does not require a drop container, it's optional. So adding an `@Input` is quite simple. The init only happen when actual dragging starts so it shouldn't be an issue.
The `CdkDropList` will require some modifications because it uses a template query to get all of the child drag items it manages. This is also doable... Maybe by having a flag that defines the work mode or another directive that does not use a template query.
When a drag item is assigned a drop container it will notify the container so it can store a ref to it... doing the same when the drag is destroyed or disconnected from the parent drop container.
Thanks!
Hướng dẫn đóng góp
Hướng nghiên cứu
Đọc các triển khai của CdkDrag và CdkDropList, bắt đầu với hành vi dependency injection và phát hiện drag con của chúng. Theo dõi cách các container được gán động được kết nối và ngắt kết nối, sau đó xác định hoàn thành là hỗ trợ các mối quan hệ drag/container nằm ngoài phạm vi mà không làm mất hành vi hiện có dựa trên parent.
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ó
- 5/5
- Thời gian dự kiến
- Hơn một tuần
- 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