react-leaflet
Advanced tools
Comparing version 3.2.2 to 3.2.3
@@ -10,7 +10,8 @@ "use strict"; | ||
const Circle = (0, _core.createPathComponent)(function createCircle({ | ||
center, | ||
children: _c, | ||
...options | ||
}, ctx) { | ||
const Circle = (0, _core.createPathComponent)(function createCircle(_ref, ctx) { | ||
let { | ||
center, | ||
children: _c, | ||
...options | ||
} = _ref; | ||
const instance = new _leaflet.Circle(center, options); | ||
@@ -17,0 +18,0 @@ return { |
@@ -10,7 +10,8 @@ "use strict"; | ||
const CircleMarker = (0, _core.createPathComponent)(function createCircleMarker({ | ||
center, | ||
children: _c, | ||
...options | ||
}, ctx) { | ||
const CircleMarker = (0, _core.createPathComponent)(function createCircleMarker(_ref, ctx) { | ||
let { | ||
center, | ||
children: _c, | ||
...options | ||
} = _ref; | ||
const instance = new _leaflet.CircleMarker(center, options); | ||
@@ -17,0 +18,0 @@ return { |
@@ -10,6 +10,7 @@ "use strict"; | ||
const FeatureGroup = (0, _core.createPathComponent)(function createFeatureGroup({ | ||
children: _c, | ||
...options | ||
}, ctx) { | ||
const FeatureGroup = (0, _core.createPathComponent)(function createFeatureGroup(_ref, ctx) { | ||
let { | ||
children: _c, | ||
...options | ||
} = _ref; | ||
const instance = new _leaflet.FeatureGroup([], options); | ||
@@ -16,0 +17,0 @@ const context = { ...ctx, |
@@ -10,6 +10,7 @@ "use strict"; | ||
const GeoJSON = (0, _core.createPathComponent)(function createGeoJSON({ | ||
data, | ||
...options | ||
}, ctx) { | ||
const GeoJSON = (0, _core.createPathComponent)(function createGeoJSON(_ref, ctx) { | ||
let { | ||
data, | ||
...options | ||
} = _ref; | ||
const instance = new _leaflet.GeoJSON(data, options); | ||
@@ -16,0 +17,0 @@ return { |
@@ -10,7 +10,8 @@ "use strict"; | ||
const ImageOverlay = (0, _core.createLayerComponent)(function createImageOveraly({ | ||
bounds, | ||
url, | ||
...options | ||
}, ctx) { | ||
const ImageOverlay = (0, _core.createLayerComponent)(function createImageOveraly(_ref, ctx) { | ||
let { | ||
bounds, | ||
url, | ||
...options | ||
} = _ref; | ||
const instance = new _leaflet.ImageOverlay(url, bounds, options); | ||
@@ -17,0 +18,0 @@ return { |
@@ -10,6 +10,7 @@ "use strict"; | ||
const LayerGroup = (0, _core.createLayerComponent)(function createLayerGroup({ | ||
children: _c, | ||
...options | ||
}, ctx) { | ||
const LayerGroup = (0, _core.createLayerComponent)(function createLayerGroup(_ref, ctx) { | ||
let { | ||
children: _c, | ||
...options | ||
} = _ref; | ||
const instance = new _leaflet.LayerGroup([], options); | ||
@@ -16,0 +17,0 @@ return { |
@@ -18,6 +18,7 @@ "use strict"; | ||
const useLayersControlElement = (0, _core.createElementHook)(function createLayersControl({ | ||
children: _c, | ||
...options | ||
}, ctx) { | ||
const useLayersControlElement = (0, _core.createElementHook)(function createLayersControl(_ref, ctx) { | ||
let { | ||
children: _c, | ||
...options | ||
} = _ref; | ||
const instance = new _leaflet.Control.Layers(undefined, undefined, options); | ||
@@ -24,0 +25,0 @@ return { |
@@ -8,6 +8,7 @@ "use strict"; | ||
function MapConsumer({ | ||
children | ||
}) { | ||
function MapConsumer(_ref) { | ||
let { | ||
children | ||
} = _ref; | ||
return children((0, _hooks.useMap)()); | ||
} |
@@ -41,11 +41,12 @@ "use strict"; | ||
function MapContainer({ | ||
children, | ||
className, | ||
id, | ||
placeholder, | ||
style, | ||
whenCreated, | ||
...options | ||
}) { | ||
function MapContainer(_ref) { | ||
let { | ||
children, | ||
className, | ||
id, | ||
placeholder, | ||
style, | ||
whenCreated, | ||
...options | ||
} = _ref; | ||
const mapRef = (0, _react.useRef)(null); | ||
@@ -52,0 +53,0 @@ const map = useMapElement(mapRef, options); |
@@ -10,6 +10,7 @@ "use strict"; | ||
const Marker = (0, _core.createLayerComponent)(function createMarker({ | ||
position, | ||
...options | ||
}, ctx) { | ||
const Marker = (0, _core.createLayerComponent)(function createMarker(_ref, ctx) { | ||
let { | ||
position, | ||
...options | ||
} = _ref; | ||
const instance = new _leaflet.Marker(position, options); | ||
@@ -16,0 +17,0 @@ return { |
@@ -10,6 +10,7 @@ "use strict"; | ||
const Polygon = (0, _core.createPathComponent)(function createPolygon({ | ||
positions, | ||
...options | ||
}, ctx) { | ||
const Polygon = (0, _core.createPathComponent)(function createPolygon(_ref, ctx) { | ||
let { | ||
positions, | ||
...options | ||
} = _ref; | ||
const instance = new _leaflet.Polygon(positions, options); | ||
@@ -16,0 +17,0 @@ return { |
@@ -10,6 +10,7 @@ "use strict"; | ||
const Polyline = (0, _core.createPathComponent)(function createPolyline({ | ||
positions, | ||
...options | ||
}, ctx) { | ||
const Polyline = (0, _core.createPathComponent)(function createPolyline(_ref, ctx) { | ||
let { | ||
positions, | ||
...options | ||
} = _ref; | ||
const instance = new _leaflet.Polyline(positions, options); | ||
@@ -16,0 +17,0 @@ return { |
@@ -10,6 +10,7 @@ "use strict"; | ||
const Rectangle = (0, _core.createPathComponent)(function createRectangle({ | ||
bounds, | ||
...options | ||
}, ctx) { | ||
const Rectangle = (0, _core.createPathComponent)(function createRectangle(_ref, ctx) { | ||
let { | ||
bounds, | ||
...options | ||
} = _ref; | ||
const instance = new _leaflet.Rectangle(bounds, options); | ||
@@ -16,0 +17,0 @@ return { |
@@ -39,6 +39,7 @@ "use strict"; | ||
function SVGOverlayComponent({ | ||
children, | ||
...options | ||
}, ref) { | ||
function SVGOverlayComponent(_ref, ref) { | ||
let { | ||
children, | ||
...options | ||
} = _ref; | ||
const { | ||
@@ -45,0 +46,0 @@ instance, |
@@ -10,6 +10,7 @@ "use strict"; | ||
const TileLayer = (0, _core.createTileLayerComponent)(function createTileLayer({ | ||
url, | ||
...options | ||
}, context) { | ||
const TileLayer = (0, _core.createTileLayerComponent)(function createTileLayer(_ref, context) { | ||
let { | ||
url, | ||
...options | ||
} = _ref; | ||
return { | ||
@@ -16,0 +17,0 @@ instance: new _leaflet.TileLayer(url, (0, _core.withPane)(options, context)), |
@@ -20,3 +20,4 @@ "use strict"; | ||
onClose, | ||
onOpen | ||
onOpen, | ||
position | ||
} = props; | ||
@@ -36,2 +37,6 @@ (0, _react.useEffect)(function addTooltip() { | ||
if (event.tooltip === instance) { | ||
if (position) { | ||
instance.setLatLng(position); | ||
} | ||
instance.update(); | ||
@@ -65,4 +70,4 @@ setOpen(true); | ||
}; | ||
}, [element, context, setOpen, onClose, onOpen]); | ||
}, [element, context, setOpen, onClose, onOpen, position]); | ||
}); | ||
exports.Tooltip = Tooltip; |
@@ -10,7 +10,8 @@ "use strict"; | ||
const VideoOverlay = (0, _core.createLayerComponent)(function createVideoOverlay({ | ||
bounds, | ||
url, | ||
...options | ||
}, ctx) { | ||
const VideoOverlay = (0, _core.createLayerComponent)(function createVideoOverlay(_ref, ctx) { | ||
let { | ||
bounds, | ||
url, | ||
...options | ||
} = _ref; | ||
const instance = new _leaflet.VideoOverlay(url, bounds, options); | ||
@@ -17,0 +18,0 @@ |
@@ -10,7 +10,8 @@ "use strict"; | ||
const WMSTileLayer = (0, _core.createTileLayerComponent)(function createWMSTileLayer({ | ||
params = {}, | ||
url, | ||
...options | ||
}, context) { | ||
const WMSTileLayer = (0, _core.createTileLayerComponent)(function createWMSTileLayer(_ref, context) { | ||
let { | ||
params = {}, | ||
url, | ||
...options | ||
} = _ref; | ||
return { | ||
@@ -17,0 +18,0 @@ instance: new _leaflet.TileLayer.WMS(url, { ...params, |
import { createPathComponent, updateCircle } from '@react-leaflet/core'; | ||
import { Circle as LeafletCircle } from 'leaflet'; | ||
export const Circle = createPathComponent(function createCircle({ | ||
center, | ||
children: _c, | ||
...options | ||
}, ctx) { | ||
export const Circle = createPathComponent(function createCircle(_ref, ctx) { | ||
let { | ||
center, | ||
children: _c, | ||
...options | ||
} = _ref; | ||
const instance = new LeafletCircle(center, options); | ||
@@ -9,0 +10,0 @@ return { |
import { createPathComponent, updateCircle } from '@react-leaflet/core'; | ||
import { CircleMarker as LeafletCircleMarker } from 'leaflet'; | ||
export const CircleMarker = createPathComponent(function createCircleMarker({ | ||
center, | ||
children: _c, | ||
...options | ||
}, ctx) { | ||
export const CircleMarker = createPathComponent(function createCircleMarker(_ref, ctx) { | ||
let { | ||
center, | ||
children: _c, | ||
...options | ||
} = _ref; | ||
const instance = new LeafletCircleMarker(center, options); | ||
@@ -9,0 +10,0 @@ return { |
import { createPathComponent } from '@react-leaflet/core'; | ||
import { FeatureGroup as LeafletFeatureGroup } from 'leaflet'; | ||
export const FeatureGroup = createPathComponent(function createFeatureGroup({ | ||
children: _c, | ||
...options | ||
}, ctx) { | ||
export const FeatureGroup = createPathComponent(function createFeatureGroup(_ref, ctx) { | ||
let { | ||
children: _c, | ||
...options | ||
} = _ref; | ||
const instance = new LeafletFeatureGroup([], options); | ||
@@ -8,0 +9,0 @@ const context = { ...ctx, |
import { createPathComponent } from '@react-leaflet/core'; | ||
import { GeoJSON as LeafletGeoJSON } from 'leaflet'; | ||
export const GeoJSON = createPathComponent(function createGeoJSON({ | ||
data, | ||
...options | ||
}, ctx) { | ||
export const GeoJSON = createPathComponent(function createGeoJSON(_ref, ctx) { | ||
let { | ||
data, | ||
...options | ||
} = _ref; | ||
const instance = new LeafletGeoJSON(data, options); | ||
@@ -8,0 +9,0 @@ return { |
import { createLayerComponent, updateMediaOverlay } from '@react-leaflet/core'; | ||
import { ImageOverlay as LeafletImageOverlay } from 'leaflet'; | ||
export const ImageOverlay = createLayerComponent(function createImageOveraly({ | ||
bounds, | ||
url, | ||
...options | ||
}, ctx) { | ||
export const ImageOverlay = createLayerComponent(function createImageOveraly(_ref, ctx) { | ||
let { | ||
bounds, | ||
url, | ||
...options | ||
} = _ref; | ||
const instance = new LeafletImageOverlay(url, bounds, options); | ||
@@ -9,0 +10,0 @@ return { |
import { createLayerComponent } from '@react-leaflet/core'; | ||
import { LayerGroup as LeafletLayerGroup } from 'leaflet'; | ||
export const LayerGroup = createLayerComponent(function createLayerGroup({ | ||
children: _c, | ||
...options | ||
}, ctx) { | ||
export const LayerGroup = createLayerComponent(function createLayerGroup(_ref, ctx) { | ||
let { | ||
children: _c, | ||
...options | ||
} = _ref; | ||
const instance = new LeafletLayerGroup([], options); | ||
@@ -8,0 +9,0 @@ return { |
import { LeafletProvider, createContainerComponent, createControlHook, createElementHook, useLeafletContext } from '@react-leaflet/core'; | ||
import { Control } from 'leaflet'; | ||
import React, { useCallback, useEffect, useMemo, useRef, useState } from 'react'; | ||
export const useLayersControlElement = createElementHook(function createLayersControl({ | ||
children: _c, | ||
...options | ||
}, ctx) { | ||
export const useLayersControlElement = createElementHook(function createLayersControl(_ref, ctx) { | ||
let { | ||
children: _c, | ||
...options | ||
} = _ref; | ||
const instance = new Control.Layers(undefined, undefined, options); | ||
@@ -9,0 +10,0 @@ return { |
import { useMap } from './hooks'; | ||
export function MapConsumer({ | ||
children | ||
}) { | ||
export function MapConsumer(_ref) { | ||
let { | ||
children | ||
} = _ref; | ||
return children(useMap()); | ||
} |
@@ -27,11 +27,12 @@ function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); } | ||
} | ||
export function MapContainer({ | ||
children, | ||
className, | ||
id, | ||
placeholder, | ||
style, | ||
whenCreated, | ||
...options | ||
}) { | ||
export function MapContainer(_ref) { | ||
let { | ||
children, | ||
className, | ||
id, | ||
placeholder, | ||
style, | ||
whenCreated, | ||
...options | ||
} = _ref; | ||
const mapRef = useRef(null); | ||
@@ -38,0 +39,0 @@ const map = useMapElement(mapRef, options); |
import { createLayerComponent } from '@react-leaflet/core'; | ||
import { Marker as LeafletMarker } from 'leaflet'; | ||
export const Marker = createLayerComponent(function createMarker({ | ||
position, | ||
...options | ||
}, ctx) { | ||
export const Marker = createLayerComponent(function createMarker(_ref, ctx) { | ||
let { | ||
position, | ||
...options | ||
} = _ref; | ||
const instance = new LeafletMarker(position, options); | ||
@@ -8,0 +9,0 @@ return { |
import { createPathComponent } from '@react-leaflet/core'; | ||
import { Polygon as LeafletPolygon } from 'leaflet'; | ||
export const Polygon = createPathComponent(function createPolygon({ | ||
positions, | ||
...options | ||
}, ctx) { | ||
export const Polygon = createPathComponent(function createPolygon(_ref, ctx) { | ||
let { | ||
positions, | ||
...options | ||
} = _ref; | ||
const instance = new LeafletPolygon(positions, options); | ||
@@ -8,0 +9,0 @@ return { |
import { createPathComponent } from '@react-leaflet/core'; | ||
import { Polyline as LeafletPolyline } from 'leaflet'; | ||
export const Polyline = createPathComponent(function createPolyline({ | ||
positions, | ||
...options | ||
}, ctx) { | ||
export const Polyline = createPathComponent(function createPolyline(_ref, ctx) { | ||
let { | ||
positions, | ||
...options | ||
} = _ref; | ||
const instance = new LeafletPolyline(positions, options); | ||
@@ -8,0 +9,0 @@ return { |
import { createPathComponent } from '@react-leaflet/core'; | ||
import { Rectangle as LeafletRectangle } from 'leaflet'; | ||
export const Rectangle = createPathComponent(function createRectangle({ | ||
bounds, | ||
...options | ||
}, ctx) { | ||
export const Rectangle = createPathComponent(function createRectangle(_ref, ctx) { | ||
let { | ||
bounds, | ||
...options | ||
} = _ref; | ||
const instance = new LeafletRectangle(bounds, options); | ||
@@ -8,0 +9,0 @@ return { |
@@ -28,6 +28,7 @@ import { createElementHook, createLayerHook, updateMediaOverlay } from '@react-leaflet/core'; | ||
function SVGOverlayComponent({ | ||
children, | ||
...options | ||
}, ref) { | ||
function SVGOverlayComponent(_ref, ref) { | ||
let { | ||
children, | ||
...options | ||
} = _ref; | ||
const { | ||
@@ -34,0 +35,0 @@ instance, |
import { createTileLayerComponent, updateGridLayer, withPane } from '@react-leaflet/core'; | ||
import { TileLayer as LeafletTileLayer } from 'leaflet'; | ||
export const TileLayer = createTileLayerComponent(function createTileLayer({ | ||
url, | ||
...options | ||
}, context) { | ||
export const TileLayer = createTileLayerComponent(function createTileLayer(_ref, context) { | ||
let { | ||
url, | ||
...options | ||
} = _ref; | ||
return { | ||
@@ -8,0 +9,0 @@ instance: new LeafletTileLayer(url, withPane(options, context)), |
@@ -12,3 +12,4 @@ import { createOverlayComponent } from '@react-leaflet/core'; | ||
onClose, | ||
onOpen | ||
onOpen, | ||
position | ||
} = props; | ||
@@ -28,2 +29,6 @@ useEffect(function addTooltip() { | ||
if (event.tooltip === instance) { | ||
if (position) { | ||
instance.setLatLng(position); | ||
} | ||
instance.update(); | ||
@@ -57,3 +62,3 @@ setOpen(true); | ||
}; | ||
}, [element, context, setOpen, onClose, onOpen]); | ||
}, [element, context, setOpen, onClose, onOpen, position]); | ||
}); |
import { createLayerComponent, updateMediaOverlay } from '@react-leaflet/core'; | ||
import { VideoOverlay as LeafletVideoOverlay } from 'leaflet'; | ||
export const VideoOverlay = createLayerComponent(function createVideoOverlay({ | ||
bounds, | ||
url, | ||
...options | ||
}, ctx) { | ||
export const VideoOverlay = createLayerComponent(function createVideoOverlay(_ref, ctx) { | ||
let { | ||
bounds, | ||
url, | ||
...options | ||
} = _ref; | ||
const instance = new LeafletVideoOverlay(url, bounds, options); | ||
@@ -9,0 +10,0 @@ |
import { createTileLayerComponent, updateGridLayer, withPane } from '@react-leaflet/core'; | ||
import { TileLayer } from 'leaflet'; | ||
export const WMSTileLayer = createTileLayerComponent(function createWMSTileLayer({ | ||
params = {}, | ||
url, | ||
...options | ||
}, context) { | ||
export const WMSTileLayer = createTileLayerComponent(function createWMSTileLayer(_ref, context) { | ||
let { | ||
params = {}, | ||
url, | ||
...options | ||
} = _ref; | ||
return { | ||
@@ -9,0 +10,0 @@ instance: new TileLayer.WMS(url, { ...params, |
{ | ||
"name": "react-leaflet", | ||
"version": "3.2.2", | ||
"version": "3.2.3", | ||
"description": "React components for Leaflet maps", | ||
@@ -55,6 +55,6 @@ "main": "cjs/index.js", | ||
"@rollup/plugin-babel": "^5.3.0", | ||
"@rollup/plugin-commonjs": "^21.0.0", | ||
"@rollup/plugin-node-resolve": "^13.0.5", | ||
"@rollup/plugin-replace": "^3.0.0", | ||
"rollup": "^2.58.0", | ||
"@rollup/plugin-commonjs": "^21.0.1", | ||
"@rollup/plugin-node-resolve": "^13.1.3", | ||
"@rollup/plugin-replace": "^3.0.1", | ||
"rollup": "^2.63.0", | ||
"rollup-plugin-terser": "^7.0.0" | ||
@@ -61,0 +61,0 @@ }, |
@@ -6,2 +6,2 @@ import { Map } from 'leaflet'; | ||
} | ||
export declare function MapConsumer({ children }: MapConsumerProps): ReactElement<any, string | import("react").JSXElementConstructor<any>> | null; | ||
export declare function MapConsumer({ children }: MapConsumerProps): ReactElement<any, string | ((props: any) => ReactElement<any, any> | null) | (new (props: any) => import("react").Component<any, any, any>)> | null; |
@@ -329,7 +329,8 @@ (function (global, factory) { | ||
const Circle = createPathComponent(function createCircle({ | ||
center, | ||
children: _c, | ||
...options | ||
}, ctx) { | ||
const Circle = createPathComponent(function createCircle(_ref, ctx) { | ||
let { | ||
center, | ||
children: _c, | ||
...options | ||
} = _ref; | ||
const instance = new leaflet.Circle(center, options); | ||
@@ -344,7 +345,8 @@ return { | ||
const CircleMarker = createPathComponent(function createCircleMarker({ | ||
center, | ||
children: _c, | ||
...options | ||
}, ctx) { | ||
const CircleMarker = createPathComponent(function createCircleMarker(_ref, ctx) { | ||
let { | ||
center, | ||
children: _c, | ||
...options | ||
} = _ref; | ||
const instance = new leaflet.CircleMarker(center, options); | ||
@@ -359,6 +361,7 @@ return { | ||
const FeatureGroup = createPathComponent(function createFeatureGroup({ | ||
children: _c, | ||
...options | ||
}, ctx) { | ||
const FeatureGroup = createPathComponent(function createFeatureGroup(_ref, ctx) { | ||
let { | ||
children: _c, | ||
...options | ||
} = _ref; | ||
const instance = new leaflet.FeatureGroup([], options); | ||
@@ -375,6 +378,7 @@ const context = { ...ctx, | ||
const GeoJSON = createPathComponent(function createGeoJSON({ | ||
data, | ||
...options | ||
}, ctx) { | ||
const GeoJSON = createPathComponent(function createGeoJSON(_ref, ctx) { | ||
let { | ||
data, | ||
...options | ||
} = _ref; | ||
const instance = new leaflet.GeoJSON(data, options); | ||
@@ -397,7 +401,8 @@ return { | ||
const ImageOverlay = createLayerComponent(function createImageOveraly({ | ||
bounds, | ||
url, | ||
...options | ||
}, ctx) { | ||
const ImageOverlay = createLayerComponent(function createImageOveraly(_ref, ctx) { | ||
let { | ||
bounds, | ||
url, | ||
...options | ||
} = _ref; | ||
const instance = new leaflet.ImageOverlay(url, bounds, options); | ||
@@ -418,6 +423,7 @@ return { | ||
const LayerGroup = createLayerComponent(function createLayerGroup({ | ||
children: _c, | ||
...options | ||
}, ctx) { | ||
const LayerGroup = createLayerComponent(function createLayerGroup(_ref, ctx) { | ||
let { | ||
children: _c, | ||
...options | ||
} = _ref; | ||
const instance = new leaflet.LayerGroup([], options); | ||
@@ -432,6 +438,7 @@ return { | ||
const useLayersControlElement = createElementHook(function createLayersControl({ | ||
children: _c, | ||
...options | ||
}, ctx) { | ||
const useLayersControlElement = createElementHook(function createLayersControl(_ref, ctx) { | ||
let { | ||
children: _c, | ||
...options | ||
} = _ref; | ||
const instance = new leaflet.Control.Layers(undefined, undefined, options); | ||
@@ -508,5 +515,6 @@ return { | ||
function MapConsumer({ | ||
children | ||
}) { | ||
function MapConsumer(_ref) { | ||
let { | ||
children | ||
} = _ref; | ||
return children(useMap()); | ||
@@ -554,11 +562,12 @@ } | ||
} | ||
function MapContainer({ | ||
children, | ||
className, | ||
id, | ||
placeholder, | ||
style, | ||
whenCreated, | ||
...options | ||
}) { | ||
function MapContainer(_ref) { | ||
let { | ||
children, | ||
className, | ||
id, | ||
placeholder, | ||
style, | ||
whenCreated, | ||
...options | ||
} = _ref; | ||
const mapRef = React.useRef(null); | ||
@@ -590,6 +599,7 @@ const map = useMapElement(mapRef, options); | ||
const Marker = createLayerComponent(function createMarker({ | ||
position, | ||
...options | ||
}, ctx) { | ||
const Marker = createLayerComponent(function createMarker(_ref, ctx) { | ||
let { | ||
position, | ||
...options | ||
} = _ref; | ||
const instance = new leaflet.Marker(position, options); | ||
@@ -693,6 +703,7 @@ return { | ||
const Polygon = createPathComponent(function createPolygon({ | ||
positions, | ||
...options | ||
}, ctx) { | ||
const Polygon = createPathComponent(function createPolygon(_ref, ctx) { | ||
let { | ||
positions, | ||
...options | ||
} = _ref; | ||
const instance = new leaflet.Polygon(positions, options); | ||
@@ -711,6 +722,7 @@ return { | ||
const Polyline = createPathComponent(function createPolyline({ | ||
positions, | ||
...options | ||
}, ctx) { | ||
const Polyline = createPathComponent(function createPolyline(_ref, ctx) { | ||
let { | ||
positions, | ||
...options | ||
} = _ref; | ||
const instance = new leaflet.Polyline(positions, options); | ||
@@ -790,6 +802,7 @@ return { | ||
const Rectangle = createPathComponent(function createRectangle({ | ||
bounds, | ||
...options | ||
}, ctx) { | ||
const Rectangle = createPathComponent(function createRectangle(_ref, ctx) { | ||
let { | ||
bounds, | ||
...options | ||
} = _ref; | ||
const instance = new leaflet.Rectangle(bounds, options); | ||
@@ -835,6 +848,7 @@ return { | ||
function SVGOverlayComponent({ | ||
children, | ||
...options | ||
}, ref) { | ||
function SVGOverlayComponent(_ref, ref) { | ||
let { | ||
children, | ||
...options | ||
} = _ref; | ||
const { | ||
@@ -850,6 +864,7 @@ instance, | ||
const TileLayer = createTileLayerComponent(function createTileLayer({ | ||
url, | ||
...options | ||
}, context) { | ||
const TileLayer = createTileLayerComponent(function createTileLayer(_ref, context) { | ||
let { | ||
url, | ||
...options | ||
} = _ref; | ||
return { | ||
@@ -869,3 +884,4 @@ instance: new leaflet.TileLayer(url, withPane(options, context)), | ||
onClose, | ||
onOpen | ||
onOpen, | ||
position | ||
} = props; | ||
@@ -885,2 +901,6 @@ React.useEffect(function addTooltip() { | ||
if (event.tooltip === instance) { | ||
if (position) { | ||
instance.setLatLng(position); | ||
} | ||
instance.update(); | ||
@@ -914,10 +934,11 @@ setOpen(true); | ||
}; | ||
}, [element, context, setOpen, onClose, onOpen]); | ||
}, [element, context, setOpen, onClose, onOpen, position]); | ||
}); | ||
const VideoOverlay = createLayerComponent(function createVideoOverlay({ | ||
bounds, | ||
url, | ||
...options | ||
}, ctx) { | ||
const VideoOverlay = createLayerComponent(function createVideoOverlay(_ref, ctx) { | ||
let { | ||
bounds, | ||
url, | ||
...options | ||
} = _ref; | ||
const instance = new leaflet.VideoOverlay(url, bounds, options); | ||
@@ -955,7 +976,8 @@ | ||
const WMSTileLayer = createTileLayerComponent(function createWMSTileLayer({ | ||
params = {}, | ||
url, | ||
...options | ||
}, context) { | ||
const WMSTileLayer = createTileLayerComponent(function createWMSTileLayer(_ref, context) { | ||
let { | ||
params = {}, | ||
url, | ||
...options | ||
} = _ref; | ||
return { | ||
@@ -962,0 +984,0 @@ instance: new leaflet.TileLayer.WMS(url, { ...params, |
@@ -1,1 +0,1 @@ | ||
!function(n,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports,require("react"),require("leaflet"),require("react-dom")):"function"==typeof define&&define.amd?define(["exports","react","leaflet","react-dom"],e):e((n="undefined"!=typeof globalThis?globalThis:n||self).ReactLeaflet={},n.React,n.L,n.ReactDOM)}(this,(function(n,e,t,r){"use strict";function o(n){return n&&"object"==typeof n&&"default"in n?n:{default:n}}var u=o(e);function c(n,t){const r=e.useRef(t);e.useEffect((function(){t!==r.current&&null!=n.attributionControl&&(null!=r.current&&n.attributionControl.removeAttribution(r.current),null!=t&&n.attributionControl.addAttribution(t)),r.current=t}),[n,t])}function a(n,e,t){e.center!==t.center&&n.setLatLng(e.center),null!=e.radius&&e.radius!==t.radius&&n.setRadius(e.radius)}const l=e.createContext(null),i=l.Provider;function s(){const n=e.useContext(l);if(null==n)throw new Error("No context provided: useLeafletContext() can only be used in a descendant of <MapContainer>");return n}function f(n){function t(t,r){const{instance:o,context:c}=n(t).current;return e.useImperativeHandle(r,(()=>o)),null==t.children?null:u.default.createElement(i,{value:c},t.children)}return e.forwardRef(t)}function p(n){function t(t,r){const{instance:o}=n(t).current;return e.useImperativeHandle(r,(()=>o)),null}return e.forwardRef(t)}function d(n){return function(t){const r=s(),o=n(t,r),{instance:u}=o.current,c=e.useRef(t.position),{position:a}=t;return e.useEffect((function(){return u.addTo(r.map),function(){u.remove()}}),[r.map,u]),e.useEffect((function(){null!=a&&a!==c.current&&(u.setPosition(a),c.current=a)}),[u,a]),o}}function y(n,t){const r=e.useRef();e.useEffect((function(){return null!=t&&n.instance.on(t),r.current=t,function(){null!=r.current&&n.instance.off(r.current),r.current=null}}),[n,t])}function m(n,e){const t=n.pane??e.pane;return t?{...n,pane:t}:n}function v(n,e){(function(n){return n.split(" ").filter(Boolean)})(e).forEach((e=>{t.DomUtil.addClass(n,e)}))}function C(n,t){return null==t?function(t,r){return e.useRef(n(t,r))}:function(r,o){const u=e.useRef(n(r,o)),c=e.useRef(r),{instance:a}=u.current;return e.useEffect((function(){c.current!==r&&(t(a,r,c.current),c.current=r)}),[a,r,o]),u}}function h(n,t){e.useEffect((function(){return(t.layerContainer??t.map).addLayer(n.instance),function(){var e;null==(e=t.layerContainer)||e.removeLayer(n.instance),t.map.removeLayer(n.instance)}}),[t,n])}function b(n){return function(e){const t=s(),r=n(m(e,t),t);return c(t.map,e.attribution),y(r.current,e.eventHandlers),h(r.current,t),r}}function w(n){return function(t){const r=s(),o=n(m(t,r),r);return y(o.current,t.eventHandlers),h(o.current,r),function(n,t){const r=e.useRef();e.useEffect((function(){if(t.pathOptions!==r.current){const e=t.pathOptions??{};n.instance.setStyle(e),r.current=e}}),[n,t])}(o.current,t),o}}function x(n){return p(d(C((function(e,t){return{instance:n(e),context:t}}))))}function g(n,e){return f(b(C(n,e)))}function L(n,t){const o=function(n,e){return function(t,r){const o=s(),u=n(m(t,o),o);return c(o.map,t.attribution),y(u.current,t.eventHandlers),e(u.current,o,t,r),u}}(C(n),t);return function(n){function t(t,o){const[u,c]=e.useState(!1),{instance:a}=n(t,c).current;e.useImperativeHandle(o,(()=>a)),e.useEffect((function(){u&&a.update()}),[a,u,t.children]);const l=a._contentNode;return l?r.createPortal(t.children,l):null}return e.forwardRef(t)}(o)}function E(n,e){return f(w(C(n,e)))}function O(n,e){return p(b(C(n,e)))}function P(n,e,t){const{opacity:r,zIndex:o}=e;null!=r&&r!==t.opacity&&n.setOpacity(r),null!=o&&o!==t.zIndex&&n.setZIndex(o)}function R(n,e,r){e.bounds instanceof t.LatLngBounds&&e.bounds!==r.bounds&&n.setBounds(e.bounds),null!=e.opacity&&e.opacity!==r.opacity&&n.setOpacity(e.opacity),null!=e.zIndex&&e.zIndex!==r.zIndex&&n.setZIndex(e.zIndex)}function I(){return s().map}const M=x((function(n){return new t.Control.Attribution(n)})),S=E((function({center:n,children:e,...r},o){const u=new t.Circle(n,r);return{instance:u,context:{...o,overlayContainer:u}}}),a),k=E((function({center:n,children:e,...r},o){const u=new t.CircleMarker(n,r);return{instance:u,context:{...o,overlayContainer:u}}}),a),z=E((function({children:n,...e},r){const o=new t.FeatureGroup([],e);return{instance:o,context:{...r,layerContainer:o,overlayContainer:o}}})),T=E((function({data:n,...e},r){const o=new t.GeoJSON(n,e);return{instance:o,context:{...r,overlayContainer:o}}}),(function(n,e,t){e.style!==t.style&&(null==e.style?n.resetStyle():n.setStyle(e.style))})),_=g((function({bounds:n,url:e,...r},o){const u=new t.ImageOverlay(e,n,r);return{instance:u,context:{...o,overlayContainer:u}}}),(function(n,e,t){R(n,e,t),e.url!==t.url&&n.setUrl(e.url)})),N=g((function({children:n,...e},r){const o=new t.LayerGroup([],e);return{instance:o,context:{...r,layerContainer:o}}})),G=f(d(C((function({children:n,...e},r){const o=new t.Control.Layers(void 0,void 0,e);return{instance:o,context:{...r,layersControl:o}}}),(function(n,e,t){e.collapsed!==t.collapsed&&(!0===e.collapsed?n.collapse():n.expand())}))));function j(n){return function(t){const r=s(),o=e.useRef(t),[c,a]=e.useState(null),{layersControl:l,map:f}=r,p=e.useCallback((e=>{null!=l&&(o.current.checked&&f.addLayer(e),n(l,e,o.current.name),a(e))}),[l,f]),d=e.useCallback((n=>{null==l||l.removeLayer(n),a(null)}),[l]),y=e.useMemo((()=>({...r,layerContainer:{addLayer:p,removeLayer:d}})),[r,p,d]);return e.useEffect((()=>{null!==c&&o.current!==t&&(!0!==t.checked||null!=o.current.checked&&!1!==o.current.checked?!0!==o.current.checked||null!=t.checked&&!1!==t.checked||f.removeLayer(c):f.addLayer(c),o.current=t)})),t.children?u.default.createElement(i,{value:y},t.children):null}}function A(){return A=Object.assign||function(n){for(var e=1;e<arguments.length;e++){var t=arguments[e];for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(n[r]=t[r])}return n},A.apply(this,arguments)}G.BaseLayer=j((function(n,e,t){n.addBaseLayer(e,t)})),G.Overlay=j((function(n,e,t){n.addOverlay(e,t)}));const B=g((function({position:n,...e},r){const o=new t.Marker(n,e);return{instance:o,context:{...r,overlayContainer:o}}}),(function(n,e,t){e.position!==t.position&&n.setLatLng(e.position),null!=e.icon&&e.icon!==t.icon&&n.setIcon(e.icon),null!=e.zIndexOffset&&e.zIndexOffset!==t.zIndexOffset&&n.setZIndexOffset(e.zIndexOffset),null!=e.opacity&&e.opacity!==t.opacity&&n.setOpacity(e.opacity),null!=n.dragging&&e.draggable!==t.draggable&&(!0===e.draggable?n.dragging.enable():n.dragging.disable())})),H=["mapPane","markerPane","overlayPane","popupPane","shadowPane","tilePane","tooltipPane"];function V(n,e){const{[e]:t,...r}=n;return r}const Z=E((function({positions:n,...e},r){const o=new t.Polygon(n,e);return{instance:o,context:{...r,overlayContainer:o}}}),(function(n,e,t){e.positions!==t.positions&&n.setLatLngs(e.positions)})),q=E((function({positions:n,...e},r){const o=new t.Polyline(n,e);return{instance:o,context:{...r,overlayContainer:o}}}),(function(n,e,t){e.positions!==t.positions&&n.setLatLngs(e.positions)})),U=L((function(n,e){return{instance:new t.Popup(n,e.overlayContainer),context:e}}),(function(n,t,r,o){const{onClose:u,onOpen:c,position:a}=r;e.useEffect((function(){const{instance:e}=n;function r(n){n.popup===e&&(e.update(),o(!0),null==c||c())}function l(n){n.popup===e&&(o(!1),null==u||u())}return t.map.on({popupopen:r,popupclose:l}),null==t.overlayContainer?(null!=a&&e.setLatLng(a),e.openOn(t.map)):t.overlayContainer.bindPopup(e),function(){var n;t.map.off({popupopen:r,popupclose:l}),null==(n=t.overlayContainer)||n.unbindPopup(),t.map.removeLayer(e)}}),[n,t,o,u,c,a])})),D=E((function({bounds:n,...e},r){const o=new t.Rectangle(n,e);return{instance:o,context:{...r,overlayContainer:o}}}),(function(n,e,t){e.bounds!==t.bounds&&n.setBounds(e.bounds)})),F=x((function(n){return new t.Control.Scale(n)})),J=b(C((function(n,e){const{attributes:r,bounds:o,...u}=n,c=document.createElementNS("http://www.w3.org/2000/svg","svg");return c.setAttribute("xmlns","http://www.w3.org/2000/svg"),null!=r&&Object.keys(r).forEach((n=>{c.setAttribute(n,r[n])})),{instance:new t.SVGOverlay(c,o,u),container:c,context:e}}),R));function W({children:n,...t},o){const{instance:u,container:c}=J(t).current;return e.useImperativeHandle(o,(()=>u)),null==c||null==n?null:r.createPortal(n,c)}const $=e.forwardRef(W),Y=O((function({url:n,...e},r){return{instance:new t.TileLayer(n,m(e,r)),context:r}}),P),K=L((function(n,e){return{instance:new t.Tooltip(n,e.overlayContainer),context:e}}),(function(n,t,r,o){const{onClose:u,onOpen:c}=r;e.useEffect((function(){const e=t.overlayContainer;if(null==e)return;const{instance:r}=n,a=n=>{n.tooltip===r&&(r.update(),o(!0),null==c||c())},l=n=>{n.tooltip===r&&(o(!1),null==u||u())};return e.on({tooltipopen:a,tooltipclose:l}),e.bindTooltip(r),function(){e.off({tooltipopen:a,tooltipclose:l}),null!=e._map&&e.unbindTooltip()}}),[n,t,o,u,c])})),Q=g((function({bounds:n,url:e,...r},o){const u=new t.VideoOverlay(e,n,r);var c;!0===r.play&&(null==(c=u.getElement())||c.play());return{instance:u,context:{...o,overlayContainer:u}}}),(function(n,e,t){R(n,e,t),"string"==typeof e.url&&e.url!==t.url&&n.setUrl(e.url);const r=n.getElement();null!=r&&(!0!==e.play||t.play?e.play||!0!==t.play||r.pause():r.play())})),X=O((function({params:n={},url:e,...r},o){return{instance:new t.TileLayer.WMS(e,{...n,...m(r,o)}),context:o}}),(function(n,e,t){P(n,e,t),null!=e.params&&e.params!==t.params&&n.setParams(e.params)})),nn=x((function(n){return new t.Control.Zoom(n)}));n.AttributionControl=M,n.Circle=S,n.CircleMarker=k,n.FeatureGroup=z,n.GeoJSON=T,n.ImageOverlay=_,n.LayerGroup=N,n.LayersControl=G,n.MapConsumer=function({children:n}){return n(I())},n.MapContainer=function({children:n,className:r,id:o,placeholder:c,style:a,whenCreated:l,...s}){const f=e.useRef(null),p=function(n,r){const[o,u]=e.useState(null);return e.useEffect((()=>{if(null!==n.current&&null===o){const e=new t.Map(n.current,r);null!=r.center&&null!=r.zoom?e.setView(r.center,r.zoom):null!=r.bounds&&e.fitBounds(r.bounds,r.boundsOptions),null!=r.whenReady&&e.whenReady(r.whenReady),u(e)}}),[n,o,r]),o}(f,s),d=e.useRef(!1);e.useEffect((()=>{null!=p&&!1===d.current&&null!=l&&(d.current=!0,l(p))}),[p,l]);const[y]=e.useState({className:r,id:o,style:a}),m=e.useMemo((()=>p?{__version:1,map:p}:null),[p]),v=m?u.default.createElement(i,{value:m},n):c??null;return u.default.createElement("div",A({},y,{ref:f}),v)},n.Marker=B,n.Pane=function(n){const[t,o]=e.useState(),c=s(),a=e.useMemo((()=>({...c,pane:n.name})),[c]);return e.useEffect((()=>(o(function(n,e){const t=n.name;if(-1!==H.indexOf(t))throw new Error(`You must use a unique name for a pane that is not a default Leaflet pane: ${t}`);if(null!=e.map.getPane(t))throw new Error(`A pane with this name already exists: ${t}`);const r=n.pane??e.pane,o=r?e.map.getPane(r):void 0,u=e.map.createPane(t,o);return null!=n.className&&v(u,n.className),null!=n.style&&Object.keys(n.style).forEach((e=>{u.style[e]=n.style[e]})),u}(n,c)),function(){const e=c.map.getPane(n.name);null==e||null==e.remove||e.remove(),null!=c.map._panes&&(c.map._panes=V(c.map._panes,n.name),c.map._paneRenderers=V(c.map._paneRenderers,n.name))})),[]),null!=n.children&&null!=t?r.createPortal(u.default.createElement(i,{value:a},n.children),t):null},n.Polygon=Z,n.Polyline=q,n.Popup=U,n.Rectangle=D,n.SVGOverlay=$,n.ScaleControl=F,n.TileLayer=Y,n.Tooltip=K,n.VideoOverlay=Q,n.WMSTileLayer=X,n.ZoomControl=nn,n.useMap=I,n.useMapEvent=function(n,t){const r=I();return e.useEffect((function(){return r.on(n,t),function(){r.off(n,t)}}),[r,n,t]),r},n.useMapEvents=function(n){const t=I();return e.useEffect((function(){return t.on(n),function(){t.off(n)}}),[t,n]),t},Object.defineProperty(n,"__esModule",{value:!0})})); | ||
!function(n,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports,require("react"),require("leaflet"),require("react-dom")):"function"==typeof define&&define.amd?define(["exports","react","leaflet","react-dom"],e):e((n="undefined"!=typeof globalThis?globalThis:n||self).ReactLeaflet={},n.React,n.L,n.ReactDOM)}(this,(function(n,e,t,o){"use strict";function r(n){return n&&"object"==typeof n&&"default"in n?n:{default:n}}var u=r(e);function c(n,t){const o=e.useRef(t);e.useEffect((function(){t!==o.current&&null!=n.attributionControl&&(null!=o.current&&n.attributionControl.removeAttribution(o.current),null!=t&&n.attributionControl.addAttribution(t)),o.current=t}),[n,t])}function a(n,e,t){e.center!==t.center&&n.setLatLng(e.center),null!=e.radius&&e.radius!==t.radius&&n.setRadius(e.radius)}const l=e.createContext(null),i=l.Provider;function s(){const n=e.useContext(l);if(null==n)throw new Error("No context provided: useLeafletContext() can only be used in a descendant of <MapContainer>");return n}function f(n){function t(t,o){const{instance:r,context:c}=n(t).current;return e.useImperativeHandle(o,(()=>r)),null==t.children?null:u.default.createElement(i,{value:c},t.children)}return e.forwardRef(t)}function p(n){function t(t,o){const{instance:r}=n(t).current;return e.useImperativeHandle(o,(()=>r)),null}return e.forwardRef(t)}function d(n){return function(t){const o=s(),r=n(t,o),{instance:u}=r.current,c=e.useRef(t.position),{position:a}=t;return e.useEffect((function(){return u.addTo(o.map),function(){u.remove()}}),[o.map,u]),e.useEffect((function(){null!=a&&a!==c.current&&(u.setPosition(a),c.current=a)}),[u,a]),r}}function y(n,t){const o=e.useRef();e.useEffect((function(){return null!=t&&n.instance.on(t),o.current=t,function(){null!=o.current&&n.instance.off(o.current),o.current=null}}),[n,t])}function m(n,e){const t=n.pane??e.pane;return t?{...n,pane:t}:n}function v(n,e){(function(n){return n.split(" ").filter(Boolean)})(e).forEach((e=>{t.DomUtil.addClass(n,e)}))}function C(n,t){return null==t?function(t,o){return e.useRef(n(t,o))}:function(o,r){const u=e.useRef(n(o,r)),c=e.useRef(o),{instance:a}=u.current;return e.useEffect((function(){c.current!==o&&(t(a,o,c.current),c.current=o)}),[a,o,r]),u}}function h(n,t){e.useEffect((function(){return(t.layerContainer??t.map).addLayer(n.instance),function(){var e;null==(e=t.layerContainer)||e.removeLayer(n.instance),t.map.removeLayer(n.instance)}}),[t,n])}function b(n){return function(e){const t=s(),o=n(m(e,t),t);return c(t.map,e.attribution),y(o.current,e.eventHandlers),h(o.current,t),o}}function w(n){return function(t){const o=s(),r=n(m(t,o),o);return y(r.current,t.eventHandlers),h(r.current,o),function(n,t){const o=e.useRef();e.useEffect((function(){if(t.pathOptions!==o.current){const e=t.pathOptions??{};n.instance.setStyle(e),o.current=e}}),[n,t])}(r.current,t),r}}function g(n){return p(d(C((function(e,t){return{instance:n(e),context:t}}))))}function x(n,e){return f(b(C(n,e)))}function L(n,t){const r=function(n,e){return function(t,o){const r=s(),u=n(m(t,r),r);return c(r.map,t.attribution),y(u.current,t.eventHandlers),e(u.current,r,t,o),u}}(C(n),t);return function(n){function t(t,r){const[u,c]=e.useState(!1),{instance:a}=n(t,c).current;e.useImperativeHandle(r,(()=>a)),e.useEffect((function(){u&&a.update()}),[a,u,t.children]);const l=a._contentNode;return l?o.createPortal(t.children,l):null}return e.forwardRef(t)}(r)}function E(n,e){return f(w(C(n,e)))}function O(n,e){return p(b(C(n,e)))}function P(n,e,t){const{opacity:o,zIndex:r}=e;null!=o&&o!==t.opacity&&n.setOpacity(o),null!=r&&r!==t.zIndex&&n.setZIndex(r)}function R(n,e,o){e.bounds instanceof t.LatLngBounds&&e.bounds!==o.bounds&&n.setBounds(e.bounds),null!=e.opacity&&e.opacity!==o.opacity&&n.setOpacity(e.opacity),null!=e.zIndex&&e.zIndex!==o.zIndex&&n.setZIndex(e.zIndex)}function I(){return s().map}const M=g((function(n){return new t.Control.Attribution(n)})),S=E((function(n,e){let{center:o,children:r,...u}=n;const c=new t.Circle(o,u);return{instance:c,context:{...e,overlayContainer:c}}}),a),k=E((function(n,e){let{center:o,children:r,...u}=n;const c=new t.CircleMarker(o,u);return{instance:c,context:{...e,overlayContainer:c}}}),a),z=E((function(n,e){let{children:o,...r}=n;const u=new t.FeatureGroup([],r);return{instance:u,context:{...e,layerContainer:u,overlayContainer:u}}})),T=E((function(n,e){let{data:o,...r}=n;const u=new t.GeoJSON(o,r);return{instance:u,context:{...e,overlayContainer:u}}}),(function(n,e,t){e.style!==t.style&&(null==e.style?n.resetStyle():n.setStyle(e.style))})),_=x((function(n,e){let{bounds:o,url:r,...u}=n;const c=new t.ImageOverlay(r,o,u);return{instance:c,context:{...e,overlayContainer:c}}}),(function(n,e,t){R(n,e,t),e.url!==t.url&&n.setUrl(e.url)})),N=x((function(n,e){let{children:o,...r}=n;const u=new t.LayerGroup([],r);return{instance:u,context:{...e,layerContainer:u}}})),G=f(d(C((function(n,e){let{children:o,...r}=n;const u=new t.Control.Layers(void 0,void 0,r);return{instance:u,context:{...e,layersControl:u}}}),(function(n,e,t){e.collapsed!==t.collapsed&&(!0===e.collapsed?n.collapse():n.expand())}))));function j(n){return function(t){const o=s(),r=e.useRef(t),[c,a]=e.useState(null),{layersControl:l,map:f}=o,p=e.useCallback((e=>{null!=l&&(r.current.checked&&f.addLayer(e),n(l,e,r.current.name),a(e))}),[l,f]),d=e.useCallback((n=>{null==l||l.removeLayer(n),a(null)}),[l]),y=e.useMemo((()=>({...o,layerContainer:{addLayer:p,removeLayer:d}})),[o,p,d]);return e.useEffect((()=>{null!==c&&r.current!==t&&(!0!==t.checked||null!=r.current.checked&&!1!==r.current.checked?!0!==r.current.checked||null!=t.checked&&!1!==t.checked||f.removeLayer(c):f.addLayer(c),r.current=t)})),t.children?u.default.createElement(i,{value:y},t.children):null}}function A(){return A=Object.assign||function(n){for(var e=1;e<arguments.length;e++){var t=arguments[e];for(var o in t)Object.prototype.hasOwnProperty.call(t,o)&&(n[o]=t[o])}return n},A.apply(this,arguments)}G.BaseLayer=j((function(n,e,t){n.addBaseLayer(e,t)})),G.Overlay=j((function(n,e,t){n.addOverlay(e,t)}));const B=x((function(n,e){let{position:o,...r}=n;const u=new t.Marker(o,r);return{instance:u,context:{...e,overlayContainer:u}}}),(function(n,e,t){e.position!==t.position&&n.setLatLng(e.position),null!=e.icon&&e.icon!==t.icon&&n.setIcon(e.icon),null!=e.zIndexOffset&&e.zIndexOffset!==t.zIndexOffset&&n.setZIndexOffset(e.zIndexOffset),null!=e.opacity&&e.opacity!==t.opacity&&n.setOpacity(e.opacity),null!=n.dragging&&e.draggable!==t.draggable&&(!0===e.draggable?n.dragging.enable():n.dragging.disable())})),H=["mapPane","markerPane","overlayPane","popupPane","shadowPane","tilePane","tooltipPane"];function V(n,e){const{[e]:t,...o}=n;return o}const Z=E((function(n,e){let{positions:o,...r}=n;const u=new t.Polygon(o,r);return{instance:u,context:{...e,overlayContainer:u}}}),(function(n,e,t){e.positions!==t.positions&&n.setLatLngs(e.positions)})),q=E((function(n,e){let{positions:o,...r}=n;const u=new t.Polyline(o,r);return{instance:u,context:{...e,overlayContainer:u}}}),(function(n,e,t){e.positions!==t.positions&&n.setLatLngs(e.positions)})),U=L((function(n,e){return{instance:new t.Popup(n,e.overlayContainer),context:e}}),(function(n,t,o,r){const{onClose:u,onOpen:c,position:a}=o;e.useEffect((function(){const{instance:e}=n;function o(n){n.popup===e&&(e.update(),r(!0),null==c||c())}function l(n){n.popup===e&&(r(!1),null==u||u())}return t.map.on({popupopen:o,popupclose:l}),null==t.overlayContainer?(null!=a&&e.setLatLng(a),e.openOn(t.map)):t.overlayContainer.bindPopup(e),function(){var n;t.map.off({popupopen:o,popupclose:l}),null==(n=t.overlayContainer)||n.unbindPopup(),t.map.removeLayer(e)}}),[n,t,r,u,c,a])})),D=E((function(n,e){let{bounds:o,...r}=n;const u=new t.Rectangle(o,r);return{instance:u,context:{...e,overlayContainer:u}}}),(function(n,e,t){e.bounds!==t.bounds&&n.setBounds(e.bounds)})),F=g((function(n){return new t.Control.Scale(n)})),J=b(C((function(n,e){const{attributes:o,bounds:r,...u}=n,c=document.createElementNS("http://www.w3.org/2000/svg","svg");return c.setAttribute("xmlns","http://www.w3.org/2000/svg"),null!=o&&Object.keys(o).forEach((n=>{c.setAttribute(n,o[n])})),{instance:new t.SVGOverlay(c,r,u),container:c,context:e}}),R));function W(n,t){let{children:r,...u}=n;const{instance:c,container:a}=J(u).current;return e.useImperativeHandle(t,(()=>c)),null==a||null==r?null:o.createPortal(r,a)}const $=e.forwardRef(W),Y=O((function(n,e){let{url:o,...r}=n;return{instance:new t.TileLayer(o,m(r,e)),context:e}}),P),K=L((function(n,e){return{instance:new t.Tooltip(n,e.overlayContainer),context:e}}),(function(n,t,o,r){const{onClose:u,onOpen:c,position:a}=o;e.useEffect((function(){const e=t.overlayContainer;if(null==e)return;const{instance:o}=n,l=n=>{n.tooltip===o&&(a&&o.setLatLng(a),o.update(),r(!0),null==c||c())},i=n=>{n.tooltip===o&&(r(!1),null==u||u())};return e.on({tooltipopen:l,tooltipclose:i}),e.bindTooltip(o),function(){e.off({tooltipopen:l,tooltipclose:i}),null!=e._map&&e.unbindTooltip()}}),[n,t,r,u,c,a])})),Q=x((function(n,e){let{bounds:o,url:r,...u}=n;const c=new t.VideoOverlay(r,o,u);var a;!0===u.play&&(null==(a=c.getElement())||a.play());return{instance:c,context:{...e,overlayContainer:c}}}),(function(n,e,t){R(n,e,t),"string"==typeof e.url&&e.url!==t.url&&n.setUrl(e.url);const o=n.getElement();null!=o&&(!0!==e.play||t.play?e.play||!0!==t.play||o.pause():o.play())})),X=O((function(n,e){let{params:o={},url:r,...u}=n;return{instance:new t.TileLayer.WMS(r,{...o,...m(u,e)}),context:e}}),(function(n,e,t){P(n,e,t),null!=e.params&&e.params!==t.params&&n.setParams(e.params)})),nn=g((function(n){return new t.Control.Zoom(n)}));n.AttributionControl=M,n.Circle=S,n.CircleMarker=k,n.FeatureGroup=z,n.GeoJSON=T,n.ImageOverlay=_,n.LayerGroup=N,n.LayersControl=G,n.MapConsumer=function(n){let{children:e}=n;return e(I())},n.MapContainer=function(n){let{children:o,className:r,id:c,placeholder:a,style:l,whenCreated:s,...f}=n;const p=e.useRef(null),d=function(n,o){const[r,u]=e.useState(null);return e.useEffect((()=>{if(null!==n.current&&null===r){const e=new t.Map(n.current,o);null!=o.center&&null!=o.zoom?e.setView(o.center,o.zoom):null!=o.bounds&&e.fitBounds(o.bounds,o.boundsOptions),null!=o.whenReady&&e.whenReady(o.whenReady),u(e)}}),[n,r,o]),r}(p,f),y=e.useRef(!1);e.useEffect((()=>{null!=d&&!1===y.current&&null!=s&&(y.current=!0,s(d))}),[d,s]);const[m]=e.useState({className:r,id:c,style:l}),v=e.useMemo((()=>d?{__version:1,map:d}:null),[d]),C=v?u.default.createElement(i,{value:v},o):a??null;return u.default.createElement("div",A({},m,{ref:p}),C)},n.Marker=B,n.Pane=function(n){const[t,r]=e.useState(),c=s(),a=e.useMemo((()=>({...c,pane:n.name})),[c]);return e.useEffect((()=>(r(function(n,e){const t=n.name;if(-1!==H.indexOf(t))throw new Error(`You must use a unique name for a pane that is not a default Leaflet pane: ${t}`);if(null!=e.map.getPane(t))throw new Error(`A pane with this name already exists: ${t}`);const o=n.pane??e.pane,r=o?e.map.getPane(o):void 0,u=e.map.createPane(t,r);return null!=n.className&&v(u,n.className),null!=n.style&&Object.keys(n.style).forEach((e=>{u.style[e]=n.style[e]})),u}(n,c)),function(){const e=c.map.getPane(n.name);null==e||null==e.remove||e.remove(),null!=c.map._panes&&(c.map._panes=V(c.map._panes,n.name),c.map._paneRenderers=V(c.map._paneRenderers,n.name))})),[]),null!=n.children&&null!=t?o.createPortal(u.default.createElement(i,{value:a},n.children),t):null},n.Polygon=Z,n.Polyline=q,n.Popup=U,n.Rectangle=D,n.SVGOverlay=$,n.ScaleControl=F,n.TileLayer=Y,n.Tooltip=K,n.VideoOverlay=Q,n.WMSTileLayer=X,n.ZoomControl=nn,n.useMap=I,n.useMapEvent=function(n,t){const o=I();return e.useEffect((function(){return o.on(n,t),function(){o.off(n,t)}}),[o,n,t]),o},n.useMapEvents=function(n){const t=I();return e.useEffect((function(){return t.on(n),function(){t.off(n)}}),[t,n]),t},Object.defineProperty(n,"__esModule",{value:!0})})); |
118363
2629