2018-07-10 13:35:43 +00:00
|
|
|
<template>
|
2018-07-16 11:20:24 +00:00
|
|
|
<div :class="['modal fade show d-block']" @click.self="onBackdropClick"
|
2018-07-10 13:35:43 +00:00
|
|
|
tabindex="-1" role="dialog" aria-labelledby="frappe-modal-label" aria-hidden="true">
|
|
|
|
<div class="modal-dialog" role="document">
|
|
|
|
<div class="modal-content shadow">
|
2018-07-16 11:20:24 +00:00
|
|
|
<div class="modal-header" v-if="!noHeader">
|
2018-07-10 13:35:43 +00:00
|
|
|
<h5 class="modal-title">{{ title }}</h5>
|
|
|
|
<button type="button" class="close" data-dismiss="modal" aria-label="Close" @click="closeModal">
|
|
|
|
<span aria-hidden="true">×</span>
|
|
|
|
</button>
|
|
|
|
</div>
|
2018-07-16 11:20:24 +00:00
|
|
|
<div class="modal-body modal-height p-0">
|
2018-07-15 11:39:40 +00:00
|
|
|
<component ref="modalComponent" :is="component" v-bind="props" v-on="events"/>
|
2018-07-10 13:35:43 +00:00
|
|
|
</div>
|
|
|
|
<div class="modal-footer">
|
2018-07-15 11:39:40 +00:00
|
|
|
<!-- <f-button secondary @click="closeModal">{{ _('Close') }}</f-button> -->
|
|
|
|
<f-button primary v-if="primaryAction" @click="onPrimaryAction">{{ primaryAction.label }}</f-button>
|
2018-07-10 13:35:43 +00:00
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</template>
|
|
|
|
<script>
|
|
|
|
export default {
|
|
|
|
props: {
|
|
|
|
title: {
|
|
|
|
type: String,
|
|
|
|
default: "Modal Title"
|
|
|
|
},
|
2018-07-15 11:39:40 +00:00
|
|
|
primaryAction: {
|
|
|
|
type: Object,
|
|
|
|
default: null
|
|
|
|
},
|
2018-07-10 13:35:43 +00:00
|
|
|
component: {
|
|
|
|
type: Object
|
|
|
|
},
|
|
|
|
props: {
|
|
|
|
type: Object
|
|
|
|
},
|
|
|
|
events: {
|
|
|
|
type: Object
|
2018-07-16 11:20:24 +00:00
|
|
|
},
|
|
|
|
noHeader: {
|
|
|
|
type: Boolean,
|
|
|
|
default: false
|
2018-07-10 13:35:43 +00:00
|
|
|
}
|
|
|
|
},
|
|
|
|
methods: {
|
|
|
|
closeModal() {
|
|
|
|
this.$emit('close-modal');
|
2018-07-15 11:39:40 +00:00
|
|
|
},
|
|
|
|
onPrimaryAction() {
|
|
|
|
this.primaryAction.handler(this.$refs.modalComponent);
|
2018-07-16 11:20:24 +00:00
|
|
|
},
|
|
|
|
onBackdropClick(e) {
|
|
|
|
this.closeModal();
|
2018-07-10 13:35:43 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
};
|
|
|
|
</script>
|
|
|
|
<style scoped>
|
|
|
|
.modal-height {
|
|
|
|
max-height: 80vh;
|
|
|
|
overflow: auto;
|
|
|
|
}
|
|
|
|
</style>
|