source: trip-planner-front/node_modules/primeng/fesm2015/primeng-defer.mjs@ 571e0df

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

adding photos

  • Property mode set to 100644
File size: 3.8 KB
Line 
1import * as i0 from '@angular/core';
2import { EventEmitter, TemplateRef, Directive, Output, ContentChild, NgModule } from '@angular/core';
3import { CommonModule } from '@angular/common';
4
5class DeferredLoader {
6 constructor(el, renderer, viewContainer, cd) {
7 this.el = el;
8 this.renderer = renderer;
9 this.viewContainer = viewContainer;
10 this.cd = cd;
11 this.onLoad = new EventEmitter();
12 }
13 ngAfterViewInit() {
14 if (this.shouldLoad()) {
15 this.load();
16 }
17 if (!this.isLoaded()) {
18 this.documentScrollListener = this.renderer.listen('window', 'scroll', () => {
19 if (this.shouldLoad()) {
20 this.load();
21 this.documentScrollListener();
22 this.documentScrollListener = null;
23 }
24 });
25 }
26 }
27 shouldLoad() {
28 if (this.isLoaded()) {
29 return false;
30 }
31 else {
32 let rect = this.el.nativeElement.getBoundingClientRect();
33 let docElement = document.documentElement;
34 let winHeight = docElement.clientHeight;
35 return (winHeight >= rect.top);
36 }
37 }
38 load() {
39 this.view = this.viewContainer.createEmbeddedView(this.template);
40 this.onLoad.emit();
41 this.cd.detectChanges();
42 }
43 isLoaded() {
44 return this.view != null;
45 }
46 ngOnDestroy() {
47 this.view = null;
48 if (this.documentScrollListener) {
49 this.documentScrollListener();
50 }
51 }
52}
53DeferredLoader.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.0.0", ngImport: i0, type: DeferredLoader, deps: [{ token: i0.ElementRef }, { token: i0.Renderer2 }, { token: i0.ViewContainerRef }, { token: i0.ChangeDetectorRef }], target: i0.ɵɵFactoryTarget.Directive });
54DeferredLoader.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "13.0.0", type: DeferredLoader, selector: "[pDefer]", outputs: { onLoad: "onLoad" }, host: { classAttribute: "p-element" }, queries: [{ propertyName: "template", first: true, predicate: TemplateRef, descendants: true }], ngImport: i0 });
55i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.0.0", ngImport: i0, type: DeferredLoader, decorators: [{
56 type: Directive,
57 args: [{
58 selector: '[pDefer]',
59 host: {
60 'class': 'p-element'
61 }
62 }]
63 }], ctorParameters: function () { return [{ type: i0.ElementRef }, { type: i0.Renderer2 }, { type: i0.ViewContainerRef }, { type: i0.ChangeDetectorRef }]; }, propDecorators: { onLoad: [{
64 type: Output
65 }], template: [{
66 type: ContentChild,
67 args: [TemplateRef]
68 }] } });
69class DeferModule {
70}
71DeferModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.0.0", ngImport: i0, type: DeferModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
72DeferModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "13.0.0", ngImport: i0, type: DeferModule, declarations: [DeferredLoader], imports: [CommonModule], exports: [DeferredLoader] });
73DeferModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "13.0.0", ngImport: i0, type: DeferModule, imports: [[CommonModule]] });
74i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.0.0", ngImport: i0, type: DeferModule, decorators: [{
75 type: NgModule,
76 args: [{
77 imports: [CommonModule],
78 exports: [DeferredLoader],
79 declarations: [DeferredLoader]
80 }]
81 }] });
82
83/**
84 * Generated bundle index. Do not edit.
85 */
86
87export { DeferModule, DeferredLoader };
Note: See TracBrowser for help on using the repository browser.