2020-10-24 10:21:41 -06:00
|
|
|
<template>
|
|
|
|
<div class="qvzfzxam _narrow_" v-if="component">
|
|
|
|
<div class="container">
|
|
|
|
<header class="header" @contextmenu.prevent.stop="onContextmenu">
|
2021-04-20 08:22:59 -06:00
|
|
|
<button class="_button" @click="back()" v-if="history.length > 0"><i class="fas fa-chevron-left"></i></button>
|
2020-10-24 10:21:41 -06:00
|
|
|
<button class="_button" style="pointer-events: none;" v-else><!-- マージンのバランスを取るためのダミー --></button>
|
2021-08-05 07:43:14 -06:00
|
|
|
<XHeader class="title" :info="pageInfo" :back-button="false"/>
|
2021-04-20 08:22:59 -06:00
|
|
|
<button class="_button" @click="close()"><i class="fas fa-times"></i></button>
|
2020-10-24 10:21:41 -06:00
|
|
|
</header>
|
|
|
|
<component :is="component" v-bind="props" :ref="changePage"/>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</template>
|
|
|
|
|
|
|
|
<script lang="ts">
|
|
|
|
import { defineComponent } from 'vue';
|
|
|
|
import XHeader from './_common_/header.vue';
|
2021-03-23 02:30:14 -06:00
|
|
|
import * as os from '@client/os';
|
|
|
|
import copyToClipboard from '@client/scripts/copy-to-clipboard';
|
|
|
|
import { resolve } from '@client/router';
|
|
|
|
import { url } from '@client/config';
|
2021-04-09 21:54:12 -06:00
|
|
|
import * as symbols from '@client/symbols';
|
2020-10-24 10:21:41 -06:00
|
|
|
|
|
|
|
export default defineComponent({
|
|
|
|
components: {
|
|
|
|
XHeader
|
|
|
|
},
|
|
|
|
|
|
|
|
provide() {
|
|
|
|
return {
|
2020-11-02 18:06:19 -07:00
|
|
|
navHook: (path) => {
|
|
|
|
this.navigate(path);
|
2020-10-24 10:21:41 -06:00
|
|
|
}
|
|
|
|
};
|
|
|
|
},
|
|
|
|
|
|
|
|
data() {
|
|
|
|
return {
|
2020-11-02 18:06:19 -07:00
|
|
|
path: null,
|
2020-10-24 10:21:41 -06:00
|
|
|
component: null,
|
|
|
|
props: {},
|
|
|
|
pageInfo: null,
|
|
|
|
history: [],
|
|
|
|
};
|
|
|
|
},
|
|
|
|
|
2020-11-02 18:06:19 -07:00
|
|
|
computed: {
|
|
|
|
url(): string {
|
|
|
|
return url + this.path;
|
|
|
|
}
|
|
|
|
},
|
|
|
|
|
2020-10-24 10:21:41 -06:00
|
|
|
methods: {
|
|
|
|
changePage(page) {
|
|
|
|
if (page == null) return;
|
2021-04-09 21:54:12 -06:00
|
|
|
if (page[symbols.PAGE_INFO]) {
|
|
|
|
this.pageInfo = page[symbols.PAGE_INFO];
|
2020-10-24 10:21:41 -06:00
|
|
|
}
|
|
|
|
},
|
|
|
|
|
2020-11-02 18:06:19 -07:00
|
|
|
navigate(path, record = true) {
|
|
|
|
if (record && this.path) this.history.push(this.path);
|
|
|
|
this.path = path;
|
|
|
|
const { component, props } = resolve(path);
|
2020-10-24 10:21:41 -06:00
|
|
|
this.component = component;
|
|
|
|
this.props = props;
|
|
|
|
},
|
|
|
|
|
|
|
|
back() {
|
|
|
|
this.navigate(this.history.pop(), false);
|
|
|
|
},
|
|
|
|
|
|
|
|
close() {
|
2020-11-02 18:06:19 -07:00
|
|
|
this.path = null;
|
2020-10-24 10:21:41 -06:00
|
|
|
this.component = null;
|
|
|
|
this.props = {};
|
|
|
|
},
|
|
|
|
|
|
|
|
onContextmenu(e) {
|
|
|
|
os.contextMenu([{
|
|
|
|
type: 'label',
|
2020-11-02 18:06:19 -07:00
|
|
|
text: this.path,
|
2020-10-24 10:21:41 -06:00
|
|
|
}, {
|
2021-04-20 08:22:59 -06:00
|
|
|
icon: 'fas fa-expand-alt',
|
2020-12-25 18:47:36 -07:00
|
|
|
text: this.$ts.showInPage,
|
2020-10-24 10:21:41 -06:00
|
|
|
action: () => {
|
2020-11-02 18:06:19 -07:00
|
|
|
this.$router.push(this.path);
|
2020-10-24 10:21:41 -06:00
|
|
|
this.close();
|
|
|
|
}
|
|
|
|
}, {
|
2021-04-20 08:22:59 -06:00
|
|
|
icon: 'fas fa-window-maximize',
|
2020-12-25 18:47:36 -07:00
|
|
|
text: this.$ts.openInWindow,
|
2020-10-24 10:21:41 -06:00
|
|
|
action: () => {
|
2020-11-02 18:06:19 -07:00
|
|
|
os.pageWindow(this.path);
|
2020-10-24 10:21:41 -06:00
|
|
|
this.close();
|
|
|
|
}
|
|
|
|
}, null, {
|
2021-04-20 08:22:59 -06:00
|
|
|
icon: 'fas fa-external-link-alt',
|
2020-12-25 18:47:36 -07:00
|
|
|
text: this.$ts.openInNewTab,
|
2020-10-24 10:21:41 -06:00
|
|
|
action: () => {
|
|
|
|
window.open(this.url, '_blank');
|
|
|
|
this.close();
|
|
|
|
}
|
|
|
|
}, {
|
2021-04-20 08:22:59 -06:00
|
|
|
icon: 'fas fa-link',
|
2020-12-25 18:47:36 -07:00
|
|
|
text: this.$ts.copyLink,
|
2020-10-24 10:21:41 -06:00
|
|
|
action: () => {
|
|
|
|
copyToClipboard(this.url);
|
|
|
|
}
|
|
|
|
}], e);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
});
|
|
|
|
</script>
|
|
|
|
|
|
|
|
<style lang="scss" scoped>
|
|
|
|
.qvzfzxam {
|
|
|
|
$header-height: 58px; // TODO: どこかに集約したい
|
|
|
|
|
2021-04-09 21:40:50 -06:00
|
|
|
--root-margin: 16px;
|
2020-10-24 10:21:41 -06:00
|
|
|
--margin: var(--marginHalf);
|
|
|
|
|
|
|
|
> .container {
|
|
|
|
position: fixed;
|
|
|
|
width: 370px;
|
|
|
|
height: 100vh;
|
|
|
|
overflow: auto;
|
|
|
|
box-sizing: border-box;
|
|
|
|
|
|
|
|
> .header {
|
|
|
|
display: flex;
|
|
|
|
position: sticky;
|
|
|
|
z-index: 1000;
|
|
|
|
top: 0;
|
|
|
|
height: $header-height;
|
|
|
|
width: 100%;
|
|
|
|
line-height: $header-height;
|
|
|
|
text-align: center;
|
|
|
|
font-weight: bold;
|
|
|
|
//background-color: var(--panel);
|
|
|
|
-webkit-backdrop-filter: blur(32px);
|
|
|
|
backdrop-filter: blur(32px);
|
|
|
|
background-color: var(--header);
|
|
|
|
|
|
|
|
> ._button {
|
|
|
|
height: $header-height;
|
|
|
|
width: $header-height;
|
|
|
|
|
|
|
|
&:hover {
|
|
|
|
color: var(--fgHighlighted);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
> .title {
|
|
|
|
flex: 1;
|
|
|
|
position: relative;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
</style>
|
|
|
|
|