2021-04-11 14:09:35 +02:00
|
|
|
<template>
|
|
|
|
<MkModal ref="modal" @click="$emit('click')" @closed="$emit('closed')">
|
2021-08-09 14:41:20 +02:00
|
|
|
<div class="hrmcaedk _window _narrow_" :style="{ width: `${width}px`, height: (height ? `min(${height}px, 100%)` : '100%') }">
|
2021-04-23 07:59:21 +02:00
|
|
|
<div class="header" @contextmenu="onContextmenu">
|
2021-04-11 14:09:35 +02:00
|
|
|
<span class="title">
|
2021-10-08 15:03:06 +02:00
|
|
|
|
2021-04-11 14:09:35 +02:00
|
|
|
</span>
|
|
|
|
</div>
|
|
|
|
<div class="body _flat_">
|
2021-10-08 15:03:06 +02:00
|
|
|
<XHeader :info="pageInfo"/>
|
2021-04-11 14:31:38 +02:00
|
|
|
<keep-alive>
|
|
|
|
<component :is="component" v-bind="props" :ref="changePage"/>
|
|
|
|
</keep-alive>
|
2021-04-11 14:09:35 +02:00
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</MkModal>
|
|
|
|
</template>
|
|
|
|
|
|
|
|
<script lang="ts">
|
|
|
|
import { defineComponent } from 'vue';
|
|
|
|
import MkModal from '@client/components/ui/modal.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';
|
|
|
|
import * as symbols from '@client/symbols';
|
2021-04-23 07:59:21 +02:00
|
|
|
import * as os from '@client/os';
|
2021-04-11 14:09:35 +02:00
|
|
|
|
|
|
|
export default defineComponent({
|
|
|
|
components: {
|
|
|
|
MkModal,
|
|
|
|
XHeader,
|
|
|
|
},
|
|
|
|
|
|
|
|
inject: {
|
|
|
|
sideViewHook: {
|
|
|
|
default: null
|
|
|
|
}
|
|
|
|
},
|
|
|
|
|
|
|
|
provide() {
|
|
|
|
return {
|
|
|
|
navHook: (path) => {
|
|
|
|
this.navigate(path);
|
|
|
|
}
|
|
|
|
};
|
|
|
|
},
|
|
|
|
|
|
|
|
props: {
|
|
|
|
initialPath: {
|
|
|
|
type: String,
|
|
|
|
required: true,
|
|
|
|
},
|
|
|
|
initialComponent: {
|
|
|
|
type: Object,
|
|
|
|
required: true,
|
|
|
|
},
|
|
|
|
initialProps: {
|
|
|
|
type: Object,
|
|
|
|
required: false,
|
|
|
|
default: () => {},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
|
|
|
|
emits: ['closed'],
|
|
|
|
|
|
|
|
data() {
|
|
|
|
return {
|
2021-04-11 16:49:13 +02:00
|
|
|
width: 860,
|
|
|
|
height: 660,
|
2021-04-11 14:09:35 +02:00
|
|
|
pageInfo: null,
|
|
|
|
path: this.initialPath,
|
|
|
|
component: this.initialComponent,
|
|
|
|
props: this.initialProps,
|
|
|
|
history: [],
|
|
|
|
};
|
|
|
|
},
|
|
|
|
|
|
|
|
computed: {
|
|
|
|
url(): string {
|
|
|
|
return url + this.path;
|
|
|
|
},
|
|
|
|
|
|
|
|
contextmenu() {
|
|
|
|
return [{
|
|
|
|
type: 'label',
|
|
|
|
text: this.path,
|
|
|
|
}, {
|
2021-04-20 16:22:59 +02:00
|
|
|
icon: 'fas fa-expand-alt',
|
2021-04-11 14:09:35 +02:00
|
|
|
text: this.$ts.showInPage,
|
|
|
|
action: this.expand
|
|
|
|
}, this.sideViewHook ? {
|
2021-04-20 16:22:59 +02:00
|
|
|
icon: 'fas fa-columns',
|
2021-04-11 14:09:35 +02:00
|
|
|
text: this.$ts.openInSideView,
|
|
|
|
action: () => {
|
|
|
|
this.sideViewHook(this.path);
|
|
|
|
this.$refs.window.close();
|
|
|
|
}
|
|
|
|
} : undefined, {
|
2021-04-20 16:22:59 +02:00
|
|
|
icon: 'fas fa-external-link-alt',
|
2021-04-11 14:09:35 +02:00
|
|
|
text: this.$ts.popout,
|
|
|
|
action: this.popout
|
|
|
|
}, null, {
|
2021-04-20 16:22:59 +02:00
|
|
|
icon: 'fas fa-external-link-alt',
|
2021-04-11 14:09:35 +02:00
|
|
|
text: this.$ts.openInNewTab,
|
|
|
|
action: () => {
|
|
|
|
window.open(this.url, '_blank');
|
|
|
|
this.$refs.window.close();
|
|
|
|
}
|
|
|
|
}, {
|
2021-04-20 16:22:59 +02:00
|
|
|
icon: 'fas fa-link',
|
2021-04-11 14:09:35 +02:00
|
|
|
text: this.$ts.copyLink,
|
|
|
|
action: () => {
|
|
|
|
copyToClipboard(this.url);
|
|
|
|
}
|
|
|
|
}];
|
|
|
|
},
|
|
|
|
},
|
|
|
|
|
|
|
|
methods: {
|
|
|
|
changePage(page) {
|
|
|
|
if (page == null) return;
|
|
|
|
if (page[symbols.PAGE_INFO]) {
|
|
|
|
this.pageInfo = page[symbols.PAGE_INFO];
|
|
|
|
}
|
|
|
|
},
|
|
|
|
|
|
|
|
navigate(path, record = true) {
|
|
|
|
if (record) this.history.push(this.path);
|
|
|
|
this.path = path;
|
|
|
|
const { component, props } = resolve(path);
|
|
|
|
this.component = component;
|
|
|
|
this.props = props;
|
|
|
|
},
|
|
|
|
|
|
|
|
back() {
|
|
|
|
this.navigate(this.history.pop(), false);
|
|
|
|
},
|
|
|
|
|
|
|
|
expand() {
|
|
|
|
this.$router.push(this.path);
|
|
|
|
this.$refs.window.close();
|
|
|
|
},
|
|
|
|
|
|
|
|
popout() {
|
|
|
|
popout(this.path, this.$el);
|
|
|
|
this.$refs.window.close();
|
|
|
|
},
|
2021-04-23 07:59:21 +02:00
|
|
|
|
|
|
|
onContextmenu(e) {
|
|
|
|
os.contextMenu(this.contextmenu, e);
|
|
|
|
}
|
2021-04-11 14:09:35 +02:00
|
|
|
},
|
|
|
|
});
|
|
|
|
</script>
|
|
|
|
|
|
|
|
<style lang="scss" scoped>
|
|
|
|
.hrmcaedk {
|
|
|
|
overflow: hidden;
|
|
|
|
display: flex;
|
|
|
|
flex-direction: column;
|
|
|
|
contain: content;
|
|
|
|
|
|
|
|
--root-margin: 24px;
|
|
|
|
|
|
|
|
@media (max-width: 500px) {
|
|
|
|
--root-margin: 16px;
|
|
|
|
}
|
|
|
|
|
|
|
|
> .header {
|
2021-04-13 18:41:49 +02:00
|
|
|
$height: 52px;
|
2021-04-11 14:09:35 +02:00
|
|
|
$height-narrow: 42px;
|
|
|
|
display: flex;
|
|
|
|
flex-shrink: 0;
|
|
|
|
box-shadow: 0px 1px var(--divider);
|
|
|
|
|
|
|
|
> .title {
|
|
|
|
flex: 1;
|
2021-08-05 15:43:14 +02:00
|
|
|
height: $height;
|
2021-04-11 14:09:35 +02:00
|
|
|
font-weight: bold;
|
|
|
|
white-space: nowrap;
|
|
|
|
overflow: hidden;
|
|
|
|
text-overflow: ellipsis;
|
|
|
|
|
|
|
|
@media (max-width: 500px) {
|
2021-08-05 15:43:14 +02:00
|
|
|
height: $height-narrow;
|
2021-04-11 14:09:35 +02:00
|
|
|
padding-left: 16px;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
> .body {
|
|
|
|
overflow: auto;
|
|
|
|
background: var(--bg);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
</style>
|