2020-10-04 01:30:50 +03:00
|
|
|
|
2019-05-23 18:03:04 +03:00
|
|
|
<!--
|
|
|
|
- @copyright Copyright (c) 2019 John Molakvoæ <skjnldsv@protonmail.com>
|
|
|
|
-
|
|
|
|
- @author John Molakvoæ <skjnldsv@protonmail.com>
|
|
|
|
-
|
|
|
|
- @license GNU AGPL version 3 or any later version
|
|
|
|
-
|
|
|
|
- This program is free software: you can redistribute it and/or modify
|
|
|
|
- it under the terms of the GNU Affero General Public License as
|
|
|
|
- published by the Free Software Foundation, either version 3 of the
|
|
|
|
- License, or (at your option) any later version.
|
|
|
|
-
|
|
|
|
- This program is distributed in the hope that it will be useful,
|
|
|
|
- but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
- GNU Affero General Public License for more details.
|
|
|
|
-
|
|
|
|
- You should have received a copy of the GNU Affero General Public License
|
|
|
|
- along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
-
|
|
|
|
-->
|
|
|
|
<template>
|
2020-01-29 18:31:47 +03:00
|
|
|
<AppSidebarTab
|
|
|
|
:id="id"
|
2019-05-23 18:03:04 +03:00
|
|
|
:name="name"
|
2020-10-04 01:30:50 +03:00
|
|
|
:icon="icon">
|
|
|
|
<!-- Using a dummy div as Vue mount replace the element directly
|
|
|
|
It does NOT append to the content -->
|
|
|
|
<div ref="mount"></div>
|
|
|
|
</AppSidebarTab>
|
2019-05-23 18:03:04 +03:00
|
|
|
</template>
|
2020-10-04 01:30:50 +03:00
|
|
|
|
2019-05-23 18:03:04 +03:00
|
|
|
<script>
|
2020-01-16 02:03:29 +03:00
|
|
|
import AppSidebarTab from '@nextcloud/vue/dist/Components/AppSidebarTab'
|
2019-05-23 18:03:04 +03:00
|
|
|
export default {
|
2020-10-04 01:30:50 +03:00
|
|
|
name: 'SidebarTab',
|
|
|
|
|
2019-05-23 18:03:04 +03:00
|
|
|
components: {
|
2020-07-31 10:26:43 +03:00
|
|
|
AppSidebarTab,
|
2019-05-23 18:03:04 +03:00
|
|
|
},
|
2020-10-04 01:30:50 +03:00
|
|
|
|
2019-05-23 18:03:04 +03:00
|
|
|
props: {
|
2020-10-04 01:30:50 +03:00
|
|
|
fileInfo: {
|
2019-05-23 18:03:04 +03:00
|
|
|
type: Object,
|
2020-10-04 01:30:50 +03:00
|
|
|
default: () => {},
|
2019-11-13 15:05:10 +03:00
|
|
|
required: true,
|
2019-05-23 18:03:04 +03:00
|
|
|
},
|
2020-01-29 18:31:47 +03:00
|
|
|
id: {
|
2019-05-23 18:03:04 +03:00
|
|
|
type: String,
|
2019-11-13 15:05:10 +03:00
|
|
|
required: true,
|
2019-05-23 18:03:04 +03:00
|
|
|
},
|
2020-10-04 01:30:50 +03:00
|
|
|
name: {
|
|
|
|
type: String,
|
2019-11-13 15:05:10 +03:00
|
|
|
required: true,
|
|
|
|
},
|
2020-10-04 01:30:50 +03:00
|
|
|
icon: {
|
|
|
|
type: String,
|
|
|
|
required: true,
|
2019-05-23 18:03:04 +03:00
|
|
|
},
|
2020-10-04 01:30:50 +03:00
|
|
|
render: {
|
|
|
|
type: Function,
|
|
|
|
required: true,
|
2019-05-23 18:03:04 +03:00
|
|
|
},
|
2020-10-04 01:30:50 +03:00
|
|
|
},
|
|
|
|
|
|
|
|
computed: {
|
|
|
|
// TODO: implement a better way to force pass a prop fromm Sidebar
|
2019-05-23 18:03:04 +03:00
|
|
|
activeTab() {
|
|
|
|
return this.$parent.activeTab
|
2019-11-13 15:05:10 +03:00
|
|
|
},
|
2019-05-23 18:03:04 +03:00
|
|
|
},
|
2020-10-04 01:30:50 +03:00
|
|
|
|
2019-05-23 18:03:04 +03:00
|
|
|
watch: {
|
2020-10-04 01:30:50 +03:00
|
|
|
fileInfo(newFile, oldFile) {
|
|
|
|
if (newFile.id !== oldFile.id) {
|
|
|
|
this.mountTab()
|
2019-05-23 18:03:04 +03:00
|
|
|
}
|
2019-11-13 15:05:10 +03:00
|
|
|
},
|
2019-05-23 18:03:04 +03:00
|
|
|
},
|
2020-10-04 01:30:50 +03:00
|
|
|
|
2019-05-23 18:03:04 +03:00
|
|
|
mounted() {
|
2020-10-04 01:30:50 +03:00
|
|
|
this.mountTab()
|
2019-10-23 19:40:48 +03:00
|
|
|
},
|
2020-10-04 01:30:50 +03:00
|
|
|
|
2019-05-23 18:03:04 +03:00
|
|
|
methods: {
|
2020-10-04 01:30:50 +03:00
|
|
|
mountTab() {
|
|
|
|
// Mount the tab into this component
|
|
|
|
this.render(this.$refs.mount, this.fileInfo)
|
2019-11-13 15:05:10 +03:00
|
|
|
},
|
|
|
|
},
|
2019-05-23 18:03:04 +03:00
|
|
|
}
|
|
|
|
</script>
|