fix:picker全选排除已禁用的行 (#7736)

Co-authored-by: wanglinfang <wanglinfang@baidu.com>
This commit is contained in:
wanglinfang2014 2023-08-08 19:20:36 +08:00 committed by GitHub
parent 2719df138d
commit c8ad83ec03
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -653,10 +653,9 @@ export const TableStore = iRendererStore
},
get allChecked(): boolean {
return !!(
self.selectedRows.length ===
(self as ITableStore).checkableRows.length &&
(self as ITableStore).checkableRows.length
// 只要selectedRows中包含checkableRows中的全部数据就认为是全选
return (self as ITableStore).checkableRows.every(item =>
self.selectedRows.includes(item)
);
},
@ -1246,7 +1245,11 @@ export const TableStore = iRendererStore
function toggleAll() {
if (self.allChecked) {
self.selectedRows.clear();
// 需要将不可选的row排除掉
// 不可选的 始终保持初始化的状态
self.selectedRows.replace(
self.selectedRows.filter(row => !row.checkable)
);
} else {
self.selectedRows.replace(getSelectedRows());
}