Skip to content

feat(select): add option removal handling for multiple selection #3526

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

Merged

Conversation

QuentinHsu
Copy link
Contributor

🤔 这个 PR 的性质是?

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

🔗 相关 Issue

ref #3522

💡 需求背景和解决方案

当多选时

  1. 修复取消勾选时的 trigger 赋值。
  2. context.trigger === 'uncheck'remove 事件回调函数存在时触发 remove 事件回调。

📝 更新日志

feat(select): 取消勾选面板中的已选项时触发 remove 事件回调

  • 本条 PR 不需要纳入 Changelog

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

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

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

Copy link

pkg-pr-new bot commented Apr 26, 2025

Open in StackBlitz

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

commit: d8e142c

Copy link
Contributor

github-actions bot commented Apr 26, 2025

完成

@HaixingOoO HaixingOoO requested a review from Copilot April 27, 2025 01:08
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 implements the removal handling for multiple selections by triggering a remove event callback when an option is unchecked. It updates the type definitions for removal contexts, adds removal callback handling in the Select component, and adjusts the trigger logic in PopupContent to distinguish between check and uncheck events.

Reviewed Changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.

File Description
packages/components/select/type.ts Updated type definitions for removal contexts with expanded event types
packages/components/select/base/Select.tsx Added handling for triggering the remove event on uncheck in multiple mode
packages/components/select/base/PopupContent.tsx Modified the onChange trigger logic to toggle between 'check' and 'uncheck' based on selection
Comments suppressed due to low confidence (1)

packages/components/select/base/Select.tsx:260

  • [nitpick] Consider renaming the variable 'value' in this removal block to avoid confusion with the prop 'value'. For example, use 'removedValue' to clearly indicate its purpose in the removal context.
const value = context?.value;

@uyarn uyarn merged commit 60d800b into Tencent:develop Apr 28, 2025
9 checks passed
@github-actions github-actions bot mentioned this pull request Apr 28, 2025
16 tasks
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.

3 participants