angular / angular/components

feat(CdkDropList): Allow to connect to lists sharing the same ID

Abierto
#27,493 2 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

Currently there seem to be no simple way to connect various drop lists in various components, unless they have a `cdkDropListGroup` on top of them, or a defined list of ids, which is not achievable in many cases.

Hence we could imagine that the `connectedTo` input could be used to connect several lists, depending on a single `id` parameter (or maybe some `groupName` ?), like :

```
// In some place in the code


...
// In a completely different place

...
// In another completely different place

```

Also the Input `connectedTo` already supports an ID as `string` but gets only a single element, as it can be seen in the code :
```
const siblings = coerceArray(this.connectedTo).map(drop => {
if (typeof drop === 'string') {
const correspondingDropList = CdkDropList._dropLists.find(list => list.id === drop); <-- Here

if (!correspondingDropList && (typeof ngDevMode === 'undefined' || ngDevMode)) {
console.warn(`CdkDropList could not find connected drop list with id "${drop}"`);
}

return correspondingDropList!;
}

return drop;
});
```

Hence replacing `.find(list => list.id === drop)` by a `.filter(list => list.id === drop)` pipe will allow to register as siblings all the lists that have this ID, so it may not be a big deal technically (in first approximation).

### Use Case

I've got a dataviz interface where datasets could be drag n' dropped in various containers (columns, graphs, segments, etc), but not knowing the number of them and not being able to get them under a single group.

Guía de contribución

Abrir la guía de contribución

Línea de trabajo

Start at the CdkDropList connectedTo handling shown in the issue, especially the lookup of lists by id. Trace how connected drop lists are registered and identify existing coverage for connectedTo IDs. Done means the intended behavior for multiple lists sharing an ID is agreed, implemented without breaking single-ID connections, and covered by tests.

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.