feat: add resizable drawer feature#527
feat: add resizable drawer feature#527QdabuliuQ wants to merge 5 commits intoreact-component:antd-5.xfrom
Conversation
|
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 ✨ Finishing Touches🧪 Generate unit tests
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. 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed help? Create a ticket on our support page for assistance with any issues or questions. CodeRabbit Commands (Invoked using PR/Issue comments)Type Other keywords and placeholders
CodeRabbit Configuration File (
|
|
@QdabuliuQ is attempting to deploy a commit to the React Component Team on Vercel. A member of the Team first needs to authorize it. |
| mask?: React.CSSProperties; | ||
| wrapper?: React.CSSProperties; | ||
| content?: React.CSSProperties; | ||
| resizableLine?: React.CSSProperties; |
There was a problem hiding this comment.
| onResize?: (size: number) => void; | ||
| onResizeStart?: () => void; | ||
| onResizeEnd?: () => void; |
There was a problem hiding this comment.
不确定是否需要一开始暴露这么多回调,看看大佬们怎么说~ 也可以说说你的想法
There was a problem hiding this comment.
是的嘞,我觉得有必要暴露出去,因为 antd/drawer 组件使用的时候需要监听到 start / end 事件,取消 / 恢复 transition 过渡 antd/drawer 宽度的样式,这样在拖拽的时候可以动态开启和关闭 transition 影响。
|
上面的问题都调整了,麻烦大佬们再看看~ |
| // Add global mouse event listeners during drag | ||
| document.addEventListener('mousemove', handleMouseMove); | ||
| document.addEventListener('mouseup', handleMouseUp); | ||
| document.body.style.cursor = isHorizontal ? 'col-resize' : 'row-resize'; |
There was a problem hiding this comment.
为啥是 body,如果 dom 不在 body 上呢
There was a problem hiding this comment.
这里是鼠标按住resizable 组件的后进入isDragging 状态,就给 body 监听鼠标移动和抬起事件,计算 drawer 的宽度的呀;dom 不在 body 也是可以正常计算的哩
|
辛苦了~ 感谢你的贡献,太感谢了。 |
|
#528 @thinkasany 新的 pr 合并到 master的~ |
参考一下 bot 的 cr 建议,有的好像是可以考虑的,然后明天帮你问问豆酱~ |





🤔 This is a ...
🔗 Related Issues
feat: ant-design/ant-design#54597
💡 Background and Solution
add resizable feature to Drawer component
add ResizableLine component to control the size of drawer
📝 Change Log