diff --git a/.changeset/perfect-swans-draw.md b/.changeset/perfect-swans-draw.md new file mode 100644 index 000000000..21c94b3f3 --- /dev/null +++ b/.changeset/perfect-swans-draw.md @@ -0,0 +1,8 @@ +--- +"@hi-ui/hiui": patch +--- + +fix(tree-select): 修复 keyword 设置后数据没有过滤的问题 +fix(check-tree-select): 修复 keyword 设置后数据没有过滤的问题 +fix(cascader): 修复 keyword 设置后数据没有过滤的问题 +fix(check-cascader): 修复 keyword 设置后数据没有过滤的问题 diff --git a/.changeset/selfish-apricots-applaud.md b/.changeset/selfish-apricots-applaud.md new file mode 100644 index 000000000..ba7e4f78b --- /dev/null +++ b/.changeset/selfish-apricots-applaud.md @@ -0,0 +1,5 @@ +--- +"@hi-ui/check-tree-select": patch +--- + +fix: 修复 keyword 设置后数据没有过滤的问题 diff --git a/.changeset/yellow-chicken-shout.md b/.changeset/yellow-chicken-shout.md new file mode 100644 index 000000000..5eaee1f7b --- /dev/null +++ b/.changeset/yellow-chicken-shout.md @@ -0,0 +1,7 @@ +--- +"@hi-ui/cascader": patch +"@hi-ui/check-cascader": patch +"@hi-ui/tree-select": patch +--- + +fix: 修复 keyword 设置后数据没有过滤的问题 diff --git a/packages/ui/cascader/src/Cascader.tsx b/packages/ui/cascader/src/Cascader.tsx index 30a7d678e..7f0fefb32 100644 --- a/packages/ui/cascader/src/Cascader.tsx +++ b/packages/ui/cascader/src/Cascader.tsx @@ -46,6 +46,7 @@ export const Cascader = forwardRef((props, invalid, filterOption, searchable: searchableProp, + keyword: keywordProp, onSearch: onSearchProp, render: titleRender, overlayClassName, @@ -134,6 +135,7 @@ export const Cascader = forwardRef((props, keyword: searchValue, } = useSearchMode({ searchable: searchableProp, + keyword: keywordProp, strategies: [customSearchStrategy, upMatchSearchStrategy], }) @@ -236,6 +238,7 @@ export const Cascader = forwardRef((props, searchable={searchable} scrollable={false} footer={isFunction(renderExtraFooter) && renderExtraFooter()} + keyword={keywordProp} onSearch={callAllFuncs(onSearchProp, onSearch)} trigger={ customRender ? ( diff --git a/packages/ui/check-cascader/src/CheckCascader.tsx b/packages/ui/check-cascader/src/CheckCascader.tsx index 6f8acb8a8..231c7cb05 100644 --- a/packages/ui/check-cascader/src/CheckCascader.tsx +++ b/packages/ui/check-cascader/src/CheckCascader.tsx @@ -66,6 +66,7 @@ export const CheckCascader = forwardRef { return matchUp(item) }, []) + const [keyword, setKeyword] = React.useState('小米') + return ( <>

Searchable

@@ -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) diff --git a/packages/ui/tree-select/src/TreeSelect.tsx b/packages/ui/tree-select/src/TreeSelect.tsx index 421fc5394..27e1c70e4 100644 --- a/packages/ui/tree-select/src/TreeSelect.tsx +++ b/packages/ui/tree-select/src/TreeSelect.tsx @@ -60,6 +60,7 @@ export const TreeSelect = forwardRef( onLoadChildren, render: titleRender, filterOption, + keyword: keywordProp, onSearch: onSearchProp, // ********* popper ********* // // optionWidth, @@ -182,6 +183,7 @@ export const TreeSelect = forwardRef( keyword: searchValue, } = useSearchMode({ searchable: searchableProp, + keyword: keywordProp, strategies: [ dataSourceStrategy, customSearchStrategy, @@ -244,6 +246,7 @@ export const TreeSelect = forwardRef( // onChange={tryChangeValue} // data={mergedData} searchable={searchable} + keyword={keywordProp} onSearch={callAllFuncs(onSearchProp, onSearch)} loading={rest.loading !== undefined ? rest.loading : loading} trigger={