1 | {"version":3,"file":"primeng-gmap.mjs","sources":["../../src/app/components/gmap/gmap.ts","../../src/app/components/gmap/primeng-gmap.ts"],"sourcesContent":["import {NgModule,Component,ElementRef,AfterViewChecked,DoCheck,Input,Output,EventEmitter,IterableDiffers,ChangeDetectorRef,NgZone,ChangeDetectionStrategy, ViewEncapsulation} from '@angular/core';\nimport {CommonModule} from '@angular/common';\n\ndeclare var google: any;\n\n@Component({\n selector: 'p-gmap',\n template: `<div [ngStyle]=\"style\" [class]=\"styleClass\"></div>`,\n changeDetection: ChangeDetectionStrategy.OnPush,\n encapsulation: ViewEncapsulation.None,\n host: {\n 'class': 'p-element'\n }\n})\nexport class GMap implements AfterViewChecked,DoCheck {\n\n @Input() style: any;\n\n @Input() styleClass: string;\n\n @Input() options: any;\n\n @Input() overlays: any[];\n\n @Output() onMapClick: EventEmitter<any> = new EventEmitter();\n\n @Output() onOverlayClick: EventEmitter<any> = new EventEmitter();\n\n @Output() onOverlayDblClick: EventEmitter<any> = new EventEmitter();\n\n @Output() onOverlayDragStart: EventEmitter<any> = new EventEmitter();\n\n @Output() onOverlayDrag: EventEmitter<any> = new EventEmitter();\n\n @Output() onOverlayDragEnd: EventEmitter<any> = new EventEmitter();\n\n @Output() onMapReady: EventEmitter<any> = new EventEmitter();\n\n @Output() onMapDragEnd: EventEmitter<any> = new EventEmitter();\n\n @Output() onZoomChanged: EventEmitter<any> = new EventEmitter();\n\n differ: any;\n\n map: any;\n\n constructor(public el: ElementRef,differs: IterableDiffers, public cd: ChangeDetectorRef, public zone:NgZone) {\n this.differ = differs.find([]).create(null);\n }\n\n ngAfterViewChecked() {\n if (!this.map && this.el.nativeElement.offsetParent) {\n this.initialize();\n }\n }\n\n initialize() {\n this.map = new google.maps.Map(this.el.nativeElement.children[0], this.options);\n this.onMapReady.emit({\n map: this.map\n });\n\n if (this.overlays) {\n for(let overlay of this.overlays) {\n overlay.setMap(this.map);\n this.bindOverlayEvents(overlay);\n }\n }\n\n this.map.addListener('click', (event) => {\n this.zone.run(() => {\n this.onMapClick.emit(event);\n });\n });\n\n this.map.addListener('dragend', (event) => {\n this.zone.run(() => {\n this.onMapDragEnd.emit(event);\n });\n });\n\n this.map.addListener('zoom_changed', (event) => {\n this.zone.run(() => {\n this.onZoomChanged.emit(event);\n });\n });\n }\n\n bindOverlayEvents(overlay: any) {\n overlay.addListener('click', (event) => {\n this.zone.run(() => {\n this.onOverlayClick.emit({\n originalEvent: event,\n 'overlay': overlay,\n map: this.map\n });\n });\n });\n\n overlay.addListener('dblclick', (event) => {\n this.zone.run(() => {\n this.onOverlayDblClick.emit({\n originalEvent: event,\n 'overlay': overlay,\n map: this.map\n });\n });\n });\n\n if (overlay.getDraggable()) {\n this.bindDragEvents(overlay);\n }\n }\n\n ngDoCheck() {\n let changes = this.differ.diff(this.overlays);\n\n if (changes && this.map) {\n changes.forEachRemovedItem((record) => {\n google.maps.event.clearInstanceListeners(record.item);\n record.item.setMap(null);\n });\n\n changes.forEachAddedItem((record) => {\n record.item.setMap(this.map);\n record.item.addListener('click', (event) => {\n this.zone.run(() => {\n this.onOverlayClick.emit({\n originalEvent: event,\n overlay: record.item,\n map: this.map\n });\n });\n });\n\n if (record.item.getDraggable()) {\n this.bindDragEvents(record.item);\n }\n });\n }\n }\n\n bindDragEvents(overlay) {\n overlay.addListener('dragstart', (event) => {\n this.zone.run(() => {\n this.onOverlayDragStart.emit({\n originalEvent: event,\n overlay: overlay,\n map: this.map\n });\n });\n });\n\n overlay.addListener('drag', (event) => {\n this.zone.run(() => {\n this.onOverlayDrag.emit({\n originalEvent: event,\n overlay: overlay,\n map: this.map\n });\n });\n });\n\n overlay.addListener('dragend', (event) => {\n this.zone.run(() => {\n this.onOverlayDragEnd.emit({\n originalEvent: event,\n overlay: overlay,\n map: this.map\n });\n });\n });\n }\n\n getMap() {\n return this.map;\n }\n}\n\n@NgModule({\n imports: [CommonModule],\n exports: [GMap],\n declarations: [GMap]\n})\nexport class GMapModule { }\n","/**\n * Generated bundle index.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