Build your own AI office with Univer Office SDK. Bring editing, calculation, collaboration, and file processing into your product for people and AI agents. Built on an extensible open-source core.
TypeScript boardcollaborationdocdocxexceloffce365officepdfpptpptxpresentationsdksheetslidesspreadsheetuniverwordwordprocessorworkspacexlsx
fix(design): fix the mask, maskClosable, and keyboard properties in IDialogProps (#6311)
wpxp123456ebae000348d6
diff --git a/packages/design/src/components/dialog/Dialog.tsx b/packages/design/src/components/dialog/Dialog.tsxindex a2bc2c7a23..c0ad31ad6e 100644--- a/packages/design/src/components/dialog/Dialog.tsx+++ b/packages/design/src/components/dialog/Dialog.tsx@@ -60,6 +60,7 @@ export interface IDialogProps {/*** Whether the dialog should be destroyed on close.+ * @deprecated* @default false*/destroyOnClose?: boolean;@@ -250,7 +251,6 @@ export function Dialog(props: IDialogProps) {width,draggable = false,defaultPosition,- destroyOnClose = false,footer: propFooter,mask = true,keyboard = true,@@ -292,7 +292,7 @@ export function Dialog(props: IDialogProps) {}, [draggable, setElementRef]);const handleOpenChange = useCallback((isOpen: boolean) => {- if (!maskClosable && !isOpen) {+ if (!mask && !isOpen) {return;}@@ -337,6 +337,18 @@ export function Dialog(props: IDialogProps) {}}closable={closable}onClickClose={handleClickClose}+ onEscapeKeyDown={(e) => {+ if (keyboard) {+ handleClickClose();+ }+ e.preventDefault();+ }}+ onPointerDownOutside={(e) => {+ if (maskClosable) {+ handleClickClose();+ }+ e.preventDefault();+ }}><DialogHeaderclassName={clsx({diff --git a/packages/design/src/components/dialog/DialogPrimitive.tsx b/packages/design/src/components/dialog/DialogPrimitive.tsxindex 63984244f9..77c7699974 100644--- a/packages/design/src/components/dialog/DialogPrimitive.tsx+++ b/packages/design/src/components/dialog/DialogPrimitive.tsx@@ -37,9 +37,9 @@ const DialogOverlay = forwardRef<ref={ref}className={clsx(`- univer-bg-black/80 univer-fixed univer-inset-0 univer-z-[1080]data-[state=open]:univer-animate-in data-[state=open]:univer-fade-in-0data-[state=closed]:univer-animate-out data-[state=closed]:univer-fade-out-0+ univer-fixed univer-inset-0 univer-z-[1080] univer-bg-[rgba(0,0,0,0.8)]`,className)}