aio-map 3.3.1 → 3.3.2
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/index.d.ts +1 -1
- package/index.js +6 -0
- package/package.json +1 -1
package/index.d.ts
CHANGED
package/index.js
CHANGED
|
@@ -123,6 +123,9 @@ const MapLayers = () => {
|
|
|
123
123
|
}
|
|
124
124
|
const { position = 'topright', items = [] } = layers;
|
|
125
125
|
return (_jsx(ReactLeaflet.LayersControl, { position: position, children: items.map((o, i) => {
|
|
126
|
+
if (!o) {
|
|
127
|
+
return null;
|
|
128
|
+
}
|
|
126
129
|
const { shapes = [], markers = [], active = true, cluster } = o;
|
|
127
130
|
const content = markers.map((marker, j) => _jsx(MapMarker, { pos: marker.pos, html: marker.html, eventHandlers: marker.eventHandlers }, j));
|
|
128
131
|
return (_jsx(ReactLeaflet.LayersControl.Overlay, { name: o.name, checked: active, children: _jsxs(ReactLeaflet.FeatureGroup, { children: [!!cluster && _jsx(MarkerClusterGroup, { chunkedLoading: true, showCoverageOnHover: false, children: content }), !cluster && content, shapes.map((shape, k) => _jsx(MapShape, { shape: shape }, k))] }) }, i));
|
|
@@ -155,6 +158,9 @@ const MapFooter = () => {
|
|
|
155
158
|
};
|
|
156
159
|
const MapMarker = ({ pos, html, eventHandlers }) => {
|
|
157
160
|
const { getDefaultMarkerIcon } = useContext(MAPCTX);
|
|
161
|
+
if (!pos || !Array.isArray(pos) || typeof pos[0] !== "number" || typeof pos[1] !== "number") {
|
|
162
|
+
return null;
|
|
163
|
+
}
|
|
158
164
|
function getHtmlIcon(html) {
|
|
159
165
|
return Leaflet.divIcon({
|
|
160
166
|
html: JSXToHTML(html),
|