Skip to content

Commit

Permalink
fix(module:tree-view): nzTreeNodePadding not works in virtual scroll (N…
Browse files Browse the repository at this point in the history
  • Loading branch information
WwwHhhYran authored Dec 14, 2024
1 parent 8e797c2 commit 82b660a
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions components/tree-view/tree-virtual-scroll-view.ts
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,19 @@ export class NzTreeVirtualScrollViewComponent<T> extends NzTreeView<T> implement
this.changeDetectorRef.markForCheck();
}

/**
* @note
* angular/cdk v18.2.0 breaking changes: https://github.com/angular/components/pull/29062
* Temporary workaround: revert to old method of getting level
* TODO: refactor tree-view, remove #treeControl and adopt #levelAccessor and #childrenAccessor
* */
override _getLevel(nodeData: T): number | undefined {
if (this.treeControl.getLevel) {
return this.treeControl.getLevel(nodeData);
}
return;
}

private createNode(nodeData: T, index: number): NzTreeVirtualNodeData<T> {
const node = this._getNodeDef(nodeData, index);
const context = new CdkTreeNodeOutletContext<T>(nodeData);
Expand Down

0 comments on commit 82b660a

Please sign in to comment.