feat(drawer): support boolean for resizable#55861
feat(drawer): support boolean for resizable#55861thinkasany merged 5 commits intoant-design:featurefrom
Conversation
|
|
👁 Visual Regression Report for PR #55861 Passed ✅
🎊 Congrats! No visual-regression diff found.
|
Summary of ChangesHello @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
Using Gemini Code AssistThe 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
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 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
|
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. Please check the settings in the CodeRabbit UI or the You can disable this status message by setting the Note Other AI code review bot(s) detectedCodeRabbit 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. 📝 WalkthroughSummary by CodeRabbit
✏️ Tip: You can customize this high-level summary in your review settings. 概览Drawer 组件的 变更
估计代码审查工作量🎯 2 (简单) | ⏱️ ~8 分钟
诗
Pre-merge checks and finishing touches✅ Passed checks (3 passed)
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. Comment |
There was a problem hiding this comment.
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; |
There was a problem hiding this comment.
There was a problem hiding this comment.
Actionable comments posted: 0
🧹 Nitpick comments (1)
components/drawer/index.tsx (1)
45-45:resizableAPI 扩展整体合理,但需要确认底层 RcDrawer 类型是否同步更新
- 把
DrawerProps.resizable扩展为boolean | DrawerResizableConfig,配合...(resizable ? { resizable } : {})透传到RcDrawer,整体语义清晰:
true:启用可拖拽,使用默认配置;DrawerResizableConfig:启用并附带回调;false/undefined:不传resizable,保持关闭状态。- 这种按 truthy 透传的方式也避免了把
false显式传给RcDrawer,行为上基本等价于「不开启」,和文档默认值-一致。建议 / 需要确认的点:
确认
@rc-component/drawer的resizable类型是否已经扩展为boolean | ResizableConfig。
否则当前实现会把boolean直接传给RcDrawer,在 TS 类型或运行时上都有潜在不一致:
- TS 层面:
RcDrawerProps['resizable']如果仍是纯ResizableConfig,这里会有类型不匹配;- 运行时:如果内部仅按对象处理
resizable,传入true可能导致判断分支不符合预期。如果未来存在「配置层面默认开启 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
📒 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 Report✅ All modified and coverable lines are covered by tests. ❌ 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. 🚀 New features to boost your workflow:
|
|
ci 好像挂了 |
类型冲突了,需要更新rc-drawer的版本了,rc-drawer已经支持了boolean |
|
发到 feature 分支 |
More templates
commit: |
Bundle ReportChanges will decrease total bundle size by 25.9kB (-0.66%) ⬇️. This is within the configured threshold ✅ Detailed changes
Affected Assets, Files, and Routes:view changes for bundle: antd.min-array-pushAssets Changed:
|
Signed-off-by: thinkasany <480968828@qq.com>
Signed-off-by: thinkasany <480968828@qq.com>


feat: #55846
中文版模板 / Chinese template
🤔 This is a ...
🔗 Related Issues
💡 Background and Solution
📝 Change Log