From 88fd6ec0d21dc8a9afa49bd0320f2ec70eee7869 Mon Sep 17 00:00:00 2001 From: Paul Valerie GOMA Date: Mon, 28 Jul 2025 09:11:29 +0200 Subject: [PATCH] =?UTF-8?q?=E2=9C=A8=20feature:=20useConfirmModal=20compos?= =?UTF-8?q?able=20added?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/composable/useConfirmModal.ts | 42 ++++++++++++++++++++ 1 file changed, 42 insertions(+) create mode 100644 src/components/composable/useConfirmModal.ts diff --git a/src/components/composable/useConfirmModal.ts b/src/components/composable/useConfirmModal.ts new file mode 100644 index 0000000..85f58a7 --- /dev/null +++ b/src/components/composable/useConfirmModal.ts @@ -0,0 +1,42 @@ +import { type ConfirmationOptions } from "primevue/confirmationoptions"; +import { useConfirm } from "primevue"; +import VButton from "../button/VButton.vue"; + +export function useConfirmModal() { + const confirm = useConfirm(); + + const showConfirmModal = ({ + acceptProps = VButton, + rejectProps = VButton, + group = '', + header = '', + message = '', + icon = '', + accept = Function, + reject = Function, + onHide = Function, + onShow = Function, + modal = true, + blockScroll = true, + position = 'center', + appendTo = 'body', + }: ConfirmationOptions) => { + confirm.require({ + group, + header, + message, + icon, + rejectProps, + acceptProps, + accept, + reject, + onHide, + onShow, + modal, + blockScroll, + position, + appendTo, + }) + } + return {showConfirmModal} +}