angular / angular/components

[CdkTable] expose _insertRow to derived classes

Offen
#14,199 3 Kommentare 4 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen
area: cdk/table feature P3
Vorherrschende Sprache
TypeScript
Sterne
25k
Forks
6.8k
Ø Merge
1 T. 8 Std.
Gemergte PRs (30 T.)
91

Beschreibung

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

Beitragsleitfaden

Beitragsleitfaden öffnen

Rechercherichtung

Beginne damit, die Methoden _insertRow und _renderRow von CdkTable sowie die Erstellung von RowContext zu lesen. Bestimme, ob abgeleitete Klassen auf die vorhandenen Methoden oder auf einen geschützten Einstiegspunkt zur Kontexterstellung zugreifen sollten; erledigt ist dies, wenn die gewählte API Zeilenmetadaten für abgeleitete Klassen unterstützt, ohne das Verhalten mehrdeutig zu machen.

Vom Indexierungsmodell aus dem Issue-Text verfasst.

Bewertung

Tech-Stack
angular, typescript
Bereich
frontend
Issue-Typ
Feature
Schwierigkeit
4/5
Geschätzter Aufwand
3-5 Tage
Aktivitätsstatus
Veraltet
Klarheit
Größtenteils klar
Anfängerfreundlichkeit
35/100

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.