-
Notifications
You must be signed in to change notification settings - Fork 360
fix(Select): improved label filtering #3891
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
base: develop
Are you sure you want to change the base?
Conversation
commit: |
fc47b2a to
8ec8e7d
Compare
There was a problem hiding this 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 improves label filtering functionality in the Select component and related components (SelectInput, Cascader, TreeSelect), fixing several issues with custom node rendering and input behavior.
Key Changes:
- Fixed errors when filtering Select options with custom label nodes (ReactElements)
- Fixed rendering issues for custom content in Select dropdown options
- Improved single-selection input value display for SelectInput when labels are custom nodes
- Fixed
inputProps.inputClassnot being applied correctly
Reviewed Changes
Copilot reviewed 9 out of 9 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
packages/components/select/base/Select.tsx |
Added extractTextFromTNode utility to enable filtering custom label nodes; fixed type annotations |
packages/components/select/base/Option.tsx |
Added auto-height styling for custom element content; removed unreachable return statement |
packages/components/select/_example/custom-options.tsx |
Refactored demo to show both slot-based and content attribute approaches for custom options |
packages/components/select-input/useSingle.tsx |
Refactored single-select value display logic to properly render custom label nodes with absolute positioning |
packages/components/_util/parseTNode.ts |
Added extractTextFromTNode utility function to recursively extract text from TNode structures |
packages/components/tree-select/TreeSelect.tsx |
Simplified input value logic by removing redundant display handling code |
test/snap/__snapshots__/ssr.test.jsx.snap |
Updated snapshots to reflect DOM structure changes |
test/snap/__snapshots__/csr.test.jsx.snap |
Updated snapshots to reflect DOM structure changes |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
9d1f8c9 to
ba42885
Compare

🤔 这个 PR 的性质是?
🔗 相关 Issue
💡 需求背景和解决方案
Select:(历史相关 PR:#973 (comment))label只要不是string,哪怕不是TNode,是纯数字或者布尔也会出问题Cascader:(右边为当前效果... Input 框的撑开高度交给用户自己设置
inputClass更加自由,下拉框的选项高度,通过组件库主动给高度设为auto比较合理)📝 更新日志
fix(Select): 修复
label为非string类型时,开启filterable搜索后报错的问题fix(Select): 修复使用
label/content/children自定义元素时,下拉框选项的高度没有撑开的问题fix(SelectInput): 修复
inputProps.inputClass无法生效的问题fix(SelectInput): 修复单选且
valueDisplay为自定义元素时,开启filterable无法显示输入内容的问题本条 PR 不需要纳入 Changelog
☑️ 请求合并前的自查清单