Skip to content

feat(select): support checkAll in filterable mode #3516

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 5 commits into
base: develop
Choose a base branch
from

Conversation

huangchen1031
Copy link
Collaborator

🤔 这个 PR 的性质是?

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

🔗 相关 Issue

💡 需求背景和解决方案

Select组件在filterable模式下需要支持checkAll属性

📝 更新日志

feat(select): filterable模式下支持checkAll

  • 本条 PR 不需要纳入 Changelog

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

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

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

Copy link

pkg-pr-new bot commented Apr 23, 2025

Open in StackBlitz

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

commit: d43b67a

Copy link
Contributor

github-actions bot commented Apr 23, 2025

完成

@HaixingOoO HaixingOoO requested a review from Copilot April 23, 2025 02:32
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 support for the checkAll feature when the Select component is in filterable mode.

  • In Select.tsx, the input value is reset when applicable.
  • In PopupContent.tsx, checkAllStatus is computed with useMemo and passed to child options.
  • In Option.tsx, selection logic is updated to use checkAllStatus when checkAll is enabled.

Reviewed Changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.

File Description
packages/components/select/base/Select.tsx Resets input value when reserveKeyword is false in filterable mode.
packages/components/select/base/PopupContent.tsx Introduces memoized checkAllStatus for managing select-all state.
packages/components/select/base/Option.tsx Updates multi-select logic to use checkAllStatus for checkAll options.

Copy link
Collaborator

@uyarn uyarn left a comment

Choose a reason for hiding this comment

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

预期点击全选,会需要保留之前已选的选项,目前的实现,会把之前的已选项都清空

@huangchen1031
Copy link
Collaborator Author

预期点击全选,会需要保留之前已选的选项,目前的实现,会把之前的已选项都清空

补充了过滤时的逻辑,全选时合并、取消全选时排除

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants