Ensure disabled item tree rows are not selectible with Select All
This commit is contained in:
parent
7265393be9
commit
1db2eb4aea
2 changed files with 21 additions and 2 deletions
|
@ -542,7 +542,22 @@ class VirtualizedTable extends React.Component {
|
|||
|
||||
case "a":
|
||||
// i.e. if CTRL/CMD pressed down
|
||||
if (movePivot) this.selection.rangedSelect(0, this.props.getRowCount()-1);
|
||||
if (movePivot) {
|
||||
// Do not select unselectable (disabled) rows
|
||||
for (let i = 0; i < this.props.getRowCount(); i++) {
|
||||
if (this.props.isSelectable(i)) {
|
||||
this.selection.selected.add(i);
|
||||
} else {
|
||||
this.selection.selected.delete(i);
|
||||
}
|
||||
}
|
||||
if (this.selection.selectEventsSuppressed) break;
|
||||
this.invalidate();
|
||||
if (!this.selection.selectEventsSuppressed) {
|
||||
this.props.onSelectionChange(this, shouldDebounce);
|
||||
}
|
||||
this.selection.rangedSelect(0, this.props.getRowCount()-1);
|
||||
}
|
||||
break;
|
||||
|
||||
case " ":
|
||||
|
|
|
@ -1128,7 +1128,7 @@ var ItemTree = class ItemTree extends LibraryTree {
|
|||
multiSelect: true,
|
||||
|
||||
onSelectionChange: this._handleSelectionChange,
|
||||
isSelectable: () => true,
|
||||
isSelectable: this.isSelectable,
|
||||
getParentIndex: this.getParentIndex,
|
||||
isContainer: this.isContainer,
|
||||
isContainerEmpty: this.isContainerEmpty,
|
||||
|
@ -1904,6 +1904,10 @@ var ItemTree = class ItemTree extends LibraryTree {
|
|||
}
|
||||
}
|
||||
|
||||
isSelectable = (index) => {
|
||||
return !this._searchMode || this._searchItemIDs.has(this.getRow(index).id);
|
||||
}
|
||||
|
||||
isContainer = (index) => {
|
||||
return this.getRow(index).ref.isRegularItem();
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue