Skip to content

Conversation

@RSS1102
Copy link
Collaborator

@RSS1102 RSS1102 commented Jun 6, 2025

chore: 上传事件添加 stopPropagation

🤔 这个 PR 的性质是?

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

🔗 相关 Issue

sync Tencent/tdesign-vue-next#5575

💡 需求背景和解决方案

此次更改是为了让用户可以在点击这个区域都可以触发上传文件事件,避免用户点击操作触发上传事件困难。

image

📝 更新日志

  • feat(Upload): 扩大 draggable 的点击事件触发热区至整个卡片区域

  • 本条 PR 不需要纳入 Changelog

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

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

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

… to the entire card area

chore: 上传事件添加 `stopPropagation`
@pkg-pr-new
Copy link

pkg-pr-new bot commented Jun 6, 2025

tdesign-react-demo

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

commit: a3d730b

@github-actions
Copy link
Contributor

github-actions bot commented Jun 6, 2025

完成

@HaixingOoO HaixingOoO requested a review from Copilot June 9, 2025 01:02
Copy link
Contributor

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 expands the clickable area for the "display" theme in the upload component, ensuring that the click event is triggered correctly across the entire card area and that event propagation is properly controlled.

  • Updated triggerUpload definitions in several components to accept a MouseEvent parameter.
  • Added an onClick handler in the DraggerFile component and updated the useUpload hook to stop event propagation.

Reviewed Changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated no comments.

File Description
packages/components/upload/themes/ImageCard.tsx Updated triggerUpload’s signature to include the event parameter.
packages/components/upload/themes/DraggerFile.tsx Added onClick handler and updated triggerUpload’s type and usage with proper memoization.
packages/components/upload/themes/CustomFile.tsx Updated triggerUpload’s signature to include the event parameter with React-specific typing.
packages/components/upload/hooks/useUpload.ts Modified triggerUpload to accept an optional event parameter and stop its propagation.
Comments suppressed due to low confidence (2)

packages/components/upload/themes/CustomFile.tsx:13

  • Ensure consistent event types for triggerUpload across components. Currently, CustomFile.tsx uses React.MouseEvent while other components (e.g., ImageCard.tsx and DraggerFile.tsx) use MouseEvent; consider unifying these types to avoid potential type mismatches.
triggerUpload?: (e: React.MouseEvent<HTMLDivElement>) => void;

packages/components/upload/hooks/useUpload.ts:345

  • Consider standardizing the event type for the triggerUpload function here. If the UI components expect a React.MouseEvent, align this hook's event type accordingly.
e?.stopPropagation?.();

@uyarn
Copy link
Collaborator

uyarn commented Aug 1, 2025

theme=display?

@uyarn uyarn requested a review from HaixingOoO August 1, 2025 07:14
@RSS1102 RSS1102 changed the title fix(upload): expand the scope of the click event of theme="display" to the entire card area fix(upload): expand the scope of the click event of theme="file" to the entire card area Aug 1, 2025
@RSS1102 RSS1102 changed the title fix(upload): expand the scope of the click event of theme="file" to the entire card area fix(upload): expand the scope of the click event of draggable to the entire card area Aug 1, 2025
@RSS1102
Copy link
Collaborator Author

RSS1102 commented Aug 1, 2025

theme=display?

已更改,看是否需要二次修改更新日志

@RSS1102 RSS1102 changed the title fix(upload): expand the scope of the click event of draggable to the entire card area feat(upload): expand the scope of the click event of draggable to the entire card area Aug 7, 2025
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.

4 participants