angular / angular/components

[CdkTable] expose _insertRow to derived classes

未关闭
#14,199 3 条评论 4 个 reaction 已指派 0 人 在 GitHub 查看
area: cdk/table feature P3
主要语言
TypeScript
星标
25k
派生
6.8k
平均合并
1 天 8 小时
30 天内合并 PR
91

描述

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

贡献指南

打开贡献指南

调研方向

首先阅读 CdkTable 的 _insertRow 和 _renderRow 方法,以及 RowContext 的创建方式。确定派生类应访问现有方法,还是应访问受保护的上下文创建入口点;当所选 API 支持派生类使用行元数据,且不会使行为变得含糊不清时,即视为完成。

由索引模型根据 Issue 内容生成。

评估

技术栈
angular, typescript
领域
frontend
Issue 类型
功能
难度
4/5
预计耗时
3-5 天
活跃度
停滞
描述清晰度
基本清楚
新手友好度
35/100

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。