Fixed #4463 - Dialog: new blockScroll property
parent
aa34254aa7
commit
d9aeaec5e7
|
@ -71,6 +71,12 @@ const DialogProps = [
|
||||||
default: 'true',
|
default: 'true',
|
||||||
description: 'Whether to show the header or not.'
|
description: 'Whether to show the header or not.'
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
name: 'blockScroll',
|
||||||
|
type: 'boolean',
|
||||||
|
default: 'false',
|
||||||
|
description: 'Whether background scroll should be blocked when dialog is visible.'
|
||||||
|
},
|
||||||
{
|
{
|
||||||
name: 'baseZIndex',
|
name: 'baseZIndex',
|
||||||
type: 'number',
|
type: 'number',
|
||||||
|
|
|
@ -247,6 +247,10 @@ export default {
|
||||||
type: Boolean,
|
type: Boolean,
|
||||||
default: true
|
default: true
|
||||||
},
|
},
|
||||||
|
blockScroll: {
|
||||||
|
type: Boolean,
|
||||||
|
default: false
|
||||||
|
},
|
||||||
baseZIndex: {
|
baseZIndex: {
|
||||||
type: Number,
|
type: Number,
|
||||||
default: 0
|
default: 0
|
||||||
|
|
|
@ -202,6 +202,11 @@ export interface DialogProps {
|
||||||
* @defaultValue true
|
* @defaultValue true
|
||||||
*/
|
*/
|
||||||
showHeader?: boolean | undefined;
|
showHeader?: boolean | undefined;
|
||||||
|
/**
|
||||||
|
* Whether background scroll should be blocked when dialog is visible.
|
||||||
|
* @defaultValue false
|
||||||
|
*/
|
||||||
|
blockScroll?: boolean | undefined;
|
||||||
/**
|
/**
|
||||||
* Base zIndex value to use in layering.
|
* Base zIndex value to use in layering.
|
||||||
* @defaultValue 0
|
* @defaultValue 0
|
||||||
|
|
|
@ -208,12 +208,12 @@ export default {
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
enableDocumentSettings() {
|
enableDocumentSettings() {
|
||||||
if (this.modal || (this.maximizable && this.maximized)) {
|
if (this.modal || (!this.modal && this.blockScroll) || (this.maximizable && this.maximized)) {
|
||||||
DomHandler.addClass(document.body, 'p-overflow-hidden');
|
DomHandler.addClass(document.body, 'p-overflow-hidden');
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
unbindDocumentState() {
|
unbindDocumentState() {
|
||||||
if (this.modal || (this.maximizable && this.maximized)) {
|
if (this.modal || (!this.modal && this.blockScroll) || (this.maximizable && this.maximized)) {
|
||||||
DomHandler.removeClass(document.body, 'p-overflow-hidden');
|
DomHandler.removeClass(document.body, 'p-overflow-hidden');
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
Loading…
Reference in New Issue