2025-07-28 11:22:30 +02:00
|
|
|
import type { ConfirmationOptions } from "primevue/confirmationoptions";
|
2025-07-28 09:11:29 +02:00
|
|
|
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}
|
|
|
|
}
|