2018-03-27 19:54:05 +05:30
|
|
|
<script>
|
2018-05-09 12:01:36 +05:30
|
|
|
const buttonVariants = ['danger', 'primary', 'success', 'warning'];
|
2018-03-27 19:54:05 +05:30
|
|
|
|
2018-05-09 12:01:36 +05:30
|
|
|
export default {
|
|
|
|
name: 'GlModal',
|
2018-03-27 19:54:05 +05:30
|
|
|
|
2018-05-09 12:01:36 +05:30
|
|
|
props: {
|
|
|
|
id: {
|
|
|
|
type: String,
|
|
|
|
required: false,
|
|
|
|
default: null,
|
2018-03-27 19:54:05 +05:30
|
|
|
},
|
2018-05-09 12:01:36 +05:30
|
|
|
headerTitleText: {
|
|
|
|
type: String,
|
|
|
|
required: false,
|
|
|
|
default: '',
|
|
|
|
},
|
|
|
|
footerPrimaryButtonVariant: {
|
|
|
|
type: String,
|
|
|
|
required: false,
|
|
|
|
default: 'primary',
|
|
|
|
validator: value => buttonVariants.includes(value),
|
|
|
|
},
|
|
|
|
footerPrimaryButtonText: {
|
|
|
|
type: String,
|
|
|
|
required: false,
|
|
|
|
default: '',
|
|
|
|
},
|
|
|
|
},
|
2018-03-27 19:54:05 +05:30
|
|
|
|
2018-05-09 12:01:36 +05:30
|
|
|
methods: {
|
|
|
|
emitCancel(event) {
|
|
|
|
this.$emit('cancel', event);
|
|
|
|
},
|
|
|
|
emitSubmit(event) {
|
|
|
|
this.$emit('submit', event);
|
2018-03-27 19:54:05 +05:30
|
|
|
},
|
2018-05-09 12:01:36 +05:30
|
|
|
},
|
|
|
|
};
|
2018-03-27 19:54:05 +05:30
|
|
|
</script>
|
|
|
|
|
|
|
|
<template>
|
|
|
|
<div
|
|
|
|
:id="id"
|
|
|
|
class="modal fade"
|
|
|
|
tabindex="-1"
|
|
|
|
role="dialog"
|
|
|
|
>
|
|
|
|
<div
|
|
|
|
class="modal-dialog"
|
|
|
|
role="document"
|
|
|
|
>
|
|
|
|
<div class="modal-content">
|
|
|
|
<div class="modal-header">
|
|
|
|
<slot name="header">
|
|
|
|
<button
|
|
|
|
type="button"
|
2018-05-09 12:01:36 +05:30
|
|
|
class="close js-modal-close-action"
|
2018-03-27 19:54:05 +05:30
|
|
|
data-dismiss="modal"
|
|
|
|
:aria-label="s__('Modal|Close')"
|
|
|
|
@click="emitCancel($event)"
|
|
|
|
>
|
|
|
|
<span aria-hidden="true">×</span>
|
|
|
|
</button>
|
|
|
|
<h4 class="modal-title">
|
|
|
|
<slot name="title">
|
|
|
|
{{ headerTitleText }}
|
|
|
|
</slot>
|
|
|
|
</h4>
|
|
|
|
</slot>
|
|
|
|
</div>
|
|
|
|
|
|
|
|
<div class="modal-body">
|
|
|
|
<slot></slot>
|
|
|
|
</div>
|
|
|
|
|
|
|
|
<div class="modal-footer">
|
|
|
|
<slot name="footer">
|
|
|
|
<button
|
|
|
|
type="button"
|
2018-05-09 12:01:36 +05:30
|
|
|
class="btn js-modal-cancel-action"
|
2018-03-27 19:54:05 +05:30
|
|
|
data-dismiss="modal"
|
|
|
|
@click="emitCancel($event)"
|
|
|
|
>
|
|
|
|
{{ s__('Modal|Cancel') }}
|
|
|
|
</button>
|
|
|
|
<button
|
|
|
|
type="button"
|
2018-05-09 12:01:36 +05:30
|
|
|
class="btn js-modal-primary-action"
|
2018-03-27 19:54:05 +05:30
|
|
|
:class="`btn-${footerPrimaryButtonVariant}`"
|
|
|
|
data-dismiss="modal"
|
|
|
|
@click="emitSubmit($event)"
|
|
|
|
>
|
|
|
|
{{ footerPrimaryButtonText }}
|
|
|
|
</button>
|
|
|
|
</slot>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</template>
|