1
0
mirror of https://github.com/haiwen/seahub.git synced 2025-08-31 22:54:11 +00:00

Grid view support multi-select by drag (#6420)

* grid view support multiple selection by drag

* fix conflict with multiple selection by keyboard

* improve selection experience and code format

* fix bug - select failed when file name include '...'
This commit is contained in:
Aries
2024-07-26 17:15:18 +08:00
committed by GitHub
parent fa46b89b0d
commit 3a06447faf
9 changed files with 211 additions and 20 deletions

View File

@@ -1378,6 +1378,18 @@ class LibContentView extends React.Component {
}
};
onSelectedDirentListUpdate = (newSelectedDirentList, lastSelectedIndex = null) => {
this.setState({
direntList: this.state.direntList.map(dirent => {
dirent.isSelected = newSelectedDirentList.some(selectedDirent => selectedDirent.name === dirent.name);
return dirent;
}),
isDirentSelected: newSelectedDirentList.length > 0,
selectedDirentList: newSelectedDirentList,
lastSelectedIndex: lastSelectedIndex,
});
};
onItemClick = (dirent) => {
this.resetSelected();
let repoID = this.props.repoID;
@@ -2152,6 +2164,7 @@ class LibContentView extends React.Component {
isDirentDetailShow={this.state.isDirentDetailShow}
selectedDirent={this.state.selectedDirentList && this.state.selectedDirentList[0]}
selectedDirentList={this.state.selectedDirentList}
onSelectedDirentListUpdate={this.onSelectedDirentListUpdate}
onItemsMove={this.onMoveItems}
onItemsCopy={this.onCopyItems}
onItemsDelete={this.onDeleteItems}