Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(module:tree-view): upgrade tree view #9003

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

WwwHhhYran
Copy link
Contributor

PR Checklist

Please check if your PR fulfills the following requirements:

PR Type

What kind of change does this PR introduce?

  • Bugfix
  • Feature
  • Code style update (formatting, local variables)
  • Refactoring (no functional changes, no api changes)
  • Build related changes
  • CI related changes
  • Documentation content changes
  • Application (the showcase website) / infrastructure changes
  • Other... Please describe:

What is the current behavior?

Issue Number: N/A

What is the new behavior?

Upgrade Tree View Component

angular/cdk has now marked treeControl as deprecated in 18.2.0, replacing it with levelAccessor and childrenAccessor, and is planning to remove treeControl in 21.0.0. So I'm going to synchronise this feature in Ng Zorro.

So I've made the following changes:

  • Deprecate nzTreeControl parameter and add nzLevelAccessor and nzChildrenAccessor paramter, in order to synchronize the new features of CdkTree (@angular/cdk ^18.2.0)
  • Rewrite all demos for Tree View component based on levelAccessor and childrenAccessor.
  • Update document

Does this PR introduce a breaking change?

  • Yes
  • No

Other information

@WwwHhhYran WwwHhhYran requested a review from hsuanxyz as a code owner February 11, 2025 12:25
Copy link

zorro-bot bot commented Feb 11, 2025

This preview will be available after the AzureCI is passed.

Copy link

codecov bot commented Feb 11, 2025

Codecov Report

Attention: Patch coverage is 78.53107% with 38 lines in your changes missing coverage. Please review.

Project coverage is 91.68%. Comparing base (8a1ac18) to head (386deb3).

Files with missing lines Patch % Lines
components/tree-view/indent.ts 35.13% 16 Missing and 8 partials ⚠️
components/tree-view/flattener.ts 89.47% 2 Missing and 2 partials ⚠️
components/tree-view/nested-data-source.ts 81.25% 3 Missing ⚠️
components/tree-view/tree-virtual-scroll-view.ts 25.00% 3 Missing ⚠️
components/tree-view/flat-data-source.ts 92.30% 2 Missing ⚠️
components/tree-view/utils.ts 95.45% 2 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master    #9003      +/-   ##
==========================================
- Coverage   91.96%   91.68%   -0.29%     
==========================================
  Files         559      574      +15     
  Lines       19772    20244     +472     
  Branches     2954     3027      +73     
==========================================
+ Hits        18183    18560     +377     
- Misses       1263     1346      +83     
- Partials      326      338      +12     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@Laffery Laffery added this to the v19.2 milestone Feb 13, 2025
@HyperLife1119 HyperLife1119 added the PR: need-test Test is necessary for code changes. label Feb 14, 2025
@WwwHhhYran
Copy link
Contributor Author

There has been a lack of testing for Tree-View component for a long time, and this is a historical problem. I will add test cases to make up for it in the future. ( WIP...

@WwwHhhYran WwwHhhYran force-pushed the feat/tree_view_accessor branch from bf44c72 to 386deb3 Compare March 3, 2025 13:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants