Skip to content

Commit

Permalink
fix(check-tree-select): 修复 keyword 设置后数据没有过滤的问题 (#2988)
Browse files Browse the repository at this point in the history
  • Loading branch information
zyprepare committed Sep 9, 2024
1 parent 878941f commit 283da32
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 0 deletions.
5 changes: 5 additions & 0 deletions .changeset/perfect-swans-draw.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@hi-ui/hiui": patch
---

fix(check-tree-select): 修复 keyword 设置后数据没有过滤的问题
5 changes: 5 additions & 0 deletions .changeset/selfish-apricots-applaud.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@hi-ui/check-tree-select": patch
---

fix: 修复 keyword 设置后数据没有过滤的问题
3 changes: 3 additions & 0 deletions packages/ui/check-tree-select/src/CheckTreeSelect.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,7 @@ export const CheckTreeSelect = forwardRef<HTMLDivElement | null, CheckTreeSelect
customRender,
prefix,
suffix,
keyword: keywordProp,
...rest
},
ref
Expand Down Expand Up @@ -223,6 +224,7 @@ export const CheckTreeSelect = forwardRef<HTMLDivElement | null, CheckTreeSelect
keyword: searchValue,
} = useSearchMode({
searchable: searchableProp,
keyword: keywordProp,
strategies: [
dataSourceStrategy,
customSearchStrategy,
Expand Down Expand Up @@ -349,6 +351,7 @@ export const CheckTreeSelect = forwardRef<HTMLDivElement | null, CheckTreeSelect
// onChange={tryChangeValue}
// data={mergedData}
searchable={searchable}
keyword={keywordProp}
onSearch={callAllFuncs(onSearchProp, onSearch)}
footer={renderDefaultFooter()}
loading={rest.loading !== undefined ? rest.loading : loading}
Expand Down
4 changes: 4 additions & 0 deletions packages/ui/check-tree-select/stories/searchable.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,8 @@ export const Searchable = () => {
return matchUp(item)
}, [])

const [keyword, setKeyword] = React.useState('小米')

return (
<>
<h1>Searchable</h1>
Expand All @@ -132,6 +134,8 @@ export const Searchable = () => {
style={{ width: 240 }}
data={data}
searchable
keyword={keyword}
onSearch={setKeyword}
searchMode="filter"
onChange={(checkedIds, options) => {
console.log('CheckTreeSelect onChange: ', checkedIds, options)
Expand Down

0 comments on commit 283da32

Please sign in to comment.