Message slot added to confirmdialog component
parent
2afa257b09
commit
27ac7ac76e
|
@ -1,8 +1,12 @@
|
||||||
<template>
|
<template>
|
||||||
<CDialog v-model:visible="visible" :modal="true" :header="header" :blockScroll="blockScroll" :position="position" class="p-confirm-dialog"
|
<CDialog v-model:visible="visible" :modal="true" :header="header" :blockScroll="blockScroll" :position="position" class="p-confirm-dialog"
|
||||||
:breakpoints="breakpoints" :closeOnEscape="closeOnEscape">
|
:breakpoints="breakpoints" :closeOnEscape="closeOnEscape">
|
||||||
|
<template v-if="!$slots.message">
|
||||||
<i :class="iconClass" />
|
<i :class="iconClass" />
|
||||||
<span class="p-confirm-dialog-message">{{ message }}</span>
|
<span class="p-confirm-dialog-message">{{ message }}</span>
|
||||||
|
</template>
|
||||||
|
<component v-else :is="$slots.message"
|
||||||
|
:message="confirmation"></component>
|
||||||
<template #footer>
|
<template #footer>
|
||||||
<CDButton :label="rejectLabel" :icon="rejectIcon" :class="rejectClass" @click="reject()" :autofocus="autoFocusReject"/>
|
<CDButton :label="rejectLabel" :icon="rejectIcon" :class="rejectClass" @click="reject()" :autofocus="autoFocusReject"/>
|
||||||
<CDButton :label="acceptLabel" :icon="acceptIcon" :class="acceptClass" @click="accept()" :autofocus="autoFocusAccept" />
|
<CDButton :label="acceptLabel" :icon="acceptIcon" :class="acceptClass" @click="accept()" :autofocus="autoFocusAccept" />
|
||||||
|
|
|
@ -10,6 +10,14 @@
|
||||||
|
|
||||||
<div class="content-section implementation">
|
<div class="content-section implementation">
|
||||||
<ConfirmDialog></ConfirmDialog>
|
<ConfirmDialog></ConfirmDialog>
|
||||||
|
<ConfirmDialog group="templating">
|
||||||
|
<template #message="slotProps">
|
||||||
|
<div class="flex p-4">
|
||||||
|
<i :class="slotProps.message.icon" style="font-size: 1.5rem"></i>
|
||||||
|
<p class="pl-2">{{slotProps.message.message}}</p>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
</ConfirmDialog>
|
||||||
<ConfirmDialog group="positionDialog"></ConfirmDialog>
|
<ConfirmDialog group="positionDialog"></ConfirmDialog>
|
||||||
|
|
||||||
<div class="card">
|
<div class="card">
|
||||||
|
@ -17,6 +25,9 @@
|
||||||
<Button @click="confirm1()" icon="pi pi-check" label="Confirm" class="mr-2"></Button>
|
<Button @click="confirm1()" icon="pi pi-check" label="Confirm" class="mr-2"></Button>
|
||||||
<Button @click="confirm2()" icon="pi pi-times" label="Delete"></Button>
|
<Button @click="confirm2()" icon="pi pi-times" label="Delete"></Button>
|
||||||
|
|
||||||
|
<h5>Templating</h5>
|
||||||
|
<Button @click="showTemplate()" icon="pi pi-check" label="Terms and Conditions" class="mr-2"></Button>
|
||||||
|
|
||||||
<h5>Position</h5>
|
<h5>Position</h5>
|
||||||
<div class="grid flex-column">
|
<div class="grid flex-column">
|
||||||
<div class="col">
|
<div class="col">
|
||||||
|
@ -87,6 +98,22 @@ export default {
|
||||||
this.$toast.add({severity:'error', summary:'Rejected', detail:'You have rejected', life: 3000});
|
this.$toast.add({severity:'error', summary:'Rejected', detail:'You have rejected', life: 3000});
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
},
|
||||||
|
showTemplate() {
|
||||||
|
this.$confirm.require({
|
||||||
|
group: 'templating',
|
||||||
|
header: 'Terms and Conditions',
|
||||||
|
message: 'Do you accept that?',
|
||||||
|
icon: 'pi pi-question-circle',
|
||||||
|
acceptIcon: 'pi pi-check',
|
||||||
|
rejectIcon: 'pi pi-times',
|
||||||
|
accept: () => {
|
||||||
|
this.$toast.add({severity:'info', summary:'Confirmed', detail:'You have accepted', life: 3000});
|
||||||
|
},
|
||||||
|
reject: () => {
|
||||||
|
this.$toast.add({severity:'error', summary:'Rejected', detail:'You have rejected', life: 3000});
|
||||||
|
}
|
||||||
|
});
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
components: {
|
components: {
|
||||||
|
|
|
@ -299,6 +299,14 @@ export default {
|
||||||
<div>
|
<div>
|
||||||
<Toast />
|
<Toast />
|
||||||
<ConfirmDialog></ConfirmDialog>
|
<ConfirmDialog></ConfirmDialog>
|
||||||
|
<ConfirmDialog group="templating">
|
||||||
|
<template #message="slotProps">
|
||||||
|
<div class="flex p-4">
|
||||||
|
<i :class="slotProps.message.icon" style="font-size: 1.5rem"></i>
|
||||||
|
<p class="pl-2">{{slotProps.message.message}}</p>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
</ConfirmDialog>
|
||||||
<ConfirmDialog group="positionDialog"></ConfirmDialog>
|
<ConfirmDialog group="positionDialog"></ConfirmDialog>
|
||||||
|
|
||||||
<div class="card">
|
<div class="card">
|
||||||
|
@ -306,6 +314,9 @@ export default {
|
||||||
<Button @click="confirm1()" icon="pi pi-check" label="Confirm" class="mr-2"></Button>
|
<Button @click="confirm1()" icon="pi pi-check" label="Confirm" class="mr-2"></Button>
|
||||||
<Button @click="confirm2()" icon="pi pi-times" label="Delete"></Button>
|
<Button @click="confirm2()" icon="pi pi-times" label="Delete"></Button>
|
||||||
|
|
||||||
|
<h5>Templating</h5>
|
||||||
|
<Button @click="showTemplate()" icon="pi pi-check" label="Terms and Conditions" class="mr-2"></Button>
|
||||||
|
|
||||||
<h5>Position</h5>
|
<h5>Position</h5>
|
||||||
<div class="grid flex-column">
|
<div class="grid flex-column">
|
||||||
<div class="p-col">
|
<div class="p-col">
|
||||||
|
@ -371,6 +382,22 @@ export default {
|
||||||
this.$toast.add({severity:'error', summary:'Rejected', detail:'You have rejected', life: 3000});
|
this.$toast.add({severity:'error', summary:'Rejected', detail:'You have rejected', life: 3000});
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
},
|
||||||
|
showTemplate() {
|
||||||
|
this.$confirm.require({
|
||||||
|
group: 'templating',
|
||||||
|
header: 'Terms and Conditions',
|
||||||
|
message: 'Do you accept that?',
|
||||||
|
icon: 'pi pi-question-circle',
|
||||||
|
acceptIcon: 'pi pi-check',
|
||||||
|
rejectIcon: 'pi pi-times',
|
||||||
|
accept: () => {
|
||||||
|
this.$toast.add({severity:'info', summary:'Confirmed', detail:'You have accepted', life: 3000});
|
||||||
|
},
|
||||||
|
reject: () => {
|
||||||
|
this.$toast.add({severity:'error', summary:'Rejected', detail:'You have rejected', life: 3000});
|
||||||
|
}
|
||||||
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -384,6 +411,14 @@ export default {
|
||||||
<div>
|
<div>
|
||||||
<Toast />
|
<Toast />
|
||||||
<ConfirmDialog></ConfirmDialog>
|
<ConfirmDialog></ConfirmDialog>
|
||||||
|
<ConfirmDialog group="templating">
|
||||||
|
<template #message="slotProps">
|
||||||
|
<div class="flex p-4">
|
||||||
|
<i :class="slotProps.message.icon" style="font-size: 1.5rem"></i>
|
||||||
|
<p class="pl-2">{{slotProps.message.message}}</p>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
</ConfirmDialog>
|
||||||
<ConfirmDialog group="positionDialog"></ConfirmDialog>
|
<ConfirmDialog group="positionDialog"></ConfirmDialog>
|
||||||
|
|
||||||
<div class="card">
|
<div class="card">
|
||||||
|
@ -391,6 +426,9 @@ export default {
|
||||||
<Button @click="confirm1()" icon="pi pi-check" label="Confirm" class="mr-2"></Button>
|
<Button @click="confirm1()" icon="pi pi-check" label="Confirm" class="mr-2"></Button>
|
||||||
<Button @click="confirm2()" icon="pi pi-times" label="Delete"></Button>
|
<Button @click="confirm2()" icon="pi pi-times" label="Delete"></Button>
|
||||||
|
|
||||||
|
<h5>Templating</h5>
|
||||||
|
<Button @click="showTemplate()" icon="pi pi-check" label="Terms and Conditions" class="mr-2"></Button>
|
||||||
|
|
||||||
<h5>Position</h5>
|
<h5>Position</h5>
|
||||||
<div class="grid flex-column">
|
<div class="grid flex-column">
|
||||||
<div class="p-col">
|
<div class="p-col">
|
||||||
|
@ -467,7 +505,24 @@ export default defineComponent({
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
return { confirm1, confirm2, confirmPosition };
|
const showTemplate = () => {
|
||||||
|
confirm.require({
|
||||||
|
group: 'templating',
|
||||||
|
header: 'Terms and Conditions',
|
||||||
|
message: 'Do you accept that?',
|
||||||
|
icon: 'pi pi-question-circle',
|
||||||
|
acceptIcon: 'pi pi-check',
|
||||||
|
rejectIcon: 'pi pi-times',
|
||||||
|
accept: () => {
|
||||||
|
this.$toast.add({severity:'info', summary:'Confirmed', detail:'You have accepted', life: 3000});
|
||||||
|
},
|
||||||
|
reject: () => {
|
||||||
|
this.$toast.add({severity:'error', summary:'Rejected', detail:'You have rejected', life: 3000});
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
return { confirm1, confirm2, confirmPosition, showTemplate };
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
<\\/script>
|
<\\/script>
|
||||||
|
@ -482,6 +537,14 @@ export default defineComponent({
|
||||||
content: `<div id="app">
|
content: `<div id="app">
|
||||||
<p-toast></p-toast>
|
<p-toast></p-toast>
|
||||||
<p-confirmdialog></p-confirmdialog>
|
<p-confirmdialog></p-confirmdialog>
|
||||||
|
<p-confirmdialog group="templating">
|
||||||
|
<template #message="slotProps">
|
||||||
|
<div class="flex p-4">
|
||||||
|
<i :class="slotProps.message.icon" style="font-size: 1.5rem"></i>
|
||||||
|
<p class="pl-2">{{slotProps.message.message}}</p>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
</p-confirmdialog>
|
||||||
<p-confirmdialog group="positionDialog"></p-confirmdialog>
|
<p-confirmdialog group="positionDialog"></p-confirmdialog>
|
||||||
|
|
||||||
<div class="card">
|
<div class="card">
|
||||||
|
@ -489,6 +552,9 @@ export default defineComponent({
|
||||||
<p-button @click="confirm1()" icon="pi pi-check" label="Confirm" class="mr-2"></p-button>
|
<p-button @click="confirm1()" icon="pi pi-check" label="Confirm" class="mr-2"></p-button>
|
||||||
<p-button @click="confirm2()" icon="pi pi-times" label="Delete"></p-button>
|
<p-button @click="confirm2()" icon="pi pi-times" label="Delete"></p-button>
|
||||||
|
|
||||||
|
<h5>Templating</h5>
|
||||||
|
<p-button @click="showTemplate()" icon="pi pi-check" label="Terms and Conditions" class="mr-2"></p-button>
|
||||||
|
|
||||||
<h5>Position</h5>
|
<h5>Position</h5>
|
||||||
<div class="grid flex-column">
|
<div class="grid flex-column">
|
||||||
<div class="p-col">
|
<div class="p-col">
|
||||||
|
@ -564,7 +630,24 @@ export default defineComponent({
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
return { confirm1, confirm2, confirmPosition };
|
const showTemplate = () => {
|
||||||
|
confirm.require({
|
||||||
|
group: 'templating',
|
||||||
|
header: 'Terms and Conditions',
|
||||||
|
message: 'Do you accept that?',
|
||||||
|
icon: 'pi pi-question-circle',
|
||||||
|
acceptIcon: 'pi pi-check',
|
||||||
|
rejectIcon: 'pi pi-times',
|
||||||
|
accept: () => {
|
||||||
|
this.$toast.add({severity:'info', summary:'Confirmed', detail:'You have accepted', life: 3000});
|
||||||
|
},
|
||||||
|
reject: () => {
|
||||||
|
this.$toast.add({severity:'error', summary:'Rejected', detail:'You have rejected', life: 3000});
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
return { confirm1, confirm2, confirmPosition, showTemplate };
|
||||||
},
|
},
|
||||||
components: {
|
components: {
|
||||||
"p-confirmdialog": primevue.confirmdialog,
|
"p-confirmdialog": primevue.confirmdialog,
|
||||||
|
|
Loading…
Reference in New Issue