2020-10-17 14:12:00 +03:00
|
|
|
<template>
|
2020-10-24 19:21:41 +03:00
|
|
|
<XWindow ref="window"
|
2020-12-30 06:07:16 +02:00
|
|
|
:initial-width="500"
|
2020-10-24 19:21:41 +03:00
|
|
|
:initial-height="500"
|
|
|
|
:can-resize="true"
|
2021-08-05 16:43:14 +03:00
|
|
|
:close-button="false"
|
2020-10-24 19:21:41 +03:00
|
|
|
:contextmenu="contextmenu"
|
|
|
|
@closed="$emit('closed')"
|
|
|
|
>
|
2020-10-17 14:12:00 +03:00
|
|
|
<template #header>
|
2021-08-05 16:43:14 +03:00
|
|
|
<XHeader :info="pageInfo" :back-button="history.length > 0" @back="back()" :close-button="true" @close="close()"/>
|
2020-10-17 14:12:00 +03:00
|
|
|
</template>
|
2021-04-10 06:40:50 +03:00
|
|
|
<div class="yrolvcoq _flat_">
|
2020-10-17 14:12:00 +03:00
|
|
|
<component :is="component" v-bind="props" :ref="changePage"/>
|
|
|
|
</div>
|
|
|
|
</XWindow>
|
|
|
|
</template>
|
|
|
|
|
|
|
|
<script lang="ts">
|
2020-10-24 19:21:41 +03:00
|
|
|
import { defineComponent } from 'vue';
|
2021-03-23 10:30:14 +02:00
|
|
|
import XWindow from '@client/components/ui/window.vue';
|
|
|
|
import XHeader from '@client/ui/_common_/header.vue';
|
|
|
|
import { popout } from '@client/scripts/popout';
|
|
|
|
import copyToClipboard from '@client/scripts/copy-to-clipboard';
|
|
|
|
import { resolve } from '@client/router';
|
|
|
|
import { url } from '@client/config';
|
2021-04-10 06:54:12 +03:00
|
|
|
import * as symbols from '@client/symbols';
|
2020-10-17 14:12:00 +03:00
|
|
|
|
|
|
|
export default defineComponent({
|
|
|
|
components: {
|
|
|
|
XWindow,
|
|
|
|
XHeader,
|
|
|
|
},
|
|
|
|
|
2020-10-28 15:21:53 +02:00
|
|
|
inject: {
|
|
|
|
sideViewHook: {
|
|
|
|
default: null
|
|
|
|
}
|
|
|
|
},
|
|
|
|
|
2020-10-24 19:21:41 +03:00
|
|
|
provide() {
|
|
|
|
return {
|
2020-11-03 03:06:19 +02:00
|
|
|
navHook: (path) => {
|
|
|
|
this.navigate(path);
|
2020-10-24 19:21:41 +03:00
|
|
|
}
|
|
|
|
};
|
|
|
|
},
|
|
|
|
|
2020-10-17 14:12:00 +03:00
|
|
|
props: {
|
2020-11-03 03:06:19 +02:00
|
|
|
initialPath: {
|
2020-10-17 14:12:00 +03:00
|
|
|
type: String,
|
|
|
|
required: true,
|
|
|
|
},
|
|
|
|
initialComponent: {
|
|
|
|
type: Object,
|
|
|
|
required: true,
|
|
|
|
},
|
|
|
|
initialProps: {
|
|
|
|
type: Object,
|
|
|
|
required: false,
|
2020-10-24 19:21:41 +03:00
|
|
|
default: () => {},
|
2020-10-17 14:12:00 +03:00
|
|
|
},
|
|
|
|
},
|
|
|
|
|
|
|
|
emits: ['closed'],
|
|
|
|
|
|
|
|
data() {
|
|
|
|
return {
|
|
|
|
pageInfo: null,
|
2020-11-03 03:06:19 +02:00
|
|
|
path: this.initialPath,
|
2020-10-17 14:12:00 +03:00
|
|
|
component: this.initialComponent,
|
|
|
|
props: this.initialProps,
|
2020-10-24 19:21:41 +03:00
|
|
|
history: [],
|
2020-10-17 14:12:00 +03:00
|
|
|
};
|
|
|
|
},
|
|
|
|
|
2020-10-24 19:21:41 +03:00
|
|
|
computed: {
|
2020-11-03 03:06:19 +02:00
|
|
|
url(): string {
|
|
|
|
return url + this.path;
|
|
|
|
},
|
|
|
|
|
2020-10-24 19:21:41 +03:00
|
|
|
contextmenu() {
|
|
|
|
return [{
|
|
|
|
type: 'label',
|
2020-11-03 03:06:19 +02:00
|
|
|
text: this.path,
|
2020-10-24 19:21:41 +03:00
|
|
|
}, {
|
2021-04-20 17:22:59 +03:00
|
|
|
icon: 'fas fa-expand-alt',
|
2020-12-26 03:47:36 +02:00
|
|
|
text: this.$ts.showInPage,
|
2020-10-24 19:21:41 +03:00
|
|
|
action: this.expand
|
2020-10-28 15:21:53 +02:00
|
|
|
}, this.sideViewHook ? {
|
2021-04-20 17:22:59 +03:00
|
|
|
icon: 'fas fa-columns',
|
2020-12-26 03:47:36 +02:00
|
|
|
text: this.$ts.openInSideView,
|
2020-10-28 15:21:53 +02:00
|
|
|
action: () => {
|
2020-11-03 03:06:19 +02:00
|
|
|
this.sideViewHook(this.path);
|
2020-10-28 15:21:53 +02:00
|
|
|
this.$refs.window.close();
|
|
|
|
}
|
|
|
|
} : undefined, {
|
2021-04-20 17:22:59 +03:00
|
|
|
icon: 'fas fa-external-link-alt',
|
2020-12-26 03:47:36 +02:00
|
|
|
text: this.$ts.popout,
|
2020-10-24 19:21:41 +03:00
|
|
|
action: this.popout
|
|
|
|
}, null, {
|
2021-04-20 17:22:59 +03:00
|
|
|
icon: 'fas fa-external-link-alt',
|
2020-12-26 03:47:36 +02:00
|
|
|
text: this.$ts.openInNewTab,
|
2020-10-24 19:21:41 +03:00
|
|
|
action: () => {
|
|
|
|
window.open(this.url, '_blank');
|
|
|
|
this.$refs.window.close();
|
|
|
|
}
|
|
|
|
}, {
|
2021-04-20 17:22:59 +03:00
|
|
|
icon: 'fas fa-link',
|
2020-12-26 03:47:36 +02:00
|
|
|
text: this.$ts.copyLink,
|
2020-10-24 19:21:41 +03:00
|
|
|
action: () => {
|
|
|
|
copyToClipboard(this.url);
|
|
|
|
}
|
|
|
|
}];
|
|
|
|
},
|
2020-10-17 14:12:00 +03:00
|
|
|
},
|
|
|
|
|
|
|
|
methods: {
|
|
|
|
changePage(page) {
|
|
|
|
if (page == null) return;
|
2021-04-10 06:54:12 +03:00
|
|
|
if (page[symbols.PAGE_INFO]) {
|
|
|
|
this.pageInfo = page[symbols.PAGE_INFO];
|
2020-10-17 14:12:00 +03:00
|
|
|
}
|
|
|
|
},
|
|
|
|
|
2020-11-03 03:06:19 +02:00
|
|
|
navigate(path, record = true) {
|
|
|
|
if (record) this.history.push(this.path);
|
|
|
|
this.path = path;
|
|
|
|
const { component, props } = resolve(path);
|
2020-10-24 19:21:41 +03:00
|
|
|
this.component = component;
|
|
|
|
this.props = props;
|
|
|
|
},
|
|
|
|
|
|
|
|
back() {
|
|
|
|
this.navigate(this.history.pop(), false);
|
|
|
|
},
|
|
|
|
|
2021-08-05 16:43:14 +03:00
|
|
|
close() {
|
|
|
|
this.$refs.window.close();
|
|
|
|
},
|
|
|
|
|
2020-10-17 14:12:00 +03:00
|
|
|
expand() {
|
2020-11-03 03:06:19 +02:00
|
|
|
this.$router.push(this.path);
|
2020-10-17 14:12:00 +03:00
|
|
|
this.$refs.window.close();
|
|
|
|
},
|
|
|
|
|
|
|
|
popout() {
|
2020-11-03 03:06:19 +02:00
|
|
|
popout(this.path, this.$el);
|
2020-10-17 14:12:00 +03:00
|
|
|
this.$refs.window.close();
|
|
|
|
},
|
|
|
|
},
|
|
|
|
});
|
|
|
|
</script>
|
2020-10-19 13:29:04 +03:00
|
|
|
|
|
|
|
<style lang="scss" scoped>
|
|
|
|
.yrolvcoq {
|
2021-04-10 06:40:50 +03:00
|
|
|
min-height: 100%;
|
2020-10-19 13:29:04 +03:00
|
|
|
}
|
|
|
|
</style>
|