2018-08-11 07:47:10 +02:00
|
|
|
<template>
|
2025-01-23 09:31:51 +01:00
|
|
|
<transition name="fade">
|
|
|
|
<div v-if="show" class="modal is-active">
|
|
|
|
<div class="modal-background" @click="$emit('close')" />
|
|
|
|
<div class="modal-content">
|
|
|
|
<div class="card">
|
|
|
|
<div class="card-content">
|
2025-02-08 14:35:25 +01:00
|
|
|
<p v-if="title" class="title is-4" v-text="title" />
|
2025-02-09 08:05:03 +01:00
|
|
|
<slot name="content" />
|
2025-01-23 09:31:51 +01:00
|
|
|
</div>
|
2025-02-09 08:05:03 +01:00
|
|
|
<footer v-if="actions.length" class="card-footer">
|
2025-02-08 14:35:25 +01:00
|
|
|
<a
|
|
|
|
v-for="action in actions"
|
2025-02-09 17:52:45 +01:00
|
|
|
:key="action.label"
|
2025-02-08 14:35:25 +01:00
|
|
|
class="card-footer-item"
|
|
|
|
:class="{ 'is-disabled': action.disabled }"
|
2025-02-09 08:05:03 +01:00
|
|
|
@click="action.handler"
|
2025-02-08 14:35:25 +01:00
|
|
|
>
|
|
|
|
<mdicon class="icon" :name="action.icon" size="16" />
|
|
|
|
<span class="is-size-7" v-text="action.label" />
|
|
|
|
</a>
|
2025-01-23 09:31:51 +01:00
|
|
|
</footer>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</transition>
|
2018-08-11 07:47:10 +02:00
|
|
|
</template>
|
|
|
|
|
|
|
|
<script>
|
|
|
|
export default {
|
2025-02-09 08:05:03 +01:00
|
|
|
name: 'ModalDialog',
|
2024-02-27 17:18:58 +01:00
|
|
|
props: {
|
2025-02-09 08:05:03 +01:00
|
|
|
actions: { type: Array, required: true },
|
2025-02-08 14:35:25 +01:00
|
|
|
show: Boolean,
|
2025-02-09 08:05:03 +01:00
|
|
|
title: { type: String, default: '' }
|
2024-02-27 17:18:58 +01:00
|
|
|
},
|
2025-02-04 22:00:48 +01:00
|
|
|
emits: ['close'],
|
|
|
|
watch: {
|
|
|
|
show(value) {
|
|
|
|
const { classList } = document.querySelector('html')
|
|
|
|
if (value) {
|
|
|
|
classList.add('is-clipped')
|
|
|
|
} else {
|
|
|
|
classList.remove('is-clipped')
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2018-08-11 07:47:10 +02:00
|
|
|
}
|
|
|
|
</script>
|
2025-01-23 09:31:51 +01:00
|
|
|
|
2025-02-04 22:00:48 +01:00
|
|
|
<style scoped>
|
|
|
|
.fade-leave-active {
|
|
|
|
transition: opacity 0.2s ease;
|
|
|
|
}
|
|
|
|
.fade-enter-active {
|
|
|
|
transition: opacity 0.5s ease;
|
|
|
|
}
|
|
|
|
.fade-enter-from,
|
|
|
|
.fade-leave-to {
|
|
|
|
opacity: 0;
|
|
|
|
}
|
|
|
|
.fade-enter-to,
|
|
|
|
.fade-leave-from {
|
|
|
|
opacity: 1;
|
|
|
|
}
|
2025-02-09 08:05:03 +01:00
|
|
|
.card-content {
|
|
|
|
max-height: calc(100vh - calc(4 * var(--bulma-navbar-height)));
|
|
|
|
overflow: auto;
|
|
|
|
}
|
2025-02-04 22:00:48 +01:00
|
|
|
</style>
|