2019-02-18 15:43:41 -08:00
|
|
|
<ModalDialog
|
|
|
|
{id}
|
|
|
|
{label}
|
|
|
|
{title}
|
2019-02-18 19:55:44 -08:00
|
|
|
{className}
|
2019-04-14 14:09:10 -07:00
|
|
|
shrinkWidthToFit={true}
|
2019-02-18 15:43:41 -08:00
|
|
|
background="var(--main-bg)"
|
|
|
|
>
|
|
|
|
<form class="confirmation-dialog-form">
|
|
|
|
<slot></slot>
|
|
|
|
<div class="confirmation-dialog-form-flex">
|
2021-03-13 17:31:17 -08:00
|
|
|
<button type="button" disabled={confirmationButtonDisabled} on:click="onPositive()">
|
2019-02-18 15:43:41 -08:00
|
|
|
{positiveText || 'OK'}
|
|
|
|
</button>
|
|
|
|
<button type="button" on:click="onNegative()">
|
|
|
|
{negativeText || 'Cancel'}
|
|
|
|
</button>
|
|
|
|
</div>
|
|
|
|
</form>
|
|
|
|
</ModalDialog>
|
|
|
|
<style>
|
|
|
|
.confirmation-dialog-form-flex {
|
|
|
|
display: grid;
|
|
|
|
grid-template-columns: 1fr 1fr;
|
|
|
|
grid-gap: 10px;
|
|
|
|
padding: 10px 20px;
|
|
|
|
}
|
|
|
|
.confirmation-dialog-form-flex button {
|
|
|
|
min-width: 125px;
|
|
|
|
}
|
|
|
|
</style>
|
|
|
|
<script>
|
|
|
|
import ModalDialog from './ModalDialog.html'
|
|
|
|
import { show } from '../helpers/showDialog'
|
|
|
|
import { close } from '../helpers/closeDialog'
|
|
|
|
import { on } from '../../../_utils/eventBus'
|
|
|
|
import { oncreate as onCreateDialog } from '../helpers/onCreateDialog'
|
|
|
|
|
|
|
|
export default {
|
|
|
|
oncreate () {
|
|
|
|
on('destroyDialog', this, this.onDestroyDialog)
|
|
|
|
onCreateDialog.call(this)
|
|
|
|
},
|
|
|
|
data: () => ({
|
2019-08-19 19:08:59 -07:00
|
|
|
positiveText: undefined,
|
|
|
|
negativeText: undefined,
|
2019-04-14 19:47:30 -07:00
|
|
|
className: ''
|
2019-02-18 15:43:41 -08:00
|
|
|
}),
|
|
|
|
methods: {
|
|
|
|
show,
|
|
|
|
close,
|
|
|
|
onDestroyDialog (thisId) {
|
2019-08-03 13:49:37 -07:00
|
|
|
const {
|
2019-02-18 15:43:41 -08:00
|
|
|
id,
|
|
|
|
positiveResult
|
|
|
|
} = this.get()
|
|
|
|
if (thisId !== id) {
|
|
|
|
return
|
|
|
|
}
|
|
|
|
if (positiveResult) {
|
|
|
|
this.fire('positive')
|
|
|
|
} else {
|
|
|
|
this.fire('negative')
|
|
|
|
}
|
|
|
|
},
|
|
|
|
onPositive () {
|
|
|
|
this.set({ positiveResult: true })
|
|
|
|
this.close()
|
|
|
|
},
|
|
|
|
onNegative () {
|
|
|
|
this.close()
|
|
|
|
}
|
|
|
|
},
|
|
|
|
components: {
|
|
|
|
ModalDialog
|
|
|
|
}
|
|
|
|
}
|
|
|
|
</script>
|