Skip to content

Commit e69ae33

Browse files
committed
* dtable: update row check logic to allow partial checks and simplify disabled checkbox handling
1 parent c5391ec commit e69ae33

1 file changed

Lines changed: 3 additions & 3 deletions

File tree

lib/dtable/src/plugins/checkable/index.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -116,12 +116,12 @@ function isAllRowChecked(this: DTableCheckable): boolean {
116116
const checkedLength = this.getChecks().length;
117117
const {canRowCheckable, allowCheckDisabled} = this.options;
118118
if (canRowCheckable) {
119-
return checkedLength === this.layout?.allRows.reduce((length, row) => {
119+
return checkedLength >= this.layout?.allRows.reduce((length, row) => {
120120
const checkable = canRowCheckable ? canRowCheckable.call(this, row.id) : true;
121121
return length + ((!checkable || (!allowCheckDisabled && checkable === 'disabled')) ? 0 : 1);
122122
}, 0);
123123
}
124-
return checkedLength === allRowLength;
124+
return checkedLength >= allRowLength;
125125
}
126126

127127
function getChecks(this: DTableCheckable): string[] {
@@ -281,7 +281,7 @@ const checkablePlugin: DTablePlugin<DTableCheckableTypes> = {
281281
return;
282282
}
283283
const $checkbox = $target.closest(checkboxSelector);
284-
if ($checkbox.closest('.disabled').length && !this.options.allowCheckDisabled) {
284+
if ($checkbox.closest('.disabled').length) {
285285
event.preventDefault();
286286
return;
287287
}

0 commit comments

Comments
 (0)