angular / angular/components

[CdkTable] expose _insertRow to derived classes

Open
#14,199 3 comments 4 reactions 0 assignees View on GitHub
area: cdk/table feature P3
Dominant language
TypeScript
Stars
25k
Forks
6.8k
Avg merge
1d 8h
Merged PRs (30d)
91

Description

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

Contributor guide

Open the contributing guide

Research direction

Start by reading CdkTable's _insertRow and _renderRow methods and how RowContext is created. Determine whether derived classes should access the existing methods or a protected context-creation entry point; done means the chosen API supports row metadata for derived classes without leaving the behavior ambiguous.

Written by the indexing model from the issue text.

Assessment

Tech stack
angular, typescript
Domain
frontend
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.