Skip to content

Commit

Permalink
fix(check-cascader): 修复 checkedMode="PARENT"模式下搜索后子节点无法选中问题 (#2992)
Browse files Browse the repository at this point in the history
  • Loading branch information
zyprepare committed Sep 11, 2024
1 parent 5384275 commit 2f462c4
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 1 deletion.
5 changes: 5 additions & 0 deletions .changeset/grumpy-tips-peel.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@hi-ui/check-cascader": patch
---

fix: 修复 checkedMode="PARENT"模式下搜索后子节点无法选中问题
5 changes: 5 additions & 0 deletions .changeset/silver-bulldogs-provide.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@hi-ui/hiui": patch
---

fix(check-cascader): 修复 checkedMode="PARENT"模式下搜索后子节点无法选中问题
1 change: 1 addition & 0 deletions packages/ui/check-cascader/src/CheckCascader.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -291,6 +291,7 @@ export const CheckCascader = forwardRef<HTMLDivElement | null, CheckCascaderProp
flatted={flatted || !!searchValue}
// @ts-ignore
flattedData={selectProps.data}
originalFlattedData={flattedData}
data={cascaderData}
onChangeData={setCascaderData}
checkedMode={checkedMode}
Expand Down
8 changes: 7 additions & 1 deletion packages/ui/check-cascader/src/CheckCascaderMenuList.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ export const CheckCascaderMenuList = forwardRef<HTMLDivElement | null, CascaderM
children,
data,
flattedData,
originalFlattedData,
onChangeData,
value: valueProp,
defaultValue = NOOP_ARRAY,
Expand Down Expand Up @@ -59,7 +60,7 @@ export const CheckCascaderMenuList = forwardRef<HTMLDivElement | null, CascaderM
const [onOptionCheck, isCheckedId, isSemiCheckedId] = useCheck(
checkedMode,
disabled,
flattedData,
originalFlattedData,
defaultValue,
valueProp,
({ checkedIds, semiCheckedIds }, target, shouldChecked) => {
Expand Down Expand Up @@ -164,6 +165,11 @@ export interface CascaderMenusProps {
* 设置选择项数据源
*/
flattedData: FlattedCheckCascaderDataItem[]
/**
* 未被过滤的选择项数据源,Hotfix:https://github.com/XiaoMi/hiui/issues/2992
* @private
*/
originalFlattedData: FlattedCheckCascaderDataItem[]
/**
* 设置当前多选值
*/
Expand Down

0 comments on commit 2f462c4

Please sign in to comment.