Skip to content

Commit

Permalink
fix(data-table): selectable when loading (#1815)
Browse files Browse the repository at this point in the history
* fix: table can selete when loading

* Update CHANGELOG.zh-CN.md

Co-authored-by: 07akioni <[email protected]>
  • Loading branch information
Talljack and 07akioni authored Dec 12, 2021
1 parent 39a0608 commit f15a1b3
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 2 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.en-US.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@

- Fix `n-alert`'s `header` slot unable to display normally.
- Fix `n-data-table`'s pagination `onUpdatePageSize` prop does't trigger, closes [#1774](https://github.com/TuSimple/naive-ui/issues/1774).
- Fix `n-data-table` can select rows when table is loading, closes [#1812](https://github.com/TuSimple/naive-ui/issues/1812).
- Fix `n-tag` line-height is too low that clamps the content.
- Fix `n-select` displays with mistake in input if `filterable` is `true`, closes [#1823](https://github.com/TuSimple/naive-ui/issues/1823).
- Fix `n-page-header`'s content has margin-top when header is not displayed, closes [#1795](https://github.com/TuSimple/naive-ui/issues/1795).
Expand Down
1 change: 1 addition & 0 deletions CHANGELOG.zh-CN.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@

- 修复 `n-alert``header` slot 无法正常显示
- 修复 `n-data-table` 的分页器 `onUpdatePageSize` 属性未被触发, 关闭 [#1774](https://github.com/TuSimple/naive-ui/issues/1774)
- 修复 `n-data-table` loading 时可以选中行, 关闭 [#1812](https://github.com/TuSimple/naive-ui/issues/1812)
- 修复 `n-tag` 行高过低导致内容截断
- 修复 `n-select` 设定 `filterable` 后选项过长显示出错,关闭 [#1823](https://github.com/TuSimple/naive-ui/issues/1823)
- 修复 `n-page-header` 在不显示头部时内容有 margin-top,关闭 [#1795](https://github.com/TuSimple/naive-ui/issues/1795)
Expand Down
6 changes: 4 additions & 2 deletions src/data-table/src/use-check.ts
Original file line number Diff line number Diff line change
Expand Up @@ -89,13 +89,15 @@ export function useCheck (
uncontrolledCheckedRowKeysRef.value = keys
}
function doCheck (rowKey: RowKey | RowKey[]): void {
if (props.loading) return
doUpdateCheckedRowKeys(
treeMateRef.value.check(rowKey, mergedCheckedRowKeysRef.value, {
cascade: props.cascade
}).checkedKeys
)
}
function doUncheck (rowKey: RowKey | RowKey[]): void {
if (props.loading) return
doUpdateCheckedRowKeys(
treeMateRef.value.uncheck(rowKey, mergedCheckedRowKeysRef.value, {
cascade: props.cascade
Expand All @@ -104,7 +106,7 @@ export function useCheck (
}
function doCheckAll (checkWholeTable: boolean = false): void {
const { value: column } = selectionColumnRef
if (!column) return
if (!column || props.loading) return
const rowKeysToCheck: RowKey[] = []
;(checkWholeTable
? treeMateRef.value.treeNodes
Expand All @@ -123,7 +125,7 @@ export function useCheck (
}
function doUncheckAll (checkWholeTable: boolean = false): void {
const { value: column } = selectionColumnRef
if (!column) return
if (!column || props.loading) return
const rowKeysToUncheck: RowKey[] = []
;(checkWholeTable
? treeMateRef.value.treeNodes
Expand Down

0 comments on commit f15a1b3

Please sign in to comment.