vue3-google-map
Advanced tools
Comparing version 0.5.1 to 0.5.2
@@ -34,9 +34,9 @@ /* | ||
vue.onBeforeUnmount(()=>{var a;d.value&&(null===(a=f.value)||void 0===a?void 0:a.event.clearInstanceListeners(d.value))});"undefined"!==typeof window&&(new Loader({apiKey:a.apiKey,version:"weekly",libraries:["places"],language:a.language,region:a.region})).load().then(()=>{var {Map:h}=f.value=google.maps;d.value=new h(e.value,g());mapEvents.forEach(a=>{var c;null===(c=d.value)||void 0===c?void 0:c.addListener(a,c=>b(a,c))});c.value=!0;h=Object.keys(a).filter(a=>!["center","zoom"].includes(a)).map(b=> | ||
vue.toRef(a,b));vue.watch([()=>a.center,()=>a.zoom,...h],([a,b],[c,e])=>{var f,h,k,l=g();l=__rest(l,["center","zoom"]);null===(f=d.value)||void 0===f?void 0:f.setOptions(l);void 0!==b&&b!==e&&(null===(h=d.value)||void 0===h?void 0:h.setZoom(b));!a||c&&a.lng===c.lng&&a.lat===c.lat||(null===(k=d.value)||void 0===k?void 0:k.panTo(a))})});return{mapRef:e,ready:c,map:d,api:f}}});let _hoisted_1={ref:"mapRef"}; | ||
function render(a,b,e,c,d,f){return vue.openBlock(),vue.createBlock("div",_hoisted_1,[vue.renderSlot(a.$slots,"default")],512)}script.render=render;script.__file="src/components/GoogleMap.vue"; | ||
let useSetupMapComponent=(a,b,e,c)=>{let d=null;const f=vue.ref(null),g=vue.inject(MapSymbol,vue.ref(null)),h=vue.inject(ApiSymbol,vue.ref(null));vue.watch([g,e],(l,n,m)=>{g.value&&h.value&&(f.value=d=new h.value[a](Object.assign(Object.assign({},e.value),{map:g.value})),b.forEach(a=>{null===d||void 0===d?void 0:d.addListener(a,b=>c(a,b))}));m(()=>{var a;d&&(null===(a=h.value)||void 0===a?void 0:a.event.clearInstanceListeners(d),d.setMap(null))})});return{component:f}}; | ||
vue.toRef(a,b));vue.watch([()=>a.center,()=>a.zoom,...h],([a,b],[c,e])=>{var f,h,k,l=g();l=__rest(l,["center","zoom"]);null===(f=d.value)||void 0===f?void 0:f.setOptions(l);void 0!==b&&b!==e&&(null===(h=d.value)||void 0===h?void 0:h.setZoom(b));!a||c&&a.lng===c.lng&&a.lat===c.lat||(null===(k=d.value)||void 0===k?void 0:k.panTo(a))})});return{mapRef:e,ready:c,map:d,api:f}}}); | ||
function render(a,b,e,c,d,f){return vue.openBlock(),vue.createBlock("div",null,[vue.createVNode("div",vue.mergeProps(a.$attrs,{ref:"mapRef"}),null,16),vue.renderSlot(a.$slots,"default")])}script.render=render;script.__file="src/components/GoogleMap.vue"; | ||
let useSetupMapComponent=(a,b,e,c)=>{let d=null;const f=vue.ref(null),g=vue.inject(MapSymbol,vue.ref(null)),h=vue.inject(ApiSymbol,vue.ref(null));vue.watch([g,e],(l,n,m)=>{g.value&&h.value&&(f.value=d=new h.value[a](Object.assign(Object.assign({},e.value),{map:g.value})),b.forEach(a=>{null===d||void 0===d?void 0:d.addListener(a,b=>c(a,b))}));m(()=>{var a;d&&(null===(a=h.value)||void 0===a?void 0:a.event.clearInstanceListeners(d),d.setMap(null))})},{immediate:!0});return{component:f}}; | ||
var Marker=vue.defineComponent({props:{options:{type:Object,required:!0}},emits:markerEvents,setup(a,{emit:b}){a=vue.toRef(a,"options");return{marker:useSetupMapComponent("Marker",markerEvents,a,b)}},render:()=>null}),Polyline=vue.defineComponent({props:{options:{type:Object,required:!0}},emits:polylineEvents,setup(a,{emit:b}){a=vue.toRef(a,"options");return{polyline:useSetupMapComponent("Polyline",polylineEvents,a,b)}},render:()=>null}),Polygon=vue.defineComponent({props:{options:{type:Object,required:!0}}, | ||
emits:polygonEvents,setup(a,{emit:b}){a=vue.toRef(a,"options");return{polygon:useSetupMapComponent("Polygon",polygonEvents,a,b)}},render:()=>null}),Rectangle=vue.defineComponent({props:{options:{type:Object,required:!0}},emits:rectangleEvents,setup(a,{emit:b}){a=vue.toRef(a,"options");return{rectangle:useSetupMapComponent("Rectangle",rectangleEvents,a,b)}},render:()=>null}),Circle=vue.defineComponent({props:{options:{type:Object,required:!0}},emits:circleEvents,setup(a,{emit:b}){a=vue.toRef(a,"options"); | ||
return{circle:useSetupMapComponent("Circle",circleEvents,a,b)}},render:()=>null}),script$1=vue.defineComponent({props:{position:{type:String,required:!0},index:Number},setup(a){let b=vue.ref(null),e=vue.inject(MapSymbol,vue.ref(null)),c=vue.inject(ApiSymbol,vue.ref(null));vue.watch([e,()=>a.position,()=>a.index],(d,f,g)=>{e.value&&c.value&&(a.index&&(b.value.index=a.index),b.value&&e.value.controls[c.value.ControlPosition[a.position]].push(b.value));g(()=>{if(e.value&&c.value&&b.value){let a=void 0; | ||
e.value.controls[c.value.ControlPosition[f[1]]].forEach((c,d)=>{c===b.value&&(a=d)});a&&e.value.controls[c.value.ControlPosition[f[1]]].removeAt(a)}})});return{controlRef:b}}});let _hoisted_1$1={ref:"controlRef"};function render$1(a,b,e,c,d,f){return vue.openBlock(),vue.createBlock("div",_hoisted_1$1,[vue.renderSlot(a.$slots,"default")],512)}script$1.render=render$1;script$1.__file="src/components/CustomControl.vue";exports.Circle=Circle;exports.CustomControl=script$1;exports.GoogleMap=script; | ||
return{circle:useSetupMapComponent("Circle",circleEvents,a,b)}},render:()=>null}),script$1=vue.defineComponent({props:{position:{type:String,required:!0},index:Number},setup(a){let b=vue.ref(null),e=vue.inject(MapSymbol,vue.ref(null)),c=vue.inject(ApiSymbol,vue.ref(null));vue.watch([e,()=>a.position,()=>a.index],(d,[,f],g)=>{e.value&&c.value&&(a.index&&(b.value.index=a.index),b.value&&e.value.controls[c.value.ControlPosition[a.position]].push(b.value));g(()=>{if(e.value&&c.value&&f){let a=void 0; | ||
e.value.controls[c.value.ControlPosition[f]].forEach((c,d)=>{c===b.value&&(a=d)});a&&e.value.controls[c.value.ControlPosition[f]].removeAt(a)}})},{immediate:!0});return{controlRef:b}}});let _hoisted_1={ref:"controlRef"};function render$1(a,b,e,c,d,f){return vue.openBlock(),vue.createBlock("div",_hoisted_1,[vue.renderSlot(a.$slots,"default")],512)}script$1.render=render$1;script$1.__file="src/components/CustomControl.vue";exports.Circle=Circle;exports.CustomControl=script$1;exports.GoogleMap=script; | ||
exports.Marker=Marker;exports.Polygon=Polygon;exports.Polyline=Polyline;exports.Rectangle=Rectangle |
@@ -1,1 +0,1 @@ | ||
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("vue");var o=function e(o,t){if(o===t)return!0;if(o&&t&&"object"==typeof o&&"object"==typeof t){if(o.constructor!==t.constructor)return!1;var n;if(Array.isArray(o)){var i=o.length;if(i!=t.length)return!1;for(n=i;0!=n--;)if(!e(o[n],t[n]))return!1;return!0}if(o.constructor===RegExp)return o.source===t.source&&o.flags===t.flags;if(o.valueOf!==Object.prototype.valueOf)return o.valueOf()===t.valueOf();if(o.toString!==Object.prototype.toString)return o.toString()===t.toString();var r=Object.keys(o);if((i=r.length)!==Object.keys(t).length)return!1;for(n=i;0!=n--;)if(!Object.prototype.hasOwnProperty.call(t,r[n]))return!1;for(n=i;0!=n--;)if(!e(o[i=r[n]],t[i]))return!1;return!0}return o!=o&&t!=t};class t{constructor({apiKey:e,channel:n,client:i,id:r="__googleMapsScriptId",libraries:l=[],language:a,region:s,version:c,mapIds:d,nonce:u,retries:p=3,url:g="https://maps.googleapis.com/maps/api/js"}){if(this.CALLBACK="__googleMapsCallback",this.callbacks=[],this.loading=this.done=!1,this.errors=[],this.version=c,this.apiKey=e,this.channel=n,this.client=i,this.id=r||"__googleMapsScriptId",this.libraries=l,this.language=a,this.region=s,this.mapIds=d,this.nonce=u,this.retries=p,this.url=g,t.instance){if(!o(this.options,t.instance.options))throw Error(`Loader must not be called again with different options. ${JSON.stringify(this.options)} !== ${JSON.stringify(t.instance.options)}`);return t.instance}t.instance=this}get options(){return{version:this.version,apiKey:this.apiKey,channel:this.channel,client:this.client,id:this.id,libraries:this.libraries,language:this.language,region:this.region,mapIds:this.mapIds,nonce:this.nonce,url:this.url}}createUrl(){let e=this.url;return e+="?callback="+this.CALLBACK,this.apiKey&&(e+="&key="+this.apiKey),this.channel&&(e+="&channel="+this.channel),this.client&&(e+="&client="+this.client),0<this.libraries.length&&(e+="&libraries="+this.libraries.join(",")),this.language&&(e+="&language="+this.language),this.region&&(e+="®ion="+this.region),this.version&&(e+="&v="+this.version),this.mapIds&&(e+="&map_ids="+this.mapIds.join(",")),e}load(){return this.loadPromise()}loadPromise(){return new Promise(((e,o)=>{this.loadCallback((t=>{t?o(t):e()}))}))}loadCallback(e){this.callbacks.push(e),this.execute()}setScript(){if(document.getElementById(this.id))this.callback();else{var e=this.createUrl(),o=document.createElement("script");o.id=this.id,o.type="text/javascript",o.src=e,o.onerror=this.loadErrorCallback.bind(this),o.defer=!0,o.async=!0,this.nonce&&(o.nonce=this.nonce),document.head.appendChild(o)}}deleteScript(){let e=document.getElementById(this.id);e&&e.remove()}resetIfRetryingFailed(){let e=this.retries+1;this.done&&!this.loading&&this.errors.length>=e&&(this.deleteScript(),this.loading=this.done=!1,this.errors=[])}loadErrorCallback(e){this.errors.push(e),this.errors.length<=this.retries?(e=this.errors.length*Math.pow(2,this.errors.length),console.log(`Failed to load Google Maps script, retrying in ${e} ms.`),setTimeout((()=>{this.deleteScript(),this.setScript()}),e)):(this.onerrorEvent=e,this.callback())}setCallback(){window.__googleMapsCallback=this.callback.bind(this)}callback(){this.done=!0,this.loading=!1,this.callbacks.forEach((e=>{e(this.onerrorEvent)})),this.callbacks=[]}execute(){window.google&&window.google.maps&&window.google.maps.version&&(console.warn("Aborted attempt to load Google Maps JS with @googlemaps/js-api-loader.This may result in undesirable behavior as script parameters may not match."),this.callback()),this.resetIfRetryingFailed(),this.done?this.callback():this.loading||(this.loading=!0,this.setCallback(),this.setScript())}}let n=Symbol("api"),i=Symbol("map"),r="bounds_changed center_changed click dblclick drag dragend dragstart heading_changed idle maptypeid_changed mousemove mouseout mouseover projection_changed resize rightclick tilesloaded tilt_changed zoom_changed".split(" "),l="animation_changed click dblclick rightclick dragstart dragend drag mouseover mousedown mouseup draggable_changed clickable_changed cursor_changed flat_changed rightclick zindex_changed icon_changed position_changed shape_changed title_changed visible_changed".split(" "),a="click dblclick drag dragend dragstart mousedown mousemove mouseout mouseover mouseup rightclick".split(" "),s=a,c=a.concat(["bounds_changed"]),d=a.concat(["center_changed","radius_changed"]);var u=e.defineComponent({props:{apiKey:{type:String,default:""},region:String,language:String,backgroundColor:String,center:Object,clickableIcons:{type:Boolean,default:void 0},controlSize:Number,disableDefaultUi:{type:Boolean,default:void 0},disableDoubleClickZoom:{type:Boolean,default:void 0},draggable:{type:Boolean,default:void 0},draggableCursor:String,draggingCursor:String,fullscreenControl:{type:Boolean,default:void 0},fullscreenControlPosition:String,gestureHandling:String,heading:Number,keyboardShortcuts:{type:Boolean,default:void 0},mapTypeControl:{type:Boolean,default:void 0},mapTypeControlOptions:Object,mapTypeId:{type:[Number,String]},maxZoom:Number,minZoom:Number,noClear:{type:Boolean,default:void 0},panControl:{type:Boolean,default:void 0},panControlPosition:String,restriction:Object,rotateControl:{type:Boolean,default:void 0},rotateControlPosition:String,scaleControl:{type:Boolean,default:void 0},scaleControlStyle:Number,scrollwheel:{type:Boolean,default:void 0},streetView:Object,streetViewControl:{type:Boolean,default:void 0},streetViewControlPosition:String,styles:Array,tilt:Number,zoom:Number,zoomControl:{type:Boolean,default:void 0},zoomControlPosition:String},emits:r,setup(o,{emit:l}){let a=e.ref(null),s=e.ref(!1),c=e.ref(null),d=e.ref(null);e.provide(i,c),e.provide(n,d);let u=()=>{var e,t,n,i,r;const l={backgroundColor:o.backgroundColor,center:o.center,clickableIcons:o.clickableIcons,controlSize:o.controlSize,disableDefaultUI:o.disableDefaultUi,disableDoubleClickZoom:o.disableDoubleClickZoom,draggable:o.draggable,draggableCursor:o.draggableCursor,draggingCursor:o.draggingCursor,fullscreenControl:o.fullscreenControl,fullscreenControlOptions:o.fullscreenControlPosition?{position:null===(e=d.value)||void 0===e?void 0:e.ControlPosition[o.fullscreenControlPosition]}:{},gestureHandling:o.gestureHandling,heading:o.heading,keyboardShortcuts:o.keyboardShortcuts,mapTypeControl:o.mapTypeControl,mapTypeControlOptions:o.mapTypeControlOptions,mapTypeId:o.mapTypeId,maxZoom:o.maxZoom,minZoom:o.minZoom,noClear:o.noClear,panControl:o.panControl,panControlOptions:o.panControlPosition?{position:null===(t=d.value)||void 0===t?void 0:t.ControlPosition[o.panControlPosition]}:{},restriction:o.restriction,rotateControl:o.rotateControl,rotateControlOptions:o.rotateControlPosition?{position:null===(n=d.value)||void 0===n?void 0:n.ControlPosition[o.rotateControlPosition]}:{},scaleControl:o.scaleControl,scaleControlOptions:o.scaleControlStyle?{style:o.scaleControlStyle}:{},scrollwheel:o.scrollwheel,streetView:o.streetView,streetViewControl:o.streetViewControl,streetViewControlOptions:o.streetViewControlPosition?{position:null===(i=d.value)||void 0===i?void 0:i.ControlPosition[o.streetViewControlPosition]}:{},styles:o.styles,tilt:o.tilt,zoom:o.zoom,zoomControl:o.zoomControl,zoomControlOptions:o.zoomControlPosition?{position:null===(r=d.value)||void 0===r?void 0:r.ControlPosition[o.zoomControlPosition]}:{}};return Object.keys(l).forEach((e=>void 0===l[e]&&delete l[e])),l};return e.onBeforeUnmount((()=>{var e;c.value&&(null===(e=d.value)||void 0===e||e.event.clearInstanceListeners(c.value))})),"undefined"!=typeof window&&new t({apiKey:o.apiKey,version:"weekly",libraries:["places"],language:o.language,region:o.region}).load().then((()=>{var{Map:t}=d.value=google.maps;c.value=new t(a.value,u()),r.forEach((e=>{var o;null===(o=c.value)||void 0===o||o.addListener(e,(o=>l(e,o)))})),s.value=!0,t=Object.keys(o).filter((e=>!["center","zoom"].includes(e))).map((t=>e.toRef(o,t))),e.watch([()=>o.center,()=>o.zoom,...t],(([e,o],[t,n])=>{var i,r,l,a=u();a=function(e,o){var t,n={};for(t in e)Object.prototype.hasOwnProperty.call(e,t)&&0>o.indexOf(t)&&(n[t]=e[t]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var i=0;for(t=Object.getOwnPropertySymbols(e);i<t.length;i++)0>o.indexOf(t[i])&&Object.prototype.propertyIsEnumerable.call(e,t[i])&&(n[t[i]]=e[t[i]])}return n}(a,["center","zoom"]),null===(i=c.value)||void 0===i||i.setOptions(a),void 0!==o&&o!==n&&(null===(r=c.value)||void 0===r||r.setZoom(o)),!e||t&&e.lng===t.lng&&e.lat===t.lat||null===(l=c.value)||void 0===l||l.panTo(e)}))})),{mapRef:a,ready:s,map:c,api:d}}});let p={ref:"mapRef"};u.render=function(o,t,n,i,r,l){return e.openBlock(),e.createBlock("div",p,[e.renderSlot(o.$slots,"default")],512)},u.__file="src/components/GoogleMap.vue";let g=(o,t,r,l)=>{let a=null;const s=e.ref(null),c=e.inject(i,e.ref(null)),d=e.inject(n,e.ref(null));return e.watch([c,r],((e,n,i)=>{c.value&&d.value&&(s.value=a=new d.value[o](Object.assign(Object.assign({},r.value),{map:c.value})),t.forEach((e=>{null==a||a.addListener(e,(o=>l(e,o)))}))),i((()=>{var e;a&&(null===(e=d.value)||void 0===e||e.event.clearInstanceListeners(a),a.setMap(null))}))})),{component:s}};var h=e.defineComponent({props:{options:{type:Object,required:!0}},emits:l,setup:(o,{emit:t})=>(o=e.toRef(o,"options"),{marker:g("Marker",l,o,t)}),render:()=>null}),m=e.defineComponent({props:{options:{type:Object,required:!0}},emits:a,setup:(o,{emit:t})=>(o=e.toRef(o,"options"),{polyline:g("Polyline",a,o,t)}),render:()=>null}),v=e.defineComponent({props:{options:{type:Object,required:!0}},emits:s,setup:(o,{emit:t})=>(o=e.toRef(o,"options"),{polygon:g("Polygon",s,o,t)}),render:()=>null}),f=e.defineComponent({props:{options:{type:Object,required:!0}},emits:c,setup:(o,{emit:t})=>(o=e.toRef(o,"options"),{rectangle:g("Rectangle",c,o,t)}),render:()=>null}),b=e.defineComponent({props:{options:{type:Object,required:!0}},emits:d,setup:(o,{emit:t})=>(o=e.toRef(o,"options"),{circle:g("Circle",d,o,t)}),render:()=>null}),y=e.defineComponent({props:{position:{type:String,required:!0},index:Number},setup(o){let t=e.ref(null),r=e.inject(i,e.ref(null)),l=e.inject(n,e.ref(null));return e.watch([r,()=>o.position,()=>o.index],((e,n,i)=>{r.value&&l.value&&(o.index&&(t.value.index=o.index),t.value&&r.value.controls[l.value.ControlPosition[o.position]].push(t.value)),i((()=>{if(r.value&&l.value&&t.value){let e=void 0;r.value.controls[l.value.ControlPosition[n[1]]].forEach(((o,n)=>{o===t.value&&(e=n)})),e&&r.value.controls[l.value.ControlPosition[n[1]]].removeAt(e)}}))})),{controlRef:t}}});let C={ref:"controlRef"};y.render=function(o,t,n,i,r,l){return e.openBlock(),e.createBlock("div",C,[e.renderSlot(o.$slots,"default")],512)},y.__file="src/components/CustomControl.vue",exports.Circle=b,exports.CustomControl=y,exports.GoogleMap=u,exports.Marker=h,exports.Polygon=v,exports.Polyline=m,exports.Rectangle=f; | ||
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("vue");var o=function e(o,t){if(o===t)return!0;if(o&&t&&"object"==typeof o&&"object"==typeof t){if(o.constructor!==t.constructor)return!1;var n;if(Array.isArray(o)){var i=o.length;if(i!=t.length)return!1;for(n=i;0!=n--;)if(!e(o[n],t[n]))return!1;return!0}if(o.constructor===RegExp)return o.source===t.source&&o.flags===t.flags;if(o.valueOf!==Object.prototype.valueOf)return o.valueOf()===t.valueOf();if(o.toString!==Object.prototype.toString)return o.toString()===t.toString();var r=Object.keys(o);if((i=r.length)!==Object.keys(t).length)return!1;for(n=i;0!=n--;)if(!Object.prototype.hasOwnProperty.call(t,r[n]))return!1;for(n=i;0!=n--;)if(!e(o[i=r[n]],t[i]))return!1;return!0}return o!=o&&t!=t};class t{constructor({apiKey:e,channel:n,client:i,id:r="__googleMapsScriptId",libraries:l=[],language:a,region:s,version:c,mapIds:d,nonce:u,retries:p=3,url:g="https://maps.googleapis.com/maps/api/js"}){if(this.CALLBACK="__googleMapsCallback",this.callbacks=[],this.loading=this.done=!1,this.errors=[],this.version=c,this.apiKey=e,this.channel=n,this.client=i,this.id=r||"__googleMapsScriptId",this.libraries=l,this.language=a,this.region=s,this.mapIds=d,this.nonce=u,this.retries=p,this.url=g,t.instance){if(!o(this.options,t.instance.options))throw Error(`Loader must not be called again with different options. ${JSON.stringify(this.options)} !== ${JSON.stringify(t.instance.options)}`);return t.instance}t.instance=this}get options(){return{version:this.version,apiKey:this.apiKey,channel:this.channel,client:this.client,id:this.id,libraries:this.libraries,language:this.language,region:this.region,mapIds:this.mapIds,nonce:this.nonce,url:this.url}}createUrl(){let e=this.url;return e+="?callback="+this.CALLBACK,this.apiKey&&(e+="&key="+this.apiKey),this.channel&&(e+="&channel="+this.channel),this.client&&(e+="&client="+this.client),0<this.libraries.length&&(e+="&libraries="+this.libraries.join(",")),this.language&&(e+="&language="+this.language),this.region&&(e+="®ion="+this.region),this.version&&(e+="&v="+this.version),this.mapIds&&(e+="&map_ids="+this.mapIds.join(",")),e}load(){return this.loadPromise()}loadPromise(){return new Promise(((e,o)=>{this.loadCallback((t=>{t?o(t):e()}))}))}loadCallback(e){this.callbacks.push(e),this.execute()}setScript(){if(document.getElementById(this.id))this.callback();else{var e=this.createUrl(),o=document.createElement("script");o.id=this.id,o.type="text/javascript",o.src=e,o.onerror=this.loadErrorCallback.bind(this),o.defer=!0,o.async=!0,this.nonce&&(o.nonce=this.nonce),document.head.appendChild(o)}}deleteScript(){let e=document.getElementById(this.id);e&&e.remove()}resetIfRetryingFailed(){let e=this.retries+1;this.done&&!this.loading&&this.errors.length>=e&&(this.deleteScript(),this.loading=this.done=!1,this.errors=[])}loadErrorCallback(e){this.errors.push(e),this.errors.length<=this.retries?(e=this.errors.length*Math.pow(2,this.errors.length),console.log(`Failed to load Google Maps script, retrying in ${e} ms.`),setTimeout((()=>{this.deleteScript(),this.setScript()}),e)):(this.onerrorEvent=e,this.callback())}setCallback(){window.__googleMapsCallback=this.callback.bind(this)}callback(){this.done=!0,this.loading=!1,this.callbacks.forEach((e=>{e(this.onerrorEvent)})),this.callbacks=[]}execute(){window.google&&window.google.maps&&window.google.maps.version&&(console.warn("Aborted attempt to load Google Maps JS with @googlemaps/js-api-loader.This may result in undesirable behavior as script parameters may not match."),this.callback()),this.resetIfRetryingFailed(),this.done?this.callback():this.loading||(this.loading=!0,this.setCallback(),this.setScript())}}let n=Symbol("api"),i=Symbol("map"),r="bounds_changed center_changed click dblclick drag dragend dragstart heading_changed idle maptypeid_changed mousemove mouseout mouseover projection_changed resize rightclick tilesloaded tilt_changed zoom_changed".split(" "),l="animation_changed click dblclick rightclick dragstart dragend drag mouseover mousedown mouseup draggable_changed clickable_changed cursor_changed flat_changed rightclick zindex_changed icon_changed position_changed shape_changed title_changed visible_changed".split(" "),a="click dblclick drag dragend dragstart mousedown mousemove mouseout mouseover mouseup rightclick".split(" "),s=a,c=a.concat(["bounds_changed"]),d=a.concat(["center_changed","radius_changed"]);var u=e.defineComponent({props:{apiKey:{type:String,default:""},region:String,language:String,backgroundColor:String,center:Object,clickableIcons:{type:Boolean,default:void 0},controlSize:Number,disableDefaultUi:{type:Boolean,default:void 0},disableDoubleClickZoom:{type:Boolean,default:void 0},draggable:{type:Boolean,default:void 0},draggableCursor:String,draggingCursor:String,fullscreenControl:{type:Boolean,default:void 0},fullscreenControlPosition:String,gestureHandling:String,heading:Number,keyboardShortcuts:{type:Boolean,default:void 0},mapTypeControl:{type:Boolean,default:void 0},mapTypeControlOptions:Object,mapTypeId:{type:[Number,String]},maxZoom:Number,minZoom:Number,noClear:{type:Boolean,default:void 0},panControl:{type:Boolean,default:void 0},panControlPosition:String,restriction:Object,rotateControl:{type:Boolean,default:void 0},rotateControlPosition:String,scaleControl:{type:Boolean,default:void 0},scaleControlStyle:Number,scrollwheel:{type:Boolean,default:void 0},streetView:Object,streetViewControl:{type:Boolean,default:void 0},streetViewControlPosition:String,styles:Array,tilt:Number,zoom:Number,zoomControl:{type:Boolean,default:void 0},zoomControlPosition:String},emits:r,setup(o,{emit:l}){let a=e.ref(null),s=e.ref(!1),c=e.ref(null),d=e.ref(null);e.provide(i,c),e.provide(n,d);let u=()=>{var e,t,n,i,r;const l={backgroundColor:o.backgroundColor,center:o.center,clickableIcons:o.clickableIcons,controlSize:o.controlSize,disableDefaultUI:o.disableDefaultUi,disableDoubleClickZoom:o.disableDoubleClickZoom,draggable:o.draggable,draggableCursor:o.draggableCursor,draggingCursor:o.draggingCursor,fullscreenControl:o.fullscreenControl,fullscreenControlOptions:o.fullscreenControlPosition?{position:null===(e=d.value)||void 0===e?void 0:e.ControlPosition[o.fullscreenControlPosition]}:{},gestureHandling:o.gestureHandling,heading:o.heading,keyboardShortcuts:o.keyboardShortcuts,mapTypeControl:o.mapTypeControl,mapTypeControlOptions:o.mapTypeControlOptions,mapTypeId:o.mapTypeId,maxZoom:o.maxZoom,minZoom:o.minZoom,noClear:o.noClear,panControl:o.panControl,panControlOptions:o.panControlPosition?{position:null===(t=d.value)||void 0===t?void 0:t.ControlPosition[o.panControlPosition]}:{},restriction:o.restriction,rotateControl:o.rotateControl,rotateControlOptions:o.rotateControlPosition?{position:null===(n=d.value)||void 0===n?void 0:n.ControlPosition[o.rotateControlPosition]}:{},scaleControl:o.scaleControl,scaleControlOptions:o.scaleControlStyle?{style:o.scaleControlStyle}:{},scrollwheel:o.scrollwheel,streetView:o.streetView,streetViewControl:o.streetViewControl,streetViewControlOptions:o.streetViewControlPosition?{position:null===(i=d.value)||void 0===i?void 0:i.ControlPosition[o.streetViewControlPosition]}:{},styles:o.styles,tilt:o.tilt,zoom:o.zoom,zoomControl:o.zoomControl,zoomControlOptions:o.zoomControlPosition?{position:null===(r=d.value)||void 0===r?void 0:r.ControlPosition[o.zoomControlPosition]}:{}};return Object.keys(l).forEach((e=>void 0===l[e]&&delete l[e])),l};return e.onBeforeUnmount((()=>{var e;c.value&&(null===(e=d.value)||void 0===e||e.event.clearInstanceListeners(c.value))})),"undefined"!=typeof window&&new t({apiKey:o.apiKey,version:"weekly",libraries:["places"],language:o.language,region:o.region}).load().then((()=>{var{Map:t}=d.value=google.maps;c.value=new t(a.value,u()),r.forEach((e=>{var o;null===(o=c.value)||void 0===o||o.addListener(e,(o=>l(e,o)))})),s.value=!0,t=Object.keys(o).filter((e=>!["center","zoom"].includes(e))).map((t=>e.toRef(o,t))),e.watch([()=>o.center,()=>o.zoom,...t],(([e,o],[t,n])=>{var i,r,l,a=u();a=function(e,o){var t,n={};for(t in e)Object.prototype.hasOwnProperty.call(e,t)&&0>o.indexOf(t)&&(n[t]=e[t]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var i=0;for(t=Object.getOwnPropertySymbols(e);i<t.length;i++)0>o.indexOf(t[i])&&Object.prototype.propertyIsEnumerable.call(e,t[i])&&(n[t[i]]=e[t[i]])}return n}(a,["center","zoom"]),null===(i=c.value)||void 0===i||i.setOptions(a),void 0!==o&&o!==n&&(null===(r=c.value)||void 0===r||r.setZoom(o)),!e||t&&e.lng===t.lng&&e.lat===t.lat||null===(l=c.value)||void 0===l||l.panTo(e)}))})),{mapRef:a,ready:s,map:c,api:d}}});u.render=function(o,t,n,i,r,l){return e.openBlock(),e.createBlock("div",null,[e.createVNode("div",e.mergeProps(o.$attrs,{ref:"mapRef"}),null,16),e.renderSlot(o.$slots,"default")])},u.__file="src/components/GoogleMap.vue";let p=(o,t,r,l)=>{let a=null;const s=e.ref(null),c=e.inject(i,e.ref(null)),d=e.inject(n,e.ref(null));return e.watch([c,r],((e,n,i)=>{c.value&&d.value&&(s.value=a=new d.value[o](Object.assign(Object.assign({},r.value),{map:c.value})),t.forEach((e=>{null==a||a.addListener(e,(o=>l(e,o)))}))),i((()=>{var e;a&&(null===(e=d.value)||void 0===e||e.event.clearInstanceListeners(a),a.setMap(null))}))}),{immediate:!0}),{component:s}};var g=e.defineComponent({props:{options:{type:Object,required:!0}},emits:l,setup:(o,{emit:t})=>(o=e.toRef(o,"options"),{marker:p("Marker",l,o,t)}),render:()=>null}),h=e.defineComponent({props:{options:{type:Object,required:!0}},emits:a,setup:(o,{emit:t})=>(o=e.toRef(o,"options"),{polyline:p("Polyline",a,o,t)}),render:()=>null}),m=e.defineComponent({props:{options:{type:Object,required:!0}},emits:s,setup:(o,{emit:t})=>(o=e.toRef(o,"options"),{polygon:p("Polygon",s,o,t)}),render:()=>null}),v=e.defineComponent({props:{options:{type:Object,required:!0}},emits:c,setup:(o,{emit:t})=>(o=e.toRef(o,"options"),{rectangle:p("Rectangle",c,o,t)}),render:()=>null}),f=e.defineComponent({props:{options:{type:Object,required:!0}},emits:d,setup:(o,{emit:t})=>(o=e.toRef(o,"options"),{circle:p("Circle",d,o,t)}),render:()=>null}),b=e.defineComponent({props:{position:{type:String,required:!0},index:Number},setup(o){let t=e.ref(null),r=e.inject(i,e.ref(null)),l=e.inject(n,e.ref(null));return e.watch([r,()=>o.position,()=>o.index],((e,[,n],i)=>{r.value&&l.value&&(o.index&&(t.value.index=o.index),t.value&&r.value.controls[l.value.ControlPosition[o.position]].push(t.value)),i((()=>{if(r.value&&l.value&&n){let e=void 0;r.value.controls[l.value.ControlPosition[n]].forEach(((o,n)=>{o===t.value&&(e=n)})),e&&r.value.controls[l.value.ControlPosition[n]].removeAt(e)}}))}),{immediate:!0}),{controlRef:t}}});let y={ref:"controlRef"};b.render=function(o,t,n,i,r,l){return e.openBlock(),e.createBlock("div",y,[e.renderSlot(o.$slots,"default")],512)},b.__file="src/components/CustomControl.vue",exports.Circle=f,exports.CustomControl=b,exports.GoogleMap=u,exports.Marker=g,exports.Polygon=m,exports.Polyline=h,exports.Rectangle=v; |
@@ -1,2 +0,2 @@ | ||
import{defineComponent,ref,provide,onBeforeUnmount,toRef,watch,openBlock,createBlock,renderSlot,inject}from'vue';/* | ||
import{defineComponent,ref,provide,onBeforeUnmount,toRef,watch,openBlock,createBlock,createVNode,mergeProps,renderSlot,inject}from'vue';/* | ||
***************************************************************************** | ||
@@ -34,7 +34,7 @@ Copyright (c) Microsoft Corporation. | ||
k)&&0>t.indexOf(k)&&(p[k]=m[k]);if(null!=m&&"function"===typeof Object.getOwnPropertySymbols){var r=0;for(k=Object.getOwnPropertySymbols(m);r<k.length;r++)0>t.indexOf(k[r])&&Object.prototype.propertyIsEnumerable.call(m,k[r])&&(p[k[r]]=m[k[r]])}null===(e=c.value)||void 0===e?void 0:e.setOptions(p);void 0!==b&&b!==f&&(null===(h=c.value)||void 0===h?void 0:h.setZoom(b));!a||d&&a.lng===d.lng&&a.lat===d.lat||(null===(l=c.value)||void 0===l?void 0:l.panTo(a))})});return{mapRef:e,ready:d,map:c,api:f}}}); | ||
let E={ref:"mapRef"};D.render=function(a){return openBlock(),createBlock("div",E,[renderSlot(a.$slots,"default")],512)};D.__file="src/components/GoogleMap.vue"; | ||
let F=(a,b,e,d)=>{let c=null;const f=ref(null),g=inject(x,ref(null)),h=inject(w,ref(null));watch([g,e],(t,p,v)=>{g.value&&h.value&&(f.value=c=new h.value[a](Object.assign(Object.assign({},e.value),{map:g.value})),b.forEach(a=>{null===c||void 0===c?void 0:c.addListener(a,b=>d(a,b))}));v(()=>{var a;c&&(null===(a=h.value)||void 0===a?void 0:a.event.clearInstanceListeners(c),c.setMap(null))})});return{component:f}}; | ||
var G=defineComponent({props:{options:{type:Object,required:!0}},emits:z,setup(a,{emit:b}){a=toRef(a,"options");return{marker:F("Marker",z,a,b)}},render:()=>null}),H=defineComponent({props:{options:{type:Object,required:!0}},emits:A,setup(a,{emit:b}){a=toRef(a,"options");return{polyline:F("Polyline",A,a,b)}},render:()=>null}),I=defineComponent({props:{options:{type:Object,required:!0}},emits:A,setup(a,{emit:b}){a=toRef(a,"options");return{polygon:F("Polygon",A,a,b)}},render:()=>null}),J=defineComponent({props:{options:{type:Object, | ||
required:!0}},emits:B,setup(a,{emit:b}){a=toRef(a,"options");return{rectangle:F("Rectangle",B,a,b)}},render:()=>null}),K=defineComponent({props:{options:{type:Object,required:!0}},emits:C,setup(a,{emit:b}){a=toRef(a,"options");return{circle:F("Circle",C,a,b)}},render:()=>null}),L=defineComponent({props:{position:{type:String,required:!0},index:Number},setup(a){let b=ref(null),e=inject(x,ref(null)),d=inject(w,ref(null));watch([e,()=>a.position,()=>a.index],(c,f,g)=>{e.value&&d.value&&(a.index&&(b.value.index= | ||
a.index),b.value&&e.value.controls[d.value.ControlPosition[a.position]].push(b.value));g(()=>{if(e.value&&d.value&&b.value){let a=void 0;e.value.controls[d.value.ControlPosition[f[1]]].forEach((c,d)=>{c===b.value&&(a=d)});a&&e.value.controls[d.value.ControlPosition[f[1]]].removeAt(a)}})});return{controlRef:b}}});let M={ref:"controlRef"};L.render=function(a){return openBlock(),createBlock("div",M,[renderSlot(a.$slots,"default")],512)};L.__file="src/components/CustomControl.vue"; | ||
export{K as Circle,L as CustomControl,D as GoogleMap,G as Marker,I as Polygon,H as Polyline,J as Rectangle} | ||
D.render=function(a){return openBlock(),createBlock("div",null,[createVNode("div",mergeProps(a.$attrs,{ref:"mapRef"}),null,16),renderSlot(a.$slots,"default")])};D.__file="src/components/GoogleMap.vue"; | ||
let E=(a,b,e,d)=>{let c=null;const f=ref(null),g=inject(x,ref(null)),h=inject(w,ref(null));watch([g,e],(t,p,v)=>{g.value&&h.value&&(f.value=c=new h.value[a](Object.assign(Object.assign({},e.value),{map:g.value})),b.forEach(a=>{null===c||void 0===c?void 0:c.addListener(a,b=>d(a,b))}));v(()=>{var a;c&&(null===(a=h.value)||void 0===a?void 0:a.event.clearInstanceListeners(c),c.setMap(null))})},{immediate:!0});return{component:f}}; | ||
var F=defineComponent({props:{options:{type:Object,required:!0}},emits:z,setup(a,{emit:b}){a=toRef(a,"options");return{marker:E("Marker",z,a,b)}},render:()=>null}),G=defineComponent({props:{options:{type:Object,required:!0}},emits:A,setup(a,{emit:b}){a=toRef(a,"options");return{polyline:E("Polyline",A,a,b)}},render:()=>null}),H=defineComponent({props:{options:{type:Object,required:!0}},emits:A,setup(a,{emit:b}){a=toRef(a,"options");return{polygon:E("Polygon",A,a,b)}},render:()=>null}),I=defineComponent({props:{options:{type:Object, | ||
required:!0}},emits:B,setup(a,{emit:b}){a=toRef(a,"options");return{rectangle:E("Rectangle",B,a,b)}},render:()=>null}),J=defineComponent({props:{options:{type:Object,required:!0}},emits:C,setup(a,{emit:b}){a=toRef(a,"options");return{circle:E("Circle",C,a,b)}},render:()=>null}),K=defineComponent({props:{position:{type:String,required:!0},index:Number},setup(a){let b=ref(null),e=inject(x,ref(null)),d=inject(w,ref(null));watch([e,()=>a.position,()=>a.index],(c,[,f],g)=>{e.value&&d.value&&(a.index&& | ||
(b.value.index=a.index),b.value&&e.value.controls[d.value.ControlPosition[a.position]].push(b.value));g(()=>{if(e.value&&d.value&&f){let a=void 0;e.value.controls[d.value.ControlPosition[f]].forEach((c,d)=>{c===b.value&&(a=d)});a&&e.value.controls[d.value.ControlPosition[f]].removeAt(a)}})},{immediate:!0});return{controlRef:b}}});let L={ref:"controlRef"};K.render=function(a){return openBlock(),createBlock("div",L,[renderSlot(a.$slots,"default")],512)};K.__file="src/components/CustomControl.vue"; | ||
export{J as Circle,K as CustomControl,D as GoogleMap,F as Marker,H as Polygon,G as Polyline,I as Rectangle} |
@@ -22,4 +22,6 @@ import { watch, ref, inject } from 'vue'; | ||
}); | ||
}, { | ||
immediate: true, | ||
}); | ||
return { component }; | ||
}; |
{ | ||
"name": "vue3-google-map", | ||
"version": "0.5.1", | ||
"version": "0.5.2", | ||
"license": "MIT", | ||
@@ -5,0 +5,0 @@ "repository": { |
83978
1919