mirror of
https://gitee.com/nocobase/nocobase.git
synced 2025-07-02 03:02:19 +08:00
refactor: validate required fields before showing confirmation dialog (#6931)
This commit is contained in:
parent
21d7acd74e
commit
40d36af75b
@ -416,12 +416,12 @@ const RenderButton = ({
|
|||||||
const { t } = useTranslation();
|
const { t } = useTranslation();
|
||||||
const { isPopupVisibleControlledByURL } = usePopupSettings();
|
const { isPopupVisibleControlledByURL } = usePopupSettings();
|
||||||
const { openPopup } = usePopupUtils();
|
const { openPopup } = usePopupUtils();
|
||||||
|
const form = useForm();
|
||||||
const openPopupRef = useRef(null);
|
const openPopupRef = useRef(null);
|
||||||
openPopupRef.current = openPopup;
|
openPopupRef.current = openPopup;
|
||||||
|
|
||||||
const handleButtonClick = useCallback(
|
const handleButtonClick = useCallback(
|
||||||
(e: React.MouseEvent, checkPortal = true) => {
|
async (e: React.MouseEvent, checkPortal = true) => {
|
||||||
if (checkPortal && isPortalInBody(e.target as Element)) {
|
if (checkPortal && isPortalInBody(e.target as Element)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -454,6 +454,7 @@ const RenderButton = ({
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
if (confirm?.enable !== false && confirm?.content) {
|
if (confirm?.enable !== false && confirm?.content) {
|
||||||
|
await form?.submit?.();
|
||||||
modal.confirm({
|
modal.confirm({
|
||||||
title: t(confirm.title, { title: confirmTitle || title || field?.title }),
|
title: t(confirm.title, { title: confirmTitle || title || field?.title }),
|
||||||
content: t(confirm.content, { title: confirmTitle || title || field?.title }),
|
content: t(confirm.content, { title: confirmTitle || title || field?.title }),
|
||||||
|
Loading…
x
Reference in New Issue
Block a user