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.
Files changed (3) hide show
  1. package/index.d.ts +1 -1
  2. package/index.js +6 -0
  3. package/package.json +1 -1
package/index.d.ts CHANGED
@@ -69,7 +69,7 @@ export type I_Map = {
69
69
  };
70
70
  export type I_layers = {
71
71
  position: 'topright' | 'topleft';
72
- items: I_layerItem[];
72
+ items: (I_layerItem | false | undefined)[];
73
73
  };
74
74
  export type I_layerItem = {
75
75
  name: string;
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),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "aio-map",
3
- "version": "3.3.1",
3
+ "version": "3.3.2",
4
4
  "description": "",
5
5
  "types": "index.d.ts",
6
6
  "main": "index.js",