UNPKG

@agm/snazzy-info-window

Version:

Angular Google Maps (AGM) package for Snazzy Info Window support

2 lines 4.68 kB
!function(e,n){"object"==typeof exports&&"undefined"!=typeof module?n(exports,require("@agm/core"),require("@angular/core")):"function"==typeof define&&define.amd?define("@agm/snazzy-info-window",["exports","@agm/core","@angular/core"],n):n(((e=e||self).agm=e.agm||{},e.agm["snazzy-info-window"]={}),e.core,e.ng.core)}(this,(function(e,n,t){"use strict";var o=function(){function e(e,n,o,i){this._marker=e,this._wrapper=n,this._manager=o,this._loader=i,this.isOpen=!1,this.isOpenChange=new t.EventEmitter,this.placement="top",this.maxWidth=200,this.maxHeight=200,this.openOnMarkerClick=!0,this.closeOnMapClick=!0,this.closeWhenOthersOpen=!1,this.showCloseButton=!0,this.panOnOpen=!0,this.beforeOpen=new t.EventEmitter,this.afterClose=new t.EventEmitter,this._snazzyInfoWindowInitialized=null}return e.prototype.ngOnChanges=function(e){null!=this._nativeSnazzyInfoWindow&&("isOpen"in e&&this.isOpen?this._openInfoWindow():"isOpen"in e&&!this.isOpen&&this._closeInfoWindow(),("latitude"in e||"longitude"in e)&&null==this._marker&&this._updatePosition())},e.prototype.ngAfterViewInit=function(){var e=this,n=null!=this._manager?this._manager.getNativeMarker(this._marker):null;this._snazzyInfoWindowInitialized=this._loader.load().then((function(){return require("snazzy-info-window")})).then((function(t){return Promise.all([t,n,e._wrapper.getNativeMap()])})).then((function(n){var t={map:n[2],content:"",placement:e.placement,maxWidth:e.maxWidth,maxHeight:e.maxHeight,backgroundColor:e.backgroundColor,padding:e.padding,border:e.border,borderRadius:e.borderRadius,fontColor:e.fontColor,pointer:e.pointer,shadow:e.shadow,closeOnMapClick:e.closeOnMapClick,openOnMarkerClick:e.openOnMarkerClick,closeWhenOthersOpen:e.closeWhenOthersOpen,showCloseButton:e.showCloseButton,panOnOpen:e.panOnOpen,wrapperClass:e.wrapperClass,callbacks:{beforeOpen:function(){e._createViewContent(),e.beforeOpen.emit()},afterOpen:function(){e.isOpenChange.emit(e.openStatus())},afterClose:function(){e.afterClose.emit(),e.isOpenChange.emit(e.openStatus())}}};null!=n[1]?t.marker=n[1]:t.position={lat:e.latitude,lng:e.longitude},e._nativeSnazzyInfoWindow=new n[0](t)})),this._snazzyInfoWindowInitialized.then((function(){e.isOpen&&e._openInfoWindow()}))},e.prototype._openInfoWindow=function(){var e=this;this._snazzyInfoWindowInitialized.then((function(){e._createViewContent(),e._nativeSnazzyInfoWindow.open()}))},e.prototype._closeInfoWindow=function(){var e=this;this._snazzyInfoWindowInitialized.then((function(){e._nativeSnazzyInfoWindow.close()}))},e.prototype._createViewContent=function(){if(1!==this._viewContainerRef.length){var e=this._viewContainerRef.createEmbeddedView(this._templateRef);this._nativeSnazzyInfoWindow.setContent(this._outerWrapper.nativeElement),setTimeout((function(){e.detectChanges()}))}},e.prototype._updatePosition=function(){this._nativeSnazzyInfoWindow.setPosition({lat:this.latitude,lng:this.longitude})},e.prototype.openStatus=function(){return this._nativeSnazzyInfoWindow&&this._nativeSnazzyInfoWindow.isOpen()},e.prototype.ngOnDestroy=function(){this._nativeSnazzyInfoWindow&&this._nativeSnazzyInfoWindow.destroy()},e}();o.decorators=[{type:t.Component,args:[{selector:"agm-snazzy-info-window",template:"<div #outerWrapper><div #viewContainer></div></div><ng-content></ng-content>"}]}],o.ctorParameters=function(){return[{type:n.AgmMarker,decorators:[{type:t.Optional},{type:t.Host},{type:t.SkipSelf}]},{type:n.GoogleMapsAPIWrapper},{type:n.MarkerManager},{type:n.MapsAPILoader}]},o.propDecorators={latitude:[{type:t.Input}],longitude:[{type:t.Input}],isOpen:[{type:t.Input}],isOpenChange:[{type:t.Output}],placement:[{type:t.Input}],maxWidth:[{type:t.Input}],maxHeight:[{type:t.Input}],backgroundColor:[{type:t.Input}],padding:[{type:t.Input}],border:[{type:t.Input}],borderRadius:[{type:t.Input}],fontColor:[{type:t.Input}],fontSize:[{type:t.Input}],pointer:[{type:t.Input}],shadow:[{type:t.Input}],openOnMarkerClick:[{type:t.Input}],closeOnMapClick:[{type:t.Input}],wrapperClass:[{type:t.Input}],closeWhenOthersOpen:[{type:t.Input}],showCloseButton:[{type:t.Input}],panOnOpen:[{type:t.Input}],beforeOpen:[{type:t.Output}],afterClose:[{type:t.Output}],_outerWrapper:[{type:t.ViewChild,args:["outerWrapper",{read:t.ElementRef,static:!1}]}],_viewContainerRef:[{type:t.ViewChild,args:["viewContainer",{read:t.ViewContainerRef,static:!1}]}],_templateRef:[{type:t.ContentChild,args:[t.TemplateRef,{static:!1}]}]};var i=function(){};i.decorators=[{type:t.NgModule,args:[{declarations:[o],exports:[o]}]}],e.AgmSnazzyInfoWindow=o,e.AgmSnazzyInfoWindowModule=i,Object.defineProperty(e,"__esModule",{value:!0})})); //# sourceMappingURL=agm-snazzy-info-window.umd.min.js.map