source: trip-planner-front/node_modules/primeng/fesm2015/primeng-gmap.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: 7.8 KB
RevLine 
[59329aa]1import * as i0 from '@angular/core';
2import { EventEmitter, Component, ChangeDetectionStrategy, ViewEncapsulation, Input, Output, NgModule } from '@angular/core';
3import * as i1 from '@angular/common';
4import { CommonModule } from '@angular/common';
5
6class GMap {
7 constructor(el, differs, cd, zone) {
8 this.el = el;
9 this.cd = cd;
10 this.zone = zone;
11 this.onMapClick = new EventEmitter();
12 this.onOverlayClick = new EventEmitter();
13 this.onOverlayDblClick = new EventEmitter();
14 this.onOverlayDragStart = new EventEmitter();
15 this.onOverlayDrag = new EventEmitter();
16 this.onOverlayDragEnd = new EventEmitter();
17 this.onMapReady = new EventEmitter();
18 this.onMapDragEnd = new EventEmitter();
19 this.onZoomChanged = new EventEmitter();
20 this.differ = differs.find([]).create(null);
21 }
22 ngAfterViewChecked() {
23 if (!this.map && this.el.nativeElement.offsetParent) {
24 this.initialize();
25 }
26 }
27 initialize() {
28 this.map = new google.maps.Map(this.el.nativeElement.children[0], this.options);
29 this.onMapReady.emit({
30 map: this.map
31 });
32 if (this.overlays) {
33 for (let overlay of this.overlays) {
34 overlay.setMap(this.map);
35 this.bindOverlayEvents(overlay);
36 }
37 }
38 this.map.addListener('click', (event) => {
39 this.zone.run(() => {
40 this.onMapClick.emit(event);
41 });
42 });
43 this.map.addListener('dragend', (event) => {
44 this.zone.run(() => {
45 this.onMapDragEnd.emit(event);
46 });
47 });
48 this.map.addListener('zoom_changed', (event) => {
49 this.zone.run(() => {
50 this.onZoomChanged.emit(event);
51 });
52 });
53 }
54 bindOverlayEvents(overlay) {
55 overlay.addListener('click', (event) => {
56 this.zone.run(() => {
57 this.onOverlayClick.emit({
58 originalEvent: event,
59 'overlay': overlay,
60 map: this.map
61 });
62 });
63 });
64 overlay.addListener('dblclick', (event) => {
65 this.zone.run(() => {
66 this.onOverlayDblClick.emit({
67 originalEvent: event,
68 'overlay': overlay,
69 map: this.map
70 });
71 });
72 });
73 if (overlay.getDraggable()) {
74 this.bindDragEvents(overlay);
75 }
76 }
77 ngDoCheck() {
78 let changes = this.differ.diff(this.overlays);
79 if (changes && this.map) {
80 changes.forEachRemovedItem((record) => {
81 google.maps.event.clearInstanceListeners(record.item);
82 record.item.setMap(null);
83 });
84 changes.forEachAddedItem((record) => {
85 record.item.setMap(this.map);
86 record.item.addListener('click', (event) => {
87 this.zone.run(() => {
88 this.onOverlayClick.emit({
89 originalEvent: event,
90 overlay: record.item,
91 map: this.map
92 });
93 });
94 });
95 if (record.item.getDraggable()) {
96 this.bindDragEvents(record.item);
97 }
98 });
99 }
100 }
101 bindDragEvents(overlay) {
102 overlay.addListener('dragstart', (event) => {
103 this.zone.run(() => {
104 this.onOverlayDragStart.emit({
105 originalEvent: event,
106 overlay: overlay,
107 map: this.map
108 });
109 });
110 });
111 overlay.addListener('drag', (event) => {
112 this.zone.run(() => {
113 this.onOverlayDrag.emit({
114 originalEvent: event,
115 overlay: overlay,
116 map: this.map
117 });
118 });
119 });
120 overlay.addListener('dragend', (event) => {
121 this.zone.run(() => {
122 this.onOverlayDragEnd.emit({
123 originalEvent: event,
124 overlay: overlay,
125 map: this.map
126 });
127 });
128 });
129 }
130 getMap() {
131 return this.map;
132 }
133}
134GMap.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.0.0", ngImport: i0, type: GMap, deps: [{ token: i0.ElementRef }, { token: i0.IterableDiffers }, { token: i0.ChangeDetectorRef }, { token: i0.NgZone }], target: i0.ɵɵFactoryTarget.Component });
135GMap.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.0.0", type: GMap, selector: "p-gmap", inputs: { style: "style", styleClass: "styleClass", options: "options", overlays: "overlays" }, outputs: { onMapClick: "onMapClick", onOverlayClick: "onOverlayClick", onOverlayDblClick: "onOverlayDblClick", onOverlayDragStart: "onOverlayDragStart", onOverlayDrag: "onOverlayDrag", onOverlayDragEnd: "onOverlayDragEnd", onMapReady: "onMapReady", onMapDragEnd: "onMapDragEnd", onZoomChanged: "onZoomChanged" }, host: { classAttribute: "p-element" }, ngImport: i0, template: `<div [ngStyle]="style" [class]="styleClass"></div>`, isInline: true, directives: [{ type: i1.NgStyle, selector: "[ngStyle]", inputs: ["ngStyle"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None });
136i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.0.0", ngImport: i0, type: GMap, decorators: [{
137 type: Component,
138 args: [{
139 selector: 'p-gmap',
140 template: `<div [ngStyle]="style" [class]="styleClass"></div>`,
141 changeDetection: ChangeDetectionStrategy.OnPush,
142 encapsulation: ViewEncapsulation.None,
143 host: {
144 'class': 'p-element'
145 }
146 }]
147 }], ctorParameters: function () { return [{ type: i0.ElementRef }, { type: i0.IterableDiffers }, { type: i0.ChangeDetectorRef }, { type: i0.NgZone }]; }, propDecorators: { style: [{
148 type: Input
149 }], styleClass: [{
150 type: Input
151 }], options: [{
152 type: Input
153 }], overlays: [{
154 type: Input
155 }], onMapClick: [{
156 type: Output
157 }], onOverlayClick: [{
158 type: Output
159 }], onOverlayDblClick: [{
160 type: Output
161 }], onOverlayDragStart: [{
162 type: Output
163 }], onOverlayDrag: [{
164 type: Output
165 }], onOverlayDragEnd: [{
166 type: Output
167 }], onMapReady: [{
168 type: Output
169 }], onMapDragEnd: [{
170 type: Output
171 }], onZoomChanged: [{
172 type: Output
173 }] } });
174class GMapModule {
175}
176GMapModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.0.0", ngImport: i0, type: GMapModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
177GMapModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "13.0.0", ngImport: i0, type: GMapModule, declarations: [GMap], imports: [CommonModule], exports: [GMap] });
178GMapModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "13.0.0", ngImport: i0, type: GMapModule, imports: [[CommonModule]] });
179i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.0.0", ngImport: i0, type: GMapModule, decorators: [{
180 type: NgModule,
181 args: [{
182 imports: [CommonModule],
183 exports: [GMap],
184 declarations: [GMap]
185 }]
186 }] });
187
188/**
189 * Generated bundle index. Do not edit.
190 */
191
192export { GMap, GMapModule };
Note: See TracBrowser for help on using the repository browser.