source: trip-planner-front/node_modules/primeng/fesm2020/primeng-blockui.mjs@ 1ad8e64

Last change on this file since 1ad8e64 was 59329aa, checked in by Ema <ema_spirova@…>, 3 years ago

adding photos

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