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