Skip to content

Conversation

FlowerBlackG
Copy link
Contributor

@FlowerBlackG FlowerBlackG commented Oct 9, 2025

#3634

🤔 这个 PR 的性质是?

  • 日常 bug 修复
  • 新特性提交
  • 文档改进
  • 演示代码改进
  • 组件样式/交互改进
  • CI/CD 改进
  • 重构
  • 代码风格优化
  • 测试用例
  • 分支合并
  • 其他

🔗 相关 Issue

#3634

💡 需求背景和解决方案

Dialog 允许开发者设置边缘拖拽改变大小。

📝 更新日志

  • 本条 PR 不需要纳入 Changelog

☑️ 请求合并前的自查清单

⚠️ 请自检并全部勾选全部选项⚠️

  • 文档已补充或无须补充
  • 代码演示已提供或无须提供
  • TypeScript 定义已补充或无须补充
  • Changelog 已提供或无须提供

Copy link
Contributor

github-actions bot commented Oct 9, 2025

失败

Copy link

pkg-pr-new bot commented Oct 9, 2025

tdesign-react-demo

npm i https://pkg.pr.new/tdesign-react@3875

commit: 67bc72b

@RylanBot RylanBot requested a review from Copilot October 9, 2025 23:21
Copy link
Contributor

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR adds a sizeDraggable property to the Dialog component that allows users to resize dialogs by dragging their edges. The feature includes customizable size limits and integrates with the existing drag functionality.

  • Adds a new sizeDraggable prop with support for boolean or object configuration with size limits
  • Implements edge-based resizing with cursor feedback and collision detection
  • Integrates with existing dialog drag functionality to prevent conflicts

Reviewed Changes

Copilot reviewed 8 out of 8 changed files in this pull request and generated 5 comments.

Show a summary per file
File Description
packages/components/hooks/useMouseEvent.ts Adds alwaysEmitOnMove option to emit mouse events even when not actively dragging
packages/components/dialog/type.ts Defines the sizeDraggable prop and DialogSizeDragLimit interface
packages/components/dialog/hooks/useDialogResize.ts New hook implementing the resize functionality with edge detection and size constraints
packages/components/dialog/hooks/useDialogDrag.ts Updates drag hook to avoid conflicts with resize functionality
packages/components/dialog/dialog.md Chinese documentation for the new prop
packages/components/dialog/dialog.en-US.md English documentation for the new prop
packages/components/dialog/defaultProps.ts Sets default value for sizeDraggable to false
packages/components/dialog/Dialog.tsx Integrates resize hook and prevents overlay clicks during resize

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.


const minWidth = React.useRef(0);
const maxWidth = React.useRef(Number.MAX_VALUE);
const minHeight = React.useRef<number|undefined>(undefined); // If undefined, set to current height on first drag (lower than which causes buttons overflow).
Copy link

Copilot AI Oct 9, 2025

Choose a reason for hiding this comment

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

Missing space after pipe character in type annotation.

Suggested change
const minHeight = React.useRef<number|undefined>(undefined); // If undefined, set to current height on first drag (lower than which causes buttons overflow).
const minHeight = React.useRef<number | undefined>(undefined); // If undefined, set to current height on first drag (lower than which causes buttons overflow).

Copilot uses AI. Check for mistakes.

if (sizeDraggableProps === undefined || typeof sizeDraggableProps === 'boolean') {
minWidth.current = undefined;
maxWidth.current = Number.MAX_VALUE;
minHeight.current = 0;
Copy link

Copilot AI Oct 9, 2025

Choose a reason for hiding this comment

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

Inconsistent handling of undefined values. Line 72 sets minWidth.current = undefined but line 74 sets minHeight.current = 0. Both should handle undefined consistently or there should be a clear reason for the difference.

Suggested change
minHeight.current = 0;
minHeight.current = undefined;

Copilot uses AI. Check for mistakes.

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.

1 participant