bug(MatTree): padding is not recomputed when moving a node inside/outside an expandable node
- 主要语言
- TypeScript
- 星标
- 25k
- 派生
- 6.8k
- 平均合并
- 1 天 8 小时
- 30 天内合并 PR
- 91
描述
### Is this a regression?
- [ ] Yes, this behavior used to work in the previous version
### The previous version in which this bug was not present was
_No response_
### Description
As `TreeControl` is deprecated, I started migrating to the latest API using `childrenAccessor`. So far so good, except for one case not working any more.
I'm using `matTreeNodePadding` and `matTreeNodePaddingIndent` on ``. When I move a node inside/outside of an expandable node, padding is not recomputed as-is.
Expanding/collapsing the parent node in which the node was moved, will recompute its padding though.
### Reproduction
Minimal example on [Stackblitz](https://stackblitz.com/~/github.com/poirierlouis/ng-issue-29959).
Steps to reproduce:
1. Open link
2. Open preview in a new tab
3. Open both folders (`/` and `home`)
4. Follow instructions to move a node outside its parent node
`dataSource` is updated with a new array, using the same items. Can it be a source of error? Should the entire tree be cloned somehow, to trigger changes detection down to padding computation?
### Expected Behavior
When a node is moved inside/outside of an expandable node (level is changed), padding should be recomputed based on the new level of the node.
### Actual Behavior
Padding of the node is not updated when moving the node inside/outside of an expandable node.
### Environment
- Angular: 18.2.10
- CDK/Material: 18.2.11
- Browser(s): Firefox / Chrome
- Operating System (e.g. Windows, macOS, Ubuntu): Windows
贡献指南
调研方向
从链接的 StackBlitz 复现开始,检查使用 childrenAccessor 并在可展开的父节点之间移动节点时 matTreeNodePadding 的行为。跟踪节点层级如何变化以及 padding 如何重新计算,然后验证移动节点会更新其 padding,而不会展开或折叠父节点。
由索引模型根据 Issue 内容生成。
评估
- 技术栈
- angular, typescript
- 领域
- frontend
- Issue 类型
- 缺陷
- 难度
- 3/5
- 预计耗时
- 1-2 天
- 活跃度
- 停滞
- 描述清晰度
- 基本清楚
- 新手友好度
- 48/100