@micromag/element-map 0.3.531 → 0.3.547
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/es/index.js +2 -4
- package/package.json +4 -5
- package/lib/index.js +0 -740
package/es/index.js
CHANGED
|
@@ -433,7 +433,6 @@ var Map$2 = function Map(_ref) {
|
|
|
433
433
|
};
|
|
434
434
|
Map$2.propTypes = propTypes$2;
|
|
435
435
|
Map$2.defaultProps = defaultProps$2;
|
|
436
|
-
var GoogleMap = Map$2;
|
|
437
436
|
|
|
438
437
|
var eventMapping = {
|
|
439
438
|
onClick: 'click',
|
|
@@ -558,7 +557,6 @@ var Marker = function Marker(_ref) {
|
|
|
558
557
|
};
|
|
559
558
|
Marker.propTypes = propTypes$1;
|
|
560
559
|
Marker.defaultProps = defaultProps$1;
|
|
561
|
-
var Marker$1 = Marker;
|
|
562
560
|
|
|
563
561
|
var styles = {"container":"micromag-element-map-container"};
|
|
564
562
|
|
|
@@ -688,7 +686,7 @@ var Map = function Map(_ref) {
|
|
|
688
686
|
}, [onClick, onCenterChanged, onBoundsChanged, onDrag, onDragEnd, onTilesLoaded]);
|
|
689
687
|
return /*#__PURE__*/React.createElement("div", {
|
|
690
688
|
className: classNames([styles.container, _defineProperty({}, className, className !== null)])
|
|
691
|
-
}, /*#__PURE__*/React.createElement(
|
|
689
|
+
}, /*#__PURE__*/React.createElement(Map$2, {
|
|
692
690
|
center: center,
|
|
693
691
|
zoom: zoom,
|
|
694
692
|
withoutStyle: withoutStyle,
|
|
@@ -712,7 +710,7 @@ var Map = function Map(_ref) {
|
|
|
712
710
|
image = _ref5$image === void 0 ? null : _ref5$image,
|
|
713
711
|
_ref5$title = _ref5.title,
|
|
714
712
|
title = _ref5$title === void 0 ? null : _ref5$title;
|
|
715
|
-
return geoPosition !== null && (geoPosition.lat || null) !== null && (geoPosition.lng || null) !== null ? /*#__PURE__*/React.createElement(Marker
|
|
713
|
+
return geoPosition !== null && (geoPosition.lat || null) !== null && (geoPosition.lng || null) !== null ? /*#__PURE__*/React.createElement(Marker, {
|
|
716
714
|
key: "marker-".concat(index),
|
|
717
715
|
active: active,
|
|
718
716
|
title: title !== null && _typeof(title.body) ? title.body : null,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@micromag/element-map",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.547",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "",
|
|
6
6
|
"keywords": [
|
|
@@ -30,11 +30,10 @@
|
|
|
30
30
|
}
|
|
31
31
|
],
|
|
32
32
|
"license": "ISC",
|
|
33
|
-
"
|
|
33
|
+
"type": "module",
|
|
34
34
|
"module": "es/index.js",
|
|
35
35
|
"exports": {
|
|
36
36
|
".": {
|
|
37
|
-
"require": "./lib/index.js",
|
|
38
37
|
"import": "./es/index.js"
|
|
39
38
|
},
|
|
40
39
|
"./assets/css/styles": "./assets/css/styles.css",
|
|
@@ -60,7 +59,7 @@
|
|
|
60
59
|
},
|
|
61
60
|
"dependencies": {
|
|
62
61
|
"@babel/runtime": "^7.13.10",
|
|
63
|
-
"@micromag/core": "^0.3.
|
|
62
|
+
"@micromag/core": "^0.3.547",
|
|
64
63
|
"classnames": "^2.2.6",
|
|
65
64
|
"lodash": "^4.17.21",
|
|
66
65
|
"prop-types": "^15.7.2",
|
|
@@ -71,5 +70,5 @@
|
|
|
71
70
|
"access": "public",
|
|
72
71
|
"registry": "https://registry.npmjs.org/"
|
|
73
72
|
},
|
|
74
|
-
"gitHead": "
|
|
73
|
+
"gitHead": "3c2f5904ce61fcfa61f673c38c2a5ec56e9e2b07"
|
|
75
74
|
}
|
package/lib/index.js
DELETED
|
@@ -1,740 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
-
|
|
5
|
-
var _typeof = require('@babel/runtime/helpers/typeof');
|
|
6
|
-
var _defineProperty = require('@babel/runtime/helpers/defineProperty');
|
|
7
|
-
var _slicedToArray = require('@babel/runtime/helpers/slicedToArray');
|
|
8
|
-
var classNames = require('classnames');
|
|
9
|
-
var PropTypes = require('prop-types');
|
|
10
|
-
var React = require('react');
|
|
11
|
-
var contexts = require('@micromag/core/contexts');
|
|
12
|
-
var hooks = require('@micromag/core/hooks');
|
|
13
|
-
var core = require('@micromag/core');
|
|
14
|
-
var isObject = require('lodash/isObject');
|
|
15
|
-
|
|
16
|
-
var styles$2 = [{
|
|
17
|
-
elementType: 'geometry',
|
|
18
|
-
stylers: [{
|
|
19
|
-
color: '#f5f5f5'
|
|
20
|
-
}]
|
|
21
|
-
}, {
|
|
22
|
-
elementType: 'labels.icon',
|
|
23
|
-
stylers: [{
|
|
24
|
-
visibility: 'off'
|
|
25
|
-
}]
|
|
26
|
-
}, {
|
|
27
|
-
elementType: 'labels.text.fill',
|
|
28
|
-
stylers: [{
|
|
29
|
-
color: '#616161'
|
|
30
|
-
}]
|
|
31
|
-
}, {
|
|
32
|
-
elementType: 'labels.text.stroke',
|
|
33
|
-
stylers: [{
|
|
34
|
-
color: '#f5f5f5'
|
|
35
|
-
}]
|
|
36
|
-
}, {
|
|
37
|
-
featureType: 'administrative.land_parcel',
|
|
38
|
-
stylers: [{
|
|
39
|
-
visibility: 'off'
|
|
40
|
-
}]
|
|
41
|
-
}, {
|
|
42
|
-
featureType: 'administrative.land_parcel',
|
|
43
|
-
elementType: 'labels.text.fill',
|
|
44
|
-
stylers: [{
|
|
45
|
-
color: '#bdbdbd'
|
|
46
|
-
}]
|
|
47
|
-
}, {
|
|
48
|
-
featureType: 'administrative.neighborhood',
|
|
49
|
-
stylers: [{
|
|
50
|
-
visibility: 'off'
|
|
51
|
-
}]
|
|
52
|
-
}, {
|
|
53
|
-
featureType: 'poi',
|
|
54
|
-
elementType: 'geometry',
|
|
55
|
-
stylers: [{
|
|
56
|
-
color: '#eeeeee'
|
|
57
|
-
}]
|
|
58
|
-
}, {
|
|
59
|
-
featureType: 'poi',
|
|
60
|
-
elementType: 'labels.text',
|
|
61
|
-
stylers: [{
|
|
62
|
-
visibility: 'off'
|
|
63
|
-
}]
|
|
64
|
-
}, {
|
|
65
|
-
featureType: 'poi',
|
|
66
|
-
elementType: 'labels.text.fill',
|
|
67
|
-
stylers: [{
|
|
68
|
-
color: '#757575'
|
|
69
|
-
}]
|
|
70
|
-
}, {
|
|
71
|
-
featureType: 'poi.business',
|
|
72
|
-
stylers: [{
|
|
73
|
-
visibility: 'off'
|
|
74
|
-
}]
|
|
75
|
-
}, {
|
|
76
|
-
featureType: 'poi.park',
|
|
77
|
-
elementType: 'geometry',
|
|
78
|
-
stylers: [{
|
|
79
|
-
color: '#e5e5e5'
|
|
80
|
-
}]
|
|
81
|
-
}, {
|
|
82
|
-
featureType: 'poi.park',
|
|
83
|
-
elementType: 'labels.text.fill',
|
|
84
|
-
stylers: [{
|
|
85
|
-
color: '#9e9e9e'
|
|
86
|
-
}]
|
|
87
|
-
}, {
|
|
88
|
-
featureType: 'road',
|
|
89
|
-
elementType: 'geometry',
|
|
90
|
-
stylers: [{
|
|
91
|
-
color: '#ffffff'
|
|
92
|
-
}]
|
|
93
|
-
}, {
|
|
94
|
-
featureType: 'road',
|
|
95
|
-
elementType: 'labels',
|
|
96
|
-
stylers: [{
|
|
97
|
-
visibility: 'off'
|
|
98
|
-
}]
|
|
99
|
-
}, {
|
|
100
|
-
featureType: 'road',
|
|
101
|
-
elementType: 'labels.icon',
|
|
102
|
-
stylers: [{
|
|
103
|
-
visibility: 'off'
|
|
104
|
-
}]
|
|
105
|
-
}, {
|
|
106
|
-
featureType: 'road.arterial',
|
|
107
|
-
elementType: 'labels',
|
|
108
|
-
stylers: [{
|
|
109
|
-
visibility: 'off'
|
|
110
|
-
}]
|
|
111
|
-
}, {
|
|
112
|
-
featureType: 'road.arterial',
|
|
113
|
-
elementType: 'labels.text.fill',
|
|
114
|
-
stylers: [{
|
|
115
|
-
color: '#757575'
|
|
116
|
-
}]
|
|
117
|
-
}, {
|
|
118
|
-
featureType: 'road.highway',
|
|
119
|
-
elementType: 'geometry',
|
|
120
|
-
stylers: [{
|
|
121
|
-
color: '#dadada'
|
|
122
|
-
}]
|
|
123
|
-
}, {
|
|
124
|
-
featureType: 'road.highway',
|
|
125
|
-
elementType: 'labels',
|
|
126
|
-
stylers: [{
|
|
127
|
-
visibility: 'off'
|
|
128
|
-
}]
|
|
129
|
-
}, {
|
|
130
|
-
featureType: 'road.highway',
|
|
131
|
-
elementType: 'labels.text.fill',
|
|
132
|
-
stylers: [{
|
|
133
|
-
color: '#616161'
|
|
134
|
-
}]
|
|
135
|
-
}, {
|
|
136
|
-
featureType: 'road.local',
|
|
137
|
-
stylers: [{
|
|
138
|
-
visibility: 'off'
|
|
139
|
-
}]
|
|
140
|
-
}, {
|
|
141
|
-
featureType: 'road.local',
|
|
142
|
-
elementType: 'labels.text.fill',
|
|
143
|
-
stylers: [{
|
|
144
|
-
color: '#9e9e9e'
|
|
145
|
-
}]
|
|
146
|
-
}, {
|
|
147
|
-
featureType: 'transit',
|
|
148
|
-
stylers: [{
|
|
149
|
-
visibility: 'off'
|
|
150
|
-
}]
|
|
151
|
-
}, {
|
|
152
|
-
featureType: 'transit.line',
|
|
153
|
-
elementType: 'geometry',
|
|
154
|
-
stylers: [{
|
|
155
|
-
color: '#e5e5e5'
|
|
156
|
-
}]
|
|
157
|
-
}, {
|
|
158
|
-
featureType: 'transit.station',
|
|
159
|
-
elementType: 'geometry',
|
|
160
|
-
stylers: [{
|
|
161
|
-
color: '#eeeeee'
|
|
162
|
-
}]
|
|
163
|
-
}, {
|
|
164
|
-
featureType: 'water',
|
|
165
|
-
elementType: 'geometry',
|
|
166
|
-
stylers: [{
|
|
167
|
-
color: '#c9c9c9'
|
|
168
|
-
}]
|
|
169
|
-
}, {
|
|
170
|
-
featureType: 'water',
|
|
171
|
-
elementType: 'labels.text',
|
|
172
|
-
stylers: [{
|
|
173
|
-
visibility: 'off'
|
|
174
|
-
}]
|
|
175
|
-
}, {
|
|
176
|
-
featureType: 'water',
|
|
177
|
-
elementType: 'labels.text.fill',
|
|
178
|
-
stylers: [{
|
|
179
|
-
color: '#9e9e9e'
|
|
180
|
-
}]
|
|
181
|
-
}];
|
|
182
|
-
|
|
183
|
-
var eventsMapping = {
|
|
184
|
-
onClick: ['click', function (map) {
|
|
185
|
-
return map.getCenter();
|
|
186
|
-
}],
|
|
187
|
-
onCenterChanged: ['center_changed', function (map) {
|
|
188
|
-
return map.getCenter();
|
|
189
|
-
}],
|
|
190
|
-
onBoundsChanged: ['bounds_changed', function (map) {
|
|
191
|
-
return map.getBounds();
|
|
192
|
-
}],
|
|
193
|
-
onDragEnd: ['dragend', function (map) {
|
|
194
|
-
return map.getCenter();
|
|
195
|
-
}],
|
|
196
|
-
onTilesLoaded: ['tilesloaded', function () {}]
|
|
197
|
-
};
|
|
198
|
-
function useGoogleMap(_ref) {
|
|
199
|
-
var zoom = _ref.zoom,
|
|
200
|
-
_ref$maxZoom = _ref.maxZoom,
|
|
201
|
-
maxZoom = _ref$maxZoom === void 0 ? null : _ref$maxZoom,
|
|
202
|
-
_ref$center = _ref.center,
|
|
203
|
-
center = _ref$center === void 0 ? null : _ref$center,
|
|
204
|
-
_ref$withoutStyle = _ref.withoutStyle,
|
|
205
|
-
withoutStyle = _ref$withoutStyle === void 0 ? false : _ref$withoutStyle,
|
|
206
|
-
_ref$fitBounds = _ref.fitBounds,
|
|
207
|
-
fitBounds = _ref$fitBounds === void 0 ? false : _ref$fitBounds,
|
|
208
|
-
_ref$bounds = _ref.bounds,
|
|
209
|
-
bounds = _ref$bounds === void 0 ? null : _ref$bounds,
|
|
210
|
-
events = _ref.events,
|
|
211
|
-
_ref$draggable = _ref.draggable,
|
|
212
|
-
draggable = _ref$draggable === void 0 ? false : _ref$draggable,
|
|
213
|
-
zoomControl = _ref.zoomControl,
|
|
214
|
-
mapTypeControl = _ref.mapTypeControl,
|
|
215
|
-
scaleControl = _ref.scaleControl,
|
|
216
|
-
streetViewControl = _ref.streetViewControl,
|
|
217
|
-
rotateControl = _ref.rotateControl,
|
|
218
|
-
fullscreenControl = _ref.fullscreenControl;
|
|
219
|
-
var client = contexts.useGoogleMapsClient();
|
|
220
|
-
var _useState = React.useState(false),
|
|
221
|
-
_useState2 = _slicedToArray(_useState, 2),
|
|
222
|
-
ready = _useState2[0],
|
|
223
|
-
setReady = _useState2[1];
|
|
224
|
-
var containerRef = React.useRef(null);
|
|
225
|
-
var mapRef = React.useRef(null);
|
|
226
|
-
var _useDimensionObserver = hooks.useDimensionObserver(),
|
|
227
|
-
resizeRef = _useDimensionObserver.ref,
|
|
228
|
-
_useDimensionObserver2 = _useDimensionObserver.width,
|
|
229
|
-
width = _useDimensionObserver2 === void 0 ? null : _useDimensionObserver2,
|
|
230
|
-
_useDimensionObserver3 = _useDimensionObserver.height,
|
|
231
|
-
height = _useDimensionObserver3 === void 0 ? null : _useDimensionObserver3;
|
|
232
|
-
React.useEffect(function () {
|
|
233
|
-
var map = mapRef.current;
|
|
234
|
-
if (map !== null && center !== null) {
|
|
235
|
-
var _ref2 = center || {},
|
|
236
|
-
_ref2$lat = _ref2.lat,
|
|
237
|
-
lat = _ref2$lat === void 0 ? null : _ref2$lat,
|
|
238
|
-
_ref2$lng = _ref2.lng,
|
|
239
|
-
lng = _ref2$lng === void 0 ? null : _ref2$lng;
|
|
240
|
-
map.panTo({
|
|
241
|
-
lat: lat || 0,
|
|
242
|
-
lng: lng || 0
|
|
243
|
-
});
|
|
244
|
-
}
|
|
245
|
-
}, [center]);
|
|
246
|
-
React.useEffect(function () {
|
|
247
|
-
var map = mapRef.current;
|
|
248
|
-
if (map !== null && zoom !== null) {
|
|
249
|
-
map.setZoom(Math.min(maxZoom, zoom));
|
|
250
|
-
}
|
|
251
|
-
}, [zoom, maxZoom]);
|
|
252
|
-
var updateBounds = React.useCallback(function (map, newBounds) {
|
|
253
|
-
if (newBounds === null || newBounds.equals(map.getBounds())) {
|
|
254
|
-
return;
|
|
255
|
-
}
|
|
256
|
-
map.fitBounds(newBounds);
|
|
257
|
-
if (map.getZoom() > maxZoom) {
|
|
258
|
-
map.setZoom(maxZoom);
|
|
259
|
-
}
|
|
260
|
-
map.panToBounds(newBounds);
|
|
261
|
-
}, [maxZoom]);
|
|
262
|
-
React.useEffect(function () {
|
|
263
|
-
var map = mapRef.current;
|
|
264
|
-
if (map !== null && fitBounds) {
|
|
265
|
-
updateBounds(map, bounds);
|
|
266
|
-
}
|
|
267
|
-
}, [updateBounds, bounds, fitBounds, width, height]);
|
|
268
|
-
React.useEffect(function () {
|
|
269
|
-
var map = mapRef.current;
|
|
270
|
-
if (ready && map !== null) {
|
|
271
|
-
map.setOptions({
|
|
272
|
-
draggable: draggable,
|
|
273
|
-
scrollWheel: draggable,
|
|
274
|
-
disableDoubleClickZoom: !draggable,
|
|
275
|
-
gestureHandling: draggable ? 'cooperative' : 'none'
|
|
276
|
-
});
|
|
277
|
-
}
|
|
278
|
-
}, [ready, draggable]);
|
|
279
|
-
React.useEffect(function () {
|
|
280
|
-
if (client === null || containerRef.current === null || mapRef.current !== null) {
|
|
281
|
-
return function () {};
|
|
282
|
-
}
|
|
283
|
-
var map = new client.maps.Map(containerRef.current, {
|
|
284
|
-
zoom: zoom,
|
|
285
|
-
center: center,
|
|
286
|
-
styles: !withoutStyle ? styles$2 : null,
|
|
287
|
-
zoomControl: zoomControl,
|
|
288
|
-
mapTypeControl: mapTypeControl,
|
|
289
|
-
scaleControl: scaleControl,
|
|
290
|
-
streetViewControl: streetViewControl,
|
|
291
|
-
rotateControl: rotateControl,
|
|
292
|
-
fullscreenControl: fullscreenControl
|
|
293
|
-
});
|
|
294
|
-
if (fitBounds) {
|
|
295
|
-
updateBounds(map, bounds);
|
|
296
|
-
}
|
|
297
|
-
mapRef.current = map;
|
|
298
|
-
|
|
299
|
-
// @TODO unbind events
|
|
300
|
-
if (events !== null) {
|
|
301
|
-
Object.keys(events).forEach(function (eventName) {
|
|
302
|
-
if (events[eventName] !== null) {
|
|
303
|
-
map.addListener(eventsMapping[eventName][0], function () {
|
|
304
|
-
return events[eventName](eventsMapping[eventName][1](map));
|
|
305
|
-
});
|
|
306
|
-
}
|
|
307
|
-
});
|
|
308
|
-
}
|
|
309
|
-
setReady(true);
|
|
310
|
-
return function () {};
|
|
311
|
-
}, [client, setReady]);
|
|
312
|
-
var finalRef = React.useCallback(function (ref) {
|
|
313
|
-
resizeRef.current = ref;
|
|
314
|
-
containerRef.current = ref;
|
|
315
|
-
}, []);
|
|
316
|
-
return {
|
|
317
|
-
ref: finalRef,
|
|
318
|
-
map: mapRef.current,
|
|
319
|
-
ready: ready,
|
|
320
|
-
loading: !ready
|
|
321
|
-
};
|
|
322
|
-
}
|
|
323
|
-
|
|
324
|
-
var styles$1 = {"container":"micromag-element-map-container","map":"micromag-element-map-map","preventScroll":"micromag-element-map-preventScroll"};
|
|
325
|
-
|
|
326
|
-
var stopDragEventsPropagation = {
|
|
327
|
-
onTouchMove: function onTouchMove(e) {
|
|
328
|
-
return e.stopPropagation();
|
|
329
|
-
},
|
|
330
|
-
onTouchStart: function onTouchStart(e) {
|
|
331
|
-
return e.stopPropagation();
|
|
332
|
-
},
|
|
333
|
-
onTouchEnd: function onTouchEnd(e) {
|
|
334
|
-
return e.stopPropagation();
|
|
335
|
-
},
|
|
336
|
-
onPointerMove: function onPointerMove(e) {
|
|
337
|
-
return e.stopPropagation();
|
|
338
|
-
},
|
|
339
|
-
onPointerUp: function onPointerUp(e) {
|
|
340
|
-
return e.stopPropagation();
|
|
341
|
-
},
|
|
342
|
-
onPointerDown: function onPointerDown(e) {
|
|
343
|
-
return e.stopPropagation();
|
|
344
|
-
}
|
|
345
|
-
};
|
|
346
|
-
var propTypes$2 = {
|
|
347
|
-
center: PropTypes.shape({
|
|
348
|
-
lat: PropTypes.number,
|
|
349
|
-
lng: PropTypes.number
|
|
350
|
-
}),
|
|
351
|
-
zoom: PropTypes.number,
|
|
352
|
-
maxZoom: PropTypes.number,
|
|
353
|
-
bounds: PropTypes.object,
|
|
354
|
-
// eslint-disable-line
|
|
355
|
-
draggable: PropTypes.bool,
|
|
356
|
-
withoutStyle: PropTypes.bool,
|
|
357
|
-
// Global maps events
|
|
358
|
-
events: PropTypes.object,
|
|
359
|
-
// eslint-disable-line
|
|
360
|
-
fitBounds: PropTypes.bool,
|
|
361
|
-
zoomControl: PropTypes.bool,
|
|
362
|
-
mapTypeControl: PropTypes.bool,
|
|
363
|
-
scaleControl: PropTypes.bool,
|
|
364
|
-
streetViewControl: PropTypes.bool,
|
|
365
|
-
rotateControl: PropTypes.bool,
|
|
366
|
-
fullscreenControl: PropTypes.bool,
|
|
367
|
-
className: PropTypes.string,
|
|
368
|
-
children: PropTypes.node,
|
|
369
|
-
focusable: PropTypes.bool
|
|
370
|
-
};
|
|
371
|
-
var defaultProps$2 = {
|
|
372
|
-
center: null,
|
|
373
|
-
zoom: null,
|
|
374
|
-
maxZoom: 16,
|
|
375
|
-
bounds: null,
|
|
376
|
-
events: null,
|
|
377
|
-
fitBounds: false,
|
|
378
|
-
draggable: true,
|
|
379
|
-
withoutStyle: false,
|
|
380
|
-
zoomControl: false,
|
|
381
|
-
mapTypeControl: false,
|
|
382
|
-
scaleControl: false,
|
|
383
|
-
streetViewControl: false,
|
|
384
|
-
rotateControl: false,
|
|
385
|
-
fullscreenControl: false,
|
|
386
|
-
className: null,
|
|
387
|
-
children: null,
|
|
388
|
-
focusable: true
|
|
389
|
-
};
|
|
390
|
-
var Map$2 = function Map(_ref) {
|
|
391
|
-
var center = _ref.center,
|
|
392
|
-
zoom = _ref.zoom,
|
|
393
|
-
maxZoom = _ref.maxZoom,
|
|
394
|
-
bounds = _ref.bounds,
|
|
395
|
-
draggable = _ref.draggable,
|
|
396
|
-
withoutStyle = _ref.withoutStyle,
|
|
397
|
-
events = _ref.events,
|
|
398
|
-
fitBounds = _ref.fitBounds,
|
|
399
|
-
zoomControl = _ref.zoomControl,
|
|
400
|
-
mapTypeControl = _ref.mapTypeControl,
|
|
401
|
-
scaleControl = _ref.scaleControl,
|
|
402
|
-
streetViewControl = _ref.streetViewControl,
|
|
403
|
-
rotateControl = _ref.rotateControl,
|
|
404
|
-
fullscreenControl = _ref.fullscreenControl,
|
|
405
|
-
className = _ref.className,
|
|
406
|
-
children = _ref.children,
|
|
407
|
-
focusable = _ref.focusable;
|
|
408
|
-
var _useGoogleMap = useGoogleMap({
|
|
409
|
-
zoom: zoom,
|
|
410
|
-
maxZoom: maxZoom,
|
|
411
|
-
bounds: bounds,
|
|
412
|
-
draggable: draggable,
|
|
413
|
-
fitBounds: fitBounds,
|
|
414
|
-
center: center,
|
|
415
|
-
events: events,
|
|
416
|
-
withoutStyle: withoutStyle,
|
|
417
|
-
zoomControl: zoomControl,
|
|
418
|
-
mapTypeControl: mapTypeControl,
|
|
419
|
-
scaleControl: scaleControl,
|
|
420
|
-
streetViewControl: streetViewControl,
|
|
421
|
-
rotateControl: rotateControl,
|
|
422
|
-
fullscreenControl: fullscreenControl
|
|
423
|
-
}),
|
|
424
|
-
map = _useGoogleMap.map,
|
|
425
|
-
mapRef = _useGoogleMap.ref;
|
|
426
|
-
return /*#__PURE__*/React.createElement("div", Object.assign({
|
|
427
|
-
className: classNames([styles$1.container, _defineProperty(_defineProperty({}, className, className !== null), styles$1.preventScroll, !draggable)])
|
|
428
|
-
}, stopDragEventsPropagation), /*#__PURE__*/React.createElement("div", {
|
|
429
|
-
ref: mapRef,
|
|
430
|
-
className: styles$1.map,
|
|
431
|
-
tabIndex: focusable ? '0' : '-1'
|
|
432
|
-
}), React.Children.map(children, function (child) {
|
|
433
|
-
return /*#__PURE__*/React.cloneElement(child, {
|
|
434
|
-
map: map
|
|
435
|
-
});
|
|
436
|
-
}));
|
|
437
|
-
};
|
|
438
|
-
Map$2.propTypes = propTypes$2;
|
|
439
|
-
Map$2.defaultProps = defaultProps$2;
|
|
440
|
-
var GoogleMap = Map$2;
|
|
441
|
-
|
|
442
|
-
var eventMapping = {
|
|
443
|
-
onClick: 'click',
|
|
444
|
-
onDoubleClick: 'dblclick'
|
|
445
|
-
};
|
|
446
|
-
function useGoogleMapMarker(map) {
|
|
447
|
-
var _ref = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {},
|
|
448
|
-
_ref$position = _ref.position,
|
|
449
|
-
position = _ref$position === void 0 ? null : _ref$position,
|
|
450
|
-
_ref$icon = _ref.icon,
|
|
451
|
-
icon = _ref$icon === void 0 ? null : _ref$icon,
|
|
452
|
-
_ref$iconSize = _ref.iconSize,
|
|
453
|
-
iconSize = _ref$iconSize === void 0 ? null : _ref$iconSize,
|
|
454
|
-
events = _ref.events,
|
|
455
|
-
title = _ref.title;
|
|
456
|
-
var client = contexts.useGoogleMapsClient();
|
|
457
|
-
var markerRef = React.useRef(null);
|
|
458
|
-
React.useEffect(function () {
|
|
459
|
-
var marker = markerRef.current;
|
|
460
|
-
if (marker !== null && position !== null) {
|
|
461
|
-
marker.setPosition(position);
|
|
462
|
-
}
|
|
463
|
-
}, [position]);
|
|
464
|
-
var updateIcon = React.useCallback(function (marker, newIcon) {
|
|
465
|
-
if (client === null) {
|
|
466
|
-
return;
|
|
467
|
-
}
|
|
468
|
-
if (isObject(newIcon)) {
|
|
469
|
-
var _ref2 = newIcon || {},
|
|
470
|
-
_ref2$url = _ref2.url,
|
|
471
|
-
iconUrl = _ref2$url === void 0 ? null : _ref2$url;
|
|
472
|
-
marker.setIcon({
|
|
473
|
-
url: iconUrl,
|
|
474
|
-
scaledSize: new client.maps.Size(iconSize.width, iconSize.height)
|
|
475
|
-
});
|
|
476
|
-
} else {
|
|
477
|
-
marker.setIcon(newIcon);
|
|
478
|
-
}
|
|
479
|
-
}, [client, iconSize]);
|
|
480
|
-
React.useEffect(function () {
|
|
481
|
-
var marker = markerRef.current;
|
|
482
|
-
if (marker === null || client === null) {
|
|
483
|
-
return;
|
|
484
|
-
}
|
|
485
|
-
updateIcon(marker, icon);
|
|
486
|
-
}, [client, icon, updateIcon]);
|
|
487
|
-
React.useEffect(function () {
|
|
488
|
-
if (client === null || map === null || markerRef.current !== null) {
|
|
489
|
-
return function () {};
|
|
490
|
-
}
|
|
491
|
-
var marker = new client.maps.Marker({
|
|
492
|
-
position: position,
|
|
493
|
-
map: map,
|
|
494
|
-
title: title
|
|
495
|
-
});
|
|
496
|
-
updateIcon(marker, icon);
|
|
497
|
-
Object.keys(events).forEach(function (eventName) {
|
|
498
|
-
marker.addListener(eventMapping[eventName], events[eventName]);
|
|
499
|
-
});
|
|
500
|
-
markerRef.current = marker;
|
|
501
|
-
return function () {
|
|
502
|
-
client.maps.event.clearInstanceListeners(marker);
|
|
503
|
-
marker.setMap(null);
|
|
504
|
-
};
|
|
505
|
-
}, [client, map]);
|
|
506
|
-
return markerRef.current;
|
|
507
|
-
}
|
|
508
|
-
|
|
509
|
-
var Pin = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABsAAAArCAYAAACJrvP4AAAC+ElEQVR4AWIgBP7//88DxCGAWssB1pIkCsO1iLG27WCtYG17x3Ywtm3bthlNMLZtz/NrXvStM/cbP/Vln6RSOfq/xqlOi2nO10bxUe26RRKLRdnxiZOnTqVpQO6NOc5AiYSd6O4dRcbAnlJQv4rk/fWt5HzzkbDjEydPHfX0pQr6Q4dcI7RqqZP7Z1z8i/cSLuqop4/+ZCB3iOt214UFVkG9SoikvOijHx1fGAXeqWNm7u9f0Zj2oh+dCoHcOlfkA0oZiB66ZYaBZ53uo/N7pOiWGBqmyF21xKEg24uhQf/mOWJsmaYgYOiiDwfYn5yTRE2X42vNWy/KyKcelZ6PPMCOTzwhEH04ii8ABzMRaNwzj0uXB+8rs4gnAqIPR/HJ4UvgV8wdlICUXOR9+9GHo/jG8enxK+aR+cDI+/ajD0eJ50Vzvv3Yt5h35Acj79ePPhylbetyXuVfA70z9OEoXVy0pbBl40DfGfpwVMy1R1kTRnpBTqM1cZQHh3P2Tiwv1wzynKEPR2HaNI4VNmsQyBcE3bj+UTgYE1kncm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NgZN0yCEgKZpGBsbCy17ADh//nxbSnlXENFSu93+MDo6GltdXQ0MyuVyobM4qNHRUUQikQYRLTEAkFLeNgxjq68sPcowjC1VVW8D3SuGMfYgmUx+Gh8fHyhofHwcqVRqE0B5F0ZEjpTyy5mZmS3O+UBAnHPMzMxsRSKRr4jI2YV1gU+llH8YhmENAmYYhiWl/J2Inu70sb0OiqLMFwoFK2zfhCmZTKJQKFiKonyxt38fjIganPOFUqkUfFiGqFQqmZzzBSLadxuzg46c83u6ri8Xi0Xnc0DFYtHRdX2Zc37voO0/MABQFOWyYRjbYWfmQcXjcRiGsa0oyuXD7IfCiGhVCHFrbm6ur+Wcm5szhRC3iOjQ0+FQGAAwxu5kMpkPExMTPYEmJiaQyWQ+MMbuHJnzKEN3712bnZ1tCSECQUIIzM7OtqSU13b2VF+wLvAl5/z51NRUYLFMTU05nPPnRPQyyC8QBgBSyhvT09OOqqqH2lVVxfT0tCOlvBGWKxRGRG8cx3k2OTl56J03OTnpOo7zjIjeHBsGAKqqflMsFrcZ2+/OGEOxWNxWVfWbXvL0BCOivwC8OliZ3farrn0wMABQVfXhuXPn9r0K8/l8U1XVh73m6BkG4EkulxNE/z7piAjZbFYAeDJwGBF9dF33bTqdBgCk02m4rvuWiD4OHNZVJZVKAQC630o/wX3BFEV5r2maDwCapvmKorz/32BEVNd1vQ0Auq63iSj4RXIcGIB32WzW1jQN2WzWBvCuz/je5fs+63Q6j13XbXc6nce+7/c12H8A3aa8zLNKuWMAAAAASUVORK5CYII=";
|
|
512
|
-
|
|
513
|
-
var propTypes$1 = {
|
|
514
|
-
// map: PropTypes.object.isRequired, // eslint-disable-line
|
|
515
|
-
map: PropTypes.object,
|
|
516
|
-
// eslint-disable-line
|
|
517
|
-
position: PropTypes.shape({
|
|
518
|
-
lat: PropTypes.number,
|
|
519
|
-
lng: PropTypes.number
|
|
520
|
-
}).isRequired,
|
|
521
|
-
type: PropTypes.string,
|
|
522
|
-
// .isRequired,
|
|
523
|
-
events: PropTypes.object,
|
|
524
|
-
// eslint-disable-line
|
|
525
|
-
active: PropTypes.bool,
|
|
526
|
-
title: PropTypes.string,
|
|
527
|
-
image: core.PropTypes.imageMedia,
|
|
528
|
-
iconSize: PropTypes.shape({
|
|
529
|
-
width: PropTypes.number,
|
|
530
|
-
height: PropTypes.number
|
|
531
|
-
})
|
|
532
|
-
};
|
|
533
|
-
var defaultProps$1 = {
|
|
534
|
-
map: null,
|
|
535
|
-
events: null,
|
|
536
|
-
active: true,
|
|
537
|
-
title: null,
|
|
538
|
-
image: null,
|
|
539
|
-
iconSize: {
|
|
540
|
-
width: 50,
|
|
541
|
-
height: 50
|
|
542
|
-
}
|
|
543
|
-
};
|
|
544
|
-
var Marker = function Marker(_ref) {
|
|
545
|
-
var map = _ref.map,
|
|
546
|
-
position = _ref.position,
|
|
547
|
-
type = _ref.type,
|
|
548
|
-
events = _ref.events,
|
|
549
|
-
active = _ref.active,
|
|
550
|
-
title = _ref.title,
|
|
551
|
-
image = _ref.image,
|
|
552
|
-
iconSize = _ref.iconSize;
|
|
553
|
-
useGoogleMapMarker(map, {
|
|
554
|
-
position: position,
|
|
555
|
-
type: type,
|
|
556
|
-
events: events,
|
|
557
|
-
title: title,
|
|
558
|
-
icon: image || (active ? Pin : PinInactive),
|
|
559
|
-
iconSize: iconSize
|
|
560
|
-
});
|
|
561
|
-
return null;
|
|
562
|
-
};
|
|
563
|
-
Marker.propTypes = propTypes$1;
|
|
564
|
-
Marker.defaultProps = defaultProps$1;
|
|
565
|
-
var Marker$1 = Marker;
|
|
566
|
-
|
|
567
|
-
var styles = {"container":"micromag-element-map-container"};
|
|
568
|
-
|
|
569
|
-
var propTypes = {
|
|
570
|
-
center: PropTypes.shape({
|
|
571
|
-
lat: PropTypes.number,
|
|
572
|
-
lng: PropTypes.number
|
|
573
|
-
}),
|
|
574
|
-
zoom: PropTypes.number,
|
|
575
|
-
draggable: PropTypes.bool,
|
|
576
|
-
markers: PropTypes.arrayOf(PropTypes.object),
|
|
577
|
-
// eslint-disable-line react/forbid-prop-types
|
|
578
|
-
onClickMap: PropTypes.func,
|
|
579
|
-
onClickMarker: PropTypes.func,
|
|
580
|
-
className: PropTypes.string,
|
|
581
|
-
onReady: PropTypes.func,
|
|
582
|
-
onCenterChanged: PropTypes.func,
|
|
583
|
-
onBoundsChanged: PropTypes.func,
|
|
584
|
-
onDrag: PropTypes.func,
|
|
585
|
-
onDragEnd: PropTypes.func,
|
|
586
|
-
withoutStyle: PropTypes.bool,
|
|
587
|
-
fitBounds: PropTypes.bool,
|
|
588
|
-
zoomControl: PropTypes.bool,
|
|
589
|
-
mapTypeControl: PropTypes.bool,
|
|
590
|
-
scaleControl: PropTypes.bool,
|
|
591
|
-
streetViewControl: PropTypes.bool,
|
|
592
|
-
rotateControl: PropTypes.bool,
|
|
593
|
-
fullscreenControl: PropTypes.bool,
|
|
594
|
-
focusable: PropTypes.bool
|
|
595
|
-
};
|
|
596
|
-
var defaultProps = {
|
|
597
|
-
center: null,
|
|
598
|
-
zoom: null,
|
|
599
|
-
draggable: true,
|
|
600
|
-
markers: [],
|
|
601
|
-
onClickMap: null,
|
|
602
|
-
onClickMarker: null,
|
|
603
|
-
className: null,
|
|
604
|
-
onReady: null,
|
|
605
|
-
onCenterChanged: null,
|
|
606
|
-
onBoundsChanged: null,
|
|
607
|
-
onDrag: null,
|
|
608
|
-
onDragEnd: null,
|
|
609
|
-
withoutStyle: false,
|
|
610
|
-
fitBounds: false,
|
|
611
|
-
zoomControl: false,
|
|
612
|
-
mapTypeControl: false,
|
|
613
|
-
scaleControl: false,
|
|
614
|
-
streetViewControl: false,
|
|
615
|
-
rotateControl: false,
|
|
616
|
-
fullscreenControl: false,
|
|
617
|
-
focusable: true
|
|
618
|
-
};
|
|
619
|
-
var Map = function Map(_ref) {
|
|
620
|
-
var center = _ref.center,
|
|
621
|
-
zoom = _ref.zoom,
|
|
622
|
-
draggable = _ref.draggable,
|
|
623
|
-
markers = _ref.markers,
|
|
624
|
-
onClickMap = _ref.onClickMap,
|
|
625
|
-
onClickMarker = _ref.onClickMarker,
|
|
626
|
-
className = _ref.className,
|
|
627
|
-
onReady = _ref.onReady,
|
|
628
|
-
onCenterChanged = _ref.onCenterChanged,
|
|
629
|
-
onBoundsChanged = _ref.onBoundsChanged,
|
|
630
|
-
onDrag = _ref.onDrag,
|
|
631
|
-
onDragEnd = _ref.onDragEnd,
|
|
632
|
-
withoutStyle = _ref.withoutStyle,
|
|
633
|
-
fitBounds = _ref.fitBounds,
|
|
634
|
-
zoomControl = _ref.zoomControl,
|
|
635
|
-
mapTypeControl = _ref.mapTypeControl,
|
|
636
|
-
scaleControl = _ref.scaleControl,
|
|
637
|
-
streetViewControl = _ref.streetViewControl,
|
|
638
|
-
rotateControl = _ref.rotateControl,
|
|
639
|
-
fullscreenControl = _ref.fullscreenControl,
|
|
640
|
-
focusable = _ref.focusable;
|
|
641
|
-
var client = contexts.useGoogleMapsClient();
|
|
642
|
-
var onClick = React.useCallback(function (position) {
|
|
643
|
-
if (onClickMap !== null) {
|
|
644
|
-
onClickMap(position);
|
|
645
|
-
}
|
|
646
|
-
}, [onClickMap]);
|
|
647
|
-
var bounds = React.useMemo(function () {
|
|
648
|
-
var correctMarkers = (markers || []).filter(function (it) {
|
|
649
|
-
return it !== null && (it.geoPosition || null) !== null;
|
|
650
|
-
});
|
|
651
|
-
if (client === null || correctMarkers === null || correctMarkers.length === 0) {
|
|
652
|
-
return null;
|
|
653
|
-
}
|
|
654
|
-
var markersBounds = correctMarkers.reduce(function (newBounds, _ref2) {
|
|
655
|
-
var _ref2$geoPosition = _ref2.geoPosition,
|
|
656
|
-
geoPosition = _ref2$geoPosition === void 0 ? null : _ref2$geoPosition;
|
|
657
|
-
var _ref3 = geoPosition || {},
|
|
658
|
-
_ref3$lat = _ref3.lat,
|
|
659
|
-
lat = _ref3$lat === void 0 ? null : _ref3$lat,
|
|
660
|
-
_ref3$lng = _ref3.lng,
|
|
661
|
-
lng = _ref3$lng === void 0 ? null : _ref3$lng;
|
|
662
|
-
if (lat !== null && lng !== null) {
|
|
663
|
-
newBounds.extend(new client.maps.LatLng(lat, lng));
|
|
664
|
-
}
|
|
665
|
-
return newBounds;
|
|
666
|
-
}, new client.maps.LatLngBounds());
|
|
667
|
-
return markersBounds;
|
|
668
|
-
}, [client, markers]);
|
|
669
|
-
var _useState = React.useState(false),
|
|
670
|
-
_useState2 = _slicedToArray(_useState, 2),
|
|
671
|
-
loaded = _useState2[0],
|
|
672
|
-
setLoaded = _useState2[1];
|
|
673
|
-
React.useEffect(function () {
|
|
674
|
-
if (client !== null && loaded) {
|
|
675
|
-
if (onReady !== null) {
|
|
676
|
-
onReady(client);
|
|
677
|
-
}
|
|
678
|
-
}
|
|
679
|
-
}, [client, loaded, onReady]);
|
|
680
|
-
var onTilesLoaded = React.useCallback(function () {
|
|
681
|
-
return setLoaded(true);
|
|
682
|
-
}, [setLoaded]);
|
|
683
|
-
var events = React.useMemo(function () {
|
|
684
|
-
return {
|
|
685
|
-
onClick: onClick,
|
|
686
|
-
onCenterChanged: onCenterChanged,
|
|
687
|
-
onBoundsChanged: onBoundsChanged,
|
|
688
|
-
onDrag: onDrag,
|
|
689
|
-
onDragEnd: onDragEnd,
|
|
690
|
-
onTilesLoaded: onTilesLoaded
|
|
691
|
-
};
|
|
692
|
-
}, [onClick, onCenterChanged, onBoundsChanged, onDrag, onDragEnd, onTilesLoaded]);
|
|
693
|
-
return /*#__PURE__*/React.createElement("div", {
|
|
694
|
-
className: classNames([styles.container, _defineProperty({}, className, className !== null)])
|
|
695
|
-
}, /*#__PURE__*/React.createElement(GoogleMap, {
|
|
696
|
-
center: center,
|
|
697
|
-
zoom: zoom,
|
|
698
|
-
withoutStyle: withoutStyle,
|
|
699
|
-
bounds: bounds,
|
|
700
|
-
draggable: draggable,
|
|
701
|
-
events: events,
|
|
702
|
-
fitBounds: fitBounds,
|
|
703
|
-
zoomControl: zoomControl,
|
|
704
|
-
mapTypeControl: mapTypeControl,
|
|
705
|
-
scaleControl: scaleControl,
|
|
706
|
-
streetViewControl: streetViewControl,
|
|
707
|
-
rotateControl: rotateControl,
|
|
708
|
-
fullscreenControl: fullscreenControl,
|
|
709
|
-
focusable: focusable
|
|
710
|
-
}, markers !== null ? markers.map(function (_ref5, index) {
|
|
711
|
-
var _ref5$active = _ref5.active,
|
|
712
|
-
active = _ref5$active === void 0 ? true : _ref5$active,
|
|
713
|
-
_ref5$geoPosition = _ref5.geoPosition,
|
|
714
|
-
geoPosition = _ref5$geoPosition === void 0 ? null : _ref5$geoPosition,
|
|
715
|
-
_ref5$image = _ref5.image,
|
|
716
|
-
image = _ref5$image === void 0 ? null : _ref5$image,
|
|
717
|
-
_ref5$title = _ref5.title,
|
|
718
|
-
title = _ref5$title === void 0 ? null : _ref5$title;
|
|
719
|
-
return geoPosition !== null && (geoPosition.lat || null) !== null && (geoPosition.lng || null) !== null ? /*#__PURE__*/React.createElement(Marker$1, {
|
|
720
|
-
key: "marker-".concat(index),
|
|
721
|
-
active: active,
|
|
722
|
-
title: title !== null && _typeof(title.body) ? title.body : null,
|
|
723
|
-
image: image,
|
|
724
|
-
position: geoPosition,
|
|
725
|
-
events: {
|
|
726
|
-
onClick: onClickMarker !== null ? function (e) {
|
|
727
|
-
return onClickMarker(e, index);
|
|
728
|
-
} : function () {
|
|
729
|
-
return console.log(index);
|
|
730
|
-
} // eslint-disable-line no-console
|
|
731
|
-
}
|
|
732
|
-
}) : /*#__PURE__*/React.createElement("div", null);
|
|
733
|
-
}) : null));
|
|
734
|
-
};
|
|
735
|
-
Map.propTypes = propTypes;
|
|
736
|
-
Map.defaultProps = defaultProps;
|
|
737
|
-
var Map$1 = Map;
|
|
738
|
-
|
|
739
|
-
exports.Pin = Pin;
|
|
740
|
-
exports.default = Map$1;
|