Skip to content

Sync-in · Sovereign platform for file storage, sharing, synchronization, and collaboration.

fix(frontend:files): fix range file selection when filtering is enabled

johaven43125d5ef79e
diff --git a/frontend/src/app/applications/spaces/components/spaces-browser.component.ts b/frontend/src/app/applications/spaces/components/spaces-browser.component.ts
index bb27c683..667b8c10 100644
--- a/frontend/src/app/applications/spaces/components/spaces-browser.component.ts
+++ b/frontend/src/app/applications/spaces/components/spaces-browser.component.ts
@@ -812,18 +812,18 @@ export class SpacesBrowserComponent implements OnInit, AfterViewInit, OnDestroy
}
private selectRangeFiles(file: FileModel) {
- const fileIndex = this.files.indexOf(file)
- const currentIndexes: number[] = this.selection.map((f: FileModel) => this.files.indexOf(f))
+ const fileIndex = this.scrollView.viewPortItems.indexOf(file)
+ const currentIndexes: number[] = this.selection.map((f: FileModel) => this.scrollView.viewPortItems.indexOf(f))
const finalSelection: FileModel[] = []
const minIndex = Math.min(...currentIndexes)
const maxIndex = Math.max(...currentIndexes)
if (fileIndex < minIndex) {
for (let i = fileIndex; i < minIndex; i++) {
- finalSelection.push(this.files[i])
+ finalSelection.push(this.scrollView.viewPortItems[i])
}
} else if (fileIndex > maxIndex) {
for (let i = fileIndex; i > maxIndex; i--) {
- finalSelection.push(this.files[i])
+ finalSelection.push(this.scrollView.viewPortItems[i])
}
}
this.updateSelection([...this.selection, ...finalSelection])