angular / angular/components

[CdkTable] expose _insertRow to derived classes

Aperta
#14,199 3 commenti 4 reazioni 0 assegnatari Vedi su GitHub
area: cdk/table feature P3
Lingua principale
TypeScript
Stelle
25k
Fork
6.8k
Merge medio
1g 8h
PR unite (30g)
91

Descrizione

#### Bug, feature request, or proposal: proposal

#### What is the expected behavior?
`_insertRow` is visible to inheriting classes

#### What is the current behavior?
`_insertRow` is private

#### What is the use-case or motivation for changing an existing behavior?
In `_insertRow` the context is created (`RowContext`).
The row context is very useful as a metadata storage for the row, storing information about the row that helps when we want to create features that require state.

For example, flagging if the row is currently being edited, which cell is edited. If the row is being dragged or not etc...

This is also true for a specific cell, metadata for it can be saved on the row context.

#### Is there anything else we should know?
Because `_insertRow` calls `_renderRow`, which is also private, it will require exposing `_renderRow` as well, which is dont think is such a bad thing.

But, if we want to avoid that, maybe it will be better to expose a new protected method, `_createRowContext(data: T): RowContext ` that people can extend

Guida per i contributori

Apri la guida per i contributori

Direzione di ricerca

Inizia leggendo i metodi _insertRow e _renderRow di CdkTable e come viene creato RowContext. Determina se le classi derivate debbano accedere ai metodi esistenti o a un punto di ingresso protetto per la creazione del contesto; il lavoro è completato quando l’API scelta supporta i metadati delle righe per le classi derivate senza lasciare ambiguo il comportamento.

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.