2020-01-29 20:37:25 +01:00
|
|
|
<template>
|
2020-10-17 13:12:00 +02:00
|
|
|
<MkModal ref="modal" @click="$emit('click')" @closed="$emit('closed')">
|
|
|
|
<div class="ebkgoccj _popup _narrow_" @keydown="onKeydown" :style="{ width: `${width}px`, height: height ? `${height}px` : null }">
|
2020-01-29 20:37:25 +01:00
|
|
|
<div class="header">
|
2020-10-17 13:12:00 +02:00
|
|
|
<button class="_button" v-if="withOkButton" @click="$emit('close')"><Fa :icon="faTimes"/></button>
|
2020-01-29 20:37:25 +01:00
|
|
|
<span class="title">
|
|
|
|
<slot name="header"></slot>
|
|
|
|
</span>
|
2020-10-17 13:12:00 +02:00
|
|
|
<button class="_button" v-if="!withOkButton" @click="$emit('close')"><Fa :icon="faTimes"/></button>
|
|
|
|
<button class="_button" v-if="withOkButton" @click="$emit('ok')" :disabled="okButtonDisabled"><Fa :icon="faCheck"/></button>
|
2020-01-29 20:37:25 +01:00
|
|
|
</div>
|
2020-10-17 13:12:00 +02:00
|
|
|
<div class="body" v-if="padding">
|
|
|
|
<div class="_section">
|
|
|
|
<slot></slot>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
<div class="body" v-else>
|
2020-01-29 20:37:25 +01:00
|
|
|
<slot></slot>
|
|
|
|
</div>
|
|
|
|
</div>
|
2020-10-17 13:12:00 +02:00
|
|
|
</MkModal>
|
2020-01-29 20:37:25 +01:00
|
|
|
</template>
|
|
|
|
|
|
|
|
<script lang="ts">
|
2020-10-17 13:12:00 +02:00
|
|
|
import { defineComponent } from 'vue';
|
2020-01-29 20:37:25 +01:00
|
|
|
import { faTimes, faCheck } from '@fortawesome/free-solid-svg-icons';
|
2020-10-17 13:12:00 +02:00
|
|
|
import MkModal from './modal.vue';
|
2020-01-29 20:37:25 +01:00
|
|
|
|
2020-10-17 13:12:00 +02:00
|
|
|
export default defineComponent({
|
2020-01-29 20:37:25 +01:00
|
|
|
components: {
|
2020-10-17 13:12:00 +02:00
|
|
|
MkModal
|
2020-01-29 20:37:25 +01:00
|
|
|
},
|
|
|
|
props: {
|
|
|
|
withOkButton: {
|
|
|
|
type: Boolean,
|
|
|
|
required: false,
|
|
|
|
default: false
|
|
|
|
},
|
|
|
|
okButtonDisabled: {
|
|
|
|
type: Boolean,
|
|
|
|
required: false,
|
|
|
|
default: false
|
|
|
|
},
|
2020-10-17 13:12:00 +02:00
|
|
|
padding: {
|
2020-01-29 20:37:25 +01:00
|
|
|
type: Boolean,
|
|
|
|
required: false,
|
|
|
|
default: false
|
2020-04-21 17:34:56 +02:00
|
|
|
},
|
|
|
|
width: {
|
|
|
|
type: Number,
|
|
|
|
required: false,
|
|
|
|
default: 400
|
|
|
|
},
|
|
|
|
height: {
|
|
|
|
type: Number,
|
|
|
|
required: false,
|
2020-10-17 13:12:00 +02:00
|
|
|
default: null
|
2020-04-21 17:34:56 +02:00
|
|
|
},
|
2020-07-11 03:13:11 +02:00
|
|
|
canClose: {
|
|
|
|
type: Boolean,
|
|
|
|
required: false,
|
|
|
|
default: true,
|
|
|
|
},
|
2020-01-29 20:37:25 +01:00
|
|
|
},
|
|
|
|
|
2020-10-17 13:12:00 +02:00
|
|
|
emits: ['click', 'close', 'closed', 'ok'],
|
|
|
|
|
2020-01-29 20:37:25 +01:00
|
|
|
data() {
|
|
|
|
return {
|
|
|
|
faTimes, faCheck
|
|
|
|
};
|
|
|
|
},
|
|
|
|
|
|
|
|
methods: {
|
|
|
|
close() {
|
|
|
|
this.$refs.modal.close();
|
|
|
|
},
|
|
|
|
|
|
|
|
onKeydown(e) {
|
|
|
|
if (e.which === 27) { // Esc
|
|
|
|
e.preventDefault();
|
|
|
|
e.stopPropagation();
|
|
|
|
this.close();
|
|
|
|
}
|
|
|
|
},
|
|
|
|
}
|
|
|
|
});
|
|
|
|
</script>
|
|
|
|
|
|
|
|
<style lang="scss" scoped>
|
|
|
|
.ebkgoccj {
|
|
|
|
overflow: hidden;
|
|
|
|
display: flex;
|
|
|
|
flex-direction: column;
|
2020-10-17 13:12:00 +02:00
|
|
|
contain: content;
|
|
|
|
|
|
|
|
--section-padding: 24px;
|
|
|
|
|
|
|
|
@media (max-width: 500px) {
|
|
|
|
--section-padding: 16px;
|
|
|
|
}
|
2020-01-29 20:37:25 +01:00
|
|
|
|
|
|
|
> .header {
|
|
|
|
$height: 58px;
|
|
|
|
$height-narrow: 42px;
|
|
|
|
display: flex;
|
|
|
|
flex-shrink: 0;
|
2020-10-17 13:12:00 +02:00
|
|
|
box-shadow: 0px 1px var(--divider);
|
2020-01-29 20:37:25 +01:00
|
|
|
|
|
|
|
> button {
|
|
|
|
height: $height;
|
|
|
|
width: $height;
|
|
|
|
|
|
|
|
@media (max-width: 500px) {
|
|
|
|
height: $height-narrow;
|
|
|
|
width: $height-narrow;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
> .title {
|
|
|
|
flex: 1;
|
|
|
|
line-height: $height;
|
|
|
|
padding-left: 32px;
|
|
|
|
font-weight: bold;
|
|
|
|
white-space: nowrap;
|
|
|
|
overflow: hidden;
|
|
|
|
text-overflow: ellipsis;
|
|
|
|
pointer-events: none;
|
|
|
|
|
|
|
|
@media (max-width: 500px) {
|
|
|
|
line-height: $height-narrow;
|
|
|
|
padding-left: 16px;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
> button + .title {
|
|
|
|
padding-left: 0;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
> .body {
|
|
|
|
overflow: auto;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
</style>
|