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
feat(design): add closable prop to `Confirm` (#6073)
Univer36a51425e213
diff --git a/packages/design/src/components/confirm/Confirm.tsx b/packages/design/src/components/confirm/Confirm.tsxindex 3e653a1bbc..c38b227589 100644--- a/packages/design/src/components/confirm/Confirm.tsx+++ b/packages/design/src/components/confirm/Confirm.tsx@@ -60,14 +60,20 @@ export interface IConfirmProps {*/width?: number | string;+ /**+ * Whether to show the close button.+ * @default true+ */+ closable?: boolean;+}-function Footer(props: { locale: typeof enUS['design']; cancelText?: string; confirmText?: string; onClose: (() => void) | undefined; onConfirm: (() => void) | undefined }) {- const { locale, cancelText, confirmText, onClose, onConfirm } = props;+function Footer(props: { locale: typeof enUS['design']; cancelText?: string; confirmText?: string; onClose: (() => void) | undefined; onConfirm: (() => void) | undefined; closable?: boolean }) {+ const { locale, cancelText, confirmText, onClose, onConfirm, closable = true } = props;return (<footer className="univer-flex univer-items-center univer-justify-end univer-gap-2">- <Button onClick={onClose}>{cancelText ?? locale?.Confirm.cancel}</Button>+ {closable && (<Button onClick={onClose}>{cancelText ?? locale?.Confirm.cancel}</Button>)}<Button variant="primary" onClick={onConfirm}>{confirmText ?? locale?.Confirm.confirm}</Button>@@ -76,7 +82,7 @@ function Footer(props: { locale: typeof enUS['design']; cancelText?: string; con}export function Confirm(props: IConfirmProps) {- const { children, visible = false, title, cancelText, confirmText, width, onClose, onConfirm } = props;+ const { children, visible = false, title, cancelText, confirmText, width, onClose, onConfirm, closable = true } = props;const { locale } = useContext(ConfigContext);return (@@ -91,10 +97,12 @@ export function Confirm(props: IConfirmProps) {confirmText={confirmText}onClose={onClose}onConfirm={onConfirm}+ closable={closable}/>)}onClose={onClose}width={width}+ closable={closable}>{children}</Dialog>