@opengeoweb/core 4.6.0 → 4.7.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (47) hide show
  1. package/index.esm.js +1522 -843
  2. package/index.umd.js +1383 -663
  3. package/lib/components/ConfigurableMap/ConfigurableMapConnect.d.ts +1 -0
  4. package/lib/components/FeatureInfo/GetFeatureInfoButtonConnect.d.ts +8 -0
  5. package/lib/components/FeatureInfo/GetFeatureInfoButtonConnect.spec.d.ts +1 -0
  6. package/lib/components/FeatureInfo/GetFeatureInfoConnect.d.ts +8 -0
  7. package/lib/components/FeatureInfo/GetFeatureInfoConnect.spec.d.ts +1 -0
  8. package/lib/components/FeatureInfo/GetFeatureInfoDialog.d.ts +16 -0
  9. package/lib/components/FeatureInfo/GetFeatureInfoDialog.spec.d.ts +1 -0
  10. package/lib/components/FeatureInfo/index.d.ts +3 -0
  11. package/lib/components/FeatureInfo/utils.d.ts +17 -0
  12. package/lib/components/FeatureInfo/utils.spec.d.ts +1 -0
  13. package/lib/components/LayerManager/DockedLayerManagerConnect.d.ts +2 -0
  14. package/lib/components/LayerManager/LayerSelect/LayerSelectUtils.d.ts +2 -2
  15. package/lib/components/LayerManager/LayerSelect/ServiceList/ServiceList.d.ts +2 -2
  16. package/lib/components/LayerManager/LayerSelect/ServiceOptionsDialog/ServiceOptionsDialog.d.ts +2 -2
  17. package/lib/components/LayerManager/LayerSelect/ServicePopup/ServicePopup.d.ts +2 -2
  18. package/lib/components/LayerManager/LayerSelect/ServicePopup/utils.d.ts +3 -3
  19. package/lib/components/ReactMapView/AdagucMapDraw.d.ts +0 -11
  20. package/lib/components/ReactMapView/AdagucMapDrawTools.d.ts +18 -0
  21. package/lib/components/ReactMapView/ReactMapView.d.ts +1 -2
  22. package/lib/components/ReactMapView/types.d.ts +1 -3
  23. package/lib/components/TimeSlider/TimeSliderButtons/AnimationLengthButton/AnimationLengthButton.d.ts +2 -1
  24. package/lib/components/TimeSlider/TimeSliderButtons/OptionsMenuButton/OptionsMenuButton.d.ts +0 -5
  25. package/lib/components/TimeSlider/TimeSliderButtons/PlayButton/PlayButtonConnect.d.ts +1 -1
  26. package/lib/components/TimeSlider/TimeSliderButtons/TimeSliderMenu/TimeSliderMenu.d.ts +2 -1
  27. package/lib/components/TimeSlider/TimeSliderButtons/TimeStepButton/TimeStepButton.d.ts +1 -1
  28. package/lib/components/TimeSlider/TimeSliderLegend/TimeSliderLegend.d.ts +2 -2
  29. package/lib/components/TimeSlider/TimeSliderUtils.d.ts +7 -3
  30. package/lib/components/TimeSlider/index.d.ts +1 -0
  31. package/lib/hooks/useSetupDialog/useSetupDialog.d.ts +2 -1
  32. package/lib/index.d.ts +10 -10
  33. package/lib/store/layerSelect/reducer.d.ts +3 -1
  34. package/lib/store/layerSelect/selectors.d.ts +6 -39
  35. package/lib/store/layerSelect/types.d.ts +12 -20
  36. package/lib/store/layerSelect/utils.d.ts +5 -0
  37. package/lib/store/layerSelect/utils.spec.d.ts +1 -0
  38. package/lib/store/mapStore/layers/reducer.d.ts +3 -1
  39. package/lib/store/mapStore/layers/selectors.d.ts +40 -0
  40. package/lib/store/mapStore/layers/types.d.ts +4 -0
  41. package/lib/store/mapStore/map/reducer.d.ts +2 -10
  42. package/lib/store/mapStore/map/sagas.d.ts +0 -5
  43. package/lib/store/mapStore/map/selectors.d.ts +25 -52
  44. package/lib/store/mapStore/map/types.d.ts +0 -23
  45. package/lib/store/mapStore/map/utils.d.ts +5 -4
  46. package/lib/store/ui/types.d.ts +4 -2
  47. package/package.json +11 -9
package/index.esm.js CHANGED
@@ -7,7 +7,7 @@ import _, { debounce, isEqual, groupBy, throttle, range } from 'lodash';
7
7
  import { takeLatest, put, select, call, takeEvery, all, delay } from 'redux-saga/effects';
8
8
  import { connect, useDispatch, useSelector, Provider } from 'react-redux';
9
9
  import { CustomTooltip, ToolButton, ToolContainerDraggable, IS_JEST, TooltipSelect, AlertIcon, useControlledTooltip, tooltipContainerStyles, sliderHeaderStyle, CustomSlider, ToggleMenu, ManagerButton, CustomAccordion, EnableButton, ManagerDeleteButton, AlertBanner, calculateDialogSizeAndPosition, useIsMounted, CustomToggleButton, useMakeSureContainerStaysInsideWindow, withEggs } from '@opengeoweb/shared';
10
- import { Pause, Play, Add, Copy, Both, None, DragHandle as DragHandle$1, Cached, CollapseSmall, CollapseMedium, CollapseLarge, CollapseWindow, ExpandWindow, Filter, Search, Clear, Close, Info, DimensionsOther, DimensionsElevation, DimensionsRefTime, DimensionsTime, Edit, Visibility, Delete, Home, Minus, Layers, Equalizer, Link, LinkOff, AutoUpdateActive, AutoUpdateInActive, TextIcon, Speed, FastForward, Clock, Now, Animation, Options, StepForward, StepBackward, dragHandlePath, ChevronDown, ChevronUp, List as List$1, ChevronRight, ChevronLeft, Resize, ThemeWrapper, lightTheme } from '@opengeoweb/theme';
10
+ import { Pause, Play, Add, Copy, Both, None, DragHandle as DragHandle$1, Cached, CollapseSmall, CollapseMedium, CollapseLarge, CollapseWindow, ExpandWindow, Filter, Search, Clear, Close, Info, DimensionsOther, DimensionsElevation, DimensionsRefTime, DimensionsTime, Edit, Visibility, Delete, Home, Minus, Layers, Equalizer, Link, LinkOff, AutoUpdateActive, AutoUpdateInActive, TextIcon, Speed, FastForward, Clock, Now, Animation, Options, StepForward, StepBackward, dragHandlePath, ChevronDown, ChevronUp, List as List$1, ChevronRight, ChevronLeft, Resize, ExitDomain, ThemeWrapper, lightTheme } from '@opengeoweb/theme';
11
11
  import { Paper, Box, Typography, IconButton, Grid, MenuItem, Button, Popper, FormControl, InputLabel, List, ListItem, ListItemText, CircularProgress, ListSubheader, Dialog, DialogTitle, DialogContent, DialogContentText, TextField, DialogActions, LinearProgress, InputAdornment, Backdrop, ListItemSecondaryAction, ListItemIcon, Checkbox, Switch, styled, Slider, Menu, useTheme, Snackbar } from '@mui/material';
12
12
  import { legendImageStore, WMImageEventType, getLegendGraphicURLForLayer, WMGetServiceFromStore, LayerType as LayerType$1, clearImageCache, getMapImageStore, WMBBOX, debug, DebugType, WMJSMap, WMLayer } from '@opengeoweb/webmap';
13
13
  import { ReactSortable } from 'react-sortablejs';
@@ -25,6 +25,8 @@ import proj4 from 'proj4';
25
25
  import * as turf from '@turf/turf';
26
26
  import Draggable from 'react-draggable';
27
27
  import { Resizable } from 're-resizable';
28
+ import axios from 'axios';
29
+ import { useDebounce } from '@opengeoweb/api';
28
30
  import { createStore } from '@redux-eggs/redux-toolkit';
29
31
  import { getSagaExtension } from '@redux-eggs/saga-extension';
30
32
 
@@ -368,6 +370,13 @@ var LayerActionOrigin;
368
370
  LayerActionOrigin["unregisterMapSaga"] = "unregisterMapSaga";
369
371
  })(LayerActionOrigin || (LayerActionOrigin = {}));
370
372
 
373
+ var types$3 = /*#__PURE__*/Object.freeze({
374
+ __proto__: null,
375
+ get LayerType () { return LayerType; },
376
+ get LayerStatus () { return LayerStatus; },
377
+ get LayerActionOrigin () { return LayerActionOrigin; }
378
+ });
379
+
371
380
  /* *
372
381
  * Licensed under the Apache License, Version 2.0 (the "License");
373
382
  * you may not use this file except in compliance with the License.
@@ -738,6 +747,14 @@ var getDataLimitsFromLayers = function getDataLimitsFromLayers(layers) {
738
747
  */
739
748
  [2147483647, 0]);
740
749
  };
750
+ var getNextTimeStepvalue = function getNextTimeStepvalue(value, max) {
751
+ var newValue = value + 1;
752
+ return newValue > max ? max : newValue;
753
+ };
754
+ var getPreviousTimeStepvalue = function getPreviousTimeStepvalue(value, min) {
755
+ var newValue = value - 1;
756
+ return newValue < min ? min : newValue;
757
+ };
741
758
  var setPreviousTimeStep = function setPreviousTimeStep(timeStep, curTime, dataStartTime, onSetNewDate) {
742
759
  var prevTimeStep = moment.utc(curTime).subtract(timeStep, 'm').toISOString();
743
760
 
@@ -764,43 +781,39 @@ var setNextTimeStep = function setNextTimeStep(timeStep, curTime, dataEndTime, o
764
781
 
765
782
  onsetNewDateDebounced(nextTimeStep, onSetNewDate);
766
783
  };
767
- var getTimeStepFromDataInterval = function getTimeStepFromDataInterval(timeInterval) {
768
- switch (timeInterval.isRegularInterval) {
769
- case false:
770
- switch (timeInterval.year) {
771
- case 0:
772
- // month
773
- return 30 * 24 * 60;
774
-
775
- default:
776
- return timeInterval.year * 365 * 24 * 60;
777
- }
778
-
779
- case true:
780
- if (timeInterval.day !== 0) {
781
- return timeInterval.day * 24 * 60;
782
- }
784
+ var getValueFromKeyboardEvent = function getValueFromKeyboardEvent(event, value, min, max) {
785
+ var supportFourDirectionNavigation = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : false;
783
786
 
784
- if (timeInterval.hour !== 0) {
785
- return timeInterval.hour * 60;
786
- }
787
+ if (!supportFourDirectionNavigation) {
788
+ if (event.ctrlKey || event.metaKey) {
789
+ switch (event.key) {
790
+ case 'ArrowDown':
791
+ return getPreviousTimeStepvalue(value, min);
787
792
 
788
- if (timeInterval.minute !== 0) {
789
- return timeInterval.minute;
790
- }
793
+ case 'ArrowUp':
794
+ return getNextTimeStepvalue(value, max);
791
795
 
792
- if (timeInterval.second !== 0) {
793
- return timeInterval.second / 60.0;
796
+ default:
797
+ return null;
794
798
  }
799
+ }
800
+ } else {
801
+ // currently supportFourDirectionNavigation (left/right/up/down) is only used in horizontal slider TimeSliderScaleSlider
802
+ switch (event.key) {
803
+ case 'ArrowDown':
804
+ case 'ArrowLeft':
805
+ return getPreviousTimeStepvalue(value, min);
795
806
 
796
- return 5;
807
+ case 'ArrowUp':
808
+ case 'ArrowRight':
809
+ return getNextTimeStepvalue(value, max);
797
810
 
798
- default:
799
- return 5;
811
+ default:
812
+ return null;
813
+ }
800
814
  }
801
- };
802
- var getActiveLayerTimeStep = function getActiveLayerTimeStep(timeDimension) {
803
- return (timeDimension === null || timeDimension === void 0 ? void 0 : timeDimension.timeInterval) ? getTimeStepFromDataInterval(timeDimension.timeInterval) : null;
815
+
816
+ return null;
804
817
  };
805
818
  /**
806
819
  * This function calculates a suitable secondsPerpx value,
@@ -847,11 +860,38 @@ var scaleToSecondsPerPx = _toConsumableArray(secondsPerPxToScale.entries()).redu
847
860
 
848
861
  return Object.assign(Object.assign({}, acc), _defineProperty({}, v, Number(k)));
849
862
  }, {});
863
+ /**
864
+ * This function creates and returns an array where there is secondsPerPx
865
+ * number of the data set added for a data scale (dataScaleToSecondsPerPx)
866
+ * to secondsPerPxToScale.
867
+ * @param dataScaleToSecondsPerPx
868
+ * @returns an array containing secondsPerPx numbers.
869
+ * The secondsPerPx number for a data scale is included
870
+ * contrary to secondsPerPxToScale.
871
+ */
872
+
873
+ var secondsPerPxValues = function secondsPerPxValues(dataScaleToSecondsPerPx) {
874
+ var sortedSecondsPerPx = _toConsumableArray(secondsPerPxToScale).map(function (value) {
875
+ return Number(value[0]);
876
+ });
877
+
878
+ var full = [].concat(_toConsumableArray(sortedSecondsPerPx), [dataScaleToSecondsPerPx]);
879
+ return full;
880
+ };
850
881
  var defaultDataScaleToSecondsPerPx = 43200;
851
882
  var getNewCenterOfFixedPointZoom = function getNewCenterOfFixedPointZoom(fixedTimePoint, oldSecondsPerPx, newSecondsPerPx, oldCenterTime) {
852
883
  var centerToFixedPointPx = (fixedTimePoint - oldCenterTime) / oldSecondsPerPx;
853
884
  return fixedTimePoint - centerToFixedPointPx * newSecondsPerPx;
854
885
  };
886
+ /**
887
+ * Move the time slider such that a given time point (timePoint)
888
+ * is at a given pixel width (timePointPx).
889
+ * @returns a new center time for the resulting position
890
+ */
891
+
892
+ var moveRelativeToTimePoint = function moveRelativeToTimePoint(timePoint, timePointPx, secondsPerPx, canvasWidth) {
893
+ return timePoint - secondsPerPx * (timePointPx - canvasWidth / 2);
894
+ };
855
895
  /** This reusable custom hook tells whether given pointer event targets current canvas node.
856
896
  * Example:
857
897
  *
@@ -889,6 +929,10 @@ var needleGeom = {
889
929
  cornerRadius: 5,
890
930
  lineWidth: 1
891
931
  };
932
+ var AUTO_MOVE_AREA_PADDING = 1;
933
+ var getAutoMoveAreaWidth = function getAutoMoveAreaWidth(scale) {
934
+ return (scale === Scale.Year ? needleGeom.largeWidth : needleGeom.smallWidth) / 2 + AUTO_MOVE_AREA_PADDING;
935
+ };
892
936
  /** Reusable business logic for how to handle events that set time to now (closest).
893
937
  * Used in NowButton and TimeSliderLegend.
894
938
  */
@@ -908,6 +952,92 @@ var handleSetNowEvent = function handleSetNowEvent(timeStep, dataStartTime, data
908
952
  }
909
953
  }
910
954
  };
955
+ var TimeInMinutes;
956
+
957
+ (function (TimeInMinutes) {
958
+ TimeInMinutes[TimeInMinutes["YEAR"] = 525600] = "YEAR";
959
+ TimeInMinutes[TimeInMinutes["MONTH"] = 43800] = "MONTH";
960
+ TimeInMinutes[TimeInMinutes["DAY"] = 1440] = "DAY";
961
+ TimeInMinutes[TimeInMinutes["HOUR"] = 60] = "HOUR";
962
+ })(TimeInMinutes || (TimeInMinutes = {}));
963
+
964
+ var minutesToDescribedDuration = function minutesToDescribedDuration(minutes) {
965
+ var dateStr = '';
966
+ var time = minutes; // subtracting whole years/months/days from time duration and adding the amount to the string to be printed.
967
+
968
+ if (time >= TimeInMinutes.YEAR) {
969
+ var yearsInMintues = Math.floor(time / TimeInMinutes.YEAR);
970
+ dateStr += "".concat(yearsInMintues, "y");
971
+ time -= yearsInMintues * TimeInMinutes.YEAR;
972
+ }
973
+
974
+ if (time >= TimeInMinutes.MONTH) {
975
+ var monthsInMinutes = Math.floor(time / TimeInMinutes.MONTH);
976
+ dateStr += "".concat(monthsInMinutes, "m");
977
+ time -= monthsInMinutes * TimeInMinutes.MONTH;
978
+ }
979
+
980
+ if (time >= TimeInMinutes.DAY) {
981
+ var daysInMinutes = Math.floor(time / TimeInMinutes.DAY);
982
+ dateStr += "".concat(daysInMinutes, "d");
983
+ time -= daysInMinutes * TimeInMinutes.DAY;
984
+ } // we will always print hour/minutes if there are any of them in the XX:XX format
985
+
986
+
987
+ if (time > 0) {
988
+ if (dateStr !== '') dateStr += ' ';
989
+ dateStr += "".concat(Math.floor(time / TimeInMinutes.HOUR).toLocaleString(undefined, {
990
+ minimumIntegerDigits: 2,
991
+ useGrouping: false
992
+ }), "h").concat((time % TimeInMinutes.HOUR).toLocaleString(undefined, {
993
+ minimumIntegerDigits: 2,
994
+ useGrouping: false
995
+ }), "min");
996
+ }
997
+
998
+ return dateStr;
999
+ };
1000
+
1001
+ var TimeSliderUtils = /*#__PURE__*/Object.freeze({
1002
+ __proto__: null,
1003
+ millisecondsInSecond: millisecondsInSecond,
1004
+ defaultAnimationDelayAtStart: defaultAnimationDelayAtStart,
1005
+ defaultDelay: defaultDelay,
1006
+ defaultTimeStep: defaultTimeStep,
1007
+ speedFactors: speedFactors,
1008
+ getSpeedDelay: getSpeedDelay,
1009
+ getSpeedFactor: getSpeedFactor,
1010
+ getSelectedTime: getSelectedTime,
1011
+ getTimeBounds: getTimeBounds,
1012
+ getMomentTimeBounds: getMomentTimeBounds,
1013
+ scalingCoefficient: scalingCoefficient,
1014
+ timestampToPixelEdges: timestampToPixelEdges,
1015
+ timestampToPixel: timestampToPixel,
1016
+ pixelToTimestamp: pixelToTimestamp,
1017
+ onsetNewDateDebounced: onsetNewDateDebounced,
1018
+ roundWithTimeStep: roundWithTimeStep,
1019
+ setNewRoundedTime: setNewRoundedTime,
1020
+ getDataLimitsFromLayers: getDataLimitsFromLayers,
1021
+ getNextTimeStepvalue: getNextTimeStepvalue,
1022
+ getPreviousTimeStepvalue: getPreviousTimeStepvalue,
1023
+ setPreviousTimeStep: setPreviousTimeStep,
1024
+ setNextTimeStep: setNextTimeStep,
1025
+ getValueFromKeyboardEvent: getValueFromKeyboardEvent,
1026
+ getScaleToSecondsPerPxForDataScale: getScaleToSecondsPerPxForDataScale,
1027
+ secondsPerPxToScale: secondsPerPxToScale,
1028
+ scaleToSecondsPerPx: scaleToSecondsPerPx,
1029
+ secondsPerPxValues: secondsPerPxValues,
1030
+ defaultDataScaleToSecondsPerPx: defaultDataScaleToSecondsPerPx,
1031
+ getNewCenterOfFixedPointZoom: getNewCenterOfFixedPointZoom,
1032
+ moveRelativeToTimePoint: moveRelativeToTimePoint,
1033
+ useCanvasTarget: useCanvasTarget,
1034
+ needleGeom: needleGeom,
1035
+ AUTO_MOVE_AREA_PADDING: AUTO_MOVE_AREA_PADDING,
1036
+ getAutoMoveAreaWidth: getAutoMoveAreaWidth,
1037
+ handleSetNowEvent: handleSetNowEvent,
1038
+ get TimeInMinutes () { return TimeInMinutes; },
1039
+ minutesToDescribedDuration: minutesToDescribedDuration
1040
+ });
911
1041
 
912
1042
  var createMap = function createMap(_ref) {
913
1043
  var id = _ref.id,
@@ -958,18 +1088,12 @@ var createMap = function createMap(_ref) {
958
1088
  isTimeSliderHoverOn = _ref$isTimeSliderHove === void 0 ? false : _ref$isTimeSliderHove,
959
1089
  _ref$isTimeSliderVisi = _ref.isTimeSliderVisible,
960
1090
  isTimeSliderVisible = _ref$isTimeSliderVisi === void 0 ? true : _ref$isTimeSliderVisi,
961
- _ref$activeMapPresetI = _ref.activeMapPresetId,
962
- activeMapPresetId = _ref$activeMapPresetI === void 0 ? null : _ref$activeMapPresetI,
963
1091
  _ref$displayMapPin = _ref.displayMapPin,
964
1092
  displayMapPin = _ref$displayMapPin === void 0 ? false : _ref$displayMapPin,
965
1093
  _ref$disableMapPin = _ref.disableMapPin,
966
1094
  disableMapPin = _ref$disableMapPin === void 0 ? false : _ref$disableMapPin,
967
1095
  _ref$shouldShowZoomCo = _ref.shouldShowZoomControls,
968
- shouldShowZoomControls = _ref$shouldShowZoomCo === void 0 ? true : _ref$shouldShowZoomCo,
969
- _ref$dockedLayerManag = _ref.dockedLayerManager,
970
- dockedLayerManager = _ref$dockedLayerManag === void 0 ? {
971
- isOpen: false
972
- } : _ref$dockedLayerManag;
1096
+ shouldShowZoomControls = _ref$shouldShowZoomCo === void 0 ? true : _ref$shouldShowZoomCo;
973
1097
  return {
974
1098
  id: id,
975
1099
  isAnimating: isAnimating,
@@ -993,11 +1117,9 @@ var createMap = function createMap(_ref) {
993
1117
  isTimestepAuto: isTimestepAuto,
994
1118
  isTimeSliderHoverOn: isTimeSliderHoverOn,
995
1119
  isTimeSliderVisible: isTimeSliderVisible,
996
- activeMapPresetId: activeMapPresetId,
997
1120
  displayMapPin: displayMapPin,
998
1121
  disableMapPin: disableMapPin,
999
- shouldShowZoomControls: shouldShowZoomControls,
1000
- dockedLayerManager: dockedLayerManager
1122
+ shouldShowZoomControls: shouldShowZoomControls
1001
1123
  };
1002
1124
  };
1003
1125
  var checkValidLayersPayload = function checkValidLayersPayload(layers, mapId) {
@@ -1137,6 +1259,44 @@ function moveArrayElements(array, oldIndex, newIndex) {
1137
1259
  newArray.splice(indexNew, 0, newArray.splice(oldIndex, 1)[0]);
1138
1260
  return newArray;
1139
1261
  }
1262
+ var getTimeStepFromDataInterval = function getTimeStepFromDataInterval(timeInterval) {
1263
+ switch (timeInterval.isRegularInterval) {
1264
+ case false:
1265
+ switch (timeInterval.year) {
1266
+ case 0:
1267
+ // month
1268
+ return 30 * 24 * 60;
1269
+
1270
+ default:
1271
+ return timeInterval.year * 365 * 24 * 60;
1272
+ }
1273
+
1274
+ case true:
1275
+ if (timeInterval.day !== 0) {
1276
+ return timeInterval.day * 24 * 60;
1277
+ }
1278
+
1279
+ if (timeInterval.hour !== 0) {
1280
+ return timeInterval.hour * 60;
1281
+ }
1282
+
1283
+ if (timeInterval.minute !== 0) {
1284
+ return timeInterval.minute;
1285
+ }
1286
+
1287
+ if (timeInterval.second !== 0) {
1288
+ return timeInterval.second / 60.0;
1289
+ }
1290
+
1291
+ return 5;
1292
+
1293
+ default:
1294
+ return 5;
1295
+ }
1296
+ };
1297
+ var getActiveLayerTimeStep = function getActiveLayerTimeStep(timeDimension) {
1298
+ return (timeDimension === null || timeDimension === void 0 ? void 0 : timeDimension.timeInterval) ? getTimeStepFromDataInterval(timeDimension.timeInterval) : null;
1299
+ };
1140
1300
 
1141
1301
  var utils = /*#__PURE__*/Object.freeze({
1142
1302
  __proto__: null,
@@ -1146,7 +1306,9 @@ var utils = /*#__PURE__*/Object.freeze({
1146
1306
  produceDraftStateSetWebMapDimension: produceDraftStateSetWebMapDimension,
1147
1307
  findMapIdFromLayerId: findMapIdFromLayerId,
1148
1308
  produceDraftStateSetMapDimensionFromLayerChangeDimension: produceDraftStateSetMapDimensionFromLayerChangeDimension,
1149
- moveArrayElements: moveArrayElements
1309
+ moveArrayElements: moveArrayElements,
1310
+ getTimeStepFromDataInterval: getTimeStepFromDataInterval,
1311
+ getActiveLayerTimeStep: getActiveLayerTimeStep
1150
1312
  });
1151
1313
 
1152
1314
  /* *
@@ -1692,13 +1854,24 @@ var slice$6 = createSlice({
1692
1854
  var dimensionsAction = layerActions.layerSetDimensions(layerDimensions);
1693
1855
  var newState = layerDimensions === null ? intermediateState : reducer$6(intermediateState, dimensionsAction);
1694
1856
  return newState;
1857
+ },
1858
+ setSelectedFeature: function setSelectedFeature(draft, action) {
1859
+ var _action$payload13 = action.payload,
1860
+ layerId = _action$payload13.layerId,
1861
+ selectedFeatureIndex = _action$payload13.selectedFeatureIndex;
1862
+
1863
+ if (!draft.byId[layerId]) {
1864
+ return;
1865
+ }
1866
+
1867
+ draft.byId[layerId].selectedFeatureIndex = selectedFeatureIndex;
1695
1868
  }
1696
1869
  },
1697
1870
  extraReducers: function extraReducers(builder) {
1698
1871
  builder.addCase(setTimeSync, function (draft, action) {
1699
- var _action$payload13 = action.payload,
1700
- targetsFromAction = _action$payload13.targets,
1701
- source = _action$payload13.source;
1872
+ var _action$payload14 = action.payload,
1873
+ targetsFromAction = _action$payload14.targets,
1874
+ source = _action$payload14.source;
1702
1875
  /* Because we want backwards compatibility with the previous code, we also need to listen to the original source action */
1703
1876
 
1704
1877
  var targets = [{
@@ -1724,9 +1897,9 @@ var slice$6 = createSlice({
1724
1897
  * These targets can be used as payloads in new Layer actions.
1725
1898
  * These actions are here handled via the layer reducer, as it is the same logic
1726
1899
  */
1727
- var _action$payload14 = action.payload,
1728
- targets = _action$payload14.targets,
1729
- source = _action$payload14.source;
1900
+ var _action$payload15 = action.payload,
1901
+ targets = _action$payload15.targets,
1902
+ source = _action$payload15.source;
1730
1903
  var state = current(draft);
1731
1904
  return targets.reduce(function (prevState, target) {
1732
1905
  var action = {
@@ -2261,21 +2434,10 @@ var slice$3 = createSlice({
2261
2434
 
2262
2435
  draft.byId[mapId].animationEndTime = animationEndTime;
2263
2436
  },
2264
- setSelectedFeature: function setSelectedFeature(draft, action) {
2437
+ setAnimationDelay: function setAnimationDelay(draft, action) {
2265
2438
  var _action$payload7 = action.payload,
2266
2439
  mapId = _action$payload7.mapId,
2267
- selectedFeatureIndex = _action$payload7.selectedFeatureIndex;
2268
-
2269
- if (!draft.byId[mapId]) {
2270
- return;
2271
- }
2272
-
2273
- draft.byId[mapId].selectedFeatureIndex = selectedFeatureIndex;
2274
- },
2275
- setAnimationDelay: function setAnimationDelay(draft, action) {
2276
- var _action$payload8 = action.payload,
2277
- mapId = _action$payload8.mapId,
2278
- animationDelay = _action$payload8.animationDelay;
2440
+ animationDelay = _action$payload7.animationDelay;
2279
2441
 
2280
2442
  if (!draft.byId[mapId]) {
2281
2443
  return;
@@ -2284,10 +2446,10 @@ var slice$3 = createSlice({
2284
2446
  draft.byId[mapId].animationDelay = animationDelay;
2285
2447
  },
2286
2448
  layerMoveLayer: function layerMoveLayer(draft, action) {
2287
- var _action$payload9 = action.payload,
2288
- oldIndex = _action$payload9.oldIndex,
2289
- newIndex = _action$payload9.newIndex,
2290
- mapId = _action$payload9.mapId;
2449
+ var _action$payload8 = action.payload,
2450
+ oldIndex = _action$payload8.oldIndex,
2451
+ newIndex = _action$payload8.newIndex,
2452
+ mapId = _action$payload8.mapId;
2291
2453
 
2292
2454
  if (!draft.byId[mapId]) {
2293
2455
  return;
@@ -2296,9 +2458,9 @@ var slice$3 = createSlice({
2296
2458
  draft.byId[mapId].mapLayers = moveArrayElements(draft.byId[mapId].mapLayers, oldIndex, newIndex);
2297
2459
  },
2298
2460
  setActiveLayerId: function setActiveLayerId(draft, action) {
2299
- var _action$payload10 = action.payload,
2300
- mapId = _action$payload10.mapId,
2301
- layerId = _action$payload10.layerId;
2461
+ var _action$payload9 = action.payload,
2462
+ mapId = _action$payload9.mapId,
2463
+ layerId = _action$payload9.layerId;
2302
2464
 
2303
2465
  if (!draft.byId[mapId]) {
2304
2466
  return;
@@ -2307,9 +2469,9 @@ var slice$3 = createSlice({
2307
2469
  draft.byId[mapId].activeLayerId = layerId;
2308
2470
  },
2309
2471
  setTimeSliderCenterTime: function setTimeSliderCenterTime(draft, action) {
2310
- var _action$payload11 = action.payload,
2311
- mapId = _action$payload11.mapId,
2312
- timeSliderCenterTime = _action$payload11.timeSliderCenterTime;
2472
+ var _action$payload10 = action.payload,
2473
+ mapId = _action$payload10.mapId,
2474
+ timeSliderCenterTime = _action$payload10.timeSliderCenterTime;
2313
2475
 
2314
2476
  if (!draft.byId[mapId]) {
2315
2477
  return;
@@ -2318,9 +2480,9 @@ var slice$3 = createSlice({
2318
2480
  draft.byId[mapId].timeSliderCenterTime = timeSliderCenterTime;
2319
2481
  },
2320
2482
  setTimeSliderUnfilteredSelectedTime: function setTimeSliderUnfilteredSelectedTime(draft, action) {
2321
- var _action$payload12 = action.payload,
2322
- mapId = _action$payload12.mapId,
2323
- timeSliderUnfilteredSelectedTime = _action$payload12.timeSliderUnfilteredSelectedTime;
2483
+ var _action$payload11 = action.payload,
2484
+ mapId = _action$payload11.mapId,
2485
+ timeSliderUnfilteredSelectedTime = _action$payload11.timeSliderUnfilteredSelectedTime;
2324
2486
 
2325
2487
  if (!draft.byId[mapId]) {
2326
2488
  return;
@@ -2329,9 +2491,9 @@ var slice$3 = createSlice({
2329
2491
  draft.byId[mapId].timeSliderUnfilteredSelectedTime = timeSliderUnfilteredSelectedTime;
2330
2492
  },
2331
2493
  setTimeSliderSecondsPerPx: function setTimeSliderSecondsPerPx(draft, action) {
2332
- var _action$payload13 = action.payload,
2333
- mapId = _action$payload13.mapId,
2334
- timeSliderSecondsPerPx = _action$payload13.timeSliderSecondsPerPx;
2494
+ var _action$payload12 = action.payload,
2495
+ mapId = _action$payload12.mapId,
2496
+ timeSliderSecondsPerPx = _action$payload12.timeSliderSecondsPerPx;
2335
2497
 
2336
2498
  if (!draft.byId[mapId]) {
2337
2499
  return;
@@ -2343,9 +2505,9 @@ var slice$3 = createSlice({
2343
2505
  draft.byId[mapId].timeSliderScale = scale;
2344
2506
  },
2345
2507
  setTimeSliderDataScaleToSecondsPerPx: function setTimeSliderDataScaleToSecondsPerPx(draft, action) {
2346
- var _action$payload14 = action.payload,
2347
- mapId = _action$payload14.mapId,
2348
- timeSliderDataScaleToSecondsPerPx = _action$payload14.timeSliderDataScaleToSecondsPerPx;
2508
+ var _action$payload13 = action.payload,
2509
+ mapId = _action$payload13.mapId,
2510
+ timeSliderDataScaleToSecondsPerPx = _action$payload13.timeSliderDataScaleToSecondsPerPx;
2349
2511
 
2350
2512
  if (!draft.byId[mapId]) {
2351
2513
  return;
@@ -2354,9 +2516,9 @@ var slice$3 = createSlice({
2354
2516
  draft.byId[mapId].timeSliderDataScaleToSecondsPerPx = timeSliderDataScaleToSecondsPerPx;
2355
2517
  },
2356
2518
  toggleAutoUpdate: function toggleAutoUpdate(draft, action) {
2357
- var _action$payload15 = action.payload,
2358
- mapId = _action$payload15.mapId,
2359
- shouldAutoUpdate = _action$payload15.shouldAutoUpdate;
2519
+ var _action$payload14 = action.payload,
2520
+ mapId = _action$payload14.mapId,
2521
+ shouldAutoUpdate = _action$payload14.shouldAutoUpdate;
2360
2522
 
2361
2523
  if (!draft.byId[mapId]) {
2362
2524
  return;
@@ -2365,9 +2527,9 @@ var slice$3 = createSlice({
2365
2527
  draft.byId[mapId].isAutoUpdating = shouldAutoUpdate;
2366
2528
  },
2367
2529
  toggleTimestepAuto: function toggleTimestepAuto(draft, action) {
2368
- var _action$payload16 = action.payload,
2369
- mapId = _action$payload16.mapId,
2370
- timestepAuto = _action$payload16.timestepAuto;
2530
+ var _action$payload15 = action.payload,
2531
+ mapId = _action$payload15.mapId,
2532
+ timestepAuto = _action$payload15.timestepAuto;
2371
2533
 
2372
2534
  if (!draft.byId[mapId]) {
2373
2535
  return;
@@ -2376,9 +2538,9 @@ var slice$3 = createSlice({
2376
2538
  draft.byId[mapId].isTimestepAuto = timestepAuto;
2377
2539
  },
2378
2540
  toggleTimeSliderHover: function toggleTimeSliderHover(draft, action) {
2379
- var _action$payload17 = action.payload,
2380
- mapId = _action$payload17.mapId,
2381
- isTimeSliderHoverOn = _action$payload17.isTimeSliderHoverOn;
2541
+ var _action$payload16 = action.payload,
2542
+ mapId = _action$payload16.mapId,
2543
+ isTimeSliderHoverOn = _action$payload16.isTimeSliderHoverOn;
2382
2544
 
2383
2545
  if (!draft.byId[mapId]) {
2384
2546
  return;
@@ -2387,9 +2549,9 @@ var slice$3 = createSlice({
2387
2549
  draft.byId[mapId].isTimeSliderHoverOn = isTimeSliderHoverOn;
2388
2550
  },
2389
2551
  toggleTimeSliderIsVisible: function toggleTimeSliderIsVisible(draft, action) {
2390
- var _action$payload18 = action.payload,
2391
- mapId = _action$payload18.mapId,
2392
- isTimeSliderVisible = _action$payload18.isTimeSliderVisible;
2552
+ var _action$payload17 = action.payload,
2553
+ mapId = _action$payload17.mapId,
2554
+ isTimeSliderVisible = _action$payload17.isTimeSliderVisible;
2393
2555
 
2394
2556
  if (!draft.byId[mapId]) {
2395
2557
  return;
@@ -2398,9 +2560,9 @@ var slice$3 = createSlice({
2398
2560
  draft.byId[mapId].isTimeSliderVisible = isTimeSliderVisible;
2399
2561
  },
2400
2562
  toggleZoomControls: function toggleZoomControls(draft, action) {
2401
- var _action$payload19 = action.payload,
2402
- mapId = _action$payload19.mapId,
2403
- shouldShowZoomControls = _action$payload19.shouldShowZoomControls;
2563
+ var _action$payload18 = action.payload,
2564
+ mapId = _action$payload18.mapId,
2565
+ shouldShowZoomControls = _action$payload18.shouldShowZoomControls;
2404
2566
 
2405
2567
  if (!draft.byId[mapId]) {
2406
2568
  return;
@@ -2409,9 +2571,9 @@ var slice$3 = createSlice({
2409
2571
  draft.byId[mapId].shouldShowZoomControls = shouldShowZoomControls;
2410
2572
  },
2411
2573
  setMapPinLocation: function setMapPinLocation(draft, action) {
2412
- var _action$payload20 = action.payload,
2413
- mapId = _action$payload20.mapId,
2414
- mapPinLocation = _action$payload20.mapPinLocation;
2574
+ var _action$payload19 = action.payload,
2575
+ mapId = _action$payload19.mapId,
2576
+ mapPinLocation = _action$payload19.mapPinLocation;
2415
2577
 
2416
2578
  if (!draft.byId[mapId]) {
2417
2579
  return;
@@ -2420,9 +2582,9 @@ var slice$3 = createSlice({
2420
2582
  draft.byId[mapId].mapPinLocation = mapPinLocation;
2421
2583
  },
2422
2584
  setDisableMapPin: function setDisableMapPin(draft, action) {
2423
- var _action$payload21 = action.payload,
2424
- mapId = _action$payload21.mapId,
2425
- disableMapPin = _action$payload21.disableMapPin;
2585
+ var _action$payload20 = action.payload,
2586
+ mapId = _action$payload20.mapId,
2587
+ disableMapPin = _action$payload20.disableMapPin;
2426
2588
 
2427
2589
  if (!draft.byId[mapId]) {
2428
2590
  return;
@@ -2431,57 +2593,22 @@ var slice$3 = createSlice({
2431
2593
  draft.byId[mapId].disableMapPin = disableMapPin;
2432
2594
  },
2433
2595
  toggleMapPinIsVisible: function toggleMapPinIsVisible(draft, action) {
2434
- var _action$payload22 = action.payload,
2435
- mapId = _action$payload22.mapId,
2436
- displayMapPin = _action$payload22.displayMapPin;
2596
+ var _action$payload21 = action.payload,
2597
+ mapId = _action$payload21.mapId,
2598
+ displayMapPin = _action$payload21.displayMapPin;
2437
2599
 
2438
2600
  if (!draft.byId[mapId]) {
2439
2601
  return;
2440
2602
  }
2441
2603
 
2442
2604
  draft.byId[mapId].displayMapPin = displayMapPin;
2443
- },
2444
- setActiveMapPresetId: function setActiveMapPresetId(draft, action) {
2445
- var _action$payload23 = action.payload,
2446
- mapId = _action$payload23.mapId,
2447
- presetId = _action$payload23.presetId;
2448
-
2449
- if (!draft.byId[mapId]) {
2450
- return;
2451
- }
2452
-
2453
- draft.byId[mapId].activeMapPresetId = presetId;
2454
- },
2455
- setHasMapPresetChanges: function setHasMapPresetChanges(draft, action) {
2456
- var _action$payload24 = action.payload,
2457
- mapId = _action$payload24.mapId,
2458
- hasChanges = _action$payload24.hasChanges;
2459
-
2460
- if (!draft.byId[mapId]) {
2461
- return;
2462
- }
2463
-
2464
- draft.byId[mapId].hasMapPresetChanges = hasChanges;
2465
- },
2466
- toggleDockedLayerManager: function toggleDockedLayerManager(draft, action) {
2467
- var _action$payload25 = action.payload,
2468
- mapId = _action$payload25.mapId,
2469
- openDockedLayerManager = _action$payload25.openDockedLayerManager;
2470
-
2471
- if (!draft.byId[mapId]) {
2472
- return;
2473
- }
2474
-
2475
- draft.byId[mapId].dockedLayerManager = {
2476
- isOpen: openDockedLayerManager
2477
- };
2478
2605
  }
2479
2606
  },
2480
2607
  extraReducers: function extraReducers(builder) {
2481
2608
  builder.addCase(addLayer$1, function (draft, action) {
2482
- var _action$payload26 = action.payload,
2483
- layerId = _action$payload26.layerId,
2484
- mapId = _action$payload26.mapId;
2609
+ var _action$payload22 = action.payload,
2610
+ layerId = _action$payload22.layerId,
2611
+ mapId = _action$payload22.mapId;
2485
2612
 
2486
2613
  if (!draft.byId[mapId]) {
2487
2614
  return;
@@ -2498,10 +2625,10 @@ var slice$3 = createSlice({
2498
2625
 
2499
2626
  draft.byId[mapId].mapLayers.unshift(layerId);
2500
2627
  }).addCase(addBaseLayer, function (draft, action) {
2501
- var _action$payload27 = action.payload,
2502
- layer = _action$payload27.layer,
2503
- layerId = _action$payload27.layerId,
2504
- mapId = _action$payload27.mapId;
2628
+ var _action$payload23 = action.payload,
2629
+ layer = _action$payload23.layer,
2630
+ layerId = _action$payload23.layerId,
2631
+ mapId = _action$payload23.mapId;
2505
2632
 
2506
2633
  if (!draft.byId[mapId]) {
2507
2634
  return;
@@ -2551,9 +2678,9 @@ var slice$3 = createSlice({
2551
2678
  }
2552
2679
  }
2553
2680
  }).addCase(setBaseLayers$1, function (draft, action) {
2554
- var _action$payload28 = action.payload,
2555
- layers = _action$payload28.layers,
2556
- mapId = _action$payload28.mapId; // Split into base and overlayers
2681
+ var _action$payload24 = action.payload,
2682
+ layers = _action$payload24.layers,
2683
+ mapId = _action$payload24.mapId; // Split into base and overlayers
2557
2684
 
2558
2685
  var baseLayers = [];
2559
2686
  var overLayers = [];
@@ -2580,9 +2707,9 @@ var slice$3 = createSlice({
2580
2707
  if (overLayerIds.length !== 0) draft.byId[mapId].overLayers = overLayerIds;
2581
2708
  }
2582
2709
  }).addCase(layerDelete$1, function (draft, action) {
2583
- var _action$payload29 = action.payload,
2584
- mapId = _action$payload29.mapId,
2585
- layerId = _action$payload29.layerId;
2710
+ var _action$payload25 = action.payload,
2711
+ mapId = _action$payload25.mapId,
2712
+ layerId = _action$payload25.layerId;
2586
2713
 
2587
2714
  if (!draft.byId[mapId]) {
2588
2715
  return;
@@ -2603,9 +2730,9 @@ var slice$3 = createSlice({
2603
2730
  draft.byId[mapId].activeLayerId = '';
2604
2731
  }
2605
2732
  }).addCase(baseLayerDelete, function (draft, action) {
2606
- var _action$payload30 = action.payload,
2607
- mapId = _action$payload30.mapId,
2608
- layerId = _action$payload30.layerId;
2733
+ var _action$payload26 = action.payload,
2734
+ mapId = _action$payload26.mapId,
2735
+ layerId = _action$payload26.layerId;
2609
2736
 
2610
2737
  if (!draft.byId[mapId]) {
2611
2738
  return;
@@ -2618,14 +2745,14 @@ var slice$3 = createSlice({
2618
2745
  return id !== layerId;
2619
2746
  });
2620
2747
  }).addCase(layerChangeDimension$1, function (draft, action) {
2621
- var _action$payload31 = action.payload,
2622
- layerId = _action$payload31.layerId,
2623
- dimension = _action$payload31.dimension;
2748
+ var _action$payload27 = action.payload,
2749
+ layerId = _action$payload27.layerId,
2750
+ dimension = _action$payload27.dimension;
2624
2751
  produceDraftStateSetMapDimensionFromLayerChangeDimension(draft, layerId, dimension);
2625
2752
  }).addCase(setTimeSync, function (draft, action) {
2626
- var _action$payload32 = action.payload,
2627
- targetsFromAction = _action$payload32.targets,
2628
- source = _action$payload32.source;
2753
+ var _action$payload28 = action.payload,
2754
+ targetsFromAction = _action$payload28.targets,
2755
+ source = _action$payload28.source;
2629
2756
  /* Because we want backwards compatibility with the previous code, we also need to listen to the original source action */
2630
2757
 
2631
2758
  var targets = [{
@@ -2649,9 +2776,9 @@ var slice$3 = createSlice({
2649
2776
  }
2650
2777
  });
2651
2778
  }).addCase(setBboxSync, function (draft, action) {
2652
- var _action$payload33 = action.payload,
2653
- targetsFromAction = _action$payload33.targets,
2654
- source = _action$payload33.source;
2779
+ var _action$payload29 = action.payload,
2780
+ targetsFromAction = _action$payload29.targets,
2781
+ source = _action$payload29.source;
2655
2782
  /* Because we want backwards compatibility with the previous code, we also need to listen to the original source action */
2656
2783
 
2657
2784
  var targets = [{
@@ -2682,9 +2809,9 @@ var slice$3 = createSlice({
2682
2809
  * These targets can be used as payloads in new Layer actions.
2683
2810
  * These actions are here handled via the layer reducer, as it is the same logic
2684
2811
  */
2685
- var _action$payload34 = action.payload,
2686
- targets = _action$payload34.targets,
2687
- source = _action$payload34.source;
2812
+ var _action$payload30 = action.payload,
2813
+ targets = _action$payload30.targets,
2814
+ source = _action$payload30.source;
2688
2815
  return targets.reduce(function (prevState, target) {
2689
2816
  var action = {
2690
2817
  payload: target,
@@ -2700,9 +2827,9 @@ var slice$3 = createSlice({
2700
2827
  var mapAction = mapActions$1.mapUpdateAllMapDimensions(mapDimensions);
2701
2828
  return reducer$3(draft, mapAction);
2702
2829
  }).addCase(mapChangeDimension, function (draft, action) {
2703
- var _action$payload35 = action.payload,
2704
- mapId = _action$payload35.mapId,
2705
- dimensionFromAction = _action$payload35.dimension;
2830
+ var _action$payload31 = action.payload,
2831
+ mapId = _action$payload31.mapId,
2832
+ dimensionFromAction = _action$payload31.dimension;
2706
2833
  produceDraftStateSetWebMapDimension(draft, mapId, dimensionFromAction, true);
2707
2834
  }).addCase(setMapPreset, function (draft, action) {
2708
2835
  var mapId = action.payload.mapId;
@@ -2715,19 +2842,18 @@ var slice$3 = createSlice({
2715
2842
  draft.byId[mapId].baseLayers = [];
2716
2843
  draft.byId[mapId].mapLayers = [];
2717
2844
  draft.byId[mapId].overLayers = [];
2718
- draft.byId[mapId].hasMapPresetChanges = false;
2719
2845
  draft.byId[mapId].isAutoUpdating = false;
2720
2846
  draft.byId[mapId].isAnimating = false;
2721
2847
  draft.byId[mapId].isTimeSliderVisible = true;
2722
2848
  draft.byId[mapId].isTimestepAuto = true;
2723
2849
  draft.byId[mapId].displayMapPin = false;
2724
2850
  draft.byId[mapId].shouldShowZoomControls = true;
2725
- draft.byId[mapId].timeStep = defaultTimeStep;
2851
+ draft.byId[mapId].timeStep = undefined;
2726
2852
  draft.byId[mapId].animationDelay = defaultAnimationDelayAtStart;
2727
2853
  }).addCase(uiActions.registerDialog, function (draft, action) {
2728
- var _action$payload36 = action.payload,
2729
- mapId = _action$payload36.mapId,
2730
- type = _action$payload36.type;
2854
+ var _action$payload32 = action.payload,
2855
+ mapId = _action$payload32.mapId,
2856
+ type = _action$payload32.type;
2731
2857
 
2732
2858
  if (!draft.byId[mapId]) {
2733
2859
  return;
@@ -2839,7 +2965,7 @@ var getLayersByMapId = createSelector(getAllLayers, function (_store, _mapId) {
2839
2965
  * @returns {array} returnType: array - an array of all non-baselayers containing layer information (service, name, style, enabled etc.)
2840
2966
  */
2841
2967
 
2842
- createSelector(getAllLayers, function (layers) {
2968
+ var getLayers = createSelector(getAllLayers, function (layers) {
2843
2969
  return layers.filter(function (layer) {
2844
2970
  return layer.layerType !== LayerType.baseLayer && layer.layerType !== LayerType.overLayer;
2845
2971
  });
@@ -2852,7 +2978,7 @@ createSelector(getAllLayers, function (layers) {
2852
2978
  * @returns {array} returnType: array - an array of all baselayers containing layer information (service, name, style, enabled etc.)
2853
2979
  */
2854
2980
 
2855
- createSelector(getAllLayers, function (layers) {
2981
+ var getBaseLayers = createSelector(getAllLayers, function (layers) {
2856
2982
  return layers.filter(function (layer) {
2857
2983
  return layer.layerType === LayerType.baseLayer;
2858
2984
  });
@@ -2865,7 +2991,7 @@ createSelector(getAllLayers, function (layers) {
2865
2991
  * @returns {array} returnType: array - an array of all overLayers containing layer information (service, name, style, enabled etc.)
2866
2992
  */
2867
2993
 
2868
- createSelector(getAllLayers, function (layers) {
2994
+ var getOverLayers = createSelector(getAllLayers, function (layers) {
2869
2995
  return layers.filter(function (layer) {
2870
2996
  return layer.layerType === LayerType.overLayer;
2871
2997
  });
@@ -2994,7 +3120,7 @@ var getLayerStyle = createSelector(getLayerById, function (layer) {
2994
3120
  * @returns {string} returnType: LayerStatus
2995
3121
  */
2996
3122
 
2997
- createSelector(getLayerById, function (layer) {
3123
+ var getLayerStatus = createSelector(getLayerById, function (layer) {
2998
3124
  return layer && layer.status ? layer.status : LayerStatus["default"];
2999
3125
  });
3000
3126
  /**
@@ -3022,23 +3148,85 @@ var getAvailableBaseLayersForMap = createSelector(layerStore, function (_store,
3022
3148
 
3023
3149
  return [];
3024
3150
  }, selectorMemoizationOptions);
3025
-
3026
- /* *
3027
- * Licensed under the Apache License, Version 2.0 (the "License");
3028
- * you may not use this file except in compliance with the License.
3029
- * You may obtain a copy of the License at
3030
- *
3031
- * http://www.apache.org/licenses/LICENSE-2.0
3151
+ /**
3152
+ * Returns the selected geojson feature for the given layer
3032
3153
  *
3033
- * Unless required by applicable law or agreed to in writing, software
3034
- * distributed under the License is distributed on an "AS IS" BASIS,
3035
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
3036
- * See the License for the specific language governing permissions and
3037
- * limitations under the License.
3154
+ * Example const selectedFeature = getSelectedFeature(store, 'layerId1')
3155
+ * @param {object} store store: object - store object
3156
+ * @param {string} mapId layerId: string - Id of the layer
3157
+ * @returns {number} selectedFeatureIndex: the index of the selected geojson feature
3158
+ */
3159
+
3160
+ var getSelectedFeatureIndex = createSelector(getLayerById, function (layer) {
3161
+ return layer === null || layer === void 0 ? void 0 : layer.selectedFeatureIndex;
3162
+ });
3163
+ /**
3164
+ * Gets layerIds that contain passed dimension
3038
3165
  *
3039
- * Copyright 2021 - Koninklijk Nederlands Meteorologisch Instituut (KNMI)
3040
- * Copyright 2021 - Finnish Meteorological Institute (FMI)
3041
- * */
3166
+ * Example: dimension = getDimensionLayerIds(store, 'elevation')
3167
+ * @param {object} store store: object - object from which the layers state will be extracted
3168
+ * @param {string} dimensionName dimensionName: string - name of dimension you want to retrieve the dimension data for
3169
+ * @returns {string[]} returnType: string[] - layerIds
3170
+ */
3171
+
3172
+ var getDimensionLayerIds = createSelector(getLayersIds, getLayersById, function (_store, dimensionName) {
3173
+ return dimensionName;
3174
+ }, function (layerIds, layers, dimensionName) {
3175
+ return layerIds.reduce(function (list, layerId) {
3176
+ var layer = layers[layerId];
3177
+ var dimensions = (layer === null || layer === void 0 ? void 0 : layer.dimensions) ? layer.dimensions : [];
3178
+
3179
+ if (dimensions.find(function (dimension) {
3180
+ return dimension.name === dimensionName;
3181
+ })) {
3182
+ return list.concat(layerId);
3183
+ }
3184
+
3185
+ return list;
3186
+ }, []);
3187
+ }, selectorMemoizationOptions);
3188
+
3189
+ var selectors$2 = /*#__PURE__*/Object.freeze({
3190
+ __proto__: null,
3191
+ getLayerById: getLayerById,
3192
+ getLayersById: getLayersById,
3193
+ getLayersIds: getLayersIds,
3194
+ getAllLayers: getAllLayers,
3195
+ getLayersByMapId: getLayersByMapId,
3196
+ getLayers: getLayers,
3197
+ getBaseLayers: getBaseLayers,
3198
+ getOverLayers: getOverLayers,
3199
+ getLayerDimensions: getLayerDimensions,
3200
+ getLayerNonTimeDimensions: getLayerNonTimeDimensions,
3201
+ getLayerTimeDimension: getLayerTimeDimension,
3202
+ getLayerDimension: getLayerDimension,
3203
+ getLayerOpacity: getLayerOpacity,
3204
+ getLayerEnabled: getLayerEnabled,
3205
+ getLayerName: getLayerName,
3206
+ getLayerService: getLayerService,
3207
+ getLayerStyle: getLayerStyle,
3208
+ getLayerStatus: getLayerStatus,
3209
+ getAvailableBaseLayersForMap: getAvailableBaseLayersForMap,
3210
+ getSelectedFeatureIndex: getSelectedFeatureIndex,
3211
+ getDimensionLayerIds: getDimensionLayerIds
3212
+ });
3213
+
3214
+ /* *
3215
+ * Licensed under the Apache License, Version 2.0 (the "License");
3216
+ * you may not use this file except in compliance with the License.
3217
+ * You may obtain a copy of the License at
3218
+ *
3219
+ * http://www.apache.org/licenses/LICENSE-2.0
3220
+ *
3221
+ * Unless required by applicable law or agreed to in writing, software
3222
+ * distributed under the License is distributed on an "AS IS" BASIS,
3223
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
3224
+ * See the License for the specific language governing permissions and
3225
+ * limitations under the License.
3226
+ *
3227
+ * Copyright 2021 - Koninklijk Nederlands Meteorologisch Instituut (KNMI)
3228
+ * Copyright 2021 - Finnish Meteorological Institute (FMI)
3229
+ * */
3042
3230
  var getUiStore = function getUiStore(store) {
3043
3231
  if (store && store.ui) {
3044
3232
  return store.ui;
@@ -3957,7 +4145,12 @@ var getMapTimeSliderScale = createSelector(getMapById, function (store) {
3957
4145
  */
3958
4146
 
3959
4147
  var getMapTimeStep = createSelector(getMapById, function (store) {
3960
- return store ? store.timeStep : defaultTimeStep;
4148
+ var _a;
4149
+
4150
+ return (_a = store === null || store === void 0 ? void 0 : store.timeStep) !== null && _a !== void 0 ? _a : defaultTimeStep;
4151
+ });
4152
+ var getMapTimeStepWithoutDefault = createSelector(getMapById, function (store) {
4153
+ return store === null || store === void 0 ? void 0 : store.timeStep;
3961
4154
  });
3962
4155
  /**
3963
4156
  * Returns the speed of animation
@@ -4204,7 +4397,7 @@ var getDisableMapPin = createSelector(getMapById, function (store) {
4204
4397
  return store ? store.disableMapPin : false;
4205
4398
  });
4206
4399
  /**
4207
- * Returns the diplay map pin boolean for the current map
4400
+ * Returns the display map pin boolean for the current map
4208
4401
  *
4209
4402
  * Example getDisplayMapPin(store);
4210
4403
  * @param {object} store store: object - store object
@@ -4215,30 +4408,6 @@ var getDisableMapPin = createSelector(getMapById, function (store) {
4215
4408
  var getDisplayMapPin = createSelector(getMapById, function (store) {
4216
4409
  return store ? store.displayMapPin : false;
4217
4410
  });
4218
- /**
4219
- * Returns the selected geojson feature for the given map
4220
- *
4221
- * Example const selectedFeature = getSelectedFeature(store, 'mapId1')
4222
- * @param {object} store store: object - store object
4223
- * @param {string} mapId mapId: string - Id of the map
4224
- * @returns {number} selectedFeatureIndex: the index of the selected geojson feature
4225
- */
4226
-
4227
- var getSelectedFeatureIndex = createSelector(getMapById, function (store) {
4228
- return store === null || store === void 0 ? void 0 : store.selectedFeatureIndex;
4229
- });
4230
- /**
4231
- * Returns the active map preset id
4232
- *
4233
- * Example getActiveMapPresetId(store, mapId);
4234
- * @param {object} store store: object - store object
4235
- * @param {string} mapId mapId: string - Id of the map
4236
- * @returns {boolean} returnType: boolean or undefined
4237
- */
4238
-
4239
- var getActiveMapPresetId = createSelector(getMapById, function (store) {
4240
- return store ? store.activeMapPresetId : undefined;
4241
- });
4242
4411
  /**
4243
4412
  * Returns the legend id
4244
4413
  *
@@ -4303,31 +4472,40 @@ var getMapPreset = createSelector(getMapLayers, getMapBaseLayers, getMapOverLaye
4303
4472
  });
4304
4473
  }, selectorMemoizationOptions);
4305
4474
  /**
4306
- * Returns the has changes state of the map preset
4475
+ * Gets all enabled layerIds for map
4307
4476
  *
4308
- * Example getHasMapPresetChanges(store, mapId);
4309
- * @param {object} store store: object - store object
4477
+ * Example: getMapLayerIdsEnabled = getLayerIdsEnabled(store, 'mapId_1')
4478
+ * @param {object} store store: object - store
4310
4479
  * @param {string} mapId mapId: string - Id of the map
4311
- * @returns {boolean} returnType: boolean
4480
+ * @returns {string[]} returnType: string[] - array of enabled layerIds
4312
4481
  */
4313
4482
 
4314
- var getHasMapPresetChanges = createSelector(getMapById, function (store) {
4315
- return store && store.hasMapPresetChanges ? store.hasMapPresetChanges : false;
4316
- });
4483
+ var getMapLayerIdsEnabled = createSelector(getLayerIds, getLayersById, function (mapLayerIds, layers) {
4484
+ return mapLayerIds.reduce(function (list, layerId) {
4485
+ if (layers[layerId] && layers[layerId].enabled) {
4486
+ return list.concat(layerId);
4487
+ }
4488
+
4489
+ return list;
4490
+ }, []);
4491
+ }, selectorMemoizationOptions);
4317
4492
  /**
4318
- * Returns whether the docked layer manager is open
4493
+ * Returns if a map dimension is used for any enabled layers on that map
4319
4494
  *
4320
- * Example getIsDockedLayerManagerOpen(store, mapId);
4495
+ * Example getIsEnabledLayersForMapDimension(store, mapId);
4321
4496
  * @param {object} store store: object - store object
4322
4497
  * @param {string} mapId mapId: string - Id of the map
4498
+ * @param {string} dimensionName dimensionName: string - name of the dimension
4323
4499
  * @returns {Boolean} returnType: boolean
4324
4500
  */
4325
4501
 
4326
- var getIsDockedLayerManagerOpen = createSelector(getMapById, function (store) {
4327
- var _a;
4328
-
4329
- return (_a = store === null || store === void 0 ? void 0 : store.dockedLayerManager) === null || _a === void 0 ? void 0 : _a.isOpen;
4330
- });
4502
+ var getIsEnabledLayersForMapDimension = createSelector(getMapLayerIdsEnabled, function (store, _mapId, dimensionName) {
4503
+ return getDimensionLayerIds(store, dimensionName);
4504
+ }, function (enabledMapLayerIds, dimensionLayerIds) {
4505
+ return dimensionLayerIds.some(function (layerId) {
4506
+ return enabledMapLayerIds.includes(layerId);
4507
+ });
4508
+ }, selectorMemoizationOptions);
4331
4509
 
4332
4510
  var selectors = /*#__PURE__*/Object.freeze({
4333
4511
  __proto__: null,
@@ -4354,6 +4532,7 @@ var selectors = /*#__PURE__*/Object.freeze({
4354
4532
  getActiveLayerId: getActiveLayerId,
4355
4533
  getMapTimeSliderScale: getMapTimeSliderScale,
4356
4534
  getMapTimeStep: getMapTimeStep,
4535
+ getMapTimeStepWithoutDefault: getMapTimeStepWithoutDefault,
4357
4536
  getMapAnimationDelay: getMapAnimationDelay,
4358
4537
  getMapTimeSliderCenterTime: getMapTimeSliderCenterTime,
4359
4538
  getTimeSliderUnfilteredSelectedTime: getTimeSliderUnfilteredSelectedTime,
@@ -4372,12 +4551,10 @@ var selectors = /*#__PURE__*/Object.freeze({
4372
4551
  getPinLocation: getPinLocation,
4373
4552
  getDisableMapPin: getDisableMapPin,
4374
4553
  getDisplayMapPin: getDisplayMapPin,
4375
- getSelectedFeatureIndex: getSelectedFeatureIndex,
4376
- getActiveMapPresetId: getActiveMapPresetId,
4377
4554
  getLegendId: getLegendId,
4378
4555
  getMapPreset: getMapPreset,
4379
- getHasMapPresetChanges: getHasMapPresetChanges,
4380
- getIsDockedLayerManagerOpen: getIsDockedLayerManagerOpen
4556
+ getMapLayerIdsEnabled: getMapLayerIdsEnabled,
4557
+ getIsEnabledLayersForMapDimension: getIsEnabledLayersForMapDimension
4381
4558
  });
4382
4559
 
4383
4560
  var DialogTypes;
@@ -4392,6 +4569,7 @@ var DialogTypes;
4392
4569
  DialogTypes["DimensionSelectElevation"] = "dimensionSelect-elevation";
4393
4570
  DialogTypes["LayerManager"] = "layerManager";
4394
4571
  DialogTypes["LayerSelect"] = "layerSelect";
4572
+ DialogTypes["DockedLayerManager"] = "dockedLayerManager";
4395
4573
  })(DialogTypes || (DialogTypes = {}));
4396
4574
 
4397
4575
  var types = /*#__PURE__*/Object.freeze({
@@ -4422,17 +4600,54 @@ var FilterType;
4422
4600
  FilterType["Group"] = "groups";
4423
4601
  })(FilterType || (FilterType = {}));
4424
4602
 
4603
+ /* *
4604
+ * Licensed under the Apache License, Version 2.0 (the "License");
4605
+ * you may not use this file except in compliance with the License.
4606
+ * You may obtain a copy of the License at
4607
+ *
4608
+ * http://www.apache.org/licenses/LICENSE-2.0
4609
+ *
4610
+ * Unless required by applicable law or agreed to in writing, software
4611
+ * distributed under the License is distributed on an "AS IS" BASIS,
4612
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
4613
+ * See the License for the specific language governing permissions and
4614
+ * limitations under the License.
4615
+ *
4616
+ * Copyright 2022 - Koninklijk Nederlands Meteorologisch Instituut (KNMI)
4617
+ * Copyright 2022 - Finnish Meteorological Institute (FMI)
4618
+ * */
4619
+ var getFilterId = function getFilterId(filterType, filterName) {
4620
+ return "".concat(filterType, "-").concat(filterName);
4621
+ };
4622
+ var produceFilters = function produceFilters(filterNames, filterType, draft, layerSelectFilterAdapter) {
4623
+ filterNames.forEach(function (filterName) {
4624
+ var id = getFilterId(filterType, filterName);
4625
+
4626
+ if (!draft.filters.filters.entities[id]) {
4627
+ // If this filter doesn't exit yet, add it
4628
+ layerSelectFilterAdapter.addOne(draft.filters.filters, {
4629
+ id: id,
4630
+ name: filterName,
4631
+ amount: 1,
4632
+ amountVisible: 1,
4633
+ checked: true,
4634
+ type: filterType
4635
+ });
4636
+ } else {
4637
+ // If it exists already, up the amounts
4638
+ draft.filters.filters.entities[id].amount += 1;
4639
+ draft.filters.filters.entities[id].amountVisible += 1;
4640
+ }
4641
+ });
4642
+ };
4643
+
4644
+ var layerSelectFilterAdapter = createEntityAdapter();
4645
+ var layerSelectActiveServicesAdapter = createEntityAdapter();
4425
4646
  var initialState$1 = {
4426
4647
  filters: {
4427
4648
  searchFilter: '',
4428
- activeServices: {
4429
- byId: {},
4430
- allIds: []
4431
- },
4432
- filters: {
4433
- byId: {},
4434
- allIds: []
4435
- }
4649
+ activeServices: layerSelectActiveServicesAdapter.getInitialState(),
4650
+ filters: layerSelectFilterAdapter.getInitialState()
4436
4651
  },
4437
4652
  allServicesEnabled: true,
4438
4653
  activeLayerInfo: {
@@ -4456,6 +4671,8 @@ var slice$1 = createSlice({
4456
4671
  draft.allServicesEnabled = allServicesEnabled;
4457
4672
  },
4458
4673
  addFiltersAndActiveServices: function addFiltersAndActiveServices(draft, action) {
4674
+ var _a, _b;
4675
+
4459
4676
  var _action$payload = action.payload,
4460
4677
  serviceId = _action$payload.serviceId,
4461
4678
  serviceName = _action$payload.serviceName,
@@ -4463,59 +4680,59 @@ var slice$1 = createSlice({
4463
4680
  _abstract = _action$payload["abstract"],
4464
4681
  keywords = _action$payload.keywords,
4465
4682
  scope = _action$payload.scope,
4466
- groups = _action$payload.groups;
4467
-
4468
- if (!draft.filters.activeServices.byId[serviceId]) {
4469
- draft.filters.activeServices.byId[serviceId] = {};
4470
-
4471
- var addFilters = function addFilters(filterNames, filterType) {
4472
- filterNames.forEach(function (filterName) {
4473
- var id = "".concat(filterType, "-").concat(filterName);
4474
-
4475
- if (!draft.filters.filters.byId[id]) {
4476
- draft.filters.filters.byId[id] = {
4477
- id: id,
4478
- name: filterName,
4479
- amount: 1,
4480
- amountVisible: 1,
4481
- checked: true,
4482
- type: filterType
4483
- };
4484
- draft.filters.filters.allIds.push(id);
4485
- } else {
4486
- draft.filters.filters.byId[id].amount += 1;
4487
- draft.filters.filters.byId[id].amountVisible += 1;
4488
- }
4489
- });
4683
+ groups = _action$payload.groups,
4684
+ isLoading = _action$payload.isLoading;
4685
+
4686
+ if (isLoading) {
4687
+ // If service is still loading, add without filters
4688
+ draft.filters.activeServices.entities[serviceId] = {
4689
+ serviceId: serviceId,
4690
+ enabled: draft.allServicesEnabled,
4691
+ filterIds: [],
4692
+ scope: scope,
4693
+ serviceName: serviceName,
4694
+ serviceUrl: serviceUrl,
4695
+ "abstract": _abstract,
4696
+ isLoading: isLoading
4490
4697
  };
4698
+ }
4699
+
4700
+ if (!isLoading) {
4701
+ // If service is done loading, add with filters
4702
+ if (!((_b = (_a = draft.filters.activeServices.entities[serviceId]) === null || _a === void 0 ? void 0 : _a.filterIds) === null || _b === void 0 ? void 0 : _b.length)) {
4703
+ // If the service has no filters yet, add them
4704
+ produceFilters(groups, FilterType.Group, draft, layerSelectFilterAdapter);
4705
+ produceFilters(keywords, FilterType.Keyword, draft, layerSelectFilterAdapter);
4706
+ }
4491
4707
 
4492
- addFilters(groups, FilterType.Group);
4493
- addFilters(keywords, FilterType.Keyword);
4708
+ var filterIds = groups.map(function (group) {
4709
+ return getFilterId(FilterType.Group, group);
4710
+ }).concat(keywords.map(function (keyword) {
4711
+ return getFilterId(FilterType.Keyword, keyword);
4712
+ }));
4713
+ draft.filters.activeServices.entities[serviceId] = {
4714
+ serviceId: serviceId,
4715
+ enabled: draft.allServicesEnabled,
4716
+ filterIds: filterIds,
4717
+ scope: scope,
4718
+ serviceName: serviceName,
4719
+ serviceUrl: serviceUrl,
4720
+ "abstract": _abstract,
4721
+ isLoading: isLoading
4722
+ };
4494
4723
  }
4495
4724
 
4496
- var filterIds = groups.map(function (group) {
4497
- return "".concat(FilterType.Group, "-").concat(group);
4498
- }).concat(keywords.map(function (keyword) {
4499
- return "".concat(FilterType.Keyword, "-").concat(keyword);
4500
- }));
4501
- draft.filters.activeServices.byId[serviceId] = {
4502
- serviceId: serviceId,
4503
- enabled: draft.allServicesEnabled,
4504
- filterIds: filterIds,
4505
- scope: scope,
4506
- serviceName: serviceName,
4507
- serviceUrl: serviceUrl,
4508
- "abstract": _abstract
4509
- };
4510
- if (!draft.filters.activeServices.allIds.includes(serviceId)) draft.filters.activeServices.allIds.push(serviceId);
4725
+ if (!draft.filters.activeServices.ids.includes(serviceId)) {
4726
+ draft.filters.activeServices.ids.push(serviceId);
4727
+ }
4511
4728
  },
4512
4729
  layerSelectRemoveService: function layerSelectRemoveService(draft, action) {
4513
4730
  var serviceId = action.payload.serviceId; // 1. Find a service that is to be removed
4514
4731
 
4515
- var foundService = draft.filters.activeServices.byId[serviceId]; // 2. Go through all keywords for removed service, and decrement the amount of all found keywords
4732
+ var foundService = draft.filters.activeServices.entities[serviceId]; // 2. Go through all keywords for removed service, and decrement the amount of all found keywords
4516
4733
 
4517
4734
  foundService.filterIds.forEach(function (filterId) {
4518
- var foundObject = draft.filters.filters.byId[filterId];
4735
+ var foundObject = draft.filters.filters.entities[filterId];
4519
4736
 
4520
4737
  if (foundObject && foundObject.amount) {
4521
4738
  foundObject.amount -= 1;
@@ -4523,23 +4740,20 @@ var slice$1 = createSlice({
4523
4740
  }
4524
4741
 
4525
4742
  if (foundObject && foundObject.amount === 0) {
4526
- delete draft.filters.filters.byId[filterId];
4527
- draft.filters.filters.allIds = draft.filters.filters.allIds.filter(function (serviceId) {
4743
+ delete draft.filters.filters.entities[filterId];
4744
+ draft.filters.filters.ids = draft.filters.filters.ids.filter(function (serviceId) {
4528
4745
  return serviceId !== filterId;
4529
4746
  });
4530
4747
  }
4531
4748
  }); // Finally remove object from activeServices, so if the service is added again later on, new object and keywords will be re-added
4532
4749
 
4533
- delete draft.filters.activeServices.byId[serviceId];
4534
- draft.filters.activeServices.allIds = draft.filters.activeServices.allIds.filter(function (id) {
4535
- return id !== serviceId;
4536
- });
4750
+ layerSelectActiveServicesAdapter.removeOne(draft.filters.activeServices, serviceId);
4537
4751
  },
4538
4752
  enableActiveService: function enableActiveService(draft, action) {
4539
4753
  var _action$payload2 = action.payload,
4540
4754
  serviceId = _action$payload2.serviceId,
4541
4755
  keywords = _action$payload2.filters;
4542
- draft.filters.activeServices.byId[serviceId].enabled = true;
4756
+ draft.filters.activeServices.entities[serviceId].enabled = true;
4543
4757
 
4544
4758
  var _iterator = _createForOfIteratorHelper(keywords),
4545
4759
  _step;
@@ -4547,7 +4761,7 @@ var slice$1 = createSlice({
4547
4761
  try {
4548
4762
  for (_iterator.s(); !(_step = _iterator.n()).done;) {
4549
4763
  var keyword = _step.value;
4550
- draft.filters.filters.byId[keyword].amountVisible += 1;
4764
+ draft.filters.filters.entities[keyword].amountVisible += 1;
4551
4765
  }
4552
4766
  } catch (err) {
4553
4767
  _iterator.e(err);
@@ -4559,7 +4773,7 @@ var slice$1 = createSlice({
4559
4773
  var _action$payload3 = action.payload,
4560
4774
  serviceId = _action$payload3.serviceId,
4561
4775
  keywords = _action$payload3.filters;
4562
- draft.filters.activeServices.byId[serviceId].enabled = false;
4776
+ draft.filters.activeServices.entities[serviceId].enabled = false;
4563
4777
 
4564
4778
  var _iterator2 = _createForOfIteratorHelper(keywords),
4565
4779
  _step2;
@@ -4567,7 +4781,7 @@ var slice$1 = createSlice({
4567
4781
  try {
4568
4782
  for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {
4569
4783
  var keyword = _step2.value;
4570
- draft.filters.filters.byId[keyword].amountVisible -= 1;
4784
+ draft.filters.filters.entities[keyword].amountVisible -= 1;
4571
4785
  }
4572
4786
  } catch (err) {
4573
4787
  _iterator2.e(err);
@@ -4578,15 +4792,15 @@ var slice$1 = createSlice({
4578
4792
  toggleFilter: function toggleFilter(draft, action) {
4579
4793
  var filterIds = action.payload.filterIds;
4580
4794
  filterIds.forEach(function (filterId) {
4581
- draft.filters.filters.byId[filterId].checked = !draft.filters.filters.byId[filterId].checked;
4795
+ draft.filters.filters.entities[filterId].checked = !draft.filters.filters.entities[filterId].checked;
4582
4796
  });
4583
4797
  },
4584
4798
  enableOnlyOneFilter: function enableOnlyOneFilter(draft, action) {
4585
4799
  var filterId = action.payload.filterId;
4586
- draft.filters.filters.allIds.forEach(function (filterId) {
4587
- draft.filters.filters.byId[filterId].checked = false;
4800
+ draft.filters.filters.ids.forEach(function (filterId) {
4801
+ draft.filters.filters.entities[filterId].checked = false;
4588
4802
  });
4589
- draft.filters.filters.byId[filterId].checked = true;
4803
+ draft.filters.filters.entities[filterId].checked = true;
4590
4804
  },
4591
4805
  setActiveLayerInfo: function setActiveLayerInfo(draft, action) {
4592
4806
  var layer = action.payload.layer;
@@ -4682,21 +4896,32 @@ var layerSelectStore = function layerSelectStore(store) {
4682
4896
 
4683
4897
 
4684
4898
  var getSearchFilter = createSelector(layerSelectStore, function (store) {
4685
- return store ? store.filters.searchFilter : '';
4899
+ var _a;
4900
+
4901
+ return ((_a = store === null || store === void 0 ? void 0 : store.filters) === null || _a === void 0 ? void 0 : _a.searchFilter) || '';
4686
4902
  });
4687
4903
  /**
4688
4904
  * Returns active services array
4689
4905
  *
4690
4906
  * Example getActiveServices(store);
4691
4907
  * @param {object} store store: object - store object
4692
- * @returns {object} returnType: object of active services
4908
+ * @returns {ActiveServiceObjectEntities} returnType: ActiveServiceObjectEntitiesobject of active services
4693
4909
  */
4910
+ // cast to usable type - selectEntities returns Dictionary<ActiveServiceObject> which is not usable inside of the code
4694
4911
 
4695
- var getActiveServices = createSelector(layerSelectStore, function (store) {
4696
- var _a;
4912
+ var getActiveServices = function getActiveServices(store) {
4913
+ return getActiveServicesDictionary(store);
4914
+ };
4697
4915
 
4698
- return store ? (_a = store === null || store === void 0 ? void 0 : store.filters) === null || _a === void 0 ? void 0 : _a.activeServices.byId : {};
4699
- }, selectorMemoizationOptions);
4916
+ var _layerSelectActiveSer = layerSelectActiveServicesAdapter.getSelectors(function (store) {
4917
+ var _a, _b;
4918
+
4919
+ return ((_b = (_a = store === null || store === void 0 ? void 0 : store.layerSelect) === null || _a === void 0 ? void 0 : _a.filters) === null || _b === void 0 ? void 0 : _b.activeServices) || {
4920
+ entities: {},
4921
+ ids: []
4922
+ };
4923
+ }),
4924
+ getActiveServicesDictionary = _layerSelectActiveSer.selectEntities;
4700
4925
  /**
4701
4926
  * Returns active services by id
4702
4927
  *
@@ -4706,10 +4931,11 @@ var getActiveServices = createSelector(layerSelectStore, function (store) {
4706
4931
  * @returns {object} returnType: object of active service
4707
4932
  */
4708
4933
 
4934
+
4709
4935
  var getActiveServiceById = function getActiveServiceById(store, serviceId) {
4710
- var _a, _b;
4936
+ var _a, _b, _c;
4711
4937
 
4712
- var enabledServices = ((_b = (_a = store === null || store === void 0 ? void 0 : store.layerSelect) === null || _a === void 0 ? void 0 : _a.filters) === null || _b === void 0 ? void 0 : _b.activeServices.byId[serviceId]) || {};
4938
+ var enabledServices = ((_c = (_b = (_a = store === null || store === void 0 ? void 0 : store.layerSelect) === null || _a === void 0 ? void 0 : _a.filters) === null || _b === void 0 ? void 0 : _b.activeServices) === null || _c === void 0 ? void 0 : _c.entities[serviceId]) || {};
4713
4939
  return enabledServices;
4714
4940
  };
4715
4941
  /**
@@ -4723,10 +4949,10 @@ var getActiveServiceById = function getActiveServiceById(store, serviceId) {
4723
4949
  var getEnabledServiceIds = createSelector(layerSelectStore, function (store) {
4724
4950
  var _a, _b;
4725
4951
 
4726
- var enabledServices = (_b = (_a = store === null || store === void 0 ? void 0 : store.filters) === null || _a === void 0 ? void 0 : _a.activeServices.allIds.filter(function (serviceId) {
4727
- var _a;
4952
+ var enabledServices = (_b = (_a = store === null || store === void 0 ? void 0 : store.filters) === null || _a === void 0 ? void 0 : _a.activeServices.ids.filter(function (serviceId) {
4953
+ var _a, _b, _c;
4728
4954
 
4729
- return (_a = store === null || store === void 0 ? void 0 : store.filters) === null || _a === void 0 ? void 0 : _a.activeServices.byId[serviceId].enabled;
4955
+ return (_c = (_b = (_a = store === null || store === void 0 ? void 0 : store.filters) === null || _a === void 0 ? void 0 : _a.activeServices) === null || _b === void 0 ? void 0 : _b.entities[serviceId]) === null || _c === void 0 ? void 0 : _c.enabled;
4730
4956
  })) !== null && _b !== void 0 ? _b : [];
4731
4957
  return enabledServices;
4732
4958
  }, selectorMemoizationOptions);
@@ -4739,17 +4965,17 @@ var getEnabledServiceIds = createSelector(layerSelectStore, function (store) {
4739
4965
  */
4740
4966
 
4741
4967
  var getCheckedFilterIds = createSelector(layerSelectStore, function (store) {
4742
- var _a, _b;
4968
+ var _a, _b, _c;
4743
4969
 
4744
- var checkedFilters = (_b = (_a = store === null || store === void 0 ? void 0 : store.filters) === null || _a === void 0 ? void 0 : _a.filters.allIds.filter(function (filterId) {
4745
- var _a, _b;
4970
+ var checkedFilters = (_c = (_b = (_a = store === null || store === void 0 ? void 0 : store.filters) === null || _a === void 0 ? void 0 : _a.filters) === null || _b === void 0 ? void 0 : _b.ids.filter(function (filterId) {
4971
+ var _a, _b, _c;
4746
4972
 
4747
- return (_b = (_a = store === null || store === void 0 ? void 0 : store.filters) === null || _a === void 0 ? void 0 : _a.filters.byId[filterId]) === null || _b === void 0 ? void 0 : _b.checked;
4748
- })) !== null && _b !== void 0 ? _b : [];
4973
+ return (_c = (_b = (_a = store === null || store === void 0 ? void 0 : store.filters) === null || _a === void 0 ? void 0 : _a.filters) === null || _b === void 0 ? void 0 : _b.entities[filterId]) === null || _c === void 0 ? void 0 : _c.checked;
4974
+ })) !== null && _c !== void 0 ? _c : [];
4749
4975
  return checkedFilters.map(function (filterId) {
4750
- var _a;
4976
+ var _a, _b, _c;
4751
4977
 
4752
- return (_a = store === null || store === void 0 ? void 0 : store.filters) === null || _a === void 0 ? void 0 : _a.filters.byId[filterId].id;
4978
+ return (_c = (_b = (_a = store === null || store === void 0 ? void 0 : store.filters) === null || _a === void 0 ? void 0 : _a.filters) === null || _b === void 0 ? void 0 : _b.entities[filterId]) === null || _c === void 0 ? void 0 : _c.id;
4753
4979
  });
4754
4980
  }, selectorMemoizationOptions);
4755
4981
  /**
@@ -4759,12 +4985,21 @@ var getCheckedFilterIds = createSelector(layerSelectStore, function (store) {
4759
4985
  * @param {object} store store: object - store object
4760
4986
  * @returns {array} returnType: array of all keyword ids
4761
4987
  */
4988
+ // cast to usable type - selectIds returns EntityId[] which is not usable inside of the code
4989
+
4990
+ var getAllFilterIds = function getAllFilterIds(store) {
4991
+ return getAllFilterIdsEntity(store);
4992
+ };
4762
4993
 
4763
- var getAllFilterIds = createSelector(layerSelectStore, function (store) {
4994
+ var _layerSelectFilterAda = layerSelectFilterAdapter.getSelectors(function (store) {
4764
4995
  var _a, _b;
4765
4996
 
4766
- return (_b = (_a = store === null || store === void 0 ? void 0 : store.filters) === null || _a === void 0 ? void 0 : _a.filters.allIds) !== null && _b !== void 0 ? _b : [];
4767
- }, selectorMemoizationOptions);
4997
+ return ((_b = (_a = store === null || store === void 0 ? void 0 : store.layerSelect) === null || _a === void 0 ? void 0 : _a.filters) === null || _b === void 0 ? void 0 : _b.filters) || {
4998
+ entities: {},
4999
+ ids: []
5000
+ };
5001
+ }),
5002
+ getAllFilterIdsEntity = _layerSelectFilterAda.selectIds;
4768
5003
  /**
4769
5004
  * Returns all filters
4770
5005
  *
@@ -4773,40 +5008,43 @@ var getAllFilterIds = createSelector(layerSelectStore, function (store) {
4773
5008
  * @returns {array} returnType: array of all filters
4774
5009
  */
4775
5010
 
4776
- var getAllFilters = createSelector(layerSelectStore, function (store) {
4777
- var filters = store === null || store === void 0 ? void 0 : store.filters.filters.byId;
4778
5011
 
4779
- if (filters) {
4780
- return Object.values(filters);
4781
- }
4782
-
4783
- return [];
4784
- });
4785
- /**
4786
- * Returns if all keywords are checked
4787
- *
4788
- * Example isAllKeywordsChecked(store);
4789
- * @param {object} store store: object - store object
4790
- * @returns {array} returnType: boolean if all keywords are checked
4791
- */
5012
+ var _layerSelectFilterAda2 = layerSelectFilterAdapter.getSelectors(function (store) {
5013
+ var _a, _b;
4792
5014
 
5015
+ return ((_b = (_a = store === null || store === void 0 ? void 0 : store.layerSelect) === null || _a === void 0 ? void 0 : _a.filters) === null || _b === void 0 ? void 0 : _b.filters) || {
5016
+ entities: {},
5017
+ ids: []
5018
+ };
5019
+ }),
5020
+ getAllFilters = _layerSelectFilterAda2.selectAll;
4793
5021
  var isAllFiltersChecked = createSelector(layerSelectStore, function (store) {
4794
5022
  var _a, _b;
4795
5023
 
4796
- return (_b = (_a = store === null || store === void 0 ? void 0 : store.filters) === null || _a === void 0 ? void 0 : _a.filters) === null || _b === void 0 ? void 0 : _b.allIds.every(function (filterId) {
5024
+ return (_b = (_a = store === null || store === void 0 ? void 0 : store.filters) === null || _a === void 0 ? void 0 : _a.filters) === null || _b === void 0 ? void 0 : _b.ids.every(function (filterId) {
4797
5025
  var _a, _b, _c;
4798
5026
 
4799
- return (_c = (_b = (_a = store === null || store === void 0 ? void 0 : store.filters) === null || _a === void 0 ? void 0 : _a.filters) === null || _b === void 0 ? void 0 : _b.byId[filterId]) === null || _c === void 0 ? void 0 : _c.checked;
5027
+ return (_c = (_b = (_a = store === null || store === void 0 ? void 0 : store.filters) === null || _a === void 0 ? void 0 : _a.filters) === null || _b === void 0 ? void 0 : _b.entities[filterId]) === null || _c === void 0 ? void 0 : _c.checked;
4800
5028
  });
4801
5029
  });
4802
5030
  /**
4803
- * Returns the active layer info
5031
+ * Gets a KeywordObject by its id
4804
5032
  *
4805
- * Example getActiveLayerInfo(store);
4806
- * @param {object} store store: object - store object
4807
- * @returns {object} returnType: ActiveLayerObject
5033
+ * Example: keywordObject = getKeywordObjectById(store, 'keywordId')
5034
+ * @param {object} store object from which the keyword state will be extracted
5035
+ * @param {string} filterId Id of the keyword
5036
+ * @returns {object} object containing keyword information (id, amount, amountVisible, checked)
4808
5037
  */
4809
5038
 
5039
+ var _layerSelectFilterAda3 = layerSelectFilterAdapter.getSelectors(function (store) {
5040
+ var _a, _b;
5041
+
5042
+ return ((_b = (_a = store === null || store === void 0 ? void 0 : store.layerSelect) === null || _a === void 0 ? void 0 : _a.filters) === null || _b === void 0 ? void 0 : _b.filters) || {
5043
+ entities: {},
5044
+ ids: []
5045
+ };
5046
+ });
5047
+ _layerSelectFilterAda3.selectById;
4810
5048
  var getActiveLayerInfo = createSelector(layerSelectStore, function (store) {
4811
5049
  return store === null || store === void 0 ? void 0 : store.activeLayerInfo;
4812
5050
  });
@@ -7620,9 +7858,8 @@ var _marked$2 = /*#__PURE__*/regeneratorRuntime.mark(startAnimationSaga),
7620
7858
  _marked6 = /*#__PURE__*/regeneratorRuntime.mark(toggleAutoUpdateSaga),
7621
7859
  _marked7 = /*#__PURE__*/regeneratorRuntime.mark(handleBaseLayersSaga),
7622
7860
  _marked8 = /*#__PURE__*/regeneratorRuntime.mark(setMapPresetSaga),
7623
- _marked9 = /*#__PURE__*/regeneratorRuntime.mark(checkMapPresetForChangesSaga),
7624
- _marked10 = /*#__PURE__*/regeneratorRuntime.mark(unregisterMapSaga),
7625
- _marked11 = /*#__PURE__*/regeneratorRuntime.mark(rootSaga$2);
7861
+ _marked9 = /*#__PURE__*/regeneratorRuntime.mark(unregisterMapSaga),
7862
+ _marked10 = /*#__PURE__*/regeneratorRuntime.mark(rootSaga$2);
7626
7863
 
7627
7864
  var generateTimeList = function generateTimeList(start, end, interval) {
7628
7865
  var timeList = [];
@@ -7791,7 +8028,7 @@ function updateAnimation(mapId, maxValue) {
7791
8028
  }, _marked4$1);
7792
8029
  }
7793
8030
  function setLayerDimensionsSaga(_ref4) {
7794
- var payload, layerDimensions, dimensions, layerId, layer, newTimeDimension, mapId, activeLayerId, shouldAutoUpdate, prevTimeDimension, isAnimating$1, webmapInstance;
8031
+ var payload, layerDimensions, dimensions, layerId, layer, newTimeDimension, mapId, activeLayerId, shouldAutoUpdate, prevTimeDimension, isAnimating$1, webmapInstance, isActiveLayer, timeStep, newTimeStep;
7795
8032
  return regeneratorRuntime.wrap(function setLayerDimensionsSaga$(_context5) {
7796
8033
  while (1) {
7797
8034
  switch (_context5.prev = _context5.next) {
@@ -7848,19 +8085,44 @@ function setLayerDimensionsSaga(_ref4) {
7848
8085
  case 24:
7849
8086
  isAnimating$1 = _context5.sent;
7850
8087
  webmapInstance = getWMJSMapById(mapId);
8088
+ isActiveLayer = layerId === activeLayerId;
8089
+ _context5.next = 29;
8090
+ return select(getMapTimeStepWithoutDefault, mapId);
7851
8091
 
7852
- if (!(layerId === activeLayerId && // only update the active layer
8092
+ case 29:
8093
+ timeStep = _context5.sent;
8094
+
8095
+ if (!(isActiveLayer && timeStep === undefined && newTimeDimension)) {
8096
+ _context5.next = 35;
8097
+ break;
8098
+ }
8099
+
8100
+ newTimeStep = getActiveLayerTimeStep(newTimeDimension);
8101
+
8102
+ if (!newTimeStep) {
8103
+ _context5.next = 35;
8104
+ break;
8105
+ }
8106
+
8107
+ _context5.next = 35;
8108
+ return put(mapActions$1.setTimeStep({
8109
+ mapId: mapId,
8110
+ timeStep: newTimeStep
8111
+ }));
8112
+
8113
+ case 35:
8114
+ if (!(isActiveLayer && // only update the active layer
7853
8115
  shouldAutoUpdate && newTimeDimension && newTimeDimension.maxValue && prevTimeDimension && prevTimeDimension.currentValue && prevTimeDimension.currentValue !== newTimeDimension.maxValue)) {
7854
- _context5.next = 34;
8116
+ _context5.next = 43;
7855
8117
  break;
7856
8118
  }
7857
8119
 
7858
8120
  if (isAnimating$1) {
7859
- _context5.next = 30;
8121
+ _context5.next = 39;
7860
8122
  break;
7861
8123
  }
7862
8124
 
7863
- _context5.next = 30;
8125
+ _context5.next = 39;
7864
8126
  return put(layerActions.layerChangeDimension({
7865
8127
  layerId: layerId,
7866
8128
  origin: LayerActionOrigin.setLayerDimensionSaga,
@@ -7870,39 +8132,39 @@ function setLayerDimensionsSaga(_ref4) {
7870
8132
  }
7871
8133
  }));
7872
8134
 
7873
- case 30:
7874
- _context5.next = 32;
8135
+ case 39:
8136
+ _context5.next = 41;
7875
8137
  return call(updateAnimation, mapId, newTimeDimension.maxValue);
7876
8138
 
7877
- case 32:
7878
- _context5.next = 37;
8139
+ case 41:
8140
+ _context5.next = 46;
7879
8141
  break;
7880
8142
 
7881
- case 34:
8143
+ case 43:
7882
8144
  if (!(isAnimating$1 && !webmapInstance.isAnimating && newTimeDimension && newTimeDimension.maxValue)) {
7883
- _context5.next = 37;
8145
+ _context5.next = 46;
7884
8146
  break;
7885
8147
  }
7886
8148
 
7887
- _context5.next = 37;
8149
+ _context5.next = 46;
7888
8150
  return call(updateAnimation, mapId, newTimeDimension.maxValue);
7889
8151
 
7890
- case 37:
7891
- _context5.next = 42;
8152
+ case 46:
8153
+ _context5.next = 51;
7892
8154
  break;
7893
8155
 
7894
- case 39:
7895
- _context5.prev = 39;
8156
+ case 48:
8157
+ _context5.prev = 48;
7896
8158
  _context5.t0 = _context5["catch"](1);
7897
8159
  // eslint-disable-next-line no-console
7898
8160
  console.warn(_context5.t0);
7899
8161
 
7900
- case 42:
8162
+ case 51:
7901
8163
  case "end":
7902
8164
  return _context5.stop();
7903
8165
  }
7904
8166
  }
7905
- }, _marked5, null, [[1, 39]]);
8167
+ }, _marked5, null, [[1, 48]]);
7906
8168
  }
7907
8169
  function toggleAutoUpdateSaga(_ref5) {
7908
8170
  var payload, shouldAutoUpdate, mapId, layerId, timeDimension;
@@ -8248,70 +8510,20 @@ function setMapPresetSaga(_ref6) {
8248
8510
  }
8249
8511
  }, _marked8, null, [[1, 66]]);
8250
8512
  }
8251
- var mapPresetChangeActions = [layerActions.setBaseLayers.type, layerActions.layerDelete.type, layerActions.addLayer.type, layerActions.layerChangeEnabled.type, layerActions.layerChangeName.type, layerActions.layerChangeStyle.type, layerActions.layerChangeOpacity.type, layerActions.layerChangeDimension.type, mapActions$1.layerMoveLayer.type, mapActions$1.setActiveLayerId.type, mapActions$1.toggleAutoUpdate, mapActions$1.mapStartAnimation, mapActions$1.mapStopAnimation, mapActions$1.toggleTimeSliderIsVisible, mapActions$1.setTimeStep, mapActions$1.setAnimationDelay, mapActions$1.toggleTimestepAuto, uiActions.setActiveMapIdForDialog, uiActions.setToggleOpenDialog, genericActions.setBbox.type];
8252
- var supportedChangeOrigins = [LayerActionOrigin.layerManager, LayerActionOrigin.wmsLoader, MapActionOrigin.map];
8253
- function checkMapPresetForChangesSaga(action) {
8254
- var _action$payload, mapId, origin, isChangeOriginSupported, hasMapPresetChanges;
8255
-
8256
- return regeneratorRuntime.wrap(function checkMapPresetForChangesSaga$(_context9) {
8257
- while (1) {
8258
- switch (_context9.prev = _context9.next) {
8259
- case 0:
8260
- _action$payload = action.payload, mapId = _action$payload.mapId, origin = _action$payload.origin;
8261
-
8262
- if (origin) {
8263
- _context9.next = 3;
8264
- break;
8265
- }
8266
-
8267
- return _context9.abrupt("return");
8268
-
8269
- case 3:
8270
- isChangeOriginSupported = supportedChangeOrigins.indexOf(origin) >= 0;
8271
-
8272
- if (!isChangeOriginSupported) {
8273
- _context9.next = 11;
8274
- break;
8275
- }
8276
-
8277
- _context9.next = 7;
8278
- return select(getHasMapPresetChanges, mapId);
8279
-
8280
- case 7:
8281
- hasMapPresetChanges = _context9.sent;
8282
-
8283
- if (hasMapPresetChanges) {
8284
- _context9.next = 11;
8285
- break;
8286
- }
8287
-
8288
- _context9.next = 11;
8289
- return put(mapActions$1.setHasMapPresetChanges({
8290
- mapId: mapId,
8291
- hasChanges: true
8292
- }));
8293
-
8294
- case 11:
8295
- case "end":
8296
- return _context9.stop();
8297
- }
8298
- }
8299
- }, _marked9);
8300
- }
8301
8513
  function unregisterMapSaga(_ref7) {
8302
8514
  var payload, mapId, layerList;
8303
- return regeneratorRuntime.wrap(function unregisterMapSaga$(_context10) {
8515
+ return regeneratorRuntime.wrap(function unregisterMapSaga$(_context9) {
8304
8516
  while (1) {
8305
- switch (_context10.prev = _context10.next) {
8517
+ switch (_context9.prev = _context9.next) {
8306
8518
  case 0:
8307
8519
  payload = _ref7.payload;
8308
8520
  mapId = payload.mapId;
8309
- _context10.next = 4;
8521
+ _context9.next = 4;
8310
8522
  return select(getLayersByMapId, mapId);
8311
8523
 
8312
8524
  case 4:
8313
- layerList = _context10.sent;
8314
- _context10.next = 7;
8525
+ layerList = _context9.sent;
8526
+ _context9.next = 7;
8315
8527
  return all(layerList.map(function (layer) {
8316
8528
  return put(layerActions.layerDelete({
8317
8529
  mapId: mapId,
@@ -8323,55 +8535,49 @@ function unregisterMapSaga(_ref7) {
8323
8535
 
8324
8536
  case 7:
8325
8537
  case "end":
8326
- return _context10.stop();
8538
+ return _context9.stop();
8327
8539
  }
8328
8540
  }
8329
- }, _marked10);
8541
+ }, _marked9);
8330
8542
  }
8331
8543
  function rootSaga$2() {
8332
- return regeneratorRuntime.wrap(function rootSaga$(_context11) {
8544
+ return regeneratorRuntime.wrap(function rootSaga$(_context10) {
8333
8545
  while (1) {
8334
- switch (_context11.prev = _context11.next) {
8546
+ switch (_context10.prev = _context10.next) {
8335
8547
  case 0:
8336
- _context11.next = 2;
8337
- return all([takeLatest(mapActions$1.mapStopAnimation.type, stopAnimationSaga), takeLatest(mapActions$1.setActiveMapPresetId.type, stopAnimationSaga)]);
8548
+ _context10.next = 2;
8549
+ return takeLatest(mapActions$1.mapStopAnimation.type, stopAnimationSaga);
8338
8550
 
8339
8551
  case 2:
8340
- _context11.next = 4;
8552
+ _context10.next = 4;
8341
8553
  return takeLatest(mapActions$1.mapStartAnimation.type, startAnimationSaga);
8342
8554
 
8343
8555
  case 4:
8344
- _context11.next = 6;
8556
+ _context10.next = 6;
8345
8557
  return takeLatest(layerActions.layerDelete.type, deleteLayerSaga);
8346
8558
 
8347
8559
  case 6:
8348
- _context11.next = 8;
8560
+ _context10.next = 8;
8349
8561
  return takeLatest(layerActions.onUpdateLayerInformation.type, setLayerDimensionsSaga);
8350
8562
 
8351
8563
  case 8:
8352
- _context11.next = 10;
8564
+ _context10.next = 10;
8353
8565
  return takeLatest(mapActions$1.toggleAutoUpdate.type, toggleAutoUpdateSaga);
8354
8566
 
8355
8567
  case 10:
8356
- _context11.next = 12;
8568
+ _context10.next = 12;
8357
8569
  return takeEvery(mapActions$1.setMapPreset.type, setMapPresetSaga);
8358
8570
 
8359
8571
  case 12:
8360
- _context11.next = 14;
8361
- return all(mapPresetChangeActions.map(function (action) {
8362
- return takeEvery(action, checkMapPresetForChangesSaga);
8363
- }));
8364
-
8365
- case 14:
8366
- _context11.next = 16;
8572
+ _context10.next = 14;
8367
8573
  return takeEvery(mapActions$1.unregisterMap.type, unregisterMapSaga);
8368
8574
 
8369
- case 16:
8575
+ case 14:
8370
8576
  case "end":
8371
- return _context11.stop();
8577
+ return _context10.stop();
8372
8578
  }
8373
8579
  }
8374
- }, _marked11);
8580
+ }, _marked10);
8375
8581
  }
8376
8582
 
8377
8583
  var moduleConfig = {
@@ -8483,7 +8689,8 @@ function newServiceAddedSaga(capturedAction) {
8483
8689
  keywords: keywords,
8484
8690
  scope: scope,
8485
8691
  groups: groups,
8486
- "abstract": _abstract
8692
+ "abstract": _abstract,
8693
+ isLoading: false
8487
8694
  }));
8488
8695
 
8489
8696
  case 8:
@@ -8608,7 +8815,7 @@ function layerSelectRemoveServiceSaga(capturedAction) {
8608
8815
  results = _context3.sent;
8609
8816
  services = results;
8610
8817
  servicesEnabled = Object.values(services).find(function (service) {
8611
- return service.enabled;
8818
+ return service === null || service === void 0 ? void 0 : service.enabled;
8612
8819
  });
8613
8820
 
8614
8821
  if (!(servicesEnabled === undefined)) {
@@ -8624,7 +8831,7 @@ function layerSelectRemoveServiceSaga(capturedAction) {
8624
8831
 
8625
8832
  return put(layerSelectActions.enableActiveService({
8626
8833
  serviceId: serviceId,
8627
- filters: service.filterIds
8834
+ filters: service === null || service === void 0 ? void 0 : service.filterIds
8628
8835
  }));
8629
8836
  }));
8630
8837
 
@@ -11914,7 +12121,6 @@ var LayerManager = function LayerManager(_ref) {
11914
12121
  }));
11915
12122
  }
11916
12123
  }),
11917
- hasElevation: !isDockedLayerManager,
11918
12124
  className: "layermanager",
11919
12125
  sx: layerManagerStyle,
11920
12126
  onResizeStop: function onResizeStop(_event, _direction, node) {
@@ -11985,6 +12191,7 @@ var LayerManager = function LayerManager(_ref) {
11985
12191
  * Copyright 2022 - Finnish Meteorological Institute (FMI)
11986
12192
  * */
11987
12193
  var useSetupDialog = function useSetupDialog(dialogType) {
12194
+ var source = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'app';
11988
12195
  var dispatch = useDispatch();
11989
12196
  var onCloseDialog = useCallback(function () {
11990
12197
  dispatch(uiActions.setToggleOpenDialog({
@@ -12007,9 +12214,10 @@ var useSetupDialog = function useSetupDialog(dialogType) {
12007
12214
  var registerDialog = useCallback(function () {
12008
12215
  dispatch(uiActions.registerDialog({
12009
12216
  type: dialogType,
12010
- setOpen: false
12217
+ setOpen: false,
12218
+ source: source
12011
12219
  }));
12012
- }, [dialogType, dispatch]);
12220
+ }, [dialogType, dispatch, source]);
12013
12221
  var unregisterDialog = useCallback(function () {
12014
12222
  dispatch(uiActions.unregisterDialog({
12015
12223
  type: dialogType
@@ -12071,18 +12279,36 @@ var useFetchServices = function useFetchServices(dialogType) {
12071
12279
  var serviceSetLayers = React.useCallback(function (payload) {
12072
12280
  dispatch(serviceActions.serviceSetLayers(payload));
12073
12281
  }, [dispatch]);
12282
+ var addFiltersAndActiveServices = React.useCallback(function (payload) {
12283
+ dispatch(layerSelectActions.addFiltersAndActiveServices(payload));
12284
+ }, [dispatch]);
12074
12285
  React.useEffect(function () {
12075
12286
  if (isOpenInStore && preloadedServices && preloadedServices.length > 0) {
12076
12287
  mergePresetsAndUserAddedServices(preloadedServices, getUserAddedServices()).forEach(function (service) {
12288
+ var wmService = WMGetServiceFromStore(service.url);
12289
+ var scope = service.scope ? service.scope : 'system';
12290
+
12291
+ if (isMounted.current) {
12292
+ addFiltersAndActiveServices({
12293
+ serviceId: wmService.id,
12294
+ serviceName: service.name,
12295
+ serviceUrl: service.url,
12296
+ keywords: [],
12297
+ scope: scope,
12298
+ groups: [],
12299
+ "abstract": service["abstract"] || wmService["abstract"],
12300
+ isLoading: true
12301
+ });
12302
+ }
12303
+
12077
12304
  getLayersFlattenedFromService(service.url).then(function (layers) {
12078
12305
  if (isMounted.current) {
12079
- var wmService = WMGetServiceFromStore(service.url);
12080
12306
  serviceSetLayers({
12081
12307
  id: wmService.id,
12082
12308
  name: service.name,
12083
12309
  serviceUrl: service.url,
12084
12310
  layers: layers,
12085
- scope: service.scope ? service.scope : 'system',
12311
+ scope: scope,
12086
12312
  // first try to load the user abstract, otherwise the service abstract
12087
12313
  "abstract": service["abstract"] || wmService["abstract"]
12088
12314
  });
@@ -12091,9 +12317,8 @@ var useFetchServices = function useFetchServices(dialogType) {
12091
12317
  return null;
12092
12318
  });
12093
12319
  });
12094
- } // eslint-disable-next-line react-hooks/exhaustive-deps
12095
-
12096
- }, [isOpenInStore, preloadedServices, serviceSetLayers]);
12320
+ }
12321
+ }, [addFiltersAndActiveServices, isMounted, isOpenInStore, preloadedServices, serviceSetLayers]);
12097
12322
  };
12098
12323
  var mergePresetsAndUserAddedServices = function mergePresetsAndUserAddedServices(presets, userAddedServices) {
12099
12324
  return Object.values(Object.assign(Object.assign({}, presets.reduce(function (byUrl, preset) {
@@ -12158,9 +12383,9 @@ var LayerManagerConnect = function LayerManagerConnect(_ref) {
12158
12383
  var onToggleDock = function onToggleDock() {
12159
12384
  // Close the floating layer manager and open docked layer manager
12160
12385
  onCloseDialog();
12161
- dispatch(mapActions$1.toggleDockedLayerManager({
12162
- mapId: mapId,
12163
- openDockedLayerManager: true
12386
+ dispatch(uiActions.setToggleOpenDialog({
12387
+ type: "".concat(DialogTypes.DockedLayerManager, "-").concat(mapId),
12388
+ setOpen: true
12164
12389
  }));
12165
12390
  };
12166
12391
 
@@ -12214,7 +12439,9 @@ var DockedLayerManagerConnect = function DockedLayerManagerConnect(_ref) {
12214
12439
  _ref$showTitle = _ref.showTitle,
12215
12440
  showTitle = _ref$showTitle === void 0 ? false : _ref$showTitle,
12216
12441
  _ref$leftHeaderCompon = _ref.leftHeaderComponent,
12217
- leftHeaderComponent = _ref$leftHeaderCompon === void 0 ? undefined : _ref$leftHeaderCompon;
12442
+ leftHeaderComponent = _ref$leftHeaderCompon === void 0 ? undefined : _ref$leftHeaderCompon,
12443
+ _ref$source = _ref.source,
12444
+ source = _ref$source === void 0 ? 'app' : _ref$source;
12218
12445
  var dispatch = useDispatch(); // TODO: Uncomment when adding the presets: https://gitlab.com/opengeoweb/opengeoweb/-/issues/2881
12219
12446
  // const isMapPresetLoading = useSelector((store: AppStore) =>
12220
12447
  // mapSelectors.getIsMapPresetLoading(store, mapId),
@@ -12223,26 +12450,22 @@ var DockedLayerManagerConnect = function DockedLayerManagerConnect(_ref) {
12223
12450
  // mapSelectors.getMapPresetError(store, mapId),
12224
12451
  // );
12225
12452
 
12226
- var isDockedLayerManagerOpen = useSelector(function (store) {
12227
- return getIsDockedLayerManagerOpen(store, mapId);
12228
- });
12453
+ var dialogType = "".concat(DialogTypes.DockedLayerManager, "-").concat(mapId);
12229
12454
 
12230
- var onClose = function onClose() {
12231
- // Open docked layer manager and close the floating layer manager
12232
- dispatch(mapActions$1.toggleDockedLayerManager({
12233
- mapId: mapId,
12234
- openDockedLayerManager: false
12235
- }));
12236
- };
12455
+ var _useSetupDialog = useSetupDialog(dialogType, source),
12456
+ dialogOrder = _useSetupDialog.dialogOrder,
12457
+ isDialogOpen = _useSetupDialog.isDialogOpen,
12458
+ setDialogOrder = _useSetupDialog.setDialogOrder,
12459
+ onCloseDialog = _useSetupDialog.onCloseDialog;
12237
12460
 
12238
12461
  var onToggleDock = function onToggleDock() {
12239
12462
  // Close docked layer manager and open the floating layer manager
12240
- onClose();
12463
+ onCloseDialog();
12241
12464
  dispatch(uiActions.setActiveMapIdForDialog({
12242
12465
  type: DialogTypes.LayerManager,
12243
12466
  mapId: mapId,
12244
12467
  setOpen: true,
12245
- source: 'app'
12468
+ source: source
12246
12469
  }));
12247
12470
  };
12248
12471
 
@@ -12251,8 +12474,8 @@ var DockedLayerManagerConnect = function DockedLayerManagerConnect(_ref) {
12251
12474
  preloadedAvailableBaseLayers: preloadedAvailableBaseLayers,
12252
12475
  preloadedBaseServices: preloadedBaseServices,
12253
12476
  bounds: bounds,
12254
- isOpen: isDockedLayerManagerOpen,
12255
- onClose: onClose,
12477
+ isOpen: isDialogOpen,
12478
+ onClose: onCloseDialog,
12256
12479
  showTitle: showTitle,
12257
12480
  leftHeaderComponent: leftHeaderComponent,
12258
12481
  // isLoading={isMapPresetLoading}
@@ -12263,7 +12486,10 @@ var DockedLayerManagerConnect = function DockedLayerManagerConnect(_ref) {
12263
12486
  startPosition: {
12264
12487
  top: 60,
12265
12488
  right: 16
12266
- }
12489
+ },
12490
+ onMouseDown: setDialogOrder,
12491
+ order: dialogOrder,
12492
+ source: source
12267
12493
  });
12268
12494
  };
12269
12495
 
@@ -12395,7 +12621,9 @@ var validateServiceName = function validateServiceName(value, services) {
12395
12621
  var ownServiceName = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : '';
12396
12622
  var serviceName = value === null || value === void 0 ? void 0 : value.toLowerCase();
12397
12623
  var foundName = Object.keys(services).find(function (serviceId) {
12398
- return services[serviceId].serviceName.toLowerCase() === serviceName && serviceName !== ownServiceName.toLocaleLowerCase();
12624
+ var _a;
12625
+
12626
+ return ((_a = services[serviceId]) === null || _a === void 0 ? void 0 : _a.serviceName.toLowerCase()) === serviceName && serviceName !== ownServiceName.toLocaleLowerCase();
12399
12627
  });
12400
12628
  return foundName === undefined ? true : VALIDATIONS_NAME_EXISTING;
12401
12629
  };
@@ -12425,7 +12653,9 @@ var validateServiceUrl = function validateServiceUrl(value, services) {
12425
12653
 
12426
12654
 
12427
12655
  var foundUrl = Object.keys(services).find(function (serviceId) {
12428
- return services[serviceId].serviceUrl === serviceUrl;
12656
+ var _a;
12657
+
12658
+ return ((_a = services[serviceId]) === null || _a === void 0 ? void 0 : _a.serviceUrl) === serviceUrl;
12429
12659
  });
12430
12660
 
12431
12661
  if (foundUrl) {
@@ -13630,7 +13860,7 @@ var sortByService = function sortByService(serviceObj) {
13630
13860
  var _ref4 = _slicedToArray(_ref2, 2),
13631
13861
  b = _ref4[1];
13632
13862
 
13633
- return a.serviceName.localeCompare(b.serviceName);
13863
+ return a.serviceName.localeCompare(b === null || b === void 0 ? void 0 : b.serviceName);
13634
13864
  }).reduce(function (r, _ref5) {
13635
13865
  var _ref6 = _slicedToArray(_ref5, 2),
13636
13866
  key = _ref6[0],
@@ -13953,7 +14183,7 @@ var ServiceChip = function ServiceChip(_ref) {
13953
14183
  var chip = all ? 'all' : service && service.serviceUrl;
13954
14184
  return /*#__PURE__*/React.createElement(CustomTooltip, {
13955
14185
  title: (service === null || service === void 0 ? void 0 : service["abstract"]) ? "Abstract: ".concat(service["abstract"]) : ''
13956
- }, /*#__PURE__*/React.createElement(CustomToggleButton, {
14186
+ }, /*#__PURE__*/React.createElement("span", null, /*#__PURE__*/React.createElement(CustomToggleButton, {
13957
14187
  variant: "boxed",
13958
14188
  selected: isSelected,
13959
14189
  tabIndex: 0,
@@ -13966,7 +14196,7 @@ var ServiceChip = function ServiceChip(_ref) {
13966
14196
  },
13967
14197
  disabled: isDisabled,
13968
14198
  sx: style
13969
- }, service ? service.serviceName : 'All'));
14199
+ }, service ? service.serviceName : 'All')));
13970
14200
  };
13971
14201
 
13972
14202
  var ServiceChipConnect = function ServiceChipConnect(_ref) {
@@ -14107,7 +14337,7 @@ var ServiceList = function ServiceList(_ref) {
14107
14337
  all: true,
14108
14338
  isSelected: isAllSelected
14109
14339
  }), Object.keys(activeServices).map(function (serviceId) {
14110
- var _a;
14340
+ var _a, _b;
14111
14341
 
14112
14342
  var service = activeServices[serviceId];
14113
14343
  return /*#__PURE__*/React.createElement(ServiceChipConnect, {
@@ -14116,7 +14346,7 @@ var ServiceList = function ServiceList(_ref) {
14116
14346
  service: service,
14117
14347
  isSelected: (_a = activeServices[serviceId]) === null || _a === void 0 ? void 0 : _a.enabled,
14118
14348
  isAllSelected: isAllSelected,
14119
- isDisabled: activeServices[serviceId] === undefined
14349
+ isDisabled: activeServices[serviceId] === undefined || ((_b = activeServices[serviceId]) === null || _b === void 0 ? void 0 : _b.isLoading) === true
14120
14350
  });
14121
14351
  })));
14122
14352
  };
@@ -14369,7 +14599,9 @@ var Rows = function Rows(_ref2) {
14369
14599
  var getService = function getService(services, serviceUrl) {
14370
14600
  var serviceIds = Object.keys(services);
14371
14601
  var serviceIndex = serviceIds.findIndex(function (serviceId) {
14372
- return services[serviceId].serviceUrl === serviceUrl;
14602
+ var _a;
14603
+
14604
+ return ((_a = services[serviceId]) === null || _a === void 0 ? void 0 : _a.serviceUrl) === serviceUrl;
14373
14605
  });
14374
14606
  if (serviceIndex < 0) return null;
14375
14607
  return services[serviceIds[serviceIndex]];
@@ -15200,7 +15432,8 @@ var MapControls = function MapControls(_a) {
15200
15432
  left: 0,
15201
15433
  margin: 1,
15202
15434
  zIndex: 50,
15203
- top: '96px'
15435
+ top: '96px',
15436
+ userSelect: 'none'
15204
15437
  }
15205
15438
  }, props), /*#__PURE__*/React.createElement(Grid, {
15206
15439
  sx: {
@@ -15584,8 +15817,8 @@ var DimensionSelectDialogConnect = function DimensionSelectDialogConnect(_ref) {
15584
15817
  _ref$source = _ref.source,
15585
15818
  source = _ref$source === void 0 ? 'app' : _ref$source;
15586
15819
  var dispatch = useDispatch();
15587
- var mapDimension = useSelector(function (store) {
15588
- return getMapDimension(store, mapId, dimensionName);
15820
+ var mapContainsDimension = useSelector(function (store) {
15821
+ return getIsEnabledLayersForMapDimension(store, mapId, dimensionName);
15589
15822
  });
15590
15823
  var layerIds = useSelector(function (store) {
15591
15824
  return getLayerIds(store, mapId);
@@ -15613,7 +15846,7 @@ var DimensionSelectDialogConnect = function DimensionSelectDialogConnect(_ref) {
15613
15846
  }));
15614
15847
  }, [dispatch]);
15615
15848
 
15616
- if (!mapDimension || !layerIds || layerIds.length < 1) {
15849
+ if (!mapContainsDimension || !layerIds || layerIds.length < 1) {
15617
15850
  return null;
15618
15851
  }
15619
15852
 
@@ -15733,6 +15966,10 @@ var DimensionSelectMapButtonConnect = function DimensionSelectMapButtonConnect(_
15733
15966
  });
15734
15967
  var isOpenInStore = useSelector(function (store) {
15735
15968
  return getisDialogOpen(store, uiDialogType);
15969
+ }); // Only show button if enabled layer for map contains dimension
15970
+
15971
+ var mapContainsDimension = useSelector(function (store) {
15972
+ return getIsEnabledLayersForMapDimension(store, mapId, dimension);
15736
15973
  });
15737
15974
  var openMultiDimensionDialog = React.useCallback(function () {
15738
15975
  var setOpen = currentActiveMapId !== mapId ? true : !isOpenInStore;
@@ -15743,6 +15980,11 @@ var DimensionSelectMapButtonConnect = function DimensionSelectMapButtonConnect(_
15743
15980
  source: source
15744
15981
  }));
15745
15982
  }, [currentActiveMapId, dispatch, isOpenInStore, uiDialogType, mapId, source]);
15983
+
15984
+ if (!mapContainsDimension) {
15985
+ return null;
15986
+ }
15987
+
15746
15988
  var isOpen = currentActiveMapId === mapId && isOpenInStore;
15747
15989
  return /*#__PURE__*/React.createElement(DimensionSelectButton, {
15748
15990
  dimension: dimension,
@@ -15886,7 +16128,8 @@ var TimeSliderMenu = function TimeSliderMenu(_ref) {
15886
16128
  title = _ref.title,
15887
16129
  icon = _ref.icon,
15888
16130
  _ref$onChangeMouseWhe = _ref.onChangeMouseWheel,
15889
- onChangeMouseWheel = _ref$onChangeMouseWhe === void 0 ? function () {} : _ref$onChangeMouseWhe;
16131
+ onChangeMouseWheel = _ref$onChangeMouseWhe === void 0 ? function () {} : _ref$onChangeMouseWhe,
16132
+ animationLength = _ref.animationLength;
15890
16133
  var currentMarkIndex = marks.findIndex(function (mark) {
15891
16134
  return mark.value === value;
15892
16135
  });
@@ -15978,7 +16221,22 @@ var TimeSliderMenu = function TimeSliderMenu(_ref) {
15978
16221
  },
15979
16222
  selected: isAutoSelected,
15980
16223
  disabled: isDisabled
15981
- }, "Auto")));
16224
+ }, "Auto"), animationLength && /*#__PURE__*/React.createElement(MenuItem, {
16225
+ disabled: true,
16226
+ sx: {
16227
+ fontSize: '12px',
16228
+ opacity: 0.67,
16229
+ padding: '0px 12px',
16230
+ '&.MuiMenuItem-root': {
16231
+ minHeight: '30px!important'
16232
+ }
16233
+ }
16234
+ }, "length"), animationLength && /*#__PURE__*/React.createElement(ToolButton, {
16235
+ "data-testid": "menu-animation-length-button",
16236
+ active: false,
16237
+ disableRipple: true,
16238
+ width: "100%"
16239
+ }, minutesToDescribedDuration(animationLength))));
15982
16240
  };
15983
16241
 
15984
16242
  var speedTooltipTitle = 'Speed';
@@ -16121,8 +16379,7 @@ var TimeStepButton = function TimeStepButton(_ref) {
16121
16379
  var timeStep = _ref.timeStep,
16122
16380
  _ref$disabled = _ref.disabled,
16123
16381
  disabled = _ref$disabled === void 0 ? false : _ref$disabled,
16124
- _ref$isTimestepAuto = _ref.isTimestepAuto,
16125
- isTimestepAuto = _ref$isTimestepAuto === void 0 ? false : _ref$isTimestepAuto,
16382
+ isTimestepAuto = _ref.isTimestepAuto,
16126
16383
  onChangeTimeStep = _ref.onChangeTimeStep,
16127
16384
  _ref$onToggleTimestep = _ref.onToggleTimestepAuto,
16128
16385
  onToggleTimestepAuto = _ref$onToggleTimestep === void 0 ? function () {} : _ref$onToggleTimestep,
@@ -16331,6 +16588,7 @@ var AnimationLengthButton = function AnimationLengthButton(_ref) {
16331
16588
  disabled = _ref$disabled === void 0 ? false : _ref$disabled,
16332
16589
  _ref$animationLength = _ref.animationLength,
16333
16590
  animationLength = _ref$animationLength === void 0 ? AnimationLength.Hours1 : _ref$animationLength,
16591
+ animationLengthInMinutes = _ref.animationLengthInMinutes,
16334
16592
  onChangeAnimationLength = _ref.onChangeAnimationLength;
16335
16593
 
16336
16594
  var onChangeSliderValue = function onChangeSliderValue(mark) {
@@ -16349,7 +16607,8 @@ var AnimationLengthButton = function AnimationLengthButton(_ref) {
16349
16607
  title: title,
16350
16608
  isDisabled: disabled,
16351
16609
  value: animationLength,
16352
- onChangeMouseWheel: onChangeSliderValue
16610
+ onChangeMouseWheel: onChangeSliderValue,
16611
+ animationLength: animationLengthInMinutes
16353
16612
  });
16354
16613
  };
16355
16614
 
@@ -16398,7 +16657,8 @@ var OptionsMenu = function OptionsMenu(_ref) {
16398
16657
  xs: "auto"
16399
16658
  }, timeStepBtn || /*#__PURE__*/React__default.createElement(TimeStepButton, {
16400
16659
  timeStep: 0,
16401
- onChangeTimeStep: function onChangeTimeStep() {}
16660
+ onChangeTimeStep: function onChangeTimeStep() {},
16661
+ isTimestepAuto: false
16402
16662
  })), /*#__PURE__*/React__default.createElement(Grid, {
16403
16663
  item: true,
16404
16664
  xs: "auto"
@@ -16419,12 +16679,7 @@ var OptionsMenuButton = function OptionsMenuButton(_ref) {
16419
16679
  timeScaleBtn = _ref.timeScaleBtn,
16420
16680
  animationLengthBtn = _ref.animationLengthBtn,
16421
16681
  _ref$isOpenByDefault = _ref.isOpenByDefault,
16422
- isOpenByDefault = _ref$isOpenByDefault === void 0 ? false : _ref$isOpenByDefault,
16423
- timeStep = _ref.timeStep,
16424
- timeDimension = _ref.timeDimension,
16425
- onChangeTimeStep = _ref.onChangeTimeStep,
16426
- _ref$isTimestepAuto = _ref.isTimestepAuto,
16427
- isTimestepAuto = _ref$isTimestepAuto === void 0 ? false : _ref$isTimestepAuto;
16682
+ isOpenByDefault = _ref$isOpenByDefault === void 0 ? false : _ref$isOpenByDefault;
16428
16683
 
16429
16684
  var _useState = useState(null),
16430
16685
  _useState2 = _slicedToArray(_useState, 2),
@@ -16441,12 +16696,6 @@ var OptionsMenuButton = function OptionsMenuButton(_ref) {
16441
16696
  setOpen(true);
16442
16697
  }
16443
16698
  }, [anchorEl, isOpenByDefault]);
16444
- var timeStepFromLayer = getActiveLayerTimeStep(timeDimension) || timeStep;
16445
- React__default.useEffect(function () {
16446
- if (isTimestepAuto) {
16447
- onChangeTimeStep(timeStepFromLayer);
16448
- }
16449
- }, [timeStepFromLayer, isTimestepAuto, onChangeTimeStep]);
16450
16699
  return /*#__PURE__*/React__default.createElement("div", null, /*#__PURE__*/React__default.createElement(CustomTooltip, {
16451
16700
  title: "Animation options",
16452
16701
  placement: "bottom"
@@ -17447,147 +17696,28 @@ var isLeftAnimationIconArea = function isLeftAnimationIconArea(x, leftMarkerPx,
17447
17696
  return x >= leftMarkerPx && x <= leftMarkerPx + width;
17448
17697
  };
17449
17698
 
17699
+ var TIME_SLIDER_LEGEND_HEIGHT = 24;
17450
17700
  var DRAG_AREA_WIDTH = 24;
17451
17701
 
17452
- var TimeSliderLegend = function TimeSliderLegend(_ref) {
17453
- var mapId = _ref.mapId,
17454
- centerTime = _ref.centerTime,
17455
- secondsPerPx = _ref.secondsPerPx,
17456
- _ref$dataScaleToSecon = _ref.dataScaleToSecondsPerPx,
17457
- dataScaleToSecondsPerPx = _ref$dataScaleToSecon === void 0 ? defaultDataScaleToSecondsPerPx : _ref$dataScaleToSecon,
17458
- selectedTime = _ref.selectedTime,
17459
- _ref$scale = _ref.scale,
17460
- scale = _ref$scale === void 0 ? Scale.Hour : _ref$scale,
17461
- currentTime = _ref.currentTime,
17462
- dataStartTime = _ref.dataStartTime,
17463
- dataEndTime = _ref.dataEndTime,
17464
- animationStartTime = _ref.animationStartTime,
17465
- animationEndTime = _ref.animationEndTime,
17466
- timeStep = _ref.timeStep,
17467
- _ref$mapIsActive = _ref.mapIsActive,
17468
- mapIsActive = _ref$mapIsActive === void 0 ? true : _ref$mapIsActive,
17469
- unfilteredSelectedTime = _ref.unfilteredSelectedTime,
17470
- setUnfilteredSelectedTime = _ref.setUnfilteredSelectedTime,
17471
- onSetNewDate = _ref.onSetNewDate,
17472
- onSetCenterTime = _ref.onSetCenterTime,
17473
- onSetAnimationStartTime = _ref.onSetAnimationStartTime,
17474
- onSetAnimationEndTime = _ref.onSetAnimationEndTime;
17475
-
17476
- var _useCanvasTarget = useCanvasTarget('mousedown'),
17477
- _useCanvasTarget2 = _slicedToArray(_useCanvasTarget, 2),
17478
- node = _useCanvasTarget2[1];
17479
-
17480
- var _React$useState = React.useState(0),
17702
+ function useAnimationTime(animationStartTime, animationEndTime, onSetAnimationStartTime, onSetAnimationEndTime, leftMarkerDragging, rightMarkerDragging, animationAreaDragging, centerTime, canvasWidth, secondsPerPx, dragTooltipPosition, pixelsToLeft, setTooltipTime, startDraggingPosition) {
17703
+ var _React$useState = React.useState(convertStringTimeToUnix(animationStartTime)),
17481
17704
  _React$useState2 = _slicedToArray(_React$useState, 2),
17482
- canvasWidth = _React$useState2[0],
17483
- setCanvasWidth = _React$useState2[1];
17705
+ localAnimationStartTime = _React$useState2[0],
17706
+ setLocalAnimationStartTime = _React$useState2[1];
17484
17707
 
17485
- var _React$useState3 = React.useState(false),
17708
+ var _React$useState3 = React.useState(convertStringTimeToUnix(animationEndTime)),
17486
17709
  _React$useState4 = _slicedToArray(_React$useState3, 2),
17487
- selectedTimeDragging = _React$useState4[0],
17488
- setSelectedTimeDragging = _React$useState4[1];
17489
-
17490
- var _React$useState5 = React.useState(false),
17491
- _React$useState6 = _slicedToArray(_React$useState5, 2),
17492
- leftMarkerDragging = _React$useState6[0],
17493
- setLeftMarkerDragging = _React$useState6[1];
17494
-
17495
- var _React$useState7 = React.useState(false),
17496
- _React$useState8 = _slicedToArray(_React$useState7, 2),
17497
- rightMarkerDragging = _React$useState8[0],
17498
- setRightMarkerDragging = _React$useState8[1];
17499
-
17500
- var _React$useState9 = React.useState(false),
17501
- _React$useState10 = _slicedToArray(_React$useState9, 2),
17502
- centerTimeDragging = _React$useState10[0],
17503
- setCenterTimeDragging = _React$useState10[1];
17504
-
17505
- var _React$useState11 = React.useState(false),
17506
- _React$useState12 = _slicedToArray(_React$useState11, 2),
17507
- dragTooltipOpen = _React$useState12[0],
17508
- setDragTooltipOpen = _React$useState12[1];
17509
-
17510
- var _React$useState13 = React.useState(false),
17511
- _React$useState14 = _slicedToArray(_React$useState13, 2),
17512
- mouseDownInLegend = _React$useState14[0],
17513
- setMouseDownInLegend = _React$useState14[1];
17514
-
17515
- var _React$useState15 = React.useState(animationStartTime && moment.utc(animationStartTime).unix()),
17516
- _React$useState16 = _slicedToArray(_React$useState15, 2),
17517
- localAnimationStartTime = _React$useState16[0],
17518
- setLocalAnimationStartTime = _React$useState16[1];
17519
-
17520
- var _React$useState17 = React.useState(animationEndTime && moment.utc(animationEndTime).unix()),
17521
- _React$useState18 = _slicedToArray(_React$useState17, 2),
17522
- localAnimationEndTime = _React$useState18[0],
17523
- setLocalAnimationEndTime = _React$useState18[1];
17524
-
17525
- var _React$useState19 = React.useState(moment.utc(0)),
17526
- _React$useState20 = _slicedToArray(_React$useState19, 2),
17527
- tooltipTime = _React$useState20[0],
17528
- setTooltipTime = _React$useState20[1];
17529
-
17530
- var _React$useState21 = React.useState(false),
17531
- _React$useState22 = _slicedToArray(_React$useState21, 2),
17532
- animationAreaDragging = _React$useState22[0],
17533
- setAnimationAreaDragging = _React$useState22[1];
17534
-
17535
- var animationDiff = React.useRef();
17536
- var isClickOrDrag = React.useRef();
17537
- var pixelsMovedSinceStartDragging = React.useRef(0);
17538
- var elem = document.querySelector(".timeSliderLegend_".concat(mapId));
17539
- var pixelsToLeft = elem === null || elem === void 0 ? void 0 : elem.getBoundingClientRect()['left'];
17540
- var pixelsToTop = elem === null || elem === void 0 ? void 0 : elem.getBoundingClientRect()['top'];
17541
-
17542
- var _React$useState23 = React.useState('auto'),
17543
- _React$useState24 = _slicedToArray(_React$useState23, 2),
17544
- cursorStyle = _React$useState24[0],
17545
- setCursorStyle = _React$useState24[1];
17710
+ localAnimationEndTime = _React$useState4[0],
17711
+ setLocalAnimationEndTime = _React$useState4[1];
17546
17712
 
17547
- var curTime = selectedTime !== undefined ? moment.unix(selectedTime).toISOString() : moment.utc().toISOString();
17548
17713
  React.useEffect(function () {
17549
- setLocalAnimationStartTime(animationStartTime && moment.utc(animationStartTime).unix());
17550
- setLocalAnimationEndTime(animationEndTime && moment.utc(animationEndTime).unix());
17714
+ setLocalAnimationStartTime(convertStringTimeToUnix(animationStartTime));
17715
+ setLocalAnimationEndTime(convertStringTimeToUnix(animationEndTime));
17551
17716
  }, [animationStartTime, animationEndTime]);
17552
- React.useEffect(function () {
17553
- var handleKeyDown = function handleKeyDown(event) {
17554
- if (event.key === 'Home' && mapIsActive) {
17555
- handleSetNowEvent(timeStep, dataStartTime, dataEndTime, currentTime, onSetNewDate, onSetCenterTime);
17556
- }
17557
-
17558
- if (event.ctrlKey && dataStartTime && dataEndTime && mapIsActive) {
17559
- switch (event.code) {
17560
- case 'ArrowLeft':
17561
- setPreviousTimeStep(timeStep, curTime, dataStartTime, onSetNewDate);
17562
- break;
17563
-
17564
- case 'ArrowRight':
17565
- setNextTimeStep(timeStep, curTime, dataEndTime, onSetNewDate);
17566
- break;
17567
- }
17568
- }
17569
- };
17570
-
17571
- document.addEventListener('keydown', handleKeyDown);
17572
- return function () {
17573
- document.removeEventListener('keydown', handleKeyDown);
17574
- };
17575
- }, [curTime, currentTime, dataEndTime, dataStartTime, mapIsActive, onSetCenterTime, onSetNewDate, timeStep]);
17576
- /**
17577
- * remove active drag. can happen outside canvas.
17578
- */
17579
-
17717
+ var animationDiff = React.useRef();
17718
+ var pixelsMovedSinceStartDragging = React.useRef(0);
17580
17719
  React.useEffect(function () {
17581
17720
  var handleMouseUp = function handleMouseUp() {
17582
- centerTimeDragging ? setCursorStyle('auto') : setCursorStyle('ew-resize');
17583
- setSelectedTimeDragging(false);
17584
- setLeftMarkerDragging(false);
17585
- setRightMarkerDragging(false);
17586
- setMouseDownInLegend(false);
17587
- setCenterTimeDragging(false);
17588
- setDragTooltipOpen(false);
17589
- setAnimationAreaDragging(false);
17590
- startDraggingPosition.current = 0;
17591
17721
  pixelsMovedSinceStartDragging.current = 0;
17592
17722
  animationDiff.current = undefined;
17593
17723
  };
@@ -17596,8 +17726,22 @@ var TimeSliderLegend = function TimeSliderLegend(_ref) {
17596
17726
  return function () {
17597
17727
  document.removeEventListener('mouseup', handleMouseUp);
17598
17728
  };
17599
- }, [centerTimeDragging]);
17600
- var onMouseTouchMoveActions = useCallback(function (x) {
17729
+ }, []);
17730
+ React.useEffect(function () {
17731
+ var stoppedDragging = !leftMarkerDragging && !rightMarkerDragging && !animationAreaDragging;
17732
+
17733
+ if (stoppedDragging) {
17734
+ if (localAnimationStartTime && localAnimationStartTime !== convertStringTimeToUnix(animationStartTime)) {
17735
+ onSetAnimationStartTime(moment.utc(localAnimationStartTime * 1000).format(dateFormat));
17736
+ }
17737
+
17738
+ if (localAnimationEndTime && localAnimationEndTime !== convertStringTimeToUnix(animationEndTime)) {
17739
+ onSetAnimationEndTime(moment.utc(localAnimationEndTime * 1000).format(dateFormat));
17740
+ }
17741
+ } // eslint-disable-next-line react-hooks/exhaustive-deps
17742
+
17743
+ }, [leftMarkerDragging, rightMarkerDragging, animationAreaDragging]);
17744
+ var handleAnimationDragging = useCallback(function (x) {
17601
17745
  if (!localAnimationStartTime || !localAnimationEndTime) return;
17602
17746
 
17603
17747
  var _map = [localAnimationStartTime, localAnimationEndTime].map(function (timestamp) {
@@ -17609,16 +17753,11 @@ var TimeSliderLegend = function TimeSliderLegend(_ref) {
17609
17753
 
17610
17754
  if (leftMarkerDragging) {
17611
17755
  var mousePosition = leftMarkerPx + x;
17612
- var rightAnimationPosition = rightMarkerPx - DRAG_AREA_WIDTH * 2; // update tooltip position while dragging
17613
- // Prevent dragging if it would cause markers to cross over, except if the markers
17614
- // are moved away from being crossed over
17615
-
17616
- if (mousePosition >= rightAnimationPosition || mousePosition <= 0) return; // set animation drag info dialog location
17756
+ var rightAnimationPosition = rightMarkerPx - DRAG_AREA_WIDTH * 2;
17757
+ if (mousePosition >= rightAnimationPosition || mousePosition <= 0) return; // eslint-disable-next-line no-param-reassign
17617
17758
 
17618
- dragTooltipPosition.current = pixelsToLeft ? mousePosition + pixelsToLeft : mousePosition; // change local time bounds according to either dragged marker
17619
-
17620
- var mouseTimeUnix = pixelToTimestamp(mousePosition, // lets us drag on the marker
17621
- centerTime, canvasWidth, secondsPerPx);
17759
+ dragTooltipPosition.current = pixelsToLeft ? mousePosition + pixelsToLeft : mousePosition;
17760
+ var mouseTimeUnix = pixelToTimestamp(mousePosition, centerTime, canvasWidth, secondsPerPx);
17622
17761
  setLocalAnimationStartTime(mouseTimeUnix);
17623
17762
  setTooltipTime(moment.unix(mouseTimeUnix));
17624
17763
  return;
@@ -17627,14 +17766,12 @@ var TimeSliderLegend = function TimeSliderLegend(_ref) {
17627
17766
  if (rightMarkerDragging) {
17628
17767
  var _mousePosition = rightMarkerPx + x;
17629
17768
 
17630
- var leftAnimationPosition = leftMarkerPx + DRAG_AREA_WIDTH * 2; // Similar condition for other marker
17631
-
17632
- if (leftAnimationPosition >= _mousePosition || _mousePosition >= canvasWidth) return; // set animation drag info dialog location
17769
+ var leftAnimationPosition = leftMarkerPx + DRAG_AREA_WIDTH * 2;
17770
+ if (leftAnimationPosition >= _mousePosition || _mousePosition >= canvasWidth) return; // eslint-disable-next-line no-param-reassign
17633
17771
 
17634
- dragTooltipPosition.current = pixelsToLeft ? _mousePosition + pixelsToLeft : _mousePosition; // change local time bounds according to either dragged marker
17772
+ dragTooltipPosition.current = pixelsToLeft ? _mousePosition + pixelsToLeft : _mousePosition;
17635
17773
 
17636
- var _mouseTimeUnix = pixelToTimestamp(_mousePosition, // lets us drag on the marker
17637
- centerTime, canvasWidth, secondsPerPx);
17774
+ var _mouseTimeUnix = pixelToTimestamp(_mousePosition, centerTime, canvasWidth, secondsPerPx);
17638
17775
 
17639
17776
  setLocalAnimationEndTime(_mouseTimeUnix);
17640
17777
  setTooltipTime(moment.unix(_mouseTimeUnix));
@@ -17663,101 +17800,236 @@ var TimeSliderLegend = function TimeSliderLegend(_ref) {
17663
17800
  setLocalAnimationStartTime(startTime);
17664
17801
  setLocalAnimationEndTime(endTime);
17665
17802
  }
17666
- }, [localAnimationStartTime, localAnimationEndTime, leftMarkerDragging, rightMarkerDragging, animationAreaDragging, centerTime, canvasWidth, secondsPerPx, pixelsToLeft, animationDiff]);
17667
- var setSelectedTime = useCallback(function (x) {
17668
- var unfliteredSelectedTimePx = timestampToPixel(unfilteredSelectedTime, centerTime, canvasWidth, secondsPerPx) + x;
17669
- setUnfilteredSelectedTime(pixelToTimestamp(unfliteredSelectedTimePx, centerTime, canvasWidth, secondsPerPx));
17670
- setNewRoundedTime(unfliteredSelectedTimePx, centerTime, canvasWidth, secondsPerPx, timeStep, dataStartTime, dataEndTime, onSetNewDate);
17671
- }, [canvasWidth, centerTime, dataEndTime, dataStartTime, onSetNewDate, secondsPerPx, setUnfilteredSelectedTime, timeStep, unfilteredSelectedTime]);
17803
+ }, [localAnimationStartTime, localAnimationEndTime, leftMarkerDragging, rightMarkerDragging, animationAreaDragging, centerTime, canvasWidth, secondsPerPx, dragTooltipPosition, pixelsToLeft, setTooltipTime, startDraggingPosition]);
17804
+ return {
17805
+ handleAnimationDragging: handleAnimationDragging,
17806
+ localAnimationEndTime: localAnimationEndTime,
17807
+ localAnimationStartTime: localAnimationStartTime
17808
+ };
17809
+ }
17810
+
17811
+ function useHandleKeyDown(mapIsActive, timeStep, dataStartTime, dataEndTime, currentTime, onSetNewDate, onSetCenterTime, selectedTime) {
17812
+ var curTime = selectedTime !== undefined ? moment.unix(selectedTime).toISOString() : moment.utc().toISOString();
17672
17813
  React.useEffect(function () {
17673
- var handleMouseMove = function handleMouseMove(event) {
17674
- if (event.movementX === 0) return;
17814
+ var handleKeyDown = function handleKeyDown(event) {
17815
+ if (event.key === 'Home' && mapIsActive) {
17816
+ handleSetNowEvent(timeStep, dataStartTime, dataEndTime, currentTime, onSetNewDate, onSetCenterTime);
17817
+ }
17675
17818
 
17676
- if (mouseDownInLegend) {
17677
- setCenterTimeDragging(true);
17678
- var dragDistanceTime = event.movementX * secondsPerPx;
17679
- var newCenterTime = centerTime - dragDistanceTime;
17680
- onSetCenterTime && onSetCenterTime(newCenterTime);
17681
- } else if (leftMarkerDragging || rightMarkerDragging || animationAreaDragging) {
17682
- onMouseTouchMoveActions(event.movementX);
17683
- } else if (selectedTimeDragging) {
17684
- setSelectedTime(event.movementX);
17819
+ if (event.ctrlKey && dataStartTime && dataEndTime && mapIsActive) {
17820
+ switch (event.code) {
17821
+ case 'ArrowLeft':
17822
+ setPreviousTimeStep(timeStep, curTime, dataStartTime, onSetNewDate);
17823
+ break;
17824
+
17825
+ case 'ArrowRight':
17826
+ setNextTimeStep(timeStep, curTime, dataEndTime, onSetNewDate);
17827
+ break;
17828
+ }
17685
17829
  }
17686
17830
  };
17687
17831
 
17688
- document.addEventListener('mousemove', handleMouseMove);
17832
+ document.addEventListener('keydown', handleKeyDown);
17689
17833
  return function () {
17690
- document.removeEventListener('mousemove', handleMouseMove);
17834
+ document.removeEventListener('keydown', handleKeyDown);
17691
17835
  };
17692
- }, [animationAreaDragging, centerTime, leftMarkerDragging, mouseDownInLegend, onMouseTouchMoveActions, onSetCenterTime, rightMarkerDragging, secondsPerPx, selectedTimeDragging, setSelectedTime]);
17693
- var theme = useTheme();
17694
- var startDraggingPosition = React.useRef(0);
17836
+ }, [curTime, currentTime, dataEndTime, dataStartTime, mapIsActive, onSetCenterTime, onSetNewDate, timeStep]);
17837
+ }
17695
17838
 
17696
- var onMouseDown = function onMouseDown(x, y, width) {
17697
- isClickOrDrag.current = 'click';
17698
- startDraggingPosition.current = x;
17839
+ function convertStringTimeToUnix(time) {
17840
+ return time ? moment.utc(time).unix() : undefined;
17841
+ } // Explanation of props can be found here:
17842
+ // https://drive.google.com/file/d/1jqqNcciCH0UJiZ04HO-1vknmPPpT8fK5/view?usp=sharing
17699
17843
 
17700
- var _map3 = [localAnimationStartTime, localAnimationEndTime, selectedTime].map(function (timestamp) {
17701
- return timestampToPixel(timestamp, centerTime, width, secondsPerPx);
17702
- }),
17703
- _map4 = _slicedToArray(_map3, 3),
17704
- leftMarkerPx = _map4[0],
17705
- rightMarkerPx = _map4[1],
17706
- selectedTimePx = _map4[2]; // start dragging selected time.
17707
17844
 
17845
+ var TimeSliderLegend = function TimeSliderLegend(_ref) {
17846
+ var mapId = _ref.mapId,
17847
+ centerTime = _ref.centerTime,
17848
+ secondsPerPx = _ref.secondsPerPx,
17849
+ _ref$dataScaleToSecon = _ref.dataScaleToSecondsPerPx,
17850
+ dataScaleToSecondsPerPx = _ref$dataScaleToSecon === void 0 ? defaultDataScaleToSecondsPerPx : _ref$dataScaleToSecon,
17851
+ selectedTime = _ref.selectedTime,
17852
+ _ref$scale = _ref.scale,
17853
+ scale = _ref$scale === void 0 ? Scale.Hour : _ref$scale,
17854
+ currentTime = _ref.currentTime,
17855
+ dataStartTime = _ref.dataStartTime,
17856
+ dataEndTime = _ref.dataEndTime,
17857
+ animationStartTime = _ref.animationStartTime,
17858
+ animationEndTime = _ref.animationEndTime,
17859
+ timeStep = _ref.timeStep,
17860
+ _ref$mapIsActive = _ref.mapIsActive,
17861
+ mapIsActive = _ref$mapIsActive === void 0 ? true : _ref$mapIsActive,
17862
+ unfilteredSelectedTime = _ref.unfilteredSelectedTime,
17863
+ setUnfilteredSelectedTime = _ref.setUnfilteredSelectedTime,
17864
+ _ref$onSetNewDate = _ref.onSetNewDate,
17865
+ onSetNewDate = _ref$onSetNewDate === void 0 ? function () {} : _ref$onSetNewDate,
17866
+ _ref$onSetCenterTime = _ref.onSetCenterTime,
17867
+ onSetCenterTime = _ref$onSetCenterTime === void 0 ? function () {} : _ref$onSetCenterTime,
17868
+ _ref$onSetAnimationSt = _ref.onSetAnimationStartTime,
17869
+ onSetAnimationStartTime = _ref$onSetAnimationSt === void 0 ? function () {} : _ref$onSetAnimationSt,
17870
+ _ref$onSetAnimationEn = _ref.onSetAnimationEndTime,
17871
+ onSetAnimationEndTime = _ref$onSetAnimationEn === void 0 ? function () {} : _ref$onSetAnimationEn;
17872
+ useHandleKeyDown(mapIsActive, timeStep, dataStartTime, dataEndTime, currentTime, onSetNewDate, onSetCenterTime, selectedTime);
17708
17873
 
17709
- if (isSelectedTimeIconArea(x, selectedTimePx, DRAG_AREA_WIDTH)) {
17710
- setCursorStyle('grabbing');
17711
- setSelectedTimeDragging(true);
17712
- return;
17713
- }
17874
+ var _useCanvasTarget = useCanvasTarget('mousedown'),
17875
+ _useCanvasTarget2 = _slicedToArray(_useCanvasTarget, 2),
17876
+ node = _useCanvasTarget2[1];
17714
17877
 
17715
- if (animationStartTime && animationEndTime && onSetAnimationStartTime && onSetAnimationEndTime) {
17716
- dragTooltipPosition.current = pixelsToLeft ? x + pixelsToLeft : x; // start dragging either marker
17878
+ var _React$useState5 = React.useState(0),
17879
+ _React$useState6 = _slicedToArray(_React$useState5, 2),
17880
+ canvasWidth = _React$useState6[0],
17881
+ setCanvasWidth = _React$useState6[1];
17717
17882
 
17718
- if (isLeftAnimationIconArea(x, leftMarkerPx, DRAG_AREA_WIDTH) && !rightMarkerDragging) {
17719
- setCursorStyle('grabbing');
17720
- setLeftMarkerDragging(true);
17721
- setTooltipTime(moment.utc(animationStartTime));
17722
- setDragTooltipOpen(true);
17723
- return;
17724
- }
17883
+ var _React$useState7 = React.useState(false),
17884
+ _React$useState8 = _slicedToArray(_React$useState7, 2),
17885
+ selectedTimeDragging = _React$useState8[0],
17886
+ setSelectedTimeDragging = _React$useState8[1];
17725
17887
 
17726
- if (isRightAnimationIconArea(x, rightMarkerPx, DRAG_AREA_WIDTH) && !leftMarkerDragging) {
17727
- setCursorStyle('grabbing');
17728
- setRightMarkerDragging(true);
17729
- setTooltipTime(moment.utc(animationEndTime));
17730
- setDragTooltipOpen(true);
17731
- return;
17732
- }
17888
+ var _React$useState9 = React.useState(false),
17889
+ _React$useState10 = _slicedToArray(_React$useState9, 2),
17890
+ leftMarkerDragging = _React$useState10[0],
17891
+ setLeftMarkerDragging = _React$useState10[1];
17733
17892
 
17734
- if (isInsideAnimationArea(x, leftMarkerPx, rightMarkerPx) && !animationAreaDragging) {
17735
- setCursorStyle('grabbing');
17736
- setAnimationAreaDragging(true);
17737
- return;
17738
- }
17739
- } // clicking the timeslider
17893
+ var _React$useState11 = React.useState(false),
17894
+ _React$useState12 = _slicedToArray(_React$useState11, 2),
17895
+ rightMarkerDragging = _React$useState12[0],
17896
+ setRightMarkerDragging = _React$useState12[1];
17897
+
17898
+ var _React$useState13 = React.useState(false),
17899
+ _React$useState14 = _slicedToArray(_React$useState13, 2),
17900
+ dragTooltipOpen = _React$useState14[0],
17901
+ setDragTooltipOpen = _React$useState14[1];
17740
17902
 
17903
+ var _React$useState15 = React.useState(false),
17904
+ _React$useState16 = _slicedToArray(_React$useState15, 2),
17905
+ mouseDownInLegend = _React$useState16[0],
17906
+ setMouseDownInLegend = _React$useState16[1];
17907
+
17908
+ var _React$useState17 = React.useState(false),
17909
+ _React$useState18 = _slicedToArray(_React$useState17, 2),
17910
+ animationAreaDragging = _React$useState18[0],
17911
+ setAnimationAreaDragging = _React$useState18[1];
17912
+
17913
+ var _React$useState19 = React.useState('auto'),
17914
+ _React$useState20 = _slicedToArray(_React$useState19, 2),
17915
+ cursorStyle = _React$useState20[0],
17916
+ setCursorStyle = _React$useState20[1];
17917
+ /**
17918
+ * remove active drag. can happen outside canvas.
17919
+ */
17741
17920
 
17742
- setMouseDownInLegend(true);
17743
- };
17744
17921
 
17745
17922
  React.useEffect(function () {
17746
- var stoppedDragging = !leftMarkerDragging && !rightMarkerDragging && !animationAreaDragging;
17923
+ var handleMouseUp = function handleMouseUp() {
17924
+ setCursorStyle('auto');
17925
+ setSelectedTimeDragging(false);
17926
+ setLeftMarkerDragging(false);
17927
+ setRightMarkerDragging(false);
17928
+ setMouseDownInLegend(false);
17929
+ setDragTooltipOpen(false);
17930
+ setAnimationAreaDragging(false);
17931
+ startDraggingPosition.current = 0;
17932
+ };
17747
17933
 
17748
- if (stoppedDragging) {
17749
- if (localAnimationStartTime !== convertStringTimeToUnix(animationStartTime)) {
17750
- onSetAnimationStartTime(moment.utc(localAnimationStartTime * 1000).format(dateFormat));
17934
+ document.addEventListener('mouseup', handleMouseUp);
17935
+ return function () {
17936
+ document.removeEventListener('mouseup', handleMouseUp);
17937
+ };
17938
+ }, []);
17939
+ var dragTooltipPosition = React.useRef();
17940
+ var startDraggingPosition = React.useRef(0);
17941
+ var timeSliderLegendId = "timeSliderLegend_".concat(mapId);
17942
+ var timeSliderLegendElement = document.querySelector(".".concat(timeSliderLegendId));
17943
+ var pixelsToLeft = timeSliderLegendElement === null || timeSliderLegendElement === void 0 ? void 0 : timeSliderLegendElement.getBoundingClientRect()['left'];
17944
+
17945
+ var _React$useState21 = React.useState(moment.utc(0)),
17946
+ _React$useState22 = _slicedToArray(_React$useState21, 2),
17947
+ tooltipTime = _React$useState22[0],
17948
+ setTooltipTime = _React$useState22[1];
17949
+
17950
+ var _useAnimationTime = useAnimationTime(animationStartTime, animationEndTime, onSetAnimationStartTime, onSetAnimationEndTime, leftMarkerDragging, rightMarkerDragging, animationAreaDragging, centerTime, canvasWidth, secondsPerPx, dragTooltipPosition, pixelsToLeft, setTooltipTime, startDraggingPosition),
17951
+ handleAnimationDragging = _useAnimationTime.handleAnimationDragging,
17952
+ localAnimationEndTime = _useAnimationTime.localAnimationEndTime,
17953
+ localAnimationStartTime = _useAnimationTime.localAnimationStartTime;
17954
+
17955
+ var setSelectedTime = useCallback(function (x) {
17956
+ var unfliteredSelectedTimePx = timestampToPixel(unfilteredSelectedTime, centerTime, canvasWidth, secondsPerPx) + x;
17957
+ setUnfilteredSelectedTime(pixelToTimestamp(unfliteredSelectedTimePx, centerTime, canvasWidth, secondsPerPx));
17958
+ setNewRoundedTime(unfliteredSelectedTimePx, centerTime, canvasWidth, secondsPerPx, timeStep, dataStartTime, dataEndTime, onSetNewDate);
17959
+ }, [canvasWidth, centerTime, dataEndTime, dataStartTime, onSetNewDate, secondsPerPx, setUnfilteredSelectedTime, timeStep, unfilteredSelectedTime]);
17960
+ React.useEffect(function () {
17961
+ var handleMouseMove = function handleMouseMove(event) {
17962
+ if (event.movementX === 0) return;
17963
+
17964
+ if (mouseDownInLegend) {
17965
+ var dragDistanceTime = event.movementX * secondsPerPx;
17966
+ var newCenterTime = centerTime - dragDistanceTime;
17967
+ onSetCenterTime && onSetCenterTime(newCenterTime);
17968
+ } else if (leftMarkerDragging || rightMarkerDragging || animationAreaDragging) {
17969
+ handleAnimationDragging(event.movementX);
17970
+ } else if (selectedTimeDragging) {
17971
+ setSelectedTime(event.movementX);
17751
17972
  }
17973
+ };
17752
17974
 
17753
- if (localAnimationEndTime !== convertStringTimeToUnix(animationEndTime)) {
17754
- onSetAnimationEndTime(moment.utc(localAnimationEndTime * 1000).format(dateFormat));
17975
+ document.addEventListener('mousemove', handleMouseMove);
17976
+ return function () {
17977
+ document.removeEventListener('mousemove', handleMouseMove);
17978
+ };
17979
+ }, [animationAreaDragging, centerTime, leftMarkerDragging, mouseDownInLegend, handleAnimationDragging, onSetCenterTime, rightMarkerDragging, secondsPerPx, selectedTimeDragging, setSelectedTime]);
17980
+ var theme = useTheme();
17981
+ var isClickOrDrag = React.useRef();
17982
+
17983
+ var onMouseDown = function onMouseDown(x, y, width) {
17984
+ isClickOrDrag.current = 'click';
17985
+ startDraggingPosition.current = x;
17986
+
17987
+ var _map3 = [localAnimationStartTime, localAnimationEndTime, selectedTime].map(function (timestamp) {
17988
+ return timestampToPixel(timestamp, centerTime, width, secondsPerPx);
17989
+ }),
17990
+ _map4 = _slicedToArray(_map3, 3),
17991
+ leftMarkerPx = _map4[0],
17992
+ rightMarkerPx = _map4[1],
17993
+ selectedTimePx = _map4[2]; // start dragging selected time.
17994
+
17995
+
17996
+ if (isSelectedTimeIconArea(x, selectedTimePx, DRAG_AREA_WIDTH)) {
17997
+ setCursorStyle('grabbing');
17998
+ setSelectedTimeDragging(true);
17999
+ return;
18000
+ }
18001
+
18002
+ if (animationStartTime && animationEndTime) {
18003
+ dragTooltipPosition.current = pixelsToLeft ? x + pixelsToLeft : x; // start dragging either marker
18004
+
18005
+ if (isLeftAnimationIconArea(x, leftMarkerPx, DRAG_AREA_WIDTH) && !rightMarkerDragging) {
18006
+ setCursorStyle('grabbing');
18007
+ setLeftMarkerDragging(true);
18008
+ setTooltipTime(moment.utc(animationStartTime));
18009
+ setDragTooltipOpen(true);
18010
+ return;
17755
18011
  }
17756
- } // eslint-disable-next-line react-hooks/exhaustive-deps
17757
18012
 
17758
- }, [leftMarkerDragging, rightMarkerDragging, animationAreaDragging]);
18013
+ if (isRightAnimationIconArea(x, rightMarkerPx, DRAG_AREA_WIDTH) && !leftMarkerDragging) {
18014
+ setCursorStyle('grabbing');
18015
+ setRightMarkerDragging(true);
18016
+ setTooltipTime(moment.utc(animationEndTime));
18017
+ setDragTooltipOpen(true);
18018
+ return;
18019
+ }
18020
+
18021
+ if (isInsideAnimationArea(x, leftMarkerPx, rightMarkerPx) && !animationAreaDragging) {
18022
+ setCursorStyle('grabbing');
18023
+ setAnimationAreaDragging(true);
18024
+ return;
18025
+ }
18026
+ } // clicking the timeslider
18027
+
17759
18028
 
17760
- var onMouseUpTouchEnd = function onMouseUpTouchEnd(x) {
18029
+ setMouseDownInLegend(true);
18030
+ };
18031
+
18032
+ var onMouseUp = function onMouseUp(x) {
17761
18033
  if (isClickOrDrag.current === 'click') {
17762
18034
  // we need to set the unfiltered time, so the timebox will update accordingly
17763
18035
  setUnfilteredSelectedTime(pixelToTimestamp(x, centerTime, canvasWidth, secondsPerPx));
@@ -17800,8 +18072,8 @@ var TimeSliderLegend = function TimeSliderLegend(_ref) {
17800
18072
  }
17801
18073
  };
17802
18074
 
17803
- var dragTooltipPosition = React.useRef();
17804
18075
  var popperRef = React.useRef(null);
18076
+ var pixelsToTop = timeSliderLegendElement === null || timeSliderLegendElement === void 0 ? void 0 : timeSliderLegendElement.getBoundingClientRect()['top'];
17805
18077
 
17806
18078
  var setTooltipPosition = function setTooltipPosition() {
17807
18079
  var tooltipX = dragTooltipPosition.current;
@@ -17820,7 +18092,7 @@ var TimeSliderLegend = function TimeSliderLegend(_ref) {
17820
18092
  }
17821
18093
  }, /*#__PURE__*/React.createElement(Box, {
17822
18094
  "data-testid": "timeSliderLegend",
17823
- className: "timeSliderLegend_".concat(mapId),
18095
+ className: timeSliderLegendId,
17824
18096
  sx: {
17825
18097
  height: "".concat(TIME_SLIDER_LEGEND_HEIGHT, "px"),
17826
18098
  borderRadius: '4.5px',
@@ -17837,7 +18109,7 @@ var TimeSliderLegend = function TimeSliderLegend(_ref) {
17837
18109
  onSetCenterTime && onSetCenterTime(newCenterTime);
17838
18110
  },
17839
18111
  onMouseDown: onMouseDown,
17840
- onMouseUp: onMouseUpTouchEnd,
18112
+ onMouseUp: onMouseUp,
17841
18113
  onRenderCanvas: function onRenderCanvas(ctx, width, height) {
17842
18114
  setCanvasWidth(width);
17843
18115
  drawTimeSliderLegend(ctx, theme, width, height, centerTime, secondsPerPx, dataScaleToSecondsPerPx, selectedTime, scale, currentTime, localAnimationStartTime, localAnimationEndTime, dataStartTime, dataEndTime);
@@ -17845,12 +18117,6 @@ var TimeSliderLegend = function TimeSliderLegend(_ref) {
17845
18117
  })));
17846
18118
  };
17847
18119
 
17848
- function convertStringTimeToUnix(time) {
17849
- return time ? moment.utc(time).unix() : undefined;
17850
- }
17851
-
17852
- var TIME_SLIDER_LEGEND_HEIGHT = 24;
17853
-
17854
18120
  /* *
17855
18121
  * Licensed under the Apache License, Version 2.0 (the "License");
17856
18122
  * you may not use this file except in compliance with the License.
@@ -18294,26 +18560,46 @@ var TimeStepButtonComponent = function TimeStepButtonComponent(_ref) {
18294
18560
  var isTimestepAuto$1 = useSelector(function (store) {
18295
18561
  return isTimestepAuto(store, mapId);
18296
18562
  });
18297
- var onToggleTimestepAuto = React.useCallback(function () {
18563
+ var activeLayerId = useSelector(function (store) {
18564
+ return getActiveLayerId(store, mapId);
18565
+ });
18566
+ var activeLayerTimeDimension = useSelector(function (store) {
18567
+ return getLayerTimeDimension(store, activeLayerId);
18568
+ });
18569
+
18570
+ var onToggleTimestepAuto = function onToggleTimestepAuto() {
18571
+ var newTimestepAuto = !isTimestepAuto$1;
18572
+
18573
+ if (newTimestepAuto) {
18574
+ var timeStepFromLayer = getActiveLayerTimeStep(activeLayerTimeDimension);
18575
+
18576
+ if (timeStepFromLayer) {
18577
+ dispatch(mapActions$1.setTimeStep({
18578
+ mapId: mapId,
18579
+ timeStep: timeStepFromLayer
18580
+ }));
18581
+ }
18582
+ }
18583
+
18298
18584
  dispatch(mapActions$1.toggleTimestepAuto({
18299
18585
  mapId: mapId,
18300
- timestepAuto: !isTimestepAuto$1,
18301
- origin: MapActionOrigin.map
18586
+ timestepAuto: newTimestepAuto
18302
18587
  }));
18303
- }, [dispatch, isTimestepAuto$1, mapId]);
18304
- var onSetTimeStep = React.useCallback(function (timeStep, origin) {
18305
- dispatch(mapActions$1.setTimeStep(Object.assign({
18588
+ };
18589
+
18590
+ var onSetTimeStep = function onSetTimeStep(timeStep) {
18591
+ dispatch(mapActions$1.setTimeStep({
18306
18592
  mapId: mapId,
18307
18593
  timeStep: timeStep
18308
- }, origin && {
18309
- origin: origin
18310
- })));
18311
- }, [dispatch, mapId]);
18594
+ }));
18595
+ };
18596
+
18312
18597
  return /*#__PURE__*/React.createElement(TimeStepButton, {
18313
18598
  timeStep: timeStep,
18314
18599
  onChangeTimeStep: onSetTimeStep,
18315
18600
  disabled: isAnimating$1,
18316
- onToggleTimestepAuto: onToggleTimestepAuto
18601
+ onToggleTimestepAuto: onToggleTimestepAuto,
18602
+ isTimestepAuto: Boolean(isTimestepAuto$1)
18317
18603
  });
18318
18604
  };
18319
18605
 
@@ -18480,7 +18766,8 @@ var AnimationLengthButtonConnect = function AnimationLengthButtonConnect(_ref) {
18480
18766
  return /*#__PURE__*/React.createElement(AnimationLengthButton, {
18481
18767
  disabled: isAnimating$1,
18482
18768
  animationLength: currentLength || Number(AnimationLength.Hours24),
18483
- onChangeAnimationLength: handlechangeAnimationLength
18769
+ onChangeAnimationLength: handlechangeAnimationLength,
18770
+ animationLengthInMinutes: currentDiffInMinutes
18484
18771
  });
18485
18772
  };
18486
18773
 
@@ -18512,27 +18799,6 @@ var AnimationLengthButtonConnect = function AnimationLengthButtonConnect(_ref) {
18512
18799
  var OptionsMenuButtonConnect = function OptionsMenuButtonConnect(_ref) {
18513
18800
  var sourceId = _ref.sourceId,
18514
18801
  mapId = _ref.mapId;
18515
- var dispatch = useDispatch();
18516
- var isTimestepAuto$1 = useSelector(function (store) {
18517
- return isTimestepAuto(store, mapId);
18518
- });
18519
- var timeStep = useSelector(function (store) {
18520
- return getMapTimeStep(store, mapId);
18521
- });
18522
- var activeLayerId = useSelector(function (store) {
18523
- return getActiveLayerId(store, mapId);
18524
- });
18525
- var activeLayerTimeDimension = useSelector(function (store) {
18526
- return getLayerTimeDimension(store, activeLayerId);
18527
- });
18528
- var onSetTimeStep = React.useCallback(function (timeStep, origin) {
18529
- dispatch(mapActions$1.setTimeStep(Object.assign({
18530
- mapId: mapId,
18531
- timeStep: timeStep
18532
- }, origin && {
18533
- origin: origin
18534
- })));
18535
- }, [dispatch, mapId]);
18536
18802
  return /*#__PURE__*/React.createElement(OptionsMenuButton, {
18537
18803
  nowBtn: /*#__PURE__*/React.createElement(NowButtonConnect, {
18538
18804
  mapId: mapId,
@@ -18552,11 +18818,7 @@ var OptionsMenuButtonConnect = function OptionsMenuButtonConnect(_ref) {
18552
18818
  }),
18553
18819
  timeScaleBtn: /*#__PURE__*/React.createElement(TimeScaleButtonConnect, {
18554
18820
  mapId: mapId
18555
- }),
18556
- timeStep: timeStep,
18557
- isTimestepAuto: isTimestepAuto$1,
18558
- onChangeTimeStep: onSetTimeStep,
18559
- timeDimension: activeLayerTimeDimension
18821
+ })
18560
18822
  });
18561
18823
  };
18562
18824
 
@@ -19671,6 +19933,34 @@ var checkHoverFeatures = function checkHoverFeatures(geojson, mouseX, mouseY, co
19671
19933
 
19672
19934
  return null;
19673
19935
  };
19936
+ var generatedDrawFunctionIds = 0;
19937
+
19938
+ var generateDrawFunctionId = function generateDrawFunctionId() {
19939
+ generatedDrawFunctionIds += 1;
19940
+ return "drawFunctionId_".concat(generatedDrawFunctionIds);
19941
+ };
19942
+ /**
19943
+ * DrawFunction store for re-use of drawFunctions
19944
+ */
19945
+
19946
+
19947
+ var drawFunctionStore = [];
19948
+ var getDrawFunctionFromStore = function getDrawFunctionFromStore(id) {
19949
+ var drawFunction = drawFunctionStore.find(function (drawFunction) {
19950
+ return drawFunction.id === id;
19951
+ });
19952
+ return drawFunction === null || drawFunction === void 0 ? void 0 : drawFunction.drawMethod;
19953
+ };
19954
+ var registerDrawFunction = function registerDrawFunction() {
19955
+ var drawFunction = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : function () {};
19956
+ var id = generateDrawFunctionId();
19957
+ var newFunction = {
19958
+ id: id,
19959
+ drawMethod: drawFunction
19960
+ };
19961
+ drawFunctionStore.push(newFunction);
19962
+ return id;
19963
+ };
19674
19964
 
19675
19965
  var Proj4js = proj4; // Cache for for storing and reusing Proj4 instances
19676
19966
 
@@ -21474,22 +21764,25 @@ var AdagucMapDraw = /*#__PURE__*/function (_React$PureComponent) {
21474
21764
  }
21475
21765
 
21476
21766
  var drawStyledMarker = featureProperties ? featureProperties.stroke || featureProperties['stroke-width'] || featureProperties.fill : null;
21477
- var drawMarkerByDefault = !featureProperties || !featureProperties.imageURL || !featureProperties.drawFunction;
21478
-
21479
- if (featureProperties.drawFunction) {
21480
- var isHovered = this.featureEvent && this.featureEvent.feature === feature;
21481
- featureProperties.drawFunction({
21482
- context: ctx,
21483
- featureIndex: featureIndex,
21484
- coord: _coord,
21485
- selected: selected,
21486
- middle: middle,
21487
- isInEditMode: isInEditMode,
21488
- feature: feature,
21489
- mouseX: this.mouseX,
21490
- mouseY: this.mouseY,
21491
- isHovered: isHovered
21492
- });
21767
+ var drawMarkerByDefault = !featureProperties || !featureProperties.imageURL || !featureProperties.drawFunctionId;
21768
+
21769
+ if (featureProperties.drawFunctionId) {
21770
+ var drawFunction = getDrawFunctionFromStore(featureProperties.drawFunctionId);
21771
+
21772
+ if (drawFunction) {
21773
+ var isHovered = this.featureEvent && this.featureEvent.feature === feature;
21774
+ drawFunction({
21775
+ context: ctx,
21776
+ featureIndex: featureIndex,
21777
+ coord: _coord,
21778
+ selected: selected,
21779
+ isInEditMode: isInEditMode,
21780
+ feature: feature,
21781
+ mouseX: this.mouseX,
21782
+ mouseY: this.mouseY,
21783
+ isHovered: isHovered
21784
+ });
21785
+ }
21493
21786
  } else if (drawStyledMarker || drawMarkerByDefault) {
21494
21787
  this.drawMarker(ctx, _coord, selected, middle, isInEditMode, featureProperties);
21495
21788
  }
@@ -22084,9 +22377,8 @@ var ReactMapView = /*#__PURE__*/function (_React$Component) {
22084
22377
  key: "componentDidMount",
22085
22378
  value: function componentDidMount() {
22086
22379
  var _this$props2 = this.props,
22087
- onMount = _this$props2.onMount,
22380
+ onWMJSMount = _this$props2.onWMJSMount,
22088
22381
  mapId = _this$props2.mapId,
22089
- onRegisterAdaguc = _this$props2.onRegisterAdaguc,
22090
22382
  shouldAutoFetch = _this$props2.shouldAutoFetch;
22091
22383
  this.checkAdaguc();
22092
22384
  this.checkNewProps(null, this.props);
@@ -22094,13 +22386,9 @@ var ReactMapView = /*#__PURE__*/function (_React$Component) {
22094
22386
 
22095
22387
  if (this.adaguc.initialized === false && this.adaguc.webMapJS) {
22096
22388
  this.adaguc.initialized = true;
22097
-
22098
- if (onRegisterAdaguc) {
22099
- onRegisterAdaguc(this.adaguc.webMapJS);
22100
- }
22101
22389
  }
22102
22390
 
22103
- onMount(mapId, this.adaguc.webMapJS);
22391
+ onWMJSMount(mapId);
22104
22392
 
22105
22393
  if (shouldAutoFetch) {
22106
22394
  this.onStartRefetchTimer();
@@ -22109,11 +22397,7 @@ var ReactMapView = /*#__PURE__*/function (_React$Component) {
22109
22397
  }, {
22110
22398
  key: "componentWillUnmount",
22111
22399
  value: function componentWillUnmount() {
22112
- var _this$props3 = this.props,
22113
- onUnMount = _this$props3.onUnMount,
22114
- mapId = _this$props3.mapId;
22115
22400
  window.removeEventListener('resize', this.handleWindowResize);
22116
- onUnMount(mapId, this.adaguc.webMapJS);
22117
22401
  this.adaguc.webMapJS.getListener().suspendEvents();
22118
22402
 
22119
22403
  if (typeof this.adaguc.webMapJS.stopAnimating === 'function') {
@@ -22127,9 +22411,9 @@ var ReactMapView = /*#__PURE__*/function (_React$Component) {
22127
22411
  }, {
22128
22412
  key: "onDimChangeListener",
22129
22413
  value: function onDimChangeListener() {
22130
- var _this$props4 = this.props,
22131
- mapId = _this$props4.mapId,
22132
- onMapChangeDimension = _this$props4.onMapChangeDimension;
22414
+ var _this$props3 = this.props,
22415
+ mapId = _this$props3.mapId,
22416
+ onMapChangeDimension = _this$props3.onMapChangeDimension;
22133
22417
 
22134
22418
  if (this.adaguc && this.adaguc.webMapJS) {
22135
22419
  var timeDimension = this.adaguc.webMapJS.getDimension('time');
@@ -22151,9 +22435,9 @@ var ReactMapView = /*#__PURE__*/function (_React$Component) {
22151
22435
  value: function onAfterSetBBoxListener(wmjsMap) {
22152
22436
  var _this2 = this;
22153
22437
 
22154
- var _this$props5 = this.props,
22155
- mapId = _this$props5.mapId,
22156
- onMapZoomEnd = _this$props5.onMapZoomEnd;
22438
+ var _this$props4 = this.props,
22439
+ mapId = _this$props4.mapId,
22440
+ onMapZoomEnd = _this$props4.onMapZoomEnd;
22157
22441
  /* Update the map after 100 ms */
22158
22442
 
22159
22443
  window.setTimeout(function () {
@@ -22608,12 +22892,12 @@ var ReactMapView = /*#__PURE__*/function (_React$Component) {
22608
22892
  value: function checkAdaguc() {
22609
22893
  var _this4 = this;
22610
22894
 
22611
- var _this$props6 = this.props,
22612
- mapId = _this$props6.mapId,
22613
- listeners = _this$props6.listeners,
22614
- srs = _this$props6.srs,
22615
- bbox = _this$props6.bbox,
22616
- onMapPinChangeLocation = _this$props6.onMapPinChangeLocation;
22895
+ var _this$props5 = this.props,
22896
+ mapId = _this$props5.mapId,
22897
+ listeners = _this$props5.listeners,
22898
+ srs = _this$props5.srs,
22899
+ bbox = _this$props5.bbox,
22900
+ onMapPinChangeLocation = _this$props5.onMapPinChangeLocation;
22617
22901
 
22618
22902
  if (this.adaguc.webMapJSCreated) {
22619
22903
  return;
@@ -22687,10 +22971,10 @@ var ReactMapView = /*#__PURE__*/function (_React$Component) {
22687
22971
  }, {
22688
22972
  key: "render",
22689
22973
  value: function render() {
22690
- var _this$props7 = this.props,
22691
- passiveMap = _this$props7.passiveMap,
22692
- children = _this$props7.children,
22693
- onClick = _this$props7.onClick;
22974
+ var _this$props6 = this.props,
22975
+ passiveMap = _this$props6.passiveMap,
22976
+ children = _this$props6.children,
22977
+ onClick = _this$props6.onClick;
22694
22978
  var adagucInitialised = this.state.adagucInitialised;
22695
22979
  var featureLayers = getFeatureLayers(children);
22696
22980
  return /*#__PURE__*/React.createElement("div", {
@@ -22771,8 +23055,7 @@ ReactMapView.defaultProps = {
22771
23055
  shouldAutoFetch: true,
22772
23056
  displayMapPin: false,
22773
23057
  disableMapPin: false,
22774
- onMount: function onMount() {},
22775
- onUnMount: function onUnMount() {},
23058
+ onWMJSMount: function onWMJSMount() {},
22776
23059
  onMapChangeDimension: function onMapChangeDimension() {
22777
23060
  /* nothing */
22778
23061
  },
@@ -22864,8 +23147,8 @@ var MapView = function MapView(_a) {
22864
23147
  displayTimeInMap = _a$displayTimeInMap === void 0 ? true : _a$displayTimeInMap,
22865
23148
  props = __rest(_a, ["children", "controls", "displayTimeInMap"]);
22866
23149
 
22867
- var dimensions = props.dimensions;
22868
- var adagucRef = React.useRef(null);
23150
+ var dimensions = props.dimensions,
23151
+ mapId = props.mapId;
22869
23152
  return /*#__PURE__*/React.createElement(Box, {
22870
23153
  sx: {
22871
23154
  display: 'grid',
@@ -22881,13 +23164,16 @@ var MapView = function MapView(_a) {
22881
23164
  }
22882
23165
  }, /*#__PURE__*/React.createElement(ZoomControls, {
22883
23166
  onZoomIn: function onZoomIn() {
22884
- return adagucRef.current.zoomIn(undefined);
23167
+ var wmjsMap = getWMJSMapById(mapId);
23168
+ wmjsMap.zoomIn(undefined);
22885
23169
  },
22886
23170
  onZoomOut: function onZoomOut() {
22887
- return adagucRef.current.zoomOut();
23171
+ var wmjsMap = getWMJSMapById(mapId);
23172
+ wmjsMap.zoomOut();
22888
23173
  },
22889
23174
  onZoomReset: function onZoomReset() {
22890
- return adagucRef.current.zoomToLayer(adagucRef.current.getActiveLayer());
23175
+ var wmjsMap = getWMJSMapById(mapId);
23176
+ wmjsMap.zoomToLayer(wmjsMap.getActiveLayer());
22891
23177
  }
22892
23178
  })), /*#__PURE__*/React.createElement(Box, {
22893
23179
  sx: {
@@ -22895,9 +23181,6 @@ var MapView = function MapView(_a) {
22895
23181
  gridRowStart: 1
22896
23182
  }
22897
23183
  }, /*#__PURE__*/React.createElement(ReactMapView, Object.assign({}, props, {
22898
- onRegisterAdaguc: function onRegisterAdaguc(adaguc) {
22899
- adagucRef.current = adaguc;
22900
- },
22901
23184
  showLegend: false,
22902
23185
  displayTimeInMap: false
22903
23186
  }), children)), displayTimeInMap && dimensions && /*#__PURE__*/React.createElement(MapTime, {
@@ -23266,7 +23549,7 @@ var MapViewConnect = function MapViewConnect(_a) {
23266
23549
  dispatch(mapActions$1.setMapPinLocation(payload));
23267
23550
  }, [dispatch]);
23268
23551
  var setSelectedFeature = React.useCallback(function (payload) {
23269
- dispatch(mapActions$1.setSelectedFeature(payload));
23552
+ dispatch(layerActions.setSelectedFeature(payload));
23270
23553
  }, [dispatch]);
23271
23554
  var activeWindowId = useSelector(getActiveWindowId);
23272
23555
 
@@ -23276,29 +23559,29 @@ var MapViewConnect = function MapViewConnect(_a) {
23276
23559
 
23277
23560
  useKeyboardZoomAndPan(isActiveWindowId(), mapId);
23278
23561
  useTouchZoomPan(isActiveWindowId(), mapId);
23279
- return /*#__PURE__*/React.createElement("div", {
23280
- style: {
23281
- height: '100%'
23282
- }
23283
- }, /*#__PURE__*/React.createElement(MapView, Object.assign({}, props, {
23284
- mapId: mapId,
23285
- onMount: function onMount() {
23286
- registerMap({
23287
- mapId: mapId
23288
- });
23289
- syncGroupAddSource({
23290
- id: mapId,
23291
- type: [SYNCGROUPS_TYPE_SETTIME, SYNCGROUPS_TYPE_SETBBOX]
23292
- });
23293
- },
23294
- onUnMount: function onUnMount() {
23562
+ React.useEffect(function () {
23563
+ registerMap({
23564
+ mapId: mapId
23565
+ });
23566
+ syncGroupAddSource({
23567
+ id: mapId,
23568
+ type: [SYNCGROUPS_TYPE_SETTIME, SYNCGROUPS_TYPE_SETBBOX]
23569
+ });
23570
+ return function () {
23295
23571
  unregisterMap({
23296
23572
  mapId: mapId
23297
23573
  });
23298
23574
  syncGroupRemoveSource({
23299
23575
  id: mapId
23300
23576
  });
23301
- },
23577
+ };
23578
+ }, [mapId, registerMap, syncGroupAddSource, syncGroupRemoveSource, unregisterMap]);
23579
+ return /*#__PURE__*/React.createElement("div", {
23580
+ style: {
23581
+ height: '100%'
23582
+ }
23583
+ }, /*#__PURE__*/React.createElement(MapView, Object.assign({}, props, {
23584
+ mapId: mapId,
23302
23585
  srs: srs,
23303
23586
  bbox: bbox,
23304
23587
  mapPinLocation: displayMapPin ? mapPinLocation : undefined,
@@ -23353,7 +23636,7 @@ var MapViewConnect = function MapViewConnect(_a) {
23353
23636
  },
23354
23637
  onClickFeature: layer.geojson ? function (event) {
23355
23638
  setSelectedFeature({
23356
- mapId: mapId,
23639
+ layerId: layer.id,
23357
23640
  selectedFeatureIndex: event === null || event === void 0 ? void 0 : event.featureIndex
23358
23641
  });
23359
23642
  } : undefined
@@ -23915,13 +24198,401 @@ var TimeSliderClockConnect = function TimeSliderClockConnect(_ref) {
23915
24198
  });
23916
24199
  };
23917
24200
 
24201
+ /* *
24202
+ * Licensed under the Apache License, Version 2.0 (the "License");
24203
+ * you may not use this file except in compliance with the License.
24204
+ * You may obtain a copy of the License at
24205
+ *
24206
+ * http://www.apache.org/licenses/LICENSE-2.0
24207
+ *
24208
+ * Unless required by applicable law or agreed to in writing, software
24209
+ * distributed under the License is distributed on an "AS IS" BASIS,
24210
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
24211
+ * See the License for the specific language governing permissions and
24212
+ * limitations under the License.
24213
+ *
24214
+ * Copyright 2022 - Koninklijk Nederlands Meteorologisch Instituut (KNMI)
24215
+ * Copyright 2022 - Finnish Meteorological Institute (FMI)
24216
+ * */
24217
+ /**
24218
+ * Get the title for this WMS layer based on its layerId. If not defined, layerId is used instead.
24219
+ * @param layerId
24220
+ * @returns Title for the layer
24221
+ */
24222
+
24223
+ var getTitle = function getTitle(layerId) {
24224
+ var wmjsLayer = getWMLayerById(layerId);
24225
+ return wmjsLayer ? wmjsLayer.title || wmjsLayer.name : layerId;
24226
+ };
24227
+ /**
24228
+ * Make a list of GFI Layers to display.
24229
+ * @param layers
24230
+ * @param mapId
24231
+ * @returns
24232
+ */
24233
+
24234
+
24235
+ var getLayersToUpdate = function getLayersToUpdate(layers, mapId) {
24236
+ var wmjsMap = getWMJSMapById(mapId);
24237
+ if (!wmjsMap || !layers || layers.length === 0) return [];
24238
+ return layers.filter(function (layer) {
24239
+ return layer && layer.enabled && !!getWMLayerById(layer.id);
24240
+ }).map(function (layer) {
24241
+ /*
24242
+ We need a wmjsLayer to build the getfeatureinfo url (getWMSGetFeatureInfoRequestURL function).
24243
+ But it seems that its dimension are lazely updated (by ReactMapView).
24244
+ Therefore make a clone of this layer and set its dimensions based on the layer object.
24245
+ Otherwise we risk making a getfeatureinfo call with outdated dimension values.
24246
+ */
24247
+ var wmjsLayer = getWMLayerById(layer.id).cloneLayer();
24248
+ layer.dimensions && layer.dimensions.forEach(function (dim) {
24249
+ var wmDim = wmjsLayer.getDimension(dim.name);
24250
+
24251
+ if (wmDim && wmDim.getValue() !== dim.currentValue) {
24252
+ wmDim.setValue(dim.currentValue);
24253
+ }
24254
+ });
24255
+ return {
24256
+ layerId: layer.id,
24257
+ url: wmjsMap.getWMSGetFeatureInfoRequestURL(wmjsLayer, "".concat(wmjsMap.getMapPin().getXY().x), "".concat(wmjsMap.getMapPin().getXY().y), 'text/html'),
24258
+ title: getTitle(layer.id)
24259
+ };
24260
+ });
24261
+ };
24262
+
24263
+ var GetFeatureInfoDialog = function GetFeatureInfoDialog(_ref) {
24264
+ var layers = _ref.layers,
24265
+ isOpen = _ref.isOpen,
24266
+ onClose = _ref.onClose,
24267
+ _ref$onMouseDown = _ref.onMouseDown,
24268
+ onMouseDown = _ref$onMouseDown === void 0 ? function () {} : _ref$onMouseDown,
24269
+ mapId = _ref.mapId,
24270
+ _ref$showMapId = _ref.showMapId,
24271
+ showMapId = _ref$showMapId === void 0 ? false : _ref$showMapId,
24272
+ _ref$order = _ref.order,
24273
+ order = _ref$order === void 0 ? 0 : _ref$order,
24274
+ _ref$source = _ref.source,
24275
+ source = _ref$source === void 0 ? 'app' : _ref$source,
24276
+ mapPinLocation = _ref.mapPinLocation;
24277
+
24278
+ /* Ref and state for maplocation */
24279
+ var mapLocationWasChanged = React__default.useRef(false);
24280
+
24281
+ var _React$useState = React__default.useState(false),
24282
+ _React$useState2 = _slicedToArray(_React$useState, 2),
24283
+ isInitialMapLocationChanged = _React$useState2[0],
24284
+ setInitialMapLocationIsChanged = _React$useState2[1];
24285
+ /* Ref, state and update function for results per layer map */
24286
+
24287
+
24288
+ var gfiResultMap = React__default.useRef(new Map()).current;
24289
+
24290
+ var _React$useState3 = React__default.useState(),
24291
+ _React$useState4 = _slicedToArray(_React$useState3, 2),
24292
+ triggerRerender = _React$useState4[1];
24293
+
24294
+ var updateLayerResult = function updateLayerResult(_ref2) {
24295
+ var layerId = _ref2.layerId,
24296
+ data = _ref2.data,
24297
+ isLoading = _ref2.isLoading;
24298
+ gfiResultMap.set(layerId, {
24299
+ data: data,
24300
+ isLoading: isLoading
24301
+ });
24302
+ triggerRerender("".concat(layerId).concat(isLoading));
24303
+ };
24304
+ /* Build a layerlist array with a set of arguments per layer to do the query for */
24305
+
24306
+
24307
+ var layerToUpdateList = isOpen ? getLayersToUpdate(layers, mapId) : [];
24308
+ /*
24309
+ Build a string based on the GFI urls. If this changes for whatever reason we need to update.
24310
+ These strings can change very often, therefore they need to be debounced and only use the most recent result must be used.
24311
+ */
24312
+
24313
+ var debouncedlayerListString = useDebounce(layerToUpdateList.map(function (layer) {
24314
+ return layer.url;
24315
+ }).join(','), 100);
24316
+ /* Do a GFI call to the server and use the updateLayerResult to provide the results. */
24317
+
24318
+ var fetchLayerInfo = function fetchLayerInfo(url, layerId) {
24319
+ return __awaiter(void 0, void 0, void 0, /*#__PURE__*/regeneratorRuntime.mark(function _callee() {
24320
+ var _yield$axios$get, data, errorMessage;
24321
+
24322
+ return regeneratorRuntime.wrap(function _callee$(_context) {
24323
+ while (1) {
24324
+ switch (_context.prev = _context.next) {
24325
+ case 0:
24326
+ _context.prev = 0;
24327
+ updateLayerResult({
24328
+ layerId: layerId,
24329
+ data: '',
24330
+ isLoading: true
24331
+ });
24332
+ _context.next = 4;
24333
+ return axios.get(url);
24334
+
24335
+ case 4:
24336
+ _yield$axios$get = _context.sent;
24337
+ data = _yield$axios$get.data;
24338
+ updateLayerResult({
24339
+ layerId: layerId,
24340
+ data: data,
24341
+ isLoading: false
24342
+ });
24343
+ _context.next = 13;
24344
+ break;
24345
+
24346
+ case 9:
24347
+ _context.prev = 9;
24348
+ _context.t0 = _context["catch"](0);
24349
+ errorMessage = _context.t0.message;
24350
+ updateLayerResult({
24351
+ layerId: layerId,
24352
+ data: errorMessage,
24353
+ isLoading: false
24354
+ });
24355
+
24356
+ case 13:
24357
+ case "end":
24358
+ return _context.stop();
24359
+ }
24360
+ }
24361
+ }, _callee, null, [[0, 9]]);
24362
+ }));
24363
+ };
24364
+ /* Wait till the user has clicked the map. */
24365
+
24366
+
24367
+ React__default.useEffect(function () {
24368
+ if (mapLocationWasChanged.current !== false) {
24369
+ setInitialMapLocationIsChanged(true);
24370
+ }
24371
+
24372
+ mapLocationWasChanged.current = true;
24373
+ }, [mapPinLocation]);
24374
+ /* For each changed getfeature url string, load new data using WMS GetFeatureInfo */
24375
+
24376
+ React__default.useEffect(function () {
24377
+ if (isInitialMapLocationChanged && isOpen) {
24378
+ layerToUpdateList.forEach(function (_ref3) {
24379
+ var url = _ref3.url,
24380
+ layerId = _ref3.layerId;
24381
+ fetchLayerInfo(url, layerId);
24382
+ });
24383
+ } // eslint-disable-next-line react-hooks/exhaustive-deps
24384
+
24385
+ }, [debouncedlayerListString]);
24386
+ var hasLayers = layers && layers.length > 0;
24387
+ return /*#__PURE__*/React__default.createElement(ToolContainerDraggable, {
24388
+ startPosition: {
24389
+ right: 10,
24390
+ top: 80
24391
+ },
24392
+ minWidth: 300,
24393
+ onClose: onClose,
24394
+ title: showMapId ? "Event marker info ".concat(mapId) : 'Event marker info',
24395
+ headerSize: "small",
24396
+ initialMaxHeight: 440,
24397
+ isOpen: isOpen,
24398
+ "data-testid": "moveable-getfeatureinfo",
24399
+ bounds: "parent",
24400
+ onMouseDown: onMouseDown,
24401
+ order: order,
24402
+ source: source
24403
+ }, /*#__PURE__*/React__default.createElement(Box, {
24404
+ sx: {
24405
+ padding: 0
24406
+ }
24407
+ }, isOpen && hasLayers && isInitialMapLocationChanged && /*#__PURE__*/React__default.createElement(Box, {
24408
+ "data-testid": "GetFeatureInfoList"
24409
+ }, layerToUpdateList.map(function (layer) {
24410
+ var layerId = layer.layerId,
24411
+ title = layer.title,
24412
+ url = layer.url;
24413
+ var result = gfiResultMap.get(layerId);
24414
+ if (!result) return null;
24415
+ return /*#__PURE__*/React__default.createElement(Grid, {
24416
+ key: layerId,
24417
+ sx: {
24418
+ margin: '4px 6px 4px 6px',
24419
+ padding: '6px',
24420
+ backgroundColor: 'geowebColors.cards.cardContainer',
24421
+ border: 'solid 1px',
24422
+ borderColor: 'geowebColors.cards.cardContainerBorder'
24423
+ }
24424
+ }, /*#__PURE__*/React__default.createElement(Typography, {
24425
+ variant: "subtitle1"
24426
+ }, title, "\xA0", /*#__PURE__*/React__default.createElement(IconButton, {
24427
+ sx: {
24428
+ "float": 'right'
24429
+ },
24430
+ size: "small",
24431
+ "aria-label": "Open layer featureinfo in another page",
24432
+ onClick: function onClick() {
24433
+ window.open(url);
24434
+ }
24435
+ }, /*#__PURE__*/React__default.createElement(ExitDomain, null))), !result.isLoading ? /*#__PURE__*/React__default.createElement("div", {
24436
+ style: {
24437
+ fontSize: '11px',
24438
+ padding: '6px',
24439
+ margin: '0',
24440
+ fontFamily: 'Roboto,Helvetica,Arial,sans-serif',
24441
+ fontWeight: '400',
24442
+ lineHeight: '1.75',
24443
+ letterSpacing: '0.25px'
24444
+ },
24445
+ "data-testid": "layer-result-ready-".concat(layerId),
24446
+ // eslint-disable-next-line react/no-danger
24447
+ dangerouslySetInnerHTML: {
24448
+ __html: result.data.replace(/<hr\/>/g, '')
24449
+ }
24450
+ }) : /*#__PURE__*/React__default.createElement("div", {
24451
+ "data-testid": "layer-result-loading-".concat(layerId)
24452
+ }, /*#__PURE__*/React__default.createElement(CircularProgress, {
24453
+ "data-testid": "spinner",
24454
+ color: "inherit"
24455
+ })));
24456
+ })), hasLayers && !isInitialMapLocationChanged && /*#__PURE__*/React__default.createElement(Typography, {
24457
+ "data-testid": "click-on-map-for-info",
24458
+ variant: "subtitle1",
24459
+ sx: {
24460
+ padding: '10px'
24461
+ }
24462
+ }, "Click on the map for info."), !hasLayers && /*#__PURE__*/React__default.createElement(Typography, {
24463
+ "data-testid": "NoLayers",
24464
+ variant: "subtitle1",
24465
+ sx: {
24466
+ padding: '10px'
24467
+ }
24468
+ }, "No layers added to the map.")));
24469
+ };
24470
+
24471
+ /* *
24472
+ * Licensed under the Apache License, Version 2.0 (the "License");
24473
+ * you may not use this file except in compliance with the License.
24474
+ * You may obtain a copy of the License at
24475
+ *
24476
+ * http://www.apache.org/licenses/LICENSE-2.0
24477
+ *
24478
+ * Unless required by applicable law or agreed to in writing, software
24479
+ * distributed under the License is distributed on an "AS IS" BASIS,
24480
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
24481
+ * See the License for the specific language governing permissions and
24482
+ * limitations under the License.
24483
+ *
24484
+ * Copyright 2022 - Koninklijk Nederlands Meteorologisch Instituut (KNMI)
24485
+ * Copyright 2022 - Finnish Meteorological Institute (FMI)
24486
+ * */
24487
+
24488
+ var GetFeatureInfoConnect = function GetFeatureInfoConnect(_ref) {
24489
+ var _ref$showMapId = _ref.showMapId,
24490
+ showMapId = _ref$showMapId === void 0 ? false : _ref$showMapId,
24491
+ mapId = _ref.mapId;
24492
+ var dispatch = useDispatch();
24493
+ var getFeatureInfoType = "getfeatureinfo-".concat(mapId);
24494
+ var mapPinLocation = useSelector(function (store) {
24495
+ return getPinLocation(store, mapId);
24496
+ });
24497
+ var toggleMapPinIsVisible = React.useCallback(function (displayMapPin) {
24498
+ dispatch(mapActions$1.toggleMapPinIsVisible({
24499
+ mapId: mapId,
24500
+ displayMapPin: displayMapPin
24501
+ }));
24502
+ }, [dispatch, mapId]);
24503
+
24504
+ var enableMapPin = function enableMapPin() {
24505
+ dispatch(mapActions$1.setDisableMapPin({
24506
+ mapId: mapId,
24507
+ disableMapPin: false
24508
+ }));
24509
+ };
24510
+
24511
+ var mapLayers = useSelector(function (store) {
24512
+ return getMapLayers(store, mapId);
24513
+ });
24514
+
24515
+ var _useSetupDialog = useSetupDialog(getFeatureInfoType),
24516
+ dialogOrder = _useSetupDialog.dialogOrder,
24517
+ isDialogOpen = _useSetupDialog.isDialogOpen,
24518
+ uiSource = _useSetupDialog.uiSource,
24519
+ setDialogOrder = _useSetupDialog.setDialogOrder,
24520
+ onCloseDialog = _useSetupDialog.onCloseDialog;
24521
+
24522
+ React.useEffect(function () {
24523
+ toggleMapPinIsVisible(isDialogOpen);
24524
+
24525
+ if (isDialogOpen) {
24526
+ enableMapPin();
24527
+ }
24528
+ /* Do not respond on changes of isMapPinVisible, to allow other components to open/close the mappin. */
24529
+ // eslint-disable-next-line react-hooks/exhaustive-deps
24530
+
24531
+ }, [isDialogOpen, toggleMapPinIsVisible]);
24532
+ return /*#__PURE__*/React.createElement(GetFeatureInfoDialog, {
24533
+ layers: mapLayers,
24534
+ isOpen: isDialogOpen,
24535
+ onClose: onCloseDialog,
24536
+ mapId: mapId,
24537
+ showMapId: showMapId,
24538
+ onMouseDown: setDialogOrder,
24539
+ order: dialogOrder,
24540
+ source: uiSource,
24541
+ mapPinLocation: mapPinLocation
24542
+ });
24543
+ };
24544
+
24545
+ /* *
24546
+ * Licensed under the Apache License, Version 2.0 (the "License");
24547
+ * you may not use this file except in compliance with the License.
24548
+ * You may obtain a copy of the License at
24549
+ *
24550
+ * http://www.apache.org/licenses/LICENSE-2.0
24551
+ *
24552
+ * Unless required by applicable law or agreed to in writing, software
24553
+ * distributed under the License is distributed on an "AS IS" BASIS,
24554
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
24555
+ * See the License for the specific language governing permissions and
24556
+ * limitations under the License.
24557
+ *
24558
+ * Copyright 2022 - Koninklijk Nederlands Meteorologisch Instituut (KNMI)
24559
+ * Copyright 2022 - Finnish Meteorological Institute (FMI)
24560
+ * */
24561
+
24562
+ var GetFeatureInfoButtonConnect = function GetFeatureInfoButtonConnect(_ref) {
24563
+ var mapId = _ref.mapId,
24564
+ _ref$source = _ref.source,
24565
+ source = _ref$source === void 0 ? 'app' : _ref$source;
24566
+ var dispatch = useDispatch();
24567
+ var gfiType = "getfeatureinfo-".concat(mapId);
24568
+ var isOpenInStore = useSelector(function (store) {
24569
+ return getisDialogOpen(store, gfiType);
24570
+ });
24571
+ var openGfiDialog = React.useCallback(function () {
24572
+ dispatch(uiActions.setActiveMapIdForDialog({
24573
+ type: gfiType,
24574
+ mapId: mapId,
24575
+ setOpen: !isOpenInStore,
24576
+ source: source,
24577
+ origin: MapActionOrigin.map
24578
+ }));
24579
+ }, [mapId, dispatch, isOpenInStore, source, gfiType]);
24580
+ return /*#__PURE__*/React.createElement(MapControlButton, {
24581
+ title: "Get information for a specific location",
24582
+ "data-testid": "open-getfeatureinfo",
24583
+ onClick: openGfiDialog,
24584
+ isActive: isOpenInStore
24585
+ }, /*#__PURE__*/React.createElement(Info, null));
24586
+ };
24587
+
23918
24588
  var titleStyle = function titleStyle(theme) {
23919
24589
  return {
23920
24590
  position: 'absolute',
23921
24591
  padding: '5px',
23922
24592
  zIndex: 50,
23923
24593
  color: theme.palette.common.black,
23924
- whiteSpace: 'nowrap'
24594
+ whiteSpace: 'nowrap',
24595
+ userSelect: 'none'
23925
24596
  };
23926
24597
  };
23927
24598
 
@@ -23966,8 +24637,10 @@ var ConfigurableMapConnect = function ConfigurableMapConnect(_a) {
23966
24637
  shouldShowLayerManager = _a.shouldShowLayerManager,
23967
24638
  _a$showClock = _a.showClock,
23968
24639
  showClock = _a$showClock === void 0 ? true : _a$showClock,
24640
+ _a$displayGetFeatureI = _a.displayGetFeatureInfoButtonInMap,
24641
+ displayGetFeatureInfoButtonInMap = _a$displayGetFeatureI === void 0 ? false : _a$displayGetFeatureI,
23969
24642
  children = _a.children,
23970
- props = __rest(_a, ["id", "title", "layers", "shouldAutoUpdate", "shouldAnimate", "bbox", "srs", "shouldShowZoomControls", "displayMapPin", "showTimeSlider", "disableTimeSlider", "displayTimeInMap", "displayLayerManagerAndLegendButtonInMap", "displayDimensionSelectButtonInMap", "multiLegend", "shouldShowLayerManager", "showClock", "children"]);
24643
+ props = __rest(_a, ["id", "title", "layers", "shouldAutoUpdate", "shouldAnimate", "bbox", "srs", "shouldShowZoomControls", "displayMapPin", "showTimeSlider", "disableTimeSlider", "displayTimeInMap", "displayLayerManagerAndLegendButtonInMap", "displayDimensionSelectButtonInMap", "multiLegend", "shouldShowLayerManager", "showClock", "displayGetFeatureInfoButtonInMap", "children"]);
23971
24644
 
23972
24645
  var dispatch = useDispatch();
23973
24646
  var mapId = React__default.useRef(id || generateMapId()).current;
@@ -24033,6 +24706,8 @@ var ConfigurableMapConnect = function ConfigurableMapConnect(_a) {
24033
24706
  multiLegend: multiLegend
24034
24707
  }), displayDimensionSelectButtonInMap && /*#__PURE__*/React__default.createElement(MultiDimensionSelectMapButtonsConnect, {
24035
24708
  mapId: mapId
24709
+ }), displayGetFeatureInfoButtonInMap && /*#__PURE__*/React__default.createElement(GetFeatureInfoButtonConnect, {
24710
+ mapId: mapId
24036
24711
  })), !disableTimeSlider && /*#__PURE__*/React__default.createElement(Box, {
24037
24712
  sx: {
24038
24713
  position: 'absolute',
@@ -24055,6 +24730,9 @@ var ConfigurableMapConnect = function ConfigurableMapConnect(_a) {
24055
24730
  multiLegend: multiLegend
24056
24731
  }), showClock && /*#__PURE__*/React__default.createElement(TimeSliderClockConnect, {
24057
24732
  mapId: mapId
24733
+ }), displayGetFeatureInfoButtonInMap && /*#__PURE__*/React__default.createElement(GetFeatureInfoConnect, {
24734
+ showMapId: true,
24735
+ mapId: mapId
24058
24736
  }), /*#__PURE__*/React__default.createElement(DockedLayerManagerConnect, {
24059
24737
  mapId: mapId,
24060
24738
  bounds: "parent"
@@ -24392,7 +25070,8 @@ var componentsLookUp = function componentsLookUp(_ref) {
24392
25070
  var mapPreset = initialProps.mapPreset;
24393
25071
  return /*#__PURE__*/React__default.createElement(ConfigurableMapConnect, Object.assign({}, mapPreset, {
24394
25072
  id: id,
24395
- "data-testid": "coreConfigurableMapConnect"
25073
+ "data-testid": "coreConfigurableMapConnect",
25074
+ displayGetFeatureInfoButtonInMap: true
24396
25075
  }));
24397
25076
  }
24398
25077
 
@@ -25142,4 +25821,4 @@ var MapWarningProperties = function MapWarningProperties(_ref) {
25142
25821
  * */
25143
25822
  var mapActions = Object.assign(Object.assign(Object.assign({}, layerActions), mapActions$1), serviceActions);
25144
25823
 
25145
- export { ConfigurableMapConnect, CoreThemeProvider, CoreThemeStoreProvider, HarmonieTempAndPrecipPreset, LayerManagerConnect, LayerManagerMapButtonConnect, LayerSelectConnect, Legend, LegendConnect, LegendMapButtonConnect, MapControls, MapView, MapViewConnect, MapViewLayer, MapWarningProperties, MultiDimensionSelectMapButtonsConnect, MultiMapMultiDimensionSelectConnect as MultiMapDimensionSelectConnect, MultiMapViewConnect, ReactMapView, ReactMapViewLayer, SnackbarWrapperConnect, SyncGroupViewerConnect, index as SyncGroups, TimeSliderConnect, ZoomControlConnect, ZoomControls, componentsLookUp, coreModuleConfig, dateFormat, defaultBbox, defaultConfigurations, filterLayers, filterMapPresets, filterNonTimeDimensions, filterServices, generateLayerId, generateMapId, generateTimesliderId, getFirstTimeStepForLayerId, getInitialAppPresets, getLastTimeStepForLayerId, getNextTimeStepForLayerId, getPreviousTimeStepForLayerId, getWMJSDimensionForLayerAndDimension, getWMJSMapById, getWMJSTimeDimensionForLayerId, getWMLayerById, layerActions, reducer$6 as layerReducer, mapActions, moduleConfig as mapModuleConfig, selectors as mapSelectors, types$2 as mapTypes, utils as mapUtils, parseBoolean, parseLayer, publicLayers, publicServices, registerWMJSMap, registerWMLayer, snackbarActions, store, genericActions as syncGroupActions, synchronizationGroupConfig as synchronizationGroupModuleConfig, synchronizationGroupConfig as synchronizationGroupsConfig, testLayers, uiActions, uiModuleConfig, selectors$1 as uiSelectors, types as uiTypes, useSetupDialog };
25824
+ export { ConfigurableMapConnect, CoreThemeProvider, CoreThemeStoreProvider, DockedLayerManagerConnect, HarmonieTempAndPrecipPreset, LayerManagerConnect, LayerManagerMapButtonConnect, LayerSelectConnect, Legend, LegendConnect, LegendMapButtonConnect, MapControls, MapView, MapViewConnect, MapViewLayer, MapWarningProperties, MultiDimensionSelectMapButtonsConnect, MultiMapMultiDimensionSelectConnect as MultiMapDimensionSelectConnect, MultiMapViewConnect, ReactMapView, ReactMapViewLayer, SnackbarWrapperConnect, SyncGroupViewerConnect, index as SyncGroups, TimeSliderConnect, ZoomControlConnect, ZoomControls, componentsLookUp, coreModuleConfig, dateFormat, defaultBbox, defaultConfigurations, filterLayers, filterMapPresets, filterNonTimeDimensions, filterServices, generateLayerId, generateMapId, generateTimesliderId, getDrawFunctionFromStore, getFirstTimeStepForLayerId, getInitialAppPresets, getLastTimeStepForLayerId, getNextTimeStepForLayerId, getPreviousTimeStepForLayerId, getWMJSDimensionForLayerAndDimension, getWMJSMapById, getWMJSTimeDimensionForLayerId, getWMLayerById, layerActions, reducer$6 as layerReducer, selectors$2 as layerSelectors, types$3 as layerTypes, mapActions, moduleConfig as mapModuleConfig, selectors as mapSelectors, types$2 as mapTypes, utils as mapUtils, parseBoolean, parseLayer, publicLayers, publicServices, registerDrawFunction, registerWMJSMap, registerWMLayer, snackbarActions, store, genericActions as syncGroupActions, synchronizationGroupConfig as synchronizationGroupModuleConfig, synchronizationGroupConfig as synchronizationGroupsConfig, testLayers, TimeSliderUtils as timeSliderUtils, uiActions, uiModuleConfig, selectors$1 as uiSelectors, types as uiTypes, useSetupDialog };