[59329aa] | 1 | import { NgModule, Component, Input, ViewChild, ChangeDetectionStrategy, ViewEncapsulation, ContentChildren } from '@angular/core';
|
---|
| 2 | import { CommonModule } from '@angular/common';
|
---|
| 3 | import { PrimeTemplate } from 'primeng/api';
|
---|
| 4 | import { ZIndexUtils } from 'primeng/utils';
|
---|
| 5 | import { DomHandler } from 'primeng/dom';
|
---|
| 6 | import * as i0 from "@angular/core";
|
---|
| 7 | import * as i1 from "primeng/api";
|
---|
| 8 | import * as i2 from "@angular/common";
|
---|
| 9 | export class BlockUI {
|
---|
| 10 | constructor(el, cd, config) {
|
---|
| 11 | this.el = el;
|
---|
| 12 | this.cd = cd;
|
---|
| 13 | this.config = config;
|
---|
| 14 | this.autoZIndex = true;
|
---|
| 15 | this.baseZIndex = 0;
|
---|
| 16 | }
|
---|
| 17 | get blocked() {
|
---|
| 18 | return this._blocked;
|
---|
| 19 | }
|
---|
| 20 | set blocked(val) {
|
---|
| 21 | if (this.mask && this.mask.nativeElement) {
|
---|
| 22 | if (val)
|
---|
| 23 | this.block();
|
---|
| 24 | else
|
---|
| 25 | this.unblock();
|
---|
| 26 | }
|
---|
| 27 | else {
|
---|
| 28 | this._blocked = val;
|
---|
| 29 | }
|
---|
| 30 | }
|
---|
| 31 | ngAfterViewInit() {
|
---|
| 32 | if (this.target && !this.target.getBlockableElement) {
|
---|
| 33 | throw 'Target of BlockUI must implement BlockableUI interface';
|
---|
| 34 | }
|
---|
| 35 | }
|
---|
| 36 | ngAfterContentInit() {
|
---|
| 37 | this.templates.forEach((item) => {
|
---|
| 38 | switch (item.getType()) {
|
---|
| 39 | case 'content':
|
---|
| 40 | this.contentTemplate = item.template;
|
---|
| 41 | break;
|
---|
| 42 | default:
|
---|
| 43 | this.contentTemplate = item.template;
|
---|
| 44 | break;
|
---|
| 45 | }
|
---|
| 46 | });
|
---|
| 47 | }
|
---|
| 48 | block() {
|
---|
| 49 | this._blocked = true;
|
---|
| 50 | if (this.target) {
|
---|
| 51 | this.target.getBlockableElement().appendChild(this.mask.nativeElement);
|
---|
| 52 | this.target.getBlockableElement().style.position = 'relative';
|
---|
| 53 | }
|
---|
| 54 | else {
|
---|
| 55 | document.body.appendChild(this.mask.nativeElement);
|
---|
| 56 | }
|
---|
| 57 | if (this.autoZIndex) {
|
---|
| 58 | ZIndexUtils.set('modal', this.mask.nativeElement, this.baseZIndex + this.config.zIndex.modal);
|
---|
| 59 | }
|
---|
| 60 | }
|
---|
| 61 | unblock() {
|
---|
| 62 | this.animationEndListener = this.destroyModal.bind(this);
|
---|
| 63 | this.mask.nativeElement.addEventListener('animationend', this.animationEndListener);
|
---|
| 64 | DomHandler.addClass(this.mask.nativeElement, 'p-component-overlay-leave');
|
---|
| 65 | }
|
---|
| 66 | destroyModal() {
|
---|
| 67 | this._blocked = false;
|
---|
| 68 | DomHandler.removeClass(this.mask.nativeElement, 'p-component-overlay-leave');
|
---|
| 69 | ZIndexUtils.clear(this.mask.nativeElement);
|
---|
| 70 | this.el.nativeElement.appendChild(this.mask.nativeElement);
|
---|
| 71 | this.unbindAnimationEndListener();
|
---|
| 72 | this.cd.markForCheck();
|
---|
| 73 | }
|
---|
| 74 | unbindAnimationEndListener() {
|
---|
| 75 | if (this.animationEndListener && this.mask) {
|
---|
| 76 | this.mask.nativeElement.removeEventListener('animationend', this.animationEndListener);
|
---|
| 77 | this.animationEndListener = null;
|
---|
| 78 | }
|
---|
| 79 | }
|
---|
| 80 | ngOnDestroy() {
|
---|
| 81 | this.unblock();
|
---|
| 82 | this.destroyModal();
|
---|
| 83 | }
|
---|
| 84 | }
|
---|
| 85 | BlockUI.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.0.0", ngImport: i0, type: BlockUI, deps: [{ token: i0.ElementRef }, { token: i0.ChangeDetectorRef }, { token: i1.PrimeNGConfig }], target: i0.ɵɵFactoryTarget.Component });
|
---|
| 86 | BlockUI.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.0.0", type: BlockUI, selector: "p-blockUI", inputs: { target: "target", autoZIndex: "autoZIndex", baseZIndex: "baseZIndex", styleClass: "styleClass", blocked: "blocked" }, host: { classAttribute: "p-element" }, queries: [{ propertyName: "templates", predicate: PrimeTemplate }], viewQueries: [{ propertyName: "mask", first: true, predicate: ["mask"], descendants: true }], ngImport: i0, template: `
|
---|
| 87 | <div #mask [class]="styleClass" [ngClass]="{'p-blockui-document':!target, 'p-blockui p-component-overlay p-component-overlay-enter': true}" [ngStyle]="{display: blocked ? 'flex' : 'none'}">
|
---|
| 88 | <ng-content></ng-content>
|
---|
| 89 | <ng-container *ngTemplateOutlet="contentTemplate"></ng-container>
|
---|
| 90 | </div>
|
---|
| 91 | `, isInline: true, styles: [".p-blockui{position:absolute;top:0;left:0;width:100%;height:100%;background-color:transparent;transition-property:background-color;display:flex;align-items:center;justify-content:center}.p-blockui.p-component-overlay{position:absolute}.p-blockui-document.p-component-overlay{position:fixed}.p-blockui-leave.p-component-overlay{background-color:transparent}\n"], directives: [{ type: i2.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { type: i2.NgStyle, selector: "[ngStyle]", inputs: ["ngStyle"] }, { type: i2.NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None });
|
---|
| 92 | i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.0.0", ngImport: i0, type: BlockUI, decorators: [{
|
---|
| 93 | type: Component,
|
---|
| 94 | args: [{ selector: 'p-blockUI', template: `
|
---|
| 95 | <div #mask [class]="styleClass" [ngClass]="{'p-blockui-document':!target, 'p-blockui p-component-overlay p-component-overlay-enter': true}" [ngStyle]="{display: blocked ? 'flex' : 'none'}">
|
---|
| 96 | <ng-content></ng-content>
|
---|
| 97 | <ng-container *ngTemplateOutlet="contentTemplate"></ng-container>
|
---|
| 98 | </div>
|
---|
| 99 | `, changeDetection: ChangeDetectionStrategy.OnPush, encapsulation: ViewEncapsulation.None, host: {
|
---|
| 100 | 'class': 'p-element'
|
---|
| 101 | }, styles: [".p-blockui{position:absolute;top:0;left:0;width:100%;height:100%;background-color:transparent;transition-property:background-color;display:flex;align-items:center;justify-content:center}.p-blockui.p-component-overlay{position:absolute}.p-blockui-document.p-component-overlay{position:fixed}.p-blockui-leave.p-component-overlay{background-color:transparent}\n"] }]
|
---|
| 102 | }], ctorParameters: function () { return [{ type: i0.ElementRef }, { type: i0.ChangeDetectorRef }, { type: i1.PrimeNGConfig }]; }, propDecorators: { target: [{
|
---|
| 103 | type: Input
|
---|
| 104 | }], autoZIndex: [{
|
---|
| 105 | type: Input
|
---|
| 106 | }], baseZIndex: [{
|
---|
| 107 | type: Input
|
---|
| 108 | }], styleClass: [{
|
---|
| 109 | type: Input
|
---|
| 110 | }], templates: [{
|
---|
| 111 | type: ContentChildren,
|
---|
| 112 | args: [PrimeTemplate]
|
---|
| 113 | }], mask: [{
|
---|
| 114 | type: ViewChild,
|
---|
| 115 | args: ['mask']
|
---|
| 116 | }], blocked: [{
|
---|
| 117 | type: Input
|
---|
| 118 | }] } });
|
---|
| 119 | export class BlockUIModule {
|
---|
| 120 | }
|
---|
| 121 | BlockUIModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.0.0", ngImport: i0, type: BlockUIModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
|
---|
| 122 | BlockUIModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "13.0.0", ngImport: i0, type: BlockUIModule, declarations: [BlockUI], imports: [CommonModule], exports: [BlockUI] });
|
---|
| 123 | BlockUIModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "13.0.0", ngImport: i0, type: BlockUIModule, imports: [[CommonModule]] });
|
---|
| 124 | i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.0.0", ngImport: i0, type: BlockUIModule, decorators: [{
|
---|
| 125 | type: NgModule,
|
---|
| 126 | args: [{
|
---|
| 127 | imports: [CommonModule],
|
---|
| 128 | exports: [BlockUI],
|
---|
| 129 | declarations: [BlockUI]
|
---|
| 130 | }]
|
---|
| 131 | }] });
|
---|
| 132 | //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiYmxvY2t1aS5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uLy4uL3NyYy9hcHAvY29tcG9uZW50cy9ibG9ja3VpL2Jsb2NrdWkudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQUEsT0FBTyxFQUFDLFFBQVEsRUFBQyxTQUFTLEVBQUMsS0FBSyxFQUFvQyxTQUFTLEVBQUMsdUJBQXVCLEVBQUUsaUJBQWlCLEVBQXFCLGVBQWUsRUFBeUIsTUFBTSxlQUFlLENBQUM7QUFDM00sT0FBTyxFQUFDLFlBQVksRUFBQyxNQUFNLGlCQUFpQixDQUFDO0FBQzdDLE9BQU8sRUFBZ0IsYUFBYSxFQUFDLE1BQU0sYUFBYSxDQUFDO0FBQ3pELE9BQU8sRUFBQyxXQUFXLEVBQUMsTUFBTSxlQUFlLENBQUM7QUFDMUMsT0FBTyxFQUFFLFVBQVUsRUFBRSxNQUFNLGFBQWEsQ0FBQzs7OztBQWlCekMsTUFBTSxPQUFPLE9BQU87SUFvQmhCLFlBQW1CLEVBQWMsRUFBUyxFQUFxQixFQUFTLE1BQXFCO1FBQTFFLE9BQUUsR0FBRixFQUFFLENBQVk7UUFBUyxPQUFFLEdBQUYsRUFBRSxDQUFtQjtRQUFTLFdBQU0sR0FBTixNQUFNLENBQWU7UUFoQnBGLGVBQVUsR0FBWSxJQUFJLENBQUM7UUFFM0IsZUFBVSxHQUFXLENBQUMsQ0FBQztJQWNnRSxDQUFDO0lBRWpHLElBQWEsT0FBTztRQUNoQixPQUFPLElBQUksQ0FBQyxRQUFRLENBQUM7SU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TGlzdGVuZXI6IGFueTtcblxuICAgIGNvbnRlbnRUZW1wbGF0ZTogVGVtcGxhdGVSZWY8YW55PjtcblxuICAgIGNvbnN0cnVjdG9yKHB1YmxpYyBlbDogRWxlbWVudFJlZiwgcHVibGljIGNkOiBDaGFuZ2VEZXRlY3RvclJlZiwgcHVibGljIGNvbmZpZzogUHJpbWVOR0NvbmZpZykge31cblxuICAgIEBJbnB1dCgpIGdldCBibG9ja2VkKCk6IGJvb2xlYW4ge1xuICAgICAgICByZXR1cm4gdGhpcy5fYmxvY2tlZDtcbiAgICB9XG5cbiAgICBzZXQgYmxvY2tlZCh2YWw6IGJvb2xlYW4pIHtcbiAgICAgICAgaWYgKHRoaXMubWFzayAmJiB0aGlzLm1hc2submF0aXZlRWxlbWVudCkge1xuICAgICAgICAgICAgaWYgKHZhbClcbiAgICAgICAgICAgICAgICB0aGlzLmJsb2NrKCk7XG4gICAgICAgICAgICBlbHNlXG4gICAgICAgICAgICAgICAgdGhpcy51bmJsb2NrKCk7XG4gICAgICAgIH1cbiAgICAgICAgZWxzZSB7XG4gICAgICAgICAgICB0aGlzLl9ibG9ja2VkID0gdmFsO1xuICAgICAgICB9XG4gICAgfVxuXG4gICAgbmdBZnRlclZpZXdJbml0KCkge1xuICAgICAgICBpZiAodGhpcy50YXJnZXQgJiYgIXRoaXMudGFyZ2V0LmdldEJsb2NrYWJsZUVsZW1lbnQpIHtcbiAgICAgICAgICAgIHRocm93ICdUYXJnZXQgb2YgQmxvY2tVSSBtdXN0IGltcGxlbWVudCBCbG9ja2FibGVVSSBpbnRlcmZhY2UnO1xuICAgICAgICB9XG4gICAgfVxuXG4gICAgbmdBZnRlckNvbnRlbnRJbml0KCkge1xuICAgICAgICB0aGlzLnRlbXBsYXRlcy5mb3JFYWNoKChpdGVtKSA9PiB7XG4gICAgICAgICAgICBzd2l0Y2goaXRlbS5nZXRUeXBlKCkpIHtcbiAgICAgICAgICAgICAgICBjYXNlICdjb250ZW50JzpcbiAgICAgICAg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