|
|
@ -20,6 +20,7 @@ const useConfirmDialog = ( |
|
|
|
): { |
|
|
|
): { |
|
|
|
confirmDialog: ReactElement; |
|
|
|
confirmDialog: ReactElement; |
|
|
|
confirmDialogRef: MutableRefObject<ConfirmDialogForwardedRefContent | null>; |
|
|
|
confirmDialogRef: MutableRefObject<ConfirmDialogForwardedRefContent | null>; |
|
|
|
|
|
|
|
setConfirmDialogLoading: (value: boolean) => void; |
|
|
|
setConfirmDialogOpen: (value: boolean) => void; |
|
|
|
setConfirmDialogOpen: (value: boolean) => void; |
|
|
|
setConfirmDialogProps: Dispatch<SetStateAction<ConfirmDialogProps>>; |
|
|
|
setConfirmDialogProps: Dispatch<SetStateAction<ConfirmDialogProps>>; |
|
|
|
finishConfirm: (title: ReactNode, message: Message) => void; |
|
|
|
finishConfirm: (title: ReactNode, message: Message) => void; |
|
|
@ -44,6 +45,15 @@ const useConfirmDialog = ( |
|
|
|
titleText, |
|
|
|
titleText, |
|
|
|
}); |
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const setConfirmDialogLoading = useCallback( |
|
|
|
|
|
|
|
(value: boolean) => |
|
|
|
|
|
|
|
setConfirmDialogProps(({ loading, ...rest }) => ({ |
|
|
|
|
|
|
|
...rest, |
|
|
|
|
|
|
|
loading: value, |
|
|
|
|
|
|
|
})), |
|
|
|
|
|
|
|
[], |
|
|
|
|
|
|
|
); |
|
|
|
|
|
|
|
|
|
|
|
const setConfirmDialogOpen = useCallback( |
|
|
|
const setConfirmDialogOpen = useCallback( |
|
|
|
(value: boolean) => confirmDialogRef?.current?.setOpen?.call(null, value), |
|
|
|
(value: boolean) => confirmDialogRef?.current?.setOpen?.call(null, value), |
|
|
|
[], |
|
|
|
[], |
|
|
@ -75,6 +85,7 @@ const useConfirmDialog = ( |
|
|
|
return { |
|
|
|
return { |
|
|
|
confirmDialog, |
|
|
|
confirmDialog, |
|
|
|
confirmDialogRef, |
|
|
|
confirmDialogRef, |
|
|
|
|
|
|
|
setConfirmDialogLoading, |
|
|
|
setConfirmDialogOpen, |
|
|
|
setConfirmDialogOpen, |
|
|
|
setConfirmDialogProps, |
|
|
|
setConfirmDialogProps, |
|
|
|
finishConfirm, |
|
|
|
finishConfirm, |
|
|
|