From cf1707675b5c7b8c09e87b8622b81a9e5ba487dd Mon Sep 17 00:00:00 2001 From: Md Ashik Date: Tue, 28 Nov 2023 23:44:20 +0600 Subject: [PATCH] fix: #14230 || BlockUI: entire page is blocked if "blocked" input contains true by default --- src/app/components/blockui/blockui.ts | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/app/components/blockui/blockui.ts b/src/app/components/blockui/blockui.ts index 40fefe86807..76b043cb32a 100755 --- a/src/app/components/blockui/blockui.ts +++ b/src/app/components/blockui/blockui.ts @@ -15,7 +15,7 @@ import { ZIndexUtils } from 'primeng/utils'; [class]="styleClass" [attr.aria-busy]="blocked" [ngClass]="{ 'p-blockui-document': !target, 'p-blockui p-component-overlay p-component-overlay-enter': true }" - [ngStyle]="{ display: blocked ? 'flex' : 'none' }" + [ngStyle]="{ display: 'none' }" [attr.data-pc-name]="'blockui'" [attr.data-pc-section]="'root'" > @@ -80,6 +80,8 @@ export class BlockUI implements AfterViewInit, OnDestroy { constructor(@Inject(DOCUMENT) private document: Document, public el: ElementRef, public cd: ChangeDetectorRef, public config: PrimeNGConfig, private renderer: Renderer2, @Inject(PLATFORM_ID) public platformId: any) {} ngAfterViewInit() { + if (this._blocked) this.block(); + if (this.target && !this.target.getBlockableElement) { throw 'Target of BlockUI must implement BlockableUI interface'; } @@ -102,6 +104,7 @@ export class BlockUI implements AfterViewInit, OnDestroy { block() { if (isPlatformBrowser(this.platformId)) { this._blocked = true; + (this.mask as ElementRef).nativeElement.style.display = 'flex' if (this.target) { this.target.getBlockableElement().appendChild((this.mask as ElementRef).nativeElement);