angular / angular/components

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

Aperta
#20,069 6 commenti 1 reazione 0 assegnatari Vedi su GitHub
area: cdk/drag-drop feature P4
Lingua principale
TypeScript
Stelle
25k
Fork
6.8k
Merge medio
1g 8h
PR unite (30g)
91

Descrizione

#### 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.

Guida per i contributori

Apri la guida per i contributori

Direzione di ricerca

Inizia individuando l’implementazione di CdkDropList e i relativi test, quindi segui come id e cdkConnectedTo risolvono gli elenchi di rilascio connessi. Aggiorna il comportamento in modo che un id condiviso risolva tutti gli elenchi corrispondenti e verifica che gli id univoci rimangano autonomi, mentre gli id condivisi connettano ogni elenco corrispondente.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Valutazione

Stack tecnologico
angular, typescript
Ambito
frontend
Tipo di issue
Funzionalità
Difficoltà
4/5
Tempo stimato
3-5 giorni
Stato di attività
Ferma
Chiarezza
Abbastanza chiara
Idoneità per principianti
35/100

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.