filebrowser/frontend/src/components/prompts/Prompts.vue

80 lines
1.5 KiB
Vue
Raw Normal View History

2018-02-01 12:17:04 +00:00
<template>
<div>
2019-11-19 12:02:35 +00:00
<component :is="currentComponent"></component>
2018-02-01 12:17:04 +00:00
<div v-show="showOverlay" @click="resetPrompts" class="overlay"></div>
</div>
</template>
<script>
import Help from './Help'
import Info from './Info'
import Delete from './Delete'
import Rename from './Rename'
import Download from './Download'
import Move from './Move'
import Copy from './Copy'
import NewFile from './NewFile'
import NewDir from './NewDir'
import Replace from './Replace'
import Share from './Share'
import Upload from './Upload'
2018-02-01 12:17:04 +00:00
import { mapState } from 'vuex'
import buttons from '@/utils/buttons'
export default {
name: 'prompts',
components: {
Info,
Delete,
Rename,
Download,
Move,
Copy,
Share,
NewFile,
NewDir,
Help,
Replace,
Upload
2018-02-01 12:17:04 +00:00
},
data: function () {
return {
pluginData: {
buttons,
'store': this.$store,
'router': this.$router
}
}
},
computed: {
...mapState(['show', 'plugins']),
2019-11-19 12:02:35 +00:00
currentComponent: function () {
const matched = [
'info',
'help',
'delete',
'rename',
'move',
'copy',
'newFile',
'newDir',
'download',
'replace',
'share',
'upload'
2019-11-19 12:02:35 +00:00
].indexOf(this.show) >= 0;
return matched && this.show || null;
},
2018-02-01 12:17:04 +00:00
showOverlay: function () {
return (this.show !== null && this.show !== 'search' && this.show !== 'more')
}
},
methods: {
resetPrompts () {
this.$store.commit('closeHovers')
}
}
}
</script>