@opengeoweb/core 2.1.1 → 2.1.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 (75) hide show
  1. package/core.esm.js +965 -493
  2. package/core.umd.js +951 -419
  3. package/lib/components/ComponentsLookUp/componentsLookUp.d.ts +1 -0
  4. package/lib/components/ConfigurableConnectedMap/ConfigurableConnectedMap.d.ts +1 -0
  5. package/lib/components/ConfigurableMapWithSlider/ConfigurableMapWithSliderConnect.d.ts +1 -0
  6. package/lib/components/CustomSwitch/CustomSwitch.d.ts +3 -0
  7. package/lib/components/CustomSwitch/CustomSwitch.spec.d.ts +1 -0
  8. package/lib/components/CustomSwitch/CustomSwitch.stories.d.ts +3 -0
  9. package/lib/components/CustomSwitch/index.d.ts +1 -0
  10. package/lib/components/LayerManager/LayerContainerRow/LayerRow/DimensionSelect/DimensionSelect.d.ts +4 -5
  11. package/lib/components/LayerManager/LayerContainerRow/LayerRow/DimensionSelect/DimensionSelectConnect.d.ts +0 -1
  12. package/lib/components/LayerManager/LayerContainerRow/LayerRow/RenderStyles/RenderStyles.d.ts +5 -5
  13. package/lib/components/LayerManager/LayerContainerRow/LayerRow/RenderStyles/RenderStylesConnect.d.ts +0 -1
  14. package/lib/components/LayerManager/LayerSelect/KeywordFilterButton/KeywordFilterButton.d.ts +3 -0
  15. package/lib/components/LayerManager/LayerSelect/KeywordFilterButton/KeywordFilterButton.spec.d.ts +1 -0
  16. package/lib/components/LayerManager/LayerSelect/KeywordFilterButton/KeywordFilterButton.stories.d.ts +7 -0
  17. package/lib/components/LayerManager/LayerSelect/KeywordFilterResults/KeywordFilterResults.d.ts +11 -0
  18. package/lib/components/LayerManager/LayerSelect/KeywordFilterResults/KeywordFilterResults.spec.d.ts +1 -0
  19. package/lib/components/LayerManager/LayerSelect/KeywordFilterResults/KeywordFilterResultsConnect.d.ts +3 -0
  20. package/lib/components/LayerManager/LayerSelect/KeywordFilterResults/KeywordFilterResultsConnect.stories.d.ts +7 -0
  21. package/lib/components/LayerManager/LayerSelect/KeywordFilterResults/KeywordFilterResultsListItem.d.ts +10 -0
  22. package/lib/components/LayerManager/LayerSelect/KeywordFilterResults/KeywordFilterResultsListItem.spec.d.ts +1 -0
  23. package/lib/components/LayerManager/LayerSelect/KeywordFilterResults/mockServices.d.ts +42 -0
  24. package/lib/components/LayerManager/LayerSelect/LayerSelect.stories.d.ts +7 -7
  25. package/lib/components/LayerManager/LayerSelect/LayerSelectConnect.stories.d.ts +3 -0
  26. package/lib/components/LayerManager/LayerSelect/LayerSelectStories.stories.d.ts +6 -0
  27. package/lib/components/LayerManager/LayerSelect/SearchField/SearchField.d.ts +3 -0
  28. package/lib/components/LayerManager/LayerSelect/SearchField/SearchField.spec.d.ts +1 -0
  29. package/lib/components/LayerManager/LayerSelect/ServiceList/ServiceChip.d.ts +8 -0
  30. package/lib/components/LayerManager/LayerSelect/ServiceList/ServiceChip.spec.d.ts +1 -0
  31. package/lib/components/LayerManager/LayerSelect/ServiceList/ServiceList.d.ts +8 -0
  32. package/lib/components/LayerManager/LayerSelect/ServiceList/ServiceList.spec.d.ts +1 -0
  33. package/lib/components/LayerManager/LayerSelect/ServiceList/ServiceListConnect.d.ts +6 -0
  34. package/lib/components/LayerManager/LayerSelect/ServiceList/ServiceListConnect.spec.d.ts +1 -0
  35. package/lib/components/LayerManager/LayerSelect/ServiceOptionsButton/ServiceOptionsButton.d.ts +3 -0
  36. package/lib/components/LayerManager/LayerSelect/ServiceOptionsButton/ServiceOptionsButton.spec.d.ts +1 -0
  37. package/lib/components/LayerManager/LayerSelect/ServiceOptionsButton/ServiceOptionsButton.stories.d.ts +7 -0
  38. package/lib/components/LayerManager/LayerSelect/ServicePopup/ServicePopup.d.ts +0 -1
  39. package/lib/components/MapView/{MapView.MapCursor.stories.d.ts → MapView.MapPin.stories.d.ts} +1 -1
  40. package/lib/components/MapView/MapView.ShowLayerInfo.stories.d.ts +5 -0
  41. package/lib/components/MapView/MapView.stories.d.ts +2 -1
  42. package/lib/components/MapView/MapViewConnect.MapPin.stories.d.ts +5 -0
  43. package/lib/components/MapView/MapViewConnect.d.ts +5 -3
  44. package/lib/components/MapView/MapViewConnect.stories.d.ts +1 -0
  45. package/lib/components/ReactMapView/ReactMapView.d.ts +5 -1
  46. package/lib/components/ReactMapView/ReactMapViewParseLayer.d.ts +2 -2
  47. package/lib/components/ReactMapView/types.d.ts +6 -11
  48. package/lib/components/TimeSlider/TimeSliderButtons/PlayButton/PlayButtonConnect.d.ts +2 -3
  49. package/lib/components/TimeSlider/TimeSliderRail/TimeSliderRail.d.ts +4 -4
  50. package/lib/components/TimeSlider/TimeSliderUtils.d.ts +3 -1
  51. package/lib/store/coreModuleConfig.d.ts +1 -1
  52. package/lib/store/layerSelect/actions.d.ts +8 -0
  53. package/lib/store/layerSelect/config.d.ts +4 -0
  54. package/lib/store/layerSelect/constants.d.ts +1 -0
  55. package/lib/store/layerSelect/reducer.d.ts +3 -0
  56. package/lib/store/layerSelect/reducer.spec.d.ts +1 -0
  57. package/lib/store/layerSelect/selectors.d.ts +2 -0
  58. package/lib/store/layerSelect/selectors.spec.d.ts +1 -0
  59. package/lib/store/layerSelect/types.d.ts +19 -0
  60. package/lib/store/mapStore/layers/actions.d.ts +8 -1
  61. package/lib/store/mapStore/layers/constants.d.ts +1 -0
  62. package/lib/store/mapStore/layers/selectors.d.ts +18 -0
  63. package/lib/store/mapStore/layers/types.d.ts +21 -10
  64. package/lib/store/mapStore/map/actions.d.ts +11 -4
  65. package/lib/store/mapStore/map/constants.d.ts +1 -0
  66. package/lib/store/mapStore/map/selectors.d.ts +14 -6
  67. package/lib/store/mapStore/map/types.d.ts +19 -7
  68. package/lib/store/mapStore/service/actions.d.ts +1 -8
  69. package/lib/store/mapStore/service/constants.d.ts +0 -1
  70. package/lib/store/mapStore/service/selectors.d.ts +8 -0
  71. package/lib/store/mapStore/service/types.d.ts +8 -17
  72. package/lib/store/mapStore/utils/helpers.d.ts +4 -3
  73. package/lib/types/types.d.ts +2 -1
  74. package/lib/utils/defaultTestSettings.d.ts +45 -187
  75. package/package.json +6 -6
package/core.esm.js CHANGED
@@ -5,11 +5,11 @@ import React__default, { useState, Component, useRef, useEffect } from 'react';
5
5
  import produce, { produce as produce$1 } from 'immer';
6
6
  import { takeLatest, put, select, call } from 'redux-saga/effects';
7
7
  import { WMGetServiceFromStore, getMapImageStore, WMBBOX, debug, DebugType, WMJSMap, WMLayer, legendImageStore, WMImageEventType, getLegendGraphicURLForLayer } from '@opengeoweb/webmap';
8
- import { makeStyles, Tooltip, Select, Grid, InputLabel, IconButton, Paper, Box, Typography, CircularProgress, List, ListSubheader, ListItem, ListItemText, Dialog, DialogTitle, DialogContent, DialogContentText, TextField, DialogActions, Button, createStyles, MenuItem, Checkbox, SvgIcon, ListItemIcon, Menu, FormControl, withStyles, Slider, Switch, FormControlLabel, Popover, useMediaQuery, useTheme } from '@material-ui/core';
8
+ import { makeStyles, Tooltip, Select, Grid, InputLabel, IconButton, Paper, Box, Typography, CircularProgress, List, ListSubheader, ListItem, ListItemText, Dialog, DialogTitle, DialogContent, DialogContentText, TextField, DialogActions, Button, createStyles, MenuItem, Checkbox, SvgIcon, ListItemIcon, Menu, FormControl, InputAdornment, withStyles, Slider, Switch, FormControlLabel, Popover, useMediaQuery, useTheme } from '@material-ui/core';
9
9
  import { connect, useDispatch, useSelector, Provider } from 'react-redux';
10
10
  import { sliderStyles, CustomSlider, ToolContainerDraggable, useIsMounted } from '@opengeoweb/shared';
11
11
  import _ from 'lodash';
12
- import { Cached, Add, MoreVert, FileCopy, Delete, DragIndicator, Link, LinkOff, DeleteForever } from '@material-ui/icons';
12
+ import { Cached, Add, MoreVert, FileCopy, Delete, DragIndicator, ChevronLeft, ChevronRight, Link, LinkOff, DeleteForever } from '@material-ui/icons';
13
13
  import { Sortable, ReactSortable } from 'react-sortablejs';
14
14
  import { ToggleButton } from '@material-ui/lab';
15
15
  import { debounce } from 'throttle-debounce';
@@ -56,6 +56,7 @@ var WEBMAP_TOGGLE_TIME_SLIDER_HOVER = 'WEBMAP_TOGGLE_TIME_SLIDER_HOVER';
56
56
  var WEBMAP_SET_TIME_SLIDER_CENTER_TIME = 'WEBMAP_SET_TIME_SLIDER_CENTER_TIME';
57
57
  var WEBMAP_SET_TIME_SLIDER_SECONDS_PER_PX = 'WEBMAP_SET_TIME_SLIDER_SECONDS_PER_PX';
58
58
  var WEBMAP_SET_TIME_SLIDER_DATA_SCALE_TO_SECONDS_PER_PX = 'WEBMAP_SET_TIME_SLIDER_DATA_SCALE_TO_SECONDS_PER_PX';
59
+ var WEBMAP_SET_PIN = 'WEBMAP_SET_PIN';
59
60
 
60
61
  /* *
61
62
  * Licensed under the Apache License, Version 2.0 (the "License");
@@ -147,7 +148,7 @@ var mapUpdateAllMapDimensions = function mapUpdateAllMapDimensions(payload) {
147
148
  * Starts the animation for a map.
148
149
  *
149
150
  * Example: mapStartAnimation({mapId:'mapId1', start: 'someISOTime', end: 'someISOTime', interval: 15})
150
- * @param {object} payload Object with mapId: string, start: Moment, end: Moment and interval: number (in minutes), timeList?: TimeListType[]
151
+ * @param {object} payload Object with mapId: string, start: string, end: string and interval: number (in minutes), timeList?: TimeListType[]
151
152
  */
152
153
 
153
154
  var mapStartAnimation = function mapStartAnimation(payload) {
@@ -264,7 +265,7 @@ var setAnimationDelay = function setAnimationDelay(payload) {
264
265
  *Sets the animation start time with id for a map
265
266
  *
266
267
  * Example: setAnimationStartTime({ mapId: 'mapId1'})
267
- * @param {object} payload object with mapId: string, animationStartTime: Moment
268
+ * @param {object} payload object with mapId: string, animationStartTime: string
268
269
  */
269
270
 
270
271
  var setAnimationStartTime = function setAnimationStartTime(payload) {
@@ -277,7 +278,7 @@ var setAnimationStartTime = function setAnimationStartTime(payload) {
277
278
  *Sets the animation end time with id for a map
278
279
  *
279
280
  * Example: setAnimationEndTime({ mapId: 'mapId1'})
280
- * @param {object} payload object with mapId: string, animationEndTime: Moment
281
+ * @param {object} payload object with mapId: string, animationEndTime: string
281
282
  */
282
283
 
283
284
  var setAnimationEndTime = function setAnimationEndTime(payload) {
@@ -351,6 +352,19 @@ var setTimeSliderDataScaleToSecondsPerPx = function setTimeSliderDataScaleToSeco
351
352
  payload: payload
352
353
  };
353
354
  };
355
+ /**
356
+ * Sets current curser location for a map to display the point marker
357
+ *
358
+ * Example: setMapPinLocation({ mapId: 'mapId1', mapPinLocation: {lon: 1.2, lat: 3.4} })
359
+ * @param {object} payload object with mapId: string, mapPinLocation: MapLocation
360
+ */
361
+
362
+ var setMapPinLocation = function setMapPinLocation(payload) {
363
+ return {
364
+ type: WEBMAP_SET_PIN,
365
+ payload: payload
366
+ };
367
+ };
354
368
 
355
369
  /* *
356
370
  * Licensed under the Apache License, Version 2.0 (the "License");
@@ -373,6 +387,7 @@ var WEBMAP_LAYER_CHANGE_NAME = 'WEBMAP_LAYER_CHANGE_NAME';
373
387
  var WEBMAP_LAYER_CHANGE_STYLE = 'WEBMAP_LAYER_CHANGE_STYLE';
374
388
  var WEBMAP_LAYER_CHANGE_DIMENSION = 'WEBMAP_LAYER_CHANGE_DIMENSION';
375
389
  var WEBMAP_LAYER_SET_DIMENSIONS = 'WEBMAP_LAYER_SET_DIMENSIONS';
390
+ var WEBMAP_LAYER_SET_STYLES = 'WEBMAP_LAYER_SET_STYLES';
376
391
  var WEBMAP_LAYER_CHANGE_ENABLED = 'WEBMAP_LAYER_CHANGE_ENABLED';
377
392
  var WEBMAP_LAYER_DELETE = 'WEBMAP_LAYER_DELETE';
378
393
  var WEBMAP_LAYER_ERROR = 'WEBMAP_LAYER_ERROR';
@@ -521,6 +536,19 @@ var layerSetDimensions = function layerSetDimensions(payload) {
521
536
  payload: payload
522
537
  };
523
538
  };
539
+ /**
540
+ * Action layerSetStyles is used automatically after calling the setLayers action. Contents is based on WMS GetCapabilities
541
+ *
542
+ * Example: layerSetStyles({service: someService, name: 'layerName', styles: styleArray})
543
+ * @param {object} payload consisting of service: string, name: string, styles: Style[]
544
+ */
545
+
546
+ var layerSetStyles = function layerSetStyles(payload) {
547
+ return {
548
+ type: WEBMAP_LAYER_SET_STYLES,
549
+ payload: payload
550
+ };
551
+ };
524
552
  /**
525
553
  * Changes the name of the layer
526
554
  *
@@ -634,7 +662,6 @@ var addAvailableBaseLayers = function addAvailableBaseLayers(payload) {
634
662
  * Copyright 2020 - Finnish Meteorological Institute (FMI)
635
663
  * */
636
664
  var MAP_SERVICES_SET_LAYERS = 'MAP_SERVICES_SET_LAYERS';
637
- var MAP_SERVICES_LAYER_SET_STYLES = 'MAP_SERVICES_LAYER_SET_STYLES';
638
665
 
639
666
  /* *
640
667
  * Licensed under the Apache License, Version 2.0 (the "License");
@@ -665,19 +692,6 @@ var serviceSetLayers = function serviceSetLayers(payload) {
665
692
  payload: payload
666
693
  };
667
694
  };
668
- /**
669
- * Action layerSetStyles is used automatically after calling the setLayers action. Contents is based on WMS GetCapabilities
670
- *
671
- * Example: layerSetStyles({service: someService, name: 'layerName', styles: styleArray})
672
- * @param {object} payload consisting of service: string, name: string, styles: Style[]
673
- */
674
-
675
- var layerSetStyles = function layerSetStyles(payload) {
676
- return {
677
- type: MAP_SERVICES_LAYER_SET_STYLES,
678
- payload: payload
679
- };
680
- };
681
695
 
682
696
  /* *
683
697
  * Licensed under the Apache License, Version 2.0 (the "License");
@@ -719,6 +733,7 @@ var actions$3 = /*#__PURE__*/Object.freeze({
719
733
  setTimeSliderCenterTime: setTimeSliderCenterTime,
720
734
  setTimeSliderSecondsPerPx: setTimeSliderSecondsPerPx,
721
735
  setTimeSliderDataScaleToSecondsPerPx: setTimeSliderDataScaleToSecondsPerPx,
736
+ setMapPinLocation: setMapPinLocation,
722
737
  setLayers: setLayers,
723
738
  setBaseLayers: setBaseLayers,
724
739
  addBaseLayer: addBaseLayer,
@@ -727,6 +742,7 @@ var actions$3 = /*#__PURE__*/Object.freeze({
727
742
  layerChangeEnabled: layerChangeEnabled,
728
743
  layerChangeDimension: layerChangeDimension,
729
744
  layerSetDimensions: layerSetDimensions,
745
+ layerSetStyles: layerSetStyles,
730
746
  layerChangeName: layerChangeName,
731
747
  layerChangeStyle: layerChangeStyle,
732
748
  layerDelete: layerDelete,
@@ -734,8 +750,7 @@ var actions$3 = /*#__PURE__*/Object.freeze({
734
750
  layerError: layerError,
735
751
  addAvailableBaseLayer: addAvailableBaseLayer,
736
752
  addAvailableBaseLayers: addAvailableBaseLayers,
737
- serviceSetLayers: serviceSetLayers,
738
- layerSetStyles: layerSetStyles
753
+ serviceSetLayers: serviceSetLayers
739
754
  });
740
755
 
741
756
  /* *
@@ -784,6 +799,7 @@ var Scale;
784
799
  * Copyright 2020 - Koninklijk Nederlands Meteorologisch Instituut (KNMI)
785
800
  * Copyright 2020 - Finnish Meteorological Institute (FMI)
786
801
  * */
802
+ var dateFormat = 'YYYY-MM-DDTHH:mm:ss[Z]';
787
803
  var generatedLayerIds = 0;
788
804
  var generateLayerId = function generateLayerId() {
789
805
  generatedLayerIds += 1;
@@ -849,19 +865,19 @@ var getWMJSMapById = function getWMJSMapById(wmjsMapId) {
849
865
  return registeredWMMapForReactMapId[wmjsMapId];
850
866
  };
851
867
  /**
852
- * Returns the WMJSDimension object for given layerId and Dimension
868
+ * Returns the WMJSDimension object for given layerId and dimension name
853
869
  * @param layerId The layerId
854
- * @param dimension The dimension to lookup
870
+ * @param dimensionName The dimension to lookup
855
871
  */
856
872
 
857
- var getWMJSDimensionForLayerAndDimension = function getWMJSDimensionForLayerAndDimension(layerId, dimension) {
873
+ var getWMJSDimensionForLayerAndDimension = function getWMJSDimensionForLayerAndDimension(layerId, dimensionName) {
858
874
  var wmLayer = getWMLayerById(layerId);
859
875
 
860
- if (!wmLayer || !dimension) {
876
+ if (!wmLayer || !dimensionName) {
861
877
  return null;
862
878
  }
863
879
 
864
- var wmjsDimension = wmLayer.getDimension(dimension.name);
880
+ var wmjsDimension = wmLayer.getDimension(dimensionName);
865
881
 
866
882
  if (!wmjsDimension) {
867
883
  return null;
@@ -1081,6 +1097,18 @@ var getOverLayers = createSelector(getAllLayers, function (layers) {
1081
1097
  return layer.layerType === LayerType.overLayer;
1082
1098
  });
1083
1099
  });
1100
+ /**
1101
+ * Gets styles of the passed layer
1102
+ *
1103
+ * Example: layerStyles = getLayerStyles(store, 'layerId_1')
1104
+ * @param {object} store store: object - object from which the layers state will be extracted
1105
+ * @param {string} layerId layerId: string - Id of the layer
1106
+ * @returns {array} returnType: Style[] - array containing layer styles
1107
+ */
1108
+
1109
+ var getLayerStyles = createSelector(getLayerById, function (layer) {
1110
+ return layer && layer.styles ? layer.styles : [];
1111
+ });
1084
1112
  /**
1085
1113
  * Gets dimensions of the passed layer
1086
1114
  *
@@ -1184,6 +1212,18 @@ var getLayerName = createSelector(getLayerById, function (layer) {
1184
1212
  var getLayerService = createSelector(getLayerById, function (layer) {
1185
1213
  return layer && layer.service ? layer.service : '';
1186
1214
  });
1215
+ /**
1216
+ * Gets selected style of the passed layer
1217
+ *
1218
+ * Example: layerStyle = getLayerStyle(store, 'layerId_1')
1219
+ * @param {object} store store: object - object from which the layers state will be extracted
1220
+ * @param {string} layerId layerId: string - Id of the layer
1221
+ * @returns {string} returnType: string - style that is currently selected
1222
+ */
1223
+
1224
+ var getLayerStyle = createSelector(getLayerById, function (layer) {
1225
+ return layer && layer.style ? layer.style : '';
1226
+ });
1187
1227
  /**
1188
1228
  * Gets layer status
1189
1229
  *
@@ -1631,10 +1671,29 @@ var getDataLimitsFromLayers = function getDataLimitsFromLayers(layers) {
1631
1671
  */
1632
1672
  [2147483647, 0]);
1633
1673
  };
1634
- var getValueFromEvent = function getValueFromEvent(event, newValue, sliderChangeFunction, sliderSetFunction) {
1635
- if (event.type === 'touchstart' || event.type === 'touchmove' || event.type === 'mousedown' || event.type === 'mousemove' || (event.ctrlKey || event.metaKey) && (event.key === 'ArrowDown' || event.key === 'ArrowUp')) {
1636
- sliderSetFunction(sliderChangeFunction(newValue));
1674
+ var getNextTimeStepvalue = function getNextTimeStepvalue(value, max) {
1675
+ var newValue = value + 1;
1676
+ return newValue > max ? max : newValue;
1677
+ };
1678
+ var getPreviousTimeStepvalue = function getPreviousTimeStepvalue(value, min) {
1679
+ var newValue = value - 1;
1680
+ return newValue < min ? min : newValue;
1681
+ };
1682
+ var getValueFromKeyboardEvent = function getValueFromKeyboardEvent(event, value, min, max) {
1683
+ if (event.ctrlKey || event.metaKey) {
1684
+ switch (event.key) {
1685
+ case 'ArrowDown':
1686
+ return getPreviousTimeStepvalue(value, min);
1687
+
1688
+ case 'ArrowUp':
1689
+ return getNextTimeStepvalue(value, max);
1690
+
1691
+ default:
1692
+ return null;
1693
+ }
1637
1694
  }
1695
+
1696
+ return null;
1638
1697
  };
1639
1698
  var getTimeStepFromDataInterval = function getTimeStepFromDataInterval(timeInterval) {
1640
1699
  switch (timeInterval.isRegularInterval) {
@@ -1798,9 +1857,9 @@ var createMap = function createMap(_ref) {
1798
1857
  _ref$isAnimating = _ref.isAnimating,
1799
1858
  isAnimating = _ref$isAnimating === void 0 ? false : _ref$isAnimating,
1800
1859
  _ref$animationStartTi = _ref.animationStartTime,
1801
- animationStartTime = _ref$animationStartTi === void 0 ? moment.utc(moment().unix() * 1000).subtract(5, 'h').toISOString() : _ref$animationStartTi,
1860
+ animationStartTime = _ref$animationStartTi === void 0 ? moment.utc(moment().unix() * 1000).subtract(5, 'h').format(dateFormat) : _ref$animationStartTi,
1802
1861
  _ref$animationEndTime = _ref.animationEndTime,
1803
- animationEndTime = _ref$animationEndTime === void 0 ? moment.utc(moment().unix() * 1000).subtract(10, 'm').toISOString() : _ref$animationEndTime,
1862
+ animationEndTime = _ref$animationEndTime === void 0 ? moment.utc(moment().unix() * 1000).subtract(10, 'm').format(dateFormat) : _ref$animationEndTime,
1804
1863
  _ref$isAutoUpdating = _ref.isAutoUpdating,
1805
1864
  isAutoUpdating = _ref$isAutoUpdating === void 0 ? false : _ref$isAutoUpdating,
1806
1865
  _ref$isLooping = _ref.isLooping,
@@ -1970,7 +2029,7 @@ var findMapIdFromLayerId = function findMapIdFromLayerId(draft, layerId) {
1970
2029
  */
1971
2030
 
1972
2031
  var produceDraftStateSetMapDimensionFromLayerChangeDimension = function produceDraftStateSetMapDimensionFromLayerChangeDimension(draft, layerId, dimension) {
1973
- var wmjsDimension = getWMJSDimensionForLayerAndDimension(layerId, dimension);
2032
+ var wmjsDimension = getWMJSDimensionForLayerAndDimension(layerId, dimension.name);
1974
2033
 
1975
2034
  if (!wmjsDimension) {
1976
2035
  return;
@@ -2259,23 +2318,23 @@ var isAnimating = createSelector(getMapById, function (store) {
2259
2318
  * Example: endTimeOfAnimetion = getAnimationStartTime(store, 'mapid_1')
2260
2319
  * @param {object} store store: object - store object
2261
2320
  * @param {string} mapId mapId: string - Id of the map
2262
- * @returns {moment} returnType: Moment
2321
+ * @returns {string} returnType: string
2263
2322
  */
2264
2323
 
2265
2324
  var getAnimationStartTime = createSelector(getMapById, function (store) {
2266
- return store ? moment(store.animationStartTime) : moment.utc().subtract(6, 'h');
2325
+ return store ? store.animationStartTime : moment.utc().subtract(6, 'h').format(dateFormat);
2267
2326
  });
2268
2327
  /**
2269
2328
  * Gets end time of animation
2270
2329
  *
2271
- * Example: endTimeOfAnimetion = getAnimationEndTime(store, 'mapid_1')
2330
+ * Example: endTimeOfAnimation = getAnimationEndTime(store, 'mapid_1')
2272
2331
  * @param {object} store store: object - store object
2273
2332
  * @param {string} mapId mapId: string - Id of the map
2274
- * @returns {moment} returnType: Moment
2333
+ * @returns {string} returnType: string
2275
2334
  */
2276
2335
 
2277
2336
  var getAnimationEndTime = createSelector(getMapById, function (store) {
2278
- return store ? moment(store.animationEndTime) : moment.utc().subtract(10, 'm');
2337
+ return store ? store.animationEndTime : moment.utc().subtract(10, 'm').format(dateFormat);
2279
2338
  });
2280
2339
  /**
2281
2340
  * Returns map is auto updating
@@ -2519,23 +2578,18 @@ var getAllUniqueDimensions = createSelector(getAllMapIds, function (store) {
2519
2578
  return uniqueMapDims;
2520
2579
  }, []);
2521
2580
  });
2522
-
2523
- /* *
2524
- * Licensed under the Apache License, Version 2.0 (the "License");
2525
- * you may not use this file except in compliance with the License.
2526
- * You may obtain a copy of the License at
2527
- *
2528
- * http://www.apache.org/licenses/LICENSE-2.0
2529
- *
2530
- * Unless required by applicable law or agreed to in writing, software
2531
- * distributed under the License is distributed on an "AS IS" BASIS,
2532
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2533
- * See the License for the specific language governing permissions and
2534
- * limitations under the License.
2581
+ /**
2582
+ * Returns the mapPinLocation for the current map
2535
2583
  *
2536
- * Copyright 2020 - Koninklijk Nederlands Meteorologisch Instituut (KNMI)
2537
- * Copyright 2020 - Finnish Meteorological Institute (FMI)
2538
- * */
2584
+ * Example getAllUniqueDimensions(store);
2585
+ * @param {object} store store: object - store object
2586
+ * @param {string} mapId mapId: string - Id of the map
2587
+ * @returns {object} returnType: latitude and longitude of pin
2588
+ */
2589
+
2590
+ var getPinLocation = createSelector(getMapById, function (store) {
2591
+ return store ? store.mapPinLocation : {};
2592
+ });
2539
2593
 
2540
2594
  var servicesStore = function servicesStore(store) {
2541
2595
  return store && store.services ? store.services : null;
@@ -2578,6 +2632,25 @@ var getServiceLayersByName = function getServiceLayersByName(store, serviceName)
2578
2632
 
2579
2633
  return null;
2580
2634
  };
2635
+ /**
2636
+ * Gets all keywords from services
2637
+ *
2638
+ * const keywords = useSelector((store) => mapSelectors.getKeywords(store));
2639
+ * @param {object} store store: object - Store object
2640
+ * @returns {array} returnType: Keyword[]
2641
+ */
2642
+
2643
+ var getKeywords = createSelector(servicesStore, function (store) {
2644
+ var keywords = store ? store.allIds.flatMap(function (id) {
2645
+ return store.byId[id].layers.flatMap(function (layer) {
2646
+ return layer.keywords;
2647
+ });
2648
+ }) : null;
2649
+
2650
+ var uniqueKeywords = _toConsumableArray(new Set(keywords));
2651
+
2652
+ return uniqueKeywords;
2653
+ });
2581
2654
 
2582
2655
  /* *
2583
2656
  * Licensed under the Apache License, Version 2.0 (the "License");
@@ -2633,6 +2706,7 @@ var selectors = /*#__PURE__*/Object.freeze({
2633
2706
  getLayerIndexByLayerId: getLayerIndexByLayerId,
2634
2707
  getLayerByLayerIndex: getLayerByLayerIndex,
2635
2708
  getAllUniqueDimensions: getAllUniqueDimensions,
2709
+ getPinLocation: getPinLocation,
2636
2710
  getLayerById: getLayerById,
2637
2711
  getLayersById: getLayersById,
2638
2712
  getLayersIds: getLayersIds,
@@ -2640,6 +2714,7 @@ var selectors = /*#__PURE__*/Object.freeze({
2640
2714
  getLayers: getLayers,
2641
2715
  getBaseLayers: getBaseLayers,
2642
2716
  getOverLayers: getOverLayers,
2717
+ getLayerStyles: getLayerStyles,
2643
2718
  getLayerDimensions: getLayerDimensions,
2644
2719
  getLayerNonTimeDimensions: getLayerNonTimeDimensions,
2645
2720
  getLayerTimeDimension: getLayerTimeDimension,
@@ -2648,11 +2723,13 @@ var selectors = /*#__PURE__*/Object.freeze({
2648
2723
  getLayerEnabled: getLayerEnabled,
2649
2724
  getLayerName: getLayerName,
2650
2725
  getLayerService: getLayerService,
2726
+ getLayerStyle: getLayerStyle,
2651
2727
  getLayerStatus: getLayerStatus,
2652
2728
  getAvailableBaseLayersForMap: getAvailableBaseLayersForMap,
2653
2729
  getServiceIds: getServiceIds,
2654
2730
  getServices: getServices,
2655
- getServiceLayersByName: getServiceLayersByName
2731
+ getServiceLayersByName: getServiceLayersByName,
2732
+ getKeywords: getKeywords
2656
2733
  });
2657
2734
 
2658
2735
  /* *
@@ -2695,11 +2772,13 @@ var constants$1 = /*#__PURE__*/Object.freeze({
2695
2772
  WEBMAP_SET_TIME_SLIDER_CENTER_TIME: WEBMAP_SET_TIME_SLIDER_CENTER_TIME,
2696
2773
  WEBMAP_SET_TIME_SLIDER_SECONDS_PER_PX: WEBMAP_SET_TIME_SLIDER_SECONDS_PER_PX,
2697
2774
  WEBMAP_SET_TIME_SLIDER_DATA_SCALE_TO_SECONDS_PER_PX: WEBMAP_SET_TIME_SLIDER_DATA_SCALE_TO_SECONDS_PER_PX,
2775
+ WEBMAP_SET_PIN: WEBMAP_SET_PIN,
2698
2776
  WEBMAP_LAYER_CHANGE_OPACITY: WEBMAP_LAYER_CHANGE_OPACITY,
2699
2777
  WEBMAP_LAYER_CHANGE_NAME: WEBMAP_LAYER_CHANGE_NAME,
2700
2778
  WEBMAP_LAYER_CHANGE_STYLE: WEBMAP_LAYER_CHANGE_STYLE,
2701
2779
  WEBMAP_LAYER_CHANGE_DIMENSION: WEBMAP_LAYER_CHANGE_DIMENSION,
2702
2780
  WEBMAP_LAYER_SET_DIMENSIONS: WEBMAP_LAYER_SET_DIMENSIONS,
2781
+ WEBMAP_LAYER_SET_STYLES: WEBMAP_LAYER_SET_STYLES,
2703
2782
  WEBMAP_LAYER_CHANGE_ENABLED: WEBMAP_LAYER_CHANGE_ENABLED,
2704
2783
  WEBMAP_LAYER_DELETE: WEBMAP_LAYER_DELETE,
2705
2784
  WEBMAP_LAYER_ERROR: WEBMAP_LAYER_ERROR,
@@ -2710,8 +2789,7 @@ var constants$1 = /*#__PURE__*/Object.freeze({
2710
2789
  WEBMAP_ADD_BASELAYER: WEBMAP_ADD_BASELAYER,
2711
2790
  WEBMAP_ADD_AVAILABLE_BASELAYER: WEBMAP_ADD_AVAILABLE_BASELAYER,
2712
2791
  WEBMAP_ADD_AVAILABLE_BASELAYERS: WEBMAP_ADD_AVAILABLE_BASELAYERS,
2713
- MAP_SERVICES_SET_LAYERS: MAP_SERVICES_SET_LAYERS,
2714
- MAP_SERVICES_LAYER_SET_STYLES: MAP_SERVICES_LAYER_SET_STYLES
2792
+ MAP_SERVICES_SET_LAYERS: MAP_SERVICES_SET_LAYERS
2715
2793
  });
2716
2794
 
2717
2795
  /* *
@@ -3284,7 +3362,7 @@ var produceDraftStateForAllLayersForDimensionWithinMap = function produceDraftSt
3284
3362
  var layer = draft.byId[layerId];
3285
3363
 
3286
3364
  if (layer && layer.mapId === mapId) {
3287
- var wmjsDimension = getWMJSDimensionForLayerAndDimension(layerId, dimension);
3365
+ var wmjsDimension = getWMJSDimensionForLayerAndDimension(layerId, dimension.name);
3288
3366
 
3289
3367
  if (wmjsDimension && wmjsDimension.linked && wmjsDimension.name === 'reference_time') {
3290
3368
  wmjsDimension.linked = false;
@@ -3354,7 +3432,7 @@ var createLayer = function createLayer(_a) {
3354
3432
  status: status
3355
3433
  });
3356
3434
  };
3357
- var initialState$4 = {
3435
+ var initialState$5 = {
3358
3436
  byId: {},
3359
3437
  allIds: [],
3360
3438
  availableBaseLayers: {
@@ -3362,8 +3440,8 @@ var initialState$4 = {
3362
3440
  allIds: []
3363
3441
  }
3364
3442
  };
3365
- var reducer$4 = function reducer() {
3366
- var state = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : initialState$4;
3443
+ var reducer$5 = function reducer() {
3444
+ var state = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : initialState$5;
3367
3445
  var action = arguments.length > 1 ? arguments[1] : undefined;
3368
3446
 
3369
3447
  switch (action.type) {
@@ -3647,6 +3725,18 @@ var reducer$4 = function reducer() {
3647
3725
  });
3648
3726
  }
3649
3727
 
3728
+ case WEBMAP_LAYER_SET_STYLES:
3729
+ {
3730
+ var _action$payload12 = action.payload,
3731
+ styles = _action$payload12.styles,
3732
+ _layerId9 = _action$payload12.layerId;
3733
+ return produce(state, function (draft) {
3734
+ if (draft.byId[_layerId9]) {
3735
+ draft.byId[_layerId9].styles = styles;
3736
+ }
3737
+ });
3738
+ }
3739
+
3650
3740
  case WEBMAP_ADD_AVAILABLE_BASELAYER:
3651
3741
  {
3652
3742
  var _layer2 = action.payload.layer;
@@ -3683,11 +3773,11 @@ var reducer$4 = function reducer() {
3683
3773
  }
3684
3774
  };
3685
3775
 
3686
- var reducer$5 = /*#__PURE__*/Object.freeze({
3776
+ var reducer$6 = /*#__PURE__*/Object.freeze({
3687
3777
  __proto__: null,
3688
3778
  createLayer: createLayer,
3689
- initialState: initialState$4,
3690
- reducer: reducer$4
3779
+ initialState: initialState$5,
3780
+ reducer: reducer$5
3691
3781
  });
3692
3782
 
3693
3783
  /* *
@@ -3744,7 +3834,7 @@ var removeInPlace = function removeInPlace(inDraftArray, condition) {
3744
3834
  * Copyright 2020 - Koninklijk Nederlands Meteorologisch Instituut (KNMI)
3745
3835
  * Copyright 2020 - Finnish Meteorological Institute (FMI)
3746
3836
  * */
3747
- var initialState$3 = {
3837
+ var initialState$4 = {
3748
3838
  sources: {
3749
3839
  byId: {},
3750
3840
  allIds: []
@@ -3754,8 +3844,8 @@ var initialState$3 = {
3754
3844
  allIds: []
3755
3845
  }
3756
3846
  };
3757
- var reducer$3 = function reducer() {
3758
- var state = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : initialState$3;
3847
+ var reducer$4 = function reducer() {
3848
+ var state = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : initialState$4;
3759
3849
  var action = arguments.length > 1 ? arguments[1] : undefined;
3760
3850
 
3761
3851
  switch (action.type) {
@@ -3963,7 +4053,7 @@ var reducer$3 = function reducer() {
3963
4053
  });
3964
4054
 
3965
4055
  case SYNCGROUPS_CLEAR:
3966
- return initialState$3;
4056
+ return initialState$4;
3967
4057
 
3968
4058
  default:
3969
4059
  return state;
@@ -4380,6 +4470,8 @@ var setServiceMetadata = function setServiceMetadata(wmLayer, mapId, xml2jsonreq
4380
4470
 
4381
4471
  var done = function done(layers) {
4382
4472
  onServiceSetLayers && onServiceSetLayers({
4473
+ id: wmLayer.service,
4474
+ name: wmLayer.title,
4383
4475
  service: wmLayer.service,
4384
4476
  layers: layers
4385
4477
  });
@@ -4387,8 +4479,7 @@ var setServiceMetadata = function setServiceMetadata(wmLayer, mapId, xml2jsonreq
4387
4479
 
4388
4480
  onLayerSetStyles && onLayerSetStyles({
4389
4481
  origin: origin,
4390
- service: wmLayer.service,
4391
- name: wmLayer.name,
4482
+ layerId: wmLayer.id,
4392
4483
  styles: wmLayer.getStyles()
4393
4484
  });
4394
4485
  /* Select first style in service for a layer */
@@ -4399,34 +4490,8 @@ var setServiceMetadata = function setServiceMetadata(wmLayer, mapId, xml2jsonreq
4399
4490
  style: wmLayer.currentStyle // || wmjsLayer.getStyles().length > 0 ? wmjsLayer.getStyles()[0].Name.value : 'default'
4400
4491
 
4401
4492
  });
4402
- var mapNeedsUpdate = false;
4403
- /* Synchronize layer dimension properties to wmjslayer dimension values */
4404
-
4405
- var _loop = function _loop(d) {
4406
- if (wmLayer.reactWebMapJSLayer && wmLayer.reactWebMapJSLayer.props.dimensions) {
4407
- /* Try to set the dimension according to the react layer properties */
4408
- var reactLayerDimension = wmLayer.reactWebMapJSLayer.props.dimensions.find(function (dim) {
4409
- return dim.name === wmLayer.dimensions[d].name;
4410
- });
4411
-
4412
- if (reactLayerDimension && reactLayerDimension.currentValue) {
4413
- if (reactLayerDimension.currentValue !== wmLayer.dimensions[d].currentValue) {
4414
- // eslint-disable-next-line no-param-reassign
4415
- wmLayer.dimensions[d].currentValue = reactLayerDimension.currentValue; // eslint-disable-next-line no-param-reassign
4416
-
4417
- wmLayer.dimensions[d].synced = reactLayerDimension.synced;
4418
- mapNeedsUpdate = true;
4419
- }
4420
- }
4421
- }
4422
- };
4423
-
4424
- for (var d = 0; d < wmLayer.dimensions.length; d += 1) {
4425
- _loop(d);
4426
- }
4427
4493
  /* Trigger update of all map dimensions */
4428
4494
 
4429
-
4430
4495
  onMapUpdateAllDimensions && onMapUpdateAllDimensions({
4431
4496
  origin: origin,
4432
4497
  mapId: mapId,
@@ -4474,12 +4539,6 @@ var setServiceMetadata = function setServiceMetadata(wmLayer, mapId, xml2jsonreq
4474
4539
  };
4475
4540
  })
4476
4541
  });
4477
-
4478
- if (mapNeedsUpdate) {
4479
- if (wmLayer.parentMaps && wmLayer.parentMaps.length > 0) {
4480
- wmLayer.parentMaps[0].draw();
4481
- }
4482
- }
4483
4542
  };
4484
4543
 
4485
4544
  service.getLayerObjectsFlat(done, function () {// do nothing
@@ -4998,12 +5057,12 @@ function rootSaga$2() {
4998
5057
  var synchronizationGroupConfig = {
4999
5058
  id: 'syncronizationGroupStore-module',
5000
5059
  reducerMap: {
5001
- syncronizationGroupStore: reducer$3
5060
+ syncronizationGroupStore: reducer$4
5002
5061
  },
5003
5062
  sagas: [rootSaga$3, rootSaga$2]
5004
5063
  };
5005
5064
 
5006
- var useStyles$A = makeStyles(function (theme) {
5065
+ var useStyles$E = makeStyles(function (theme) {
5007
5066
  return {
5008
5067
  select: {
5009
5068
  '& ul': {
@@ -5058,7 +5117,21 @@ var TooltipSelect = function TooltipSelect(_a) {
5058
5117
  tooltipOpen = _React$useState4[0],
5059
5118
  setTooltipOpen = _React$useState4[1];
5060
5119
 
5061
- var classes = useStyles$A();
5120
+ var classes = useStyles$E();
5121
+
5122
+ var preventDefault = function preventDefault(event) {
5123
+ event.preventDefault();
5124
+ event.stopPropagation();
5125
+ };
5126
+
5127
+ var enableScroll = React.useCallback(function () {
5128
+ document.removeEventListener('wheel', preventDefault, false);
5129
+ }, []);
5130
+ var disableScroll = React.useCallback(function () {
5131
+ document.addEventListener('wheel', preventDefault, {
5132
+ passive: false
5133
+ });
5134
+ }, []);
5062
5135
  var onWheel = React.useCallback(function (event) {
5063
5136
  if (selectOpen) return;
5064
5137
  var direction = event.deltaY < 0 ? 1 : -1;
@@ -5073,22 +5146,21 @@ var TooltipSelect = function TooltipSelect(_a) {
5073
5146
  setSelectOpen(false);
5074
5147
  }, []);
5075
5148
  var onMouseEnter = React.useCallback(function () {
5149
+ disableScroll();
5076
5150
  if (!selectOpen) setTooltipOpen(true);
5077
- }, [selectOpen]);
5151
+ }, [selectOpen, disableScroll]);
5078
5152
  var onMouseLeave = React.useCallback(function () {
5153
+ enableScroll();
5079
5154
  setTooltipOpen(false);
5080
- }, []);
5155
+ }, [enableScroll]);
5081
5156
  var onFocus = React.useCallback(function () {
5157
+ disableScroll();
5082
5158
  setTooltipOpen(true);
5083
- }, []);
5159
+ }, [disableScroll]);
5084
5160
  var onBlur = React.useCallback(function () {
5161
+ enableScroll();
5085
5162
  setTooltipOpen(false);
5086
- }, []);
5087
- React.useEffect(function () {
5088
- if (selectOpen === false) {
5089
- setTooltipOpen(false);
5090
- }
5091
- }, [selectOpen]);
5163
+ }, [enableScroll]);
5092
5164
  return /*#__PURE__*/React.createElement(Tooltip, {
5093
5165
  title: tooltip,
5094
5166
  placement: "top",
@@ -5152,7 +5224,7 @@ var index = /*#__PURE__*/Object.freeze({
5152
5224
  actions: actions$1,
5153
5225
  constants: constants,
5154
5226
  types: types,
5155
- initialState: initialState$3
5227
+ initialState: initialState$4
5156
5228
  });
5157
5229
 
5158
5230
  var moveToTop = function moveToTop(list, element) {
@@ -5175,12 +5247,12 @@ var createUIDialogElement = function createUIDialogElement(_ref) {
5175
5247
  source: source
5176
5248
  };
5177
5249
  };
5178
- var initialState$2 = {
5250
+ var initialState$3 = {
5179
5251
  order: [],
5180
5252
  dialogs: {}
5181
5253
  };
5182
- var reducer$2 = function reducer() {
5183
- var state = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : initialState$2;
5254
+ var reducer$3 = function reducer() {
5255
+ var state = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : initialState$3;
5184
5256
  var action = arguments.length > 1 ? arguments[1] : undefined;
5185
5257
 
5186
5258
  switch (action.type) {
@@ -5512,7 +5584,7 @@ function rootSaga$1() {
5512
5584
  var uiModuleConfig = {
5513
5585
  id: 'ui-module',
5514
5586
  reducerMap: {
5515
- ui: reducer$2
5587
+ ui: reducer$3
5516
5588
  },
5517
5589
  sagas: [rootSaga$1]
5518
5590
  };
@@ -5558,12 +5630,12 @@ var createLayersWithIds = function createLayersWithIds(state, layers) {
5558
5630
  });
5559
5631
  };
5560
5632
 
5561
- var initialState$1 = {
5633
+ var initialState$2 = {
5562
5634
  byId: {},
5563
5635
  allIds: []
5564
5636
  };
5565
- var reducer$1 = function reducer() {
5566
- var state = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : initialState$1;
5637
+ var reducer$2 = function reducer() {
5638
+ var state = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : initialState$2;
5567
5639
  var action = arguments.length > 1 ? arguments[1] : undefined;
5568
5640
 
5569
5641
  switch (action.type) {
@@ -5675,11 +5747,11 @@ var reducer$1 = function reducer() {
5675
5747
  draft.byId[_mapId6].isAnimating = true;
5676
5748
 
5677
5749
  if (action.payload.start) {
5678
- draft.byId[_mapId6].animationStartTime = action.payload.start.toISOString();
5750
+ draft.byId[_mapId6].animationStartTime = action.payload.start;
5679
5751
  }
5680
5752
 
5681
5753
  if (action.payload.end) {
5682
- draft.byId[_mapId6].animationEndTime = action.payload.end.toISOString();
5754
+ draft.byId[_mapId6].animationEndTime = action.payload.end;
5683
5755
  }
5684
5756
 
5685
5757
  if (action.payload.interval && action.payload.interval !== draft.byId[_mapId6].timeStep) {
@@ -5776,7 +5848,7 @@ var reducer$1 = function reducer() {
5776
5848
  }
5777
5849
 
5778
5850
  return produce$1(state, function (draft) {
5779
- draft.byId[_mapId11].animationStartTime = animationStartTime.toISOString();
5851
+ draft.byId[_mapId11].animationStartTime = animationStartTime;
5780
5852
  });
5781
5853
  }
5782
5854
 
@@ -5791,7 +5863,7 @@ var reducer$1 = function reducer() {
5791
5863
  }
5792
5864
 
5793
5865
  return produce$1(state, function (draft) {
5794
- draft.byId[_mapId12].animationEndTime = animationEndTime.toISOString();
5866
+ draft.byId[_mapId12].animationEndTime = animationEndTime;
5795
5867
  });
5796
5868
  }
5797
5869
  // LAYER actions
@@ -6126,6 +6198,21 @@ var reducer$1 = function reducer() {
6126
6198
  });
6127
6199
  }
6128
6200
 
6201
+ case WEBMAP_SET_PIN:
6202
+ {
6203
+ var _action$payload25 = action.payload,
6204
+ _mapId27 = _action$payload25.mapId,
6205
+ mapPinLocation = _action$payload25.mapPinLocation;
6206
+
6207
+ if (!state.byId[_mapId27]) {
6208
+ return state;
6209
+ }
6210
+
6211
+ return produce$1(state, function (draft) {
6212
+ draft.byId[_mapId27].mapPinLocation = mapPinLocation;
6213
+ });
6214
+ }
6215
+
6129
6216
  case GENERIC_SYNC_SETLAYERACTIONS:
6130
6217
  {
6131
6218
  /*
@@ -6134,9 +6221,9 @@ var reducer$1 = function reducer() {
6134
6221
  * These targets can be used as payloads in new Layer actions.
6135
6222
  * These actions are here handled via the layer reducer, as it is the same logic
6136
6223
  */
6137
- var _action$payload25 = action.payload,
6138
- targets = _action$payload25.targets,
6139
- source = _action$payload25.source;
6224
+ var _action$payload26 = action.payload,
6225
+ targets = _action$payload26.targets,
6226
+ source = _action$payload26.source;
6140
6227
  return targets.reduce(function (prevState, target) {
6141
6228
  var action = {
6142
6229
  payload: target,
@@ -6169,30 +6256,25 @@ var reducer$1 = function reducer() {
6169
6256
  * Copyright 2020 - Koninklijk Nederlands Meteorologisch Instituut (KNMI)
6170
6257
  * Copyright 2020 - Finnish Meteorological Institute (FMI)
6171
6258
  * */
6172
- var initialState = {
6259
+ var initialState$1 = {
6173
6260
  byId: {},
6174
6261
  allIds: []
6175
6262
  };
6176
- var reducer = function reducer() {
6177
- var state = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : initialState;
6263
+ var reducer$1 = function reducer() {
6264
+ var state = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : initialState$1;
6178
6265
  var action = arguments.length > 1 ? arguments[1] : undefined;
6179
6266
 
6180
6267
  switch (action.type) {
6181
6268
  case MAP_SERVICES_SET_LAYERS:
6182
6269
  return produce(state, function (draft) {
6183
6270
  if (!draft.byId[action.payload.service]) draft.byId[action.payload.service] = {};
6271
+ draft.byId[action.payload.service].id = action.payload.id;
6272
+ draft.byId[action.payload.service].name = action.payload.name;
6273
+ draft.byId[action.payload.service].service = action.payload.service;
6184
6274
  draft.byId[action.payload.service].layers = action.payload.layers;
6185
6275
  if (!draft.allIds.includes(action.payload.service)) draft.allIds.push(action.payload.service);
6186
6276
  });
6187
6277
 
6188
- case MAP_SERVICES_LAYER_SET_STYLES:
6189
- return produce(state, function (draft) {
6190
- if (!draft.byId[action.payload.service]) draft.byId[action.payload.service] = {};
6191
- if (!draft.byId[action.payload.service].layer) draft.byId[action.payload.service].layer = {};
6192
- if (!draft.byId[action.payload.service].layer[action.payload.name]) draft.byId[action.payload.service].layer[action.payload.name] = {};
6193
- draft.byId[action.payload.service].layer[action.payload.name].styles = action.payload.styles;
6194
- });
6195
-
6196
6278
  default:
6197
6279
  return state;
6198
6280
  }
@@ -6239,8 +6321,8 @@ function startAnimationSaga(_ref) {
6239
6321
  case 0:
6240
6322
  payload = _ref.payload;
6241
6323
  mapId = payload.mapId, start = payload.start, end = payload.end, interval = payload.interval, timeList = payload.timeList;
6242
- roundedStart = roundWithTimeStep(start && start.unix(), interval, 'ceil');
6243
- roundedEnd = roundWithTimeStep(end && end.unix(), interval, 'floor');
6324
+ roundedStart = roundWithTimeStep(start && moment.utc(start).unix(), interval, 'ceil');
6325
+ roundedEnd = roundWithTimeStep(end && moment.utc(end).unix(), interval, 'floor');
6244
6326
  _context.next = 6;
6245
6327
  return timeList || generateTimeList(moment.utc(roundedStart * 1000), moment.utc(roundedEnd * 1000), interval);
6246
6328
 
@@ -6306,7 +6388,7 @@ function deleteLayerSaga(_ref3) {
6306
6388
  }, _marked3);
6307
6389
  }
6308
6390
  function updateAnimation(mapId, maxValue) {
6309
- var animationStart, animationEnd, t, deltaT, start, end, isAnimating$1, timeStep;
6391
+ var animationStart, animationStartUnix, animationEnd, animationEndUnix, t, deltaT, start, end, isAnimating$1, timeStep;
6310
6392
  return regeneratorRuntime.wrap(function updateAnimation$(_context4) {
6311
6393
  while (1) {
6312
6394
  switch (_context4.prev = _context4.next) {
@@ -6316,46 +6398,48 @@ function updateAnimation(mapId, maxValue) {
6316
6398
 
6317
6399
  case 2:
6318
6400
  animationStart = _context4.sent;
6319
- _context4.next = 5;
6401
+ animationStartUnix = moment.utc(animationStart).unix();
6402
+ _context4.next = 6;
6320
6403
  return select(getAnimationEndTime, mapId);
6321
6404
 
6322
- case 5:
6405
+ case 6:
6323
6406
  animationEnd = _context4.sent;
6407
+ animationEndUnix = moment.utc(animationEnd).unix();
6324
6408
  t = moment.utc(maxValue).unix();
6325
- deltaT = t - animationEnd.unix();
6326
- start = moment.unix(animationStart.unix() + deltaT).utc();
6327
- end = moment.unix(animationEnd.unix() + deltaT).utc();
6328
- _context4.next = 12;
6409
+ deltaT = t - animationEndUnix;
6410
+ start = moment.unix(animationStartUnix + deltaT).utc().format(dateFormat);
6411
+ end = moment.unix(animationEndUnix + deltaT).utc().format(dateFormat);
6412
+ _context4.next = 14;
6329
6413
  return put(setAnimationEndTime({
6330
6414
  mapId: mapId,
6331
6415
  animationEndTime: end
6332
6416
  }));
6333
6417
 
6334
- case 12:
6335
- _context4.next = 14;
6418
+ case 14:
6419
+ _context4.next = 16;
6336
6420
  return put(setAnimationStartTime({
6337
6421
  mapId: mapId,
6338
6422
  animationStartTime: start
6339
6423
  }));
6340
6424
 
6341
- case 14:
6342
- _context4.next = 16;
6425
+ case 16:
6426
+ _context4.next = 18;
6343
6427
  return select(isAnimating, mapId);
6344
6428
 
6345
- case 16:
6429
+ case 18:
6346
6430
  isAnimating$1 = _context4.sent;
6347
6431
 
6348
6432
  if (!isAnimating$1) {
6349
- _context4.next = 23;
6433
+ _context4.next = 25;
6350
6434
  break;
6351
6435
  }
6352
6436
 
6353
- _context4.next = 20;
6437
+ _context4.next = 22;
6354
6438
  return select(getMapTimeStep, mapId);
6355
6439
 
6356
- case 20:
6440
+ case 22:
6357
6441
  timeStep = _context4.sent;
6358
- _context4.next = 23;
6442
+ _context4.next = 25;
6359
6443
  return put(mapStartAnimation({
6360
6444
  mapId: mapId,
6361
6445
  start: start,
@@ -6363,7 +6447,7 @@ function updateAnimation(mapId, maxValue) {
6363
6447
  interval: timeStep
6364
6448
  }));
6365
6449
 
6366
- case 23:
6450
+ case 25:
6367
6451
  case "end":
6368
6452
  return _context4.stop();
6369
6453
  }
@@ -6421,11 +6505,16 @@ function setLayerDimensionsSaga(_ref4) {
6421
6505
 
6422
6506
  if (!(layerId === activeLayerId && // only update the active layer
6423
6507
  shouldAutoUpdate && newTimeDimension && newTimeDimension.maxValue && prevTimeDimension && prevTimeDimension.currentValue && prevTimeDimension.currentValue !== newTimeDimension.maxValue)) {
6424
- _context5.next = 30;
6508
+ _context5.next = 31;
6425
6509
  break;
6426
6510
  }
6427
6511
 
6428
- _context5.next = 26;
6512
+ if (isAnimating$1) {
6513
+ _context5.next = 27;
6514
+ break;
6515
+ }
6516
+
6517
+ _context5.next = 27;
6429
6518
  return put(layerChangeDimension({
6430
6519
  layerId: layerId,
6431
6520
  origin: 'setLayerDimensionSaga',
@@ -6435,39 +6524,39 @@ function setLayerDimensionsSaga(_ref4) {
6435
6524
  }
6436
6525
  }));
6437
6526
 
6438
- case 26:
6439
- _context5.next = 28;
6527
+ case 27:
6528
+ _context5.next = 29;
6440
6529
  return call(updateAnimation, mapId, newTimeDimension.maxValue);
6441
6530
 
6442
- case 28:
6443
- _context5.next = 33;
6531
+ case 29:
6532
+ _context5.next = 34;
6444
6533
  break;
6445
6534
 
6446
- case 30:
6535
+ case 31:
6447
6536
  if (!(isAnimating$1 && !webmapInstance.isAnimating && newTimeDimension && newTimeDimension.maxValue)) {
6448
- _context5.next = 33;
6537
+ _context5.next = 34;
6449
6538
  break;
6450
6539
  }
6451
6540
 
6452
- _context5.next = 33;
6541
+ _context5.next = 34;
6453
6542
  return call(updateAnimation, mapId, newTimeDimension.maxValue);
6454
6543
 
6455
- case 33:
6456
- _context5.next = 38;
6544
+ case 34:
6545
+ _context5.next = 39;
6457
6546
  break;
6458
6547
 
6459
- case 35:
6460
- _context5.prev = 35;
6548
+ case 36:
6549
+ _context5.prev = 36;
6461
6550
  _context5.t0 = _context5["catch"](1);
6462
6551
  // eslint-disable-next-line no-console
6463
6552
  console.warn(_context5.t0);
6464
6553
 
6465
- case 38:
6554
+ case 39:
6466
6555
  case "end":
6467
6556
  return _context5.stop();
6468
6557
  }
6469
6558
  }
6470
- }, _marked5, null, [[1, 35]]);
6559
+ }, _marked5, null, [[1, 36]]);
6471
6560
  }
6472
6561
  function toggleAutoUpdateSaga(_ref5) {
6473
6562
  var payload, shouldAutoUpdate, mapId, layerId, timeDimension;
@@ -6582,9 +6671,9 @@ function rootSaga() {
6582
6671
  var moduleConfig = {
6583
6672
  id: 'webmap-module',
6584
6673
  reducerMap: {
6585
- webmap: reducer$1,
6586
- services: reducer,
6587
- layers: reducer$4
6674
+ webmap: reducer$2,
6675
+ services: reducer$1,
6676
+ layers: reducer$5
6588
6677
  },
6589
6678
  sagas: [rootSaga]
6590
6679
  };
@@ -6605,7 +6694,69 @@ var moduleConfig = {
6605
6694
  * Copyright 2021 - Koninklijk Nederlands Meteorologisch Instituut (KNMI)
6606
6695
  * Copyright 2021 - Finnish Meteorological Institute (FMI)
6607
6696
  * */
6608
- var coreModuleConfig = [moduleConfig, synchronizationGroupConfig, uiModuleConfig];
6697
+ var initialState = {
6698
+ filters: {
6699
+ searchFilter: ''
6700
+ }
6701
+ };
6702
+ var reducer = function reducer() {
6703
+ var state = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : initialState;
6704
+ var action = arguments.length > 1 ? arguments[1] : undefined;
6705
+
6706
+ switch (action.type) {
6707
+ case 'LAYER_SELECT_SET_SEARCH_FILTER':
6708
+ {
6709
+ var filterText = action.payload.filterText;
6710
+ return produce(state, function (draft) {
6711
+ draft.filters.searchFilter = filterText;
6712
+ });
6713
+ }
6714
+
6715
+ default:
6716
+ return state;
6717
+ }
6718
+ };
6719
+
6720
+ /* *
6721
+ * Licensed under the Apache License, Version 2.0 (the "License");
6722
+ * you may not use this file except in compliance with the License.
6723
+ * You may obtain a copy of the License at
6724
+ *
6725
+ * http://www.apache.org/licenses/LICENSE-2.0
6726
+ *
6727
+ * Unless required by applicable law or agreed to in writing, software
6728
+ * distributed under the License is distributed on an "AS IS" BASIS,
6729
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
6730
+ * See the License for the specific language governing permissions and
6731
+ * limitations under the License.
6732
+ *
6733
+ * Copyright 2021 - Koninklijk Nederlands Meteorologisch Instituut (KNMI)
6734
+ * Copyright 2021 - Finnish Meteorological Institute (FMI)
6735
+ * */
6736
+ var layerSelectConfig = {
6737
+ id: 'layerSelect-module',
6738
+ reducerMap: {
6739
+ layerSelect: reducer
6740
+ }
6741
+ };
6742
+
6743
+ /* *
6744
+ * Licensed under the Apache License, Version 2.0 (the "License");
6745
+ * you may not use this file except in compliance with the License.
6746
+ * You may obtain a copy of the License at
6747
+ *
6748
+ * http://www.apache.org/licenses/LICENSE-2.0
6749
+ *
6750
+ * Unless required by applicable law or agreed to in writing, software
6751
+ * distributed under the License is distributed on an "AS IS" BASIS,
6752
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
6753
+ * See the License for the specific language governing permissions and
6754
+ * limitations under the License.
6755
+ *
6756
+ * Copyright 2021 - Koninklijk Nederlands Meteorologisch Instituut (KNMI)
6757
+ * Copyright 2021 - Finnish Meteorological Institute (FMI)
6758
+ * */
6759
+ var coreModuleConfig = [moduleConfig, synchronizationGroupConfig, uiModuleConfig, layerSelectConfig];
6609
6760
 
6610
6761
  /* *
6611
6762
  * Licensed under the Apache License, Version 2.0 (the "License");
@@ -7586,7 +7737,7 @@ var defaultConfigurations = /*#__PURE__*/Object.freeze({
7586
7737
  preloadedDefaultMapServices: preloadedDefaultMapServices
7587
7738
  });
7588
7739
 
7589
- var useStyles$z = makeStyles({
7740
+ var useStyles$D = makeStyles({
7590
7741
  buttonDiv: {
7591
7742
  position: 'relative'
7592
7743
  },
@@ -7622,7 +7773,7 @@ var AddLayersPopup = function AddLayersPopup(_ref) {
7622
7773
  handleClose = _ref.handleClose,
7623
7774
  _ref$layerType = _ref.layerType,
7624
7775
  layerType = _ref$layerType === void 0 ? LayerType.mapLayer : _ref$layerType;
7625
- var classes = useStyles$z();
7776
+ var classes = useStyles$D();
7626
7777
 
7627
7778
  var _React$useState = React.useState(''),
7628
7779
  _React$useState2 = _slicedToArray(_React$useState, 2),
@@ -7774,7 +7925,7 @@ var AddLayersPopup = function AddLayersPopup(_ref) {
7774
7925
  }, "Close")));
7775
7926
  };
7776
7927
 
7777
- var useStyles$y = makeStyles(function (theme) {
7928
+ var useStyles$C = makeStyles(function (theme) {
7778
7929
  return {
7779
7930
  buttonDiv: {
7780
7931
  position: 'relative'
@@ -7809,7 +7960,7 @@ var AddLayersButton = function AddLayersButton(_ref) {
7809
7960
  _ref$shouldFocus = _ref.shouldFocus,
7810
7961
  shouldFocus = _ref$shouldFocus === void 0 ? false : _ref$shouldFocus;
7811
7962
  var ref = React.useRef(null);
7812
- var classes = useStyles$y();
7963
+ var classes = useStyles$C();
7813
7964
 
7814
7965
  var _React$useState = React.useState(false),
7815
7966
  _React$useState2 = _slicedToArray(_React$useState, 2),
@@ -7934,7 +8085,7 @@ var widthToWidthClass = function widthToWidthClass(w) {
7934
8085
  * Copyright 2021 - Koninklijk Nederlands Meteorologisch Instituut (KNMI)
7935
8086
  * Copyright 2021 - Finnish Meteorological Institute (FMI)
7936
8087
  * */
7937
- var useStyles$x = makeStyles(function (theme) {
8088
+ var useStyles$B = makeStyles(function (theme) {
7938
8089
  return {
7939
8090
  button: {
7940
8091
  width: '24px',
@@ -7951,7 +8102,7 @@ var LayerSelectButtonConnect = function LayerSelectButtonConnect(_ref) {
7951
8102
  _ref$source = _ref.source,
7952
8103
  source = _ref$source === void 0 ? 'app' : _ref$source;
7953
8104
  var dispatch = useDispatch();
7954
- var classes = useStyles$x();
8105
+ var classes = useStyles$B();
7955
8106
  var currentActiveMapId = useSelector(function (store) {
7956
8107
  return getDialogMapId(store, 'layerSelect');
7957
8108
  });
@@ -7993,7 +8144,7 @@ var LayerSelectButtonConnect = function LayerSelectButtonConnect(_ref) {
7993
8144
  * Copyright 2021 - Koninklijk Nederlands Meteorologisch Instituut (KNMI)
7994
8145
  * Copyright 2021 - Finnish Meteorological Institute (FMI)
7995
8146
  * */
7996
- var useStyles$w = makeStyles({
8147
+ var useStyles$A = makeStyles({
7997
8148
  row: {
7998
8149
  height: '32px'
7999
8150
  },
@@ -8017,7 +8168,7 @@ var DescriptionRow = function DescriptionRow(_ref) {
8017
8168
  layerManagerWidth = _ref.layerManagerWidth,
8018
8169
  _ref$layerSelect = _ref.layerSelect,
8019
8170
  layerSelect = _ref$layerSelect === void 0 ? false : _ref$layerSelect;
8020
- var classes = useStyles$w();
8171
+ var classes = useStyles$A();
8021
8172
  var columnSizes = layerManagerWidth === LayerManagerWidth.sm ? LayerManagerColumnsSmall() : LayerManagerColumnsLarge();
8022
8173
  return /*#__PURE__*/React.createElement(Grid, {
8023
8174
  container: true,
@@ -8115,39 +8266,31 @@ var useTooltipContainerStyles = makeStyles(function (theme) {
8115
8266
  });
8116
8267
 
8117
8268
  var DimensionSelect = function DimensionSelect(_ref) {
8118
- var layer = _ref.layer,
8119
- mapId = _ref.mapId,
8269
+ var layerId = _ref.layerId,
8120
8270
  onLayerChangeDimension = _ref.onLayerChangeDimension,
8121
- _ref$availableLayerDi = _ref.availableLayerDimensions,
8122
- availableLayerDimensions = _ref$availableLayerDi === void 0 ? [] : _ref$availableLayerDi,
8271
+ _ref$layerDimensions = _ref.layerDimensions,
8272
+ layerDimensions = _ref$layerDimensions === void 0 ? [] : _ref$layerDimensions,
8123
8273
  isEnabled = _ref.isEnabled;
8124
8274
  var classes = useTooltipContainerStyles(isEnabled);
8125
- var defaultDimName = availableLayerDimensions.length ? availableLayerDimensions[0].name : '';
8126
- /* Use state */
8127
8275
 
8128
- var _React$useState = React.useState(defaultDimName),
8276
+ var _React$useState = React.useState(layerDimensions.length ? layerDimensions[0].name : ''),
8129
8277
  _React$useState2 = _slicedToArray(_React$useState, 2),
8130
8278
  activeDimName = _React$useState2[0],
8131
8279
  setActiveDimName = _React$useState2[1];
8132
- /* Use effect to update the active dimension */
8133
-
8134
8280
 
8135
8281
  React.useEffect(function () {
8136
- var activeDim = availableLayerDimensions.find(function (d) {
8282
+ var activeDim = layerDimensions.find(function (d) {
8137
8283
  return d.name === activeDimName;
8138
8284
  });
8139
8285
 
8140
8286
  if (!activeDim) {
8141
- setActiveDimName(availableLayerDimensions.length ? availableLayerDimensions[0].name : '');
8287
+ setActiveDimName(layerDimensions.length ? layerDimensions[0].name : '');
8142
8288
  }
8143
- }, [availableLayerDimensions, activeDimName]);
8144
- if (!availableLayerDimensions.length) return null;
8145
- if (!layer || !layer.id) return null;
8289
+ }, [layerDimensions, activeDimName]);
8290
+ if (!layerDimensions.length || !layerId) return null;
8146
8291
 
8147
8292
  var getValuesToDisplay = function getValuesToDisplay() {
8148
- var wmjsLayer = getWMLayerById(layer.id);
8149
- if (!wmjsLayer) return null;
8150
- var activeWMJSDim = wmjsLayer.getDimension(activeDimName) || wmjsLayer.getDimension(availableLayerDimensions[0].name);
8293
+ var activeWMJSDim = getWMJSDimensionForLayerAndDimension(layerId, activeDimName) || getWMJSDimensionForLayerAndDimension(layerId, layerDimensions[0].name);
8151
8294
  if (!activeWMJSDim) return null;
8152
8295
  var availableDimValues = [];
8153
8296
 
@@ -8163,17 +8306,16 @@ var DimensionSelect = function DimensionSelect(_ref) {
8163
8306
 
8164
8307
  var valuesToDisplay = getValuesToDisplay();
8165
8308
  if (valuesToDisplay === null) return null;
8166
- var activeDimIndex = layer.dimensions.findIndex(function (dim) {
8309
+ var activeDim = layerDimensions.find(function (dim) {
8167
8310
  return dim.name === activeDimName;
8168
8311
  });
8169
- if (activeDimIndex === -1) return null;
8170
- var activeDim = layer.dimensions[activeDimIndex];
8312
+ if (!activeDim) return null;
8171
8313
 
8172
8314
  var selectDimensionValue = function selectDimensionValue(event) {
8173
8315
  event.stopPropagation();
8174
8316
 
8175
8317
  if (activeDim) {
8176
- onLayerChangeDimension(mapId, layer.id, activeDim.name, event.target.value);
8318
+ onLayerChangeDimension(activeDim.name, event.target.value);
8177
8319
  }
8178
8320
  };
8179
8321
 
@@ -8182,12 +8324,12 @@ var DimensionSelect = function DimensionSelect(_ref) {
8182
8324
  setActiveDimName(event.target.value);
8183
8325
  };
8184
8326
 
8185
- var dimNameList = availableLayerDimensions.map(function (dimension) {
8327
+ var dimNameList = layerDimensions.map(function (dimension) {
8186
8328
  return {
8187
8329
  value: dimension.name
8188
8330
  };
8189
8331
  });
8190
- var dimNameCurrentIndex = availableLayerDimensions.findIndex(function (value) {
8332
+ var dimNameCurrentIndex = layerDimensions.findIndex(function (value) {
8191
8333
  return value.name === activeDim.name;
8192
8334
  });
8193
8335
  var dimValueList = valuesToDisplay.map(function (value) {
@@ -8198,6 +8340,7 @@ var DimensionSelect = function DimensionSelect(_ref) {
8198
8340
  var dimValueCurrentIndex = valuesToDisplay.findIndex(function (value) {
8199
8341
  return value === activeDim.currentValue;
8200
8342
  });
8343
+ if (dimValueCurrentIndex === -1) return null;
8201
8344
  return /*#__PURE__*/React.createElement(Grid, {
8202
8345
  container: true,
8203
8346
  direction: "row",
@@ -8227,7 +8370,7 @@ var DimensionSelect = function DimensionSelect(_ref) {
8227
8370
  }
8228
8371
  }, /*#__PURE__*/React.createElement(MenuItem, {
8229
8372
  disabled: true
8230
- }, "Select dimension"), availableLayerDimensions.map(function (dimension) {
8373
+ }, "Select dimension"), layerDimensions.map(function (dimension) {
8231
8374
  return /*#__PURE__*/React.createElement(MenuItem, {
8232
8375
  key: dimension.name,
8233
8376
  value: dimension.name
@@ -8246,7 +8389,7 @@ var DimensionSelect = function DimensionSelect(_ref) {
8246
8389
  currentIndex: dimValueCurrentIndex,
8247
8390
  onChange: selectDimensionValue,
8248
8391
  onChangeMouseWheel: function onChangeMouseWheel(e) {
8249
- return onLayerChangeDimension(mapId, layer.id, activeDim.name, e.value);
8392
+ return onLayerChangeDimension(activeDim.name, e.value);
8250
8393
  },
8251
8394
  style: {
8252
8395
  maxWidth: '50%'
@@ -8277,7 +8420,7 @@ var DimensionSelect = function DimensionSelect(_ref) {
8277
8420
  * Copyright 2021 - Koninklijk Nederlands Meteorologisch Instituut (KNMI)
8278
8421
  * Copyright 2021 - Finnish Meteorological Institute (FMI)
8279
8422
  * */
8280
- var useStyles$v = makeStyles(function (theme) {
8423
+ var useStyles$z = makeStyles(function (theme) {
8281
8424
  return createStyles({
8282
8425
  button: {
8283
8426
  height: 28,
@@ -8336,7 +8479,7 @@ var LayerManagerButton = function LayerManagerButton(_a) {
8336
8479
  testId = _a.testId,
8337
8480
  props = __rest(_a, ["tooltipTitle", "onClick", "isActive", "isEnabled", "icon", "testId"]);
8338
8481
 
8339
- var classes = useStyles$v({
8482
+ var classes = useStyles$z({
8340
8483
  isActive: isActive,
8341
8484
  isEnabled: isEnabled
8342
8485
  });
@@ -8373,7 +8516,7 @@ var LayerManagerButton = function LayerManagerButton(_a) {
8373
8516
  * Copyright 2021 - Koninklijk Nederlands Meteorologisch Instituut (KNMI)
8374
8517
  * Copyright 2021 - Finnish Meteorological Institute (FMI)
8375
8518
  * */
8376
- var useStyles$u = makeStyles(function (theme) {
8519
+ var useStyles$y = makeStyles(function (theme) {
8377
8520
  return createStyles({
8378
8521
  checkbox: {
8379
8522
  color: 'inherit',
@@ -8396,7 +8539,7 @@ var EnableLayer = function EnableLayer(_ref) {
8396
8539
  var isEnabled = _ref.isEnabled,
8397
8540
  title = _ref.title,
8398
8541
  onChangeEnableLayer = _ref.onChangeEnableLayer;
8399
- var classes = useStyles$u(isEnabled);
8542
+ var classes = useStyles$y(isEnabled);
8400
8543
 
8401
8544
  var onClick = function onClick() {
8402
8545
  onChangeEnableLayer(!isEnabled);
@@ -8452,7 +8595,7 @@ var EnableLayer = function EnableLayer(_ref) {
8452
8595
  * Copyright 2021 - Koninklijk Nederlands Meteorologisch Instituut (KNMI)
8453
8596
  * Copyright 2021 - Finnish Meteorological Institute (FMI)
8454
8597
  * */
8455
- var useStyles$t = makeStyles(function (theme) {
8598
+ var useStyles$x = makeStyles(function (theme) {
8456
8599
  return createStyles({
8457
8600
  dropdownEmpty: {
8458
8601
  paddingLeft: 8,
@@ -8475,7 +8618,7 @@ var RenderLayers = function RenderLayers(_ref) {
8475
8618
  layers = _ref$layers === void 0 ? [] : _ref$layers,
8476
8619
  _ref$isEnabled = _ref.isEnabled,
8477
8620
  isEnabled = _ref$isEnabled === void 0 ? true : _ref$isEnabled;
8478
- var classes = useStyles$t();
8621
+ var classes = useStyles$x();
8479
8622
  var containerClass = useTooltipContainerStyles(isEnabled);
8480
8623
 
8481
8624
  if (!layers || !layers.length) {
@@ -8532,7 +8675,7 @@ var RenderLayers = function RenderLayers(_ref) {
8532
8675
  }));
8533
8676
  };
8534
8677
 
8535
- var useStyles$s = makeStyles(function (theme) {
8678
+ var useStyles$w = makeStyles(function (theme) {
8536
8679
  return {
8537
8680
  opacityDiv: {
8538
8681
  height: 'calc(100% - 5px)',
@@ -8593,28 +8736,10 @@ var OpacitySelect = function OpacitySelect(_ref) {
8593
8736
  onLayerChangeOpacity = _ref.onLayerChangeOpacity,
8594
8737
  _ref$isEnabled = _ref.isEnabled,
8595
8738
  isEnabled = _ref$isEnabled === void 0 ? true : _ref$isEnabled;
8596
- var classes = useStyles$s();
8739
+ var classes = useStyles$w();
8597
8740
  var sliderClasses = sliderStyles();
8598
8741
  var containerClass = useTooltipContainerStyles(isEnabled);
8599
8742
 
8600
- var useOutsideAlerter = function useOutsideAlerter(ref) {
8601
- React.useEffect(function () {
8602
- var handleClickOutside = function handleClickOutside(event) {
8603
- if (ref.current && !ref.current.contains(event.target)) {
8604
- setOpen(false);
8605
- }
8606
- };
8607
-
8608
- document.addEventListener('mousedown', handleClickOutside);
8609
- return function () {
8610
- document.removeEventListener('mousedown', handleClickOutside);
8611
- };
8612
- }, [ref]);
8613
- };
8614
-
8615
- var wrapperRef = React.useRef(null);
8616
- useOutsideAlerter(wrapperRef);
8617
-
8618
8743
  var _React$useState = React.useState(false),
8619
8744
  _React$useState2 = _slicedToArray(_React$useState, 2),
8620
8745
  open = _React$useState2[0],
@@ -8625,6 +8750,19 @@ var OpacitySelect = function OpacitySelect(_ref) {
8625
8750
  tooltipOpen = _React$useState4[0],
8626
8751
  setTooltipOpen = _React$useState4[1];
8627
8752
 
8753
+ var preventDefault = function preventDefault(event) {
8754
+ event.preventDefault();
8755
+ event.stopPropagation();
8756
+ };
8757
+
8758
+ var enableScroll = React.useCallback(function () {
8759
+ document.removeEventListener('wheel', preventDefault, false);
8760
+ }, []);
8761
+ var disableScroll = React.useCallback(function () {
8762
+ document.addEventListener('wheel', preventDefault, {
8763
+ passive: false
8764
+ });
8765
+ }, []);
8628
8766
  var onWheel = React.useCallback(function (event) {
8629
8767
  var multiplier = event.altKey ? 10 : 1;
8630
8768
  var direction = event.deltaY > 0 ? 0.01 * multiplier : -0.01 * multiplier;
@@ -8640,21 +8778,25 @@ var OpacitySelect = function OpacitySelect(_ref) {
8640
8778
  }
8641
8779
  }, [open]);
8642
8780
  var onMouseEnter = React.useCallback(function () {
8781
+ disableScroll();
8643
8782
  if (!open) setTooltipOpen(true);
8644
- }, [open]);
8783
+ }, [open, disableScroll]);
8645
8784
  var onMouseLeave = React.useCallback(function () {
8785
+ enableScroll();
8646
8786
  setTooltipOpen(false);
8647
- }, []);
8787
+ }, [enableScroll]);
8648
8788
  var onFocus = React.useCallback(function () {
8789
+ disableScroll();
8649
8790
  setTooltipOpen(true);
8650
- }, []);
8791
+ }, [disableScroll]);
8651
8792
  var onBlur = React.useCallback(function () {
8793
+ enableScroll();
8652
8794
  setTooltipOpen(false);
8653
- }, []);
8795
+ }, [enableScroll]);
8654
8796
  return /*#__PURE__*/React.createElement("div", {
8655
8797
  className: classes.opacityDiv,
8656
- ref: wrapperRef,
8657
- onWheel: onWheel
8798
+ onWheel: onWheel,
8799
+ "data-testid": "scrollOpacity"
8658
8800
  }, /*#__PURE__*/React.createElement(Tooltip, {
8659
8801
  title: tooltipTitle,
8660
8802
  className: containerClass.textContainer,
@@ -8706,7 +8848,7 @@ var OpacitySelect = function OpacitySelect(_ref) {
8706
8848
  * Copyright 2021 - Koninklijk Nederlands Meteorologisch Instituut (KNMI)
8707
8849
  * Copyright 2021 - Finnish Meteorological Institute (FMI)
8708
8850
  * */
8709
- var useStyles$r = makeStyles(function (theme) {
8851
+ var useStyles$v = makeStyles(function (theme) {
8710
8852
  return createStyles({
8711
8853
  icon: {
8712
8854
  minWidth: 32,
@@ -8723,7 +8865,7 @@ var MenuItemButton = function MenuItemButton(_ref) {
8723
8865
  var title = _ref.title,
8724
8866
  tooltipTitle = _ref.tooltipTitle,
8725
8867
  icon = _ref.icon;
8726
- var classes = useStyles$r();
8868
+ var classes = useStyles$v();
8727
8869
  return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(ListItemIcon, {
8728
8870
  className: "".concat(classes.icon, " icon")
8729
8871
  }, icon), /*#__PURE__*/React.createElement(Tooltip, {
@@ -8735,7 +8877,7 @@ var MenuItemButton = function MenuItemButton(_ref) {
8735
8877
  }, title)));
8736
8878
  };
8737
8879
 
8738
- var useStyles$q = makeStyles(function (theme) {
8880
+ var useStyles$u = makeStyles(function (theme) {
8739
8881
  return {
8740
8882
  menu: {
8741
8883
  backgroundColor: theme.palette.geowebColors.background.surface,
@@ -8753,7 +8895,7 @@ var LayerManagerMenuButton = function LayerManagerMenuButton(_ref) {
8753
8895
  onLayerDuplicate = _ref.onLayerDuplicate,
8754
8896
  _ref$isEnabled = _ref.isEnabled,
8755
8897
  isEnabled = _ref$isEnabled === void 0 ? true : _ref$isEnabled;
8756
- var classes = useStyles$q();
8898
+ var classes = useStyles$u();
8757
8899
 
8758
8900
  var _React$useState = React.useState(null),
8759
8901
  _React$useState2 = _slicedToArray(_React$useState, 2),
@@ -8803,9 +8945,9 @@ var LayerManagerMenuButton = function LayerManagerMenuButton(_ref) {
8803
8945
  };
8804
8946
 
8805
8947
  var RenderStyles = function RenderStyles(_ref) {
8806
- var services = _ref.services,
8807
- layer = _ref.layer,
8808
- mapId = _ref.mapId,
8948
+ var layerName = _ref.layerName,
8949
+ layerStyles = _ref.layerStyles,
8950
+ currentLayerStyle = _ref.currentLayerStyle,
8809
8951
  onChangeLayerStyle = _ref.onChangeLayerStyle,
8810
8952
  _ref$isEnabled = _ref.isEnabled,
8811
8953
  isEnabled = _ref$isEnabled === void 0 ? true : _ref$isEnabled;
@@ -8817,22 +8959,15 @@ var RenderStyles = function RenderStyles(_ref) {
8817
8959
  legendURL: ''
8818
8960
  }];
8819
8961
 
8820
- if (services && layer && layer.service && services[layer.service] && services[layer.service].layer) {
8821
- var serviceLayer = services[layer.service].layer[layer.name];
8822
-
8823
- if (serviceLayer && serviceLayer.styles && serviceLayer.styles.length > 0) {
8824
- styles.push.apply(styles, _toConsumableArray(serviceLayer.styles));
8825
- }
8962
+ if (layerStyles && layerStyles.length > 0) {
8963
+ styles.push.apply(styles, _toConsumableArray(layerStyles));
8826
8964
  }
8827
8965
 
8828
- var currentStyle = styles.filter(function (l) {
8829
- return l.name === layer.style;
8830
- })[0];
8831
- var styleValue = currentStyle || styles[0];
8966
+ var currentStyle = currentLayerStyle !== '' ? currentLayerStyle : styles[0].name;
8832
8967
 
8833
8968
  var selectStyle = function selectStyle(event) {
8834
8969
  event.stopPropagation();
8835
- onChangeLayerStyle(mapId, layer.id, event.target.value);
8970
+ onChangeLayerStyle(event.target.value);
8836
8971
  };
8837
8972
 
8838
8973
  var list = styles.map(function (style) {
@@ -8840,24 +8975,24 @@ var RenderStyles = function RenderStyles(_ref) {
8840
8975
  value: style.name
8841
8976
  };
8842
8977
  });
8843
- var currentIndex = styles.findIndex(function (layer) {
8844
- return styleValue.name === layer.name;
8978
+ var currentIndex = styles.findIndex(function (style) {
8979
+ return currentStyle === style.name;
8845
8980
  });
8846
8981
  return /*#__PURE__*/React.createElement(TooltipSelect, {
8847
8982
  disableUnderline: true,
8848
- tooltip: "Select a style for layer ".concat(layer.name),
8983
+ tooltip: "Select a style for layer ".concat(layerName),
8849
8984
  inputProps: {
8850
8985
  SelectDisplayProps: {
8851
8986
  'data-testid': 'selectStyle'
8852
8987
  }
8853
8988
  },
8854
8989
  className: classes.textContainer,
8855
- value: styleValue.name,
8990
+ value: currentStyle,
8856
8991
  list: list,
8857
8992
  currentIndex: currentIndex,
8858
8993
  onChange: selectStyle,
8859
8994
  onChangeMouseWheel: function onChangeMouseWheel(e) {
8860
- return onChangeLayerStyle(mapId, layer.id, e.value);
8995
+ return onChangeLayerStyle(e.value);
8861
8996
  }
8862
8997
  }, /*#__PURE__*/React.createElement(MenuItem, {
8863
8998
  disabled: true
@@ -8885,7 +9020,7 @@ var RenderStyles = function RenderStyles(_ref) {
8885
9020
  * Copyright 2021 - Koninklijk Nederlands Meteorologisch Instituut (KNMI)
8886
9021
  * Copyright 2021 - Finnish Meteorological Institute (FMI)
8887
9022
  * */
8888
- var useStyles$p = makeStyles(function () {
9023
+ var useStyles$t = makeStyles(function () {
8889
9024
  return createStyles({
8890
9025
  icon: {
8891
9026
  width: 20,
@@ -8899,7 +9034,7 @@ var DeleteButton = function DeleteButton(_ref) {
8899
9034
  onClickDelete = _ref.onClickDelete,
8900
9035
  _ref$isEnabled = _ref.isEnabled,
8901
9036
  isEnabled = _ref$isEnabled === void 0 ? true : _ref$isEnabled;
8902
- var classes = useStyles$p();
9037
+ var classes = useStyles$t();
8903
9038
  return /*#__PURE__*/React.createElement(LayerManagerButton, {
8904
9039
  tooltipTitle: tooltipTitle,
8905
9040
  onClick: onClickDelete,
@@ -8927,7 +9062,7 @@ var DeleteButton = function DeleteButton(_ref) {
8927
9062
  * Copyright 2021 - Koninklijk Nederlands Meteorologisch Instituut (KNMI)
8928
9063
  * Copyright 2021 - Finnish Meteorological Institute (FMI)
8929
9064
  * */
8930
- var useStyles$o = makeStyles(function (theme) {
9065
+ var useStyles$s = makeStyles(function (theme) {
8931
9066
  return createStyles({
8932
9067
  icon: {
8933
9068
  width: 18,
@@ -8964,7 +9099,7 @@ var ActivateLayer = function ActivateLayer(_ref2) {
8964
9099
  isActive = _ref2$isActive === void 0 ? false : _ref2$isActive,
8965
9100
  _ref2$isEnabled = _ref2.isEnabled,
8966
9101
  isEnabled = _ref2$isEnabled === void 0 ? true : _ref2$isEnabled;
8967
- var classes = useStyles$o({
9102
+ var classes = useStyles$s({
8968
9103
  isActive: isActive,
8969
9104
  isEnabled: isEnabled
8970
9105
  });
@@ -9013,7 +9148,7 @@ var ActivateLayer = function ActivateLayer(_ref2) {
9013
9148
  * Copyright 2021 - Koninklijk Nederlands Meteorologisch Instituut (KNMI)
9014
9149
  * Copyright 2021 - Finnish Meteorological Institute (FMI)
9015
9150
  * */
9016
- var useStyles$n = makeStyles(function (theme) {
9151
+ var useStyles$r = makeStyles(function (theme) {
9017
9152
  return createStyles({
9018
9153
  row: {
9019
9154
  background: function background(isEnabled) {
@@ -9064,7 +9199,7 @@ var LayerRow = function LayerRow(_ref) {
9064
9199
  layerActiveLayout = _ref.layerActiveLayout,
9065
9200
  layerManagerWidth = _ref.layerManagerWidth,
9066
9201
  dragHandle = _ref.dragHandle;
9067
- var classes = useStyles$n(isEnabled);
9202
+ var classes = useStyles$r(isEnabled);
9068
9203
  var columnSizes = layerManagerWidth === LayerManagerWidth.sm ? LayerManagerColumnsSmall() : LayerManagerColumnsLarge();
9069
9204
 
9070
9205
  var onClickRow = function onClickRow() {
@@ -9106,12 +9241,12 @@ var LayerRow = function LayerRow(_ref) {
9106
9241
  item: true,
9107
9242
  className: "".concat(columnSizes.column3)
9108
9243
  }, layerStylesLayout || /*#__PURE__*/React__default.createElement(RenderStyles, {
9109
- services: services,
9110
- mapId: mapId,
9111
- layer: layer,
9112
- onChangeLayerStyle: function onChangeLayerStyle(_mapId, _layerId, style) {
9244
+ layerStyles: layer.styles,
9245
+ layerName: layer.name,
9246
+ currentLayerStyle: layer.style,
9247
+ onChangeLayerStyle: function onChangeLayerStyle(style) {
9113
9248
  onLayerChangeStyle({
9114
- layerId: _layerId,
9249
+ layerId: layerId,
9115
9250
  style: style
9116
9251
  });
9117
9252
  }
@@ -9131,10 +9266,9 @@ var LayerRow = function LayerRow(_ref) {
9131
9266
  item: true,
9132
9267
  className: "".concat(columnSizes.column5)
9133
9268
  }, layerDimensionLayout || /*#__PURE__*/React__default.createElement(DimensionSelect, {
9134
- layer: layer,
9135
- mapId: mapId,
9136
- availableLayerDimensions: filterNonTimeDimensions(layer.dimensions),
9137
- onLayerChangeDimension: function onLayerChangeDimension(_mapId, _layerId, dimensionName, dimensionValue) {
9269
+ layerId: layerId,
9270
+ layerDimensions: filterNonTimeDimensions(layer.dimensions),
9271
+ onLayerChangeDimension: function onLayerChangeDimension(dimensionName, dimensionValue) {
9138
9272
  var dimension = {
9139
9273
  name: dimensionName,
9140
9274
  currentValue: dimensionValue
@@ -9314,40 +9448,33 @@ var OpacitySelectConnect = function OpacitySelectConnect(_ref) {
9314
9448
  * */
9315
9449
 
9316
9450
  var DimensionSelectConnect = function DimensionSelectConnect(_ref) {
9317
- var layerId = _ref.layerId,
9318
- mapId = _ref.mapId;
9451
+ var layerId = _ref.layerId;
9319
9452
  var dispatch = useDispatch();
9320
- var layer = useSelector(function (store) {
9321
- return getLayerById(store, layerId);
9322
- });
9323
- var availableLayerDimensions = useSelector(function (store) {
9453
+ var layerDimensions = useSelector(function (store) {
9324
9454
  return getLayerNonTimeDimensions(store, layerId);
9325
9455
  });
9456
+ var isLayerEnabled = useSelector(function (store) {
9457
+ return getLayerEnabled(store, layerId);
9458
+ });
9326
9459
  var layerChangeDimension$1 = React.useCallback(function (_ref2) {
9327
9460
  var origin = _ref2.origin,
9328
- layerId = _ref2.layerId,
9329
9461
  dimension = _ref2.dimension;
9330
9462
  return dispatch(layerChangeDimension({
9331
9463
  origin: origin,
9332
9464
  layerId: layerId,
9333
9465
  dimension: dimension
9334
9466
  }));
9335
- }, [dispatch]);
9336
- var isLayerEnabled = useSelector(function (store) {
9337
- return getLayerEnabled(store, layerId);
9338
- });
9467
+ }, [layerId, dispatch]);
9339
9468
  return /*#__PURE__*/React.createElement(DimensionSelect, {
9340
- layer: layer,
9341
- mapId: mapId,
9342
- availableLayerDimensions: availableLayerDimensions,
9343
- onLayerChangeDimension: function onLayerChangeDimension(_mapId, _layerId, dimensionName, dimensionValue) {
9469
+ layerId: layerId,
9470
+ layerDimensions: layerDimensions,
9471
+ onLayerChangeDimension: function onLayerChangeDimension(dimensionName, dimensionValue) {
9344
9472
  var dimension = {
9345
9473
  name: dimensionName,
9346
9474
  currentValue: dimensionValue
9347
9475
  };
9348
9476
  layerChangeDimension$1({
9349
9477
  origin: 'layerrow',
9350
- layerId: layerId,
9351
9478
  dimension: dimension
9352
9479
  });
9353
9480
  },
@@ -9373,37 +9500,31 @@ var DimensionSelectConnect = function DimensionSelectConnect(_ref) {
9373
9500
  * */
9374
9501
 
9375
9502
  var RenderStylesConnect = function RenderStylesConnect(_ref) {
9376
- var mapId = _ref.mapId,
9377
- layerId = _ref.layerId;
9378
- var dispatch = useDispatch(); // TODO: (Sander de Snaijer 2020-03-30 make specific selectors with layerId to prevent rerenders)
9379
-
9380
- var services = useSelector(function (store) {
9381
- return getServices(store);
9503
+ var layerId = _ref.layerId;
9504
+ var dispatch = useDispatch();
9505
+ var layerName = useSelector(function (store) {
9506
+ return getLayerName(store, layerId);
9382
9507
  });
9383
- var layer = useSelector(function (store) {
9384
- return getLayerById(store, layerId);
9508
+ var layerStyles = useSelector(function (store) {
9509
+ return getLayerStyles(store, layerId);
9385
9510
  });
9386
- var layerChangeStyle$1 = React.useCallback(function (_ref2) {
9387
- var layerId = _ref2.layerId,
9388
- style = _ref2.style;
9511
+ var currentLayerStyle = useSelector(function (store) {
9512
+ return getLayerStyle(store, layerId);
9513
+ });
9514
+ var isLayerEnabled = useSelector(function (store) {
9515
+ return getLayerEnabled(store, layerId);
9516
+ });
9517
+ var layerChangeStyle$1 = React.useCallback(function (style) {
9389
9518
  return dispatch(layerChangeStyle({
9390
9519
  layerId: layerId,
9391
9520
  style: style
9392
9521
  }));
9393
- }, [dispatch]);
9394
- var isLayerEnabled = useSelector(function (store) {
9395
- return getLayerEnabled(store, layerId);
9396
- });
9522
+ }, [layerId, dispatch]);
9397
9523
  return /*#__PURE__*/React.createElement(RenderStyles, {
9398
- mapId: mapId,
9399
- layer: layer,
9400
- services: services,
9401
- onChangeLayerStyle: function onChangeLayerStyle(_, layerId, style) {
9402
- layerChangeStyle$1({
9403
- layerId: layerId,
9404
- style: style
9405
- });
9406
- },
9524
+ layerStyles: layerStyles,
9525
+ layerName: layerName,
9526
+ currentLayerStyle: currentLayerStyle,
9527
+ onChangeLayerStyle: layerChangeStyle$1,
9407
9528
  isEnabled: isLayerEnabled
9408
9529
  });
9409
9530
  };
@@ -9616,12 +9737,10 @@ var LayerRowConnect = function LayerRowConnect(_ref) {
9616
9737
  layerServicesLayout: /*#__PURE__*/React.createElement(RenderLayersConnect, {
9617
9738
  layerId: layerId
9618
9739
  }),
9619
- layerStylesLayout: /*#__PURE__*/React.createElement(RenderStylesConnect, {
9620
- mapId: mapId,
9740
+ layerDimensionLayout: /*#__PURE__*/React.createElement(DimensionSelectConnect, {
9621
9741
  layerId: layerId
9622
9742
  }),
9623
- layerDimensionLayout: /*#__PURE__*/React.createElement(DimensionSelectConnect, {
9624
- mapId: mapId,
9743
+ layerStylesLayout: /*#__PURE__*/React.createElement(RenderStylesConnect, {
9625
9744
  layerId: layerId
9626
9745
  }),
9627
9746
  layerDeleteLayout: /*#__PURE__*/React.createElement(DeleteLayerConnect, {
@@ -9659,7 +9778,7 @@ var LayerRowConnect = function LayerRowConnect(_ref) {
9659
9778
  * Copyright 2021 - Finnish Meteorological Institute (FMI)
9660
9779
  * */
9661
9780
  var TOOLTIP_TITLE = 'Drag a layer up or down';
9662
- var useStyles$m = makeStyles(function (theme) {
9781
+ var useStyles$q = makeStyles(function (theme) {
9663
9782
  return {
9664
9783
  dragHandle: {
9665
9784
  cursor: 'grab',
@@ -9682,7 +9801,7 @@ var DragHandle = function DragHandle(_ref2) {
9682
9801
  index = _ref2$index === void 0 ? undefined : _ref2$index,
9683
9802
  _ref2$hideTooltip = _ref2.hideTooltip,
9684
9803
  hideTooltip = _ref2$hideTooltip === void 0 ? false : _ref2$hideTooltip;
9685
- var classes = useStyles$m({
9804
+ var classes = useStyles$q({
9686
9805
  isDisabled: isDisabled
9687
9806
  });
9688
9807
  var tooltipTitle = hideTooltip ? '' : TOOLTIP_TITLE;
@@ -9699,7 +9818,7 @@ var DragHandle = function DragHandle(_ref2) {
9699
9818
  });
9700
9819
  };
9701
9820
 
9702
- var useStyles$l = makeStyles(function () {
9821
+ var useStyles$p = makeStyles(function () {
9703
9822
  return {
9704
9823
  layerRows: {
9705
9824
  width: '100%',
@@ -9766,7 +9885,7 @@ var LayerContainerRow = function LayerContainerRow(_ref) {
9766
9885
 
9767
9886
  var isSorting = activeDragIndex !== null;
9768
9887
  var isDragDisabled = layerIds.length === 1;
9769
- var classes = useStyles$l(isSorting);
9888
+ var classes = useStyles$p(isSorting);
9770
9889
  return /*#__PURE__*/React.createElement(Grid, {
9771
9890
  container: true,
9772
9891
  item: true,
@@ -9976,7 +10095,7 @@ var BaseLayersConnect = function BaseLayersConnect(_ref) {
9976
10095
  * Copyright 2021 - Koninklijk Nederlands Meteorologisch Instituut (KNMI)
9977
10096
  * Copyright 2021 - Finnish Meteorological Institute (FMI)
9978
10097
  * */
9979
- var useStyles$k = makeStyles({
10098
+ var useStyles$o = makeStyles({
9980
10099
  layerRow: {
9981
10100
  width: '100%',
9982
10101
  height: '36px'
@@ -9999,7 +10118,7 @@ var BaseLayerRow = function BaseLayerRow(_ref) {
9999
10118
  layerManagerWidth = _ref.layerManagerWidth,
10000
10119
  _ref$tooltip = _ref.tooltip,
10001
10120
  tooltip = _ref$tooltip === void 0 ? '' : _ref$tooltip;
10002
- var classes = useStyles$k();
10121
+ var classes = useStyles$o();
10003
10122
  var columnSizes = layerManagerWidth === LayerManagerWidth.sm ? LayerManagerColumnsSmall() : LayerManagerColumnsLarge();
10004
10123
  return /*#__PURE__*/React.createElement(Grid, {
10005
10124
  container: true,
@@ -10028,7 +10147,7 @@ var BaseLayerRow = function BaseLayerRow(_ref) {
10028
10147
  })));
10029
10148
  };
10030
10149
 
10031
- var useStyles$j = makeStyles({
10150
+ var useStyles$n = makeStyles({
10032
10151
  layerRowContainer: {
10033
10152
  position: 'relative',
10034
10153
  width: '100%',
@@ -10063,7 +10182,7 @@ var LayerManager = function LayerManager(_ref) {
10063
10182
  layerSelect = _ref$layerSelect === void 0 ? false : _ref$layerSelect,
10064
10183
  _ref$showAddLayersToo = _ref.showAddLayersTooltip,
10065
10184
  showAddLayersTooltip = _ref$showAddLayersToo === void 0 ? true : _ref$showAddLayersToo;
10066
- var classes = useStyles$j();
10185
+ var classes = useStyles$n();
10067
10186
 
10068
10187
  var _React$useState = React.useState(LayerManagerWidth.lg),
10069
10188
  _React$useState2 = _slicedToArray(_React$useState, 2),
@@ -10120,6 +10239,228 @@ var LayerManager = function LayerManager(_ref) {
10120
10239
  }))));
10121
10240
  };
10122
10241
 
10242
+ var useStyles$m = makeStyles(function (theme) {
10243
+ return {
10244
+ iconButton: {
10245
+ color: theme.palette.geowebColors.typographyAndIcons.buttonIconTertiaryFlat
10246
+ }
10247
+ };
10248
+ });
10249
+ var clearIconPath = 'M12,2 C17.5228475,2 22,6.4771525 22,12 C22,17.5228475 17.5228475,22 12,22 C6.4771525,22 2,17.5228475 2,12 C2,6.4771525 6.4771525,2 12,2 Z M15.44426,7.26697571 L12.0002861,10.7110482 L8.55573996,7.26697571 C8.19978253,6.9110081 7.62292549,6.9110081 7.26696807,7.26697571 C6.91101064,7.62294331 6.91101064,8.19981687 7.26696807,8.55578447 L10.7115142,11.9998569 L7.26696807,15.4445017 C6.91101064,15.8004693 6.91101064,16.3767705 7.26696807,16.7333104 C7.44494678,16.910722 7.67843653,17 7.91192629,17 C8.14484377,17 8.37776125,16.910722 8.55573996,16.7333104 L12.0002861,13.289238 L15.44426,16.7333104 C15.6222388,16.910722 15.8551562,17 16.088646,17 C16.3221357,17 16.5550532,16.910722 16.7330319,16.7333104 C17.0889894,16.3767705 17.0889894,15.8004693 16.7330319,15.4445017 L13.289058,11.9998569 L16.7330319,8.55578447 C17.0889894,8.19981687 17.0889894,7.62294331 16.7330319,7.26697571 C16.3770745,6.9110081 15.8002175,6.9110081 15.44426,7.26697571 Z';
10250
+ var clearIcon = /*#__PURE__*/React.createElement(SvgIcon, {
10251
+ style: {
10252
+ width: '24px',
10253
+ height: '24px'
10254
+ },
10255
+ viewBox: "0 0 24 24",
10256
+ xmlns: "http://www.w3.org/2000/svg"
10257
+ }, /*#__PURE__*/React.createElement("path", {
10258
+ d: clearIconPath
10259
+ }));
10260
+ var searchIconPath = 'M7.81701445,12.5845372 L7.81701445,12.5845372 C7.17924024,11.946763 6.82932049,11.100321 6.82932049,10.1993044 C6.82932049,9.29828785 7.17924024,8.45077582 7.81701445,7.8140717 C8.47405029,7.15703585 9.3376137,6.82851792 10.2022472,6.82851792 C11.0658106,6.82851792 11.929374,7.15703585 12.5874799,7.8140717 C13.9026217,9.12921348 13.9026217,11.2693954 12.5874799,12.5845372 C11.9497057,13.2212413 11.1021937,13.5722311 10.2022472,13.5722311 C9.3012306,13.5722311 8.45371857,13.2212413 7.81701445,12.5845372 M19.5858748,17.581862 L15.4681648,13.465222 C16.9513109,11.0735688 16.6613162,7.88683788 14.5874799,5.81300161 C12.1690744,3.39566613 8.23434992,3.39566613 5.81594436,5.81300161 C4.64419476,6.9847512 4,8.54280364 4,10.1993044 C4,11.8558052 4.64419476,13.4138577 5.81594436,14.5845372 C6.98769395,15.7562868 8.5446763,16.4015516 10.2022472,16.4015516 C11.376137,16.4015516 12.4965222,16.0719636 13.4681648,15.4662921 L17.5837346,19.582932 C17.8608882,19.8590155 18.2225789,19.9970572 18.5853398,19.9970572 C18.9470305,19.9970572 19.3087212,19.8590155 19.5858748,19.582932 C20.1380417,19.029695 20.1380417,18.135099 19.5858748,17.581862';
10261
+ var searchIcon = /*#__PURE__*/React.createElement(SvgIcon, {
10262
+ style: {
10263
+ width: '24px',
10264
+ height: '24px'
10265
+ },
10266
+ viewBox: "0 0 24 24",
10267
+ xmlns: "http://www.w3.org/2000/svg"
10268
+ }, /*#__PURE__*/React.createElement("path", {
10269
+ d: searchIconPath
10270
+ }));
10271
+
10272
+ var SearchField = function SearchField() {
10273
+ var _React$useState = React.useState(''),
10274
+ _React$useState2 = _slicedToArray(_React$useState, 2),
10275
+ searchString = _React$useState2[0],
10276
+ setSearchString = _React$useState2[1];
10277
+
10278
+ var classes = useStyles$m();
10279
+ return /*#__PURE__*/React.createElement(TextField, {
10280
+ variant: "filled",
10281
+ label: "Search through services or enter a service URL",
10282
+ value: searchString,
10283
+ onChange: function onChange(e) {
10284
+ return setSearchString(e.target.value);
10285
+ },
10286
+ autoFocus: true,
10287
+ fullWidth: true,
10288
+ InputProps: {
10289
+ endAdornment: /*#__PURE__*/React.createElement(InputAdornment, {
10290
+ position: "end"
10291
+ }, searchString ? /*#__PURE__*/React.createElement(Tooltip, {
10292
+ title: "Clear",
10293
+ placement: "top"
10294
+ }, /*#__PURE__*/React.createElement(IconButton, {
10295
+ className: classes.iconButton,
10296
+ edge: "end",
10297
+ onClick: function onClick() {
10298
+ return setSearchString('');
10299
+ }
10300
+ }, clearIcon)) : /*#__PURE__*/React.createElement(Tooltip, {
10301
+ title: "Search",
10302
+ placement: "top"
10303
+ }, /*#__PURE__*/React.createElement(IconButton, {
10304
+ className: classes.iconButton,
10305
+ edge: "end"
10306
+ }, searchIcon)))
10307
+ }
10308
+ });
10309
+ };
10310
+
10311
+ /* *
10312
+ * Licensed under the Apache License, Version 2.0 (the "License");
10313
+ * you may not use this file except in compliance with the License.
10314
+ * You may obtain a copy of the License at
10315
+ *
10316
+ * http://www.apache.org/licenses/LICENSE-2.0
10317
+ *
10318
+ * Unless required by applicable law or agreed to in writing, software
10319
+ * distributed under the License is distributed on an "AS IS" BASIS,
10320
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
10321
+ * See the License for the specific language governing permissions and
10322
+ * limitations under the License.
10323
+ *
10324
+ * Copyright 2021 - Koninklijk Nederlands Meteorologisch Instituut (KNMI)
10325
+ * Copyright 2021 - Finnish Meteorological Institute (FMI)
10326
+ * */
10327
+ var useStyles$l = makeStyles(function (theme) {
10328
+ return createStyles({
10329
+ chip: {
10330
+ height: '32px',
10331
+ margin: '0 8px 0 0',
10332
+ padding: '5px 12px 7px',
10333
+ borderRadius: '20px',
10334
+ border: "solid 1px ".concat(theme.palette.geowebColors.typographyAndIcons.buttonIconTertiaryFlat),
10335
+ backgroundColor: theme.palette.geowebColors.buttons.surfaceIconDefault.fill,
10336
+ color: theme.palette.geowebColors.typographyAndIcons.buttonIconTertiaryFlat,
10337
+ "float": 'left',
10338
+ whiteSpace: 'nowrap',
10339
+ '&:hover': {
10340
+ backgroundColor: theme.palette.geowebColors.buttons.flatMouseover.fill,
10341
+ cursor: 'pointer'
10342
+ }
10343
+ }
10344
+ });
10345
+ });
10346
+
10347
+ var ServiceChip = function ServiceChip(_ref) {
10348
+ var _ref$all = _ref.all,
10349
+ all = _ref$all === void 0 ? false : _ref$all,
10350
+ service = _ref.service;
10351
+ var classes = useStyles$l();
10352
+
10353
+ if (all) {
10354
+ return /*#__PURE__*/React.createElement("div", {
10355
+ className: classes.chip,
10356
+ "data-testid": "serviceChipAll"
10357
+ }, "All");
10358
+ }
10359
+
10360
+ if (service && service.name) {
10361
+ return /*#__PURE__*/React.createElement("div", {
10362
+ className: classes.chip,
10363
+ "data-testid": "serviceChip"
10364
+ }, service.name);
10365
+ }
10366
+
10367
+ return /*#__PURE__*/React.createElement("div", {
10368
+ className: classes.chip
10369
+ });
10370
+ };
10371
+
10372
+ var useStyles$k = makeStyles(function (theme) {
10373
+ return createStyles({
10374
+ serviceChips: {
10375
+ width: '100%',
10376
+ display: 'inline-flex',
10377
+ alignItems: 'center',
10378
+ overflowX: 'visible',
10379
+ "float": 'left',
10380
+ paddingLeft: '32px'
10381
+ },
10382
+ scrollArrowLeft: {
10383
+ width: '120px',
10384
+ marginBottom: '-12px',
10385
+ height: '34px',
10386
+ backgroundImage: "linear-gradient(to left, rgba(0, 0, 0, 0), ".concat(theme.palette.geowebColors.background.surfaceApp, " 51%)"),
10387
+ marginLeft: '-100%',
10388
+ cursor: 'pointer'
10389
+ },
10390
+ serviceList: {
10391
+ height: '32px',
10392
+ marginTop: '8px',
10393
+ width: '100%',
10394
+ overflowX: 'hidden',
10395
+ marginRight: '-120px'
10396
+ },
10397
+ scrollArrowRight: {
10398
+ width: '120px',
10399
+ marginBottom: '-12px',
10400
+ height: '34px',
10401
+ backgroundImage: "linear-gradient(to right, rgba(0, 0, 0, 0), ".concat(theme.palette.geowebColors.background.surfaceApp, " 51%)"),
10402
+ right: '0px',
10403
+ position: 'fixed',
10404
+ cursor: 'pointer'
10405
+ }
10406
+ });
10407
+ });
10408
+
10409
+ var ServiceList = function ServiceList(_ref) {
10410
+ var layerSelectWidth = _ref.layerSelectWidth,
10411
+ services = _ref.services;
10412
+ var classes = useStyles$k();
10413
+
10414
+ var _React$useState = React.useState(0),
10415
+ _React$useState2 = _slicedToArray(_React$useState, 2),
10416
+ margin = _React$useState2[0],
10417
+ setMargin = _React$useState2[1];
10418
+
10419
+ var _React$useState3 = React.useState(0),
10420
+ _React$useState4 = _slicedToArray(_React$useState3, 2),
10421
+ width = _React$useState4[0],
10422
+ setWidth = _React$useState4[1];
10423
+
10424
+ var ref = React.useRef(null);
10425
+ var onLeftArrowClick = React.useCallback(function () {
10426
+ setMargin(Math.max(0, margin - 100));
10427
+ }, [margin]);
10428
+ var onRightArrowClick = React.useCallback(function () {
10429
+ setMargin(Math.min(width - layerSelectWidth, margin + 100));
10430
+ }, [margin, layerSelectWidth, width]);
10431
+ var gapRight = 35;
10432
+ React.useEffect(function () {
10433
+ setWidth(ref.current.scrollWidth + gapRight);
10434
+ }, [services, layerSelectWidth]);
10435
+ return /*#__PURE__*/React.createElement("div", {
10436
+ className: classes.serviceList,
10437
+ "data-testid": "serviceList"
10438
+ }, margin !== 0 && /*#__PURE__*/React.createElement(ChevronLeft, {
10439
+ className: classes.scrollArrowLeft,
10440
+ onClick: onLeftArrowClick,
10441
+ "data-testid": "leftScrollArrow"
10442
+ }), /*#__PURE__*/React.createElement("div", {
10443
+ className: classes.serviceChips,
10444
+ style: {
10445
+ marginLeft: "".concat(-margin, "px"),
10446
+ marginRight: "".concat(margin, "px")
10447
+ },
10448
+ ref: ref
10449
+ }, services && Object.keys(services) && Object.keys(services).length > 0 && /*#__PURE__*/React.createElement(ServiceChip, {
10450
+ key: "All",
10451
+ all: true
10452
+ }), Object.keys(services).map(function (service) {
10453
+ return /*#__PURE__*/React.createElement(ServiceChip, {
10454
+ key: services[service].id,
10455
+ service: services[service]
10456
+ });
10457
+ })), margin < width - layerSelectWidth - gapRight && /*#__PURE__*/React.createElement(ChevronRight, {
10458
+ className: classes.scrollArrowRight,
10459
+ onClick: onRightArrowClick,
10460
+ "data-testid": "rightScrollArrow"
10461
+ }));
10462
+ };
10463
+
10123
10464
  /* *
10124
10465
  * Licensed under the Apache License, Version 2.0 (the "License");
10125
10466
  * you may not use this file except in compliance with the License.
@@ -10137,6 +10478,23 @@ var LayerManager = function LayerManager(_ref) {
10137
10478
  * Copyright 2021 - Finnish Meteorological Institute (FMI)
10138
10479
  * */
10139
10480
 
10481
+ var ServiceListConnect = function ServiceListConnect(_ref) {
10482
+ var layerSelectWidth = _ref.layerSelectWidth;
10483
+ var services = useSelector(function (store) {
10484
+ return getServices(store);
10485
+ });
10486
+ return /*#__PURE__*/React.createElement(ServiceList, {
10487
+ layerSelectWidth: layerSelectWidth,
10488
+ services: services
10489
+ });
10490
+ };
10491
+
10492
+ var useStyles$j = makeStyles({
10493
+ serviceList: {
10494
+ height: '48px'
10495
+ }
10496
+ });
10497
+
10140
10498
  var LayerSelect = function LayerSelect(_ref) {
10141
10499
  var mapId = _ref.mapId,
10142
10500
  bounds = _ref.bounds,
@@ -10150,20 +10508,32 @@ var LayerSelect = function LayerSelect(_ref) {
10150
10508
  order = _ref$order === void 0 ? 0 : _ref$order,
10151
10509
  _ref$source = _ref.source,
10152
10510
  source = _ref$source === void 0 ? 'module' : _ref$source;
10511
+ var classes = useStyles$j();
10512
+
10513
+ var _React$useState = React.useState(750),
10514
+ _React$useState2 = _slicedToArray(_React$useState, 2),
10515
+ width = _React$useState2[0],
10516
+ setWidth = _React$useState2[1];
10517
+
10518
+ var onChangeSize = function onChangeSize(_ref2) {
10519
+ var width = _ref2.width;
10520
+ setWidth(width);
10521
+ };
10522
+
10153
10523
  return /*#__PURE__*/React.createElement(ToolContainerDraggable, {
10154
10524
  title: showTitle ? "Layer Select ".concat(mapId) : 'Layer Select',
10155
10525
  startSize: {
10156
- width: 500,
10526
+ width: width,
10157
10527
  height: 500
10158
10528
  },
10159
10529
  minWidth: 300,
10160
10530
  minHeight: 126,
10161
10531
  startPosition: {
10162
- top: 100,
10532
+ top: 150,
10163
10533
  left: 100
10164
10534
  },
10165
10535
  isOpen: isOpen,
10166
- onChangeSize: function onChangeSize() {},
10536
+ onChangeSize: onChangeSize,
10167
10537
  onClose: onClose,
10168
10538
  headerSize: "small",
10169
10539
  bounds: bounds,
@@ -10171,7 +10541,15 @@ var LayerSelect = function LayerSelect(_ref) {
10171
10541
  onMouseDown: onMouseDown,
10172
10542
  order: order,
10173
10543
  source: source
10174
- }, /*#__PURE__*/React.createElement("div", null));
10544
+ }, /*#__PURE__*/React.createElement("div", {
10545
+ style: {
10546
+ padding: '6px'
10547
+ }
10548
+ }, /*#__PURE__*/React.createElement(SearchField, null), /*#__PURE__*/React.createElement("div", {
10549
+ className: classes.serviceList
10550
+ }, /*#__PURE__*/React.createElement(ServiceListConnect, {
10551
+ layerSelectWidth: width
10552
+ }))));
10175
10553
  };
10176
10554
 
10177
10555
  /* *
@@ -10273,6 +10651,8 @@ var LayerSelectConnect = function LayerSelectConnect(_ref) {
10273
10651
  getLayerNodesFromService(service.url).then(function (layers) {
10274
10652
  if (isMounted.current) {
10275
10653
  serviceSetLayers$1({
10654
+ id: service.id,
10655
+ name: service.name,
10276
10656
  service: service.url,
10277
10657
  layers: layers
10278
10658
  });
@@ -11525,6 +11905,11 @@ var SpeedButton = function SpeedButton(_ref) {
11525
11905
  text: "".concat(speedFactor, "x")
11526
11906
  };
11527
11907
  });
11908
+ var max = marks.length - 1;
11909
+ var min = 0;
11910
+ var currentValue = marks.findIndex(function (info) {
11911
+ return info.delay === animationDelay;
11912
+ });
11528
11913
 
11529
11914
  var getAnimationDelayValue = function getAnimationDelayValue(markPos) {
11530
11915
  return marks[markPos].delay || marks[0].delay;
@@ -11534,19 +11919,26 @@ var SpeedButton = function SpeedButton(_ref) {
11534
11919
  setOpen(!open);
11535
11920
  };
11536
11921
 
11537
- var onChangeSlider = function onChangeSlider(event, newValue) {
11538
- getValueFromEvent(event, newValue, getAnimationDelayValue, setMapAnimationDelay);
11922
+ var onChangeSlider = function onChangeSlider(event, value) {
11923
+ var newValue = getAnimationDelayValue(value);
11924
+
11925
+ if (event.type !== 'keydown') {
11926
+ setMapAnimationDelay(newValue);
11927
+ }
11539
11928
  };
11540
11929
 
11541
11930
  var onKeyDown = function onKeyDown(event) {
11542
11931
  if (event.key === 'Tab') {
11543
11932
  setOpen(!open);
11544
11933
  }
11934
+
11935
+ var newValue = getValueFromKeyboardEvent(event, currentValue, min, max);
11936
+
11937
+ if (newValue !== null) {
11938
+ setMapAnimationDelay(getAnimationDelayValue(newValue));
11939
+ }
11545
11940
  };
11546
11941
 
11547
- var currentValue = marks.findIndex(function (info) {
11548
- return info.delay === animationDelay;
11549
- });
11550
11942
  var text = marks[currentValue].text;
11551
11943
  return /*#__PURE__*/React.createElement("div", {
11552
11944
  className: classes.speedButtonDiv
@@ -11576,7 +11968,8 @@ var SpeedButton = function SpeedButton(_ref) {
11576
11968
  orientation: "vertical",
11577
11969
  value: currentValue,
11578
11970
  step: null,
11579
- max: marks.length - 1,
11971
+ max: max,
11972
+ min: min,
11580
11973
  marks: marks.map(function (_ref2) {
11581
11974
  var markPos = _ref2.markPos,
11582
11975
  text = _ref2.text;
@@ -11787,19 +12180,32 @@ var TimeStepButton = function TimeStepButton(_ref) {
11787
12180
  var currentMark = timeStepMarks.find(function (mark) {
11788
12181
  return mark.timeStepValue === timeStep;
11789
12182
  });
12183
+ var value = currentMark && currentMark.value ? currentMark.value : 0;
12184
+ var min = timeStepMarks[0].value;
12185
+ var max = timeStepMarks[timeStepMarks.length - 1].value;
11790
12186
 
11791
12187
  var getTimeStepValue = function getTimeStepValue(value) {
11792
12188
  return timeStepMarks[Math.round(value - 1)].timeStepValue;
11793
12189
  };
11794
12190
 
11795
- var onChangeSlider = function onChangeSlider(event, newValue) {
11796
- getValueFromEvent(event, newValue, getTimeStepValue, onChangeTimeStep);
12191
+ var onChangeSlider = function onChangeSlider(event, value) {
12192
+ var newValue = getTimeStepValue(value);
12193
+
12194
+ if (event.type !== 'keydown') {
12195
+ onChangeTimeStep(newValue);
12196
+ }
11797
12197
  };
11798
12198
 
11799
12199
  var onKeyDown = function onKeyDown(event) {
11800
12200
  if (event.key === 'Tab') {
11801
12201
  setOpen(!open);
11802
12202
  }
12203
+
12204
+ var newValue = getValueFromKeyboardEvent(event, value, min, max);
12205
+
12206
+ if (newValue !== null) {
12207
+ onChangeTimeStep(getTimeStepValue(newValue));
12208
+ }
11803
12209
  };
11804
12210
 
11805
12211
  React.useEffect(function () {
@@ -11836,10 +12242,10 @@ var TimeStepButton = function TimeStepButton(_ref) {
11836
12242
  }, "Time step"), /*#__PURE__*/React.createElement(CustomSlider, {
11837
12243
  "data-testid": "timeStepButtonSlider",
11838
12244
  orientation: "vertical",
11839
- value: currentMark && currentMark.value ? currentMark.value : 0,
12245
+ value: value,
11840
12246
  step: null,
11841
- min: timeStepMarks[0].value,
11842
- max: timeStepMarks[timeStepMarks.length - 1].value,
12247
+ min: min,
12248
+ max: max,
11843
12249
  marks: timeStepMarks,
11844
12250
  disabled: disabledSlider,
11845
12251
  onChange: onChangeSlider,
@@ -13761,29 +14167,29 @@ var TimeSliderRail = function TimeSliderRail(_ref) {
13761
14167
  var ZOOM_RATIO = 1.1;
13762
14168
 
13763
14169
  var zoomOut = function zoomOut(relativeX) {
13764
- var su = animationStartTime.unix();
13765
- var eu = animationEndTime.unix();
14170
+ var su = moment.utc(animationStartTime).unix();
14171
+ var eu = moment.utc(animationEndTime).unix();
13766
14172
  var targetTime = su + (eu - su) * relativeX;
13767
- onSetAnimationStartTime(moment.utc(((su - targetTime) * ZOOM_RATIO + targetTime) * 1000));
13768
- onSetAnimationEndTime(moment.utc(((eu - targetTime) * ZOOM_RATIO + targetTime) * 1000));
14173
+ onSetAnimationStartTime(moment.utc(((su - targetTime) * ZOOM_RATIO + targetTime) * 1000).format(dateFormat));
14174
+ onSetAnimationEndTime(moment.utc(((eu - targetTime) * ZOOM_RATIO + targetTime) * 1000).format(dateFormat));
13769
14175
  };
13770
14176
 
13771
14177
  var zoomIn = function zoomIn(relativeX) {
13772
- var su = animationStartTime.unix();
13773
- var eu = animationEndTime.unix();
14178
+ var su = moment.utc(animationStartTime).unix();
14179
+ var eu = moment.utc(animationEndTime).unix();
13774
14180
  var targetTime = su + (eu - su) * relativeX;
13775
- onSetAnimationStartTime(moment.utc(((su - targetTime) / ZOOM_RATIO + targetTime) * 1000));
13776
- onSetAnimationEndTime(moment.utc(((eu - targetTime) / ZOOM_RATIO + targetTime) * 1000));
14181
+ onSetAnimationStartTime(moment.utc(((su - targetTime) / ZOOM_RATIO + targetTime) * 1000).format(dateFormat));
14182
+ onSetAnimationEndTime(moment.utc(((eu - targetTime) / ZOOM_RATIO + targetTime) * 1000).format(dateFormat));
13777
14183
  };
13778
14184
 
13779
14185
  var curTime = selectedTime !== undefined ? selectedTime.toISOString() : moment.utc().toISOString();
13780
14186
 
13781
- var _React$useState = React.useState(animationStartTime && animationStartTime.unix()),
14187
+ var _React$useState = React.useState(animationStartTime && moment.utc(animationStartTime).unix()),
13782
14188
  _React$useState2 = _slicedToArray(_React$useState, 2),
13783
14189
  localAnimationStartTime = _React$useState2[0],
13784
14190
  setLocalAnimationStartTime = _React$useState2[1];
13785
14191
 
13786
- var _React$useState3 = React.useState(animationEndTime && animationEndTime.unix()),
14192
+ var _React$useState3 = React.useState(animationEndTime && moment.utc(animationEndTime).unix()),
13787
14193
  _React$useState4 = _slicedToArray(_React$useState3, 2),
13788
14194
  localAnimationEndTime = _React$useState4[0],
13789
14195
  setLocalAnimationEndTime = _React$useState4[1];
@@ -13863,12 +14269,12 @@ var TimeSliderRail = function TimeSliderRail(_ref) {
13863
14269
  var onMouseUpTouchEnd = function onMouseUpTouchEnd() {
13864
14270
  // Dispatch changes when releasing mouse
13865
14271
  if (isLeftMarkerDragging) {
13866
- onSetAnimationStartTime(moment.utc(localAnimationStartTime * 1000));
14272
+ onSetAnimationStartTime(moment.utc(localAnimationStartTime * 1000).format(dateFormat));
13867
14273
  setAnimationDragged(true);
13868
14274
  }
13869
14275
 
13870
14276
  if (isRightMarkerDragging) {
13871
- onSetAnimationEndTime(moment.utc(localAnimationEndTime * 1000));
14277
+ onSetAnimationEndTime(moment.utc(localAnimationEndTime * 1000).format(dateFormat));
13872
14278
  setAnimationDragged(true);
13873
14279
  }
13874
14280
 
@@ -13926,8 +14332,8 @@ var TimeSliderRail = function TimeSliderRail(_ref) {
13926
14332
  };
13927
14333
 
13928
14334
  React.useEffect(function () {
13929
- setLocalAnimationStartTime(animationStartTime && animationStartTime.unix());
13930
- setLocalAnimationEndTime(animationEndTime && animationEndTime.unix());
14335
+ setLocalAnimationStartTime(animationStartTime && moment.utc(animationStartTime).unix());
14336
+ setLocalAnimationEndTime(animationEndTime && moment.utc(animationEndTime).unix());
13931
14337
  }, [animationStartTime, animationEndTime]);
13932
14338
  var handleKeyDown = React.useCallback(function (event) {
13933
14339
  if (event.ctrlKey && dataStartTime && dataEndTime) {
@@ -14682,16 +15088,16 @@ var TimeSliderRailConnectComponent = function TimeSliderRailConnectComponent(_re
14682
15088
  dataStartTime: dataStartTime,
14683
15089
  dataEndTime: dataEndTime,
14684
15090
  scale: scale,
14685
- onSetAnimationStartTime: function onSetAnimationStartTime(time) {
15091
+ onSetAnimationStartTime: function onSetAnimationStartTime(animationStartTime) {
14686
15092
  setAnimationStartTime({
14687
15093
  mapId: mapId,
14688
- animationStartTime: time
15094
+ animationStartTime: animationStartTime
14689
15095
  });
14690
15096
  },
14691
- onSetAnimationEndTime: function onSetAnimationEndTime(time) {
15097
+ onSetAnimationEndTime: function onSetAnimationEndTime(animationEndTime) {
14692
15098
  setAnimationEndTime({
14693
15099
  mapId: mapId,
14694
- animationEndTime: time
15100
+ animationEndTime: animationEndTime
14695
15101
  });
14696
15102
  },
14697
15103
  onSetNewDate: function onSetNewDate(newDate) {
@@ -17558,6 +17964,7 @@ var getDisplayText = function getDisplayText(currentAdagucTime) {
17558
17964
  return adagucTimeFormatted;
17559
17965
  };
17560
17966
 
17967
+ var ORIGIN_REACTMAPVIEW_ONMAPCHANGEDIMENSION = 'ORIGIN_REACTMAPVIEW_ONMAPCHANGEDIMENSION';
17561
17968
  var defaultxml2jsonrequestURL = 'http://localhost:10000/XML2JSON?';
17562
17969
 
17563
17970
  var ReactMapView = /*#__PURE__*/function (_React$Component) {
@@ -17617,22 +18024,25 @@ var ReactMapView = /*#__PURE__*/function (_React$Component) {
17617
18024
  };
17618
18025
 
17619
18026
  _this.parseWMJSLayer = function (wmLayer, forceReload, updateStrategy, child) {
17620
- var _this$props = _this.props,
17621
- onMapUpdateAllDimensions = _this$props.onMapUpdateAllDimensions,
17622
- onLayerChangeStyle = _this$props.onLayerChangeStyle,
17623
- onLayerSetDimensions = _this$props.onLayerSetDimensions,
17624
- onServiceSetLayers = _this$props.onServiceSetLayers,
17625
- onLayerSetStyles = _this$props.onLayerSetStyles,
17626
- xml2jsonrequestURL = _this$props.xml2jsonrequestURL,
17627
- mapId = _this$props.mapId;
17628
-
17629
18027
  var callback = function callback() {
17630
18028
  if (updateStrategy === 'all') {
17631
- setServiceMetadata(wmLayer, mapId, xml2jsonrequestURL, _this.adaguc.webMapJS, _this.props, onMapUpdateAllDimensions, onLayerChangeStyle, onServiceSetLayers, onLayerSetStyles, onLayerSetDimensions);
18029
+ var _this$props = _this.props,
18030
+ onMapUpdateAllDimensions = _this$props.onMapUpdateAllDimensions,
18031
+ onLayerChangeStyle = _this$props.onLayerChangeStyle,
18032
+ onLayerSetDimensions = _this$props.onLayerSetDimensions,
18033
+ onServiceSetLayers = _this$props.onServiceSetLayers,
18034
+ onLayerSetStyles = _this$props.onLayerSetStyles,
18035
+ _xml2jsonrequestURL = _this$props.xml2jsonrequestURL,
18036
+ mapId = _this$props.mapId;
18037
+ setServiceMetadata(wmLayer, mapId, _xml2jsonrequestURL, _this.adaguc.webMapJS, _this.props, onMapUpdateAllDimensions, onLayerChangeStyle, onServiceSetLayers, onLayerSetStyles, onLayerSetDimensions);
17632
18038
  }
17633
18039
 
17634
18040
  if (updateStrategy === 'onlydims') {
17635
- setServiceMetadata(wmLayer, mapId, xml2jsonrequestURL, _this.adaguc.webMapJS, _this.props, null, null, null, null, onLayerSetDimensions);
18041
+ var _this$props2 = _this.props,
18042
+ _onLayerSetDimensions = _this$props2.onLayerSetDimensions,
18043
+ _xml2jsonrequestURL2 = _this$props2.xml2jsonrequestURL,
18044
+ _mapId = _this$props2.mapId;
18045
+ setServiceMetadata(wmLayer, _mapId, _xml2jsonrequestURL2, _this.adaguc.webMapJS, _this.props, null, null, null, null, _onLayerSetDimensions);
17636
18046
  }
17637
18047
 
17638
18048
  if (child) {
@@ -17646,6 +18056,7 @@ var ReactMapView = /*#__PURE__*/function (_React$Component) {
17646
18056
  }
17647
18057
  };
17648
18058
 
18059
+ var xml2jsonrequestURL = _this.props.xml2jsonrequestURL;
17649
18060
  wmLayer.parseLayer(callback, forceReload, xml2jsonrequestURL);
17650
18061
  };
17651
18062
 
@@ -17657,6 +18068,9 @@ var ReactMapView = /*#__PURE__*/function (_React$Component) {
17657
18068
  _this.drawDebounced = debounce(600, _this.drawDebounced);
17658
18069
  _this.checkNewProps = _this.checkNewProps.bind(_assertThisInitialized(_this));
17659
18070
  _this.checkAdaguc = _this.checkAdaguc.bind(_assertThisInitialized(_this));
18071
+ _this.onAfterSetBBoxListener = _this.onAfterSetBBoxListener.bind(_assertThisInitialized(_this));
18072
+ _this.onUpdateBBoxListener = _this.onUpdateBBoxListener.bind(_assertThisInitialized(_this));
18073
+ _this.onDimChangeListener = _this.onDimChangeListener.bind(_assertThisInitialized(_this));
17660
18074
  _this.currentMapProps = {};
17661
18075
  _this.adagucContainerRef = /*#__PURE__*/React.createRef();
17662
18076
  _this.adagucWebMapJSRef = /*#__PURE__*/React.createRef();
@@ -17666,11 +18080,11 @@ var ReactMapView = /*#__PURE__*/function (_React$Component) {
17666
18080
  _createClass(ReactMapView, [{
17667
18081
  key: "componentDidMount",
17668
18082
  value: function componentDidMount() {
17669
- var _this$props2 = this.props,
17670
- onMount = _this$props2.onMount,
17671
- mapId = _this$props2.mapId,
17672
- onRegisterAdaguc = _this$props2.onRegisterAdaguc,
17673
- shouldAutoFetch = _this$props2.shouldAutoFetch;
18083
+ var _this$props3 = this.props,
18084
+ onMount = _this$props3.onMount,
18085
+ mapId = _this$props3.mapId,
18086
+ onRegisterAdaguc = _this$props3.onRegisterAdaguc,
18087
+ shouldAutoFetch = _this$props3.shouldAutoFetch;
17674
18088
  this.checkAdaguc();
17675
18089
  this.checkNewProps(null, this.props);
17676
18090
  window.addEventListener('resize', this.handleWindowResize);
@@ -17692,9 +18106,9 @@ var ReactMapView = /*#__PURE__*/function (_React$Component) {
17692
18106
  }, {
17693
18107
  key: "componentWillUnmount",
17694
18108
  value: function componentWillUnmount() {
17695
- var _this$props3 = this.props,
17696
- onUnMount = _this$props3.onUnMount,
17697
- mapId = _this$props3.mapId;
18109
+ var _this$props4 = this.props,
18110
+ onUnMount = _this$props4.onUnMount,
18111
+ mapId = _this$props4.mapId;
17698
18112
  window.removeEventListener('resize', this.handleWindowResize);
17699
18113
  onUnMount(mapId, this.adaguc.webMapJS);
17700
18114
  this.adaguc.webMapJS.getListener().suspendEvents();
@@ -17706,6 +18120,72 @@ var ReactMapView = /*#__PURE__*/function (_React$Component) {
17706
18120
 
17707
18121
  this.clearRefetchTimer();
17708
18122
  }
18123
+ }, {
18124
+ key: "onDimChangeListener",
18125
+ value: function onDimChangeListener() {
18126
+ var _this$props5 = this.props,
18127
+ mapId = _this$props5.mapId,
18128
+ onMapChangeDimension = _this$props5.onMapChangeDimension;
18129
+
18130
+ if (this.adaguc && this.adaguc.webMapJS) {
18131
+ var timeDimension = this.adaguc.webMapJS.getDimension('time');
18132
+
18133
+ if (timeDimension) {
18134
+ onMapChangeDimension({
18135
+ mapId: mapId,
18136
+ origin: ORIGIN_REACTMAPVIEW_ONMAPCHANGEDIMENSION,
18137
+ dimension: {
18138
+ name: 'time',
18139
+ currentValue: timeDimension.currentValue
18140
+ }
18141
+ });
18142
+ }
18143
+ }
18144
+ }
18145
+ }, {
18146
+ key: "onAfterSetBBoxListener",
18147
+ value: function onAfterSetBBoxListener(wmjsMap) {
18148
+ var _this2 = this;
18149
+
18150
+ var _this$props6 = this.props,
18151
+ mapId = _this$props6.mapId,
18152
+ onMapZoomEnd = _this$props6.onMapZoomEnd;
18153
+ /* Update the map after 100 ms */
18154
+
18155
+ window.setTimeout(function () {
18156
+ var MapViewBBOX = _this2.props.bbox;
18157
+ var projectionInfo = wmjsMap.getProjection();
18158
+ /* Trigger onMapZoomEnd callback */
18159
+
18160
+ var mapBBOX = projectionInfo.bbox;
18161
+
18162
+ if (MapViewBBOX.left !== mapBBOX.left || MapViewBBOX.right !== mapBBOX.right || MapViewBBOX.bottom !== mapBBOX.bottom || MapViewBBOX.top !== mapBBOX.top) {
18163
+ onMapZoomEnd({
18164
+ mapId: mapId,
18165
+ bbox: {
18166
+ left: projectionInfo.bbox.left,
18167
+ bottom: projectionInfo.bbox.bottom,
18168
+ right: projectionInfo.bbox.right,
18169
+ top: projectionInfo.bbox.top
18170
+ },
18171
+ srs: projectionInfo.srs
18172
+ });
18173
+ }
18174
+ }, 100);
18175
+ }
18176
+ }, {
18177
+ key: "onUpdateBBoxListener",
18178
+ value: function onUpdateBBoxListener(newBbox) {
18179
+ var oldbbox = this.adaguc.oldbbox || new WMBBOX(ReactMapView.defaultProps.bbox);
18180
+
18181
+ if (oldbbox.left !== newBbox.left || oldbbox.right !== newBbox.right || oldbbox.top !== newBbox.top || oldbbox.bottom !== newBbox.bottom) {
18182
+ oldbbox.left = newBbox.left;
18183
+ oldbbox.right = newBbox.right;
18184
+ oldbbox.top = newBbox.top;
18185
+ oldbbox.bottom = newBbox.bottom;
18186
+ this.adaguc.oldbbox = new WMBBOX(oldbbox);
18187
+ }
18188
+ }
17709
18189
  }, {
17710
18190
  key: "getWMJSLayerFromReactLayer",
17711
18191
  value: function getWMJSLayerFromReactLayer(wmLayers, reactWebMapJSLayer, index) {
@@ -17741,13 +18221,14 @@ var ReactMapView = /*#__PURE__*/function (_React$Component) {
17741
18221
  }, {
17742
18222
  key: "checkNewProps",
17743
18223
  value: function checkNewProps(prevProps, props) {
17744
- var _this2 = this;
18224
+ var _this3 = this;
17745
18225
 
17746
18226
  if (!props) {
17747
18227
  return;
17748
18228
  }
17749
- /* Check map props */
17750
18229
 
18230
+ var needsRedraw = false;
18231
+ /* Check map props */
17751
18232
 
17752
18233
  if (!prevProps || prevProps.showLegend !== props.showLegend) {
17753
18234
  this.adaguc.webMapJS.displayLegendInMap(props.showLegend !== false);
@@ -17755,11 +18236,11 @@ var ReactMapView = /*#__PURE__*/function (_React$Component) {
17755
18236
 
17756
18237
  if (!prevProps || prevProps.showScaleBar !== props.showScaleBar) {
17757
18238
  this.adaguc.webMapJS.displayScaleBarInMap(props.showScaleBar !== false);
18239
+ needsRedraw = true;
17758
18240
  }
17759
-
17760
- var needsRedraw = false;
17761
18241
  /* Check map dimensions */
17762
18242
 
18243
+
17763
18244
  if (!prevProps || prevProps.dimensions !== props.dimensions) {
17764
18245
  if (props.dimensions) {
17765
18246
  for (var d = 0; d < props.dimensions.length; d += 1) {
@@ -17797,21 +18278,21 @@ var ReactMapView = /*#__PURE__*/function (_React$Component) {
17797
18278
  /* Check display/hide map cursor */
17798
18279
 
17799
18280
 
17800
- if (!prevProps || prevProps.showCursor !== props.showCursor) {
17801
- if (props.showCursor === true) {
18281
+ if (!prevProps || prevProps.displayMapPin !== props.displayMapPin) {
18282
+ if (props.displayMapPin === true) {
17802
18283
  this.adaguc.webMapJS.getMapPin().showMapPin();
17803
- } else if (props.showCursor === false) {
18284
+ } else if (props.displayMapPin === false) {
17804
18285
  this.adaguc.webMapJS.getMapPin().hideMapPin();
17805
18286
  }
17806
18287
  }
17807
18288
  /* Set map cursor location */
17808
18289
 
17809
18290
 
17810
- if (!prevProps || prevProps.mapCursorLocation !== props.mapCursorLocation) {
17811
- if (props.mapCursorLocation) {
18291
+ if (!prevProps || prevProps.mapPinLocation !== props.mapPinLocation) {
18292
+ if (props.mapPinLocation) {
17812
18293
  this.adaguc.webMapJS.getMapPin().positionMapPinByLatLon({
17813
- x: props.mapCursorLocation.lon,
17814
- y: props.mapCursorLocation.lat
18294
+ x: props.mapPinLocation.lon,
18295
+ y: props.mapPinLocation.lat
17815
18296
  });
17816
18297
  }
17817
18298
  }
@@ -17825,6 +18306,14 @@ var ReactMapView = /*#__PURE__*/function (_React$Component) {
17825
18306
  }
17826
18307
  }
17827
18308
  }
18309
+ /* Check if layer metadata should be shown */
18310
+
18311
+
18312
+ if (!prevProps || prevProps.showLayerInfo !== props.showLayerInfo) {
18313
+ if (props.showLayerInfo) {
18314
+ this.adaguc.webMapJS.showLayerInfo = props.showLayerInfo;
18315
+ }
18316
+ }
17828
18317
  /* Check children */
17829
18318
 
17830
18319
 
@@ -17843,7 +18332,7 @@ var ReactMapView = /*#__PURE__*/function (_React$Component) {
17843
18332
  myChildren.push(child);
17844
18333
  takenIds.add(childProps.id);
17845
18334
  } else {
17846
- childProps.onLayerError(childProps, new Error("Duplicate layer id \"".concat(childProps.id, "\" encountered within this WebMap")), _this2.adaguc.webMapJS);
18335
+ childProps.onLayerError(childProps, new Error("Duplicate layer id \"".concat(childProps.id, "\" encountered within this WebMap")), _this3.adaguc.webMapJS);
17847
18336
  console.warn('ReactWMJSLayer has a duplicate id', child);
17848
18337
  }
17849
18338
  } else {
@@ -17853,7 +18342,7 @@ var ReactMapView = /*#__PURE__*/function (_React$Component) {
17853
18342
  });
17854
18343
  myChildren.reverse();
17855
18344
 
17856
- var wmjsLayers = _this2.adaguc.webMapJS.getLayers();
18345
+ var wmjsLayers = _this3.adaguc.webMapJS.getLayers();
17857
18346
  /* ReactWMJSLayer Layer Childs: Detect all ReactLayers connected to WMJSLayers, remove WMJSLayer if there is no ReactLayer */
17858
18347
 
17859
18348
 
@@ -17870,7 +18359,7 @@ var ReactMapView = /*#__PURE__*/function (_React$Component) {
17870
18359
  onMapUpdateAllDimensions && onMapUpdateAllDimensions({
17871
18360
  origin: origin,
17872
18361
  mapId: mapId,
17873
- dimensions: _this2.adaguc.webMapJS.mapdimensions.map(function (_ref) {
18362
+ dimensions: _this3.adaguc.webMapJS.mapdimensions.map(function (_ref) {
17874
18363
  var name = _ref.name,
17875
18364
  units = _ref.units,
17876
18365
  currentValue = _ref.currentValue,
@@ -17884,7 +18373,7 @@ var ReactMapView = /*#__PURE__*/function (_React$Component) {
17884
18373
  })
17885
18374
  });
17886
18375
 
17887
- _this2.checkNewProps(prevProps, props);
18376
+ _this3.checkNewProps(prevProps, props);
17888
18377
 
17889
18378
  return {
17890
18379
  v: {
@@ -17902,10 +18391,10 @@ var ReactMapView = /*#__PURE__*/function (_React$Component) {
17902
18391
  /* ReactWMJSLayer BaseLayer Childs: For the baseLayers, detect all ReactLayers connected to WMJSLayers, remove WMJSLayer if there is no ReactLayer */
17903
18392
 
17904
18393
 
17905
- var webmapJSBaselayers = _this2.adaguc.webMapJS.getBaseLayers();
18394
+ var webmapJSBaselayers = _this3.adaguc.webMapJS.getBaseLayers();
17906
18395
 
17907
18396
  var _loop2 = function _loop2(_l) {
17908
- var wmjsBaseLayers = _this2.adaguc.webMapJS.getBaseLayers();
18397
+ var wmjsBaseLayers = _this3.adaguc.webMapJS.getBaseLayers();
17909
18398
 
17910
18399
  if (myChildren.filter(function (c) {
17911
18400
  return c && c.props ? c.props.id === wmjsBaseLayers[_l].ReactWMJSLayerId : false;
@@ -17913,11 +18402,11 @@ var ReactMapView = /*#__PURE__*/function (_React$Component) {
17913
18402
  /* TODO (Maarten Plieger, 2020-03-19):The remove property for the baselayer is not working yet */
17914
18403
  wmjsBaseLayers.splice(_l, 1);
17915
18404
 
17916
- _this2.adaguc.webMapJS.setBaseLayers(wmjsBaseLayers);
18405
+ _this3.adaguc.webMapJS.setBaseLayers(wmjsBaseLayers);
17917
18406
 
17918
- wmjsBaseLayers = _this2.adaguc.webMapJS.getBaseLayers();
18407
+ wmjsBaseLayers = _this3.adaguc.webMapJS.getBaseLayers();
17919
18408
 
17920
- _this2.checkNewProps(prevProps, props);
18409
+ _this3.checkNewProps(prevProps, props);
17921
18410
 
17922
18411
  return {
17923
18412
  v: {
@@ -17946,12 +18435,12 @@ var ReactMapView = /*#__PURE__*/function (_React$Component) {
17946
18435
  if (_typeof(child.type) === _typeof(MapViewLayer)) {
17947
18436
  /* Feature layer (with child.props.geojson), these are handled collectively by the setState commando above. */
17948
18437
  var isBaselayer = !isAMapLayer(child.props) && !isAGeoJSONLayer(child.props);
17949
- var adagucWMJSLayers = isBaselayer ? _this2.adaguc.webMapJS.getBaseLayers() : _this2.adaguc.webMapJS.getLayers();
18438
+ var adagucWMJSLayers = isBaselayer ? _this3.adaguc.webMapJS.getBaseLayers() : _this3.adaguc.webMapJS.getLayers();
17950
18439
 
17951
- var obj = _this2.getWMJSLayerFromReactLayer(adagucWMJSLayers, child, isBaselayer ? adagucWMJSBaseLayerIndex : adagucWMJSLayerIndex);
18440
+ var obj = _this3.getWMJSLayerFromReactLayer(adagucWMJSLayers, child, isBaselayer ? adagucWMJSBaseLayerIndex : adagucWMJSLayerIndex);
17952
18441
 
17953
18442
  if (obj.layerArrayMutated) {
17954
- _this2.checkNewProps(prevProps, props);
18443
+ _this3.checkNewProps(prevProps, props);
17955
18444
 
17956
18445
  return {
17957
18446
  v: {
@@ -17978,20 +18467,20 @@ var ReactMapView = /*#__PURE__*/function (_React$Component) {
17978
18467
 
17979
18468
  if (isBaselayer) {
17980
18469
  /* Add ADAGUC WebMapJS Baselayer */
17981
- _this2.adaguc.baseLayers.push(newWMLayer);
18470
+ _this3.adaguc.baseLayers.push(newWMLayer);
17982
18471
 
17983
- _this2.adaguc.webMapJS.setBaseLayers(_this2.adaguc.baseLayers.reverse());
18472
+ _this3.adaguc.webMapJS.setBaseLayers(_this3.adaguc.baseLayers.reverse());
17984
18473
  } else {
17985
18474
  /* Add ADAGUC WebMapJS Layer */
17986
- _this2.adaguc.webMapJS.addLayer(newWMLayer).then(function () {
17987
- _this2.adaguc.webMapJS.draw();
18475
+ _this3.adaguc.webMapJS.addLayer(newWMLayer).then(function () {
18476
+ _this3.adaguc.webMapJS.draw();
17988
18477
  });
17989
18478
  }
17990
18479
 
17991
18480
  if (!isBaselayer) {
17992
18481
  newWMLayer.reactWebMapJSLayer = child;
17993
18482
 
17994
- _this2.parseWMJSLayer(newWMLayer, false, 'all', child);
18483
+ _this3.parseWMJSLayer(newWMLayer, false, 'all', child);
17995
18484
  }
17996
18485
 
17997
18486
  needsRedraw = true;
@@ -17999,7 +18488,7 @@ var ReactMapView = /*#__PURE__*/function (_React$Component) {
17999
18488
  /* Set the name of the ADAGUC WMJSLayer */
18000
18489
  if (child.props.name !== undefined && wmLayer.name !== child.props.name) {
18001
18490
  wmLayer.setName(child.props.name).then(function () {
18002
- _this2.parseWMJSLayer(wmLayer, false, 'all', child);
18491
+ _this3.parseWMJSLayer(wmLayer, false, 'all', child);
18003
18492
  });
18004
18493
  needsRedraw = true;
18005
18494
  }
@@ -18049,18 +18538,18 @@ var ReactMapView = /*#__PURE__*/function (_React$Component) {
18049
18538
  }
18050
18539
 
18051
18540
  if (child.props.isProfileLayer) {
18052
- var currentBbox = _this2.adaguc.webMapJS.getBBOX();
18541
+ var currentBbox = _this3.adaguc.webMapJS.getBBOX();
18053
18542
 
18054
18543
  var newBbox = new WMBBOX(props.bbox);
18055
18544
 
18056
18545
  if (currentBbox !== newBbox) {
18057
- _this2.adaguc.webMapJS.suspendEvent('onupdatebbox');
18546
+ _this3.adaguc.webMapJS.suspendEvent('onupdatebbox');
18058
18547
 
18059
- _this2.adaguc.webMapJS.setBBOX(new WMBBOX(props.bbox));
18548
+ _this3.adaguc.webMapJS.setBBOX(new WMBBOX(props.bbox));
18060
18549
 
18061
18550
  needsRedraw = true;
18062
18551
 
18063
- _this2.adaguc.webMapJS.resumeEvent('onupdatebbox');
18552
+ _this3.adaguc.webMapJS.resumeEvent('onupdatebbox');
18064
18553
  }
18065
18554
  }
18066
18555
  }
@@ -18075,12 +18564,12 @@ var ReactMapView = /*#__PURE__*/function (_React$Component) {
18075
18564
  }
18076
18565
 
18077
18566
  if (needsRedraw) {
18078
- _this2.adaguc.webMapJS.draw();
18567
+ _this3.adaguc.webMapJS.draw();
18079
18568
  }
18080
18569
  /* Children have been processed */
18081
18570
 
18082
18571
 
18083
- _this2.currentMapProps.children = children;
18572
+ _this3.currentMapProps.children = children;
18084
18573
  }();
18085
18574
 
18086
18575
  if (_typeof(_ret) === "object") return _ret.v;
@@ -18101,17 +18590,15 @@ var ReactMapView = /*#__PURE__*/function (_React$Component) {
18101
18590
  }, {
18102
18591
  key: "checkAdaguc",
18103
18592
  value: function checkAdaguc() {
18104
- var _this3 = this;
18593
+ var _this4 = this;
18105
18594
 
18106
- var _this$props4 = this.props,
18107
- mapId = _this$props4.mapId,
18108
- listeners = _this$props4.listeners,
18109
- xml2jsonrequestURL = _this$props4.xml2jsonrequestURL,
18110
- srs = _this$props4.srs,
18111
- bbox = _this$props4.bbox,
18112
- onMapChangeDimension = _this$props4.onMapChangeDimension,
18113
- onMapZoomEnd = _this$props4.onMapZoomEnd,
18114
- onMapCursorChangeLocation = _this$props4.onMapCursorChangeLocation;
18595
+ var _this$props7 = this.props,
18596
+ mapId = _this$props7.mapId,
18597
+ listeners = _this$props7.listeners,
18598
+ xml2jsonrequestURL = _this$props7.xml2jsonrequestURL,
18599
+ srs = _this$props7.srs,
18600
+ bbox = _this$props7.bbox,
18601
+ onMapPinChangeLocation = _this$props7.onMapPinChangeLocation;
18115
18602
 
18116
18603
  if (this.adaguc.webMapJSCreated) {
18117
18604
  return;
@@ -18119,6 +18606,9 @@ var ReactMapView = /*#__PURE__*/function (_React$Component) {
18119
18606
 
18120
18607
  this.adaguc.webMapJSCreated = true;
18121
18608
  this.adaguc.webMapJS = new WMJSMap(this.adagucWebMapJSRef.current);
18609
+ this.adaguc.webMapJS.showLayerInfo = false;
18610
+ /* Enable to show actual layer properties in the map */
18611
+
18122
18612
  registerWMJSMap(this.adaguc.webMapJS, mapId);
18123
18613
  this.adaguc.webMapJS.removeAllLayers();
18124
18614
  this.adaguc.webMapJS.setXML2JSONURL(xml2jsonrequestURL);
@@ -18127,70 +18617,35 @@ var ReactMapView = /*#__PURE__*/function (_React$Component) {
18127
18617
 
18128
18618
  if (listeners) {
18129
18619
  listeners.forEach(function (listener) {
18130
- _this3.adaguc.webMapJS.addListener(listener.name, function (data) {
18131
- listener.callbackfunction(_this3.adaguc.webMapJS, data);
18620
+ _this4.adaguc.webMapJS.addListener(listener.name, function (data) {
18621
+ listener.callbackfunction(_this4.adaguc.webMapJS, data);
18132
18622
  }, listener.keep);
18133
18623
  });
18134
18624
  }
18135
18625
 
18136
18626
  this.adaguc.webMapJS.addListener('ondimchange', function () {
18137
- if (_this3.adaguc && _this3.adaguc.webMapJS) {
18138
- var timeDimension = _this3.adaguc.webMapJS.getDimension('time');
18139
-
18140
- if (timeDimension) {
18141
- onMapChangeDimension({
18142
- mapId: mapId,
18143
- origin: 'ReactMapView, 663',
18144
- dimension: {
18145
- name: 'time',
18146
- currentValue: timeDimension.currentValue
18147
- }
18148
- });
18149
- }
18150
- }
18627
+ _this4.onDimChangeListener();
18151
18628
  }, true);
18152
18629
  this.adaguc.webMapJS.addListener('onmapready', function () {
18153
- _this3.setState({
18630
+ _this4.setState({
18154
18631
  adagucInitialised: true
18155
18632
  });
18156
18633
  });
18157
18634
  this.adaguc.webMapJS.addListener('aftersetbbox', function (wmjsMap) {
18158
- /* Update the map after 1000 ms */
18159
- window.setTimeout(function () {
18160
- var MapViewBBOX = _this3.props.bbox;
18161
- var projectionInfo = wmjsMap.getProjection();
18162
- /* Trigger onMapZoomEnd callback */
18163
-
18164
- var mapBBOX = projectionInfo.bbox;
18165
-
18166
- if (MapViewBBOX.left !== mapBBOX.left || MapViewBBOX.right !== mapBBOX.right || MapViewBBOX.bottom !== mapBBOX.bottom || MapViewBBOX.top !== mapBBOX.top) {
18167
- onMapZoomEnd({
18168
- mapId: mapId,
18169
- bbox: {
18170
- left: projectionInfo.bbox.left,
18171
- bottom: projectionInfo.bbox.bottom,
18172
- right: projectionInfo.bbox.right,
18173
- top: projectionInfo.bbox.top
18174
- },
18175
- srs: projectionInfo.srs
18176
- });
18177
- }
18178
- }, 100);
18635
+ _this4.onAfterSetBBoxListener(wmjsMap);
18179
18636
  }, true);
18180
18637
  this.adaguc.webMapJS.addListener('onupdatebbox', function (newBbox) {
18181
- var oldbbox = _this3.adaguc.oldbbox || new WMBBOX(ReactMapView.defaultProps.bbox);
18182
-
18183
- if (oldbbox.left !== newBbox.left || oldbbox.right !== newBbox.right || oldbbox.top !== newBbox.top || oldbbox.bottom !== newBbox.bottom) {
18184
- oldbbox.left = newBbox.left;
18185
- oldbbox.right = newBbox.right;
18186
- oldbbox.top = newBbox.top;
18187
- oldbbox.bottom = newBbox.bottom;
18188
- _this3.adaguc.oldbbox = new WMBBOX(oldbbox);
18189
- }
18638
+ _this4.onUpdateBBoxListener(newBbox);
18190
18639
  }, true);
18191
18640
  this.adaguc.webMapJS.addListener('onsetmappin', function (mapPinLatLonCoordinate) {
18192
- if (onMapCursorChangeLocation) {
18193
- onMapCursorChangeLocation(mapPinLatLonCoordinate);
18641
+ if (onMapPinChangeLocation) {
18642
+ onMapPinChangeLocation({
18643
+ mapPinLocation: {
18644
+ lat: mapPinLatLonCoordinate.lat,
18645
+ lon: mapPinLatLonCoordinate.lon
18646
+ },
18647
+ mapId: mapId
18648
+ });
18194
18649
  }
18195
18650
  }, true);
18196
18651
  this.resize();
@@ -18215,10 +18670,10 @@ var ReactMapView = /*#__PURE__*/function (_React$Component) {
18215
18670
  }, {
18216
18671
  key: "render",
18217
18672
  value: function render() {
18218
- var _this$props5 = this.props,
18219
- passiveMap = _this$props5.passiveMap,
18220
- children = _this$props5.children,
18221
- onClick = _this$props5.onClick;
18673
+ var _this$props8 = this.props,
18674
+ passiveMap = _this$props8.passiveMap,
18675
+ children = _this$props8.children,
18676
+ onClick = _this$props8.onClick;
18222
18677
  var adagucInitialised = this.state.adagucInitialised;
18223
18678
  var featureLayers = getFeatureLayers(children);
18224
18679
  return /*#__PURE__*/React.createElement("div", {
@@ -18298,7 +18753,7 @@ ReactMapView.defaultProps = {
18298
18753
  top: 11652109.058827976
18299
18754
  },
18300
18755
  shouldAutoFetch: true,
18301
- showCursor: false,
18756
+ displayMapPin: false,
18302
18757
  onMount: function onMount() {
18303
18758
  return null;
18304
18759
  },
@@ -18485,16 +18940,17 @@ var MapView = function MapView(_a) {
18485
18940
  * @param {string} mapId mapId: string - Id of the map
18486
18941
  * @param {object} [controls.zoomControls] **optional** controls: object - toggle the map controls, zoomControls defaults to true
18487
18942
  * @param {boolean} [displayTimeInMap] **optional** displayTimeInMap: boolean, toggles the mapTime, defaults to true
18943
+ * @param {boolean} [displayMapPin] **optional** displayMapPin: boolean, toggle the display of pin on click, defaults to false
18944
+ * @param {boolean} [showScaleBar] **optional** showScaleBar: boolean, toggles the scaleBar, defaults to true
18488
18945
  * @example
18489
- * ```<MapViewConnect mapId={mapId} />```
18490
- * @example
18491
- * ```<MapViewConnect mapId={mapId} controls={{ zoomControls: false }} displayTimeInMap={false} />```
18946
+ * ```<MapViewConnect mapId={mapId} controls={{ zoomControls: false }} displayTimeInMap={false} showScaleBar={false}/>```
18492
18947
  */
18493
18948
 
18494
18949
  var MapViewConnect = function MapViewConnect(_a) {
18495
18950
  var mapId = _a.mapId,
18496
18951
  children = _a.children,
18497
- props = __rest(_a, ["mapId", "children"]);
18952
+ displayMapPin = _a.displayMapPin,
18953
+ props = __rest(_a, ["mapId", "children", "displayMapPin"]);
18498
18954
 
18499
18955
  var mapDimensions = useSelector(function (store) {
18500
18956
  return getMapDimensions(store, mapId);
@@ -18520,6 +18976,9 @@ var MapViewConnect = function MapViewConnect(_a) {
18520
18976
  var animationDelay = useSelector(function (store) {
18521
18977
  return getMapAnimationDelay(store, mapId);
18522
18978
  });
18979
+ var mapPinLocation = useSelector(function (store) {
18980
+ return getPinLocation(store, mapId);
18981
+ });
18523
18982
  var dispatch = useDispatch();
18524
18983
  var mapChangeDimension$1 = React.useCallback(function (mapDimensionPayload) {
18525
18984
  return dispatch(mapChangeDimension(mapDimensionPayload));
@@ -18563,6 +19022,9 @@ var MapViewConnect = function MapViewConnect(_a) {
18563
19022
  var layerError$1 = React.useCallback(function (payload) {
18564
19023
  return dispatch(layerError(payload));
18565
19024
  }, [dispatch]);
19025
+ var mapPinChangeLocation = React.useCallback(function (payload) {
19026
+ return dispatch(setMapPinLocation(payload));
19027
+ }, [dispatch]);
18566
19028
  return /*#__PURE__*/React.createElement("div", {
18567
19029
  style: {
18568
19030
  height: '100%'
@@ -18584,9 +19046,11 @@ var MapViewConnect = function MapViewConnect(_a) {
18584
19046
  },
18585
19047
  srs: srs,
18586
19048
  bbox: bbox,
19049
+ mapPinLocation: displayMapPin && Object.keys(mapPinLocation).length ? mapPinLocation : null,
18587
19050
  dimensions: mapDimensions,
18588
19051
  activeLayerId: activeLayerId,
18589
19052
  animationDelay: animationDelay,
19053
+ displayMapPin: displayMapPin,
18590
19054
  onMapChangeDimension: function onMapChangeDimension(mapDimensionPayload) {
18591
19055
  if (mapDimensionPayload && mapDimensionPayload.dimension && mapDimensionPayload.dimension.name && mapDimensionPayload.dimension.name === 'time') {
18592
19056
  setTime$1({
@@ -18618,6 +19082,7 @@ var MapViewConnect = function MapViewConnect(_a) {
18618
19082
  onLayerSetDimensions: layerSetDimensions$1,
18619
19083
  onServiceSetLayers: serviceSetLayers$1,
18620
19084
  onLayerSetStyles: layerSetStyles$1,
19085
+ onMapPinChangeLocation: mapPinChangeLocation,
18621
19086
  onMapZoomEnd: function onMapZoomEnd(a) {
18622
19087
  genericSetBbox({
18623
19088
  bbox: a.bbox,
@@ -19208,7 +19673,9 @@ var ConfigurableConnectedMap = function ConfigurableConnectedMap(_ref) {
19208
19673
  _ref$animationPayload = _ref.animationPayload,
19209
19674
  animationPayload = _ref$animationPayload === void 0 ? undefined : _ref$animationPayload,
19210
19675
  _ref$shouldShowZoomCo = _ref.shouldShowZoomControls,
19211
- shouldShowZoomControls = _ref$shouldShowZoomCo === void 0 ? false : _ref$shouldShowZoomCo;
19676
+ shouldShowZoomControls = _ref$shouldShowZoomCo === void 0 ? false : _ref$shouldShowZoomCo,
19677
+ _ref$displayMapPin = _ref.displayMapPin,
19678
+ displayMapPin = _ref$displayMapPin === void 0 ? false : _ref$displayMapPin;
19212
19679
  var classes = useStyles$4();
19213
19680
  var dispatch = useDispatch();
19214
19681
  var mapId = React__default.useRef(id || generateMapId()).current;
@@ -19255,8 +19722,8 @@ var ConfigurableConnectedMap = function ConfigurableConnectedMap(_ref) {
19255
19722
 
19256
19723
  dispatch(mapStartAnimation({
19257
19724
  mapId: mapId,
19258
- start: moment.utc().subtract(duration, 'minutes'),
19259
- end: moment.utc(),
19725
+ start: moment.utc().subtract(duration, 'minutes').format(dateFormat),
19726
+ end: moment.utc().format(dateFormat),
19260
19727
  interval: animationPayload && animationPayload.interval ? animationPayload.interval : animationIntervalDefault
19261
19728
  }));
19262
19729
 
@@ -19289,6 +19756,7 @@ var ConfigurableConnectedMap = function ConfigurableConnectedMap(_ref) {
19289
19756
  })), /*#__PURE__*/React__default.createElement(MapViewConnect, {
19290
19757
  controls: {},
19291
19758
  displayTimeInMap: displayTimeInMap,
19759
+ displayMapPin: displayMapPin,
19292
19760
  showScaleBar: false,
19293
19761
  mapId: mapId
19294
19762
  }));
@@ -19656,7 +20124,9 @@ var ConfigurableMapWithSliderConnect = function ConfigurableMapWithSliderConnect
19656
20124
  _ref$shouldShowZoomCo = _ref.shouldShowZoomControls,
19657
20125
  shouldShowZoomControls = _ref$shouldShowZoomCo === void 0 ? true : _ref$shouldShowZoomCo,
19658
20126
  _ref$animationPayload = _ref.animationPayload,
19659
- animationPayload = _ref$animationPayload === void 0 ? undefined : _ref$animationPayload;
20127
+ animationPayload = _ref$animationPayload === void 0 ? undefined : _ref$animationPayload,
20128
+ _ref$displayMapPin = _ref.displayMapPin,
20129
+ displayMapPin = _ref$displayMapPin === void 0 ? false : _ref$displayMapPin;
19660
20130
  var classes = useStyles$2();
19661
20131
  return /*#__PURE__*/React__default.createElement("div", {
19662
20132
  className: classes.mapSliderConnect,
@@ -19681,7 +20151,8 @@ var ConfigurableMapWithSliderConnect = function ConfigurableMapWithSliderConnect
19681
20151
  shouldAutoUpdate: shouldAutoUpdate,
19682
20152
  shouldAnimate: shouldAnimate,
19683
20153
  animationPayload: animationPayload,
19684
- shouldShowZoomControls: shouldShowZoomControls
20154
+ shouldShowZoomControls: shouldShowZoomControls,
20155
+ displayMapPin: displayMapPin
19685
20156
  }));
19686
20157
  };
19687
20158
 
@@ -19715,6 +20186,7 @@ var componentsLookUp = function componentsLookUp(_ref) {
19715
20186
  return /*#__PURE__*/React__default.createElement(ConfigurableMapWithSliderConnect, Object.assign({}, mapPreset, {
19716
20187
  id: id,
19717
20188
  bbox: mapPreset && mapPreset.proj && mapPreset.proj.bbox,
20189
+ displayMapPin: mapPreset && mapPreset.displayMapPin,
19718
20190
  srs: mapPreset && mapPreset.proj && mapPreset.proj.srs,
19719
20191
  shouldAutoUpdate: mapPreset && mapPreset.shouldAutoUpdate || false,
19720
20192
  shouldShowZoomControls: shouldShowZoomControls !== undefined ? shouldShowZoomControls : true,
@@ -20414,4 +20886,4 @@ var CoreThemeStoreProvider = function CoreThemeStoreProvider(_ref2) {
20414
20886
  }, children)));
20415
20887
  };
20416
20888
 
20417
- export { ConfigurableConnectedMap, ConfigurableMapWithSliderConnect, CoreThemeProvider, CoreThemeStoreProvider, HarmRefTimePreset, HarmonieTempAndPrecipPreset, LayerManagerConnect, LayerManagerMapButtonConnect, Legend, LegendConnect, LegendMapButtonConnect, MapControls, MapView, MapViewConnect, MapViewLayer, MultiDimensionSelectMapButtonsConnect, MultiMapMultiDimensionSelectConnect as MultiMapDimensionSelectConnect, MultiMapViewConnect, ReactMapView, ReactMapViewLayer, SyncGroupViewerConnect, index as SyncGroups, TimeSliderConnect, TooltipSelect, ZoomControlConnect, ZoomControls, componentsLookUp, coreModuleConfig, defaultConfigurations, filterNonTimeDimensions, generateLayerId, generateMapId, generateScreenId, generateTimesliderId, getFirstTimeStepForLayerId, getLastTimeStepForLayerId, getNextTimeStepForLayerId, getPreviousTimeStepForLayerId, getWMJSDimensionForLayerAndDimension, getWMJSMapById, getWMJSTimeDimensionForLayerId, getWMLayerById, reducer$5 as layerReducer, makeMapPreset, actions$3 as mapActions, constants$1 as mapConstants, selectors as mapSelectors, types$2 as mapTypes, utils as mapUtils, publicLayers, publicServices, registerWMJSMap, registerWMLayer, store, actions as syncGroupActions, synchronizationGroupConfig as synchronizationGroupModuleConfig, testLayers, actions$2 as uiActions, types$1 as uiTypes, useStyles$3 as useStyles };
20889
+ export { ConfigurableConnectedMap, ConfigurableMapWithSliderConnect, CoreThemeProvider, CoreThemeStoreProvider, HarmRefTimePreset, HarmonieTempAndPrecipPreset, LayerManagerConnect, LayerManagerMapButtonConnect, Legend, LegendConnect, LegendMapButtonConnect, MapControls, MapView, MapViewConnect, MapViewLayer, MultiDimensionSelectMapButtonsConnect, MultiMapMultiDimensionSelectConnect as MultiMapDimensionSelectConnect, MultiMapViewConnect, ReactMapView, ReactMapViewLayer, SyncGroupViewerConnect, index as SyncGroups, TimeSliderConnect, TooltipSelect, ZoomControlConnect, ZoomControls, componentsLookUp, coreModuleConfig, dateFormat, defaultConfigurations, filterNonTimeDimensions, generateLayerId, generateMapId, generateScreenId, generateTimesliderId, getFirstTimeStepForLayerId, getLastTimeStepForLayerId, getNextTimeStepForLayerId, getPreviousTimeStepForLayerId, getWMJSDimensionForLayerAndDimension, getWMJSMapById, getWMJSTimeDimensionForLayerId, getWMLayerById, reducer$6 as layerReducer, makeMapPreset, actions$3 as mapActions, constants$1 as mapConstants, selectors as mapSelectors, types$2 as mapTypes, utils as mapUtils, publicLayers, publicServices, registerWMJSMap, registerWMLayer, store, actions as syncGroupActions, synchronizationGroupConfig as synchronizationGroupModuleConfig, testLayers, actions$2 as uiActions, types$1 as uiTypes, useStyles$3 as useStyles };