2021-04-11 15:09:35 +03:00
|
|
|
<template>
|
|
|
|
<MkModal ref="modal" @click="$emit('click')" @closed="$emit('closed')">
|
2021-08-09 15:41:20 +03:00
|
|
|
<div class="hrmcaedk _window _narrow_" :style="{ width: `${width}px`, height: (height ? `min(${height}px, 100%)` : '100%') }">
|
2021-04-23 08:59:21 +03:00
|
|
|
<div class="header" @contextmenu="onContextmenu">
|
2021-11-19 12:36:12 +02:00
|
|
|
<button v-if="history.length > 0" v-tooltip="$ts.goBack" class="_button" @click="back()"><i class="fas fa-arrow-left"></i></button>
|
2021-10-08 18:46:52 +03:00
|
|
|
<span v-else style="display: inline-block; width: 20px"></span>
|
|
|
|
<span v-if="pageInfo" class="title">
|
|
|
|
<i v-if="pageInfo.icon" class="icon" :class="pageInfo.icon"></i>
|
|
|
|
<span>{{ pageInfo.title }}</span>
|
2021-04-11 15:09:35 +03:00
|
|
|
</span>
|
2021-10-08 18:46:52 +03:00
|
|
|
<button class="_button" @click="$refs.modal.close()"><i class="fas fa-times"></i></button>
|
2021-04-11 15:09:35 +03:00
|
|
|
</div>
|
2021-10-23 17:22:20 +03:00
|
|
|
<div class="body">
|
2021-10-23 22:03:07 +03:00
|
|
|
<MkStickyContainer>
|
|
|
|
<template #header><MkHeader v-if="pageInfo && !pageInfo.hideHeader" :info="pageInfo"/></template>
|
|
|
|
<keep-alive>
|
|
|
|
<component :is="component" v-bind="props" :ref="changePage"/>
|
|
|
|
</keep-alive>
|
|
|
|
</MkStickyContainer>
|
2021-04-11 15:09:35 +03:00
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</MkModal>
|
|
|
|
</template>
|
|
|
|
|
|
|
|
<script lang="ts">
|
|
|
|
import { defineComponent } from 'vue';
|
2021-11-11 19:02:25 +02:00
|
|
|
import MkModal from '@/components/ui/modal.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';
|
|
|
|
import * as os from '@/os';
|
2021-04-11 15:09:35 +03:00
|
|
|
|
|
|
|
export default defineComponent({
|
|
|
|
components: {
|
|
|
|
MkModal,
|
|
|
|
},
|
|
|
|
|
|
|
|
inject: {
|
|
|
|
sideViewHook: {
|
2022-06-05 06:26:36 +03:00
|
|
|
default: null,
|
|
|
|
},
|
2021-04-11 15:09:35 +03:00
|
|
|
},
|
|
|
|
|
|
|
|
provide() {
|
|
|
|
return {
|
|
|
|
navHook: (path) => {
|
|
|
|
this.navigate(path);
|
2021-10-14 12:51:15 +03:00
|
|
|
},
|
|
|
|
shouldHeaderThin: true,
|
2021-04-11 15:09:35 +03:00
|
|
|
};
|
|
|
|
},
|
|
|
|
|
|
|
|
props: {
|
|
|
|
initialPath: {
|
|
|
|
type: String,
|
|
|
|
required: true,
|
|
|
|
},
|
|
|
|
initialComponent: {
|
|
|
|
type: Object,
|
|
|
|
required: true,
|
|
|
|
},
|
|
|
|
initialProps: {
|
|
|
|
type: Object,
|
|
|
|
required: false,
|
|
|
|
default: () => {},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
|
|
|
|
emits: ['closed'],
|
|
|
|
|
|
|
|
data() {
|
|
|
|
return {
|
2021-04-11 17:49:13 +03:00
|
|
|
width: 860,
|
|
|
|
height: 660,
|
2021-04-11 15:09:35 +03: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 17:22:59 +03:00
|
|
|
icon: 'fas fa-expand-alt',
|
2021-04-11 15:09:35 +03:00
|
|
|
text: this.$ts.showInPage,
|
2022-06-05 06:26:36 +03:00
|
|
|
action: this.expand,
|
2021-04-11 15:09:35 +03:00
|
|
|
}, this.sideViewHook ? {
|
2021-04-20 17:22:59 +03:00
|
|
|
icon: 'fas fa-columns',
|
2021-04-11 15:09:35 +03:00
|
|
|
text: this.$ts.openInSideView,
|
|
|
|
action: () => {
|
|
|
|
this.sideViewHook(this.path);
|
|
|
|
this.$refs.window.close();
|
2022-06-05 06:26:36 +03:00
|
|
|
},
|
2021-04-11 15:09:35 +03:00
|
|
|
} : undefined, {
|
2021-04-20 17:22:59 +03:00
|
|
|
icon: 'fas fa-external-link-alt',
|
2021-04-11 15:09:35 +03:00
|
|
|
text: this.$ts.popout,
|
2022-06-05 06:26:36 +03:00
|
|
|
action: this.popout,
|
2021-04-11 15:09:35 +03:00
|
|
|
}, null, {
|
2021-04-20 17:22:59 +03:00
|
|
|
icon: 'fas fa-external-link-alt',
|
2021-04-11 15:09:35 +03:00
|
|
|
text: this.$ts.openInNewTab,
|
|
|
|
action: () => {
|
|
|
|
window.open(this.url, '_blank');
|
|
|
|
this.$refs.window.close();
|
2022-06-05 06:26:36 +03:00
|
|
|
},
|
2021-04-11 15:09:35 +03:00
|
|
|
}, {
|
2021-04-20 17:22:59 +03:00
|
|
|
icon: 'fas fa-link',
|
2021-04-11 15:09:35 +03:00
|
|
|
text: this.$ts.copyLink,
|
|
|
|
action: () => {
|
|
|
|
copyToClipboard(this.url);
|
2022-06-05 06:26:36 +03:00
|
|
|
},
|
2021-04-11 15:09:35 +03:00
|
|
|
}];
|
|
|
|
},
|
|
|
|
},
|
|
|
|
|
|
|
|
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 08:59:21 +03:00
|
|
|
|
2022-01-18 14:35:57 +02:00
|
|
|
onContextmenu(ev: MouseEvent) {
|
|
|
|
os.contextMenu(this.contextmenu, ev);
|
2022-06-05 06:26:36 +03:00
|
|
|
},
|
2021-04-11 15:09:35 +03: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 19:41:49 +03:00
|
|
|
$height: 52px;
|
2021-04-11 15:09:35 +03:00
|
|
|
$height-narrow: 42px;
|
|
|
|
display: flex;
|
|
|
|
flex-shrink: 0;
|
2021-10-08 18:46:52 +03:00
|
|
|
height: $height;
|
|
|
|
line-height: $height;
|
|
|
|
font-weight: bold;
|
|
|
|
white-space: nowrap;
|
|
|
|
overflow: hidden;
|
|
|
|
text-overflow: ellipsis;
|
2021-04-11 15:09:35 +03:00
|
|
|
box-shadow: 0px 1px var(--divider);
|
|
|
|
|
2021-10-08 18:46:52 +03:00
|
|
|
> button {
|
2021-08-05 16:43:14 +03:00
|
|
|
height: $height;
|
2021-10-08 18:46:52 +03:00
|
|
|
width: $height;
|
|
|
|
|
|
|
|
&:hover {
|
|
|
|
color: var(--fgHighlighted);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
@media (max-width: 500px) {
|
|
|
|
height: $height-narrow;
|
|
|
|
line-height: $height-narrow;
|
|
|
|
padding-left: 16px;
|
2021-04-11 15:09:35 +03:00
|
|
|
|
2021-10-08 18:46:52 +03:00
|
|
|
> button {
|
2021-08-05 16:43:14 +03:00
|
|
|
height: $height-narrow;
|
2021-10-08 18:46:52 +03:00
|
|
|
width: $height-narrow;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
> .title {
|
|
|
|
flex: 1;
|
|
|
|
|
|
|
|
> .icon {
|
|
|
|
margin-right: 0.5em;
|
2021-04-11 15:09:35 +03:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
> .body {
|
|
|
|
overflow: auto;
|
|
|
|
background: var(--bg);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
</style>
|