aio-map 3.2.6 → 3.3.0
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.js +6 -30
- package/package.json +2 -2
package/index.js
CHANGED
|
@@ -15,7 +15,7 @@ import * as ReactLeaflet from 'react-leaflet';
|
|
|
15
15
|
import MarkerClusterGroup from "react-leaflet-cluster";
|
|
16
16
|
import AIOInput from "aio-input";
|
|
17
17
|
import 'leaflet/dist/leaflet.css';
|
|
18
|
-
import { Debounce } from 'aio-
|
|
18
|
+
import { AddToAttrs, Debounce } from 'aio-class';
|
|
19
19
|
import './index.css';
|
|
20
20
|
const MAPCTX = createContext({});
|
|
21
21
|
const AIMap = (props) => {
|
|
@@ -105,9 +105,9 @@ const MapHeader = () => {
|
|
|
105
105
|
}), 1200);
|
|
106
106
|
}
|
|
107
107
|
return (_jsx("div", { className: "ai-map-header", children: _jsx(AIOInput, { type: 'text', value: searchValue, options: (searchResult || []), before: _jsx(MagnifyIcon, {}), onChange: (searchValue) => changeSearch(searchValue), option: {
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
108
|
+
attrs: (option) => ({ onClick: () => { if (onSearch) {
|
|
109
|
+
onSearch(option);
|
|
110
|
+
} } })
|
|
111
111
|
} }) }));
|
|
112
112
|
};
|
|
113
113
|
const MapLayers = () => {
|
|
@@ -153,8 +153,8 @@ const MapMarker = ({ pos, html, eventHandlers }) => {
|
|
|
153
153
|
function getHtmlIcon(html) {
|
|
154
154
|
return Leaflet.divIcon({
|
|
155
155
|
html: JSXToHTML(html),
|
|
156
|
-
className: '',
|
|
157
|
-
iconSize: [32, 32],
|
|
156
|
+
className: '', // Optional, for adding custom styles
|
|
157
|
+
iconSize: [32, 32], // size of the icon
|
|
158
158
|
iconAnchor: [16, 32], // point of the icon which will correspond to marker's location
|
|
159
159
|
});
|
|
160
160
|
}
|
|
@@ -195,30 +195,6 @@ function MapEvents() {
|
|
|
195
195
|
function JSXToHTML(jsx) {
|
|
196
196
|
return ReactDOMServer.renderToStaticMarkup(jsx);
|
|
197
197
|
}
|
|
198
|
-
function classListToString(classes) {
|
|
199
|
-
let list = [];
|
|
200
|
-
const getClasses = (cls) => {
|
|
201
|
-
if (Array.isArray(cls)) {
|
|
202
|
-
return cls.filter((o) => !!o && typeof o === 'string');
|
|
203
|
-
}
|
|
204
|
-
if (typeof cls === 'string') {
|
|
205
|
-
return cls.split(' ');
|
|
206
|
-
}
|
|
207
|
-
return [];
|
|
208
|
-
};
|
|
209
|
-
for (let i = 0; i < classes.length; i++) {
|
|
210
|
-
const cls = classes[i];
|
|
211
|
-
list = [...list, ...getClasses(cls)];
|
|
212
|
-
}
|
|
213
|
-
return list.length ? list.join(' ') : '';
|
|
214
|
-
}
|
|
215
|
-
function AddToAttrs(attrs, p) {
|
|
216
|
-
attrs = attrs || {};
|
|
217
|
-
let { style } = p;
|
|
218
|
-
const className = classListToString([attrs.className, p.className]);
|
|
219
|
-
let newStyle = Object.assign(Object.assign({}, attrs.style), style);
|
|
220
|
-
return Object.assign(Object.assign(Object.assign({}, attrs), { className, style: newStyle }), p.attrs);
|
|
221
|
-
}
|
|
222
198
|
export function getCenterOfPoints(points) {
|
|
223
199
|
const filteredPoints = points.filter(({ lat, lng }) => typeof lat === 'number' && typeof lng === 'number');
|
|
224
200
|
let totalLat = 0, totalLng = 0;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "aio-map",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.3.0",
|
|
4
4
|
"description": "",
|
|
5
5
|
"types": "index.d.ts",
|
|
6
6
|
"main": "index.js",
|
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
"url": "git+https://github.com/mohammadFeiz/aio-map.git"
|
|
13
13
|
},
|
|
14
14
|
"dependencies": {
|
|
15
|
-
"aio-
|
|
15
|
+
"aio-class": "latest",
|
|
16
16
|
"aio-input": "latest",
|
|
17
17
|
"leaflet": "^1.9.4",
|
|
18
18
|
"react-leaflet": "^5.0.0",
|