tree-select icon indicating copy to clipboard operation
tree-select copied to clipboard

feat: support option in onChange handler

Open nathanlao opened this issue 1 year ago • 3 comments

🤔 This is a ...

  • [x] 🆕 New feature

🔗 Related Issues

close https://github.com/ant-design/ant-design/issues/50586

💡 Background and Solution

TreeSelect supports option in onChange handler

As sugguested by the member, expose option in the extra parameter in onChange handler

Summary by CodeRabbit

  • 新功能
    • 更新了 TreeSelect 组件,增强了事件处理能力,支持更详细的选项信息传递。
  • 测试
    • 增强了测试套件,新增了针对选项属性的测试用例,并改进了现有测试,确保组件在不同策略下的行为得到全面验证。

nathanlao avatar Oct 16 '24 23:10 nathanlao

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
tree-select ✅ Ready (Inspect) Visit Preview 💬 Add feedback Nov 13, 2024 6:26am

vercel[bot] avatar Oct 16 '24 23:10 vercel[bot]

Walkthrough

该拉取请求对 TreeSelect 组件及其相关接口进行了显著修改,增强了事件处理能力和测试覆盖率。在 TreeSelect.tsx 中,更新了 TreeSelectProps 接口以包含新的 DefaultOptionType,允许 onChange 方法接受额外的 option 参数。triggerChange 函数的签名也进行了调整,以包含 nodes 属性,从而提供更多上下文信息。测试套件进行了增强,新增了测试用例以验证不同策略下的选项结构。

Changes

文件路径 更改摘要
src/TreeSelect.tsx 更新 TreeSelectProps 接口以包含 DefaultOptionType,更新 triggerChange 函数签名以包含 nodes 参数。
tests/Select.props.spec.js 增强测试套件,新增测试用例并修改现有测试,涵盖 showCheckedStrategy 功能并验证 option 属性。

Assessment against linked issues

Objective Addressed Explanation
增加返回字段以暴露选中的所有属性 (50586)

Possibly related PRs

  • #564: 此PR修改了 TreeSelect 组件对 null 值的处理,与主PR中 triggerChange 函数的更改相关。
  • #576: 此PR对 OptionList 组件的更改可能与 TreeSelect 组件的功能相关,特别是在选项管理和显示方面。
  • #586: 此PR涉及对 TreeSelect 组件的重大更改,包括类型定义的更新,可能与主PR中的修改重叠。
  • #592: 此PR增强了 OptionList 组件的键盘交互,可能与主PR中描述的用户体验改进相关。
  • #595: 此PR对 TreeSelectProps 接口中的 treeTitleRender 属性的更改可能直接与主PR中的修改相关。

Suggested reviewers

  • zombieJ

Poem

🐰 在树下轻轻跳,
选项全都要,
类型更安全,
测试覆盖高,
兔子乐陶陶! 🌳✨


Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

coderabbitai[bot] avatar Oct 16 '24 23:10 coderabbitai[bot]

Codecov Report

All modified and coverable lines are covered by tests :white_check_mark:

Project coverage is 100.00%. Comparing base (3b919b5) to head (121c6d0). Report is 8 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff            @@
##            master      #589   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files           16        16           
  Lines          517       546   +29     
  Branches       140       163   +23     
=========================================
+ Hits           517       546   +29     

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.

codecov[bot] avatar Oct 17 '24 01:10 codecov[bot]