@biodiv-platform/naksha-gmaps-view 4.4.8 → 4.4.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/esm/index.js +1 -0
- package/dist/index.d.ts +14 -0
- package/dist/index.js +1 -0
- package/package.json +1 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
var y=Object.defineProperty;var u=Object.getOwnPropertySymbols;var b=Object.prototype.hasOwnProperty,x=Object.prototype.propertyIsEnumerable;var d=(o,t,e)=>t in o?y(o,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):o[t]=e,p=(o,t)=>{for(var e in t||(t={}))b.call(t,e)&&d(o,e,t[e]);if(u)for(var e of u(t))x.call(t,e)&&d(o,e,t[e]);return o};import{GMAPS_LIBRARIES as N,mapboxToGmapsViewState as R}from"@biodiv-platform/naksha-commons";import{GoogleMap as O,LoadScriptNext as T}from"@react-google-maps/api";import{useEffect as k,useRef as I,useState as S}from"react";var f={mapTypeControlOptions:{position:10}};import M from"@turf/bbox";var l=o=>{let t=M(o);return{east:t[2],north:t[3],south:t[1],west:t[0]}};import{jsx as g}from"react/jsx-runtime";function D({defaultViewState:o,gmapAccessToken:t,gmapRegion:e,features:r,mapStyle:h,maxZoom:i,options:G}){let a=I(null),[c]=S(R(o)),[m,w]=S(),A=()=>{a.current.state.map.data.forEach(function(s){a.current.state.map.data.remove(s)});let n=Array.isArray(r)?{type:"FeatureCollection",features:r}:r;if(n){n&&a.current.state.map.data.addGeoJson(n);let s=l(n);s&&a.current.state.map.fitBounds(s),i&&google.maps.event.addListenerOnce(a.current.state.map,"idle",function(){let P=a.current.state.map.getZoom();a.current.state.map.setZoom(Math.min(i,P))})}};k(()=>{m&&A()},[m,r]);let L=()=>w(!0);return g(T,{googleMapsApiKey:t,region:e,libraries:N.DEFAULT,children:g(O,{id:"naksha-gmaps-view",mapContainerStyle:h||{height:"100%",width:"100%"},zoom:c.zoom,center:c.center,options:p(p({},f),G||{}),ref:a,onLoad:L})})}export{D as NakshaGmapsView};
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
|
|
3
|
+
interface NakshaGmapsViewProps {
|
|
4
|
+
defaultViewState?: any;
|
|
5
|
+
features?: any;
|
|
6
|
+
gmapAccessToken?: any;
|
|
7
|
+
gmapRegion?: any;
|
|
8
|
+
mapStyle?: React.CSSProperties;
|
|
9
|
+
maxZoom?: any;
|
|
10
|
+
options?: any;
|
|
11
|
+
}
|
|
12
|
+
declare function NakshaGmapsView({ defaultViewState, gmapAccessToken, gmapRegion, features, mapStyle, maxZoom, options, }: NakshaGmapsViewProps): JSX.Element;
|
|
13
|
+
|
|
14
|
+
export { NakshaGmapsView, NakshaGmapsViewProps };
|
package/dist/index.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";var O=Object.create;var p=Object.defineProperty;var T=Object.getOwnPropertyDescriptor;var k=Object.getOwnPropertyNames,h=Object.getOwnPropertySymbols,I=Object.getPrototypeOf,w=Object.prototype.hasOwnProperty,V=Object.prototype.propertyIsEnumerable;var G=(e,t,o)=>t in e?p(e,t,{enumerable:!0,configurable:!0,writable:!0,value:o}):e[t]=o,d=(e,t)=>{for(var o in t||(t={}))w.call(t,o)&&G(e,o,t[o]);if(h)for(var o of h(t))V.call(t,o)&&G(e,o,t[o]);return e};var v=(e,t)=>{for(var o in t)p(e,o,{get:t[o],enumerable:!0})},A=(e,t,o,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let n of k(t))!w.call(e,n)&&n!==o&&p(e,n,{get:()=>t[n],enumerable:!(r=T(t,n))||r.enumerable});return e};var B=(e,t,o)=>(o=e!=null?O(I(e)):{},A(t||!e||!e.__esModule?p(o,"default",{value:e,enumerable:!0}):o,e)),C=e=>A(p({},"__esModule",{value:!0}),e);var z={};v(z,{NakshaGmapsView:()=>E});module.exports=C(z);var m=require("@biodiv-platform/naksha-commons"),u=require("@react-google-maps/api"),s=require("react");var L={mapTypeControlOptions:{position:10}};var P=B(require("@turf/bbox")),y=e=>{let t=(0,P.default)(e);return{east:t[2],north:t[3],south:t[1],west:t[0]}};var f=require("react/jsx-runtime");function E({defaultViewState:e,gmapAccessToken:t,gmapRegion:o,features:r,mapStyle:n,maxZoom:l,options:b}){let a=(0,s.useRef)(null),[S]=(0,s.useState)((0,m.mapboxToGmapsViewState)(e)),[g,x]=(0,s.useState)(),M=()=>{a.current.state.map.data.forEach(function(c){a.current.state.map.data.remove(c)});let i=Array.isArray(r)?{type:"FeatureCollection",features:r}:r;if(i){i&&a.current.state.map.data.addGeoJson(i);let c=y(i);c&&a.current.state.map.fitBounds(c),l&&google.maps.event.addListenerOnce(a.current.state.map,"idle",function(){let R=a.current.state.map.getZoom();a.current.state.map.setZoom(Math.min(l,R))})}};(0,s.useEffect)(()=>{g&&M()},[g,r]);let N=()=>x(!0);return(0,f.jsx)(u.LoadScriptNext,{googleMapsApiKey:t,region:o,libraries:m.GMAPS_LIBRARIES.DEFAULT,children:(0,f.jsx)(u.GoogleMap,{id:"naksha-gmaps-view",mapContainerStyle:n||{height:"100%",width:"100%"},zoom:S.zoom,center:S.center,options:d(d({},L),b||{}),ref:a,onLoad:N})})}0&&(module.exports={NakshaGmapsView});
|