@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.umd.js CHANGED
@@ -1,8 +1,8 @@
1
1
  (function (global, factory) {
2
- typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@reduxjs/toolkit'), require('immer'), require('moment'), require('react'), require('lodash'), require('redux-saga/effects'), require('react-redux'), require('@opengeoweb/shared'), require('@opengeoweb/theme'), require('@mui/material'), require('@opengeoweb/webmap'), require('react-sortablejs'), require('sortablejs'), require('@opengeoweb/form-fields'), require('react-hook-form'), require('react-window'), require('@mui/material/Box'), require('@mui/material/Typography'), require('@mui/material/Grid'), require('@mui/system'), require('throttle-debounce'), require('lodash.clonedeep'), require('proj4'), require('@turf/turf'), require('react-draggable'), require('re-resizable'), require('@redux-eggs/redux-toolkit'), require('@redux-eggs/saga-extension')) :
3
- typeof define === 'function' && define.amd ? define(['exports', '@reduxjs/toolkit', 'immer', 'moment', 'react', 'lodash', 'redux-saga/effects', 'react-redux', '@opengeoweb/shared', '@opengeoweb/theme', '@mui/material', '@opengeoweb/webmap', 'react-sortablejs', 'sortablejs', '@opengeoweb/form-fields', 'react-hook-form', 'react-window', '@mui/material/Box', '@mui/material/Typography', '@mui/material/Grid', '@mui/system', 'throttle-debounce', 'lodash.clonedeep', 'proj4', '@turf/turf', 'react-draggable', 're-resizable', '@redux-eggs/redux-toolkit', '@redux-eggs/saga-extension'], factory) :
4
- (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.Core = {}, global.toolkit, global.produce, global.moment, global.React, global._, global.effects, global.reactRedux, global.shared, global.theme, global.material, global.webmap, global.reactSortablejs, global.Sortable, global.formFields, global.reactHookForm, global.reactWindow, global.Box, global.Typography, global.Grid, global.system, global.throttleDebounce, global.cloneDeep, global.proj4, global.turf, global.Draggable, global.reResizable, global.reduxToolkit, global.sagaExtension));
5
- })(this, (function (exports, toolkit, produce, moment, React, _, effects, reactRedux, shared, theme, material, webmap, reactSortablejs, Sortable, formFields, reactHookForm, reactWindow, Box, Typography, Grid, system, throttleDebounce, cloneDeep, proj4, turf, Draggable, reResizable, reduxToolkit, sagaExtension) { 'use strict';
2
+ typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@reduxjs/toolkit'), require('immer'), require('moment'), require('react'), require('lodash'), require('redux-saga/effects'), require('react-redux'), require('@opengeoweb/shared'), require('@opengeoweb/theme'), require('@mui/material'), require('@opengeoweb/webmap'), require('react-sortablejs'), require('sortablejs'), require('@opengeoweb/form-fields'), require('react-hook-form'), require('react-window'), require('@mui/material/Box'), require('@mui/material/Typography'), require('@mui/material/Grid'), require('@mui/system'), require('throttle-debounce'), require('lodash.clonedeep'), require('proj4'), require('@turf/turf'), require('react-draggable'), require('re-resizable'), require('axios'), require('@opengeoweb/api'), require('@redux-eggs/redux-toolkit'), require('@redux-eggs/saga-extension')) :
3
+ typeof define === 'function' && define.amd ? define(['exports', '@reduxjs/toolkit', 'immer', 'moment', 'react', 'lodash', 'redux-saga/effects', 'react-redux', '@opengeoweb/shared', '@opengeoweb/theme', '@mui/material', '@opengeoweb/webmap', 'react-sortablejs', 'sortablejs', '@opengeoweb/form-fields', 'react-hook-form', 'react-window', '@mui/material/Box', '@mui/material/Typography', '@mui/material/Grid', '@mui/system', 'throttle-debounce', 'lodash.clonedeep', 'proj4', '@turf/turf', 'react-draggable', 're-resizable', 'axios', '@opengeoweb/api', '@redux-eggs/redux-toolkit', '@redux-eggs/saga-extension'], factory) :
4
+ (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.Core = {}, global.toolkit, global.produce, global.moment, global.React, global._, global.effects, global.reactRedux, global.shared, global.theme, global.material, global.webmap, global.reactSortablejs, global.Sortable, global.formFields, global.reactHookForm, global.reactWindow, global.Box, global.Typography, global.Grid, global.system, global.throttleDebounce, global.cloneDeep, global.proj4, global.turf, global.Draggable, global.reResizable, global.axios, global.api, global.reduxToolkit, global.sagaExtension));
5
+ })(this, (function (exports, toolkit, produce, moment, React, _, effects, reactRedux, shared, theme, material, webmap, reactSortablejs, Sortable, formFields, reactHookForm, reactWindow, Box, Typography, Grid, system, throttleDebounce, cloneDeep, proj4, turf, Draggable, reResizable, axios, api, reduxToolkit, sagaExtension) { 'use strict';
6
6
 
7
7
  function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
8
8
 
@@ -37,6 +37,7 @@
37
37
  var proj4__default = /*#__PURE__*/_interopDefaultLegacy(proj4);
38
38
  var turf__namespace = /*#__PURE__*/_interopNamespace(turf);
39
39
  var Draggable__default = /*#__PURE__*/_interopDefaultLegacy(Draggable);
40
+ var axios__default = /*#__PURE__*/_interopDefaultLegacy(axios);
40
41
 
41
42
  /*! *****************************************************************************
42
43
  Copyright (c) Microsoft Corporation.
@@ -211,6 +212,13 @@
211
212
  LayerActionOrigin["unregisterMapSaga"] = "unregisterMapSaga";
212
213
  })(LayerActionOrigin || (LayerActionOrigin = {}));
213
214
 
215
+ var types$3 = /*#__PURE__*/Object.freeze({
216
+ __proto__: null,
217
+ get LayerType () { return LayerType; },
218
+ get LayerStatus () { return LayerStatus; },
219
+ get LayerActionOrigin () { return LayerActionOrigin; }
220
+ });
221
+
214
222
  /* *
215
223
  * Licensed under the Apache License, Version 2.0 (the "License");
216
224
  * you may not use this file except in compliance with the License.
@@ -581,6 +589,14 @@
581
589
  */
582
590
  [2147483647, 0]);
583
591
  };
592
+ var getNextTimeStepvalue = function getNextTimeStepvalue(value, max) {
593
+ var newValue = value + 1;
594
+ return newValue > max ? max : newValue;
595
+ };
596
+ var getPreviousTimeStepvalue = function getPreviousTimeStepvalue(value, min) {
597
+ var newValue = value - 1;
598
+ return newValue < min ? min : newValue;
599
+ };
584
600
  var setPreviousTimeStep = function setPreviousTimeStep(timeStep, curTime, dataStartTime, onSetNewDate) {
585
601
  var prevTimeStep = moment__default["default"].utc(curTime).subtract(timeStep, 'm').toISOString();
586
602
 
@@ -607,43 +623,41 @@
607
623
 
608
624
  onsetNewDateDebounced(nextTimeStep, onSetNewDate);
609
625
  };
610
- var getTimeStepFromDataInterval = function getTimeStepFromDataInterval(timeInterval) {
611
- switch (timeInterval.isRegularInterval) {
612
- case false:
613
- switch (timeInterval.year) {
614
- case 0:
615
- // month
616
- return 30 * 24 * 60;
617
-
618
- default:
619
- return timeInterval.year * 365 * 24 * 60;
620
- }
621
-
622
- case true:
623
- if (timeInterval.day !== 0) {
624
- return timeInterval.day * 24 * 60;
625
- }
626
+ var getValueFromKeyboardEvent = function getValueFromKeyboardEvent(event, value, min, max, supportFourDirectionNavigation) {
627
+ if (supportFourDirectionNavigation === void 0) {
628
+ supportFourDirectionNavigation = false;
629
+ }
626
630
 
627
- if (timeInterval.hour !== 0) {
628
- return timeInterval.hour * 60;
629
- }
631
+ if (!supportFourDirectionNavigation) {
632
+ if (event.ctrlKey || event.metaKey) {
633
+ switch (event.key) {
634
+ case 'ArrowDown':
635
+ return getPreviousTimeStepvalue(value, min);
630
636
 
631
- if (timeInterval.minute !== 0) {
632
- return timeInterval.minute;
633
- }
637
+ case 'ArrowUp':
638
+ return getNextTimeStepvalue(value, max);
634
639
 
635
- if (timeInterval.second !== 0) {
636
- return timeInterval.second / 60.0;
640
+ default:
641
+ return null;
637
642
  }
643
+ }
644
+ } else {
645
+ // currently supportFourDirectionNavigation (left/right/up/down) is only used in horizontal slider TimeSliderScaleSlider
646
+ switch (event.key) {
647
+ case 'ArrowDown':
648
+ case 'ArrowLeft':
649
+ return getPreviousTimeStepvalue(value, min);
638
650
 
639
- return 5;
651
+ case 'ArrowUp':
652
+ case 'ArrowRight':
653
+ return getNextTimeStepvalue(value, max);
640
654
 
641
- default:
642
- return 5;
655
+ default:
656
+ return null;
657
+ }
643
658
  }
644
- };
645
- var getActiveLayerTimeStep = function getActiveLayerTimeStep(timeDimension) {
646
- return (timeDimension === null || timeDimension === void 0 ? void 0 : timeDimension.timeInterval) ? getTimeStepFromDataInterval(timeDimension.timeInterval) : null;
659
+
660
+ return null;
647
661
  };
648
662
  /**
649
663
  * This function calculates a suitable secondsPerpx value,
@@ -691,11 +705,39 @@
691
705
 
692
706
  return __assign(__assign({}, acc), (_b = {}, _b[v] = Number(k), _b));
693
707
  }, {});
708
+ /**
709
+ * This function creates and returns an array where there is secondsPerPx
710
+ * number of the data set added for a data scale (dataScaleToSecondsPerPx)
711
+ * to secondsPerPxToScale.
712
+ * @param dataScaleToSecondsPerPx
713
+ * @returns an array containing secondsPerPx numbers.
714
+ * The secondsPerPx number for a data scale is included
715
+ * contrary to secondsPerPxToScale.
716
+ */
717
+
718
+ var secondsPerPxValues = function secondsPerPxValues(dataScaleToSecondsPerPx) {
719
+ var sortedSecondsPerPx = __spreadArray([], __read(secondsPerPxToScale)).map(function (value) {
720
+ return Number(value[0]);
721
+ });
722
+
723
+ var full = __spreadArray(__spreadArray([], __read(sortedSecondsPerPx)), [dataScaleToSecondsPerPx]);
724
+
725
+ return full;
726
+ };
694
727
  var defaultDataScaleToSecondsPerPx = 43200;
695
728
  var getNewCenterOfFixedPointZoom = function getNewCenterOfFixedPointZoom(fixedTimePoint, oldSecondsPerPx, newSecondsPerPx, oldCenterTime) {
696
729
  var centerToFixedPointPx = (fixedTimePoint - oldCenterTime) / oldSecondsPerPx;
697
730
  return fixedTimePoint - centerToFixedPointPx * newSecondsPerPx;
698
731
  };
732
+ /**
733
+ * Move the time slider such that a given time point (timePoint)
734
+ * is at a given pixel width (timePointPx).
735
+ * @returns a new center time for the resulting position
736
+ */
737
+
738
+ var moveRelativeToTimePoint = function moveRelativeToTimePoint(timePoint, timePointPx, secondsPerPx, canvasWidth) {
739
+ return timePoint - secondsPerPx * (timePointPx - canvasWidth / 2);
740
+ };
699
741
  /** This reusable custom hook tells whether given pointer event targets current canvas node.
700
742
  * Example:
701
743
  *
@@ -732,6 +774,10 @@
732
774
  cornerRadius: 5,
733
775
  lineWidth: 1
734
776
  };
777
+ var AUTO_MOVE_AREA_PADDING = 1;
778
+ var getAutoMoveAreaWidth = function getAutoMoveAreaWidth(scale) {
779
+ return (scale === Scale.Year ? needleGeom.largeWidth : needleGeom.smallWidth) / 2 + AUTO_MOVE_AREA_PADDING;
780
+ };
735
781
  /** Reusable business logic for how to handle events that set time to now (closest).
736
782
  * Used in NowButton and TimeSliderLegend.
737
783
  */
@@ -751,6 +797,92 @@
751
797
  }
752
798
  }
753
799
  };
800
+ var TimeInMinutes;
801
+
802
+ (function (TimeInMinutes) {
803
+ TimeInMinutes[TimeInMinutes["YEAR"] = 525600] = "YEAR";
804
+ TimeInMinutes[TimeInMinutes["MONTH"] = 43800] = "MONTH";
805
+ TimeInMinutes[TimeInMinutes["DAY"] = 1440] = "DAY";
806
+ TimeInMinutes[TimeInMinutes["HOUR"] = 60] = "HOUR";
807
+ })(TimeInMinutes || (TimeInMinutes = {}));
808
+
809
+ var minutesToDescribedDuration = function minutesToDescribedDuration(minutes) {
810
+ var dateStr = '';
811
+ var time = minutes; // subtracting whole years/months/days from time duration and adding the amount to the string to be printed.
812
+
813
+ if (time >= TimeInMinutes.YEAR) {
814
+ var yearsInMintues = Math.floor(time / TimeInMinutes.YEAR);
815
+ dateStr += yearsInMintues + "y";
816
+ time -= yearsInMintues * TimeInMinutes.YEAR;
817
+ }
818
+
819
+ if (time >= TimeInMinutes.MONTH) {
820
+ var monthsInMinutes = Math.floor(time / TimeInMinutes.MONTH);
821
+ dateStr += monthsInMinutes + "m";
822
+ time -= monthsInMinutes * TimeInMinutes.MONTH;
823
+ }
824
+
825
+ if (time >= TimeInMinutes.DAY) {
826
+ var daysInMinutes = Math.floor(time / TimeInMinutes.DAY);
827
+ dateStr += daysInMinutes + "d";
828
+ time -= daysInMinutes * TimeInMinutes.DAY;
829
+ } // we will always print hour/minutes if there are any of them in the XX:XX format
830
+
831
+
832
+ if (time > 0) {
833
+ if (dateStr !== '') dateStr += ' ';
834
+ dateStr += Math.floor(time / TimeInMinutes.HOUR).toLocaleString(undefined, {
835
+ minimumIntegerDigits: 2,
836
+ useGrouping: false
837
+ }) + "h" + (time % TimeInMinutes.HOUR).toLocaleString(undefined, {
838
+ minimumIntegerDigits: 2,
839
+ useGrouping: false
840
+ }) + "min";
841
+ }
842
+
843
+ return dateStr;
844
+ };
845
+
846
+ var TimeSliderUtils = /*#__PURE__*/Object.freeze({
847
+ __proto__: null,
848
+ millisecondsInSecond: millisecondsInSecond,
849
+ defaultAnimationDelayAtStart: defaultAnimationDelayAtStart,
850
+ defaultDelay: defaultDelay,
851
+ defaultTimeStep: defaultTimeStep,
852
+ speedFactors: speedFactors,
853
+ getSpeedDelay: getSpeedDelay,
854
+ getSpeedFactor: getSpeedFactor,
855
+ getSelectedTime: getSelectedTime,
856
+ getTimeBounds: getTimeBounds,
857
+ getMomentTimeBounds: getMomentTimeBounds,
858
+ scalingCoefficient: scalingCoefficient,
859
+ timestampToPixelEdges: timestampToPixelEdges,
860
+ timestampToPixel: timestampToPixel,
861
+ pixelToTimestamp: pixelToTimestamp,
862
+ onsetNewDateDebounced: onsetNewDateDebounced,
863
+ roundWithTimeStep: roundWithTimeStep,
864
+ setNewRoundedTime: setNewRoundedTime,
865
+ getDataLimitsFromLayers: getDataLimitsFromLayers,
866
+ getNextTimeStepvalue: getNextTimeStepvalue,
867
+ getPreviousTimeStepvalue: getPreviousTimeStepvalue,
868
+ setPreviousTimeStep: setPreviousTimeStep,
869
+ setNextTimeStep: setNextTimeStep,
870
+ getValueFromKeyboardEvent: getValueFromKeyboardEvent,
871
+ getScaleToSecondsPerPxForDataScale: getScaleToSecondsPerPxForDataScale,
872
+ secondsPerPxToScale: secondsPerPxToScale,
873
+ scaleToSecondsPerPx: scaleToSecondsPerPx,
874
+ secondsPerPxValues: secondsPerPxValues,
875
+ defaultDataScaleToSecondsPerPx: defaultDataScaleToSecondsPerPx,
876
+ getNewCenterOfFixedPointZoom: getNewCenterOfFixedPointZoom,
877
+ moveRelativeToTimePoint: moveRelativeToTimePoint,
878
+ useCanvasTarget: useCanvasTarget,
879
+ needleGeom: needleGeom,
880
+ AUTO_MOVE_AREA_PADDING: AUTO_MOVE_AREA_PADDING,
881
+ getAutoMoveAreaWidth: getAutoMoveAreaWidth,
882
+ handleSetNowEvent: handleSetNowEvent,
883
+ get TimeInMinutes () { return TimeInMinutes; },
884
+ minutesToDescribedDuration: minutesToDescribedDuration
885
+ });
754
886
 
755
887
  var createMap = function createMap(_a) {
756
888
  var id = _a.id,
@@ -801,18 +933,12 @@
801
933
  isTimeSliderHoverOn = _w === void 0 ? false : _w,
802
934
  _x = _a.isTimeSliderVisible,
803
935
  isTimeSliderVisible = _x === void 0 ? true : _x,
804
- _y = _a.activeMapPresetId,
805
- activeMapPresetId = _y === void 0 ? null : _y,
806
- _z = _a.displayMapPin,
807
- displayMapPin = _z === void 0 ? false : _z,
808
- _0 = _a.disableMapPin,
809
- disableMapPin = _0 === void 0 ? false : _0,
810
- _1 = _a.shouldShowZoomControls,
811
- shouldShowZoomControls = _1 === void 0 ? true : _1,
812
- _2 = _a.dockedLayerManager,
813
- dockedLayerManager = _2 === void 0 ? {
814
- isOpen: false
815
- } : _2;
936
+ _y = _a.displayMapPin,
937
+ displayMapPin = _y === void 0 ? false : _y,
938
+ _z = _a.disableMapPin,
939
+ disableMapPin = _z === void 0 ? false : _z,
940
+ _0 = _a.shouldShowZoomControls,
941
+ shouldShowZoomControls = _0 === void 0 ? true : _0;
816
942
  return {
817
943
  id: id,
818
944
  isAnimating: isAnimating,
@@ -836,11 +962,9 @@
836
962
  isTimestepAuto: isTimestepAuto,
837
963
  isTimeSliderHoverOn: isTimeSliderHoverOn,
838
964
  isTimeSliderVisible: isTimeSliderVisible,
839
- activeMapPresetId: activeMapPresetId,
840
965
  displayMapPin: displayMapPin,
841
966
  disableMapPin: disableMapPin,
842
- shouldShowZoomControls: shouldShowZoomControls,
843
- dockedLayerManager: dockedLayerManager
967
+ shouldShowZoomControls: shouldShowZoomControls
844
968
  };
845
969
  };
846
970
  var checkValidLayersPayload = function checkValidLayersPayload(layers, mapId) {
@@ -980,6 +1104,44 @@
980
1104
  newArray.splice(indexNew, 0, newArray.splice(oldIndex, 1)[0]);
981
1105
  return newArray;
982
1106
  }
1107
+ var getTimeStepFromDataInterval = function getTimeStepFromDataInterval(timeInterval) {
1108
+ switch (timeInterval.isRegularInterval) {
1109
+ case false:
1110
+ switch (timeInterval.year) {
1111
+ case 0:
1112
+ // month
1113
+ return 30 * 24 * 60;
1114
+
1115
+ default:
1116
+ return timeInterval.year * 365 * 24 * 60;
1117
+ }
1118
+
1119
+ case true:
1120
+ if (timeInterval.day !== 0) {
1121
+ return timeInterval.day * 24 * 60;
1122
+ }
1123
+
1124
+ if (timeInterval.hour !== 0) {
1125
+ return timeInterval.hour * 60;
1126
+ }
1127
+
1128
+ if (timeInterval.minute !== 0) {
1129
+ return timeInterval.minute;
1130
+ }
1131
+
1132
+ if (timeInterval.second !== 0) {
1133
+ return timeInterval.second / 60.0;
1134
+ }
1135
+
1136
+ return 5;
1137
+
1138
+ default:
1139
+ return 5;
1140
+ }
1141
+ };
1142
+ var getActiveLayerTimeStep = function getActiveLayerTimeStep(timeDimension) {
1143
+ return (timeDimension === null || timeDimension === void 0 ? void 0 : timeDimension.timeInterval) ? getTimeStepFromDataInterval(timeDimension.timeInterval) : null;
1144
+ };
983
1145
 
984
1146
  var utils = /*#__PURE__*/Object.freeze({
985
1147
  __proto__: null,
@@ -989,7 +1151,9 @@
989
1151
  produceDraftStateSetWebMapDimension: produceDraftStateSetWebMapDimension,
990
1152
  findMapIdFromLayerId: findMapIdFromLayerId,
991
1153
  produceDraftStateSetMapDimensionFromLayerChangeDimension: produceDraftStateSetMapDimensionFromLayerChangeDimension,
992
- moveArrayElements: moveArrayElements
1154
+ moveArrayElements: moveArrayElements,
1155
+ getTimeStepFromDataInterval: getTimeStepFromDataInterval,
1156
+ getActiveLayerTimeStep: getActiveLayerTimeStep
993
1157
  });
994
1158
 
995
1159
  /* *
@@ -1551,6 +1715,17 @@
1551
1715
  var dimensionsAction = layerActions.layerSetDimensions(layerDimensions);
1552
1716
  var newState = layerDimensions === null ? intermediateState : reducer$6(intermediateState, dimensionsAction);
1553
1717
  return newState;
1718
+ },
1719
+ setSelectedFeature: function setSelectedFeature(draft, action) {
1720
+ var _a = action.payload,
1721
+ layerId = _a.layerId,
1722
+ selectedFeatureIndex = _a.selectedFeatureIndex;
1723
+
1724
+ if (!draft.byId[layerId]) {
1725
+ return;
1726
+ }
1727
+
1728
+ draft.byId[layerId].selectedFeatureIndex = selectedFeatureIndex;
1554
1729
  }
1555
1730
  },
1556
1731
  extraReducers: function extraReducers(builder) {
@@ -2154,17 +2329,6 @@
2154
2329
 
2155
2330
  draft.byId[mapId].animationEndTime = animationEndTime;
2156
2331
  },
2157
- setSelectedFeature: function setSelectedFeature(draft, action) {
2158
- var _a = action.payload,
2159
- mapId = _a.mapId,
2160
- selectedFeatureIndex = _a.selectedFeatureIndex;
2161
-
2162
- if (!draft.byId[mapId]) {
2163
- return;
2164
- }
2165
-
2166
- draft.byId[mapId].selectedFeatureIndex = selectedFeatureIndex;
2167
- },
2168
2332
  setAnimationDelay: function setAnimationDelay(draft, action) {
2169
2333
  var _a = action.payload,
2170
2334
  mapId = _a.mapId,
@@ -2333,41 +2497,6 @@
2333
2497
  }
2334
2498
 
2335
2499
  draft.byId[mapId].displayMapPin = displayMapPin;
2336
- },
2337
- setActiveMapPresetId: function setActiveMapPresetId(draft, action) {
2338
- var _a = action.payload,
2339
- mapId = _a.mapId,
2340
- presetId = _a.presetId;
2341
-
2342
- if (!draft.byId[mapId]) {
2343
- return;
2344
- }
2345
-
2346
- draft.byId[mapId].activeMapPresetId = presetId;
2347
- },
2348
- setHasMapPresetChanges: function setHasMapPresetChanges(draft, action) {
2349
- var _a = action.payload,
2350
- mapId = _a.mapId,
2351
- hasChanges = _a.hasChanges;
2352
-
2353
- if (!draft.byId[mapId]) {
2354
- return;
2355
- }
2356
-
2357
- draft.byId[mapId].hasMapPresetChanges = hasChanges;
2358
- },
2359
- toggleDockedLayerManager: function toggleDockedLayerManager(draft, action) {
2360
- var _a = action.payload,
2361
- mapId = _a.mapId,
2362
- openDockedLayerManager = _a.openDockedLayerManager;
2363
-
2364
- if (!draft.byId[mapId]) {
2365
- return;
2366
- }
2367
-
2368
- draft.byId[mapId].dockedLayerManager = {
2369
- isOpen: openDockedLayerManager
2370
- };
2371
2500
  }
2372
2501
  },
2373
2502
  extraReducers: function extraReducers(builder) {
@@ -2608,14 +2737,13 @@
2608
2737
  draft.byId[mapId].baseLayers = [];
2609
2738
  draft.byId[mapId].mapLayers = [];
2610
2739
  draft.byId[mapId].overLayers = [];
2611
- draft.byId[mapId].hasMapPresetChanges = false;
2612
2740
  draft.byId[mapId].isAutoUpdating = false;
2613
2741
  draft.byId[mapId].isAnimating = false;
2614
2742
  draft.byId[mapId].isTimeSliderVisible = true;
2615
2743
  draft.byId[mapId].isTimestepAuto = true;
2616
2744
  draft.byId[mapId].displayMapPin = false;
2617
2745
  draft.byId[mapId].shouldShowZoomControls = true;
2618
- draft.byId[mapId].timeStep = defaultTimeStep;
2746
+ draft.byId[mapId].timeStep = undefined;
2619
2747
  draft.byId[mapId].animationDelay = defaultAnimationDelayAtStart;
2620
2748
  }).addCase(uiActions.registerDialog, function (draft, action) {
2621
2749
  var _a = action.payload,
@@ -2732,7 +2860,7 @@
2732
2860
  * @returns {array} returnType: array - an array of all non-baselayers containing layer information (service, name, style, enabled etc.)
2733
2861
  */
2734
2862
 
2735
- toolkit.createSelector(getAllLayers, function (layers) {
2863
+ var getLayers = toolkit.createSelector(getAllLayers, function (layers) {
2736
2864
  return layers.filter(function (layer) {
2737
2865
  return layer.layerType !== LayerType.baseLayer && layer.layerType !== LayerType.overLayer;
2738
2866
  });
@@ -2745,7 +2873,7 @@
2745
2873
  * @returns {array} returnType: array - an array of all baselayers containing layer information (service, name, style, enabled etc.)
2746
2874
  */
2747
2875
 
2748
- toolkit.createSelector(getAllLayers, function (layers) {
2876
+ var getBaseLayers = toolkit.createSelector(getAllLayers, function (layers) {
2749
2877
  return layers.filter(function (layer) {
2750
2878
  return layer.layerType === LayerType.baseLayer;
2751
2879
  });
@@ -2758,7 +2886,7 @@
2758
2886
  * @returns {array} returnType: array - an array of all overLayers containing layer information (service, name, style, enabled etc.)
2759
2887
  */
2760
2888
 
2761
- toolkit.createSelector(getAllLayers, function (layers) {
2889
+ var getOverLayers = toolkit.createSelector(getAllLayers, function (layers) {
2762
2890
  return layers.filter(function (layer) {
2763
2891
  return layer.layerType === LayerType.overLayer;
2764
2892
  });
@@ -2887,7 +3015,7 @@
2887
3015
  * @returns {string} returnType: LayerStatus
2888
3016
  */
2889
3017
 
2890
- toolkit.createSelector(getLayerById, function (layer) {
3018
+ var getLayerStatus = toolkit.createSelector(getLayerById, function (layer) {
2891
3019
  return layer && layer.status ? layer.status : LayerStatus["default"];
2892
3020
  });
2893
3021
  /**
@@ -2915,6 +3043,68 @@
2915
3043
 
2916
3044
  return [];
2917
3045
  }, selectorMemoizationOptions);
3046
+ /**
3047
+ * Returns the selected geojson feature for the given layer
3048
+ *
3049
+ * Example const selectedFeature = getSelectedFeature(store, 'layerId1')
3050
+ * @param {object} store store: object - store object
3051
+ * @param {string} mapId layerId: string - Id of the layer
3052
+ * @returns {number} selectedFeatureIndex: the index of the selected geojson feature
3053
+ */
3054
+
3055
+ var getSelectedFeatureIndex = toolkit.createSelector(getLayerById, function (layer) {
3056
+ return layer === null || layer === void 0 ? void 0 : layer.selectedFeatureIndex;
3057
+ });
3058
+ /**
3059
+ * Gets layerIds that contain passed dimension
3060
+ *
3061
+ * Example: dimension = getDimensionLayerIds(store, 'elevation')
3062
+ * @param {object} store store: object - object from which the layers state will be extracted
3063
+ * @param {string} dimensionName dimensionName: string - name of dimension you want to retrieve the dimension data for
3064
+ * @returns {string[]} returnType: string[] - layerIds
3065
+ */
3066
+
3067
+ var getDimensionLayerIds = toolkit.createSelector(getLayersIds, getLayersById, function (_store, dimensionName) {
3068
+ return dimensionName;
3069
+ }, function (layerIds, layers, dimensionName) {
3070
+ return layerIds.reduce(function (list, layerId) {
3071
+ var layer = layers[layerId];
3072
+ var dimensions = (layer === null || layer === void 0 ? void 0 : layer.dimensions) ? layer.dimensions : [];
3073
+
3074
+ if (dimensions.find(function (dimension) {
3075
+ return dimension.name === dimensionName;
3076
+ })) {
3077
+ return list.concat(layerId);
3078
+ }
3079
+
3080
+ return list;
3081
+ }, []);
3082
+ }, selectorMemoizationOptions);
3083
+
3084
+ var selectors$2 = /*#__PURE__*/Object.freeze({
3085
+ __proto__: null,
3086
+ getLayerById: getLayerById,
3087
+ getLayersById: getLayersById,
3088
+ getLayersIds: getLayersIds,
3089
+ getAllLayers: getAllLayers,
3090
+ getLayersByMapId: getLayersByMapId,
3091
+ getLayers: getLayers,
3092
+ getBaseLayers: getBaseLayers,
3093
+ getOverLayers: getOverLayers,
3094
+ getLayerDimensions: getLayerDimensions,
3095
+ getLayerNonTimeDimensions: getLayerNonTimeDimensions,
3096
+ getLayerTimeDimension: getLayerTimeDimension,
3097
+ getLayerDimension: getLayerDimension,
3098
+ getLayerOpacity: getLayerOpacity,
3099
+ getLayerEnabled: getLayerEnabled,
3100
+ getLayerName: getLayerName,
3101
+ getLayerService: getLayerService,
3102
+ getLayerStyle: getLayerStyle,
3103
+ getLayerStatus: getLayerStatus,
3104
+ getAvailableBaseLayersForMap: getAvailableBaseLayersForMap,
3105
+ getSelectedFeatureIndex: getSelectedFeatureIndex,
3106
+ getDimensionLayerIds: getDimensionLayerIds
3107
+ });
2918
3108
 
2919
3109
  /* *
2920
3110
  * Licensed under the Apache License, Version 2.0 (the "License");
@@ -3866,7 +4056,12 @@
3866
4056
  */
3867
4057
 
3868
4058
  var getMapTimeStep = toolkit.createSelector(getMapById, function (store) {
3869
- return store ? store.timeStep : defaultTimeStep;
4059
+ var _a;
4060
+
4061
+ return (_a = store === null || store === void 0 ? void 0 : store.timeStep) !== null && _a !== void 0 ? _a : defaultTimeStep;
4062
+ });
4063
+ var getMapTimeStepWithoutDefault = toolkit.createSelector(getMapById, function (store) {
4064
+ return store === null || store === void 0 ? void 0 : store.timeStep;
3870
4065
  });
3871
4066
  /**
3872
4067
  * Returns the speed of animation
@@ -4113,7 +4308,7 @@
4113
4308
  return store ? store.disableMapPin : false;
4114
4309
  });
4115
4310
  /**
4116
- * Returns the diplay map pin boolean for the current map
4311
+ * Returns the display map pin boolean for the current map
4117
4312
  *
4118
4313
  * Example getDisplayMapPin(store);
4119
4314
  * @param {object} store store: object - store object
@@ -4124,30 +4319,6 @@
4124
4319
  var getDisplayMapPin = toolkit.createSelector(getMapById, function (store) {
4125
4320
  return store ? store.displayMapPin : false;
4126
4321
  });
4127
- /**
4128
- * Returns the selected geojson feature for the given map
4129
- *
4130
- * Example const selectedFeature = getSelectedFeature(store, 'mapId1')
4131
- * @param {object} store store: object - store object
4132
- * @param {string} mapId mapId: string - Id of the map
4133
- * @returns {number} selectedFeatureIndex: the index of the selected geojson feature
4134
- */
4135
-
4136
- var getSelectedFeatureIndex = toolkit.createSelector(getMapById, function (store) {
4137
- return store === null || store === void 0 ? void 0 : store.selectedFeatureIndex;
4138
- });
4139
- /**
4140
- * Returns the active map preset id
4141
- *
4142
- * Example getActiveMapPresetId(store, mapId);
4143
- * @param {object} store store: object - store object
4144
- * @param {string} mapId mapId: string - Id of the map
4145
- * @returns {boolean} returnType: boolean or undefined
4146
- */
4147
-
4148
- var getActiveMapPresetId = toolkit.createSelector(getMapById, function (store) {
4149
- return store ? store.activeMapPresetId : undefined;
4150
- });
4151
4322
  /**
4152
4323
  * Returns the legend id
4153
4324
  *
@@ -4213,31 +4384,40 @@
4213
4384
  });
4214
4385
  }, selectorMemoizationOptions);
4215
4386
  /**
4216
- * Returns the has changes state of the map preset
4387
+ * Gets all enabled layerIds for map
4217
4388
  *
4218
- * Example getHasMapPresetChanges(store, mapId);
4219
- * @param {object} store store: object - store object
4389
+ * Example: getMapLayerIdsEnabled = getLayerIdsEnabled(store, 'mapId_1')
4390
+ * @param {object} store store: object - store
4220
4391
  * @param {string} mapId mapId: string - Id of the map
4221
- * @returns {boolean} returnType: boolean
4392
+ * @returns {string[]} returnType: string[] - array of enabled layerIds
4222
4393
  */
4223
4394
 
4224
- var getHasMapPresetChanges = toolkit.createSelector(getMapById, function (store) {
4225
- return store && store.hasMapPresetChanges ? store.hasMapPresetChanges : false;
4226
- });
4395
+ var getMapLayerIdsEnabled = toolkit.createSelector(getLayerIds, getLayersById, function (mapLayerIds, layers) {
4396
+ return mapLayerIds.reduce(function (list, layerId) {
4397
+ if (layers[layerId] && layers[layerId].enabled) {
4398
+ return list.concat(layerId);
4399
+ }
4400
+
4401
+ return list;
4402
+ }, []);
4403
+ }, selectorMemoizationOptions);
4227
4404
  /**
4228
- * Returns whether the docked layer manager is open
4405
+ * Returns if a map dimension is used for any enabled layers on that map
4229
4406
  *
4230
- * Example getIsDockedLayerManagerOpen(store, mapId);
4407
+ * Example getIsEnabledLayersForMapDimension(store, mapId);
4231
4408
  * @param {object} store store: object - store object
4232
4409
  * @param {string} mapId mapId: string - Id of the map
4410
+ * @param {string} dimensionName dimensionName: string - name of the dimension
4233
4411
  * @returns {Boolean} returnType: boolean
4234
4412
  */
4235
4413
 
4236
- var getIsDockedLayerManagerOpen = toolkit.createSelector(getMapById, function (store) {
4237
- var _a;
4238
-
4239
- return (_a = store === null || store === void 0 ? void 0 : store.dockedLayerManager) === null || _a === void 0 ? void 0 : _a.isOpen;
4240
- });
4414
+ var getIsEnabledLayersForMapDimension = toolkit.createSelector(getMapLayerIdsEnabled, function (store, _mapId, dimensionName) {
4415
+ return getDimensionLayerIds(store, dimensionName);
4416
+ }, function (enabledMapLayerIds, dimensionLayerIds) {
4417
+ return dimensionLayerIds.some(function (layerId) {
4418
+ return enabledMapLayerIds.includes(layerId);
4419
+ });
4420
+ }, selectorMemoizationOptions);
4241
4421
 
4242
4422
  var selectors = /*#__PURE__*/Object.freeze({
4243
4423
  __proto__: null,
@@ -4264,6 +4444,7 @@
4264
4444
  getActiveLayerId: getActiveLayerId,
4265
4445
  getMapTimeSliderScale: getMapTimeSliderScale,
4266
4446
  getMapTimeStep: getMapTimeStep,
4447
+ getMapTimeStepWithoutDefault: getMapTimeStepWithoutDefault,
4267
4448
  getMapAnimationDelay: getMapAnimationDelay,
4268
4449
  getMapTimeSliderCenterTime: getMapTimeSliderCenterTime,
4269
4450
  getTimeSliderUnfilteredSelectedTime: getTimeSliderUnfilteredSelectedTime,
@@ -4282,12 +4463,10 @@
4282
4463
  getPinLocation: getPinLocation,
4283
4464
  getDisableMapPin: getDisableMapPin,
4284
4465
  getDisplayMapPin: getDisplayMapPin,
4285
- getSelectedFeatureIndex: getSelectedFeatureIndex,
4286
- getActiveMapPresetId: getActiveMapPresetId,
4287
4466
  getLegendId: getLegendId,
4288
4467
  getMapPreset: getMapPreset,
4289
- getHasMapPresetChanges: getHasMapPresetChanges,
4290
- getIsDockedLayerManagerOpen: getIsDockedLayerManagerOpen
4468
+ getMapLayerIdsEnabled: getMapLayerIdsEnabled,
4469
+ getIsEnabledLayersForMapDimension: getIsEnabledLayersForMapDimension
4291
4470
  });
4292
4471
 
4293
4472
  var DialogTypes;
@@ -4302,6 +4481,7 @@
4302
4481
  DialogTypes["DimensionSelectElevation"] = "dimensionSelect-elevation";
4303
4482
  DialogTypes["LayerManager"] = "layerManager";
4304
4483
  DialogTypes["LayerSelect"] = "layerSelect";
4484
+ DialogTypes["DockedLayerManager"] = "dockedLayerManager";
4305
4485
  })(DialogTypes || (DialogTypes = {}));
4306
4486
 
4307
4487
  var types = /*#__PURE__*/Object.freeze({
@@ -4332,6 +4512,47 @@
4332
4512
  FilterType["Group"] = "groups";
4333
4513
  })(FilterType || (FilterType = {}));
4334
4514
 
4515
+ /* *
4516
+ * Licensed under the Apache License, Version 2.0 (the "License");
4517
+ * you may not use this file except in compliance with the License.
4518
+ * You may obtain a copy of the License at
4519
+ *
4520
+ * http://www.apache.org/licenses/LICENSE-2.0
4521
+ *
4522
+ * Unless required by applicable law or agreed to in writing, software
4523
+ * distributed under the License is distributed on an "AS IS" BASIS,
4524
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
4525
+ * See the License for the specific language governing permissions and
4526
+ * limitations under the License.
4527
+ *
4528
+ * Copyright 2022 - Koninklijk Nederlands Meteorologisch Instituut (KNMI)
4529
+ * Copyright 2022 - Finnish Meteorological Institute (FMI)
4530
+ * */
4531
+ var getFilterId = function getFilterId(filterType, filterName) {
4532
+ return filterType + "-" + filterName;
4533
+ };
4534
+ var produceFilters = function produceFilters(filterNames, filterType, draft, layerSelectFilterAdapter) {
4535
+ filterNames.forEach(function (filterName) {
4536
+ var id = getFilterId(filterType, filterName);
4537
+
4538
+ if (!draft.filters.filters.entities[id]) {
4539
+ // If this filter doesn't exit yet, add it
4540
+ layerSelectFilterAdapter.addOne(draft.filters.filters, {
4541
+ id: id,
4542
+ name: filterName,
4543
+ amount: 1,
4544
+ amountVisible: 1,
4545
+ checked: true,
4546
+ type: filterType
4547
+ });
4548
+ } else {
4549
+ // If it exists already, up the amounts
4550
+ draft.filters.filters.entities[id].amount += 1;
4551
+ draft.filters.filters.entities[id].amountVisible += 1;
4552
+ }
4553
+ });
4554
+ };
4555
+
4335
4556
  /* *
4336
4557
  * Licensed under the Apache License, Version 2.0 (the "License");
4337
4558
  * you may not use this file except in compliance with the License.
@@ -4348,17 +4569,13 @@
4348
4569
  * Copyright 2021 - Koninklijk Nederlands Meteorologisch Instituut (KNMI)
4349
4570
  * Copyright 2021 - Finnish Meteorological Institute (FMI)
4350
4571
  * */
4572
+ var layerSelectFilterAdapter = toolkit.createEntityAdapter();
4573
+ var layerSelectActiveServicesAdapter = toolkit.createEntityAdapter();
4351
4574
  var initialState$1 = {
4352
4575
  filters: {
4353
4576
  searchFilter: '',
4354
- activeServices: {
4355
- byId: {},
4356
- allIds: []
4357
- },
4358
- filters: {
4359
- byId: {},
4360
- allIds: []
4361
- }
4577
+ activeServices: layerSelectActiveServicesAdapter.getInitialState(),
4578
+ filters: layerSelectFilterAdapter.getInitialState()
4362
4579
  },
4363
4580
  allServicesEnabled: true,
4364
4581
  activeLayerInfo: {
@@ -4382,66 +4599,68 @@
4382
4599
  draft.allServicesEnabled = allServicesEnabled;
4383
4600
  },
4384
4601
  addFiltersAndActiveServices: function addFiltersAndActiveServices(draft, action) {
4385
- var _a = action.payload,
4386
- serviceId = _a.serviceId,
4387
- serviceName = _a.serviceName,
4388
- serviceUrl = _a.serviceUrl,
4389
- _abstract = _a["abstract"],
4390
- keywords = _a.keywords,
4391
- scope = _a.scope,
4392
- groups = _a.groups;
4393
-
4394
- if (!draft.filters.activeServices.byId[serviceId]) {
4395
- draft.filters.activeServices.byId[serviceId] = {};
4396
-
4397
- var addFilters = function addFilters(filterNames, filterType) {
4398
- filterNames.forEach(function (filterName) {
4399
- var id = filterType + "-" + filterName;
4400
-
4401
- if (!draft.filters.filters.byId[id]) {
4402
- draft.filters.filters.byId[id] = {
4403
- id: id,
4404
- name: filterName,
4405
- amount: 1,
4406
- amountVisible: 1,
4407
- checked: true,
4408
- type: filterType
4409
- };
4410
- draft.filters.filters.allIds.push(id);
4411
- } else {
4412
- draft.filters.filters.byId[id].amount += 1;
4413
- draft.filters.filters.byId[id].amountVisible += 1;
4414
- }
4415
- });
4602
+ var _a, _b;
4603
+
4604
+ var _c = action.payload,
4605
+ serviceId = _c.serviceId,
4606
+ serviceName = _c.serviceName,
4607
+ serviceUrl = _c.serviceUrl,
4608
+ _abstract = _c["abstract"],
4609
+ keywords = _c.keywords,
4610
+ scope = _c.scope,
4611
+ groups = _c.groups,
4612
+ isLoading = _c.isLoading;
4613
+
4614
+ if (isLoading) {
4615
+ // If service is still loading, add without filters
4616
+ draft.filters.activeServices.entities[serviceId] = {
4617
+ serviceId: serviceId,
4618
+ enabled: draft.allServicesEnabled,
4619
+ filterIds: [],
4620
+ scope: scope,
4621
+ serviceName: serviceName,
4622
+ serviceUrl: serviceUrl,
4623
+ "abstract": _abstract,
4624
+ isLoading: isLoading
4416
4625
  };
4626
+ }
4417
4627
 
4418
- addFilters(groups, FilterType.Group);
4419
- addFilters(keywords, FilterType.Keyword);
4628
+ if (!isLoading) {
4629
+ // If service is done loading, add with filters
4630
+ if (!((_b = (_a = draft.filters.activeServices.entities[serviceId]) === null || _a === void 0 ? void 0 : _a.filterIds) === null || _b === void 0 ? void 0 : _b.length)) {
4631
+ // If the service has no filters yet, add them
4632
+ produceFilters(groups, FilterType.Group, draft, layerSelectFilterAdapter);
4633
+ produceFilters(keywords, FilterType.Keyword, draft, layerSelectFilterAdapter);
4634
+ }
4635
+
4636
+ var filterIds = groups.map(function (group) {
4637
+ return getFilterId(FilterType.Group, group);
4638
+ }).concat(keywords.map(function (keyword) {
4639
+ return getFilterId(FilterType.Keyword, keyword);
4640
+ }));
4641
+ draft.filters.activeServices.entities[serviceId] = {
4642
+ serviceId: serviceId,
4643
+ enabled: draft.allServicesEnabled,
4644
+ filterIds: filterIds,
4645
+ scope: scope,
4646
+ serviceName: serviceName,
4647
+ serviceUrl: serviceUrl,
4648
+ "abstract": _abstract,
4649
+ isLoading: isLoading
4650
+ };
4420
4651
  }
4421
4652
 
4422
- var filterIds = groups.map(function (group) {
4423
- return FilterType.Group + "-" + group;
4424
- }).concat(keywords.map(function (keyword) {
4425
- return FilterType.Keyword + "-" + keyword;
4426
- }));
4427
- draft.filters.activeServices.byId[serviceId] = {
4428
- serviceId: serviceId,
4429
- enabled: draft.allServicesEnabled,
4430
- filterIds: filterIds,
4431
- scope: scope,
4432
- serviceName: serviceName,
4433
- serviceUrl: serviceUrl,
4434
- "abstract": _abstract
4435
- };
4436
- if (!draft.filters.activeServices.allIds.includes(serviceId)) draft.filters.activeServices.allIds.push(serviceId);
4653
+ if (!draft.filters.activeServices.ids.includes(serviceId)) {
4654
+ draft.filters.activeServices.ids.push(serviceId);
4655
+ }
4437
4656
  },
4438
4657
  layerSelectRemoveService: function layerSelectRemoveService(draft, action) {
4439
4658
  var serviceId = action.payload.serviceId; // 1. Find a service that is to be removed
4440
4659
 
4441
- var foundService = draft.filters.activeServices.byId[serviceId]; // 2. Go through all keywords for removed service, and decrement the amount of all found keywords
4660
+ var foundService = draft.filters.activeServices.entities[serviceId]; // 2. Go through all keywords for removed service, and decrement the amount of all found keywords
4442
4661
 
4443
4662
  foundService.filterIds.forEach(function (filterId) {
4444
- var foundObject = draft.filters.filters.byId[filterId];
4663
+ var foundObject = draft.filters.filters.entities[filterId];
4445
4664
 
4446
4665
  if (foundObject && foundObject.amount) {
4447
4666
  foundObject.amount -= 1;
@@ -4449,17 +4668,14 @@
4449
4668
  }
4450
4669
 
4451
4670
  if (foundObject && foundObject.amount === 0) {
4452
- delete draft.filters.filters.byId[filterId];
4453
- draft.filters.filters.allIds = draft.filters.filters.allIds.filter(function (serviceId) {
4671
+ delete draft.filters.filters.entities[filterId];
4672
+ draft.filters.filters.ids = draft.filters.filters.ids.filter(function (serviceId) {
4454
4673
  return serviceId !== filterId;
4455
4674
  });
4456
4675
  }
4457
4676
  }); // Finally remove object from activeServices, so if the service is added again later on, new object and keywords will be re-added
4458
4677
 
4459
- delete draft.filters.activeServices.byId[serviceId];
4460
- draft.filters.activeServices.allIds = draft.filters.activeServices.allIds.filter(function (id) {
4461
- return id !== serviceId;
4462
- });
4678
+ layerSelectActiveServicesAdapter.removeOne(draft.filters.activeServices, serviceId);
4463
4679
  },
4464
4680
  enableActiveService: function enableActiveService(draft, action) {
4465
4681
  var e_1, _a;
@@ -4467,12 +4683,12 @@
4467
4683
  var _b = action.payload,
4468
4684
  serviceId = _b.serviceId,
4469
4685
  keywords = _b.filters;
4470
- draft.filters.activeServices.byId[serviceId].enabled = true;
4686
+ draft.filters.activeServices.entities[serviceId].enabled = true;
4471
4687
 
4472
4688
  try {
4473
4689
  for (var keywords_1 = __values(keywords), keywords_1_1 = keywords_1.next(); !keywords_1_1.done; keywords_1_1 = keywords_1.next()) {
4474
4690
  var keyword = keywords_1_1.value;
4475
- draft.filters.filters.byId[keyword].amountVisible += 1;
4691
+ draft.filters.filters.entities[keyword].amountVisible += 1;
4476
4692
  }
4477
4693
  } catch (e_1_1) {
4478
4694
  e_1 = {
@@ -4492,12 +4708,12 @@
4492
4708
  var _b = action.payload,
4493
4709
  serviceId = _b.serviceId,
4494
4710
  keywords = _b.filters;
4495
- draft.filters.activeServices.byId[serviceId].enabled = false;
4711
+ draft.filters.activeServices.entities[serviceId].enabled = false;
4496
4712
 
4497
4713
  try {
4498
4714
  for (var keywords_2 = __values(keywords), keywords_2_1 = keywords_2.next(); !keywords_2_1.done; keywords_2_1 = keywords_2.next()) {
4499
4715
  var keyword = keywords_2_1.value;
4500
- draft.filters.filters.byId[keyword].amountVisible -= 1;
4716
+ draft.filters.filters.entities[keyword].amountVisible -= 1;
4501
4717
  }
4502
4718
  } catch (e_2_1) {
4503
4719
  e_2 = {
@@ -4514,15 +4730,15 @@
4514
4730
  toggleFilter: function toggleFilter(draft, action) {
4515
4731
  var filterIds = action.payload.filterIds;
4516
4732
  filterIds.forEach(function (filterId) {
4517
- draft.filters.filters.byId[filterId].checked = !draft.filters.filters.byId[filterId].checked;
4733
+ draft.filters.filters.entities[filterId].checked = !draft.filters.filters.entities[filterId].checked;
4518
4734
  });
4519
4735
  },
4520
4736
  enableOnlyOneFilter: function enableOnlyOneFilter(draft, action) {
4521
4737
  var filterId = action.payload.filterId;
4522
- draft.filters.filters.allIds.forEach(function (filterId) {
4523
- draft.filters.filters.byId[filterId].checked = false;
4738
+ draft.filters.filters.ids.forEach(function (filterId) {
4739
+ draft.filters.filters.entities[filterId].checked = false;
4524
4740
  });
4525
- draft.filters.filters.byId[filterId].checked = true;
4741
+ draft.filters.filters.entities[filterId].checked = true;
4526
4742
  },
4527
4743
  setActiveLayerInfo: function setActiveLayerInfo(draft, action) {
4528
4744
  var layer = action.payload.layer;
@@ -4618,21 +4834,30 @@
4618
4834
 
4619
4835
 
4620
4836
  var getSearchFilter = toolkit.createSelector(layerSelectStore, function (store) {
4621
- return store ? store.filters.searchFilter : '';
4837
+ var _a;
4838
+
4839
+ return ((_a = store === null || store === void 0 ? void 0 : store.filters) === null || _a === void 0 ? void 0 : _a.searchFilter) || '';
4622
4840
  });
4623
4841
  /**
4624
4842
  * Returns active services array
4625
4843
  *
4626
4844
  * Example getActiveServices(store);
4627
4845
  * @param {object} store store: object - store object
4628
- * @returns {object} returnType: object of active services
4846
+ * @returns {ActiveServiceObjectEntities} returnType: ActiveServiceObjectEntitiesobject of active services
4629
4847
  */
4848
+ // cast to usable type - selectEntities returns Dictionary<ActiveServiceObject> which is not usable inside of the code
4630
4849
 
4631
- var getActiveServices = toolkit.createSelector(layerSelectStore, function (store) {
4632
- var _a;
4850
+ var getActiveServices = function getActiveServices(store) {
4851
+ return getActiveServicesDictionary(store);
4852
+ };
4853
+ var getActiveServicesDictionary = layerSelectActiveServicesAdapter.getSelectors(function (store) {
4854
+ var _a, _b;
4633
4855
 
4634
- return store ? (_a = store === null || store === void 0 ? void 0 : store.filters) === null || _a === void 0 ? void 0 : _a.activeServices.byId : {};
4635
- }, selectorMemoizationOptions);
4856
+ 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) || {
4857
+ entities: {},
4858
+ ids: []
4859
+ };
4860
+ }).selectEntities;
4636
4861
  /**
4637
4862
  * Returns active services by id
4638
4863
  *
@@ -4643,9 +4868,9 @@
4643
4868
  */
4644
4869
 
4645
4870
  var getActiveServiceById = function getActiveServiceById(store, serviceId) {
4646
- var _a, _b;
4871
+ var _a, _b, _c;
4647
4872
 
4648
- 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]) || {};
4873
+ 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]) || {};
4649
4874
  return enabledServices;
4650
4875
  };
4651
4876
  /**
@@ -4659,10 +4884,10 @@
4659
4884
  var getEnabledServiceIds = toolkit.createSelector(layerSelectStore, function (store) {
4660
4885
  var _a, _b;
4661
4886
 
4662
- 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) {
4663
- var _a;
4887
+ 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) {
4888
+ var _a, _b, _c;
4664
4889
 
4665
- return (_a = store === null || store === void 0 ? void 0 : store.filters) === null || _a === void 0 ? void 0 : _a.activeServices.byId[serviceId].enabled;
4890
+ 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;
4666
4891
  })) !== null && _b !== void 0 ? _b : [];
4667
4892
  return enabledServices;
4668
4893
  }, selectorMemoizationOptions);
@@ -4675,17 +4900,17 @@
4675
4900
  */
4676
4901
 
4677
4902
  var getCheckedFilterIds = toolkit.createSelector(layerSelectStore, function (store) {
4678
- var _a, _b;
4903
+ var _a, _b, _c;
4679
4904
 
4680
- 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) {
4681
- var _a, _b;
4905
+ 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) {
4906
+ var _a, _b, _c;
4682
4907
 
4683
- 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;
4684
- })) !== null && _b !== void 0 ? _b : [];
4908
+ 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;
4909
+ })) !== null && _c !== void 0 ? _c : [];
4685
4910
  return checkedFilters.map(function (filterId) {
4686
- var _a;
4911
+ var _a, _b, _c;
4687
4912
 
4688
- return (_a = store === null || store === void 0 ? void 0 : store.filters) === null || _a === void 0 ? void 0 : _a.filters.byId[filterId].id;
4913
+ 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;
4689
4914
  });
4690
4915
  }, selectorMemoizationOptions);
4691
4916
  /**
@@ -4695,12 +4920,19 @@
4695
4920
  * @param {object} store store: object - store object
4696
4921
  * @returns {array} returnType: array of all keyword ids
4697
4922
  */
4923
+ // cast to usable type - selectIds returns EntityId[] which is not usable inside of the code
4698
4924
 
4699
- var getAllFilterIds = toolkit.createSelector(layerSelectStore, function (store) {
4925
+ var getAllFilterIds = function getAllFilterIds(store) {
4926
+ return getAllFilterIdsEntity(store);
4927
+ };
4928
+ var getAllFilterIdsEntity = layerSelectFilterAdapter.getSelectors(function (store) {
4700
4929
  var _a, _b;
4701
4930
 
4702
- 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 : [];
4703
- }, selectorMemoizationOptions);
4931
+ 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) || {
4932
+ entities: {},
4933
+ ids: []
4934
+ };
4935
+ }).selectIds;
4704
4936
  /**
4705
4937
  * Returns all filters
4706
4938
  *
@@ -4709,15 +4941,14 @@
4709
4941
  * @returns {array} returnType: array of all filters
4710
4942
  */
4711
4943
 
4712
- var getAllFilters = toolkit.createSelector(layerSelectStore, function (store) {
4713
- var filters = store === null || store === void 0 ? void 0 : store.filters.filters.byId;
4714
-
4715
- if (filters) {
4716
- return Object.values(filters);
4717
- }
4944
+ var getAllFilters = layerSelectFilterAdapter.getSelectors(function (store) {
4945
+ var _a, _b;
4718
4946
 
4719
- return [];
4720
- });
4947
+ 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) || {
4948
+ entities: {},
4949
+ ids: []
4950
+ };
4951
+ }).selectAll;
4721
4952
  /**
4722
4953
  * Returns if all keywords are checked
4723
4954
  *
@@ -4729,12 +4960,29 @@
4729
4960
  var isAllFiltersChecked = toolkit.createSelector(layerSelectStore, function (store) {
4730
4961
  var _a, _b;
4731
4962
 
4732
- 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) {
4963
+ 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) {
4733
4964
  var _a, _b, _c;
4734
4965
 
4735
- 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;
4966
+ 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;
4736
4967
  });
4737
4968
  });
4969
+ /**
4970
+ * Gets a KeywordObject by its id
4971
+ *
4972
+ * Example: keywordObject = getKeywordObjectById(store, 'keywordId')
4973
+ * @param {object} store object from which the keyword state will be extracted
4974
+ * @param {string} filterId Id of the keyword
4975
+ * @returns {object} object containing keyword information (id, amount, amountVisible, checked)
4976
+ */
4977
+
4978
+ layerSelectFilterAdapter.getSelectors(function (store) {
4979
+ var _a, _b;
4980
+
4981
+ 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) || {
4982
+ entities: {},
4983
+ ids: []
4984
+ };
4985
+ }).selectById;
4738
4986
  /**
4739
4987
  * Returns the active layer info
4740
4988
  *
@@ -7917,12 +8165,12 @@
7917
8165
  });
7918
8166
  }
7919
8167
  function setLayerDimensionsSaga(_a) {
7920
- var layerDimensions, dimensions, layerId, layer, newTimeDimension, mapId, activeLayerId, shouldAutoUpdate, prevTimeDimension, isAnimating$1, webmapInstance, error_1;
8168
+ var layerDimensions, dimensions, layerId, layer, newTimeDimension, mapId, activeLayerId, shouldAutoUpdate, prevTimeDimension, isAnimating$1, webmapInstance, isActiveLayer, timeStep, newTimeStep, error_1;
7921
8169
  var payload = _a.payload;
7922
8170
  return __generator(this, function (_b) {
7923
8171
  switch (_b.label) {
7924
8172
  case 0:
7925
- _b.trys.push([0, 12,, 13]);
8173
+ _b.trys.push([0, 15,, 16]);
7926
8174
 
7927
8175
  layerDimensions = payload.layerDimensions;
7928
8176
  if (!layerDimensions) return [2
@@ -7967,13 +8215,40 @@
7967
8215
  case 5:
7968
8216
  isAnimating$1 = _b.sent();
7969
8217
  webmapInstance = getWMJSMapById(mapId);
7970
- if (!(layerId === activeLayerId && // only update the active layer
8218
+ isActiveLayer = layerId === activeLayerId;
8219
+ return [4
8220
+ /*yield*/
8221
+ , effects.select(getMapTimeStepWithoutDefault, mapId)];
8222
+
8223
+ case 6:
8224
+ timeStep = _b.sent();
8225
+ if (!(isActiveLayer && timeStep === undefined && newTimeDimension)) return [3
8226
+ /*break*/
8227
+ , 8];
8228
+ newTimeStep = getActiveLayerTimeStep(newTimeDimension);
8229
+ if (!newTimeStep) return [3
8230
+ /*break*/
8231
+ , 8];
8232
+ return [4
8233
+ /*yield*/
8234
+ , effects.put(mapActions$1.setTimeStep({
8235
+ mapId: mapId,
8236
+ timeStep: newTimeStep
8237
+ }))];
8238
+
8239
+ case 7:
8240
+ _b.sent();
8241
+
8242
+ _b.label = 8;
8243
+
8244
+ case 8:
8245
+ if (!(isActiveLayer && // only update the active layer
7971
8246
  shouldAutoUpdate && newTimeDimension && newTimeDimension.maxValue && prevTimeDimension && prevTimeDimension.currentValue && prevTimeDimension.currentValue !== newTimeDimension.maxValue)) return [3
7972
8247
  /*break*/
7973
- , 9];
8248
+ , 12];
7974
8249
  if (!!isAnimating$1) return [3
7975
8250
  /*break*/
7976
- , 7];
8251
+ , 10];
7977
8252
  return [4
7978
8253
  /*yield*/
7979
8254
  , effects.put(layerActions.layerChangeDimension({
@@ -7985,50 +8260,50 @@
7985
8260
  }
7986
8261
  }))];
7987
8262
 
7988
- case 6:
8263
+ case 9:
7989
8264
  _b.sent();
7990
8265
 
7991
- _b.label = 7;
8266
+ _b.label = 10;
7992
8267
 
7993
- case 7:
8268
+ case 10:
7994
8269
  return [4
7995
8270
  /*yield*/
7996
8271
  , effects.call(updateAnimation, mapId, newTimeDimension.maxValue)];
7997
8272
 
7998
- case 8:
8273
+ case 11:
7999
8274
  _b.sent();
8000
8275
 
8001
8276
  return [3
8002
8277
  /*break*/
8003
- , 11];
8278
+ , 14];
8004
8279
 
8005
- case 9:
8280
+ case 12:
8006
8281
  if (!(isAnimating$1 && !webmapInstance.isAnimating && newTimeDimension && newTimeDimension.maxValue)) return [3
8007
8282
  /*break*/
8008
- , 11];
8283
+ , 14];
8009
8284
  return [4
8010
8285
  /*yield*/
8011
8286
  , effects.call(updateAnimation, mapId, newTimeDimension.maxValue)];
8012
8287
 
8013
- case 10:
8288
+ case 13:
8014
8289
  _b.sent();
8015
8290
 
8016
- _b.label = 11;
8291
+ _b.label = 14;
8017
8292
 
8018
- case 11:
8293
+ case 14:
8019
8294
  return [3
8020
8295
  /*break*/
8021
- , 13];
8296
+ , 16];
8022
8297
 
8023
- case 12:
8298
+ case 15:
8024
8299
  error_1 = _b.sent(); // eslint-disable-next-line no-console
8025
8300
 
8026
8301
  console.warn(error_1);
8027
8302
  return [3
8028
8303
  /*break*/
8029
- , 13];
8304
+ , 16];
8030
8305
 
8031
- case 13:
8306
+ case 16:
8032
8307
  return [2
8033
8308
  /*return*/
8034
8309
  ];
@@ -8447,54 +8722,6 @@
8447
8722
  }
8448
8723
  });
8449
8724
  }
8450
- 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];
8451
- var supportedChangeOrigins = [LayerActionOrigin.layerManager, LayerActionOrigin.wmsLoader, MapActionOrigin.map];
8452
- function checkMapPresetForChangesSaga(action) {
8453
- var _a, mapId, origin, isChangeOriginSupported, hasMapPresetChanges;
8454
-
8455
- return __generator(this, function (_b) {
8456
- switch (_b.label) {
8457
- case 0:
8458
- _a = action.payload, mapId = _a.mapId, origin = _a.origin;
8459
-
8460
- if (!origin) {
8461
- return [2
8462
- /*return*/
8463
- ];
8464
- }
8465
-
8466
- isChangeOriginSupported = supportedChangeOrigins.indexOf(origin) >= 0;
8467
- if (!isChangeOriginSupported) return [3
8468
- /*break*/
8469
- , 3];
8470
- return [4
8471
- /*yield*/
8472
- , effects.select(getHasMapPresetChanges, mapId)];
8473
-
8474
- case 1:
8475
- hasMapPresetChanges = _b.sent();
8476
- if (!!hasMapPresetChanges) return [3
8477
- /*break*/
8478
- , 3];
8479
- return [4
8480
- /*yield*/
8481
- , effects.put(mapActions$1.setHasMapPresetChanges({
8482
- mapId: mapId,
8483
- hasChanges: true
8484
- }))];
8485
-
8486
- case 2:
8487
- _b.sent();
8488
-
8489
- _b.label = 3;
8490
-
8491
- case 3:
8492
- return [2
8493
- /*return*/
8494
- ];
8495
- }
8496
- });
8497
- }
8498
8725
  function unregisterMapSaga(_a) {
8499
8726
  var mapId, layerList;
8500
8727
  var payload = _a.payload;
@@ -8535,7 +8762,7 @@
8535
8762
  // resets WMJSMap state
8536
8763
  return [4
8537
8764
  /*yield*/
8538
- , effects.all([effects.takeLatest(mapActions$1.mapStopAnimation.type, stopAnimationSaga), effects.takeLatest(mapActions$1.setActiveMapPresetId.type, stopAnimationSaga)])];
8765
+ , effects.takeLatest(mapActions$1.mapStopAnimation.type, stopAnimationSaga)];
8539
8766
 
8540
8767
  case 1:
8541
8768
  // resets WMJSMap state
@@ -8576,20 +8803,11 @@
8576
8803
  case 6:
8577
8804
  _a.sent();
8578
8805
 
8579
- return [4
8580
- /*yield*/
8581
- , effects.all(mapPresetChangeActions.map(function (action) {
8582
- return effects.takeEvery(action, checkMapPresetForChangesSaga);
8583
- }))];
8584
-
8585
- case 7:
8586
- _a.sent();
8587
-
8588
8806
  return [4
8589
8807
  /*yield*/
8590
8808
  , effects.takeEvery(mapActions$1.unregisterMap.type, unregisterMapSaga)];
8591
8809
 
8592
- case 8:
8810
+ case 7:
8593
8811
  _a.sent();
8594
8812
 
8595
8813
  return [2
@@ -8716,7 +8934,8 @@
8716
8934
  keywords: keywords,
8717
8935
  scope: scope,
8718
8936
  groups: groups,
8719
- "abstract": _abstract
8937
+ "abstract": _abstract,
8938
+ isLoading: false
8720
8939
  }))];
8721
8940
 
8722
8941
  case 1:
@@ -8868,7 +9087,7 @@
8868
9087
  results = _a.sent();
8869
9088
  services = results;
8870
9089
  servicesEnabled = Object.values(services).find(function (service) {
8871
- return service.enabled;
9090
+ return service === null || service === void 0 ? void 0 : service.enabled;
8872
9091
  });
8873
9092
  if (!(servicesEnabled === undefined)) return [3
8874
9093
  /*break*/
@@ -8882,7 +9101,7 @@
8882
9101
 
8883
9102
  return effects.put(layerSelectActions.enableActiveService({
8884
9103
  serviceId: serviceId,
8885
- filters: service.filterIds
9104
+ filters: service === null || service === void 0 ? void 0 : service.filterIds
8886
9105
  }));
8887
9106
  }))];
8888
9107
 
@@ -12384,7 +12603,6 @@
12384
12603
  }));
12385
12604
  }
12386
12605
  }),
12387
- hasElevation: !isDockedLayerManager,
12388
12606
  className: "layermanager",
12389
12607
  sx: layerManagerStyle,
12390
12608
  onResizeStop: function onResizeStop(_event, _direction, node) {
@@ -12454,7 +12672,11 @@
12454
12672
  * Copyright 2022 - Koninklijk Nederlands Meteorologisch Instituut (KNMI)
12455
12673
  * Copyright 2022 - Finnish Meteorological Institute (FMI)
12456
12674
  * */
12457
- var useSetupDialog = function useSetupDialog(dialogType) {
12675
+ var useSetupDialog = function useSetupDialog(dialogType, source) {
12676
+ if (source === void 0) {
12677
+ source = 'app';
12678
+ }
12679
+
12458
12680
  var dispatch = reactRedux.useDispatch();
12459
12681
  var onCloseDialog = React.useCallback(function () {
12460
12682
  dispatch(uiActions.setToggleOpenDialog({
@@ -12477,9 +12699,10 @@
12477
12699
  var registerDialog = React.useCallback(function () {
12478
12700
  dispatch(uiActions.registerDialog({
12479
12701
  type: dialogType,
12480
- setOpen: false
12702
+ setOpen: false,
12703
+ source: source
12481
12704
  }));
12482
- }, [dialogType, dispatch]);
12705
+ }, [dialogType, dispatch, source]);
12483
12706
  var unregisterDialog = React.useCallback(function () {
12484
12707
  dispatch(uiActions.unregisterDialog({
12485
12708
  type: dialogType
@@ -12557,18 +12780,36 @@
12557
12780
  var serviceSetLayers = React__namespace.useCallback(function (payload) {
12558
12781
  dispatch(serviceActions.serviceSetLayers(payload));
12559
12782
  }, [dispatch]);
12783
+ var addFiltersAndActiveServices = React__namespace.useCallback(function (payload) {
12784
+ dispatch(layerSelectActions.addFiltersAndActiveServices(payload));
12785
+ }, [dispatch]);
12560
12786
  React__namespace.useEffect(function () {
12561
12787
  if (isOpenInStore && preloadedServices && preloadedServices.length > 0) {
12562
12788
  mergePresetsAndUserAddedServices(preloadedServices, getUserAddedServices()).forEach(function (service) {
12789
+ var wmService = webmap.WMGetServiceFromStore(service.url);
12790
+ var scope = service.scope ? service.scope : 'system';
12791
+
12792
+ if (isMounted.current) {
12793
+ addFiltersAndActiveServices({
12794
+ serviceId: wmService.id,
12795
+ serviceName: service.name,
12796
+ serviceUrl: service.url,
12797
+ keywords: [],
12798
+ scope: scope,
12799
+ groups: [],
12800
+ "abstract": service["abstract"] || wmService["abstract"],
12801
+ isLoading: true
12802
+ });
12803
+ }
12804
+
12563
12805
  getLayersFlattenedFromService(service.url).then(function (layers) {
12564
12806
  if (isMounted.current) {
12565
- var wmService = webmap.WMGetServiceFromStore(service.url);
12566
12807
  serviceSetLayers({
12567
12808
  id: wmService.id,
12568
12809
  name: service.name,
12569
12810
  serviceUrl: service.url,
12570
12811
  layers: layers,
12571
- scope: service.scope ? service.scope : 'system',
12812
+ scope: scope,
12572
12813
  // first try to load the user abstract, otherwise the service abstract
12573
12814
  "abstract": service["abstract"] || wmService["abstract"]
12574
12815
  });
@@ -12577,9 +12818,8 @@
12577
12818
  return null;
12578
12819
  });
12579
12820
  });
12580
- } // eslint-disable-next-line react-hooks/exhaustive-deps
12581
-
12582
- }, [isOpenInStore, preloadedServices, serviceSetLayers]);
12821
+ }
12822
+ }, [addFiltersAndActiveServices, isMounted, isOpenInStore, preloadedServices, serviceSetLayers]);
12583
12823
  };
12584
12824
  var mergePresetsAndUserAddedServices = function mergePresetsAndUserAddedServices(presets, userAddedServices) {
12585
12825
  return Object.values(__assign(__assign({}, presets.reduce(function (byUrl, preset) {
@@ -12646,9 +12886,9 @@
12646
12886
  var onToggleDock = function onToggleDock() {
12647
12887
  // Close the floating layer manager and open docked layer manager
12648
12888
  onCloseDialog();
12649
- dispatch(mapActions$1.toggleDockedLayerManager({
12650
- mapId: mapId,
12651
- openDockedLayerManager: true
12889
+ dispatch(uiActions.setToggleOpenDialog({
12890
+ type: DialogTypes.DockedLayerManager + "-" + mapId,
12891
+ setOpen: true
12652
12892
  }));
12653
12893
  };
12654
12894
 
@@ -12702,7 +12942,9 @@
12702
12942
  _b = _a.showTitle,
12703
12943
  showTitle = _b === void 0 ? false : _b,
12704
12944
  _c = _a.leftHeaderComponent,
12705
- leftHeaderComponent = _c === void 0 ? undefined : _c;
12945
+ leftHeaderComponent = _c === void 0 ? undefined : _c,
12946
+ _d = _a.source,
12947
+ source = _d === void 0 ? 'app' : _d;
12706
12948
  var dispatch = reactRedux.useDispatch(); // TODO: Uncomment when adding the presets: https://gitlab.com/opengeoweb/opengeoweb/-/issues/2881
12707
12949
  // const isMapPresetLoading = useSelector((store: AppStore) =>
12708
12950
  // mapSelectors.getIsMapPresetLoading(store, mapId),
@@ -12711,26 +12953,22 @@
12711
12953
  // mapSelectors.getMapPresetError(store, mapId),
12712
12954
  // );
12713
12955
 
12714
- var isDockedLayerManagerOpen = reactRedux.useSelector(function (store) {
12715
- return getIsDockedLayerManagerOpen(store, mapId);
12716
- });
12956
+ var dialogType = DialogTypes.DockedLayerManager + "-" + mapId;
12717
12957
 
12718
- var onClose = function onClose() {
12719
- // Open docked layer manager and close the floating layer manager
12720
- dispatch(mapActions$1.toggleDockedLayerManager({
12721
- mapId: mapId,
12722
- openDockedLayerManager: false
12723
- }));
12724
- };
12958
+ var _e = useSetupDialog(dialogType, source),
12959
+ dialogOrder = _e.dialogOrder,
12960
+ isDialogOpen = _e.isDialogOpen,
12961
+ setDialogOrder = _e.setDialogOrder,
12962
+ onCloseDialog = _e.onCloseDialog;
12725
12963
 
12726
12964
  var onToggleDock = function onToggleDock() {
12727
12965
  // Close docked layer manager and open the floating layer manager
12728
- onClose();
12966
+ onCloseDialog();
12729
12967
  dispatch(uiActions.setActiveMapIdForDialog({
12730
12968
  type: DialogTypes.LayerManager,
12731
12969
  mapId: mapId,
12732
12970
  setOpen: true,
12733
- source: 'app'
12971
+ source: source
12734
12972
  }));
12735
12973
  };
12736
12974
 
@@ -12739,8 +12977,8 @@
12739
12977
  preloadedAvailableBaseLayers: preloadedAvailableBaseLayers,
12740
12978
  preloadedBaseServices: preloadedBaseServices,
12741
12979
  bounds: bounds,
12742
- isOpen: isDockedLayerManagerOpen,
12743
- onClose: onClose,
12980
+ isOpen: isDialogOpen,
12981
+ onClose: onCloseDialog,
12744
12982
  showTitle: showTitle,
12745
12983
  leftHeaderComponent: leftHeaderComponent,
12746
12984
  // isLoading={isMapPresetLoading}
@@ -12751,7 +12989,10 @@
12751
12989
  startPosition: {
12752
12990
  top: 60,
12753
12991
  right: 16
12754
- }
12992
+ },
12993
+ onMouseDown: setDialogOrder,
12994
+ order: dialogOrder,
12995
+ source: source
12755
12996
  });
12756
12997
  };
12757
12998
 
@@ -12886,7 +13127,9 @@
12886
13127
 
12887
13128
  var serviceName = value === null || value === void 0 ? void 0 : value.toLowerCase();
12888
13129
  var foundName = Object.keys(services).find(function (serviceId) {
12889
- return services[serviceId].serviceName.toLowerCase() === serviceName && serviceName !== ownServiceName.toLocaleLowerCase();
13130
+ var _a;
13131
+
13132
+ return ((_a = services[serviceId]) === null || _a === void 0 ? void 0 : _a.serviceName.toLowerCase()) === serviceName && serviceName !== ownServiceName.toLocaleLowerCase();
12890
13133
  });
12891
13134
  return foundName === undefined ? true : VALIDATIONS_NAME_EXISTING;
12892
13135
  };
@@ -12916,7 +13159,9 @@
12916
13159
 
12917
13160
 
12918
13161
  var foundUrl = Object.keys(services).find(function (serviceId) {
12919
- return services[serviceId].serviceUrl === serviceUrl;
13162
+ var _a;
13163
+
13164
+ return ((_a = services[serviceId]) === null || _a === void 0 ? void 0 : _a.serviceUrl) === serviceUrl;
12920
13165
  });
12921
13166
 
12922
13167
  if (foundUrl) {
@@ -14163,7 +14408,7 @@
14163
14408
  var _d = __read(_b, 2),
14164
14409
  b = _d[1];
14165
14410
 
14166
- return a.serviceName.localeCompare(b.serviceName);
14411
+ return a.serviceName.localeCompare(b === null || b === void 0 ? void 0 : b.serviceName);
14167
14412
  }).reduce(function (r, _a) {
14168
14413
  var _b;
14169
14414
 
@@ -14487,7 +14732,7 @@
14487
14732
  var chip = all ? 'all' : service && service.serviceUrl;
14488
14733
  return /*#__PURE__*/React__namespace.createElement(shared.CustomTooltip, {
14489
14734
  title: (service === null || service === void 0 ? void 0 : service["abstract"]) ? "Abstract: " + service["abstract"] : ''
14490
- }, /*#__PURE__*/React__namespace.createElement(shared.CustomToggleButton, {
14735
+ }, /*#__PURE__*/React__namespace.createElement("span", null, /*#__PURE__*/React__namespace.createElement(shared.CustomToggleButton, {
14491
14736
  variant: "boxed",
14492
14737
  selected: isSelected,
14493
14738
  tabIndex: 0,
@@ -14500,7 +14745,7 @@
14500
14745
  },
14501
14746
  disabled: isDisabled,
14502
14747
  sx: style
14503
- }, service ? service.serviceName : 'All'));
14748
+ }, service ? service.serviceName : 'All')));
14504
14749
  };
14505
14750
 
14506
14751
  /* *
@@ -14674,7 +14919,7 @@
14674
14919
  all: true,
14675
14920
  isSelected: isAllSelected
14676
14921
  }), Object.keys(activeServices).map(function (serviceId) {
14677
- var _a;
14922
+ var _a, _b;
14678
14923
 
14679
14924
  var service = activeServices[serviceId];
14680
14925
  return /*#__PURE__*/React__namespace.createElement(ServiceChipConnect, {
@@ -14683,7 +14928,7 @@
14683
14928
  service: service,
14684
14929
  isSelected: (_a = activeServices[serviceId]) === null || _a === void 0 ? void 0 : _a.enabled,
14685
14930
  isAllSelected: isAllSelected,
14686
- isDisabled: activeServices[serviceId] === undefined
14931
+ isDisabled: activeServices[serviceId] === undefined || ((_b = activeServices[serviceId]) === null || _b === void 0 ? void 0 : _b.isLoading) === true
14687
14932
  });
14688
14933
  })));
14689
14934
  };
@@ -14953,7 +15198,9 @@
14953
15198
  var getService = function getService(services, serviceUrl) {
14954
15199
  var serviceIds = Object.keys(services);
14955
15200
  var serviceIndex = serviceIds.findIndex(function (serviceId) {
14956
- return services[serviceId].serviceUrl === serviceUrl;
15201
+ var _a;
15202
+
15203
+ return ((_a = services[serviceId]) === null || _a === void 0 ? void 0 : _a.serviceUrl) === serviceUrl;
14957
15204
  });
14958
15205
  if (serviceIndex < 0) return null;
14959
15206
  return services[serviceIds[serviceIndex]];
@@ -15852,7 +16099,8 @@
15852
16099
  left: 0,
15853
16100
  margin: 1,
15854
16101
  zIndex: 50,
15855
- top: '96px'
16102
+ top: '96px',
16103
+ userSelect: 'none'
15856
16104
  }
15857
16105
  }, props), /*#__PURE__*/React__namespace.createElement(material.Grid, {
15858
16106
  sx: {
@@ -16250,8 +16498,8 @@
16250
16498
  _d = _a.source,
16251
16499
  source = _d === void 0 ? 'app' : _d;
16252
16500
  var dispatch = reactRedux.useDispatch();
16253
- var mapDimension = reactRedux.useSelector(function (store) {
16254
- return getMapDimension(store, mapId, dimensionName);
16501
+ var mapContainsDimension = reactRedux.useSelector(function (store) {
16502
+ return getIsEnabledLayersForMapDimension(store, mapId, dimensionName);
16255
16503
  });
16256
16504
  var layerIds = reactRedux.useSelector(function (store) {
16257
16505
  return getLayerIds(store, mapId);
@@ -16279,7 +16527,7 @@
16279
16527
  }));
16280
16528
  }, [dispatch]);
16281
16529
 
16282
- if (!mapDimension || !layerIds || layerIds.length < 1) {
16530
+ if (!mapContainsDimension || !layerIds || layerIds.length < 1) {
16283
16531
  return null;
16284
16532
  }
16285
16533
 
@@ -16399,6 +16647,10 @@
16399
16647
  });
16400
16648
  var isOpenInStore = reactRedux.useSelector(function (store) {
16401
16649
  return getisDialogOpen(store, uiDialogType);
16650
+ }); // Only show button if enabled layer for map contains dimension
16651
+
16652
+ var mapContainsDimension = reactRedux.useSelector(function (store) {
16653
+ return getIsEnabledLayersForMapDimension(store, mapId, dimension);
16402
16654
  });
16403
16655
  var openMultiDimensionDialog = React__namespace.useCallback(function () {
16404
16656
  var setOpen = currentActiveMapId !== mapId ? true : !isOpenInStore;
@@ -16409,6 +16661,11 @@
16409
16661
  source: source
16410
16662
  }));
16411
16663
  }, [currentActiveMapId, dispatch, isOpenInStore, uiDialogType, mapId, source]);
16664
+
16665
+ if (!mapContainsDimension) {
16666
+ return null;
16667
+ }
16668
+
16412
16669
  var isOpen = currentActiveMapId === mapId && isOpenInStore;
16413
16670
  return /*#__PURE__*/React__namespace.createElement(DimensionSelectButton, {
16414
16671
  dimension: dimension,
@@ -16568,7 +16825,8 @@
16568
16825
  title = _a.title,
16569
16826
  icon = _a.icon,
16570
16827
  _b = _a.onChangeMouseWheel,
16571
- onChangeMouseWheel = _b === void 0 ? function () {} : _b;
16828
+ onChangeMouseWheel = _b === void 0 ? function () {} : _b,
16829
+ animationLength = _a.animationLength;
16572
16830
  var currentMarkIndex = marks.findIndex(function (mark) {
16573
16831
  return mark.value === value;
16574
16832
  });
@@ -16658,7 +16916,22 @@
16658
16916
  },
16659
16917
  selected: isAutoSelected,
16660
16918
  disabled: isDisabled
16661
- }, "Auto")));
16919
+ }, "Auto"), animationLength && /*#__PURE__*/React__namespace.createElement(material.MenuItem, {
16920
+ disabled: true,
16921
+ sx: {
16922
+ fontSize: '12px',
16923
+ opacity: 0.67,
16924
+ padding: '0px 12px',
16925
+ '&.MuiMenuItem-root': {
16926
+ minHeight: '30px!important'
16927
+ }
16928
+ }
16929
+ }, "length"), animationLength && /*#__PURE__*/React__namespace.createElement(shared.ToolButton, {
16930
+ "data-testid": "menu-animation-length-button",
16931
+ active: false,
16932
+ disableRipple: true,
16933
+ width: "100%"
16934
+ }, minutesToDescribedDuration(animationLength))));
16662
16935
  };
16663
16936
 
16664
16937
  /* *
@@ -16817,13 +17090,12 @@
16817
17090
  var timeStep = _a.timeStep,
16818
17091
  _b = _a.disabled,
16819
17092
  disabled = _b === void 0 ? false : _b,
16820
- _c = _a.isTimestepAuto,
16821
- isTimestepAuto = _c === void 0 ? false : _c,
17093
+ isTimestepAuto = _a.isTimestepAuto,
16822
17094
  onChangeTimeStep = _a.onChangeTimeStep,
16823
- _d = _a.onToggleTimestepAuto,
16824
- onToggleTimestepAuto = _d === void 0 ? function () {} : _d,
16825
- _e = _a.isOpenByDefault,
16826
- isOpenByDefault = _e === void 0 ? false : _e;
17095
+ _c = _a.onToggleTimestepAuto,
17096
+ onToggleTimestepAuto = _c === void 0 ? function () {} : _c,
17097
+ _d = _a.isOpenByDefault,
17098
+ isOpenByDefault = _d === void 0 ? false : _d;
16827
17099
 
16828
17100
  var handleMenuItemClick = function handleMenuItemClick(mark) {
16829
17101
  if (isTimestepAuto) {
@@ -17027,6 +17299,7 @@
17027
17299
  disabled = _b === void 0 ? false : _b,
17028
17300
  _c = _a.animationLength,
17029
17301
  animationLength = _c === void 0 ? AnimationLength.Hours1 : _c,
17302
+ animationLengthInMinutes = _a.animationLengthInMinutes,
17030
17303
  onChangeAnimationLength = _a.onChangeAnimationLength;
17031
17304
 
17032
17305
  var onChangeSliderValue = function onChangeSliderValue(mark) {
@@ -17045,7 +17318,8 @@
17045
17318
  title: title,
17046
17319
  isDisabled: disabled,
17047
17320
  value: animationLength,
17048
- onChangeMouseWheel: onChangeSliderValue
17321
+ onChangeMouseWheel: onChangeSliderValue,
17322
+ animationLength: animationLengthInMinutes
17049
17323
  });
17050
17324
  };
17051
17325
 
@@ -17094,7 +17368,8 @@
17094
17368
  xs: "auto"
17095
17369
  }, timeStepBtn || /*#__PURE__*/React__default["default"].createElement(TimeStepButton, {
17096
17370
  timeStep: 0,
17097
- onChangeTimeStep: function onChangeTimeStep() {}
17371
+ onChangeTimeStep: function onChangeTimeStep() {},
17372
+ isTimestepAuto: false
17098
17373
  })), /*#__PURE__*/React__default["default"].createElement(material.Grid, {
17099
17374
  item: true,
17100
17375
  xs: "auto"
@@ -17132,32 +17407,21 @@
17132
17407
  timeScaleBtn = _a.timeScaleBtn,
17133
17408
  animationLengthBtn = _a.animationLengthBtn,
17134
17409
  _b = _a.isOpenByDefault,
17135
- isOpenByDefault = _b === void 0 ? false : _b,
17136
- timeStep = _a.timeStep,
17137
- timeDimension = _a.timeDimension,
17138
- onChangeTimeStep = _a.onChangeTimeStep,
17139
- _c = _a.isTimestepAuto,
17140
- isTimestepAuto = _c === void 0 ? false : _c;
17410
+ isOpenByDefault = _b === void 0 ? false : _b;
17141
17411
 
17142
- var _d = __read(React.useState(null), 2),
17143
- anchorEl = _d[0],
17144
- setAnchorEl = _d[1];
17412
+ var _c = __read(React.useState(null), 2),
17413
+ anchorEl = _c[0],
17414
+ setAnchorEl = _c[1];
17145
17415
 
17146
- var _e = __read(React.useState(false), 2),
17147
- open = _e[0],
17148
- setOpen = _e[1];
17416
+ var _d = __read(React.useState(false), 2),
17417
+ open = _d[0],
17418
+ setOpen = _d[1];
17149
17419
 
17150
17420
  React.useEffect(function () {
17151
17421
  if (anchorEl && isOpenByDefault) {
17152
17422
  setOpen(true);
17153
17423
  }
17154
17424
  }, [anchorEl, isOpenByDefault]);
17155
- var timeStepFromLayer = getActiveLayerTimeStep(timeDimension) || timeStep;
17156
- React__default["default"].useEffect(function () {
17157
- if (isTimestepAuto) {
17158
- onChangeTimeStep(timeStepFromLayer);
17159
- }
17160
- }, [timeStepFromLayer, isTimestepAuto, onChangeTimeStep]);
17161
17425
  return /*#__PURE__*/React__default["default"].createElement("div", null, /*#__PURE__*/React__default["default"].createElement(shared.CustomTooltip, {
17162
17426
  title: "Animation options",
17163
17427
  placement: "bottom"
@@ -18229,95 +18493,114 @@
18229
18493
  * Copyright 2022 - Koninklijk Nederlands Meteorologisch Instituut (KNMI)
18230
18494
  * Copyright 2022 - Finnish Meteorological Institute (FMI)
18231
18495
  * */
18496
+ var TIME_SLIDER_LEGEND_HEIGHT = 24;
18232
18497
  var DRAG_AREA_WIDTH = 24;
18233
18498
 
18234
- var TimeSliderLegend = function TimeSliderLegend(_a) {
18235
- var mapId = _a.mapId,
18236
- centerTime = _a.centerTime,
18237
- secondsPerPx = _a.secondsPerPx,
18238
- _b = _a.dataScaleToSecondsPerPx,
18239
- dataScaleToSecondsPerPx = _b === void 0 ? defaultDataScaleToSecondsPerPx : _b,
18240
- selectedTime = _a.selectedTime,
18241
- _c = _a.scale,
18242
- scale = _c === void 0 ? Scale.Hour : _c,
18243
- currentTime = _a.currentTime,
18244
- dataStartTime = _a.dataStartTime,
18245
- dataEndTime = _a.dataEndTime,
18246
- animationStartTime = _a.animationStartTime,
18247
- animationEndTime = _a.animationEndTime,
18248
- timeStep = _a.timeStep,
18249
- _d = _a.mapIsActive,
18250
- mapIsActive = _d === void 0 ? true : _d,
18251
- unfilteredSelectedTime = _a.unfilteredSelectedTime,
18252
- setUnfilteredSelectedTime = _a.setUnfilteredSelectedTime,
18253
- onSetNewDate = _a.onSetNewDate,
18254
- onSetCenterTime = _a.onSetCenterTime,
18255
- onSetAnimationStartTime = _a.onSetAnimationStartTime,
18256
- onSetAnimationEndTime = _a.onSetAnimationEndTime;
18257
-
18258
- var _e = __read(useCanvasTarget('mousedown'), 2),
18259
- node = _e[1];
18499
+ function useAnimationTime(animationStartTime, animationEndTime, onSetAnimationStartTime, onSetAnimationEndTime, leftMarkerDragging, rightMarkerDragging, animationAreaDragging, centerTime, canvasWidth, secondsPerPx, dragTooltipPosition, pixelsToLeft, setTooltipTime, startDraggingPosition) {
18500
+ var _a = __read(React__namespace.useState(convertStringTimeToUnix(animationStartTime)), 2),
18501
+ localAnimationStartTime = _a[0],
18502
+ setLocalAnimationStartTime = _a[1];
18260
18503
 
18261
- var _f = __read(React__namespace.useState(0), 2),
18262
- canvasWidth = _f[0],
18263
- setCanvasWidth = _f[1];
18504
+ var _b = __read(React__namespace.useState(convertStringTimeToUnix(animationEndTime)), 2),
18505
+ localAnimationEndTime = _b[0],
18506
+ setLocalAnimationEndTime = _b[1];
18264
18507
 
18265
- var _g = __read(React__namespace.useState(false), 2),
18266
- selectedTimeDragging = _g[0],
18267
- setSelectedTimeDragging = _g[1];
18508
+ React__namespace.useEffect(function () {
18509
+ setLocalAnimationStartTime(convertStringTimeToUnix(animationStartTime));
18510
+ setLocalAnimationEndTime(convertStringTimeToUnix(animationEndTime));
18511
+ }, [animationStartTime, animationEndTime]);
18512
+ var animationDiff = React__namespace.useRef();
18513
+ var pixelsMovedSinceStartDragging = React__namespace.useRef(0);
18514
+ React__namespace.useEffect(function () {
18515
+ var handleMouseUp = function handleMouseUp() {
18516
+ pixelsMovedSinceStartDragging.current = 0;
18517
+ animationDiff.current = undefined;
18518
+ };
18268
18519
 
18269
- var _h = __read(React__namespace.useState(false), 2),
18270
- leftMarkerDragging = _h[0],
18271
- setLeftMarkerDragging = _h[1];
18520
+ document.addEventListener('mouseup', handleMouseUp);
18521
+ return function () {
18522
+ document.removeEventListener('mouseup', handleMouseUp);
18523
+ };
18524
+ }, []);
18525
+ React__namespace.useEffect(function () {
18526
+ var stoppedDragging = !leftMarkerDragging && !rightMarkerDragging && !animationAreaDragging;
18272
18527
 
18273
- var _j = __read(React__namespace.useState(false), 2),
18274
- rightMarkerDragging = _j[0],
18275
- setRightMarkerDragging = _j[1];
18528
+ if (stoppedDragging) {
18529
+ if (localAnimationStartTime && localAnimationStartTime !== convertStringTimeToUnix(animationStartTime)) {
18530
+ onSetAnimationStartTime(moment__default["default"].utc(localAnimationStartTime * 1000).format(dateFormat));
18531
+ }
18276
18532
 
18277
- var _k = __read(React__namespace.useState(false), 2),
18278
- centerTimeDragging = _k[0],
18279
- setCenterTimeDragging = _k[1];
18533
+ if (localAnimationEndTime && localAnimationEndTime !== convertStringTimeToUnix(animationEndTime)) {
18534
+ onSetAnimationEndTime(moment__default["default"].utc(localAnimationEndTime * 1000).format(dateFormat));
18535
+ }
18536
+ } // eslint-disable-next-line react-hooks/exhaustive-deps
18280
18537
 
18281
- var _l = __read(React__namespace.useState(false), 2),
18282
- dragTooltipOpen = _l[0],
18283
- setDragTooltipOpen = _l[1];
18538
+ }, [leftMarkerDragging, rightMarkerDragging, animationAreaDragging]);
18539
+ var handleAnimationDragging = React.useCallback(function (x) {
18540
+ if (!localAnimationStartTime || !localAnimationEndTime) return;
18284
18541
 
18285
- var _m = __read(React__namespace.useState(false), 2),
18286
- mouseDownInLegend = _m[0],
18287
- setMouseDownInLegend = _m[1];
18542
+ var _a = __read([localAnimationStartTime, localAnimationEndTime].map(function (timestamp) {
18543
+ return timestampToPixel(timestamp, centerTime, canvasWidth, secondsPerPx);
18544
+ }), 2),
18545
+ leftMarkerPx = _a[0],
18546
+ rightMarkerPx = _a[1];
18288
18547
 
18289
- var _o = __read(React__namespace.useState(animationStartTime && moment__default["default"].utc(animationStartTime).unix()), 2),
18290
- localAnimationStartTime = _o[0],
18291
- setLocalAnimationStartTime = _o[1];
18548
+ if (leftMarkerDragging) {
18549
+ var mousePosition = leftMarkerPx + x;
18550
+ var rightAnimationPosition = rightMarkerPx - DRAG_AREA_WIDTH * 2;
18551
+ if (mousePosition >= rightAnimationPosition || mousePosition <= 0) return; // eslint-disable-next-line no-param-reassign
18292
18552
 
18293
- var _p = __read(React__namespace.useState(animationEndTime && moment__default["default"].utc(animationEndTime).unix()), 2),
18294
- localAnimationEndTime = _p[0],
18295
- setLocalAnimationEndTime = _p[1];
18553
+ dragTooltipPosition.current = pixelsToLeft ? mousePosition + pixelsToLeft : mousePosition;
18554
+ var mouseTimeUnix = pixelToTimestamp(mousePosition, centerTime, canvasWidth, secondsPerPx);
18555
+ setLocalAnimationStartTime(mouseTimeUnix);
18556
+ setTooltipTime(moment__default["default"].unix(mouseTimeUnix));
18557
+ return;
18558
+ }
18296
18559
 
18297
- var _q = __read(React__namespace.useState(moment__default["default"].utc(0)), 2),
18298
- tooltipTime = _q[0],
18299
- setTooltipTime = _q[1];
18560
+ if (rightMarkerDragging) {
18561
+ var mousePosition = rightMarkerPx + x;
18562
+ var leftAnimationPosition = leftMarkerPx + DRAG_AREA_WIDTH * 2;
18563
+ if (leftAnimationPosition >= mousePosition || mousePosition >= canvasWidth) return; // eslint-disable-next-line no-param-reassign
18300
18564
 
18301
- var _r = __read(React__namespace.useState(false), 2),
18302
- animationAreaDragging = _r[0],
18303
- setAnimationAreaDragging = _r[1];
18565
+ dragTooltipPosition.current = pixelsToLeft ? mousePosition + pixelsToLeft : mousePosition;
18566
+ var mouseTimeUnix = pixelToTimestamp(mousePosition, centerTime, canvasWidth, secondsPerPx);
18567
+ setLocalAnimationEndTime(mouseTimeUnix);
18568
+ setTooltipTime(moment__default["default"].unix(mouseTimeUnix));
18569
+ return;
18570
+ }
18304
18571
 
18305
- var animationDiff = React__namespace.useRef();
18306
- var isClickOrDrag = React__namespace.useRef();
18307
- var pixelsMovedSinceStartDragging = React__namespace.useRef(0);
18308
- var elem = document.querySelector(".timeSliderLegend_" + mapId);
18309
- var pixelsToLeft = elem === null || elem === void 0 ? void 0 : elem.getBoundingClientRect()['left'];
18310
- var pixelsToTop = elem === null || elem === void 0 ? void 0 : elem.getBoundingClientRect()['top'];
18572
+ if (animationAreaDragging) {
18573
+ if (animationDiff.current === undefined) {
18574
+ var startDraggingPositionTimestamp = pixelToTimestamp(startDraggingPosition.current, centerTime, canvasWidth, secondsPerPx);
18575
+ var diffLeftAnimationToStartDraggingPosition = startDraggingPositionTimestamp - localAnimationStartTime;
18576
+ var diffRightAnimationToStartDraggingPosition = localAnimationEndTime - startDraggingPositionTimestamp;
18577
+ animationDiff.current = {
18578
+ diffStartToRight: diffRightAnimationToStartDraggingPosition,
18579
+ diffStartToLeft: diffLeftAnimationToStartDraggingPosition
18580
+ };
18581
+ return;
18582
+ }
18311
18583
 
18312
- var _s = __read(React__namespace.useState('auto'), 2),
18313
- cursorStyle = _s[0],
18314
- setCursorStyle = _s[1];
18584
+ pixelsMovedSinceStartDragging.current += x;
18585
+ var currentPositionTimestamp = pixelToTimestamp(startDraggingPosition.current + pixelsMovedSinceStartDragging.current, centerTime, canvasWidth, secondsPerPx);
18586
+ var _b = animationDiff.current,
18587
+ diffStartToRight = _b.diffStartToRight,
18588
+ diffStartToLeft = _b.diffStartToLeft;
18589
+ var startTime = currentPositionTimestamp - diffStartToLeft;
18590
+ var endTime = currentPositionTimestamp + diffStartToRight;
18591
+ setLocalAnimationStartTime(startTime);
18592
+ setLocalAnimationEndTime(endTime);
18593
+ }
18594
+ }, [localAnimationStartTime, localAnimationEndTime, leftMarkerDragging, rightMarkerDragging, animationAreaDragging, centerTime, canvasWidth, secondsPerPx, dragTooltipPosition, pixelsToLeft, setTooltipTime, startDraggingPosition]);
18595
+ return {
18596
+ handleAnimationDragging: handleAnimationDragging,
18597
+ localAnimationEndTime: localAnimationEndTime,
18598
+ localAnimationStartTime: localAnimationStartTime
18599
+ };
18600
+ }
18315
18601
 
18602
+ function useHandleKeyDown(mapIsActive, timeStep, dataStartTime, dataEndTime, currentTime, onSetNewDate, onSetCenterTime, selectedTime) {
18316
18603
  var curTime = selectedTime !== undefined ? moment__default["default"].unix(selectedTime).toISOString() : moment__default["default"].utc().toISOString();
18317
- React__namespace.useEffect(function () {
18318
- setLocalAnimationStartTime(animationStartTime && moment__default["default"].utc(animationStartTime).unix());
18319
- setLocalAnimationEndTime(animationEndTime && moment__default["default"].utc(animationEndTime).unix());
18320
- }, [animationStartTime, animationEndTime]);
18321
18604
  React__namespace.useEffect(function () {
18322
18605
  var handleKeyDown = function handleKeyDown(event) {
18323
18606
  if (event.key === 'Home' && mapIsActive) {
@@ -18342,94 +18625,114 @@
18342
18625
  document.removeEventListener('keydown', handleKeyDown);
18343
18626
  };
18344
18627
  }, [curTime, currentTime, dataEndTime, dataStartTime, mapIsActive, onSetCenterTime, onSetNewDate, timeStep]);
18628
+ }
18629
+
18630
+ function convertStringTimeToUnix(time) {
18631
+ return time ? moment__default["default"].utc(time).unix() : undefined;
18632
+ } // Explanation of props can be found here:
18633
+ // https://drive.google.com/file/d/1jqqNcciCH0UJiZ04HO-1vknmPPpT8fK5/view?usp=sharing
18634
+
18635
+
18636
+ var TimeSliderLegend = function TimeSliderLegend(_a) {
18637
+ var mapId = _a.mapId,
18638
+ centerTime = _a.centerTime,
18639
+ secondsPerPx = _a.secondsPerPx,
18640
+ _b = _a.dataScaleToSecondsPerPx,
18641
+ dataScaleToSecondsPerPx = _b === void 0 ? defaultDataScaleToSecondsPerPx : _b,
18642
+ selectedTime = _a.selectedTime,
18643
+ _c = _a.scale,
18644
+ scale = _c === void 0 ? Scale.Hour : _c,
18645
+ currentTime = _a.currentTime,
18646
+ dataStartTime = _a.dataStartTime,
18647
+ dataEndTime = _a.dataEndTime,
18648
+ animationStartTime = _a.animationStartTime,
18649
+ animationEndTime = _a.animationEndTime,
18650
+ timeStep = _a.timeStep,
18651
+ _d = _a.mapIsActive,
18652
+ mapIsActive = _d === void 0 ? true : _d,
18653
+ unfilteredSelectedTime = _a.unfilteredSelectedTime,
18654
+ setUnfilteredSelectedTime = _a.setUnfilteredSelectedTime,
18655
+ _e = _a.onSetNewDate,
18656
+ onSetNewDate = _e === void 0 ? function () {} : _e,
18657
+ _f = _a.onSetCenterTime,
18658
+ onSetCenterTime = _f === void 0 ? function () {} : _f,
18659
+ _g = _a.onSetAnimationStartTime,
18660
+ onSetAnimationStartTime = _g === void 0 ? function () {} : _g,
18661
+ _h = _a.onSetAnimationEndTime,
18662
+ onSetAnimationEndTime = _h === void 0 ? function () {} : _h;
18663
+ useHandleKeyDown(mapIsActive, timeStep, dataStartTime, dataEndTime, currentTime, onSetNewDate, onSetCenterTime, selectedTime);
18664
+
18665
+ var _j = __read(useCanvasTarget('mousedown'), 2),
18666
+ node = _j[1];
18667
+
18668
+ var _k = __read(React__namespace.useState(0), 2),
18669
+ canvasWidth = _k[0],
18670
+ setCanvasWidth = _k[1];
18671
+
18672
+ var _l = __read(React__namespace.useState(false), 2),
18673
+ selectedTimeDragging = _l[0],
18674
+ setSelectedTimeDragging = _l[1];
18675
+
18676
+ var _m = __read(React__namespace.useState(false), 2),
18677
+ leftMarkerDragging = _m[0],
18678
+ setLeftMarkerDragging = _m[1];
18679
+
18680
+ var _o = __read(React__namespace.useState(false), 2),
18681
+ rightMarkerDragging = _o[0],
18682
+ setRightMarkerDragging = _o[1];
18683
+
18684
+ var _p = __read(React__namespace.useState(false), 2),
18685
+ dragTooltipOpen = _p[0],
18686
+ setDragTooltipOpen = _p[1];
18687
+
18688
+ var _q = __read(React__namespace.useState(false), 2),
18689
+ mouseDownInLegend = _q[0],
18690
+ setMouseDownInLegend = _q[1];
18691
+
18692
+ var _r = __read(React__namespace.useState(false), 2),
18693
+ animationAreaDragging = _r[0],
18694
+ setAnimationAreaDragging = _r[1];
18695
+
18696
+ var _s = __read(React__namespace.useState('auto'), 2),
18697
+ cursorStyle = _s[0],
18698
+ setCursorStyle = _s[1];
18345
18699
  /**
18346
18700
  * remove active drag. can happen outside canvas.
18347
18701
  */
18348
18702
 
18703
+
18349
18704
  React__namespace.useEffect(function () {
18350
18705
  var handleMouseUp = function handleMouseUp() {
18351
- centerTimeDragging ? setCursorStyle('auto') : setCursorStyle('ew-resize');
18706
+ setCursorStyle('auto');
18352
18707
  setSelectedTimeDragging(false);
18353
18708
  setLeftMarkerDragging(false);
18354
18709
  setRightMarkerDragging(false);
18355
18710
  setMouseDownInLegend(false);
18356
- setCenterTimeDragging(false);
18357
18711
  setDragTooltipOpen(false);
18358
18712
  setAnimationAreaDragging(false);
18359
18713
  startDraggingPosition.current = 0;
18360
- pixelsMovedSinceStartDragging.current = 0;
18361
- animationDiff.current = undefined;
18362
18714
  };
18363
18715
 
18364
18716
  document.addEventListener('mouseup', handleMouseUp);
18365
18717
  return function () {
18366
18718
  document.removeEventListener('mouseup', handleMouseUp);
18367
18719
  };
18368
- }, [centerTimeDragging]);
18369
- var onMouseTouchMoveActions = React.useCallback(function (x) {
18370
- if (!localAnimationStartTime || !localAnimationEndTime) return;
18371
-
18372
- var _a = __read([localAnimationStartTime, localAnimationEndTime].map(function (timestamp) {
18373
- return timestampToPixel(timestamp, centerTime, canvasWidth, secondsPerPx);
18374
- }), 2),
18375
- leftMarkerPx = _a[0],
18376
- rightMarkerPx = _a[1];
18377
-
18378
- if (leftMarkerDragging) {
18379
- var mousePosition = leftMarkerPx + x;
18380
- var rightAnimationPosition = rightMarkerPx - DRAG_AREA_WIDTH * 2; // update tooltip position while dragging
18381
- // Prevent dragging if it would cause markers to cross over, except if the markers
18382
- // are moved away from being crossed over
18383
-
18384
- if (mousePosition >= rightAnimationPosition || mousePosition <= 0) return; // set animation drag info dialog location
18385
-
18386
- dragTooltipPosition.current = pixelsToLeft ? mousePosition + pixelsToLeft : mousePosition; // change local time bounds according to either dragged marker
18387
-
18388
- var mouseTimeUnix = pixelToTimestamp(mousePosition, // lets us drag on the marker
18389
- centerTime, canvasWidth, secondsPerPx);
18390
- setLocalAnimationStartTime(mouseTimeUnix);
18391
- setTooltipTime(moment__default["default"].unix(mouseTimeUnix));
18392
- return;
18393
- }
18394
-
18395
- if (rightMarkerDragging) {
18396
- var mousePosition = rightMarkerPx + x;
18397
- var leftAnimationPosition = leftMarkerPx + DRAG_AREA_WIDTH * 2; // Similar condition for other marker
18398
-
18399
- if (leftAnimationPosition >= mousePosition || mousePosition >= canvasWidth) return; // set animation drag info dialog location
18720
+ }, []);
18721
+ var dragTooltipPosition = React__namespace.useRef();
18722
+ var startDraggingPosition = React__namespace.useRef(0);
18723
+ var timeSliderLegendId = "timeSliderLegend_" + mapId;
18724
+ var timeSliderLegendElement = document.querySelector("." + timeSliderLegendId);
18725
+ var pixelsToLeft = timeSliderLegendElement === null || timeSliderLegendElement === void 0 ? void 0 : timeSliderLegendElement.getBoundingClientRect()['left'];
18400
18726
 
18401
- dragTooltipPosition.current = pixelsToLeft ? mousePosition + pixelsToLeft : mousePosition; // change local time bounds according to either dragged marker
18727
+ var _t = __read(React__namespace.useState(moment__default["default"].utc(0)), 2),
18728
+ tooltipTime = _t[0],
18729
+ setTooltipTime = _t[1];
18402
18730
 
18403
- var mouseTimeUnix = pixelToTimestamp(mousePosition, // lets us drag on the marker
18404
- centerTime, canvasWidth, secondsPerPx);
18405
- setLocalAnimationEndTime(mouseTimeUnix);
18406
- setTooltipTime(moment__default["default"].unix(mouseTimeUnix));
18407
- return;
18408
- }
18731
+ var _u = useAnimationTime(animationStartTime, animationEndTime, onSetAnimationStartTime, onSetAnimationEndTime, leftMarkerDragging, rightMarkerDragging, animationAreaDragging, centerTime, canvasWidth, secondsPerPx, dragTooltipPosition, pixelsToLeft, setTooltipTime, startDraggingPosition),
18732
+ handleAnimationDragging = _u.handleAnimationDragging,
18733
+ localAnimationEndTime = _u.localAnimationEndTime,
18734
+ localAnimationStartTime = _u.localAnimationStartTime;
18409
18735
 
18410
- if (animationAreaDragging) {
18411
- if (animationDiff.current === undefined) {
18412
- var startDraggingPositionTimestamp = pixelToTimestamp(startDraggingPosition.current, centerTime, canvasWidth, secondsPerPx);
18413
- var diffLeftAnimationToStartDraggingPosition = startDraggingPositionTimestamp - localAnimationStartTime;
18414
- var diffRightAnimationToStartDraggingPosition = localAnimationEndTime - startDraggingPositionTimestamp;
18415
- animationDiff.current = {
18416
- diffStartToRight: diffRightAnimationToStartDraggingPosition,
18417
- diffStartToLeft: diffLeftAnimationToStartDraggingPosition
18418
- };
18419
- return;
18420
- }
18421
-
18422
- pixelsMovedSinceStartDragging.current += x;
18423
- var currentPositionTimestamp = pixelToTimestamp(startDraggingPosition.current + pixelsMovedSinceStartDragging.current, centerTime, canvasWidth, secondsPerPx);
18424
- var _b = animationDiff.current,
18425
- diffStartToRight = _b.diffStartToRight,
18426
- diffStartToLeft = _b.diffStartToLeft;
18427
- var startTime = currentPositionTimestamp - diffStartToLeft;
18428
- var endTime = currentPositionTimestamp + diffStartToRight;
18429
- setLocalAnimationStartTime(startTime);
18430
- setLocalAnimationEndTime(endTime);
18431
- }
18432
- }, [localAnimationStartTime, localAnimationEndTime, leftMarkerDragging, rightMarkerDragging, animationAreaDragging, centerTime, canvasWidth, secondsPerPx, pixelsToLeft, animationDiff]);
18433
18736
  var setSelectedTime = React.useCallback(function (x) {
18434
18737
  var unfliteredSelectedTimePx = timestampToPixel(unfilteredSelectedTime, centerTime, canvasWidth, secondsPerPx) + x;
18435
18738
  setUnfilteredSelectedTime(pixelToTimestamp(unfliteredSelectedTimePx, centerTime, canvasWidth, secondsPerPx));
@@ -18440,12 +18743,11 @@
18440
18743
  if (event.movementX === 0) return;
18441
18744
 
18442
18745
  if (mouseDownInLegend) {
18443
- setCenterTimeDragging(true);
18444
18746
  var dragDistanceTime = event.movementX * secondsPerPx;
18445
18747
  var newCenterTime = centerTime - dragDistanceTime;
18446
18748
  onSetCenterTime && onSetCenterTime(newCenterTime);
18447
18749
  } else if (leftMarkerDragging || rightMarkerDragging || animationAreaDragging) {
18448
- onMouseTouchMoveActions(event.movementX);
18750
+ handleAnimationDragging(event.movementX);
18449
18751
  } else if (selectedTimeDragging) {
18450
18752
  setSelectedTime(event.movementX);
18451
18753
  }
@@ -18455,9 +18757,9 @@
18455
18757
  return function () {
18456
18758
  document.removeEventListener('mousemove', handleMouseMove);
18457
18759
  };
18458
- }, [animationAreaDragging, centerTime, leftMarkerDragging, mouseDownInLegend, onMouseTouchMoveActions, onSetCenterTime, rightMarkerDragging, secondsPerPx, selectedTimeDragging, setSelectedTime]);
18760
+ }, [animationAreaDragging, centerTime, leftMarkerDragging, mouseDownInLegend, handleAnimationDragging, onSetCenterTime, rightMarkerDragging, secondsPerPx, selectedTimeDragging, setSelectedTime]);
18459
18761
  var theme = material.useTheme();
18460
- var startDraggingPosition = React__namespace.useRef(0);
18762
+ var isClickOrDrag = React__namespace.useRef();
18461
18763
 
18462
18764
  var onMouseDown = function onMouseDown(x, y, width) {
18463
18765
  isClickOrDrag.current = 'click';
@@ -18477,7 +18779,7 @@
18477
18779
  return;
18478
18780
  }
18479
18781
 
18480
- if (animationStartTime && animationEndTime && onSetAnimationStartTime && onSetAnimationEndTime) {
18782
+ if (animationStartTime && animationEndTime) {
18481
18783
  dragTooltipPosition.current = pixelsToLeft ? x + pixelsToLeft : x; // start dragging either marker
18482
18784
 
18483
18785
  if (isLeftAnimationIconArea(x, leftMarkerPx, DRAG_AREA_WIDTH) && !rightMarkerDragging) {
@@ -18507,22 +18809,7 @@
18507
18809
  setMouseDownInLegend(true);
18508
18810
  };
18509
18811
 
18510
- React__namespace.useEffect(function () {
18511
- var stoppedDragging = !leftMarkerDragging && !rightMarkerDragging && !animationAreaDragging;
18512
-
18513
- if (stoppedDragging) {
18514
- if (localAnimationStartTime !== convertStringTimeToUnix(animationStartTime)) {
18515
- onSetAnimationStartTime(moment__default["default"].utc(localAnimationStartTime * 1000).format(dateFormat));
18516
- }
18517
-
18518
- if (localAnimationEndTime !== convertStringTimeToUnix(animationEndTime)) {
18519
- onSetAnimationEndTime(moment__default["default"].utc(localAnimationEndTime * 1000).format(dateFormat));
18520
- }
18521
- } // eslint-disable-next-line react-hooks/exhaustive-deps
18522
-
18523
- }, [leftMarkerDragging, rightMarkerDragging, animationAreaDragging]);
18524
-
18525
- var onMouseUpTouchEnd = function onMouseUpTouchEnd(x) {
18812
+ var onMouseUp = function onMouseUp(x) {
18526
18813
  if (isClickOrDrag.current === 'click') {
18527
18814
  // we need to set the unfiltered time, so the timebox will update accordingly
18528
18815
  setUnfilteredSelectedTime(pixelToTimestamp(x, centerTime, canvasWidth, secondsPerPx));
@@ -18564,8 +18851,8 @@
18564
18851
  }
18565
18852
  };
18566
18853
 
18567
- var dragTooltipPosition = React__namespace.useRef();
18568
18854
  var popperRef = React__namespace.useRef(null);
18855
+ var pixelsToTop = timeSliderLegendElement === null || timeSliderLegendElement === void 0 ? void 0 : timeSliderLegendElement.getBoundingClientRect()['top'];
18569
18856
 
18570
18857
  var setTooltipPosition = function setTooltipPosition() {
18571
18858
  var tooltipX = dragTooltipPosition.current;
@@ -18584,7 +18871,7 @@
18584
18871
  }
18585
18872
  }, /*#__PURE__*/React__namespace.createElement(material.Box, {
18586
18873
  "data-testid": "timeSliderLegend",
18587
- className: "timeSliderLegend_" + mapId,
18874
+ className: timeSliderLegendId,
18588
18875
  sx: {
18589
18876
  height: TIME_SLIDER_LEGEND_HEIGHT + "px",
18590
18877
  borderRadius: '4.5px',
@@ -18601,7 +18888,7 @@
18601
18888
  onSetCenterTime && onSetCenterTime(newCenterTime);
18602
18889
  },
18603
18890
  onMouseDown: onMouseDown,
18604
- onMouseUp: onMouseUpTouchEnd,
18891
+ onMouseUp: onMouseUp,
18605
18892
  onRenderCanvas: function onRenderCanvas(ctx, width, height) {
18606
18893
  setCanvasWidth(width);
18607
18894
  drawTimeSliderLegend(ctx, theme, width, height, centerTime, secondsPerPx, dataScaleToSecondsPerPx, selectedTime, scale, currentTime, localAnimationStartTime, localAnimationEndTime, dataStartTime, dataEndTime);
@@ -18609,12 +18896,6 @@
18609
18896
  })));
18610
18897
  };
18611
18898
 
18612
- function convertStringTimeToUnix(time) {
18613
- return time ? moment__default["default"].utc(time).unix() : undefined;
18614
- }
18615
-
18616
- var TIME_SLIDER_LEGEND_HEIGHT = 24;
18617
-
18618
18899
  /* *
18619
18900
  * Licensed under the Apache License, Version 2.0 (the "License");
18620
18901
  * you may not use this file except in compliance with the License.
@@ -19103,26 +19384,46 @@
19103
19384
  var isTimestepAuto$1 = reactRedux.useSelector(function (store) {
19104
19385
  return isTimestepAuto(store, mapId);
19105
19386
  });
19106
- var onToggleTimestepAuto = React__namespace.useCallback(function () {
19387
+ var activeLayerId = reactRedux.useSelector(function (store) {
19388
+ return getActiveLayerId(store, mapId);
19389
+ });
19390
+ var activeLayerTimeDimension = reactRedux.useSelector(function (store) {
19391
+ return getLayerTimeDimension(store, activeLayerId);
19392
+ });
19393
+
19394
+ var onToggleTimestepAuto = function onToggleTimestepAuto() {
19395
+ var newTimestepAuto = !isTimestepAuto$1;
19396
+
19397
+ if (newTimestepAuto) {
19398
+ var timeStepFromLayer = getActiveLayerTimeStep(activeLayerTimeDimension);
19399
+
19400
+ if (timeStepFromLayer) {
19401
+ dispatch(mapActions$1.setTimeStep({
19402
+ mapId: mapId,
19403
+ timeStep: timeStepFromLayer
19404
+ }));
19405
+ }
19406
+ }
19407
+
19107
19408
  dispatch(mapActions$1.toggleTimestepAuto({
19108
19409
  mapId: mapId,
19109
- timestepAuto: !isTimestepAuto$1,
19110
- origin: MapActionOrigin.map
19410
+ timestepAuto: newTimestepAuto
19111
19411
  }));
19112
- }, [dispatch, isTimestepAuto$1, mapId]);
19113
- var onSetTimeStep = React__namespace.useCallback(function (timeStep, origin) {
19114
- dispatch(mapActions$1.setTimeStep(__assign({
19412
+ };
19413
+
19414
+ var onSetTimeStep = function onSetTimeStep(timeStep) {
19415
+ dispatch(mapActions$1.setTimeStep({
19115
19416
  mapId: mapId,
19116
19417
  timeStep: timeStep
19117
- }, origin && {
19118
- origin: origin
19119
- })));
19120
- }, [dispatch, mapId]);
19418
+ }));
19419
+ };
19420
+
19121
19421
  return /*#__PURE__*/React__namespace.createElement(TimeStepButton, {
19122
19422
  timeStep: timeStep,
19123
19423
  onChangeTimeStep: onSetTimeStep,
19124
19424
  disabled: isAnimating$1,
19125
- onToggleTimestepAuto: onToggleTimestepAuto
19425
+ onToggleTimestepAuto: onToggleTimestepAuto,
19426
+ isTimestepAuto: Boolean(isTimestepAuto$1)
19126
19427
  });
19127
19428
  };
19128
19429
 
@@ -19303,7 +19604,8 @@
19303
19604
  return /*#__PURE__*/React__namespace.createElement(AnimationLengthButton, {
19304
19605
  disabled: isAnimating$1,
19305
19606
  animationLength: currentLength || Number(AnimationLength.Hours24),
19306
- onChangeAnimationLength: handlechangeAnimationLength
19607
+ onChangeAnimationLength: handlechangeAnimationLength,
19608
+ animationLengthInMinutes: currentDiffInMinutes
19307
19609
  });
19308
19610
  };
19309
19611
 
@@ -19335,27 +19637,6 @@
19335
19637
  var OptionsMenuButtonConnect = function OptionsMenuButtonConnect(_a) {
19336
19638
  var sourceId = _a.sourceId,
19337
19639
  mapId = _a.mapId;
19338
- var dispatch = reactRedux.useDispatch();
19339
- var isTimestepAuto$1 = reactRedux.useSelector(function (store) {
19340
- return isTimestepAuto(store, mapId);
19341
- });
19342
- var timeStep = reactRedux.useSelector(function (store) {
19343
- return getMapTimeStep(store, mapId);
19344
- });
19345
- var activeLayerId = reactRedux.useSelector(function (store) {
19346
- return getActiveLayerId(store, mapId);
19347
- });
19348
- var activeLayerTimeDimension = reactRedux.useSelector(function (store) {
19349
- return getLayerTimeDimension(store, activeLayerId);
19350
- });
19351
- var onSetTimeStep = React__namespace.useCallback(function (timeStep, origin) {
19352
- dispatch(mapActions$1.setTimeStep(__assign({
19353
- mapId: mapId,
19354
- timeStep: timeStep
19355
- }, origin && {
19356
- origin: origin
19357
- })));
19358
- }, [dispatch, mapId]);
19359
19640
  return /*#__PURE__*/React__namespace.createElement(OptionsMenuButton, {
19360
19641
  nowBtn: /*#__PURE__*/React__namespace.createElement(NowButtonConnect, {
19361
19642
  mapId: mapId,
@@ -19375,11 +19656,7 @@
19375
19656
  }),
19376
19657
  timeScaleBtn: /*#__PURE__*/React__namespace.createElement(TimeScaleButtonConnect, {
19377
19658
  mapId: mapId
19378
- }),
19379
- timeStep: timeStep,
19380
- isTimestepAuto: isTimestepAuto$1,
19381
- onChangeTimeStep: onSetTimeStep,
19382
- timeDimension: activeLayerTimeDimension
19659
+ })
19383
19660
  });
19384
19661
  };
19385
19662
 
@@ -20536,6 +20813,37 @@
20536
20813
 
20537
20814
  return null;
20538
20815
  };
20816
+ var generatedDrawFunctionIds = 0;
20817
+
20818
+ var generateDrawFunctionId = function generateDrawFunctionId() {
20819
+ generatedDrawFunctionIds += 1;
20820
+ return "drawFunctionId_" + generatedDrawFunctionIds;
20821
+ };
20822
+ /**
20823
+ * DrawFunction store for re-use of drawFunctions
20824
+ */
20825
+
20826
+
20827
+ var drawFunctionStore = [];
20828
+ var getDrawFunctionFromStore = function getDrawFunctionFromStore(id) {
20829
+ var drawFunction = drawFunctionStore.find(function (drawFunction) {
20830
+ return drawFunction.id === id;
20831
+ });
20832
+ return drawFunction === null || drawFunction === void 0 ? void 0 : drawFunction.drawMethod;
20833
+ };
20834
+ var registerDrawFunction = function registerDrawFunction(drawFunction) {
20835
+ if (drawFunction === void 0) {
20836
+ drawFunction = function drawFunction() {};
20837
+ }
20838
+
20839
+ var id = generateDrawFunctionId();
20840
+ var newFunction = {
20841
+ id: id,
20842
+ drawMethod: drawFunction
20843
+ };
20844
+ drawFunctionStore.push(newFunction);
20845
+ return id;
20846
+ };
20539
20847
 
20540
20848
  /* *
20541
20849
  * Licensed under the Apache License, Version 2.0 (the "License");
@@ -22302,22 +22610,25 @@
22302
22610
  }
22303
22611
 
22304
22612
  var drawStyledMarker = featureProperties ? featureProperties.stroke || featureProperties['stroke-width'] || featureProperties.fill : null;
22305
- var drawMarkerByDefault = !featureProperties || !featureProperties.imageURL || !featureProperties.drawFunction;
22306
-
22307
- if (featureProperties.drawFunction) {
22308
- var isHovered = this.featureEvent && this.featureEvent.feature === feature;
22309
- featureProperties.drawFunction({
22310
- context: ctx,
22311
- featureIndex: featureIndex,
22312
- coord: _coord,
22313
- selected: selected,
22314
- middle: middle,
22315
- isInEditMode: isInEditMode,
22316
- feature: feature,
22317
- mouseX: this.mouseX,
22318
- mouseY: this.mouseY,
22319
- isHovered: isHovered
22320
- });
22613
+ var drawMarkerByDefault = !featureProperties || !featureProperties.imageURL || !featureProperties.drawFunctionId;
22614
+
22615
+ if (featureProperties.drawFunctionId) {
22616
+ var drawFunction = getDrawFunctionFromStore(featureProperties.drawFunctionId);
22617
+
22618
+ if (drawFunction) {
22619
+ var isHovered = this.featureEvent && this.featureEvent.feature === feature;
22620
+ drawFunction({
22621
+ context: ctx,
22622
+ featureIndex: featureIndex,
22623
+ coord: _coord,
22624
+ selected: selected,
22625
+ isInEditMode: isInEditMode,
22626
+ feature: feature,
22627
+ mouseX: this.mouseX,
22628
+ mouseY: this.mouseY,
22629
+ isHovered: isHovered
22630
+ });
22631
+ }
22321
22632
  } else if (drawStyledMarker || drawMarkerByDefault) {
22322
22633
  this.drawMarker(ctx, _coord, selected, middle, isInEditMode, featureProperties);
22323
22634
  }
@@ -22897,9 +23208,8 @@
22897
23208
 
22898
23209
  ReactMapView.prototype.componentDidMount = function () {
22899
23210
  var _a = this.props,
22900
- onMount = _a.onMount,
23211
+ onWMJSMount = _a.onWMJSMount,
22901
23212
  mapId = _a.mapId,
22902
- onRegisterAdaguc = _a.onRegisterAdaguc,
22903
23213
  shouldAutoFetch = _a.shouldAutoFetch;
22904
23214
  this.checkAdaguc();
22905
23215
  this.checkNewProps(null, this.props);
@@ -22907,13 +23217,9 @@
22907
23217
 
22908
23218
  if (this.adaguc.initialized === false && this.adaguc.webMapJS) {
22909
23219
  this.adaguc.initialized = true;
22910
-
22911
- if (onRegisterAdaguc) {
22912
- onRegisterAdaguc(this.adaguc.webMapJS);
22913
- }
22914
23220
  }
22915
23221
 
22916
- onMount(mapId, this.adaguc.webMapJS);
23222
+ onWMJSMount(mapId);
22917
23223
 
22918
23224
  if (shouldAutoFetch) {
22919
23225
  this.onStartRefetchTimer();
@@ -22921,11 +23227,7 @@
22921
23227
  };
22922
23228
 
22923
23229
  ReactMapView.prototype.componentWillUnmount = function () {
22924
- var _a = this.props,
22925
- onUnMount = _a.onUnMount,
22926
- mapId = _a.mapId;
22927
23230
  window.removeEventListener('resize', this.handleWindowResize);
22928
- onUnMount(mapId, this.adaguc.webMapJS);
22929
23231
  this.adaguc.webMapJS.getListener().suspendEvents();
22930
23232
 
22931
23233
  if (typeof this.adaguc.webMapJS.stopAnimating === 'function') {
@@ -23550,8 +23852,7 @@
23550
23852
  shouldAutoFetch: true,
23551
23853
  displayMapPin: false,
23552
23854
  disableMapPin: false,
23553
- onMount: function onMount() {},
23554
- onUnMount: function onUnMount() {},
23855
+ onWMJSMount: function onWMJSMount() {},
23555
23856
  onMapChangeDimension: function onMapChangeDimension() {
23556
23857
  /* nothing */
23557
23858
  },
@@ -23646,8 +23947,8 @@
23646
23947
  // rest props
23647
23948
  props = __rest(_a, ["children", "controls", "displayTimeInMap"]);
23648
23949
 
23649
- var dimensions = props.dimensions;
23650
- var adagucRef = React__namespace.useRef(null);
23950
+ var dimensions = props.dimensions,
23951
+ mapId = props.mapId;
23651
23952
  return /*#__PURE__*/React__namespace.createElement(material.Box, {
23652
23953
  sx: {
23653
23954
  display: 'grid',
@@ -23663,13 +23964,16 @@
23663
23964
  }
23664
23965
  }, /*#__PURE__*/React__namespace.createElement(ZoomControls, {
23665
23966
  onZoomIn: function onZoomIn() {
23666
- return adagucRef.current.zoomIn(undefined);
23967
+ var wmjsMap = getWMJSMapById(mapId);
23968
+ wmjsMap.zoomIn(undefined);
23667
23969
  },
23668
23970
  onZoomOut: function onZoomOut() {
23669
- return adagucRef.current.zoomOut();
23971
+ var wmjsMap = getWMJSMapById(mapId);
23972
+ wmjsMap.zoomOut();
23670
23973
  },
23671
23974
  onZoomReset: function onZoomReset() {
23672
- return adagucRef.current.zoomToLayer(adagucRef.current.getActiveLayer());
23975
+ var wmjsMap = getWMJSMapById(mapId);
23976
+ wmjsMap.zoomToLayer(wmjsMap.getActiveLayer());
23673
23977
  }
23674
23978
  })), /*#__PURE__*/React__namespace.createElement(material.Box, {
23675
23979
  sx: {
@@ -23677,9 +23981,6 @@
23677
23981
  gridRowStart: 1
23678
23982
  }
23679
23983
  }, /*#__PURE__*/React__namespace.createElement(ReactMapView, __assign({}, props, {
23680
- onRegisterAdaguc: function onRegisterAdaguc(adaguc) {
23681
- adagucRef.current = adaguc;
23682
- },
23683
23984
  showLegend: false,
23684
23985
  displayTimeInMap: false
23685
23986
  }), children)), displayTimeInMap && dimensions && /*#__PURE__*/React__namespace.createElement(MapTime, {
@@ -24058,7 +24359,7 @@
24058
24359
  dispatch(mapActions$1.setMapPinLocation(payload));
24059
24360
  }, [dispatch]);
24060
24361
  var setSelectedFeature = React__namespace.useCallback(function (payload) {
24061
- dispatch(mapActions$1.setSelectedFeature(payload));
24362
+ dispatch(layerActions.setSelectedFeature(payload));
24062
24363
  }, [dispatch]);
24063
24364
  var activeWindowId = reactRedux.useSelector(getActiveWindowId);
24064
24365
 
@@ -24068,29 +24369,29 @@
24068
24369
 
24069
24370
  useKeyboardZoomAndPan(isActiveWindowId(), mapId);
24070
24371
  useTouchZoomPan(isActiveWindowId(), mapId);
24071
- return /*#__PURE__*/React__namespace.createElement("div", {
24072
- style: {
24073
- height: '100%'
24074
- }
24075
- }, /*#__PURE__*/React__namespace.createElement(MapView, __assign({}, props, {
24076
- mapId: mapId,
24077
- onMount: function onMount() {
24078
- registerMap({
24079
- mapId: mapId
24080
- });
24081
- syncGroupAddSource({
24082
- id: mapId,
24083
- type: [SYNCGROUPS_TYPE_SETTIME, SYNCGROUPS_TYPE_SETBBOX]
24084
- });
24085
- },
24086
- onUnMount: function onUnMount() {
24372
+ React__namespace.useEffect(function () {
24373
+ registerMap({
24374
+ mapId: mapId
24375
+ });
24376
+ syncGroupAddSource({
24377
+ id: mapId,
24378
+ type: [SYNCGROUPS_TYPE_SETTIME, SYNCGROUPS_TYPE_SETBBOX]
24379
+ });
24380
+ return function () {
24087
24381
  unregisterMap({
24088
24382
  mapId: mapId
24089
24383
  });
24090
24384
  syncGroupRemoveSource({
24091
24385
  id: mapId
24092
24386
  });
24093
- },
24387
+ };
24388
+ }, [mapId, registerMap, syncGroupAddSource, syncGroupRemoveSource, unregisterMap]);
24389
+ return /*#__PURE__*/React__namespace.createElement("div", {
24390
+ style: {
24391
+ height: '100%'
24392
+ }
24393
+ }, /*#__PURE__*/React__namespace.createElement(MapView, __assign({}, props, {
24394
+ mapId: mapId,
24094
24395
  srs: srs,
24095
24396
  bbox: bbox,
24096
24397
  mapPinLocation: displayMapPin ? mapPinLocation : undefined,
@@ -24145,7 +24446,7 @@
24145
24446
  },
24146
24447
  onClickFeature: layer.geojson ? function (event) {
24147
24448
  setSelectedFeature({
24148
- mapId: mapId,
24449
+ layerId: layer.id,
24149
24450
  selectedFeatureIndex: event === null || event === void 0 ? void 0 : event.featureIndex
24150
24451
  });
24151
24452
  } : undefined
@@ -24714,6 +25015,410 @@
24714
25015
  });
24715
25016
  };
24716
25017
 
25018
+ /* *
25019
+ * Licensed under the Apache License, Version 2.0 (the "License");
25020
+ * you may not use this file except in compliance with the License.
25021
+ * You may obtain a copy of the License at
25022
+ *
25023
+ * http://www.apache.org/licenses/LICENSE-2.0
25024
+ *
25025
+ * Unless required by applicable law or agreed to in writing, software
25026
+ * distributed under the License is distributed on an "AS IS" BASIS,
25027
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
25028
+ * See the License for the specific language governing permissions and
25029
+ * limitations under the License.
25030
+ *
25031
+ * Copyright 2022 - Koninklijk Nederlands Meteorologisch Instituut (KNMI)
25032
+ * Copyright 2022 - Finnish Meteorological Institute (FMI)
25033
+ * */
25034
+ /**
25035
+ * Get the title for this WMS layer based on its layerId. If not defined, layerId is used instead.
25036
+ * @param layerId
25037
+ * @returns Title for the layer
25038
+ */
25039
+
25040
+ var getTitle = function getTitle(layerId) {
25041
+ var wmjsLayer = getWMLayerById(layerId);
25042
+ return wmjsLayer ? wmjsLayer.title || wmjsLayer.name : layerId;
25043
+ };
25044
+ /**
25045
+ * Make a list of GFI Layers to display.
25046
+ * @param layers
25047
+ * @param mapId
25048
+ * @returns
25049
+ */
25050
+
25051
+
25052
+ var getLayersToUpdate = function getLayersToUpdate(layers, mapId) {
25053
+ var wmjsMap = getWMJSMapById(mapId);
25054
+ if (!wmjsMap || !layers || layers.length === 0) return [];
25055
+ return layers.filter(function (layer) {
25056
+ return layer && layer.enabled && !!getWMLayerById(layer.id);
25057
+ }).map(function (layer) {
25058
+ /*
25059
+ We need a wmjsLayer to build the getfeatureinfo url (getWMSGetFeatureInfoRequestURL function).
25060
+ But it seems that its dimension are lazely updated (by ReactMapView).
25061
+ Therefore make a clone of this layer and set its dimensions based on the layer object.
25062
+ Otherwise we risk making a getfeatureinfo call with outdated dimension values.
25063
+ */
25064
+ var wmjsLayer = getWMLayerById(layer.id).cloneLayer();
25065
+ layer.dimensions && layer.dimensions.forEach(function (dim) {
25066
+ var wmDim = wmjsLayer.getDimension(dim.name);
25067
+
25068
+ if (wmDim && wmDim.getValue() !== dim.currentValue) {
25069
+ wmDim.setValue(dim.currentValue);
25070
+ }
25071
+ });
25072
+ return {
25073
+ layerId: layer.id,
25074
+ url: wmjsMap.getWMSGetFeatureInfoRequestURL(wmjsLayer, "" + wmjsMap.getMapPin().getXY().x, "" + wmjsMap.getMapPin().getXY().y, 'text/html'),
25075
+ title: getTitle(layer.id)
25076
+ };
25077
+ });
25078
+ };
25079
+
25080
+ /* *
25081
+ * Licensed under the Apache License, Version 2.0 (the "License");
25082
+ * you may not use this file except in compliance with the License.
25083
+ * You may obtain a copy of the License at
25084
+ *
25085
+ * http://www.apache.org/licenses/LICENSE-2.0
25086
+ *
25087
+ * Unless required by applicable law or agreed to in writing, software
25088
+ * distributed under the License is distributed on an "AS IS" BASIS,
25089
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
25090
+ * See the License for the specific language governing permissions and
25091
+ * limitations under the License.
25092
+ *
25093
+ * Copyright 2022 - Koninklijk Nederlands Meteorologisch Instituut (KNMI)
25094
+ * Copyright 2022 - Finnish Meteorological Institute (FMI)
25095
+ * */
25096
+
25097
+ var GetFeatureInfoDialog = function GetFeatureInfoDialog(_a) {
25098
+ var layers = _a.layers,
25099
+ isOpen = _a.isOpen,
25100
+ onClose = _a.onClose,
25101
+ _b = _a.onMouseDown,
25102
+ onMouseDown = _b === void 0 ? function () {} : _b,
25103
+ mapId = _a.mapId,
25104
+ _c = _a.showMapId,
25105
+ showMapId = _c === void 0 ? false : _c,
25106
+ _d = _a.order,
25107
+ order = _d === void 0 ? 0 : _d,
25108
+ _e = _a.source,
25109
+ source = _e === void 0 ? 'app' : _e,
25110
+ mapPinLocation = _a.mapPinLocation;
25111
+ /* Ref and state for maplocation */
25112
+
25113
+ var mapLocationWasChanged = React__default["default"].useRef(false);
25114
+
25115
+ var _f = __read(React__default["default"].useState(false), 2),
25116
+ isInitialMapLocationChanged = _f[0],
25117
+ setInitialMapLocationIsChanged = _f[1];
25118
+ /* Ref, state and update function for results per layer map */
25119
+
25120
+
25121
+ var gfiResultMap = React__default["default"].useRef(new Map()).current;
25122
+
25123
+ var _g = __read(React__default["default"].useState(), 2),
25124
+ triggerRerender = _g[1];
25125
+
25126
+ var updateLayerResult = function updateLayerResult(_a) {
25127
+ var layerId = _a.layerId,
25128
+ data = _a.data,
25129
+ isLoading = _a.isLoading;
25130
+ gfiResultMap.set(layerId, {
25131
+ data: data,
25132
+ isLoading: isLoading
25133
+ });
25134
+ triggerRerender("" + layerId + isLoading);
25135
+ };
25136
+ /* Build a layerlist array with a set of arguments per layer to do the query for */
25137
+
25138
+
25139
+ var layerToUpdateList = isOpen ? getLayersToUpdate(layers, mapId) : [];
25140
+ /*
25141
+ Build a string based on the GFI urls. If this changes for whatever reason we need to update.
25142
+ These strings can change very often, therefore they need to be debounced and only use the most recent result must be used.
25143
+ */
25144
+
25145
+ var debouncedlayerListString = api.useDebounce(layerToUpdateList.map(function (layer) {
25146
+ return layer.url;
25147
+ }).join(','), 100);
25148
+ /* Do a GFI call to the server and use the updateLayerResult to provide the results. */
25149
+
25150
+ var fetchLayerInfo = function fetchLayerInfo(url, layerId) {
25151
+ return __awaiter(void 0, void 0, void 0, function () {
25152
+ var data, error_1, errorMessage;
25153
+ return __generator(this, function (_a) {
25154
+ switch (_a.label) {
25155
+ case 0:
25156
+ _a.trys.push([0, 2,, 3]);
25157
+
25158
+ updateLayerResult({
25159
+ layerId: layerId,
25160
+ data: '',
25161
+ isLoading: true
25162
+ });
25163
+ return [4
25164
+ /*yield*/
25165
+ , axios__default["default"].get(url)];
25166
+
25167
+ case 1:
25168
+ data = _a.sent().data;
25169
+ updateLayerResult({
25170
+ layerId: layerId,
25171
+ data: data,
25172
+ isLoading: false
25173
+ });
25174
+ return [3
25175
+ /*break*/
25176
+ , 3];
25177
+
25178
+ case 2:
25179
+ error_1 = _a.sent();
25180
+ errorMessage = error_1.message;
25181
+ updateLayerResult({
25182
+ layerId: layerId,
25183
+ data: errorMessage,
25184
+ isLoading: false
25185
+ });
25186
+ return [3
25187
+ /*break*/
25188
+ , 3];
25189
+
25190
+ case 3:
25191
+ return [2
25192
+ /*return*/
25193
+ ];
25194
+ }
25195
+ });
25196
+ });
25197
+ };
25198
+ /* Wait till the user has clicked the map. */
25199
+
25200
+
25201
+ React__default["default"].useEffect(function () {
25202
+ if (mapLocationWasChanged.current !== false) {
25203
+ setInitialMapLocationIsChanged(true);
25204
+ }
25205
+
25206
+ mapLocationWasChanged.current = true;
25207
+ }, [mapPinLocation]);
25208
+ /* For each changed getfeature url string, load new data using WMS GetFeatureInfo */
25209
+
25210
+ React__default["default"].useEffect(function () {
25211
+ if (isInitialMapLocationChanged && isOpen) {
25212
+ layerToUpdateList.forEach(function (_a) {
25213
+ var url = _a.url,
25214
+ layerId = _a.layerId;
25215
+ fetchLayerInfo(url, layerId);
25216
+ });
25217
+ } // eslint-disable-next-line react-hooks/exhaustive-deps
25218
+
25219
+ }, [debouncedlayerListString]);
25220
+ var hasLayers = layers && layers.length > 0;
25221
+ return /*#__PURE__*/React__default["default"].createElement(shared.ToolContainerDraggable, {
25222
+ startPosition: {
25223
+ right: 10,
25224
+ top: 80
25225
+ },
25226
+ minWidth: 300,
25227
+ onClose: onClose,
25228
+ title: showMapId ? "Event marker info " + mapId : 'Event marker info',
25229
+ headerSize: "small",
25230
+ initialMaxHeight: 440,
25231
+ isOpen: isOpen,
25232
+ "data-testid": "moveable-getfeatureinfo",
25233
+ bounds: "parent",
25234
+ onMouseDown: onMouseDown,
25235
+ order: order,
25236
+ source: source
25237
+ }, /*#__PURE__*/React__default["default"].createElement(material.Box, {
25238
+ sx: {
25239
+ padding: 0
25240
+ }
25241
+ }, isOpen && hasLayers && isInitialMapLocationChanged && /*#__PURE__*/React__default["default"].createElement(material.Box, {
25242
+ "data-testid": "GetFeatureInfoList"
25243
+ }, layerToUpdateList.map(function (layer) {
25244
+ var layerId = layer.layerId,
25245
+ title = layer.title,
25246
+ url = layer.url;
25247
+ var result = gfiResultMap.get(layerId);
25248
+ if (!result) return null;
25249
+ return /*#__PURE__*/React__default["default"].createElement(material.Grid, {
25250
+ key: layerId,
25251
+ sx: {
25252
+ margin: '4px 6px 4px 6px',
25253
+ padding: '6px',
25254
+ backgroundColor: 'geowebColors.cards.cardContainer',
25255
+ border: 'solid 1px',
25256
+ borderColor: 'geowebColors.cards.cardContainerBorder'
25257
+ }
25258
+ }, /*#__PURE__*/React__default["default"].createElement(material.Typography, {
25259
+ variant: "subtitle1"
25260
+ }, title, "\xA0", /*#__PURE__*/React__default["default"].createElement(material.IconButton, {
25261
+ sx: {
25262
+ "float": 'right'
25263
+ },
25264
+ size: "small",
25265
+ "aria-label": "Open layer featureinfo in another page",
25266
+ onClick: function onClick() {
25267
+ window.open(url);
25268
+ }
25269
+ }, /*#__PURE__*/React__default["default"].createElement(theme.ExitDomain, null))), !result.isLoading ? /*#__PURE__*/React__default["default"].createElement("div", {
25270
+ style: {
25271
+ fontSize: '11px',
25272
+ padding: '6px',
25273
+ margin: '0',
25274
+ fontFamily: 'Roboto,Helvetica,Arial,sans-serif',
25275
+ fontWeight: '400',
25276
+ lineHeight: '1.75',
25277
+ letterSpacing: '0.25px'
25278
+ },
25279
+ "data-testid": "layer-result-ready-" + layerId,
25280
+ // eslint-disable-next-line react/no-danger
25281
+ dangerouslySetInnerHTML: {
25282
+ __html: result.data.replace(/<hr\/>/g, '')
25283
+ }
25284
+ }) : /*#__PURE__*/React__default["default"].createElement("div", {
25285
+ "data-testid": "layer-result-loading-" + layerId
25286
+ }, /*#__PURE__*/React__default["default"].createElement(material.CircularProgress, {
25287
+ "data-testid": "spinner",
25288
+ color: "inherit"
25289
+ })));
25290
+ })), hasLayers && !isInitialMapLocationChanged && /*#__PURE__*/React__default["default"].createElement(material.Typography, {
25291
+ "data-testid": "click-on-map-for-info",
25292
+ variant: "subtitle1",
25293
+ sx: {
25294
+ padding: '10px'
25295
+ }
25296
+ }, "Click on the map for info."), !hasLayers && /*#__PURE__*/React__default["default"].createElement(material.Typography, {
25297
+ "data-testid": "NoLayers",
25298
+ variant: "subtitle1",
25299
+ sx: {
25300
+ padding: '10px'
25301
+ }
25302
+ }, "No layers added to the map.")));
25303
+ };
25304
+
25305
+ /* *
25306
+ * Licensed under the Apache License, Version 2.0 (the "License");
25307
+ * you may not use this file except in compliance with the License.
25308
+ * You may obtain a copy of the License at
25309
+ *
25310
+ * http://www.apache.org/licenses/LICENSE-2.0
25311
+ *
25312
+ * Unless required by applicable law or agreed to in writing, software
25313
+ * distributed under the License is distributed on an "AS IS" BASIS,
25314
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
25315
+ * See the License for the specific language governing permissions and
25316
+ * limitations under the License.
25317
+ *
25318
+ * Copyright 2022 - Koninklijk Nederlands Meteorologisch Instituut (KNMI)
25319
+ * Copyright 2022 - Finnish Meteorological Institute (FMI)
25320
+ * */
25321
+
25322
+ var GetFeatureInfoConnect = function GetFeatureInfoConnect(_a) {
25323
+ var _b = _a.showMapId,
25324
+ showMapId = _b === void 0 ? false : _b,
25325
+ mapId = _a.mapId;
25326
+ var dispatch = reactRedux.useDispatch();
25327
+ var getFeatureInfoType = "getfeatureinfo-" + mapId;
25328
+ var mapPinLocation = reactRedux.useSelector(function (store) {
25329
+ return getPinLocation(store, mapId);
25330
+ });
25331
+ var toggleMapPinIsVisible = React__namespace.useCallback(function (displayMapPin) {
25332
+ dispatch(mapActions$1.toggleMapPinIsVisible({
25333
+ mapId: mapId,
25334
+ displayMapPin: displayMapPin
25335
+ }));
25336
+ }, [dispatch, mapId]);
25337
+
25338
+ var enableMapPin = function enableMapPin() {
25339
+ dispatch(mapActions$1.setDisableMapPin({
25340
+ mapId: mapId,
25341
+ disableMapPin: false
25342
+ }));
25343
+ };
25344
+
25345
+ var mapLayers = reactRedux.useSelector(function (store) {
25346
+ return getMapLayers(store, mapId);
25347
+ });
25348
+
25349
+ var _c = useSetupDialog(getFeatureInfoType),
25350
+ dialogOrder = _c.dialogOrder,
25351
+ isDialogOpen = _c.isDialogOpen,
25352
+ uiSource = _c.uiSource,
25353
+ setDialogOrder = _c.setDialogOrder,
25354
+ onCloseDialog = _c.onCloseDialog;
25355
+
25356
+ React__namespace.useEffect(function () {
25357
+ toggleMapPinIsVisible(isDialogOpen);
25358
+
25359
+ if (isDialogOpen) {
25360
+ enableMapPin();
25361
+ }
25362
+ /* Do not respond on changes of isMapPinVisible, to allow other components to open/close the mappin. */
25363
+ // eslint-disable-next-line react-hooks/exhaustive-deps
25364
+
25365
+ }, [isDialogOpen, toggleMapPinIsVisible]);
25366
+ return /*#__PURE__*/React__namespace.createElement(GetFeatureInfoDialog, {
25367
+ layers: mapLayers,
25368
+ isOpen: isDialogOpen,
25369
+ onClose: onCloseDialog,
25370
+ mapId: mapId,
25371
+ showMapId: showMapId,
25372
+ onMouseDown: setDialogOrder,
25373
+ order: dialogOrder,
25374
+ source: uiSource,
25375
+ mapPinLocation: mapPinLocation
25376
+ });
25377
+ };
25378
+
25379
+ /* *
25380
+ * Licensed under the Apache License, Version 2.0 (the "License");
25381
+ * you may not use this file except in compliance with the License.
25382
+ * You may obtain a copy of the License at
25383
+ *
25384
+ * http://www.apache.org/licenses/LICENSE-2.0
25385
+ *
25386
+ * Unless required by applicable law or agreed to in writing, software
25387
+ * distributed under the License is distributed on an "AS IS" BASIS,
25388
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
25389
+ * See the License for the specific language governing permissions and
25390
+ * limitations under the License.
25391
+ *
25392
+ * Copyright 2022 - Koninklijk Nederlands Meteorologisch Instituut (KNMI)
25393
+ * Copyright 2022 - Finnish Meteorological Institute (FMI)
25394
+ * */
25395
+
25396
+ var GetFeatureInfoButtonConnect = function GetFeatureInfoButtonConnect(_a) {
25397
+ var mapId = _a.mapId,
25398
+ _b = _a.source,
25399
+ source = _b === void 0 ? 'app' : _b;
25400
+ var dispatch = reactRedux.useDispatch();
25401
+ var gfiType = "getfeatureinfo-" + mapId;
25402
+ var isOpenInStore = reactRedux.useSelector(function (store) {
25403
+ return getisDialogOpen(store, gfiType);
25404
+ });
25405
+ var openGfiDialog = React__namespace.useCallback(function () {
25406
+ dispatch(uiActions.setActiveMapIdForDialog({
25407
+ type: gfiType,
25408
+ mapId: mapId,
25409
+ setOpen: !isOpenInStore,
25410
+ source: source,
25411
+ origin: MapActionOrigin.map
25412
+ }));
25413
+ }, [mapId, dispatch, isOpenInStore, source, gfiType]);
25414
+ return /*#__PURE__*/React__namespace.createElement(MapControlButton, {
25415
+ title: "Get information for a specific location",
25416
+ "data-testid": "open-getfeatureinfo",
25417
+ onClick: openGfiDialog,
25418
+ isActive: isOpenInStore
25419
+ }, /*#__PURE__*/React__namespace.createElement(theme.Info, null));
25420
+ };
25421
+
24717
25422
  /* *
24718
25423
  * Licensed under the Apache License, Version 2.0 (the "License");
24719
25424
  * you may not use this file except in compliance with the License.
@@ -24737,7 +25442,8 @@
24737
25442
  padding: '5px',
24738
25443
  zIndex: 50,
24739
25444
  color: theme.palette.common.black,
24740
- whiteSpace: 'nowrap'
25445
+ whiteSpace: 'nowrap',
25446
+ userSelect: 'none'
24741
25447
  };
24742
25448
  };
24743
25449
 
@@ -24782,8 +25488,10 @@
24782
25488
  shouldShowLayerManager = _a.shouldShowLayerManager,
24783
25489
  _q = _a.showClock,
24784
25490
  showClock = _q === void 0 ? true : _q,
25491
+ _r = _a.displayGetFeatureInfoButtonInMap,
25492
+ displayGetFeatureInfoButtonInMap = _r === void 0 ? false : _r,
24785
25493
  children = _a.children,
24786
- props = __rest(_a, ["id", "title", "layers", "shouldAutoUpdate", "shouldAnimate", "bbox", "srs", "shouldShowZoomControls", "displayMapPin", "showTimeSlider", "disableTimeSlider", "displayTimeInMap", "displayLayerManagerAndLegendButtonInMap", "displayDimensionSelectButtonInMap", "multiLegend", "shouldShowLayerManager", "showClock", "children"]);
25494
+ props = __rest(_a, ["id", "title", "layers", "shouldAutoUpdate", "shouldAnimate", "bbox", "srs", "shouldShowZoomControls", "displayMapPin", "showTimeSlider", "disableTimeSlider", "displayTimeInMap", "displayLayerManagerAndLegendButtonInMap", "displayDimensionSelectButtonInMap", "multiLegend", "shouldShowLayerManager", "showClock", "displayGetFeatureInfoButtonInMap", "children"]);
24787
25495
 
24788
25496
  var dispatch = reactRedux.useDispatch();
24789
25497
  var mapId = React__default["default"].useRef(id || generateMapId()).current;
@@ -24851,6 +25559,8 @@
24851
25559
  multiLegend: multiLegend
24852
25560
  }), displayDimensionSelectButtonInMap && /*#__PURE__*/React__default["default"].createElement(MultiDimensionSelectMapButtonsConnect, {
24853
25561
  mapId: mapId
25562
+ }), displayGetFeatureInfoButtonInMap && /*#__PURE__*/React__default["default"].createElement(GetFeatureInfoButtonConnect, {
25563
+ mapId: mapId
24854
25564
  })), !disableTimeSlider && /*#__PURE__*/React__default["default"].createElement(material.Box, {
24855
25565
  sx: {
24856
25566
  position: 'absolute',
@@ -24873,6 +25583,9 @@
24873
25583
  multiLegend: multiLegend
24874
25584
  }), showClock && /*#__PURE__*/React__default["default"].createElement(TimeSliderClockConnect, {
24875
25585
  mapId: mapId
25586
+ }), displayGetFeatureInfoButtonInMap && /*#__PURE__*/React__default["default"].createElement(GetFeatureInfoConnect, {
25587
+ showMapId: true,
25588
+ mapId: mapId
24876
25589
  }), /*#__PURE__*/React__default["default"].createElement(DockedLayerManagerConnect, {
24877
25590
  mapId: mapId,
24878
25591
  bounds: "parent"
@@ -25242,7 +25955,8 @@
25242
25955
  var mapPreset = initialProps.mapPreset;
25243
25956
  return /*#__PURE__*/React__default["default"].createElement(ConfigurableMapConnect, __assign({}, mapPreset, {
25244
25957
  id: id,
25245
- "data-testid": "coreConfigurableMapConnect"
25958
+ "data-testid": "coreConfigurableMapConnect",
25959
+ displayGetFeatureInfoButtonInMap: true
25246
25960
  }));
25247
25961
  }
25248
25962
 
@@ -26016,6 +26730,7 @@
26016
26730
  exports.ConfigurableMapConnect = ConfigurableMapConnect;
26017
26731
  exports.CoreThemeProvider = CoreThemeProvider;
26018
26732
  exports.CoreThemeStoreProvider = CoreThemeStoreProvider;
26733
+ exports.DockedLayerManagerConnect = DockedLayerManagerConnect;
26019
26734
  exports.HarmonieTempAndPrecipPreset = HarmonieTempAndPrecipPreset;
26020
26735
  exports.LayerManagerConnect = LayerManagerConnect;
26021
26736
  exports.LayerManagerMapButtonConnect = LayerManagerMapButtonConnect;
@@ -26051,6 +26766,7 @@
26051
26766
  exports.generateLayerId = generateLayerId;
26052
26767
  exports.generateMapId = generateMapId;
26053
26768
  exports.generateTimesliderId = generateTimesliderId;
26769
+ exports.getDrawFunctionFromStore = getDrawFunctionFromStore;
26054
26770
  exports.getFirstTimeStepForLayerId = getFirstTimeStepForLayerId;
26055
26771
  exports.getInitialAppPresets = getInitialAppPresets;
26056
26772
  exports.getLastTimeStepForLayerId = getLastTimeStepForLayerId;
@@ -26062,6 +26778,8 @@
26062
26778
  exports.getWMLayerById = getWMLayerById;
26063
26779
  exports.layerActions = layerActions;
26064
26780
  exports.layerReducer = reducer$6;
26781
+ exports.layerSelectors = selectors$2;
26782
+ exports.layerTypes = types$3;
26065
26783
  exports.mapActions = mapActions;
26066
26784
  exports.mapModuleConfig = moduleConfig;
26067
26785
  exports.mapSelectors = selectors;
@@ -26071,6 +26789,7 @@
26071
26789
  exports.parseLayer = parseLayer;
26072
26790
  exports.publicLayers = publicLayers;
26073
26791
  exports.publicServices = publicServices;
26792
+ exports.registerDrawFunction = registerDrawFunction;
26074
26793
  exports.registerWMJSMap = registerWMJSMap;
26075
26794
  exports.registerWMLayer = registerWMLayer;
26076
26795
  exports.snackbarActions = snackbarActions;
@@ -26079,6 +26798,7 @@
26079
26798
  exports.synchronizationGroupModuleConfig = synchronizationGroupConfig;
26080
26799
  exports.synchronizationGroupsConfig = synchronizationGroupConfig;
26081
26800
  exports.testLayers = testLayers;
26801
+ exports.timeSliderUtils = TimeSliderUtils;
26082
26802
  exports.uiActions = uiActions;
26083
26803
  exports.uiModuleConfig = uiModuleConfig;
26084
26804
  exports.uiSelectors = selectors$1;