You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

1 line
6.8 KiB

2 years ago
{"ast":null,"code":"function _extends() {\n _extends = Object.assign || function (target) {\n for (var i = 1; i < arguments.length; i++) {\n var source = arguments[i];\n\n for (var key in source) {\n if (Object.prototype.hasOwnProperty.call(source, key)) {\n target[key] = source[key];\n }\n }\n }\n\n return target;\n };\n\n return _extends.apply(this, arguments);\n}\n\nimport { LeafletProvider, createLeafletContext } from '@react-leaflet/core';\nimport { Map as LeafletMap } from 'leaflet';\nimport React, { forwardRef, useCallback, useEffect, useImperativeHandle, useState } from 'react';\n\nfunction MapContainerComponent(_ref, forwardedRef) {\n let {\n bounds,\n boundsOptions,\n center,\n children,\n className,\n id,\n placeholder,\n style,\n whenReady,\n zoom,\n ...options\n } = _ref;\n const [props] = useState({\n className,\n id,\n style\n });\n const [context, setContext] = useState(null);\n useImperativeHandle(forwardedRef, () => context?.map ?? null, [context]);\n const mapRef = useCallback(node => {\n if (node !== null && context === null) {\n const map = new LeafletMap(node, options);\n\n if (center != null && zoom != null) {\n map.setView(center, zoom);\n } else if (bounds != null) {\n map.fitBounds(bounds, boundsOptions);\n }\n\n if (whenReady != null) {\n map.whenReady(whenReady);\n }\n\n setContext(createLeafletContext(map));\n }\n }, []);\n useEffect(() => {\n return () => {\n context?.map.remove();\n };\n }, [context]);\n const contents = context ? /*#__PURE__*/React.createElement(LeafletProvider, {\n value: context\n }, children) : placeholder ?? null;\n return /*#__PURE__*/React.createElement(\"div\", _extends({}, props, {\n ref: mapRef\n }), contents);\n}\n\nexport const MapContainer = /*#__PURE__*/forwardRef(MapContainerComponent);","map":{"version":3,"names":["_extends","Object","assign","target","i","arguments","length","source","key","prototype","hasOwnProperty","call","apply","LeafletProvider","createLeafletContext","Map","LeafletMap","React","forwardRef","useCallback","useEffect","useImperativeHandle","useState","MapContainerComponent","forwardedRef","bounds","boundsOptions","center","children","className","id","placeholder","style","whenReady","zoom","options","props","context","setContext","map","mapRef","node","setView","fitBounds","remove","contents","createElement","value","ref","MapContainer"],"sources":["/Users/mahdi/Documents/work/programming/barnameNegar/arbaeenWebApp/node_modules/react-leaflet/lib/MapContainer.js"],"sourcesContent":["function _extends() {\n _extends = Object.assign || function(target) {\n for(var i = 1; i < arguments.length; i++){\n var source = arguments[i];\n for(var key in source){\n if (Object.prototype.hasOwnProperty.call(source, key)) {\n target[key] = source[key];\n }\n }\n }\n return target;\n };\n return _extends.apply(this, arguments);\n}\nimport { LeafletProvider, createLeafletContext } from '@react-leaflet/core';\nimport { Map as LeafletMap } from 'leaflet';\nimport React, { forwardRef, useCallback, useEffect, useImperativeHandle, useState } from 'react';\nfunction MapContainerComponent({ bounds , boundsOptions , center , children , className , id , placeholder , style , whenReady , zoom , ...options }, forwardedRef) {\n const [props] = useState({\n className,\n id,\n style\n });\n const [context, setContext] = useState(null);\n useImperativeHandle(forwardedRef, ()=>context?.map ?? null, [\n context\n ]);\n const mapRef = useCallback((node)=>{\n if (node !== null && context === null) {\n const map = new LeafletMap(node, options);\n if (center != null && zoom != null) {\n map.setView(center, zoom);\n } else if (bounds != null) {\n map.fitBounds(bounds, bou