44 */
55
66import type { ComponentPublicInstance , PropType } from 'vue'
7+ import type { FileSource } from '../types.ts'
78
89import { showError } from '@nextcloud/dialogs'
910import { FileType , Permission , Folder , File as NcFile , NodeStatus , Node , View } from '@nextcloud/files'
@@ -85,13 +86,13 @@ export default defineComponent({
8586 } ,
8687
8788 draggingFiles ( ) {
88- return this . draggingStore . dragging
89+ return this . draggingStore . dragging as FileSource [ ]
8990 } ,
9091 selectedFiles ( ) {
91- return this . selectionStore . selected
92+ return this . selectionStore . selected as FileSource [ ]
9293 } ,
9394 isSelected ( ) {
94- return this . fileid && this . selectedFiles . includes ( this . fileid )
95+ return this . selectedFiles . includes ( this . source . source )
9596 } ,
9697
9798 isRenaming ( ) {
@@ -116,7 +117,7 @@ export default defineComponent({
116117
117118 // If we're dragging a selection, we need to check all files
118119 if ( this . selectedFiles . length > 0 ) {
119- const nodes = this . selectedFiles . map ( fileid => this . filesStore . getNode ( fileid ) ) as Node [ ]
120+ const nodes = this . selectedFiles . map ( source => this . filesStore . getNode ( source ) ) as Node [ ]
120121 return nodes . every ( canDrag )
121122 }
122123 return canDrag ( this . source )
@@ -128,7 +129,7 @@ export default defineComponent({
128129 }
129130
130131 // If the current folder is also being dragged, we can't drop it on itself
131- if ( this . fileid && this . draggingFiles . includes ( this . fileid ) ) {
132+ if ( this . draggingFiles . includes ( this . source . source ) ) {
132133 return false
133134 }
134135
@@ -269,14 +270,14 @@ export default defineComponent({
269270
270271 // Dragging set of files, if we're dragging a file
271272 // that is already selected, we use the entire selection
272- if ( this . selectedFiles . includes ( this . fileid ) ) {
273+ if ( this . selectedFiles . includes ( this . source . source ) ) {
273274 this . draggingStore . set ( this . selectedFiles )
274275 } else {
275- this . draggingStore . set ( [ this . fileid ] )
276+ this . draggingStore . set ( [ this . source . source ] )
276277 }
277278
278279 const nodes = this . draggingStore . dragging
279- . map ( fileid => this . filesStore . getNode ( fileid ) ) as Node [ ]
280+ . map ( source => this . filesStore . getNode ( source ) ) as Node [ ]
280281
281282 const image = await getDragAndDropPreview ( nodes )
282283 event . dataTransfer ?. setDragImage ( image , - 10 , - 10 )
@@ -330,12 +331,12 @@ export default defineComponent({
330331 }
331332
332333 // Else we're moving/copying files
333- const nodes = selection . map ( fileid => this . filesStore . getNode ( fileid ) ) as Node [ ]
334+ const nodes = selection . map ( source => this . filesStore . getNode ( source ) ) as Node [ ]
334335 await onDropInternalFiles ( nodes , folder , contents . contents , isCopy )
335336
336337 // Reset selection after we dropped the files
337338 // if the dropped files are within the selection
338- if ( selection . some ( fileid => this . selectedFiles . includes ( fileid ) ) ) {
339+ if ( selection . some ( source => this . selectedFiles . includes ( source ) ) ) {
339340 logger . debug ( 'Dropped selection, resetting select store...' )
340341 this . selectionStore . reset ( )
341342 }
0 commit comments