Skip to content

feat(drawer): support boolean for resizable#55861

Merged
thinkasany merged 5 commits intoant-design:featurefrom
cactuser-Lu:support-boolean-for-drawer-resizable
Nov 25, 2025
Merged

feat(drawer): support boolean for resizable#55861
thinkasany merged 5 commits intoant-design:featurefrom
cactuser-Lu:support-boolean-for-drawer-resizable

Conversation

@cactuser-Lu
Copy link
Copy Markdown
Contributor

@cactuser-Lu cactuser-Lu commented Nov 24, 2025

feat: #55846

中文版模板 / Chinese template

🤔 This is a ...

  • 🆕 New feature
  • 🐞 Bug fix
  • 📝 Site / documentation improvement
  • 📽️ Demo improvement
  • 💄 Component style improvement
  • 🤖 TypeScript definition improvement
  • 📦 Bundle size optimization
  • ⚡️ Performance optimization
  • ⭐️ Feature enhancement
  • 🌐 Internationalization
  • 🛠 Refactoring
  • 🎨 Code style optimization
  • ✅ Test Case
  • 🔀 Branch merge
  • ⏩ Workflow
  • ⌨️ Accessibility improvement
  • ❓ Other (about what?)

🔗 Related Issues

  • Describe the source of related requirements, such as links to relevant issue discussions.
  • For example: close #xxxx, fix #xxxx

💡 Background and Solution

  • The specific problem to be addressed.
  • List the final API implementation and usage if needed.
  • If there are UI/interaction changes, consider providing screenshots or GIFs.

📝 Change Log

Language Changelog
🇺🇸 English support boolean for resizable
🇨🇳 Chinese 增加resizable的布尔类型

@bolt-new-by-stackblitz
Copy link
Copy Markdown

Review PR in StackBlitz Codeflow Run & review this pull request in StackBlitz Codeflow.

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Nov 24, 2025

Preview is ready

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Nov 24, 2025

👁 Visual Regression Report for PR #55861 Passed ✅

🎯 Target branch: feature (ec44ee3)
📖 View Full Report ↗︎
📖 Alternative Report ↗︎

🎊 Congrats! No visual-regression diff found.

@gemini-code-assist
Copy link
Copy Markdown
Contributor

Summary of Changes

Hello @cactuser-Lu, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request introduces a new capability for the Drawer component, allowing developers to control its resizable behavior using a straightforward boolean value. This enhancement simplifies the API for common use cases while maintaining the flexibility of advanced configuration options.

Highlights

  • Drawer Component Resizable Prop: The resizable prop for the Drawer component now supports a boolean type, allowing for simpler enablement or disablement of the resizing feature.
  • TypeScript Definition Update: The TypeScript definition for the resizable prop in DrawerProps has been updated to include boolean as a valid type, alongside the existing DrawerResizableConfig.
  • Documentation Updates: Both English and Chinese documentation for the Drawer component have been updated to reflect the new boolean type support for the resizable prop.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Nov 24, 2025

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Note

Other AI code review bot(s) detected

CodeRabbit has detected other AI code review bot(s) in this pull request and will avoid duplicating their findings in the review comments. This may lead to a less comprehensive review.

📝 Walkthrough

Summary by CodeRabbit

  • 功能增强
    • Drawer组件的resizable属性现在支持布尔值参数,用户可以通过简单的true/false开关来启用或禁用可调整大小功能,同时仍保持使用详细配置选项的能力。

✏️ Tip: You can customize this high-level summary in your review settings.

概览

Drawer 组件的 resizable 属性类型扩展,现在同时接受布尔值和 ResizableConfig 配置对象。在 TypeScript 类型定义和英文、中文 API 文档中进行了对应更新。

变更

文件群 / 文件 变更摘要
API 文档和类型定义更新
components/drawer/index.tsx, components/drawer/index.en-US.md, components/drawer/index.zh-CN.md
resizable 属性的类型签名从 DrawerResizableConfig / [ResizableConfig](#resizableconfig) 更新为 boolean | DrawerResizableConfig / boolean | [ResizableConfig](#resizableconfig),允许直接传递布尔值来启用/禁用调整大小功能

估计代码审查工作量

🎯 2 (简单) | ⏱️ ~8 分钟

  • 变更范围小且重复性强,仅涉及一个属性的类型扩展
  • 三个文件的改动基本相同,都是同一个属性的类型变化
  • 需要确认类型扩展是否有相应的实现逻辑支持

🐰 抽屉调整尺寸今日启新程,
布尔值轻轻,配置从容行,
类型展开如春风拂去旧纹,
灵活如我,简约亦深厚真。
文档齐心,代码同歌声~ 🎉

Pre-merge checks and finishing touches

✅ Passed checks (3 passed)
Check name Status Explanation
Description check ✅ Passed 描述内容与改动相关,参考了相关的Issue并包含了变更日志信息,虽然内容相对简洁但确实描述了功能的目的。
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Title check ✅ Passed 标题准确概括了该拉取请求的主要变更:扩展了 Drawer 组件的 resizable 属性以支持布尔类型。

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

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown
Contributor

@gemini-code-assist gemini-code-assist Bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request introduces boolean support for the resizable prop on the Drawer component, allowing it to be enabled with default settings by passing true. The changes to the component's props and documentation are clear and correct. However, the pull request is missing test cases to validate this new functionality. I've added a comment to suggest adding tests to ensure the feature is robust.

Omit<DrawerPanelProps, 'prefixCls' | 'ariaId'> {
size?: sizeType | number;
resizable?: DrawerResizableConfig;
resizable?: boolean | DrawerResizableConfig;
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

high

While adding boolean support for the resizable prop is a good feature, it's crucial to accompany new functionality with corresponding tests. Please add test cases to cover the scenarios where resizable is set to true and false, to ensure correctness and prevent future regressions.

Copy link
Copy Markdown
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: 0

🧹 Nitpick comments (1)
components/drawer/index.tsx (1)

45-45: resizable API 扩展整体合理,但需要确认底层 RcDrawer 类型是否同步更新

  • DrawerProps.resizable 扩展为 boolean | DrawerResizableConfig,配合 ...(resizable ? { resizable } : {}) 透传到 RcDrawer,整体语义清晰:
    • true:启用可拖拽,使用默认配置;
    • DrawerResizableConfig:启用并附带回调;
    • false / undefined:不传 resizable,保持关闭状态。
  • 这种按 truthy 透传的方式也避免了把 false 显式传给 RcDrawer,行为上基本等价于「不开启」,和文档默认值 - 一致。

建议 / 需要确认的点:

  1. 确认 @rc-component/drawerresizable 类型是否已经扩展为 boolean | ResizableConfig
    否则当前实现会把 boolean 直接传给 RcDrawer,在 TS 类型或运行时上都有潜在不一致:

    • TS 层面:RcDrawerProps['resizable'] 如果仍是纯 ResizableConfig,这里会有类型不匹配;
    • 运行时:如果内部仅按对象处理 resizable,传入 true 可能导致判断分支不符合预期。
  2. 如果未来存在「配置层面默认开启 resizable」的场景(例如 ConfigProvider 或 context 中默认打开),那现在通过 ...(resizable ? { resizable } : {}) 无法用 resizable={false} 来「显式关闭上游默认值」,因为 false 会被过滤掉,相当于「不覆盖」。目前看 Drawer 没有从 context 读取 resizable,所以这一点现在不是问题,但可以在后续设计时注意。

如果 @rc-component/drawer 已经支持同样的 union 类型,那么这两处修改整体 LGTM。

Also applies to: 257-257

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 04fee95 and 92602ef.

📒 Files selected for processing (3)
  • components/drawer/index.en-US.md (1 hunks)
  • components/drawer/index.tsx (1 hunks)
  • components/drawer/index.zh-CN.md (1 hunks)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (15)
  • GitHub Check: test lib/es module (lib, 2/2)
  • GitHub Check: build
  • GitHub Check: test lib/es module (es, 2/2)
  • GitHub Check: test lib/es module (es, 1/2)
  • GitHub Check: test-react-latest (dom, 1/2)
  • GitHub Check: test-react-latest (dom, 2/2)
  • GitHub Check: lint
  • GitHub Check: test-node
  • GitHub Check: test-react-legacy (18, 2/2)
  • GitHub Check: test-react-legacy (18, 1/2)
  • GitHub Check: build preview
  • GitHub Check: build
  • GitHub Check: visual-diff snapshot (1/2)
  • GitHub Check: visual-diff snapshot (2/2)
  • GitHub Check: size
🔇 Additional comments (2)
components/drawer/index.en-US.md (1)

76-76: resizable 英文文档与实现一致,修改合理

Type 更新为 boolean | [ResizableConfig](#resizableconfig),与 DrawerProps.resizable?: boolean | DrawerResizableConfig; 保持一致,描述也无歧义,版本号仍为 6.0.0 合理。

components/drawer/index.zh-CN.md (1)

75-75: resizable 中文文档已与实现和英文文档对齐

类型更新为 boolean | [ResizableConfig](#resizableconfig),说明「是否启用拖拽改变尺寸」在布尔和配置两种用法下都说得通,和 TS 定义及英文文档保持一致,整体没有问题。

@codecov
Copy link
Copy Markdown

codecov Bot commented Nov 24, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 99.99%. Comparing base (da2ddb9) to head (052ee06).
⚠️ Report is 7 commits behind head on feature.

❌ Your project status has failed because the head coverage (99.99%) is below the target coverage (100.00%). You can increase the head coverage or adjust the target coverage.

Additional details and impacted files
@@             Coverage Diff             @@
##           feature   #55861      +/-   ##
===========================================
- Coverage    99.99%   99.99%   -0.01%     
===========================================
  Files          803      803              
  Lines        14892    14811      -81     
  Branches      3951     3913      -38     
===========================================
- Hits         14891    14810      -81     
  Misses           1        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.

@afc163 afc163 changed the title feat(drawer): support boolean for resizable type(drawer): support boolean for resizable Nov 25, 2025
@afc163
Copy link
Copy Markdown
Member

afc163 commented Nov 25, 2025

ci 好像挂了

@cactuser-Lu
Copy link
Copy Markdown
Contributor Author

ci 好像挂了

类型冲突了,需要更新rc-drawer的版本了,rc-drawer已经支持了boolean

@afc163
Copy link
Copy Markdown
Member

afc163 commented Nov 25, 2025

@afc163 afc163 changed the title type(drawer): support boolean for resizable feat(drawer): support boolean for resizable Nov 25, 2025
@afc163
Copy link
Copy Markdown
Member

afc163 commented Nov 25, 2025

发到 feature 分支

@thinkasany thinkasany changed the base branch from master to feature November 25, 2025 10:36
@pkg-pr-new
Copy link
Copy Markdown

pkg-pr-new Bot commented Nov 25, 2025

@socket-security
Copy link
Copy Markdown

socket-security Bot commented Nov 25, 2025

@codecov
Copy link
Copy Markdown

codecov Bot commented Nov 25, 2025

Bundle Report

Changes will decrease total bundle size by 25.9kB (-0.66%) ⬇️. This is within the configured threshold ✅

Detailed changes
Bundle name Size Change
antd.min-array-push 3.89MB -25.9kB (-0.66%) ⬇️

Affected Assets, Files, and Routes:

view changes for bundle: antd.min-array-push

Assets Changed:

Asset Name Size Change Total Size Change (%)
antd-with-locales.min.js -12.95kB 2.14MB -0.6%
antd.min.js -12.95kB 1.75MB -0.73%

Comment thread components/drawer/index.en-US.md Outdated
Comment thread components/drawer/index.zh-CN.md Outdated
Signed-off-by: thinkasany <480968828@qq.com>
Signed-off-by: thinkasany <480968828@qq.com>
@dosubot dosubot Bot added the lgtm This PR has been approved by a maintainer label Nov 25, 2025
@thinkasany thinkasany merged commit e5d7b12 into ant-design:feature Nov 25, 2025
37 of 38 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

lgtm This PR has been approved by a maintainer

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants