Skip to content

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.

feat: add `destroyOnClose` for `Dialog` (#1391)

白熱a6e17ef8265d
diff --git a/packages/design/src/components/dialog/Dialog.tsx b/packages/design/src/components/dialog/Dialog.tsx
index 2e1e4fb0f3..ce6c644327 100644
--- a/packages/design/src/components/dialog/Dialog.tsx
+++ b/packages/design/src/components/dialog/Dialog.tsx
@@ -59,6 +59,12 @@ export interface IDialogProps {
*/
closeIcon?: React.ReactNode;
+ /**
+ * Whether the dialog should be destroyed on close.
+ * @default false
+ */
+ destroyOnClose?: boolean;
+
/**
* The footer of the dialog.
*/
@@ -79,6 +85,7 @@ export function Dialog(props: IDialogProps) {
width,
draggable = false,
closeIcon = <CloseSingle />,
+ destroyOnClose = false,
footer,
onClose,
} = props;
@@ -124,10 +131,11 @@ export function Dialog(props: IDialogProps) {
title={TitleIfDraggable}
modalRender={modalRender}
closeIcon={closeIcon}
+ destroyOnClose={destroyOnClose}
footer={footer}
- onClose={onClose}
mask={!draggable}
style={style}
+ onClose={onClose}
>
{children}
</RcDialog>