@micromag/screen-map 0.2.412 → 0.3.3
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/assets/css/styles.css +1 -1
- package/es/index.js +382 -269
- package/lib/index.js +386 -273
- package/package.json +13 -13
package/lib/index.js
CHANGED
|
@@ -6,22 +6,22 @@ var reactIntl = require('react-intl');
|
|
|
6
6
|
var _defineProperty = require('@babel/runtime/helpers/defineProperty');
|
|
7
7
|
var _objectSpread = require('@babel/runtime/helpers/objectSpread2');
|
|
8
8
|
var _slicedToArray = require('@babel/runtime/helpers/slicedToArray');
|
|
9
|
-
var React = require('react');
|
|
10
|
-
var PropTypes = require('prop-types');
|
|
11
9
|
var classNames = require('classnames');
|
|
10
|
+
var PropTypes = require('prop-types');
|
|
11
|
+
var React = require('react');
|
|
12
12
|
var core = require('@micromag/core');
|
|
13
|
-
var contexts = require('@micromag/core/contexts');
|
|
14
13
|
var components = require('@micromag/core/components');
|
|
14
|
+
var contexts = require('@micromag/core/contexts');
|
|
15
15
|
var hooks = require('@micromag/core/hooks');
|
|
16
16
|
var utils = require('@micromag/core/utils');
|
|
17
17
|
var elementBackground = require('@micromag/element-background');
|
|
18
|
+
var ButtonElement = require('@micromag/element-button');
|
|
18
19
|
var Container = require('@micromag/element-container');
|
|
19
|
-
var Map = require('@micromag/element-map');
|
|
20
20
|
var Heading = require('@micromag/element-heading');
|
|
21
|
+
var ImageElement = require('@micromag/element-image');
|
|
22
|
+
var Map = require('@micromag/element-map');
|
|
21
23
|
var Scroll = require('@micromag/element-scroll');
|
|
22
24
|
var Text = require('@micromag/element-text');
|
|
23
|
-
var ImageElement = require('@micromag/element-image');
|
|
24
|
-
var ButtonElement = require('@micromag/element-button');
|
|
25
25
|
var _extends = require('@babel/runtime/helpers/extends');
|
|
26
26
|
var _toConsumableArray = require('@babel/runtime/helpers/toConsumableArray');
|
|
27
27
|
var appleNews = require('@micromag/transforms/apple-news');
|
|
@@ -31,16 +31,16 @@ function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'defau
|
|
|
31
31
|
var _defineProperty__default = /*#__PURE__*/_interopDefaultLegacy(_defineProperty);
|
|
32
32
|
var _objectSpread__default = /*#__PURE__*/_interopDefaultLegacy(_objectSpread);
|
|
33
33
|
var _slicedToArray__default = /*#__PURE__*/_interopDefaultLegacy(_slicedToArray);
|
|
34
|
-
var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
|
|
35
|
-
var PropTypes__default = /*#__PURE__*/_interopDefaultLegacy(PropTypes);
|
|
36
34
|
var classNames__default = /*#__PURE__*/_interopDefaultLegacy(classNames);
|
|
35
|
+
var PropTypes__default = /*#__PURE__*/_interopDefaultLegacy(PropTypes);
|
|
36
|
+
var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
|
|
37
|
+
var ButtonElement__default = /*#__PURE__*/_interopDefaultLegacy(ButtonElement);
|
|
37
38
|
var Container__default = /*#__PURE__*/_interopDefaultLegacy(Container);
|
|
38
|
-
var Map__default = /*#__PURE__*/_interopDefaultLegacy(Map);
|
|
39
39
|
var Heading__default = /*#__PURE__*/_interopDefaultLegacy(Heading);
|
|
40
|
+
var ImageElement__default = /*#__PURE__*/_interopDefaultLegacy(ImageElement);
|
|
41
|
+
var Map__default = /*#__PURE__*/_interopDefaultLegacy(Map);
|
|
40
42
|
var Scroll__default = /*#__PURE__*/_interopDefaultLegacy(Scroll);
|
|
41
43
|
var Text__default = /*#__PURE__*/_interopDefaultLegacy(Text);
|
|
42
|
-
var ImageElement__default = /*#__PURE__*/_interopDefaultLegacy(ImageElement);
|
|
43
|
-
var ButtonElement__default = /*#__PURE__*/_interopDefaultLegacy(ButtonElement);
|
|
44
44
|
var _extends__default = /*#__PURE__*/_interopDefaultLegacy(_extends);
|
|
45
45
|
var _toConsumableArray__default = /*#__PURE__*/_interopDefaultLegacy(_toConsumableArray);
|
|
46
46
|
|
|
@@ -60,6 +60,9 @@ var propTypes = {
|
|
|
60
60
|
button: core.PropTypes.textElement,
|
|
61
61
|
openedMarkerSpacerHeight: PropTypes__default["default"].number,
|
|
62
62
|
withMarkerImages: PropTypes__default["default"].bool,
|
|
63
|
+
center: core.PropTypes.geoPosition,
|
|
64
|
+
zoom: PropTypes__default["default"].number,
|
|
65
|
+
fitBounds: PropTypes__default["default"].bool,
|
|
63
66
|
background: core.PropTypes.backgroundElement,
|
|
64
67
|
current: PropTypes__default["default"].bool,
|
|
65
68
|
active: PropTypes__default["default"].bool,
|
|
@@ -73,6 +76,9 @@ var defaultProps = {
|
|
|
73
76
|
layout: 'normal',
|
|
74
77
|
draggable: true,
|
|
75
78
|
markers: [],
|
|
79
|
+
center: defaultCenter,
|
|
80
|
+
zoom: defaultZoom,
|
|
81
|
+
fitBounds: true,
|
|
76
82
|
title: null,
|
|
77
83
|
description: null,
|
|
78
84
|
button: null,
|
|
@@ -88,8 +94,8 @@ var defaultProps = {
|
|
|
88
94
|
className: null
|
|
89
95
|
};
|
|
90
96
|
|
|
91
|
-
|
|
92
|
-
var
|
|
97
|
+
function MapScreen(_ref) {
|
|
98
|
+
var _ref16;
|
|
93
99
|
|
|
94
100
|
var layout = _ref.layout,
|
|
95
101
|
draggable = _ref.draggable,
|
|
@@ -99,6 +105,9 @@ var MapScreen = function MapScreen(_ref) {
|
|
|
99
105
|
button = _ref.button,
|
|
100
106
|
openedMarkerSpacerHeight = _ref.openedMarkerSpacerHeight,
|
|
101
107
|
withMarkerImages = _ref.withMarkerImages,
|
|
108
|
+
zoom = _ref.zoom,
|
|
109
|
+
center = _ref.center,
|
|
110
|
+
fitBounds = _ref.fitBounds,
|
|
102
111
|
background = _ref.background,
|
|
103
112
|
current = _ref.current,
|
|
104
113
|
active = _ref.active,
|
|
@@ -142,6 +151,8 @@ var MapScreen = function MapScreen(_ref) {
|
|
|
142
151
|
isStatic = _useScreenRenderConte.isStatic,
|
|
143
152
|
isCapture = _useScreenRenderConte.isCapture;
|
|
144
153
|
|
|
154
|
+
var screenState = contexts.useScreenState();
|
|
155
|
+
|
|
145
156
|
var _useState3 = React.useState(false),
|
|
146
157
|
_useState4 = _slicedToArray__default["default"](_useState3, 2),
|
|
147
158
|
ready = _useState4[0],
|
|
@@ -208,8 +219,8 @@ var MapScreen = function MapScreen(_ref) {
|
|
|
208
219
|
trackScreenEvent('click_close', 'Close icon');
|
|
209
220
|
closeMarker();
|
|
210
221
|
}, [setOpened, onEnableInteraction, trackScreenEvent]);
|
|
211
|
-
var onMapDragEnd = React.useCallback(function (
|
|
212
|
-
var coords =
|
|
222
|
+
var onMapDragEnd = React.useCallback(function (newCenter) {
|
|
223
|
+
var coords = newCenter.toJSON();
|
|
213
224
|
trackScreenEvent('drag_map', "Latitude: ".concat(coords.lat.toFixed(4), ", Longitude: ").concat(coords.lng.toFixed(4)), {
|
|
214
225
|
coords: coords
|
|
215
226
|
});
|
|
@@ -283,211 +294,111 @@ var MapScreen = function MapScreen(_ref) {
|
|
|
283
294
|
}
|
|
284
295
|
|
|
285
296
|
return function () {};
|
|
286
|
-
}, [withMarkerImages, markers]);
|
|
287
|
-
var element = null;
|
|
297
|
+
}, [withMarkerImages, markers]); // Switch state
|
|
288
298
|
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
});
|
|
294
|
-
} else if (isPreview) {
|
|
295
|
-
if (width > 0 && height > 0 && apiKey !== null) {
|
|
296
|
-
var staticUrl = "https://maps.googleapis.com/maps/api/staticmap?size=".concat(Math.round(width), "x").concat(Math.round(height));
|
|
297
|
-
|
|
298
|
-
if (defaultCenter !== null && (markers === null || markers.length === 0)) {
|
|
299
|
-
var _ref7 = defaultCenter || {},
|
|
300
|
-
_ref7$lat = _ref7.lat,
|
|
301
|
-
lat = _ref7$lat === void 0 ? null : _ref7$lat,
|
|
302
|
-
_ref7$lng = _ref7.lng,
|
|
303
|
-
lng = _ref7$lng === void 0 ? null : _ref7$lng;
|
|
304
|
-
|
|
305
|
-
staticUrl += "¢er=".concat(lat, ",").concat(lng);
|
|
306
|
-
}
|
|
299
|
+
React.useEffect(function () {
|
|
300
|
+
if (!isEdit && !isPreview) {
|
|
301
|
+
return;
|
|
302
|
+
}
|
|
307
303
|
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
304
|
+
var _ref7 = screenState !== null ? screenState.split('.') : [],
|
|
305
|
+
_ref8 = _slicedToArray__default["default"](_ref7, 2),
|
|
306
|
+
_ref8$ = _ref8[0],
|
|
307
|
+
stateId = _ref8$ === void 0 ? null : _ref8$,
|
|
308
|
+
_ref8$2 = _ref8[1],
|
|
309
|
+
markerIndex = _ref8$2 === void 0 ? null : _ref8$2;
|
|
310
|
+
|
|
311
|
+
if (stateId === 'intro') {
|
|
312
|
+
setOpened(false);
|
|
313
|
+
setSelectedMarkerIndex(null);
|
|
314
|
+
} else if (stateId === 'map') {
|
|
315
|
+
setOpened(true);
|
|
316
|
+
setSelectedMarkerIndex(null);
|
|
317
|
+
} else if (stateId === 'markers') {
|
|
318
|
+
setOpened(true);
|
|
319
|
+
setSelectedMarkerIndex(parseInt(markerIndex, 10));
|
|
320
|
+
}
|
|
321
|
+
}, [screenState, isEdit, setOpened]);
|
|
322
|
+
var staticUrl;
|
|
323
|
+
|
|
324
|
+
if (width > 0 && height > 0 && apiKey !== null) {
|
|
325
|
+
var correctMarkers = markers !== null ? markers.filter(function (it) {
|
|
326
|
+
return it !== null;
|
|
327
|
+
}).filter(function (_ref9) {
|
|
328
|
+
var _ref9$geoPosition = _ref9.geoPosition,
|
|
329
|
+
geoPosition = _ref9$geoPosition === void 0 ? null : _ref9$geoPosition;
|
|
330
|
+
return geoPosition !== null;
|
|
331
|
+
}) : null;
|
|
332
|
+
staticUrl = "https://maps.googleapis.com/maps/api/staticmap?size=".concat(Math.round(width), "x").concat(Math.round(height));
|
|
333
|
+
|
|
334
|
+
if (center !== null && (correctMarkers === null || correctMarkers.length === 0)) {
|
|
335
|
+
var _ref10 = center || {},
|
|
336
|
+
_ref10$lat = _ref10.lat,
|
|
337
|
+
lat = _ref10$lat === void 0 ? null : _ref10$lat,
|
|
338
|
+
_ref10$lng = _ref10.lng,
|
|
339
|
+
lng = _ref10$lng === void 0 ? null : _ref10$lng;
|
|
340
|
+
|
|
341
|
+
staticUrl += "¢er=".concat(lat, ",").concat(lng);
|
|
342
|
+
}
|
|
311
343
|
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
344
|
+
if (zoom !== null) {
|
|
345
|
+
staticUrl += "&zoom=".concat(zoom);
|
|
346
|
+
}
|
|
315
347
|
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
348
|
+
if (apiKey !== null) {
|
|
349
|
+
staticUrl += "&key=".concat(apiKey);
|
|
350
|
+
}
|
|
319
351
|
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
_ref8$geoPosition = _ref8.geoPosition,
|
|
324
|
-
geoPosition = _ref8$geoPosition === void 0 ? null : _ref8$geoPosition;
|
|
352
|
+
if (locale !== null) {
|
|
353
|
+
staticUrl += "&language=".concat(locale);
|
|
354
|
+
}
|
|
325
355
|
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
356
|
+
if (correctMarkers !== null) {
|
|
357
|
+
staticUrl += correctMarkers.map(function (marker) {
|
|
358
|
+
var _ref11 = marker || {},
|
|
359
|
+
_ref11$geoPosition = _ref11.geoPosition,
|
|
360
|
+
geoPosition = _ref11$geoPosition === void 0 ? null : _ref11$geoPosition;
|
|
331
361
|
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
362
|
+
var _ref12 = geoPosition || {},
|
|
363
|
+
_ref12$lat = _ref12.lat,
|
|
364
|
+
lat = _ref12$lat === void 0 ? null : _ref12$lat,
|
|
365
|
+
_ref12$lng = _ref12.lng,
|
|
366
|
+
lng = _ref12$lng === void 0 ? null : _ref12$lng;
|
|
335
367
|
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
368
|
+
var _ref13 = marker || {},
|
|
369
|
+
_ref13$image = _ref13.image,
|
|
370
|
+
image = _ref13$image === void 0 ? null : _ref13$image;
|
|
339
371
|
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
372
|
+
var _ref14 = image || {},
|
|
373
|
+
_ref14$url = _ref14.url,
|
|
374
|
+
url = _ref14$url === void 0 ? null : _ref14$url;
|
|
343
375
|
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
url: staticUrl,
|
|
347
|
-
metadata: {
|
|
348
|
-
width: Math.min(640, width),
|
|
349
|
-
height: Math.min(640, height)
|
|
350
|
-
}
|
|
351
|
-
},
|
|
352
|
-
width: width,
|
|
353
|
-
height: height,
|
|
354
|
-
objectFit: {
|
|
355
|
-
fit: 'cover'
|
|
356
|
-
}
|
|
357
|
-
});
|
|
376
|
+
return lat !== null && lng !== null ? "&markers=".concat(url !== null ? "icon:".concat(url) : '', "%7C").concat(lat, ",").concat(lng) : '';
|
|
377
|
+
}).join('');
|
|
358
378
|
}
|
|
359
|
-
} else {
|
|
360
|
-
var renderedMarker = hasSelectedMarker ? finalMarkers[selectedMarkerIndex] : lastRenderedMarker.current;
|
|
361
|
-
|
|
362
|
-
var _ref12 = renderedMarker || {},
|
|
363
|
-
_ref12$title = _ref12.title,
|
|
364
|
-
markerTitle = _ref12$title === void 0 ? null : _ref12$title,
|
|
365
|
-
_ref12$subtitle = _ref12.subtitle,
|
|
366
|
-
markerSubtitle = _ref12$subtitle === void 0 ? null : _ref12$subtitle,
|
|
367
|
-
_ref12$description = _ref12.description,
|
|
368
|
-
markerDescription = _ref12$description === void 0 ? null : _ref12$description,
|
|
369
|
-
_ref12$image = _ref12.image,
|
|
370
|
-
markerImage = _ref12$image === void 0 ? null : _ref12$image;
|
|
371
|
-
|
|
372
|
-
var hasMarkerTitle = markerTitle !== null;
|
|
373
|
-
var hasMarkerSubtitle = markerSubtitle !== null;
|
|
374
|
-
var hasMarkerDescription = markerDescription !== null;
|
|
375
|
-
var hasMarkerImage = markerImage !== null;
|
|
376
|
-
var hasTitle = utils.isTextFilled(title);
|
|
377
|
-
var hasDescription = utils.isTextFilled(description);
|
|
378
|
-
var hasButton = utils.isTextFilled(button);
|
|
379
|
-
element = /*#__PURE__*/React__default["default"].createElement(components.Transitions, {
|
|
380
|
-
transitions: transitions,
|
|
381
|
-
playing: transitionPlaying,
|
|
382
|
-
fullscreen: true,
|
|
383
|
-
disabled: transitionDisabled
|
|
384
|
-
}, /*#__PURE__*/React__default["default"].createElement(Map__default["default"], {
|
|
385
|
-
key: "map",
|
|
386
|
-
center: defaultCenter,
|
|
387
|
-
zoom: defaultZoom,
|
|
388
|
-
draggable: draggable,
|
|
389
|
-
markers: finalMarkers,
|
|
390
|
-
fitBounds: true,
|
|
391
|
-
onClickMarker: onClickMarker,
|
|
392
|
-
onReady: onMapReady,
|
|
393
|
-
onDragEnd: onMapDragEnd
|
|
394
|
-
}), /*#__PURE__*/React__default["default"].createElement("div", {
|
|
395
|
-
key: "marker-overlay",
|
|
396
|
-
className: styles.markerOverlayContainer
|
|
397
|
-
}, /*#__PURE__*/React__default["default"].createElement("div", {
|
|
398
|
-
className: styles.markerOverlayScrollable
|
|
399
|
-
}, /*#__PURE__*/React__default["default"].createElement(Scroll__default["default"], {
|
|
400
|
-
fullscreen: true,
|
|
401
|
-
disabled: scrollingDisabled,
|
|
402
|
-
onScrolledBottom: onScrolledBottom
|
|
403
|
-
}, /*#__PURE__*/React__default["default"].createElement(components.Button, {
|
|
404
|
-
className: styles.markerOverlaySafe,
|
|
405
|
-
onClick: onClickMap,
|
|
406
|
-
withoutStyle: true,
|
|
407
|
-
style: {
|
|
408
|
-
height: height * openedMarkerSpacerHeight
|
|
409
|
-
},
|
|
410
|
-
disabled: isPreview,
|
|
411
|
-
focusable: current && isView
|
|
412
|
-
}), /*#__PURE__*/React__default["default"].createElement("div", {
|
|
413
|
-
className: styles.markerOverlay,
|
|
414
|
-
style: {
|
|
415
|
-
minHeight: height * (1 - openedMarkerSpacerHeight)
|
|
416
|
-
}
|
|
417
|
-
}, /*#__PURE__*/React__default["default"].createElement("div", {
|
|
418
|
-
className: styles.markerOverlayContent,
|
|
419
|
-
style: markerOverlayContentStyle
|
|
420
|
-
}, /*#__PURE__*/React__default["default"].createElement("div", {
|
|
421
|
-
className: styles.swipeIndicator
|
|
422
|
-
}), /*#__PURE__*/React__default["default"].createElement("div", {
|
|
423
|
-
className: styles.markerOverlayContentInner,
|
|
424
|
-
key: "markerContent-".concat(selectedMarkerIndex),
|
|
425
|
-
ref: markerOverContentInnerRef
|
|
426
|
-
}, hasMarkerImage ? /*#__PURE__*/React__default["default"].createElement(ImageElement__default["default"], {
|
|
427
|
-
className: styles.markerImage,
|
|
428
|
-
media: markerImage,
|
|
429
|
-
width: markerOverContentInnerWidth
|
|
430
|
-
}) : null, hasMarkerTitle ? /*#__PURE__*/React__default["default"].createElement(Heading__default["default"], Object.assign({
|
|
431
|
-
className: styles.markerTitle
|
|
432
|
-
}, markerTitle)) : null, hasMarkerSubtitle ? /*#__PURE__*/React__default["default"].createElement(Heading__default["default"], Object.assign({
|
|
433
|
-
size: 3,
|
|
434
|
-
className: styles.markerSubtitle
|
|
435
|
-
}, markerSubtitle)) : null, hasMarkerDescription ? /*#__PURE__*/React__default["default"].createElement(Text__default["default"], Object.assign({
|
|
436
|
-
className: styles.markerDescription
|
|
437
|
-
}, markerDescription)) : null)))))), /*#__PURE__*/React__default["default"].createElement("div", {
|
|
438
|
-
key: "splash",
|
|
439
|
-
className: classNames__default["default"]([styles.splash])
|
|
440
|
-
}, /*#__PURE__*/React__default["default"].createElement(components.ScreenElement, {
|
|
441
|
-
emptyLabel: /*#__PURE__*/React__default["default"].createElement(reactIntl.FormattedMessage, {
|
|
442
|
-
id: "2ZOPe+",
|
|
443
|
-
defaultMessage: [{
|
|
444
|
-
"type": 0,
|
|
445
|
-
"value": "Title"
|
|
446
|
-
}]
|
|
447
|
-
}),
|
|
448
|
-
emptyClassName: styles.emptyTitle,
|
|
449
|
-
isEmpty: !hasTitle
|
|
450
|
-
}, /*#__PURE__*/React__default["default"].createElement(Heading__default["default"], Object.assign({
|
|
451
|
-
className: styles.title
|
|
452
|
-
}, title))), /*#__PURE__*/React__default["default"].createElement(components.ScreenElement, {
|
|
453
|
-
emptyLabel: /*#__PURE__*/React__default["default"].createElement(reactIntl.FormattedMessage, {
|
|
454
|
-
id: "507VAi",
|
|
455
|
-
defaultMessage: [{
|
|
456
|
-
"type": 0,
|
|
457
|
-
"value": "Description"
|
|
458
|
-
}]
|
|
459
|
-
}),
|
|
460
|
-
emptyClassName: styles.emptyDescription,
|
|
461
|
-
isEmpty: !hasDescription
|
|
462
|
-
}, /*#__PURE__*/React__default["default"].createElement(Text__default["default"], Object.assign({
|
|
463
|
-
className: styles.description
|
|
464
|
-
}, description))), /*#__PURE__*/React__default["default"].createElement(components.ScreenElement, {
|
|
465
|
-
emptyLabel: /*#__PURE__*/React__default["default"].createElement(reactIntl.FormattedMessage, {
|
|
466
|
-
id: "bv3rRe",
|
|
467
|
-
defaultMessage: [{
|
|
468
|
-
"type": 0,
|
|
469
|
-
"value": "Button"
|
|
470
|
-
}]
|
|
471
|
-
}),
|
|
472
|
-
emptyClassName: styles.emptyButton,
|
|
473
|
-
isEmpty: !hasButton
|
|
474
|
-
}, /*#__PURE__*/React__default["default"].createElement(ButtonElement__default["default"], {
|
|
475
|
-
className: styles.splashButton,
|
|
476
|
-
onClick: onButtonClick,
|
|
477
|
-
buttonStyle: button !== null ? button.buttonStyle : null,
|
|
478
|
-
focusable: current && isView
|
|
479
|
-
}, /*#__PURE__*/React__default["default"].createElement(Text__default["default"], Object.assign({
|
|
480
|
-
className: styles.button
|
|
481
|
-
}, button))))), !isStatic && !isCapture ? /*#__PURE__*/React__default["default"].createElement(components.Button, {
|
|
482
|
-
key: "close-button",
|
|
483
|
-
className: styles.closeButton,
|
|
484
|
-
onClick: onCloseClick,
|
|
485
|
-
focusable: current && isView
|
|
486
|
-
}, "\xD7") : null);
|
|
487
379
|
}
|
|
488
380
|
|
|
381
|
+
var renderedMarker = hasSelectedMarker ? finalMarkers[selectedMarkerIndex] : lastRenderedMarker.current;
|
|
382
|
+
|
|
383
|
+
var _ref15 = renderedMarker || {},
|
|
384
|
+
_ref15$title = _ref15.title,
|
|
385
|
+
markerTitle = _ref15$title === void 0 ? null : _ref15$title,
|
|
386
|
+
_ref15$subtitle = _ref15.subtitle,
|
|
387
|
+
markerSubtitle = _ref15$subtitle === void 0 ? null : _ref15$subtitle,
|
|
388
|
+
_ref15$description = _ref15.description,
|
|
389
|
+
markerDescription = _ref15$description === void 0 ? null : _ref15$description,
|
|
390
|
+
_ref15$image = _ref15.image,
|
|
391
|
+
markerImage = _ref15$image === void 0 ? null : _ref15$image;
|
|
392
|
+
|
|
393
|
+
var hasMarkerTitle = markerTitle !== null;
|
|
394
|
+
var hasMarkerSubtitle = markerSubtitle !== null;
|
|
395
|
+
var hasMarkerDescription = markerDescription !== null;
|
|
396
|
+
var hasMarkerImage = markerImage !== null;
|
|
397
|
+
var hasTitle = utils.isTextFilled(title);
|
|
398
|
+
var hasDescription = utils.isTextFilled(description);
|
|
399
|
+
var hasButton = utils.isTextFilled(button);
|
|
489
400
|
return /*#__PURE__*/React__default["default"].createElement("div", {
|
|
490
|
-
className: classNames__default["default"]([styles.container, (
|
|
401
|
+
className: classNames__default["default"]([styles.container, (_ref16 = {}, _defineProperty__default["default"](_ref16, className, className !== null), _defineProperty__default["default"](_ref16, styles["".concat(layout, "Layout")], layout !== null), _defineProperty__default["default"](_ref16, styles.opened, opened || isPreview && screenState !== 'intro'), _defineProperty__default["default"](_ref16, styles.hasSelectedMarker, hasSelectedMarker), _ref16)]),
|
|
491
402
|
"data-screen-ready": finalReady
|
|
492
403
|
}, !isPlaceholder ? /*#__PURE__*/React__default["default"].createElement(elementBackground.Background, {
|
|
493
404
|
color: {
|
|
@@ -501,8 +412,131 @@ var MapScreen = function MapScreen(_ref) {
|
|
|
501
412
|
}) : null, /*#__PURE__*/React__default["default"].createElement(Container__default["default"], {
|
|
502
413
|
width: width,
|
|
503
414
|
height: height
|
|
504
|
-
},
|
|
505
|
-
|
|
415
|
+
}, isPlaceholder ? /*#__PURE__*/React__default["default"].createElement(components.PlaceholderMap, {
|
|
416
|
+
className: styles.placeholder,
|
|
417
|
+
withImages: withMarkerImages
|
|
418
|
+
}) : /*#__PURE__*/React__default["default"].createElement(components.Transitions, {
|
|
419
|
+
transitions: transitions,
|
|
420
|
+
playing: transitionPlaying,
|
|
421
|
+
fullscreen: true,
|
|
422
|
+
disabled: transitionDisabled
|
|
423
|
+
}, isPreview ? /*#__PURE__*/React__default["default"].createElement(ImageElement__default["default"], {
|
|
424
|
+
media: staticUrl !== null ? {
|
|
425
|
+
url: staticUrl,
|
|
426
|
+
metadata: {
|
|
427
|
+
width: Math.min(640, width),
|
|
428
|
+
height: Math.min(640, height)
|
|
429
|
+
}
|
|
430
|
+
} : null,
|
|
431
|
+
width: width,
|
|
432
|
+
height: height,
|
|
433
|
+
objectFit: {
|
|
434
|
+
fit: 'cover'
|
|
435
|
+
}
|
|
436
|
+
}) : /*#__PURE__*/React__default["default"].createElement(Map__default["default"], {
|
|
437
|
+
key: "map",
|
|
438
|
+
center: center,
|
|
439
|
+
zoom: zoom,
|
|
440
|
+
draggable: draggable,
|
|
441
|
+
markers: finalMarkers,
|
|
442
|
+
fitBounds: fitBounds,
|
|
443
|
+
onClickMarker: onClickMarker,
|
|
444
|
+
onReady: onMapReady,
|
|
445
|
+
onDragEnd: onMapDragEnd
|
|
446
|
+
}), /*#__PURE__*/React__default["default"].createElement("div", {
|
|
447
|
+
key: "marker-overlay",
|
|
448
|
+
className: styles.markerOverlayContainer
|
|
449
|
+
}, /*#__PURE__*/React__default["default"].createElement("div", {
|
|
450
|
+
className: styles.markerOverlayScrollable
|
|
451
|
+
}, /*#__PURE__*/React__default["default"].createElement(Scroll__default["default"], {
|
|
452
|
+
fullscreen: true,
|
|
453
|
+
disabled: scrollingDisabled,
|
|
454
|
+
onScrolledBottom: onScrolledBottom
|
|
455
|
+
}, /*#__PURE__*/React__default["default"].createElement(components.Button, {
|
|
456
|
+
className: styles.markerOverlaySafe,
|
|
457
|
+
onClick: onClickMap,
|
|
458
|
+
withoutStyle: true,
|
|
459
|
+
style: {
|
|
460
|
+
height: height * openedMarkerSpacerHeight
|
|
461
|
+
},
|
|
462
|
+
disabled: isPreview,
|
|
463
|
+
focusable: current && isView
|
|
464
|
+
}), /*#__PURE__*/React__default["default"].createElement("div", {
|
|
465
|
+
className: styles.markerOverlay,
|
|
466
|
+
style: {
|
|
467
|
+
minHeight: height * (1 - openedMarkerSpacerHeight)
|
|
468
|
+
}
|
|
469
|
+
}, /*#__PURE__*/React__default["default"].createElement("div", {
|
|
470
|
+
className: styles.markerOverlayContent,
|
|
471
|
+
style: markerOverlayContentStyle
|
|
472
|
+
}, /*#__PURE__*/React__default["default"].createElement("div", {
|
|
473
|
+
className: styles.swipeIndicator
|
|
474
|
+
}), /*#__PURE__*/React__default["default"].createElement("div", {
|
|
475
|
+
className: styles.markerOverlayContentInner,
|
|
476
|
+
key: "markerContent-".concat(selectedMarkerIndex),
|
|
477
|
+
ref: markerOverContentInnerRef
|
|
478
|
+
}, hasMarkerImage ? /*#__PURE__*/React__default["default"].createElement(ImageElement__default["default"], {
|
|
479
|
+
className: styles.markerImage,
|
|
480
|
+
media: markerImage,
|
|
481
|
+
width: markerOverContentInnerWidth
|
|
482
|
+
}) : null, hasMarkerTitle ? /*#__PURE__*/React__default["default"].createElement(Heading__default["default"], Object.assign({
|
|
483
|
+
className: styles.markerTitle
|
|
484
|
+
}, markerTitle)) : null, hasMarkerSubtitle ? /*#__PURE__*/React__default["default"].createElement(Heading__default["default"], Object.assign({
|
|
485
|
+
size: 3,
|
|
486
|
+
className: styles.markerSubtitle
|
|
487
|
+
}, markerSubtitle)) : null, hasMarkerDescription ? /*#__PURE__*/React__default["default"].createElement(Text__default["default"], Object.assign({
|
|
488
|
+
className: styles.markerDescription
|
|
489
|
+
}, markerDescription)) : null)))))), /*#__PURE__*/React__default["default"].createElement("div", {
|
|
490
|
+
key: "splash",
|
|
491
|
+
className: classNames__default["default"]([styles.splash])
|
|
492
|
+
}, /*#__PURE__*/React__default["default"].createElement(components.ScreenElement, {
|
|
493
|
+
emptyLabel: /*#__PURE__*/React__default["default"].createElement(reactIntl.FormattedMessage, {
|
|
494
|
+
id: "2ZOPe+",
|
|
495
|
+
defaultMessage: [{
|
|
496
|
+
"type": 0,
|
|
497
|
+
"value": "Title"
|
|
498
|
+
}]
|
|
499
|
+
}),
|
|
500
|
+
emptyClassName: styles.emptyTitle,
|
|
501
|
+
isEmpty: !hasTitle
|
|
502
|
+
}, /*#__PURE__*/React__default["default"].createElement(Heading__default["default"], Object.assign({
|
|
503
|
+
className: styles.title
|
|
504
|
+
}, title))), /*#__PURE__*/React__default["default"].createElement(components.ScreenElement, {
|
|
505
|
+
emptyLabel: /*#__PURE__*/React__default["default"].createElement(reactIntl.FormattedMessage, {
|
|
506
|
+
id: "507VAi",
|
|
507
|
+
defaultMessage: [{
|
|
508
|
+
"type": 0,
|
|
509
|
+
"value": "Description"
|
|
510
|
+
}]
|
|
511
|
+
}),
|
|
512
|
+
emptyClassName: styles.emptyDescription,
|
|
513
|
+
isEmpty: !hasDescription
|
|
514
|
+
}, /*#__PURE__*/React__default["default"].createElement(Text__default["default"], Object.assign({
|
|
515
|
+
className: styles.description
|
|
516
|
+
}, description))), /*#__PURE__*/React__default["default"].createElement(components.ScreenElement, {
|
|
517
|
+
emptyLabel: /*#__PURE__*/React__default["default"].createElement(reactIntl.FormattedMessage, {
|
|
518
|
+
id: "bv3rRe",
|
|
519
|
+
defaultMessage: [{
|
|
520
|
+
"type": 0,
|
|
521
|
+
"value": "Button"
|
|
522
|
+
}]
|
|
523
|
+
}),
|
|
524
|
+
emptyClassName: styles.emptyButton,
|
|
525
|
+
isEmpty: !hasButton
|
|
526
|
+
}, /*#__PURE__*/React__default["default"].createElement(ButtonElement__default["default"], {
|
|
527
|
+
className: styles.splashButton,
|
|
528
|
+
onClick: onButtonClick,
|
|
529
|
+
buttonStyle: button !== null ? button.buttonStyle : null,
|
|
530
|
+
focusable: current && isView
|
|
531
|
+
}, /*#__PURE__*/React__default["default"].createElement(Text__default["default"], Object.assign({
|
|
532
|
+
className: styles.button
|
|
533
|
+
}, button))))), !isStatic && !isCapture && !isPreview && !isEdit ? /*#__PURE__*/React__default["default"].createElement(components.Button, {
|
|
534
|
+
key: "close-button",
|
|
535
|
+
className: styles.closeButton,
|
|
536
|
+
onClick: onCloseClick,
|
|
537
|
+
focusable: current && isView
|
|
538
|
+
}, "\xD7") : null)));
|
|
539
|
+
}
|
|
506
540
|
|
|
507
541
|
MapScreen.propTypes = propTypes;
|
|
508
542
|
MapScreen.defaultProps = defaultProps;
|
|
@@ -561,7 +595,7 @@ var definition = [{
|
|
|
561
595
|
type: 'screen',
|
|
562
596
|
group: {
|
|
563
597
|
label: reactIntl.defineMessage({
|
|
564
|
-
id: "
|
|
598
|
+
id: "Z27IP6",
|
|
565
599
|
defaultMessage: [{
|
|
566
600
|
"type": 0,
|
|
567
601
|
"value": "Map"
|
|
@@ -570,7 +604,7 @@ var definition = [{
|
|
|
570
604
|
order: 6
|
|
571
605
|
},
|
|
572
606
|
title: reactIntl.defineMessage({
|
|
573
|
-
id: "
|
|
607
|
+
id: "dPYwJG",
|
|
574
608
|
defaultMessage: [{
|
|
575
609
|
"type": 0,
|
|
576
610
|
"value": "Map"
|
|
@@ -579,79 +613,158 @@ var definition = [{
|
|
|
579
613
|
component: MapScreen,
|
|
580
614
|
layouts: ['normal'],
|
|
581
615
|
transforms: transforms,
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
type: 'heading-element',
|
|
585
|
-
theme: {
|
|
586
|
-
textStyle: 'heading1'
|
|
587
|
-
},
|
|
616
|
+
states: [{
|
|
617
|
+
id: 'intro',
|
|
588
618
|
label: reactIntl.defineMessage({
|
|
589
|
-
id: "
|
|
619
|
+
id: "BgrRxZ",
|
|
590
620
|
defaultMessage: [{
|
|
591
621
|
"type": 0,
|
|
592
|
-
"value": "
|
|
622
|
+
"value": "Intro"
|
|
593
623
|
}]
|
|
594
|
-
})
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
|
|
624
|
+
}),
|
|
625
|
+
fields: [{
|
|
626
|
+
name: 'title',
|
|
627
|
+
type: 'heading-element',
|
|
628
|
+
theme: {
|
|
629
|
+
textStyle: 'heading1'
|
|
630
|
+
},
|
|
631
|
+
label: reactIntl.defineMessage({
|
|
632
|
+
id: "+AEVbJ",
|
|
633
|
+
defaultMessage: [{
|
|
634
|
+
"type": 0,
|
|
635
|
+
"value": "Title"
|
|
636
|
+
}]
|
|
637
|
+
})
|
|
638
|
+
}, {
|
|
639
|
+
name: 'description',
|
|
640
|
+
type: 'text-element',
|
|
641
|
+
theme: {
|
|
642
|
+
textStyle: 'text'
|
|
643
|
+
},
|
|
644
|
+
label: reactIntl.defineMessage({
|
|
645
|
+
id: "ZCe0r4",
|
|
646
|
+
defaultMessage: [{
|
|
647
|
+
"type": 0,
|
|
648
|
+
"value": "Description"
|
|
649
|
+
}]
|
|
650
|
+
})
|
|
651
|
+
}, {
|
|
652
|
+
name: 'button',
|
|
653
|
+
type: 'button-element',
|
|
654
|
+
theme: {
|
|
655
|
+
textStyle: 'button'
|
|
656
|
+
},
|
|
657
|
+
label: reactIntl.defineMessage({
|
|
658
|
+
id: "i6bmbD",
|
|
659
|
+
defaultMessage: [{
|
|
660
|
+
"type": 0,
|
|
661
|
+
"value": "Button"
|
|
662
|
+
}]
|
|
663
|
+
})
|
|
664
|
+
}]
|
|
621
665
|
}, {
|
|
622
|
-
|
|
623
|
-
type: 'toggle',
|
|
624
|
-
defaultValue: true,
|
|
666
|
+
id: 'map',
|
|
625
667
|
label: reactIntl.defineMessage({
|
|
626
|
-
id: "
|
|
668
|
+
id: "eYHEYe",
|
|
627
669
|
defaultMessage: [{
|
|
628
670
|
"type": 0,
|
|
629
|
-
"value": "
|
|
671
|
+
"value": "Map"
|
|
630
672
|
}]
|
|
631
|
-
})
|
|
673
|
+
}),
|
|
674
|
+
fields: [{
|
|
675
|
+
name: 'draggable',
|
|
676
|
+
type: 'toggle',
|
|
677
|
+
defaultValue: true,
|
|
678
|
+
label: reactIntl.defineMessage({
|
|
679
|
+
id: "A7ncT3",
|
|
680
|
+
defaultMessage: [{
|
|
681
|
+
"type": 0,
|
|
682
|
+
"value": "Draggable"
|
|
683
|
+
}]
|
|
684
|
+
})
|
|
685
|
+
}, {
|
|
686
|
+
name: 'fitBounds',
|
|
687
|
+
type: 'toggle',
|
|
688
|
+
defaultValue: true,
|
|
689
|
+
label: reactIntl.defineMessage({
|
|
690
|
+
id: "NVUpOG",
|
|
691
|
+
defaultMessage: [{
|
|
692
|
+
"type": 0,
|
|
693
|
+
"value": "Map fit markers"
|
|
694
|
+
}]
|
|
695
|
+
})
|
|
696
|
+
}, {
|
|
697
|
+
name: 'zoom',
|
|
698
|
+
type: 'slider',
|
|
699
|
+
defaultValue: 9,
|
|
700
|
+
min: 0,
|
|
701
|
+
max: 16,
|
|
702
|
+
label: reactIntl.defineMessage({
|
|
703
|
+
id: "vRzzo6",
|
|
704
|
+
defaultMessage: [{
|
|
705
|
+
"type": 0,
|
|
706
|
+
"value": "Zoom"
|
|
707
|
+
}]
|
|
708
|
+
})
|
|
709
|
+
}, {
|
|
710
|
+
name: 'center',
|
|
711
|
+
type: 'geo-position',
|
|
712
|
+
label: reactIntl.defineMessage({
|
|
713
|
+
id: "W5qWPj",
|
|
714
|
+
defaultMessage: [{
|
|
715
|
+
"type": 0,
|
|
716
|
+
"value": "Center"
|
|
717
|
+
}]
|
|
718
|
+
})
|
|
719
|
+
}]
|
|
632
720
|
}, {
|
|
633
|
-
|
|
634
|
-
type: 'markers',
|
|
635
|
-
theme: {
|
|
636
|
-
title: {
|
|
637
|
-
textStyle: 'heading3'
|
|
638
|
-
},
|
|
639
|
-
description: {
|
|
640
|
-
textStyle: 'text'
|
|
641
|
-
}
|
|
642
|
-
},
|
|
721
|
+
id: 'markers',
|
|
643
722
|
label: reactIntl.defineMessage({
|
|
644
|
-
id: "
|
|
723
|
+
id: "+LvOvJ",
|
|
645
724
|
defaultMessage: [{
|
|
646
725
|
"type": 0,
|
|
647
726
|
"value": "Markers"
|
|
648
727
|
}]
|
|
649
|
-
})
|
|
650
|
-
|
|
728
|
+
}),
|
|
729
|
+
repeatable: true,
|
|
730
|
+
fieldName: 'markers',
|
|
731
|
+
fields: [{
|
|
732
|
+
name: 'title',
|
|
733
|
+
type: 'heading-element',
|
|
734
|
+
label: reactIntl.defineMessage({
|
|
735
|
+
id: "+AEVbJ",
|
|
736
|
+
defaultMessage: [{
|
|
737
|
+
"type": 0,
|
|
738
|
+
"value": "Title"
|
|
739
|
+
}]
|
|
740
|
+
})
|
|
741
|
+
}, {
|
|
742
|
+
name: 'description',
|
|
743
|
+
type: 'text-element',
|
|
744
|
+
label: reactIntl.defineMessage({
|
|
745
|
+
id: "ZCe0r4",
|
|
746
|
+
defaultMessage: [{
|
|
747
|
+
"type": 0,
|
|
748
|
+
"value": "Description"
|
|
749
|
+
}]
|
|
750
|
+
})
|
|
751
|
+
}, {
|
|
752
|
+
name: 'geoPosition',
|
|
753
|
+
type: 'geo-position',
|
|
754
|
+
label: reactIntl.defineMessage({
|
|
755
|
+
id: "u3ok54",
|
|
756
|
+
defaultMessage: [{
|
|
757
|
+
"type": 0,
|
|
758
|
+
"value": "Position"
|
|
759
|
+
}]
|
|
760
|
+
})
|
|
761
|
+
}]
|
|
762
|
+
}],
|
|
763
|
+
fields: [{
|
|
651
764
|
name: 'background',
|
|
652
765
|
type: 'background',
|
|
653
766
|
label: reactIntl.defineMessage({
|
|
654
|
-
id: "
|
|
767
|
+
id: "cDj1mZ",
|
|
655
768
|
defaultMessage: [{
|
|
656
769
|
"type": 0,
|
|
657
770
|
"value": "Background"
|
|
@@ -663,7 +776,7 @@ var definition = [{
|
|
|
663
776
|
type: 'screen',
|
|
664
777
|
group: {
|
|
665
778
|
label: reactIntl.defineMessage({
|
|
666
|
-
id: "
|
|
779
|
+
id: "Z27IP6",
|
|
667
780
|
defaultMessage: [{
|
|
668
781
|
"type": 0,
|
|
669
782
|
"value": "Map"
|
|
@@ -672,7 +785,7 @@ var definition = [{
|
|
|
672
785
|
order: 6
|
|
673
786
|
},
|
|
674
787
|
title: reactIntl.defineMessage({
|
|
675
|
-
id: "
|
|
788
|
+
id: "ro6yHS",
|
|
676
789
|
defaultMessage: [{
|
|
677
790
|
"type": 0,
|
|
678
791
|
"value": "Map with image markers"
|
|
@@ -688,7 +801,7 @@ var definition = [{
|
|
|
688
801
|
textStyle: 'heading1'
|
|
689
802
|
},
|
|
690
803
|
label: reactIntl.defineMessage({
|
|
691
|
-
id: "
|
|
804
|
+
id: "+AEVbJ",
|
|
692
805
|
defaultMessage: [{
|
|
693
806
|
"type": 0,
|
|
694
807
|
"value": "Title"
|
|
@@ -701,7 +814,7 @@ var definition = [{
|
|
|
701
814
|
textStyle: 'text'
|
|
702
815
|
},
|
|
703
816
|
label: reactIntl.defineMessage({
|
|
704
|
-
id: "
|
|
817
|
+
id: "ZCe0r4",
|
|
705
818
|
defaultMessage: [{
|
|
706
819
|
"type": 0,
|
|
707
820
|
"value": "Description"
|
|
@@ -714,7 +827,7 @@ var definition = [{
|
|
|
714
827
|
textStyle: 'button'
|
|
715
828
|
},
|
|
716
829
|
label: reactIntl.defineMessage({
|
|
717
|
-
id: "
|
|
830
|
+
id: "i6bmbD",
|
|
718
831
|
defaultMessage: [{
|
|
719
832
|
"type": 0,
|
|
720
833
|
"value": "Button"
|
|
@@ -725,7 +838,7 @@ var definition = [{
|
|
|
725
838
|
type: 'toggle',
|
|
726
839
|
defaultValue: true,
|
|
727
840
|
label: reactIntl.defineMessage({
|
|
728
|
-
id: "
|
|
841
|
+
id: "A7ncT3",
|
|
729
842
|
defaultMessage: [{
|
|
730
843
|
"type": 0,
|
|
731
844
|
"value": "Draggable"
|
|
@@ -743,7 +856,7 @@ var definition = [{
|
|
|
743
856
|
}
|
|
744
857
|
},
|
|
745
858
|
label: reactIntl.defineMessage({
|
|
746
|
-
id: "
|
|
859
|
+
id: "CW3KAC",
|
|
747
860
|
defaultMessage: [{
|
|
748
861
|
"type": 0,
|
|
749
862
|
"value": "Markers with image"
|
|
@@ -753,7 +866,7 @@ var definition = [{
|
|
|
753
866
|
name: 'background',
|
|
754
867
|
type: 'background',
|
|
755
868
|
label: reactIntl.defineMessage({
|
|
756
|
-
id: "
|
|
869
|
+
id: "cDj1mZ",
|
|
757
870
|
defaultMessage: [{
|
|
758
871
|
"type": 0,
|
|
759
872
|
"value": "Background"
|