aio-map 3.3.0 → 3.3.1

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 -0
  2. package/index.js +6 -1
  3. package/package.json +4 -4
package/index.d.ts CHANGED
@@ -40,6 +40,7 @@ export type I_Map = {
40
40
  children?: React.ReactNode;
41
41
  onChangePos?: (coords: I_pos) => void;
42
42
  onChangeZoom?: (newZoom: number) => void;
43
+ cluster?: boolean;
43
44
  pos?: I_pos;
44
45
  delay?: number;
45
46
  zoom?: number;
package/index.js CHANGED
@@ -31,6 +31,9 @@ const AIMap = (props) => {
31
31
  if (newZoom === zoomRef.current) {
32
32
  return;
33
33
  }
34
+ if (props.onChangeZoom) {
35
+ props.onChangeZoom(newZoom);
36
+ }
34
37
  setZoom(newZoom);
35
38
  }
36
39
  if (mapRef) {
@@ -81,7 +84,9 @@ const MapBody = () => {
81
84
  const { rootProps, pos, setMap, getDefaultMarkerIcon, zoom } = useContext(MAPCTX);
82
85
  const { mapStyle, dragging = true, children, shapes = [], marker, markers = [], whenReady } = rootProps;
83
86
  const defaultStyle = { width: '100%', height: '100%' };
84
- return (_jsxs(ReactLeaflet.MapContainer, { center: pos, style: Object.assign(Object.assign({}, defaultStyle), mapStyle), zoom: zoom, scrollWheelZoom: ((_a = rootProps.zoomOptions) === null || _a === void 0 ? void 0 : _a.wheel) ? 'center' : undefined, zoomControl: ((_b = rootProps.zoomOptions) === null || _b === void 0 ? void 0 : _b.control) !== false, attributionControl: true, dragging: dragging, ref: setMap, whenReady: whenReady, children: [!rootProps.tileAttrs && _jsx(ReactLeaflet.TileLayer, { url: "https://{s}.tile.openstreetmap.de/{z}/{x}/{y}.png" }), !!rootProps.tileAttrs && _jsx(ReactLeaflet.TileLayer, Object.assign({}, rootProps.tileAttrs)), _jsx(MapEvents, {}), marker !== false && _jsx(MapMarker, { pos: pos, html: isValidElement(marker) ? marker : getDefaultMarkerIcon() }, 'main-marker'), _jsx(MarkerClusterGroup, { chunkedLoading: true, showCoverageOnHover: false, children: markers.map((marker, i) => _jsx(MapMarker, { pos: marker.pos, html: marker.html, eventHandlers: marker.eventHandlers }, `marker-${i}`)) }), shapes.map((o, i) => _jsx(MapShape, { shape: o }, i)), _jsx(MapLayers, {}), children] }));
87
+ const MRKS = markers.map((marker, i) => _jsx(MapMarker, { pos: marker.pos, html: marker.html, eventHandlers: marker.eventHandlers }, `marker-${i}`));
88
+ return (_jsxs(ReactLeaflet.MapContainer, { center: pos, style: Object.assign(Object.assign({}, defaultStyle), mapStyle), zoom: zoom, scrollWheelZoom: ((_a = rootProps.zoomOptions) === null || _a === void 0 ? void 0 : _a.wheel) ? 'center' : undefined, zoomControl: ((_b = rootProps.zoomOptions) === null || _b === void 0 ? void 0 : _b.control) !== false, attributionControl: true, dragging: dragging, ref: setMap, whenReady: whenReady, children: [!rootProps.tileAttrs && _jsx(ReactLeaflet.TileLayer, { url: "https://{s}.tile.openstreetmap.de/{z}/{x}/{y}.png" }), !!rootProps.tileAttrs && _jsx(ReactLeaflet.TileLayer, Object.assign({}, rootProps.tileAttrs)), _jsx(MapEvents, {}), marker !== false && _jsx(MapMarker, { pos: pos, html: isValidElement(marker) ? marker : getDefaultMarkerIcon() }, 'main-marker'), rootProps.cluster !== false &&
89
+ _jsx(MarkerClusterGroup, { chunkedLoading: true, showCoverageOnHover: false, children: MRKS }), rootProps.cluster === false && MRKS, shapes.map((o, i) => _jsx(MapShape, { shape: o }, i)), _jsx(MapLayers, {}), children] }));
85
90
  };
86
91
  const MagnifyIcon = () => {
87
92
  return (_jsx("svg", { viewBox: "0 0 24 24", xmlns: "http://www.w3.org/2000/svg", width: 24, height: 24, children: _jsx("path", { d: "M9.5,3A6.5,6.5 0 0,1 16,9.5C16,11.11 15.41,12.59 14.44,13.73L14.71,14H15.5L20.5,19L19,20.5L14,15.5V14.71L13.73,14.44C12.59,15.41 11.11,16 9.5,16A6.5,6.5 0 0,1 3,9.5A6.5,6.5 0 0,1 9.5,3M9.5,5C7,5 5,7 5,9.5C5,12 7,14 9.5,14C12,14 14,12 14,9.5C14,7 12,5 9.5,5Z" }) }));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "aio-map",
3
- "version": "3.3.0",
3
+ "version": "3.3.1",
4
4
  "description": "",
5
5
  "types": "index.d.ts",
6
6
  "main": "index.js",
@@ -14,9 +14,9 @@
14
14
  "dependencies": {
15
15
  "aio-class": "latest",
16
16
  "aio-input": "latest",
17
- "leaflet": "^1.9.4",
18
- "react-leaflet": "^5.0.0",
19
- "react-leaflet-cluster": "^2.1.0"
17
+ "leaflet": "latest",
18
+ "react-leaflet": "latest",
19
+ "react-leaflet-cluster": "latest"
20
20
  },
21
21
  "author": "mohammad sharif feiz feiz.ms@gmail.com",
22
22
  "license": "ISC",