1 line
12 KiB
Plaintext
1 line
12 KiB
Plaintext
|
{"version":3,"file":"primeng-blockui.mjs","sources":["../../src/app/components/blockui/blockui.ts","../../src/app/components/blockui/primeng-blockui.ts"],"sourcesContent":["import { CommonModule, DOCUMENT, isPlatformBrowser } from '@angular/common';\nimport {\n AfterViewInit,\n ChangeDetectionStrategy,\n ChangeDetectorRef,\n Component,\n ContentChildren,\n ElementRef,\n Inject,\n Input,\n NgModule,\n OnDestroy,\n PLATFORM_ID,\n QueryList,\n Renderer2,\n TemplateRef,\n ViewChild,\n ViewEncapsulation,\n booleanAttribute,\n numberAttribute\n} from '@angular/core';\nimport { PrimeNGConfig, PrimeTemplate } from 'primeng/api';\nimport { DomHandler } from 'primeng/dom';\nimport { ZIndexUtils } from 'primeng/utils';\n/**\n * BlockUI can either block other components or the whole page.\n * @group Components\n */\n@Component({\n selector: 'p-blockUI',\n template: `\n <div\n #mask\n [class]=\"styleClass\"\n [attr.aria-busy]=\"blocked\"\n [ngClass]=\"{ 'p-blockui-document': !target, 'p-blockui p-component-overlay p-component-overlay-enter': true }\"\n [ngStyle]=\"{ display: 'none' }\"\n [attr.data-pc-name]=\"'blockui'\"\n [attr.data-pc-section]=\"'root'\"\n >\n <ng-content></ng-content>\n <ng-container *ngTemplateOutlet=\"contentTemplate\"></ng-container>\n </div>\n `,\n changeDetection: ChangeDetectionStrategy.OnPush,\n encapsulation: ViewEncapsulation.None,\n styleUrls: ['./blockui.css'],\n host: {\n class: 'p-element'\n }\n})\nexport class BlockUI implements AfterViewInit, OnDestroy {\n /**\n * Name of the local ng-template variable referring to another component.\n * @group Props\n */\n @Input() target: any;\n /**\n * Whether to automatically manage layering.\n * @group Props\n */\n @Input({ transform: booleanAttribute }) autoZIndex: boolean = true;\n /**\n * Base zIndex value to use in layering.\n * @group Props\n */\n @Input({ transform: numberAttribute }) baseZIndex: number = 0;\n /**\n * Class of the element.\n * @group Props\n */\n @Input() styleClass: string | undefined;\n /**\n * Current blocked state as a boolean.\n * @group Props\n */\n @Input() get blocked(): boolean {\n return this._blocked;\n }\n set blocked(val: boolean) {\n if (this.mask && this.mask.nativeElement) {\n if (val) this.block();\n else this.unblock();\n } else {\n this._blocked = val;\n }\n }\n\n @ContentChildren(PrimeTemplate) templates: QueryList<PrimeTemplate> | undefined;\n\n @ViewChild('mask') mask: ElementRef | undefined;\n\n _blocked: boolean = false;\n\n animationEndListener: VoidFunction | null | undefined;\n\n contentTemplate: TemplateRef<any> | undefined;\n\n constructor(@Inject(DOCUMENT) private document: Document, public el: ElementRef, public cd: ChangeDetectorRef, public config: PrimeNGConfig, private renderer: Renderer2, @Inject(PLATFORM_ID) public platformId: any) {}\n\n ngAfterViewInit() {\n if (this._blocked) this.block();\n\n if (this.target && !this.target.getBlockableElement) {\n throw 'Target of BlockUI must implement BlockableUI interface';\n }\n }\n\n ngAfterContentInit() {\n (this.templates as QueryList<PrimeTemplate>).forEach((item) => {\n switch (item.getType()) {\n case 'content':\n this.contentTemplate = item.template;\n break;\n\n default:\n this.contentTemplate = item.template;\n break;\n }\n });\n }\n\n block() {\n if (isPlatformBrowser(this.platformId)) {\n this._blocked = true;\n (this.mask as ElementRef).nativeElement.style.display = 'flex';\n\n if (this.target) {\n this.target.getBlockableElement().a
|