Skip to content

Conversation

rubbishmaker
Copy link
Contributor

@rubbishmaker rubbishmaker commented Jul 1, 2025

#9148
自定义的valueTypeMap不应该走ProList的props剔除逻辑,应该全部放开给开发者

Summary by CodeRabbit

  • 新功能
    • 当使用自定义 valueType 时,属性过滤逻辑已优化,支持更多字段属性透传,增强了字段组件的灵活性。

Copy link

coderabbitai bot commented Jul 1, 2025

📝 Walkthrough

Walkthrough

本次变更在 ProFieldComponent 组件中调用 pickProProps 时,新增了一个布尔参数,用于判断 valueType 是否存在于 context.valueTypeMap。同时,pickProProps 函数新增了一个可选参数 customValueType,根据其值决定是否过滤某些属性。

Changes

文件/路径 变更摘要
packages/field/src/index.tsx ProFieldComponent 调用 pickProProps 时新增布尔参数,用于判断 valueType 是否在 context.valueTypeMap 中。
packages/utils/src/pickProProps/index.tsx pickProProps 函数新增可选参数 customValueType,并根据其值调整属性过滤逻辑。

Sequence Diagram(s)

sequenceDiagram
    participant ProFieldComponent
    participant pickProProps
    participant context

    ProFieldComponent->>context: 获取 valueTypeMap
    ProFieldComponent->>pickProProps: 传递 props, customValueType(由 valueType 是否在 valueTypeMap 决定)
    pickProProps-->>ProFieldComponent: 返回过滤后的属性对象
Loading

Poem

兔子挥笔写新篇,
属性过滤有新颜。
判断类型巧传参,
pickProProps 变灵便。
代码世界轻轻转,
逻辑升级喜开颜!
🐇✨

Warning

There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure.

🔧 ESLint

If the error stems from missing dependencies, add them to the package.json file. For unrecoverable errors (e.g., due to private dependencies), disable the tool in the CodeRabbit configuration.

packages/utils/src/pickProProps/index.tsx

Oops! Something went wrong! :(

ESLint: 8.57.1

ESLint couldn't find the plugin "@typescript-eslint/eslint-plugin".

(The package "@typescript-eslint/eslint-plugin" was not found when loaded as a Node module from the directory "".)

It's likely that the plugin isn't installed correctly. Try reinstalling by running the following:

npm install @typescript-eslint/eslint-plugin@latest --save-dev

The plugin "@typescript-eslint/eslint-plugin" was referenced from the config file in ".eslintrc.js » /node_modules/.pnpm/@umijs[email protected][email protected]_ts-node@10.9.2_@swc+core@1.9.2_@swc+helpers@0.5.1__@typ_e7f3abddcfd9f2889fe00a0220b1cbbc/node_modules/@umijs/fabric/dist/eslint.js#overrides[0]".

If you still can't figure out the problem, please stop by https://eslint.org/chat/help to chat with the team.

packages/field/src/index.tsx

Oops! Something went wrong! :(

ESLint: 8.57.1

ESLint couldn't find the plugin "@typescript-eslint/eslint-plugin".

(The package "@typescript-eslint/eslint-plugin" was not found when loaded as a Node module from the directory "".)

It's likely that the plugin isn't installed correctly. Try reinstalling by running the following:

npm install @typescript-eslint/eslint-plugin@latest --save-dev

The plugin "@typescript-eslint/eslint-plugin" was referenced from the config file in ".eslintrc.js » /node_modules/.pnpm/@umijs[email protected][email protected]_ts-node@10.9.2_@swc+core@1.9.2_@swc+helpers@0.5.1__@typ_e7f3abddcfd9f2889fe00a0220b1cbbc/node_modules/@umijs/fabric/dist/eslint.js#overrides[0]".

If you still can't figure out the problem, please stop by https://eslint.org/chat/help to chat with the team.


📜 Recent review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between a9c1cc5 and e0e4321.

📒 Files selected for processing (2)
  • packages/field/src/index.tsx (1 hunks)
  • packages/utils/src/pickProProps/index.tsx (1 hunks)
🧰 Additional context used
🧬 Code Graph Analysis (1)
packages/field/src/index.tsx (1)
docs/components/valueType.tsx (1)
  • valueType (115-299)
⏰ Context from checks skipped due to timeout of 90000ms (4)
  • GitHub Check: build (16.x, ubuntu-latest)
  • GitHub Check: build
  • GitHub Check: build
  • GitHub Check: Analyze (javascript)
🔇 Additional comments (3)
packages/utils/src/pickProProps/index.tsx (2)

5-8: 函数签名更新正确

新增的 customValueType 参数设计合理,默认值为 false 保证了向后兼容性。


13-14: 实现逻辑正确且注释清晰

条件判断逻辑正确实现了 PR 目标:当使用自定义 valueType 时,跳过属性过滤,将所有属性传递给开发者。中文注释清楚地解释了这一行为。

packages/field/src/index.tsx (1)

666-666: 自定义 valueType 检测逻辑实现正确

通过检查 valueType 是否存在于 context.valueTypeMap 中来判断是否为自定义类型的逻辑是正确的。可选链操作符和类型转换的使用都很恰当,确保了代码的健壮性。这一改动完美契合了 PR 目标,使自定义 valueTypeMap 能够绕过属性过滤逻辑。

✨ Finishing Touches
  • 📝 Generate Docstrings
🧪 Generate Unit Tests
  • Create PR with Unit Tests
  • Post Copyable Unit Tests in Comment

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ 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.
    • Explain this complex logic.
    • 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 explain this code block.
    • @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 explain its main purpose.
    • @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.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

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 generate docstrings to generate docstrings for this PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai auto-generate unit tests to generate unit tests for this 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.

Copy link

pkg-pr-new bot commented Jul 1, 2025

@ant-design/pro-card

npm i https://pkg.pr.new/@ant-design/pro-card@9149

@ant-design/pro-components

npm i https://pkg.pr.new/@ant-design/pro-components@9149

@ant-design/pro-descriptions

npm i https://pkg.pr.new/@ant-design/pro-descriptions@9149

@ant-design/pro-field

npm i https://pkg.pr.new/@ant-design/pro-field@9149

@ant-design/pro-form

npm i https://pkg.pr.new/@ant-design/pro-form@9149

@ant-design/pro-layout

npm i https://pkg.pr.new/@ant-design/pro-layout@9149

@ant-design/pro-list

npm i https://pkg.pr.new/@ant-design/pro-list@9149

@ant-design/pro-provider

npm i https://pkg.pr.new/@ant-design/pro-provider@9149

@ant-design/pro-skeleton

npm i https://pkg.pr.new/@ant-design/pro-skeleton@9149

@ant-design/pro-table

npm i https://pkg.pr.new/@ant-design/pro-table@9149

@ant-design/pro-utils

npm i https://pkg.pr.new/@ant-design/pro-utils@9149

commit: e0e4321

@rubbishmaker rubbishmaker changed the title feat: custom valuetypemap should not cull any props feat(ProFiled): custom valuetypemap should not cull any props Jul 1, 2025
@chenshuai2144 chenshuai2144 merged commit 6c09de8 into ant-design:master Jul 17, 2025
10 of 11 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants