2020-10-17 04:12:00 -07:00
|
|
|
<template>
|
2020-10-24 09:21:41 -07:00
|
|
|
<XWindow ref="window"
|
2020-11-03 00:00:18 -08:00
|
|
|
:initial-width="700"
|
2020-10-24 09:21:41 -07:00
|
|
|
:initial-height="500"
|
|
|
|
:can-resize="true"
|
|
|
|
:close-right="true"
|
|
|
|
:contextmenu="contextmenu"
|
|
|
|
@closed="$emit('closed')"
|
|
|
|
>
|
2020-10-17 04:12:00 -07:00
|
|
|
<template #header>
|
|
|
|
<XHeader :info="pageInfo" :with-back="false"/>
|
|
|
|
</template>
|
|
|
|
<template #buttons>
|
2020-10-24 09:21:41 -07:00
|
|
|
<button class="_button" @click="back()" v-if="history.length > 0"><Fa :icon="faChevronLeft"/></button>
|
|
|
|
<button class="_button" style="pointer-events: none;" v-else><!-- マージンのバランスを取るためのダミー --></button>
|
2020-10-17 04:12:00 -07:00
|
|
|
</template>
|
2020-10-19 03:29:04 -07:00
|
|
|
<div class="yrolvcoq" style="min-height: 100%; background: var(--bg);">
|
2020-10-17 04:12:00 -07:00
|
|
|
<component :is="component" v-bind="props" :ref="changePage"/>
|
|
|
|
</div>
|
|
|
|
</XWindow>
|
|
|
|
</template>
|
|
|
|
|
|
|
|
<script lang="ts">
|
2020-10-24 09:21:41 -07:00
|
|
|
import { defineComponent } from 'vue';
|
2020-10-28 06:21:53 -07:00
|
|
|
import { faExternalLinkAlt, faExpandAlt, faLink, faChevronLeft, faColumns } from '@fortawesome/free-solid-svg-icons';
|
2020-10-17 04:12:00 -07:00
|
|
|
import XWindow from '@/components/ui/window.vue';
|
|
|
|
import XHeader from '@/ui/_common_/header.vue';
|
|
|
|
import { popout } from '@/scripts/popout';
|
2020-10-24 09:21:41 -07:00
|
|
|
import copyToClipboard from '@/scripts/copy-to-clipboard';
|
|
|
|
import { resolve } from '@/router';
|
2020-11-02 17:06:19 -08:00
|
|
|
import { url } from '@/config';
|
2020-10-17 04:12:00 -07:00
|
|
|
|
|
|
|
export default defineComponent({
|
|
|
|
components: {
|
|
|
|
XWindow,
|
|
|
|
XHeader,
|
|
|
|
},
|
|
|
|
|
2020-10-28 06:21:53 -07:00
|
|
|
inject: {
|
|
|
|
sideViewHook: {
|
|
|
|
default: null
|
|
|
|
}
|
|
|
|
},
|
|
|
|
|
2020-10-24 09:21:41 -07:00
|
|
|
provide() {
|
|
|
|
return {
|
2020-11-02 17:06:19 -08:00
|
|
|
navHook: (path) => {
|
|
|
|
this.navigate(path);
|
2020-10-24 09:21:41 -07:00
|
|
|
}
|
|
|
|
};
|
|
|
|
},
|
|
|
|
|
2020-10-17 04:12:00 -07:00
|
|
|
props: {
|
2020-11-02 17:06:19 -08:00
|
|
|
initialPath: {
|
2020-10-17 04:12:00 -07:00
|
|
|
type: String,
|
|
|
|
required: true,
|
|
|
|
},
|
|
|
|
initialComponent: {
|
|
|
|
type: Object,
|
|
|
|
required: true,
|
|
|
|
},
|
|
|
|
initialProps: {
|
|
|
|
type: Object,
|
|
|
|
required: false,
|
2020-10-24 09:21:41 -07:00
|
|
|
default: () => {},
|
2020-10-17 04:12:00 -07:00
|
|
|
},
|
|
|
|
},
|
|
|
|
|
|
|
|
emits: ['closed'],
|
|
|
|
|
|
|
|
data() {
|
|
|
|
return {
|
|
|
|
pageInfo: null,
|
2020-11-02 17:06:19 -08:00
|
|
|
path: this.initialPath,
|
2020-10-17 04:12:00 -07:00
|
|
|
component: this.initialComponent,
|
|
|
|
props: this.initialProps,
|
2020-10-24 09:21:41 -07:00
|
|
|
history: [],
|
|
|
|
faChevronLeft,
|
2020-10-17 04:12:00 -07:00
|
|
|
};
|
|
|
|
},
|
|
|
|
|
2020-10-24 09:21:41 -07:00
|
|
|
computed: {
|
2020-11-02 17:06:19 -08:00
|
|
|
url(): string {
|
|
|
|
return url + this.path;
|
|
|
|
},
|
|
|
|
|
2020-10-24 09:21:41 -07:00
|
|
|
contextmenu() {
|
|
|
|
return [{
|
|
|
|
type: 'label',
|
2020-11-02 17:06:19 -08:00
|
|
|
text: this.path,
|
2020-10-24 09:21:41 -07:00
|
|
|
}, {
|
|
|
|
icon: faExpandAlt,
|
2020-12-25 17:47:36 -08:00
|
|
|
text: this.$ts.showInPage,
|
2020-10-24 09:21:41 -07:00
|
|
|
action: this.expand
|
2020-10-28 06:21:53 -07:00
|
|
|
}, this.sideViewHook ? {
|
|
|
|
icon: faColumns,
|
2020-12-25 17:47:36 -08:00
|
|
|
text: this.$ts.openInSideView,
|
2020-10-28 06:21:53 -07:00
|
|
|
action: () => {
|
2020-11-02 17:06:19 -08:00
|
|
|
this.sideViewHook(this.path);
|
2020-10-28 06:21:53 -07:00
|
|
|
this.$refs.window.close();
|
|
|
|
}
|
|
|
|
} : undefined, {
|
2020-10-24 09:21:41 -07:00
|
|
|
icon: faExternalLinkAlt,
|
2020-12-25 17:47:36 -08:00
|
|
|
text: this.$ts.popout,
|
2020-10-24 09:21:41 -07:00
|
|
|
action: this.popout
|
|
|
|
}, null, {
|
|
|
|
icon: faExternalLinkAlt,
|
2020-12-25 17:47:36 -08:00
|
|
|
text: this.$ts.openInNewTab,
|
2020-10-24 09:21:41 -07:00
|
|
|
action: () => {
|
|
|
|
window.open(this.url, '_blank');
|
|
|
|
this.$refs.window.close();
|
|
|
|
}
|
|
|
|
}, {
|
|
|
|
icon: faLink,
|
2020-12-25 17:47:36 -08:00
|
|
|
text: this.$ts.copyLink,
|
2020-10-24 09:21:41 -07:00
|
|
|
action: () => {
|
|
|
|
copyToClipboard(this.url);
|
|
|
|
}
|
|
|
|
}];
|
|
|
|
},
|
2020-10-17 04:12:00 -07:00
|
|
|
},
|
|
|
|
|
|
|
|
methods: {
|
|
|
|
changePage(page) {
|
|
|
|
if (page == null) return;
|
|
|
|
if (page.INFO) {
|
|
|
|
this.pageInfo = page.INFO;
|
|
|
|
}
|
|
|
|
},
|
|
|
|
|
2020-11-02 17:06:19 -08:00
|
|
|
navigate(path, record = true) {
|
|
|
|
if (record) this.history.push(this.path);
|
|
|
|
this.path = path;
|
|
|
|
const { component, props } = resolve(path);
|
2020-10-24 09:21:41 -07:00
|
|
|
this.component = component;
|
|
|
|
this.props = props;
|
|
|
|
},
|
|
|
|
|
|
|
|
back() {
|
|
|
|
this.navigate(this.history.pop(), false);
|
|
|
|
},
|
|
|
|
|
2020-10-17 04:12:00 -07:00
|
|
|
expand() {
|
2020-11-02 17:06:19 -08:00
|
|
|
this.$router.push(this.path);
|
2020-10-17 04:12:00 -07:00
|
|
|
this.$refs.window.close();
|
|
|
|
},
|
|
|
|
|
|
|
|
popout() {
|
2020-11-02 17:06:19 -08:00
|
|
|
popout(this.path, this.$el);
|
2020-10-17 04:12:00 -07:00
|
|
|
this.$refs.window.close();
|
|
|
|
},
|
|
|
|
},
|
|
|
|
});
|
|
|
|
</script>
|
2020-10-19 03:29:04 -07:00
|
|
|
|
|
|
|
<style lang="scss" scoped>
|
|
|
|
.yrolvcoq {
|
|
|
|
--section-padding: 16px;
|
|
|
|
}
|
|
|
|
</style>
|