-
Notifications
You must be signed in to change notification settings - Fork 158
/
FileDrop.vue
113 lines (108 loc) · 2.75 KB
/
FileDrop.vue
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
<template>
<div v-if="dropzone" :class="[sidebarStateClass]">
<vue-dropzone
id="oc-dropzone"
ref="ocDropzone"
class="oc-dropzone-container"
:class="[sidebarStateClass]"
:options="ocDropzone_options"
:use-custom-slot="true"
:include-styling="false"
@vdropzone-drop="$_ocUpload_addDropToQueue"
@vdropzone-files-added="$_ocDropzone_dragEnd"
@vdropzone-file-added="$_ocDropzone_removeFiles"
@vdropzone-drag-leave="$_ocDropzone_dragEnd"
>
<oc-dropzone>
<translate> Drag and drop to upload content into current folder </translate>
</oc-dropzone>
</vue-dropzone>
</div>
</template>
<script>
import vue2DropZone from 'vue2-dropzone'
import 'vue2-dropzone/dist/vue2Dropzone.min.css'
import Mixins from '../../../mixins'
import { mapActions, mapGetters, mapState } from 'vuex'
export default {
components: {
vueDropzone: vue2DropZone
},
mixins: [Mixins],
props: {
rootPath: { type: String, required: true },
path: { type: String, required: true },
headers: {
type: Object,
default: () => {
return {}
}
},
requestType: { type: String, default: 'PUT' }
},
data() {
return {
ocDropzone_options: {
url: '#', // FIXME: unused
clickable: false,
autoQueue: false
}
}
},
computed: {
...mapState(['navigation']),
...mapGetters('Files', ['dropzone']),
sidebarStateClass() {
return this.navigation.closed
? 'oc-dropzone-navigation-collapsed'
: 'oc-dropzone-navigation-expanded'
}
},
methods: {
...mapActions('Files', ['dragOver']),
$_ocDropzone_dragEnd() {
this.dragOver(false)
},
$_ocDropzone_removeFiles(file) {
this.$refs.ocDropzone.removeFile(file)
}
}
}
</script>
<style lang="scss">
.oc-dropzone-navigation-collapsed,
.oc-dropzone-navigation-expanded {
position: fixed;
top: 0;
left: 0;
width: 100%;
height: 100%;
}
.oc-dropzone-container {
position: fixed;
top: 60px;
height: calc(100% - 60px - var(--oc-space-small));
left: 0;
width: 100%;
z-index: 3;
// TODO: Remove vue-dropzone
.dz-message {
height: 100%;
}
.oc-dropzone {
border-bottom-right-radius: 15px;
border-top-right-radius: 15px;
height: calc(100% - (2 * var(--oc-space-medium)));
}
}
@media only screen and (min-width: 640px) {
.oc-dropzone-navigation-collapsed > .oc-dropzone-container {
left: calc(65px + var(--oc-space-small));
width: calc(100% - 65px - (2 * var(--oc-space-small)));
}
.oc-dropzone-navigation-expanded > .oc-dropzone-container {
left: calc(var(--oc-size-width-medium) + var(--oc-space-small));
width: calc(100% - var(--oc-size-width-medium) - (2 * var(--oc-space-small)));
}
}
</style>