angular / angular/components

feat(drag-drop): cdkConnectedTo finds all drop lists with the same ID, instead of only one

Abierto
#20,069 6 comentarios 1 reacción 0 asignados Ver en GitHub
area: cdk/drag-drop feature P4
Lenguaje dominante
TypeScript
Estrellas
25k
Forks
6.8k
Merge medio
1 d 8 h
PR fusionados (30 d)
91

Descripción

#### Feature Description

`CdkDropList` has `id` and `cdkConnectedTo` input properties to allow specifying an id or array of ids for which the drop lists should be connected.

The `id` input property "needs" to be unique, or better put is "assumed" to be unique - meaning when searching through drop lists to connect to by id, only the first match is returned.

Can the "need" for unique ids be removed and change the connected drop list logic to return **all** drop lists with a matching id?

From the user's perspective:

- If I want a drop list to inherently be standalone, provide a unique id.
- If I want a drop list to inherently be connected to others, provide a shared id.

#### Use Case

Connecting drop lists created dynamically, possibly defined in separate template files and with arbitrary DOM relation, **without** the overhead of having to maintain a separate list of all drop lists that should be connected, and making sure this list is properly updated and propagated to each drop list via change detection.

Instead a statically defined (or could be dynamic) id for the `id` and `cdkConnectedTo` inputs will automatically connect all the drop lists without any further coordination from the user.

Similar to what @sroettering mentioned [here](https://github.com/angular/components/pull/13754#issuecomment-436694651), but I don't think a new input property is necessary.

Guía de contribución

Abrir la guía de contribución

Línea de trabajo

Empieza localizando la implementación de CdkDropList y sus pruebas; después, sigue cómo id y cdkConnectedTo resuelven las listas de elementos conectables. Actualiza el comportamiento para que un id compartido resuelva todas las listas coincidentes y verifica que los ids únicos permanezcan independientes, mientras que los ids compartidos conecten todas las listas coincidentes.

Escrito por el modelo de indexación a partir del texto del issue.

Evaluación

Stack tecnológico
angular, typescript
Área
frontend
Tipo de issue
Nueva funcionalidad
Dificultad
4/5
Tiempo estimado
3-5 días
Estado de actividad
Estancado
Claridad
Bastante claro
Aptitud para principiantes
35/100

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.