45 lines
874 B
TypeScript
45 lines
874 B
TypeScript
import type { ConfirmationOptions } from "primevue/confirmationoptions";
|
|
import { useConfirm } from "primevue";
|
|
import VButton from "../button/VButton.vue";
|
|
|
|
export function useConfirmModal() {
|
|
const showConfirmModal = ({
|
|
acceptProps = VButton,
|
|
rejectProps = VButton,
|
|
group = '',
|
|
header = '',
|
|
message = '',
|
|
icon = '',
|
|
accept = () => {},
|
|
reject = () => {},
|
|
onHide = () => {},
|
|
onShow = () => {},
|
|
modal = true,
|
|
blockScroll = true,
|
|
position = 'center',
|
|
appendTo = 'body',
|
|
}: ConfirmationOptions) => {
|
|
const confirm = useConfirm();
|
|
|
|
confirm.require({
|
|
group,
|
|
header,
|
|
message,
|
|
icon,
|
|
rejectProps,
|
|
acceptProps,
|
|
accept,
|
|
reject,
|
|
onHide,
|
|
onShow,
|
|
modal,
|
|
blockScroll,
|
|
position,
|
|
appendTo,
|
|
});
|
|
};
|
|
|
|
return { showConfirmModal };
|
|
}
|
|
|