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

docs: fix attachments docs #619

Merged
merged 2 commits into from
Mar 20, 2025
Merged

docs: fix attachments docs #619

merged 2 commits into from
Mar 20, 2025

Conversation

kimteayon
Copy link
Collaborator

@kimteayon kimteayon commented Mar 18, 2025

修复文档格式冲突导致的api表格渲染错误

Summary by CodeRabbit

  • Documentation
    • 更新了附件卡片文档,明确说明移除操作的回调函数支持返回同步(布尔值)或异步(Promise)结果。
    • 简化了附件图片属性的说明,去除了多余的类型提示,提高了文档清晰度。

Copy link
Contributor

coderabbitai bot commented Mar 18, 2025

📝 Walkthrough

Walkthrough

此 PR 更新了 Attachments.FileCard Props 部分文档的类型定义。主要将 onRemove 属性的类型从 (item: Attachment) => boolean 修改为 (item: Attachment) => boolean | Promise,以便支持异步操作。同时,在英文文档中移除了 imageProps 属性的类型说明,提升了文档中对属性行为和预期返回值的描述清晰度。

Changes

文件 变更摘要
components/attachments/index.en-US.md,
components/attachments/index.zh-CN.md
onRemove 属性类型从 (item: Attachment) => boolean 更新为 (item: Attachment) => boolean | Promise
components/attachments/index.en-US.md 移除 imageProps 属性的类型说明(原类型为 ImageProps

Possibly related PRs

Suggested reviewers

  • afc163

Poem

我是一只跳跃的小兔子,齐来庆祝新变化,
onRemove 更新灵动,代码中闪耀新光彩。
imageProps悄然隐去,文档更显简洁雅,
在键盘上踏出轻盈步,字节世界乐逍遥。
快乐编程心飞扬,愿未来万象更新! 🐰✨

Tip

⚡🧪 Multi-step agentic review comment chat (experimental)
  • We're introducing multi-step agentic chat in review comments. This experimental feature enhances review discussions with the CodeRabbit agentic chat by enabling advanced interactions, including the ability to create pull requests directly from comments.
    - To enable this feature, set early_access to true under in the settings.

📜 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 4b5c9a3 and c18ce5a.

📒 Files selected for processing (1)
  • components/attachments/index.en-US.md (1 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • components/attachments/index.en-US.md

🪧 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 generate docstrings to generate docstrings 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

github-actions bot commented Mar 18, 2025

Preview is ready

Copy link

Walkthrough: 本次更改修复了由于文档格式冲突导致的 API 表格渲染错误,确保文档在中英文版本中正确显示。

Changes:

文件 概要
components/attachments/index.en-US.md, components/attachments/index.zh-CN.md 修复了 onRemoveimageProps 属性的类型定义问题,确保文档表格的正确渲染。

@@ -66,8 +66,8 @@ interface PlaceholderType {
| className | Style class name | string | - | - |
| style | Style Object | React.CSSProperties | - | - |
| item | Attachment, same as Upload `UploadFile` | Attachment | - | - |
| onRemove | A callback function, will be executed when removing file button is clicked, remove event will be prevented when the return value is false or a Promise which resolve(false) or reject | (item: Attachment) => boolean | Promise | - | - |
| imageProps | Image config, same as [Image](https://ant.design/components/image) | ImageProps | - | - |
| onRemove | A callback function, will be executed when removing file button is clicked, remove event will be prevented when the return value is false or a Promise which resolve(false) or reject | (item: Attachment) => boolean \| Promise | - | - |

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The type definition for onRemove has been corrected to include both boolean and Promise, ensuring accurate documentation.

| prefixCls | 样式类名的前缀 | string | - | - |
| className | 样式类名 | string | - | - |
| style | 样式对象 | React.CSSProperties | - | - |
| item | 附件,同 Upload `UploadFile` | Attachment | - | - |
| onRemove | 点击移除文件时的回调,返回值为 false 时不移除。支持返回一个 Promise 对象,Promise 对象 resolve(false) 或 reject 时不移除 | (item: Attachment) => boolean | Promise | - | - |
| onRemove | 点击移除文件时的回调,返回值为 false 时不移除。支持返回一个 Promise 对象,Promise 对象 resolve(false) 或 reject 时不移除 | (item: Attachment) => boolean \| Promise | - | - |

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

修正了 onRemove 的类型定义,现包括 booleanPromise,确保文档的准确性。

Copy link

codecov bot commented Mar 18, 2025

Bundle Report

Changes will increase total bundle size by 22 bytes (0.02%) ⬆️. This is within the configured threshold ✅

Detailed changes
Bundle name Size Change
antdx-array-push 134.8kB 22 bytes (0.02%) ⬆️

Affected Assets, Files, and Routes:

view changes for bundle: antdx-array-push

Assets Changed:

Asset Name Size Change Total Size Change (%)
antdx.min.js 22 bytes 134.8kB 0.02%

Copy link

codecov bot commented Mar 18, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 91.88%. Comparing base (a4a9a0d) to head (c18ce5a).
Report is 5 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #619      +/-   ##
==========================================
+ Coverage   91.81%   91.88%   +0.06%     
==========================================
  Files          67       67              
  Lines        1466     1466              
  Branches      372      388      +16     
==========================================
+ Hits         1346     1347       +1     
+ Misses        120      119       -1     

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

🚀 New features to boost your workflow:
  • Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

📜 Review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between a4a9a0d and 4b5c9a3.

📒 Files selected for processing (2)
  • components/attachments/index.en-US.md (1 hunks)
  • components/attachments/index.zh-CN.md (1 hunks)
⏰ Context from checks skipped due to timeout of 90000ms (1)
  • GitHub Check: test / react component workflow
🔇 Additional comments (2)
components/attachments/index.zh-CN.md (1)

67-73: 更新 onRemove 属性类型
已将 onRemove 的返回类型更新为 (item: Attachment) => boolean | Promise,这可以更好支持异步操作,符合业务需求。请确认相关文档描述与实现保持一致。

components/attachments/index.en-US.md (1)

69-69: 确认 onRemove 属性类型更新
已将 onRemove 的类型更新为 (item: Attachment) => boolean | Promise,满足新要求。

| onRemove | A callback function, will be executed when removing file button is clicked, remove event will be prevented when the return value is false or a Promise which resolve(false) or reject | (item: Attachment) => boolean | Promise | - | - |
| imageProps | Image config, same as [Image](https://ant.design/components/image) | ImageProps | - | - |
| onRemove | A callback function, will be executed when removing file button is clicked, remove event will be prevented when the return value is false or a Promise which resolve(false) or reject | (item: Attachment) => boolean \| Promise | - | - |
| imageProps | Image config, same as [Image](https://ant.design/components/image) | | ImageProps | - | - |
Copy link
Contributor

@coderabbitai coderabbitai bot Mar 18, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🛠️ Refactor suggestion

检查 imageProps 行的表格格式
目前这行记录显示了多余的文本 "ImageProps",导致表格列数与标题不匹配。根据 PR 目标,应移除该类型说明,使得 “类型” 栏为空,从而避免渲染错误。
建议应用以下 diff 修正格式:

-| imageProps | Image config, same as [Image](https://ant.design/components/image) |  | ImageProps | - | - |
+| imageProps | Image config, same as [Image](https://ant.design/components/image) |  | - | - |
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
| imageProps | Image config, same as [Image](https://ant.design/components/image) | | ImageProps | - | - |
| imageProps | Image config, same as [Image](https://ant.design/components/image) | | - | - |

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这里多了一个 |

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@afc163 您说得对,确实有一个多余的 |。应该是这样修改:

| imageProps | Image config, same as [Image](https://ant.design/components/image) | | - | - |

这样就只有5列,符合表格的标题结构:Property、Description、Type、Default、Version。

---

✏️ Learnings added
Learnt from: afc163
PR: ant-design/x#619
File: components/attachments/index.en-US.md:70-70
Timestamp: 2025-03-18T13:46:36.177Z
Learning: 在 Markdown 表格中,列的数量由分隔符 `|` 决定,需要确保表格的每一行中分隔符数量与表头一致,否则会导致渲染错误。

Note: Learnings are effective only in the context of similar code segments. To apply general coding guidelines, please configure review instructions. You can manage existing learnings in the app.

afc163
afc163 previously approved these changes Mar 18, 2025
@afc163 afc163 self-requested a review March 19, 2025 12:31
@afc163 afc163 dismissed their stale review March 19, 2025 12:31

这里多了一个 |

@afc163 afc163 merged commit 2d8c45e into ant-design:main Mar 20, 2025
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