@@ -36,12 +36,18 @@ export default {
36
36
data () {
37
37
return {
38
38
isLoading: false ,
39
- linkCopied: false ,
39
+ no_files: false ,
40
+ file_loader: false ,
41
+ ajax_error: false ,
40
42
toggleInfo: true ,
43
+ uploadToggle: false ,
44
+ uploadStart: false ,
45
+ uploadProgress: 0 ,
46
+
47
+ linkCopied: false ,
41
48
bulkSelectAll: false ,
42
49
bulkSelect: false ,
43
50
folderWarning: false ,
44
- uploadToggle: false ,
45
51
checkForFolders: false ,
46
52
47
53
files: [],
@@ -51,18 +57,24 @@ export default {
51
57
bulkList: [],
52
58
lockedList: [],
53
59
54
- moveToPath: undefined ,
55
- selectedFile: undefined ,
56
- sortBy: undefined ,
57
- currentFilterName: undefined ,
58
- searchItemsCount: undefined ,
59
- searchFor: undefined ,
60
- new_folder_name: undefined ,
61
- new_filename: undefined
60
+ moveToPath: null ,
61
+ selectedFile: null ,
62
+ currentFileIndex: null ,
63
+ sortBy: null ,
64
+ currentFilterName: null ,
65
+ searchItemsCount: null ,
66
+ searchFor: null ,
67
+ new_folder_name: null ,
68
+ new_filename: null ,
69
+ active_modal: null
62
70
}
63
71
},
64
72
created () {
65
- this .loadFiles ()
73
+ if (this .checkForRestrictedPath ()) {
74
+ return this .restrictAccess ()
75
+ }
76
+
77
+ this .getFiles ()
66
78
},
67
79
mounted () {
68
80
this .fileUpload ()
@@ -86,17 +98,14 @@ export default {
86
98
fileUpload () {
87
99
let manager = this
88
100
89
- $ (' #new-upload' ). dropzone ( {
101
+ new Dropzone (' #new-upload' , {
90
102
createImageThumbnails: false ,
91
103
parallelUploads: 10 ,
92
104
uploadMultiple: true ,
93
105
forceFallback: false ,
94
106
previewsContainer: ' #uploadPreview' ,
95
107
processingmultiple () {
96
- $ (' #uploadProgress' ).fadeIn ()
97
- },
98
- totaluploadprogress (uploadProgress ) {
99
- $ (' .progress-bar' ).css (' width' , uploadProgress + ' %' )
108
+ manager .uploadStart = true
100
109
},
101
110
successmultiple (files , res ) {
102
111
res .data .map ((item ) => {
@@ -107,16 +116,18 @@ export default {
107
116
}
108
117
})
109
118
110
- manager .loadFiles (manager .folders )
119
+ manager .getFiles (manager .folders )
120
+ },
121
+ totaluploadprogress (uploadProgress ) {
122
+ return manager .uploadProgress = ` ${ uploadProgress} %`
111
123
},
112
124
errormultiple (files , res ) {
113
- this .showNotif (res, ' danger' )
125
+ manager .showNotif (res, ' danger' )
114
126
},
115
127
queuecomplete () {
128
+ manager .uploadStart = false
129
+ manager .uploadProgress = 0
116
130
manager .toggleUploadPanel ()
117
- $ (' #uploadProgress' ).fadeOut (() => {
118
- $ (' .progress-bar' ).css (' width' , 0 )
119
- })
120
131
}
121
132
})
122
133
},
@@ -125,9 +136,9 @@ export default {
125
136
$ (document ).keydown ((e ) => {
126
137
127
138
// when modal isnt visible
128
- if (! $ ( ' .mm-modal ' ). hasClass ( ' is-active ' ) ) {
139
+ if (! this . active_modal ) {
129
140
// when search is not focused
130
- if (! $ ( ' .input ' ). is ( ' :focus ' ) ) {
141
+ if (document . activeElement . dataset . search == undefined ) {
131
142
// when no bulk selecting
132
143
if (! this .isBulkSelecting ()) {
133
144
@@ -162,15 +173,15 @@ export default {
162
173
// "show" image quick view
163
174
if (this .selectedFileIs (' image' )) {
164
175
this .noScroll (' add' )
165
- this .toggleModal (' # preview_modal' )
176
+ this .toggleModal (' preview_modal' )
166
177
}
167
178
}
168
179
}
169
180
// end of when there are files
170
181
171
182
// refresh
172
183
if (keycode (e) == ' r' ) {
173
- this .loadFiles (this .folders )
184
+ this .getFiles (this .folders )
174
185
}
175
186
176
187
// file upload
@@ -234,12 +245,7 @@ export default {
234
245
235
246
// when modal is visible
236
247
else {
237
- if (keycode (e) == ' enter' ) {
238
- e .preventDefault ()
239
- $ (' .mm-modal.is-active' ).find (' button[type="submit"]' ).trigger (' click' )
240
- }
241
-
242
- if (this .lightBoxIsActive ()) {
248
+ if (this .isActiveModal (' preview_modal' )) {
243
249
// hide lb
244
250
if (keycode (e) == ' space' ) {
245
251
e .preventDefault ()
@@ -278,26 +284,23 @@ export default {
278
284
})
279
285
}
280
286
281
- this .toggleModal (' # confirm_delete_modal' )
287
+ this .toggleModal (' confirm_delete_modal' )
282
288
},
283
289
moveItem () {
284
- this .toggleModal (' # move_file_modal' )
290
+ this .toggleModal (' move_file_modal' )
285
291
},
286
292
renameItem () {
287
- this .toggleModal (' # rename_file_modal' )
293
+ this .toggleModal (' rename_file_modal' )
288
294
},
289
295
blkSlct () {
290
296
this .bulkSelect = ! this .bulkSelect
291
-
292
- // reset when toggled off
293
- if (this .isBulkSelecting ()) {
294
- return this .clearSelected ()
295
- }
296
-
297
297
this .bulkSelectAll = false
298
- this .clearSelected ()
299
298
this .resetInput (' bulkList' , [])
300
- this .selectFirst ()
299
+ this .resetInput (' selectedFile' )
300
+
301
+ if (! this .isBulkSelecting ()) {
302
+ this .selectFirst ()
303
+ }
301
304
},
302
305
blkSlctAll () {
303
306
// if no items in bulk list
@@ -309,26 +312,30 @@ export default {
309
312
}
310
313
311
314
// if found search items
312
- if (this .searchItemsCount ) {
315
+ if (this .searchFor && this . searchItemsCount ) {
313
316
this .bulkSelectAll = true
314
- $ (' #files li' ).each (function () {
315
- $ (this ).trigger (' click' )
316
- })
317
+
318
+ let list = this .filesList
319
+ for (let i = list .length - 1 ; i >= 0 ; i-- ) {
320
+ list[i].click ()
321
+ }
317
322
}
318
323
}
319
324
320
325
// if having search + having bulk items < search found items
321
326
else if (this .searchFor && this .bulkItemsCount < this .searchItemsCount ) {
322
327
this .resetInput (' bulkList' , [])
323
- this .clearSelected ( )
328
+ this .resetInput ( ' selectedFile ' )
324
329
325
330
if (this .bulkSelectAll ) {
326
331
this .bulkSelectAll = false
327
332
} else {
328
333
this .bulkSelectAll = true
329
- $ (' #files li' ).each (function () {
330
- $ (this ).trigger (' click' )
331
- })
334
+
335
+ let list = this .filesList
336
+ for (let i = list .length - 1 ; i >= 0 ; i-- ) {
337
+ list[i].click ()
338
+ }
332
339
}
333
340
}
334
341
@@ -342,14 +349,14 @@ export default {
342
349
this .bulkList = this .allFiles .slice (0 )
343
350
}
344
351
345
- this .clearSelected ( )
352
+ this .resetInput ( ' selectedFile ' )
346
353
}
347
354
348
355
// otherwise
349
356
else {
350
357
this .bulkSelectAll = false
351
358
this .resetInput (' bulkList' , [])
352
- this .clearSelected ( )
359
+ this .resetInput ( ' selectedFile ' )
353
360
}
354
361
355
362
// if we have items in bulk list, select first item
@@ -400,7 +407,7 @@ export default {
400
407
}
401
408
402
409
if (! this .allItemsCount ) {
403
- this .clearSelected ( )
410
+ this .resetInput ( ' selectedFile ' )
404
411
}
405
412
}
406
413
},
0 commit comments