diff --git a/components/lib/dialog/Dialog.js b/components/lib/dialog/Dialog.js index f762797876..e051f0fd43 100644 --- a/components/lib/dialog/Dialog.js +++ b/components/lib/dialog/Dialog.js @@ -291,13 +291,15 @@ export const Dialog = React.forwardRef((props, ref) => { const disableDocumentSettings = () => { unbindGlobalListeners(); + const isMaximized = props.maximizable && maximized; + if (props.modal) { - let hasBlockScroll = document.primeDialogParams && document.primeDialogParams.some((param) => param.hasBlockScroll); + const hasBlockScroll = document.primeDialogParams && document.primeDialogParams.some((param) => param.hasBlockScroll); - if (hasBlockScroll) { + if (hasBlockScroll || isMaximized) { DomHandler.removeClass(document.body, 'p-overflow-hidden'); } - } else if (props.blockScroll || (props.maximizable && maximized)) { + } else if (props.blockScroll || isMaximized) { DomHandler.removeClass(document.body, 'p-overflow-hidden'); } }; @@ -560,49 +562,49 @@ export const Dialog = React.forwardRef((props, ref) => { Dialog.displayName = 'Dialog'; Dialog.defaultProps = { __TYPE: 'Dialog', - id: null, - header: null, - footer: null, - visible: false, - position: 'center', - draggable: true, - resizable: true, - modal: true, - onHide: null, - onShow: null, - headerStyle: null, - headerClassName: null, - contentStyle: null, - contentClassName: null, - closeOnEscape: true, - dismissableMask: false, - rtl: false, - closable: true, - style: null, - className: null, - maskStyle: null, - maskClassName: null, - showHeader: true, appendTo: null, + ariaCloseIconLabel: null, baseZIndex: 0, - maximizable: false, blockScroll: false, - icons: null, - ariaCloseIconLabel: null, + breakpoints: null, + className: null, + closable: true, + closeOnEscape: true, + contentClassName: null, + contentStyle: null, + dismissableMask: false, + draggable: true, focusOnShow: true, - minX: 0, - minY: 0, + footer: null, + header: null, + headerClassName: null, + headerStyle: null, + icons: null, + id: null, keepInViewport: true, + maskClassName: null, + maskStyle: null, + maximizable: false, maximized: false, - breakpoints: null, - transitionOptions: null, - onMaximize: null, - onDragStart: null, + minX: 0, + minY: 0, + modal: true, + onClick: null, onDrag: null, onDragEnd: null, - onResizeStart: null, + onDragStart: null, + onHide: null, + onMaskClick: null, + onMaximize: null, onResize: null, onResizeEnd: null, - onClick: null, - onMaskClick: null + onResizeStart: null, + onShow: null, + position: 'center', + resizable: true, + rtl: false, + showHeader: true, + style: null, + transitionOptions: null, + visible: false }; diff --git a/components/lib/dialog/dialog.d.ts b/components/lib/dialog/dialog.d.ts index 5d971f4f08..fa0c6f8838 100644 --- a/components/lib/dialog/dialog.d.ts +++ b/components/lib/dialog/dialog.d.ts @@ -17,52 +17,52 @@ interface DialogMaximizeParams { } export interface DialogProps { - id?: string; - header?: DialogTemplateType; - footer?: DialogTemplateType; - visible?: boolean; - position?: DialogPositionType; - draggable?: boolean; - resizable?: boolean; - modal?: boolean; - headerStyle?: object; - headerClassName?: string; - contentStyle?: object; - contentClassName?: string; - closeOnEscape?: boolean; - dismissableMask?: boolean; - rtl?: boolean; - closable?: boolean; - style?: object; - className?: string; - maskStyle?: object; - maskClassName?: string; - showHeader?: boolean; appendTo?: DialogAppendToType; + ariaCloseIconLabel?: string; baseZIndex?: number; - maximizable?: boolean; blockScroll?: boolean; - icons?: DialogTemplateType; - ariaCloseIconLabel?: string; + breakpoints?: DialogBreakpoints; + children?: React.ReactNode; + className?: string; + closable?: boolean; + closeOnEscape?: boolean; + contentClassName?: string; + contentStyle?: object; + dismissableMask?: boolean; + draggable?: boolean; focusOnShow?: boolean; - minX?: number; - minY?: number; + footer?: DialogTemplateType; + header?: DialogTemplateType; + headerClassName?: string; + headerStyle?: object; + icons?: DialogTemplateType; + id?: string; keepInViewport?: boolean; + maskClassName?: string; + maskStyle?: object; + maximizable?: boolean; maximized?: boolean; - breakpoints?: DialogBreakpoints; + minX?: number; + minY?: number; + modal?: boolean; + position?: DialogPositionType; + resizable?: boolean; + rtl?: boolean; + showHeader?: boolean; + style?: object; transitionOptions?: CSSTransitionProps; - onMaximize?(e: DialogMaximizeParams): void; - onDragStart?(e: React.DragEvent): void; + visible?: boolean; + onClick?(e: React.MouseEvent): void; onDrag?(e: React.DragEvent): void; onDragEnd?(e: React.DragEvent): void; - onResizeStart?(e: React.MouseEvent): void; + onDragStart?(e: React.DragEvent): void; + onHide(): void; + onMaskClick?(e: React.MouseEvent): void; + onMaximize?(e: DialogMaximizeParams): void; onResize?(e: React.MouseEvent): void; onResizeEnd?(e: React.MouseEvent): void; - onHide(): void; + onResizeStart?(e: React.MouseEvent): void; onShow?(): void; - onMaskClick?(e: React.MouseEvent): void; - onClick?(e: React.MouseEvent): void; - children?: React.ReactNode; } export declare class Dialog extends React.Component {