Skip to content

fix(upload): expand the scope of the click event of theme="display" to the entire card area #3606

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from

Conversation

RSS1102
Copy link
Collaborator

@RSS1102 RSS1102 commented Jun 6, 2025

chore: 上传事件添加 stopPropagation

🤔 这个 PR 的性质是?

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

🔗 相关 Issue

sync Tencent/tdesign-vue-next#5575

💡 需求背景和解决方案

📝 更新日志

  • fix(upload): 将 theme="display" 的点击事件触发范围扩大至整个卡片区域

  • 本条 PR 不需要纳入 Changelog

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

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

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

… to the entire card area

chore: 上传事件添加 `stopPropagation`
Copy link

pkg-pr-new bot commented Jun 6, 2025

tdesign-react-demo

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

commit: bd6e63e

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 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?.();

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.

2 participants