Skip to content
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

fix(tree): check all items instead of uncheck them if indeterminate checkbox is clicked #4945

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.en-US.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
- Fix `n-upload`'s `data` prop type can't include `Blob` element.
- Fix `n-select` allows option to be created with existed label, closes [#4703](https://github.com/tusen-ai/naive-ui/issues/4703)
- Fix `n-upload`'s `render-icon` prop's type.
- Fix `n-tree` should check all items instead of uncheck all if indeterminate checkbox is clicked, closes [#4941](https://github.com/tusen-ai/naive-ui/issues/4941).

### Features

Expand Down
1 change: 1 addition & 0 deletions CHANGELOG.zh-CN.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
- 修复 `n-upload` 的 `data` 属性类型不能包含 `Blob` 元素
- 修复 `n-select` 动态添加选项时,可以添加已存在的选项,关闭 [#4703](https://github.com/tusen-ai/naive-ui/issues/4703)
- 修复 `n-upload` `render-icon` 属性的类型
- 修复 `n-tree` 在级联选择下点击半选状态勾选框时应选中全部而不是清空已选,关闭 [#4941](https://github.com/tusen-ai/naive-ui/issues/4941)

### Features

Expand Down
1 change: 1 addition & 0 deletions src/tree/demos/zhCN/cascade.demo.vue
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
block-line
cascade
checkable
:selectable="false"
:data="data"
:default-expanded-keys="defaultExpandedKeys"
:default-checked-keys="defaultCheckedKeys"
Expand Down
6 changes: 1 addition & 5 deletions src/tree/src/TreeNodeCheckbox.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,7 @@ export default defineComponent({
}
}
function handleUpdateValue (value: boolean): void {
if (props.indeterminate) {
doCheck(false)
} else {
doCheck(value)
}
doCheck(value)
}
return {
handleUpdateValue,
Expand Down