@opengeoweb/core 4.2.0 → 4.4.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 (116) hide show
  1. package/index.esm.js +2047 -1262
  2. package/index.umd.js +2057 -1207
  3. package/lib/components/CanvasComponent/CanvasComponent.d.ts +7 -6
  4. package/lib/components/ConfigurableMap/ConfigurableMapConnect.d.ts +1 -0
  5. package/lib/components/LayerManager/LayerContainerRow/LayerRow/RenderLayers/RenderLayers.d.ts +1 -1
  6. package/lib/components/LayerManager/LayerContainerRow/LayerRow/RenderStyles/RenderStyles.d.ts +1 -1
  7. package/lib/components/LayerManager/LayerSelect/KeywordFilterResults/KeywordFilterResults.stories.d.ts +12 -16
  8. package/lib/components/LayerManager/LayerSelect/LayerInfo/LayerInfoLegend.d.ts +10 -0
  9. package/lib/components/{TimeSlider/TimeSliderScaleSlider/TimeSliderScaleSlider.spec.d.ts → LayerManager/LayerSelect/LayerInfo/LayerInfoLegend.spec.d.ts} +0 -0
  10. package/lib/components/LayerManager/LayerSelect/LayerInfo/LayerInfoList.d.ts +6 -5
  11. package/lib/components/LayerManager/LayerSelect/LayerInfo/LayerInfoText.d.ts +9 -0
  12. package/lib/components/LayerManager/LayerSelect/LayerInfo/LayerInfoUtils.d.ts +7 -1
  13. package/lib/components/LayerManager/LayerSelect/LayerList/LayerList.d.ts +4 -5
  14. package/lib/components/LayerManager/LayerSelect/LayerList/LayerListConnect.d.ts +1 -0
  15. package/lib/components/LayerManager/LayerSelect/LayerList/LayerListDimensions.d.ts +7 -0
  16. package/lib/components/LayerManager/LayerSelect/LayerList/LayerListRow.d.ts +1 -0
  17. package/lib/components/LayerManager/LayerSelect/LayerSelect.d.ts +4 -0
  18. package/lib/components/LayerManager/LayerSelect/LayerSelect.stories.d.ts +8 -0
  19. package/lib/components/LayerManager/LayerSelect/LayerSelectUtils.d.ts +75 -0
  20. package/lib/components/LayerManager/LayerSelect/ServiceOptionsDialog/ServiceOptionsDialog.d.ts +2 -0
  21. package/lib/components/LayerManager/LayerSelect/ServiceOptionsDialog/ServiceOptionsDialog.stories.d.ts +12 -16
  22. package/lib/components/LayerManager/LayerSelect/ServiceOptionsDialog/ServiceOptionsDialogConnect.d.ts +2 -0
  23. package/lib/components/LayerManager/LayerSelect/ServicePopup/ServicePopup.stories.d.ts +24 -32
  24. package/lib/components/LayerManager/LayerSelect/ServicePopup/utils.d.ts +2 -0
  25. package/lib/components/LayerManager/useFetchServices.d.ts +1 -1
  26. package/lib/components/Legend/LegendLayout.d.ts +13 -0
  27. package/lib/components/{TimeSlider/TimeSliderScaleSlider/TimeSliderScaleSliderConnect.spec.d.ts → Legend/LegendLayout.spec.d.ts} +0 -0
  28. package/lib/components/MapControls/MapControlButton.d.ts +1 -1
  29. package/lib/components/MultiMapView/ModelRunInterval/ModelRunInterval.d.ts +6 -0
  30. package/lib/components/MultiMapView/MultiMapViewConnect.d.ts +1 -0
  31. package/lib/components/ReactMapView/AdagucMapDraw.d.ts +1 -1
  32. package/lib/components/ReactMapView/AdagucMapDrawTools.d.ts +1 -1
  33. package/lib/components/ReactMapView/ReactMapView.d.ts +7 -6
  34. package/lib/components/ReactMapView/ReactMapViewParseLayer.d.ts +3 -3
  35. package/lib/components/SyncGroups/SimpleTimeSliderConnect.d.ts +9 -1
  36. package/lib/components/SyncGroups/selector.d.ts +6 -6
  37. package/lib/components/TimeSlider/TimeSlider.d.ts +0 -1
  38. package/lib/components/TimeSlider/TimeSlider.stories.d.ts +15 -0
  39. package/lib/components/TimeSlider/TimeSliderButtons/AutoUpdateButton/AutoUpdateButtonConnect.d.ts +13 -1
  40. package/lib/components/TimeSlider/TimeSliderButtons/BackwardForwardStepButton/BackwardForwardStepButton.d.ts +10 -0
  41. package/lib/components/TimeSlider/TimeSliderButtons/BackwardForwardStepButton/BackwardForwardStepButton.spec.d.ts +1 -0
  42. package/lib/components/TimeSlider/TimeSliderButtons/BackwardForwardStepButton/BackwardForwardStepButtonConnect.d.ts +6 -0
  43. package/lib/components/TimeSlider/TimeSliderButtons/BackwardForwardStepButton/BackwardForwardStepButtonConnect.spec.d.ts +1 -0
  44. package/lib/components/TimeSlider/TimeSliderButtons/HideSliderButton/HideSliderButton.d.ts +7 -0
  45. package/lib/components/TimeSlider/TimeSliderButtons/HideSliderButton/HideSliderButton.spec.d.ts +1 -0
  46. package/lib/components/TimeSlider/TimeSliderButtons/NowButton/NowButton.d.ts +8 -0
  47. package/lib/components/TimeSlider/TimeSliderButtons/NowButton/NowButton.spec.d.ts +1 -0
  48. package/lib/components/TimeSlider/TimeSliderButtons/NowButton/NowButtonConnect.d.ts +9 -0
  49. package/lib/components/TimeSlider/TimeSliderButtons/NowButton/NowButtonConnect.spec.d.ts +1 -0
  50. package/lib/components/TimeSlider/TimeSliderButtons/OptionsMenuButton/OptionsMenuButton.d.ts +4 -1
  51. package/lib/components/TimeSlider/TimeSliderButtons/OptionsMenuButton/OptionsMenuButton.stories.d.ts +24 -0
  52. package/lib/components/TimeSlider/TimeSliderButtons/OptionsMenuButton/OptionsMenuButtonConnect.d.ts +1 -0
  53. package/lib/components/TimeSlider/TimeSliderButtons/PlayButton/PlayButtonConnect.d.ts +19 -18
  54. package/lib/components/TimeSlider/TimeSliderButtons/TimeScaleButton/TimeScaleButton.d.ts +11 -0
  55. package/lib/components/TimeSlider/TimeSliderButtons/TimeScaleButton/TimeScaleButton.spec.d.ts +1 -0
  56. package/lib/components/TimeSlider/TimeSliderButtons/TimeScaleButton/TimeScaleButtonConnect.d.ts +4 -0
  57. package/lib/components/TimeSlider/TimeSliderButtons/TimeScaleButton/TimeScaleButtonConnect.spec.d.ts +1 -0
  58. package/lib/components/TimeSlider/TimeSliderButtons/TimeSliderButtons.d.ts +2 -0
  59. package/lib/components/TimeSlider/TimeSliderButtons/TimeSliderButtons.stories.d.ts +6 -0
  60. package/lib/components/TimeSlider/TimeSliderButtons/TimeSliderButtonsConnect.d.ts +1 -0
  61. package/lib/components/TimeSlider/TimeSliderButtons/TimeSliderMenu/TimeSliderMenu.stories.d.ts +12 -16
  62. package/lib/components/TimeSlider/TimeSliderButtons/TimeStepButton/TimeStepButton.stories.d.ts +10 -16
  63. package/lib/components/TimeSlider/TimeSliderClock/TimeSliderClock.d.ts +5 -0
  64. package/lib/components/TimeSlider/TimeSliderClock/TimeSliderClock.stories.d.ts +24 -0
  65. package/lib/components/TimeSlider/TimeSliderClock/TimeSliderClockConnect.d.ts +4 -0
  66. package/lib/components/TimeSlider/TimeSliderClock/TimeSliderClockConnect.spec.d.ts +1 -0
  67. package/lib/components/TimeSlider/TimeSliderConnect.d.ts +12 -1
  68. package/lib/components/TimeSlider/TimeSliderLegend/TimeSliderLegend.d.ts +1 -0
  69. package/lib/components/TimeSlider/TimeSliderLegend/TimeSliderLegendConnect.d.ts +22 -3
  70. package/lib/components/TimeSlider/TimeSliderLegend/TimeSliderLegendRenderFunctions.d.ts +1 -1
  71. package/lib/components/TimeSlider/TimeSliderRail/TimeSliderRailConnect.d.ts +22 -3
  72. package/lib/components/TimeSlider/TimeSliderRail/TimeSliderRailRenderFunctions.d.ts +1 -1
  73. package/lib/components/TimeSlider/TimeSliderUtils.d.ts +9 -1
  74. package/lib/components/WMSLoader/WMSLayerTree/WMSLayerTreeConnect.d.ts +11 -1
  75. package/lib/components/WMSLoader/services.d.ts +2 -1
  76. package/lib/index.d.ts +52 -52
  77. package/lib/store/coreModuleConfig.d.ts +1 -1
  78. package/lib/store/generic/actions.d.ts +2 -2
  79. package/lib/store/generic/config.d.ts +3 -2
  80. package/lib/store/generic/index.d.ts +10 -10
  81. package/lib/store/generic/selectors.d.ts +7 -7
  82. package/lib/store/generic/synchronizationGroups/reducer.d.ts +2 -2
  83. package/lib/store/generic/synchronizationGroups/selectors.d.ts +15 -15
  84. package/lib/store/layerSelect/config.d.ts +3 -2
  85. package/lib/store/layerSelect/reducer.d.ts +1 -1
  86. package/lib/store/layerSelect/sagas.d.ts +3 -1
  87. package/lib/store/layerSelect/selectors.d.ts +66 -48
  88. package/lib/store/layerSelect/types.d.ts +3 -3
  89. package/lib/store/mapStore/config.d.ts +3 -2
  90. package/lib/store/mapStore/layers/reducer.d.ts +1 -1
  91. package/lib/store/mapStore/layers/selectors.d.ts +129 -109
  92. package/lib/store/mapStore/layers/types.d.ts +2 -1
  93. package/lib/store/mapStore/map/actions.d.ts +2 -2
  94. package/lib/store/mapStore/map/reducer.d.ts +33 -33
  95. package/lib/store/mapStore/map/sagas.d.ts +3 -2
  96. package/lib/store/mapStore/map/selectors.d.ts +297 -297
  97. package/lib/store/mapStore/service/reducer.d.ts +1 -1
  98. package/lib/store/mapStore/service/selectors.d.ts +36 -63
  99. package/lib/store/mapStore/service/types.d.ts +10 -2
  100. package/lib/store/snackbar/config.d.ts +3 -2
  101. package/lib/store/snackbar/reducer.d.ts +1 -1
  102. package/lib/store/snackbar/selectors.d.ts +2 -2
  103. package/lib/store/ui/config.d.ts +3 -2
  104. package/lib/store/ui/reducer.d.ts +1 -1
  105. package/lib/store/ui/selectors.d.ts +35 -35
  106. package/lib/store/ui/types.d.ts +11 -3
  107. package/lib/store/utils.d.ts +2 -0
  108. package/lib/storybookUtils/store.d.ts +1 -1
  109. package/lib/utils/__mocks__/getCapabilities.d.ts +26 -36
  110. package/lib/utils/defaultConfigurations.d.ts +2 -2
  111. package/lib/utils/defaultTestSettings.d.ts +4 -2
  112. package/lib/utils/testUtils.d.ts +1 -1
  113. package/package.json +16 -13
  114. package/lib/components/TimeSlider/TimeSliderScaleSlider/TimeSliderScaleSlider.d.ts +0 -12
  115. package/lib/components/TimeSlider/TimeSliderScaleSlider/TimeSliderScaleSlider.stories.d.ts +0 -13
  116. package/lib/components/TimeSlider/TimeSliderScaleSlider/TimeSliderScaleSliderConnect.d.ts +0 -24
package/index.esm.js CHANGED
@@ -3,26 +3,31 @@ import produce$1, { current, produce } from 'immer';
3
3
  import moment from 'moment';
4
4
  import * as React from 'react';
5
5
  import React__default, { Component, useRef, useState, useEffect, useCallback } from 'react';
6
- import _, { isEqual, debounce, groupBy, throttle, range } from 'lodash';
7
- import { takeLatest, put, select, call, all, takeEvery, delay } from 'redux-saga/effects';
6
+ import _, { debounce, isEqual, groupBy, throttle, range } from 'lodash';
7
+ import { takeLatest, put, select, call, takeEvery, all, delay } from 'redux-saga/effects';
8
8
  import { connect, useDispatch, useSelector, Provider } from 'react-redux';
9
- import { Tooltip, Paper, Box, Typography, Grid, InputLabel, IconButton, CircularProgress, List, ListSubheader, ListItem, ListItemText, Dialog, DialogTitle, DialogContent, DialogContentText, TextField, DialogActions, Button, MenuItem, FormControl, LinearProgress, InputAdornment, ListItemSecondaryAction, ListItemIcon, Checkbox, Switch, styled, Slider, Menu, Popover, useTheme, SliderThumb, Snackbar } from '@mui/material';
10
- import { ToolButton, ToolContainerDraggable, TooltipSelect, AlertIcon, tooltipContainerStyles, sliderHeaderStyle, CustomSlider, ToggleMenu, ManagerButton, EnableButton, AlertBanner, ManagerDeleteButton, calculateDialogSizeAndPosition, CustomToggleButton, useIsMounted } from '@opengeoweb/shared';
11
- import { Pause, Play, Cached, Add, Copy, Flag, DragHandle as DragHandle$1, Filter, Search, Clear, Close, Info, DimensionsTime, DimensionsRefTime, DimensionsElevation, DimensionsOther, Edit, Visibility, Delete, Home, Minus, Layers, Equalizer, Link, LinkOff, AutoUpdateActive, AutoUpdateInActive, TextIcon, Speed, FastForward, Options, SliderThumb as SliderThumb$1, List as List$1, ThemeWrapper, lightTheme } from '@opengeoweb/theme';
12
- import { legendImageStore, WMImageEventType, getLegendGraphicURLForLayer, WMGetServiceFromStore, LayerType as LayerType$1, getMapImageStore, WMBBOX, debug, DebugType, WMJSMap, WMLayer } from '@opengeoweb/webmap';
13
- import { Sortable, ReactSortable } from 'react-sortablejs';
9
+ import { Tooltip, Paper, Box, Typography, Grid, InputLabel, IconButton, CircularProgress, List, ListSubheader, ListItem, ListItemText, Dialog, DialogTitle, DialogContent, DialogContentText, TextField, DialogActions, Button, MenuItem, FormControl, LinearProgress, InputAdornment, Backdrop, ListItemSecondaryAction, ListItemIcon, Checkbox, Switch, styled, Slider, Menu, Popper, useTheme, Snackbar } from '@mui/material';
10
+ import { ToolButton, ToolContainerDraggable, TooltipSelect, AlertIcon, tooltipContainerStyles, sliderHeaderStyle, CustomSlider, ToggleMenu, ManagerButton, EnableButton, AlertBanner, ManagerDeleteButton, calculateDialogSizeAndPosition, CustomToggleButton, useIsMounted, useMakeSureContainerStaysInsideWindow, withEggs } from '@opengeoweb/shared';
11
+ import { Pause, Play, Cached, Add, Copy, Flag, DragHandle as DragHandle$1, Filter, Search, Clear, Close, Info, DimensionsOther, DimensionsElevation, DimensionsRefTime, DimensionsTime, Edit, Visibility, Delete, Home, Minus, Layers, Equalizer, Link, LinkOff, AutoUpdateActive, AutoUpdateInActive, TextIcon, Speed, FastForward, Clock, Now, Options, StepForward, StepBackward, ChevronDown, ChevronUp, List as List$1, Resize, ThemeWrapper, lightTheme } from '@opengeoweb/theme';
12
+ import { legendImageStore, WMImageEventType, getLegendGraphicURLForLayer, WMGetServiceFromStore, LayerType as LayerType$1, clearImageCache, getMapImageStore, WMBBOX, debug, DebugType, WMJSMap, WMLayer } from '@opengeoweb/webmap';
13
+ import { ReactSortable } from 'react-sortablejs';
14
+ import Sortable from 'sortablejs';
14
15
  import { ReactHookFormProvider, defaultFormOptions, ReactHookFormTextField } from '@opengeoweb/form-fields';
15
16
  import { useFormContext } from 'react-hook-form';
16
17
  import { FixedSizeList } from 'react-window';
17
18
  import Box$1 from '@mui/material/Box';
18
19
  import Typography$1 from '@mui/material/Typography';
19
20
  import Grid$1 from '@mui/material/Grid';
21
+ import Tooltip$1 from '@mui/material/Tooltip';
20
22
  import { debounce as debounce$1 } from 'throttle-debounce';
21
23
  import cloneDeep from 'lodash.clonedeep';
22
24
  import proj4 from 'proj4';
23
25
  import * as turf from '@turf/turf';
24
- import { createStore, DynamicModuleLoader } from 'redux-dynamic-modules';
25
- import { getSagaExtension } from 'redux-dynamic-modules-saga';
26
+ import { Box as Box$2 } from '@mui/system';
27
+ import Draggable from 'react-draggable';
28
+ import { Resizable } from 're-resizable';
29
+ import { createStore } from '@redux-eggs/redux-toolkit';
30
+ import { getSagaExtension } from '@redux-eggs/saga-extension';
26
31
 
27
32
  function _typeof(obj) {
28
33
  "@babel/helpers - typeof";
@@ -361,6 +366,7 @@ var LayerActionOrigin;
361
366
  LayerActionOrigin["ReactMapViewParseLayer"] = "ReactMapViewParseLayer";
362
367
  LayerActionOrigin["setLayerDimensionSaga"] = "setLayerDimensionSaga";
363
368
  LayerActionOrigin["toggleAutoUpdateSaga"] = "toggleAutoUpdateSaga";
369
+ LayerActionOrigin["unregisterMapSaga"] = "unregisterMapSaga";
364
370
  })(LayerActionOrigin || (LayerActionOrigin = {}));
365
371
 
366
372
  /* *
@@ -592,6 +598,7 @@ var types$2 = /*#__PURE__*/Object.freeze({
592
598
  get LayerActionOrigin () { return LayerActionOrigin; }
593
599
  });
594
600
 
601
+ var millisecondsInSecond = 1000;
595
602
  var defaultAnimationDelayAtStart = 250;
596
603
  var defaultDelay = 1000; // [ms]
597
604
 
@@ -608,6 +615,11 @@ var getSpeedDelay = function getSpeedDelay(speedFactor) {
608
615
  var getSpeedFactor = function getSpeedFactor(speedDelay) {
609
616
  return defaultDelay / speedDelay;
610
617
  };
618
+ var getSelectedTime = function getSelectedTime(timeDimension) {
619
+ var currentValueIsValid = timeDimension && timeDimension.currentValue && moment.utc(timeDimension.currentValue).isValid();
620
+ var selectedTime = currentValueIsValid && timeDimension ? moment.utc(timeDimension.currentValue).unix() : moment.utc().unix();
621
+ return selectedTime;
622
+ };
611
623
  /**
612
624
  * Returns time bounds from the given dimension. If no time dimension given, current time is returned as default
613
625
  */
@@ -617,13 +629,12 @@ var getTimeBounds = function getTimeBounds(dimensions) {
617
629
  second: 0,
618
630
  millisecond: 0
619
631
  }).unix();
620
- var timeDimension = dimensions ? dimensions.find(function (dim) {
632
+ var timeDimension = dimensions === null || dimensions === void 0 ? void 0 : dimensions.find(function (dim) {
621
633
  return dim.name === 'time';
622
- }) : null;
634
+ });
623
635
  var startTime = timeDimension && timeDimension.minValue ? moment.utc(timeDimension.minValue).unix() : defaultStartEnd;
624
636
  var endTime = timeDimension && timeDimension.maxValue ? moment.utc(timeDimension.maxValue).unix() : defaultStartEnd;
625
- var currentValueIsValid = timeDimension && timeDimension.currentValue && moment.utc(timeDimension.currentValue).isValid();
626
- var selectedTime = currentValueIsValid ? moment.utc(timeDimension.currentValue).unix() : moment.utc().unix();
637
+ var selectedTime = getSelectedTime(timeDimension);
627
638
  return {
628
639
  selectedTime: selectedTime,
629
640
  startTime: startTime,
@@ -658,22 +669,12 @@ var timestampToPixel = function timestampToPixel(timestamp, centerTime, widthPx,
658
669
  var pixelToTimestamp = function pixelToTimestamp(timePx, centerTime, widthPx, secondsPerPx) {
659
670
  return centerTime - (widthPx / 2 - timePx) * secondsPerPx;
660
671
  };
661
- var onSetNewDateDebouncer;
662
672
  var onsetNewDateDebounced = function onsetNewDateDebounced(dateToSet, onSetNewDate) {
663
- /* Debounce the dateToSet with a simple timeout */
664
- if (onSetNewDateDebouncer === undefined) {
665
- onSetNewDateDebouncer = dateToSet;
673
+ debounce(function () {
666
674
  onSetNewDate(dateToSet);
667
- window.setTimeout(function () {
668
- if (onSetNewDateDebouncer !== undefined && onSetNewDateDebouncer !== dateToSet) {
669
- onSetNewDate(onSetNewDateDebouncer);
670
- }
671
-
672
- onSetNewDateDebouncer = undefined;
673
- }, 10);
674
- } else {
675
- onSetNewDateDebouncer = dateToSet;
676
- }
675
+ }, 10, {
676
+ leading: true
677
+ })();
677
678
  };
678
679
  var roundWithTimeStep = function roundWithTimeStep(unixTime, timeStep, type) {
679
680
  var adjustedTimeStep = timeStep * 60;
@@ -695,7 +696,9 @@ var roundWithTimeStep = function roundWithTimeStep(unixTime, timeStep, type) {
695
696
  var setNewRoundedTime = function setNewRoundedTime(x, centerTime, width, secondsPerPx, timeStep, dataStartTime, dataEndTime, onSetNewDate) {
696
697
  var unixTime = pixelToTimestamp(x, centerTime, width, secondsPerPx);
697
698
  var roundedTime = roundWithTimeStep(unixTime, timeStep);
698
- var selectedTimeString = moment.unix(Math.min(Math.max(roundedTime, dataStartTime), dataEndTime)).toISOString();
699
+ var maxTime = Math.max(roundedTime, dataStartTime);
700
+ var newTime = Math.min(maxTime, dataEndTime || roundedTime);
701
+ var selectedTimeString = moment.unix(newTime).toISOString();
699
702
  onsetNewDateDebounced(selectedTimeString, onSetNewDate);
700
703
  };
701
704
  var getDataLimitsFromLayers = function getDataLimitsFromLayers(layers) {
@@ -722,47 +725,31 @@ var getDataLimitsFromLayers = function getDataLimitsFromLayers(layers) {
722
725
  */
723
726
  [2147483647, 0]);
724
727
  };
725
- var getNextTimeStepvalue = function getNextTimeStepvalue(value, max) {
726
- var newValue = value + 1;
727
- return newValue > max ? max : newValue;
728
- };
729
- var getPreviousTimeStepvalue = function getPreviousTimeStepvalue(value, min) {
730
- var newValue = value - 1;
731
- return newValue < min ? min : newValue;
732
- };
733
- var getValueFromKeyboardEvent = function getValueFromKeyboardEvent(event, value, min, max) {
734
- var supportFourDirectionNavigation = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : false;
728
+ var setPreviousTimeStep = function setPreviousTimeStep(timeStep, curTime, dataStartTime, onSetNewDate) {
729
+ var prevTimeStep = moment.utc(curTime).subtract(timeStep, 'm').toISOString();
735
730
 
736
- if (!supportFourDirectionNavigation) {
737
- if (event.ctrlKey || event.metaKey) {
738
- switch (event.key) {
739
- case 'ArrowDown':
740
- return getPreviousTimeStepvalue(value, min);
731
+ if (!prevTimeStep) {
732
+ return;
733
+ }
741
734
 
742
- case 'ArrowUp':
743
- return getNextTimeStepvalue(value, max);
735
+ if (moment.utc(prevTimeStep) < moment.utc(dataStartTime * millisecondsInSecond)) {
736
+ return;
737
+ }
744
738
 
745
- default:
746
- return null;
747
- }
748
- }
749
- } else {
750
- // currently supportFourDirectionNavigation (left/right/up/down) is only used in horizontal slider TimeSliderScaleSlider
751
- switch (event.key) {
752
- case 'ArrowDown':
753
- case 'ArrowLeft':
754
- return getPreviousTimeStepvalue(value, min);
739
+ onsetNewDateDebounced(prevTimeStep, onSetNewDate);
740
+ };
741
+ var setNextTimeStep = function setNextTimeStep(timeStep, curTime, dataEndTime, onSetNewDate) {
742
+ var nextTimeStep = moment.utc(curTime).add(timeStep, 'm').toISOString();
755
743
 
756
- case 'ArrowUp':
757
- case 'ArrowRight':
758
- return getNextTimeStepvalue(value, max);
744
+ if (!nextTimeStep) {
745
+ return;
746
+ }
759
747
 
760
- default:
761
- return null;
762
- }
748
+ if (moment.utc(nextTimeStep) > moment.utc(dataEndTime * millisecondsInSecond)) {
749
+ return;
763
750
  }
764
751
 
765
- return null;
752
+ onsetNewDateDebounced(nextTimeStep, onSetNewDate);
766
753
  };
767
754
  var getTimeStepFromDataInterval = function getTimeStepFromDataInterval(timeInterval) {
768
755
  switch (timeInterval.isRegularInterval) {
@@ -920,6 +907,25 @@ var AUTO_MOVE_AREA_PADDING = 1;
920
907
  var getAutoMoveAreaWidth = function getAutoMoveAreaWidth(scale) {
921
908
  return (scale === Scale.Year ? needleGeom.largeWidth : needleGeom.smallWidth) / 2 + AUTO_MOVE_AREA_PADDING;
922
909
  };
910
+ /** Reusable business logic for how to handle events that set time to now (closest).
911
+ * Used in NowButton and TimeSliderLegend.
912
+ */
913
+
914
+ var handleSetNowEvent = function handleSetNowEvent(timeStep, dataStartTime, dataEndTime, currentTime, onSetNewDate, onSetCenterTime) {
915
+ if (dataStartTime < dataEndTime) {
916
+ if (dataEndTime < currentTime) {
917
+ onSetNewDate(moment.utc(dataEndTime * millisecondsInSecond).toISOString());
918
+ onSetCenterTime(dataEndTime);
919
+ } else if (dataStartTime > currentTime) {
920
+ onSetNewDate(moment.utc(dataStartTime * millisecondsInSecond).toISOString());
921
+ onSetCenterTime(dataStartTime);
922
+ } else {
923
+ var closestToCurrent = roundWithTimeStep(currentTime, timeStep);
924
+ onSetNewDate(moment.utc(closestToCurrent * millisecondsInSecond).toISOString());
925
+ onSetCenterTime(closestToCurrent);
926
+ }
927
+ }
928
+ };
923
929
 
924
930
  var createMap = function createMap(_ref) {
925
931
  var id = _ref.id,
@@ -1833,6 +1839,9 @@ var selectorMemoizationOptions = {
1833
1839
  resultEqualityCheck: isEqual
1834
1840
  }
1835
1841
  };
1842
+ var isUserAddedService = function isUserAddedService(scope) {
1843
+ return scope === 'user';
1844
+ };
1836
1845
 
1837
1846
  /* *
1838
1847
  * Licensed under the Apache License, Version 2.0 (the "License");
@@ -1954,25 +1963,6 @@ var getLayerFromService = createSelector(function (store, serviceUrl) {
1954
1963
  var getLayerStyles$1 = createSelector(getLayerFromService, function (layer) {
1955
1964
  return layer && layer.styles ? layer.styles : [];
1956
1965
  }, selectorMemoizationOptions);
1957
- /**
1958
- * Gets services and maps them into an array
1959
- *
1960
- * Example: services = getServices(store)
1961
- * @param {object} store store: object - Store object
1962
- * @returns {array} returnType: [] - array containing services
1963
- */
1964
-
1965
- createSelector(servicesStore, function (store) {
1966
- var services = store ? store.byId : {};
1967
- var arrayOfServiceObjects = Object.keys(services).map(function (key) {
1968
- return {
1969
- name: services[key].name,
1970
- serviceUrl: services[key].serviceUrl,
1971
- isUserAddedService: services[key].isUserAddedService
1972
- };
1973
- });
1974
- return arrayOfServiceObjects;
1975
- }, selectorMemoizationOptions);
1976
1966
 
1977
1967
  var moveToTop = function moveToTop(list, element) {
1978
1968
  var filteredList = list.filter(function (item) {
@@ -2823,6 +2813,22 @@ var getAllLayers = createSelector(getLayersIds, getLayersById, function (ids, la
2823
2813
  return layers[layerId];
2824
2814
  });
2825
2815
  }, selectorMemoizationOptions);
2816
+ /**
2817
+ * Retrieves all layers (including base layers and overlayers) for the given mapId
2818
+ *
2819
+ * Example: layers = getLayersByMapId(store, mapId)
2820
+ * @param {object} store store: object - object from which the layers state will be extracted
2821
+ * @param {string} mapId mapId: string - mapId
2822
+ * @returns {array} returnType: ReduxLayer[] - an array of all layers containing layer information (service, name, style, enabled etc.)
2823
+ */
2824
+
2825
+ var getLayersByMapId = createSelector(getAllLayers, function (_store, _mapId) {
2826
+ return _mapId;
2827
+ }, function (layers, mapId) {
2828
+ return layers.filter(function (layer) {
2829
+ return layer.mapId === mapId;
2830
+ });
2831
+ }, selectorMemoizationOptions);
2826
2832
  /**
2827
2833
  * Retrieves all layers that aren't base layers and aren't overlayers
2828
2834
  *
@@ -3043,7 +3049,7 @@ var getUiStore = function getUiStore(store) {
3043
3049
  *
3044
3050
  * Example: getDialogDetailsByType(store, 'legend')
3045
3051
  * @param {object} store store object from which the ui state wll be extracted
3046
- * @param {string} dialogType type of the dialog 'legend' | 'layerManager' | 'dimensionSelect-elevation'
3052
+ * @param {string} dialogType type of the dialog
3047
3053
  * @returns {array} [string, boolean] first element gives the active map id, second element whether the dialog is open
3048
3054
  */
3049
3055
 
@@ -3058,7 +3064,7 @@ var getDialogDetailsByType = function getDialogDetailsByType(store, dialogType)
3058
3064
  * For a given ui component: gets wether the dialog is open or closed
3059
3065
  *
3060
3066
  * @param {object} store store object from which the ui state wll be extracted
3061
- * @param {string} dialogType type of the dialog 'legend' | 'layerManager' | 'dimensionSelect-elevation'
3067
+ * @param {string} dialogType type of the dialog
3062
3068
  * @returns {boolean} returnType: boolean
3063
3069
  */
3064
3070
 
@@ -3073,7 +3079,7 @@ var getisDialogOpen = createSelector(getDialogDetailsByType, function (details)
3073
3079
  *For a given ui component: gets the active map Id
3074
3080
  *
3075
3081
  * @param {object} store store object from which the ui state wll be extracted
3076
- * @param {string} dialogType type of the dialog 'legend' | 'layerManager' | 'dimensionSelect-elevation'
3082
+ * @param {string} dialogType type of the dialog
3077
3083
  * @returns {string} returnType: string - the active map id
3078
3084
  */
3079
3085
 
@@ -3088,7 +3094,7 @@ var getDialogMapId = createSelector(getDialogDetailsByType, function (details) {
3088
3094
  *For a given ui component: gets the order of visible dialog
3089
3095
  *
3090
3096
  * @param {object} store store object from which the ui state wll be extracted
3091
- * @param {DialogType} dialogType type of the dialog 'legend' | 'layerManager' | 'dimensionSelect-elevation' | dimensionSelect-ensemble_member
3097
+ * @param {DialogType} dialogType type of the dialog
3092
3098
  * @returns {number} the higher the order number the higher the zIndex
3093
3099
  */
3094
3100
 
@@ -3114,7 +3120,7 @@ var getDialogOrder = createSelector(function (store, dialogType) {
3114
3120
  *For a given ui component: returns if ordered on top
3115
3121
  *
3116
3122
  * @param {object} store store object from which the ui state wll be extracted
3117
- * @param {DialogType} dialogType type of the dialog 'legend' | 'layerManager' | 'dimensionSelect-elevation' | dimensionSelect-ensemble_member
3123
+ * @param {DialogType} dialogType type of the dialog
3118
3124
  * @returns {boolean}
3119
3125
  */
3120
3126
 
@@ -4361,6 +4367,25 @@ var selectors = /*#__PURE__*/Object.freeze({
4361
4367
  getMapPresetError: getMapPresetError
4362
4368
  });
4363
4369
 
4370
+ var DialogTypes;
4371
+
4372
+ (function (DialogTypes) {
4373
+ DialogTypes["LayerInfo"] = "layerInfo";
4374
+ DialogTypes["SyncGroups"] = "syncGroups";
4375
+ DialogTypes["TimeSeriesSelect"] = "timeSeriesSelect";
4376
+ DialogTypes["TimeSeriesManager"] = "timeSeriesManager";
4377
+ DialogTypes["KeywordFilter"] = "keywordFilter";
4378
+ DialogTypes["DimensionSelectEnsembleMember"] = "dimensionSelect-ensemble_member";
4379
+ DialogTypes["DimensionSelectElevation"] = "dimensionSelect-elevation";
4380
+ DialogTypes["LayerManager"] = "layerManager";
4381
+ DialogTypes["LayerSelect"] = "layerSelect";
4382
+ })(DialogTypes || (DialogTypes = {}));
4383
+
4384
+ var types = /*#__PURE__*/Object.freeze({
4385
+ __proto__: null,
4386
+ get DialogTypes () { return DialogTypes; }
4387
+ });
4388
+
4364
4389
  var initialState$1 = {
4365
4390
  filters: {
4366
4391
  searchFilter: '',
@@ -4384,7 +4409,7 @@ var initialState$1 = {
4384
4409
  };
4385
4410
  var slice$1 = createSlice({
4386
4411
  initialState: initialState$1,
4387
- name: 'layerSelect',
4412
+ name: DialogTypes.LayerSelect,
4388
4413
  reducers: {
4389
4414
  setSearchFilter: function setSearchFilter(draft, action) {
4390
4415
  var filterText = action.payload.filterText;
@@ -4401,7 +4426,7 @@ var slice$1 = createSlice({
4401
4426
  serviceUrl = _action$payload.serviceUrl,
4402
4427
  _abstract = _action$payload["abstract"],
4403
4428
  keywords = _action$payload.keywords,
4404
- isUserAddedService = _action$payload.isUserAddedService,
4429
+ scope = _action$payload.scope,
4405
4430
  groups = _action$payload.groups;
4406
4431
 
4407
4432
  if (!draft.filters.activeServices.byId[serviceId]) {
@@ -4441,7 +4466,7 @@ var slice$1 = createSlice({
4441
4466
  serviceId: serviceId,
4442
4467
  enabled: draft.allServicesEnabled,
4443
4468
  filterIds: filterIds,
4444
- isUserAddedService: isUserAddedService,
4469
+ scope: scope,
4445
4470
  serviceName: serviceName,
4446
4471
  serviceUrl: serviceUrl,
4447
4472
  "abstract": _abstract
@@ -4536,6 +4561,61 @@ var slice$1 = createSlice({
4536
4561
  var reducer$1 = slice$1.reducer;
4537
4562
  var layerSelectActions = slice$1.actions;
4538
4563
 
4564
+ /* *
4565
+ * Licensed under the Apache License, Version 2.0 (the "License");
4566
+ * you may not use this file except in compliance with the License.
4567
+ * You may obtain a copy of the License at
4568
+ *
4569
+ * http://www.apache.org/licenses/LICENSE-2.0
4570
+ *
4571
+ * Unless required by applicable law or agreed to in writing, software
4572
+ * distributed under the License is distributed on an "AS IS" BASIS,
4573
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
4574
+ * See the License for the specific language governing permissions and
4575
+ * limitations under the License.
4576
+ *
4577
+ * Copyright 2021 - Koninklijk Nederlands Meteorologisch Instituut (KNMI)
4578
+ * Copyright 2021 - Finnish Meteorological Institute (FMI)
4579
+ * */
4580
+ var filterLayersFromService = function filterLayersFromService(serviceId, services, filterIds, allFiltersActive, searchString) {
4581
+ var mapStoreService = services[serviceId];
4582
+ if (!mapStoreService) return [];
4583
+
4584
+ if (searchString === '' && allFiltersActive) {
4585
+ return mapStoreService.layers.filter(function (layer) {
4586
+ return layer.leaf;
4587
+ });
4588
+ }
4589
+
4590
+ var searchStringArray = searchString.split(' ');
4591
+ return mapStoreService.layers.filter(function (layer) {
4592
+ return searchStringArray.every(function (search) {
4593
+ var _a, _b, _c;
4594
+
4595
+ var searchLowercase = search.toLowerCase();
4596
+ var layerFilterIds = layer.path.map(function (group) {
4597
+ return "groups-".concat(group);
4598
+ }).concat(layer.keywords.map(function (keyword) {
4599
+ return "keywords-".concat(keyword);
4600
+ }));
4601
+ var isFilterInLayer = (layerFilterIds === null || layerFilterIds === void 0 ? void 0 : layerFilterIds.some(function (id) {
4602
+ return filterIds.includes(id);
4603
+ })) || allFiltersActive;
4604
+ var isSearchTextInLayerFilter = layerFilterIds === null || layerFilterIds === void 0 ? void 0 : layerFilterIds.some(function (filterId) {
4605
+ return filterId.toLowerCase().includes(searchLowercase);
4606
+ });
4607
+ var isSearchTextInLayerName = (_a = layer.name) === null || _a === void 0 ? void 0 : _a.toLowerCase().includes(searchLowercase);
4608
+ var isSearchTextInLayerText = (_b = layer.text) === null || _b === void 0 ? void 0 : _b.toLowerCase().includes(searchLowercase);
4609
+ var isSearchTextInLayerAbstract = (_c = layer["abstract"]) === null || _c === void 0 ? void 0 : _c.toLowerCase().includes(searchLowercase);
4610
+ var isSearchTextInServiceName = mapStoreService.name.toLowerCase().includes(searchLowercase);
4611
+ var isSearchTextInLayer = isSearchTextInLayerName || isSearchTextInLayerText || isSearchTextInLayerAbstract || isSearchTextInLayerFilter || isSearchTextInServiceName;
4612
+ return isFilterInLayer && isSearchTextInLayer;
4613
+ });
4614
+ }).filter(function (layer) {
4615
+ return layer.leaf;
4616
+ });
4617
+ };
4618
+
4539
4619
  /* *
4540
4620
  * Licensed under the Apache License, Version 2.0 (the "License");
4541
4621
  * you may not use this file except in compliance with the License.
@@ -4694,6 +4774,22 @@ var isAllFiltersChecked = createSelector(layerSelectStore, function (store) {
4694
4774
  var getActiveLayerInfo = createSelector(layerSelectStore, function (store) {
4695
4775
  return store === null || store === void 0 ? void 0 : store.activeLayerInfo;
4696
4776
  });
4777
+ /**
4778
+ * Returns a filtered active layer object based on the given filter settings
4779
+ * Example: layerSelectSelectors.getFilteredLayers(store, filteredSettings);
4780
+ * @param {object} store store: object - object from which the service state will be extracted
4781
+ * @returns {array} returnType: ActiveLayerObject - an array of all filtered activelayers
4782
+ */
4783
+
4784
+ var getFilteredLayers = createSelector([getEnabledServiceIds, getServices, getCheckedFilterIds, isAllFiltersChecked, getSearchFilter], function (enabledServiceIds, servicesStore, checkedFilterIds, allFiltersActive, searchFilter) {
4785
+ return enabledServiceIds.reduce(function (layerList, serviceId) {
4786
+ return layerList.concat(filterLayersFromService(serviceId, servicesStore, checkedFilterIds, allFiltersActive, searchFilter).map(function (layer) {
4787
+ return Object.assign(Object.assign({}, layer), {
4788
+ serviceName: serviceId
4789
+ });
4790
+ }));
4791
+ }, []);
4792
+ }, selectorMemoizationOptions);
4697
4793
 
4698
4794
  /* *
4699
4795
  * Licensed under the Apache License, Version 2.0 (the "License");
@@ -4769,17 +4865,6 @@ var getFirstSnackbarMessage = createSelector(getCurrentSnackbarMessages, functio
4769
4865
  return currentMessages.length > 0 ? currentMessages[0] : undefined;
4770
4866
  });
4771
4867
 
4772
- var DialogTypes;
4773
-
4774
- (function (DialogTypes) {
4775
- DialogTypes["LayerInfo"] = "layerInfo";
4776
- })(DialogTypes || (DialogTypes = {}));
4777
-
4778
- var types = /*#__PURE__*/Object.freeze({
4779
- __proto__: null,
4780
- get DialogTypes () { return DialogTypes; }
4781
- });
4782
-
4783
4868
  /* *
4784
4869
  * Licensed under the Apache License, Version 2.0 (the "License");
4785
4870
  * you may not use this file except in compliance with the License.
@@ -4807,8 +4892,8 @@ var syncGroupStore = function syncGroupStore(store) {
4807
4892
  * @returns {object} returnType: SynchronizationGroupState
4808
4893
  */
4809
4894
 
4810
- createSelector(syncGroupStore, function (store) {
4811
- return store || [];
4895
+ var getSynchronizationGroupState = createSelector(syncGroupStore, function (store) {
4896
+ return store || null;
4812
4897
  });
4813
4898
  var getSynchronizationGroup = function getSynchronizationGroup(state, id) {
4814
4899
  return syncGroupStore(state).groups.byId[id];
@@ -5110,7 +5195,7 @@ var getMapBaseLayerActionsTargets = function getMapBaseLayerActionsTargets(state
5110
5195
  var _marked$5 = /*#__PURE__*/regeneratorRuntime.mark(setTimeSaga),
5111
5196
  _marked2$5 = /*#__PURE__*/regeneratorRuntime.mark(setBBoxSaga),
5112
5197
  _marked3$4 = /*#__PURE__*/regeneratorRuntime.mark(layerActionsSaga),
5113
- _marked4$2 = /*#__PURE__*/regeneratorRuntime.mark(addLayerActionsSaga),
5198
+ _marked4$3 = /*#__PURE__*/regeneratorRuntime.mark(addLayerActionsSaga),
5114
5199
  _marked5$2 = /*#__PURE__*/regeneratorRuntime.mark(deleteLayerActionsSaga),
5115
5200
  _marked6$1 = /*#__PURE__*/regeneratorRuntime.mark(moveLayerActionsSaga),
5116
5201
  _marked7$1 = /*#__PURE__*/regeneratorRuntime.mark(setActiveLayerIdActionsSaga),
@@ -5264,7 +5349,7 @@ function addLayerActionsSaga(_ref4) {
5264
5349
  return _context4.stop();
5265
5350
  }
5266
5351
  }
5267
- }, _marked4$2);
5352
+ }, _marked4$3);
5268
5353
  }
5269
5354
  function deleteLayerActionsSaga(_ref5) {
5270
5355
  var payload, type, targets;
@@ -5567,7 +5652,7 @@ var createSyncGroupViewStateSelector = createSelector(groups, sources, createSyn
5567
5652
  var _marked$4 = /*#__PURE__*/regeneratorRuntime.mark(updateSourceValueWhenLinkingComponentToGroupSaga),
5568
5653
  _marked2$4 = /*#__PURE__*/regeneratorRuntime.mark(addGroupTargetSaga),
5569
5654
  _marked3$3 = /*#__PURE__*/regeneratorRuntime.mark(linkGroupTargetSaga),
5570
- _marked4$1 = /*#__PURE__*/regeneratorRuntime.mark(updateViewStateSaga),
5655
+ _marked4$2 = /*#__PURE__*/regeneratorRuntime.mark(updateViewStateSaga),
5571
5656
  _marked5$1 = /*#__PURE__*/regeneratorRuntime.mark(rootSaga$4);
5572
5657
  function updateSourceValueWhenLinkingComponentToGroupSaga(groupId, targetToUpdate) {
5573
5658
  var group;
@@ -5706,7 +5791,7 @@ function updateViewStateSaga() {
5706
5791
  return _context4.stop();
5707
5792
  }
5708
5793
  }
5709
- }, _marked4$1);
5794
+ }, _marked4$2);
5710
5795
  }
5711
5796
 
5712
5797
  function rootSaga$4() {
@@ -5757,25 +5842,9 @@ function rootSaga$4() {
5757
5842
  }, _marked5$1);
5758
5843
  }
5759
5844
 
5760
- /* *
5761
- * Licensed under the Apache License, Version 2.0 (the "License");
5762
- * you may not use this file except in compliance with the License.
5763
- * You may obtain a copy of the License at
5764
- *
5765
- * http://www.apache.org/licenses/LICENSE-2.0
5766
- *
5767
- * Unless required by applicable law or agreed to in writing, software
5768
- * distributed under the License is distributed on an "AS IS" BASIS,
5769
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
5770
- * See the License for the specific language governing permissions and
5771
- * limitations under the License.
5772
- *
5773
- * Copyright 2020 - Koninklijk Nederlands Meteorologisch Instituut (KNMI)
5774
- * Copyright 2020 - Finnish Meteorological Institute (FMI)
5775
- * */
5776
5845
  var synchronizationGroupConfig = {
5777
5846
  id: 'syncronizationGroupStore-module',
5778
- reducerMap: {
5847
+ reducersMap: {
5779
5848
  syncronizationGroupStore: reducer$2
5780
5849
  },
5781
5850
  sagas: [rootSaga$5, rootSaga$4]
@@ -5906,12 +5975,12 @@ function rootSaga$3() {
5906
5975
  * See the License for the specific language governing permissions and
5907
5976
  * limitations under the License.
5908
5977
  *
5909
- * Copyright 2021 - Koninklijk Nederlands Meteorologisch Instituut (KNMI)
5910
- * Copyright 2021 - Finnish Meteorological Institute (FMI)
5978
+ * Copyright 2022 - Koninklijk Nederlands Meteorologisch Instituut (KNMI)
5979
+ * Copyright 2022 - Finnish Meteorological Institute (FMI)
5911
5980
  * */
5912
5981
  var uiModuleConfig = {
5913
5982
  id: 'ui-module',
5914
- reducerMap: {
5983
+ reducersMap: {
5915
5984
  ui: reducer$4
5916
5985
  },
5917
5986
  sagas: [rootSaga$3]
@@ -5978,9 +6047,7 @@ var PlayButton = function PlayButton(_ref) {
5978
6047
  var isAnimating = _ref.isAnimating,
5979
6048
  isDisabled = _ref.isDisabled,
5980
6049
  _ref$onTogglePlayButt = _ref.onTogglePlayButton,
5981
- onTogglePlayButton = _ref$onTogglePlayButt === void 0 ? function () {
5982
- return null;
5983
- } : _ref$onTogglePlayButt;
6050
+ onTogglePlayButton = _ref$onTogglePlayButt === void 0 ? function () {} : _ref$onTogglePlayButt;
5984
6051
 
5985
6052
  var onTogglePlay = function onTogglePlay() {
5986
6053
  onTogglePlayButton();
@@ -6232,7 +6299,7 @@ var KNMIgeoservicesRadar = {
6232
6299
  };
6233
6300
  var KNMIgeoservicesObs = {
6234
6301
  name: 'KNMIgeoservicesObs',
6235
- url: 'https://geoservices.knmi.nl/adagucserver?dataset=OBS&service=WMS&',
6302
+ url: 'https://geoservices.knmi.nl/adagucserver?dataset=OBS',
6236
6303
  id: 'KNMIgeoservicesObs'
6237
6304
  };
6238
6305
  var KNMIgeoservicesKlimaatAtlas = {
@@ -6909,11 +6976,11 @@ var CanvasComponent = /*#__PURE__*/function (_Component) {
6909
6976
  return;
6910
6977
  }
6911
6978
 
6912
- if (parseInt(this.ctx.canvas.height, 10) !== this.currentHeight) {
6979
+ if (this.ctx.canvas.height !== this.currentHeight) {
6913
6980
  this.ctx.canvas.height = this.currentHeight;
6914
6981
  }
6915
6982
 
6916
- if (parseInt(this.ctx.canvas.width, 10) !== this.currentWidth) {
6983
+ if (this.ctx.canvas.width !== this.currentWidth) {
6917
6984
  this.ctx.canvas.width = this.currentWidth;
6918
6985
  }
6919
6986
 
@@ -7099,6 +7166,84 @@ CanvasComponent.defaultProps = {
7099
7166
  }
7100
7167
  };
7101
7168
 
7169
+ /* *
7170
+ * Licensed under the Apache License, Version 2.0 (the "License");
7171
+ * you may not use this file except in compliance with the License.
7172
+ * You may obtain a copy of the License at
7173
+ *
7174
+ * http://www.apache.org/licenses/LICENSE-2.0
7175
+ *
7176
+ * Unless required by applicable law or agreed to in writing, software
7177
+ * distributed under the License is distributed on an "AS IS" BASIS,
7178
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
7179
+ * See the License for the specific language governing permissions and
7180
+ * limitations under the License.
7181
+ *
7182
+ * Copyright 2022 - Koninklijk Nederlands Meteorologisch Instituut (KNMI)
7183
+ * Copyright 2022 - Finnish Meteorological Institute (FMI)
7184
+ * */
7185
+
7186
+ var LegendLayout = function LegendLayout(_ref) {
7187
+ var title = _ref.title,
7188
+ name = _ref.name,
7189
+ dimensions = _ref.dimensions,
7190
+ children = _ref.children,
7191
+ height = _ref.height,
7192
+ width = _ref.width,
7193
+ minWidth = _ref.minWidth;
7194
+ return /*#__PURE__*/React__default.createElement(Paper, {
7195
+ "data-testid": "legend",
7196
+ sx: {
7197
+ padding: '10px',
7198
+ border: '1px solid grey',
7199
+ backgroundColor: '#FFF',
7200
+ overflow: 'hidden',
7201
+ marginBottom: 0.5
7202
+ }
7203
+ }, /*#__PURE__*/React__default.createElement(Box, {
7204
+ "data-testid": "legend-title"
7205
+ }, /*#__PURE__*/React__default.createElement(Typography, {
7206
+ sx: {
7207
+ fontFamily: 'Roboto, Helvetica, Arial',
7208
+ fontSize: '10px',
7209
+ minWidth: '100%',
7210
+ wordWrap: 'break-word',
7211
+ color: 'common.black',
7212
+ whiteSpace: 'nowrap'
7213
+ },
7214
+ variant: "h3"
7215
+ }, title)), /*#__PURE__*/React__default.createElement(Tooltip, {
7216
+ title: title || 'loading',
7217
+ placement: "top"
7218
+ }, /*#__PURE__*/React__default.createElement(Box, {
7219
+ sx: {
7220
+ margin: '10px 0px 10px 0px',
7221
+ height: "".concat(height, "px"),
7222
+ width: "".concat(width, "px")
7223
+ }
7224
+ }, children)), /*#__PURE__*/React__default.createElement(Box, {
7225
+ "data-testid": "legend-info",
7226
+ sx: Object.assign({
7227
+ fontFamily: 'Roboto, Helvetica, Arial',
7228
+ fontSize: 10,
7229
+ color: 'common.black',
7230
+ overflowX: 'hidden',
7231
+ wordWrap: 'break-word',
7232
+ whiteSpace: 'nowrap'
7233
+ }, minWidth && {
7234
+ minWidth: "".concat(minWidth, "px")
7235
+ })
7236
+ }, dimensions && dimensions.map(function (dim) {
7237
+ return /*#__PURE__*/React__default.createElement(Box, {
7238
+ key: name + dim.name
7239
+ }, dim.name === 'time' ? "".concat(dim.currentValue) : /*#__PURE__*/React__default.createElement(React__default.Fragment, null, /*#__PURE__*/React__default.createElement(Box, {
7240
+ style: {
7241
+ fontWeight: 500
7242
+ }
7243
+ }, dim.name, ":"), dim.currentValue, " ", dim.units));
7244
+ })));
7245
+ };
7246
+
7102
7247
  var defaultCanvasWidth = 150;
7103
7248
  var defaultCanvasHeight = 30;
7104
7249
  /**
@@ -7180,46 +7325,20 @@ var Legend = function Legend(_ref) {
7180
7325
  like a title and the WMS legendgraphic url */
7181
7326
 
7182
7327
  var wmLayer = getWMLayerById(layer.id);
7183
- return /*#__PURE__*/React__default.createElement(Paper, {
7184
- "data-testid": "legend",
7185
- sx: {
7186
- padding: '10px',
7187
- border: '1px solid grey',
7188
- display: 'inline-block',
7189
- backgroundColor: '#FFF',
7190
- overflow: 'hidden',
7191
- marginBottom: 0.5
7192
- }
7193
- }, /*#__PURE__*/React__default.createElement(Box, {
7194
- "data-testid": "legend-title",
7195
- style: {
7196
- maxWidth: canvasContainerWidth
7197
- }
7198
- }, /*#__PURE__*/React__default.createElement(Typography, {
7199
- sx: {
7200
- fontFamily: 'Roboto, Helvetica, Arial',
7201
- fontSize: '10px',
7202
- minWidth: "".concat(defaultCanvasWidth, "px"),
7203
- wordWrap: 'break-word',
7204
- color: 'common.black'
7205
- },
7206
- variant: "h3"
7207
- }, wmLayer && wmLayer.title)), /*#__PURE__*/React__default.createElement(Tooltip, {
7208
- title: wmLayer && wmLayer.title || 'loading',
7209
- placement: "top"
7210
- }, /*#__PURE__*/React__default.createElement(Box, {
7211
- sx: {
7212
- margin: '10px 0px 10px 0px',
7213
- height: "".concat(canvasContainerHeight, "px"),
7214
- width: "".concat(canvasContainerWidth, "px")
7215
- }
7328
+ return /*#__PURE__*/React__default.createElement(LegendLayout, {
7329
+ title: wmLayer === null || wmLayer === void 0 ? void 0 : wmLayer.title,
7330
+ name: wmLayer === null || wmLayer === void 0 ? void 0 : wmLayer.name,
7331
+ dimensions: layer === null || layer === void 0 ? void 0 : layer.dimensions,
7332
+ height: canvasContainerHeight,
7333
+ width: canvasContainerWidth,
7334
+ minWidth: defaultCanvasWidth
7216
7335
  }, /*#__PURE__*/React__default.createElement(CanvasComponent, {
7217
7336
  redrawInterval: 500,
7218
7337
  onRenderCanvas: function onRenderCanvas(ctx, width, height) {
7219
7338
  /*
7220
- Check if the wmLayer is available, this happens when the WMS GetCapabilities is loaded and parsed.
7221
- Note that we cannot use the wmLayer variable above, as this one could contain a non initialized WMJSLayer.
7222
- */
7339
+ Check if the wmLayer is available, this happens when the WMS GetCapabilities is loaded and parsed.
7340
+ Note that we cannot use the wmLayer variable above, as this one could contain a non initialized WMJSLayer.
7341
+ */
7223
7342
  var legendWmLayer = getWMLayerById(layer.id);
7224
7343
  var legendUrl = getLegendGraphicURLForLayer(legendWmLayer);
7225
7344
  var image = legendImageStore.getImage(legendUrl);
@@ -7268,26 +7387,7 @@ var Legend = function Legend(_ref) {
7268
7387
  renderLegendGraphic(previousLegendImage.current, ctx, imageWidth, imageHeight);
7269
7388
  }
7270
7389
  }
7271
- }))), /*#__PURE__*/React__default.createElement(Box, {
7272
- "data-testid": "legend-info",
7273
- sx: {
7274
- fontFamily: 'Roboto, Helvetica, Arial',
7275
- fontSize: 10,
7276
- color: 'common.black',
7277
- overflowX: 'hidden',
7278
- minWidth: "".concat(defaultCanvasWidth, "px"),
7279
- wordWrap: 'break-word',
7280
- maxWidth: "".concat(canvasContainerWidth, "px")
7281
- }
7282
- }, layer.dimensions && layer.dimensions.map(function (dim) {
7283
- return /*#__PURE__*/React__default.createElement(Box, {
7284
- key: layer.name + dim.name
7285
- }, dim.name === 'time' ? "".concat(dim.currentValue) : /*#__PURE__*/React__default.createElement(React__default.Fragment, null, /*#__PURE__*/React__default.createElement(Box, {
7286
- style: {
7287
- fontWeight: 500
7288
- }
7289
- }, dim.name, ":"), dim.currentValue, " ", dim.units));
7290
- })));
7390
+ }));
7291
7391
  };
7292
7392
 
7293
7393
  /* *
@@ -7478,13 +7578,14 @@ var LegendConnect = function LegendConnect(_a) {
7478
7578
  var _marked$2 = /*#__PURE__*/regeneratorRuntime.mark(startAnimationSaga),
7479
7579
  _marked2$2 = /*#__PURE__*/regeneratorRuntime.mark(stopAnimationSaga),
7480
7580
  _marked3$1 = /*#__PURE__*/regeneratorRuntime.mark(deleteLayerSaga),
7481
- _marked4 = /*#__PURE__*/regeneratorRuntime.mark(updateAnimation),
7581
+ _marked4$1 = /*#__PURE__*/regeneratorRuntime.mark(updateAnimation),
7482
7582
  _marked5 = /*#__PURE__*/regeneratorRuntime.mark(setLayerDimensionsSaga),
7483
7583
  _marked6 = /*#__PURE__*/regeneratorRuntime.mark(toggleAutoUpdateSaga),
7484
7584
  _marked7 = /*#__PURE__*/regeneratorRuntime.mark(handleBaseLayersSaga),
7485
7585
  _marked8 = /*#__PURE__*/regeneratorRuntime.mark(setMapPresetSaga),
7486
7586
  _marked9 = /*#__PURE__*/regeneratorRuntime.mark(checkMapPresetForChangesSaga),
7487
- _marked10 = /*#__PURE__*/regeneratorRuntime.mark(rootSaga$2);
7587
+ _marked10 = /*#__PURE__*/regeneratorRuntime.mark(unregisterMapSaga),
7588
+ _marked11 = /*#__PURE__*/regeneratorRuntime.mark(rootSaga$2);
7488
7589
 
7489
7590
  var generateTimeList = function generateTimeList(start, end, interval) {
7490
7591
  var timeList = [];
@@ -7519,8 +7620,8 @@ function startAnimationSaga(_ref) {
7519
7620
  case 0:
7520
7621
  payload = _ref.payload;
7521
7622
  mapId = payload.mapId, start = payload.start, end = payload.end, interval = payload.interval, timeList = payload.timeList;
7522
- roundedStart = roundWithTimeStep(start && moment.utc(start).unix(), interval, 'ceil');
7523
- roundedEnd = roundWithTimeStep(end && moment.utc(end).unix(), interval, 'floor');
7623
+ roundedStart = roundWithTimeStep(Number(start && moment.utc(start).unix()), interval, 'ceil');
7624
+ roundedEnd = roundWithTimeStep(Number(end && moment.utc(end).unix()), interval, 'floor');
7524
7625
  _context.next = 6;
7525
7626
  return timeList || generateTimeList(moment.utc(roundedStart * 1000), moment.utc(roundedEnd * 1000), interval);
7526
7627
 
@@ -7650,7 +7751,7 @@ function updateAnimation(mapId, maxValue) {
7650
7751
  return _context4.stop();
7651
7752
  }
7652
7753
  }
7653
- }, _marked4);
7754
+ }, _marked4$1);
7654
7755
  }
7655
7756
  function setLayerDimensionsSaga(_ref4) {
7656
7757
  var payload, layerDimensions, dimensions, layerId, layer, newTimeDimension, mapId, activeLayerId, shouldAutoUpdate, prevTimeDimension, isAnimating$1, webmapInstance;
@@ -8160,67 +8261,85 @@ function checkMapPresetForChangesSaga(action) {
8160
8261
  }
8161
8262
  }, _marked9);
8162
8263
  }
8163
- function rootSaga$2() {
8164
- return regeneratorRuntime.wrap(function rootSaga$(_context10) {
8264
+ function unregisterMapSaga(_ref7) {
8265
+ var payload, mapId, layerList;
8266
+ return regeneratorRuntime.wrap(function unregisterMapSaga$(_context10) {
8165
8267
  while (1) {
8166
8268
  switch (_context10.prev = _context10.next) {
8167
8269
  case 0:
8168
- _context10.next = 2;
8270
+ payload = _ref7.payload;
8271
+ mapId = payload.mapId;
8272
+ _context10.next = 4;
8273
+ return select(getLayersByMapId, mapId);
8274
+
8275
+ case 4:
8276
+ layerList = _context10.sent;
8277
+ _context10.next = 7;
8278
+ return all(layerList.map(function (layer) {
8279
+ return put(layerActions.layerDelete({
8280
+ mapId: mapId,
8281
+ layerId: layer.id,
8282
+ layerIndex: 0,
8283
+ origin: LayerActionOrigin.unregisterMapSaga
8284
+ }));
8285
+ }));
8286
+
8287
+ case 7:
8288
+ case "end":
8289
+ return _context10.stop();
8290
+ }
8291
+ }
8292
+ }, _marked10);
8293
+ }
8294
+ function rootSaga$2() {
8295
+ return regeneratorRuntime.wrap(function rootSaga$(_context11) {
8296
+ while (1) {
8297
+ switch (_context11.prev = _context11.next) {
8298
+ case 0:
8299
+ _context11.next = 2;
8169
8300
  return all([takeLatest(mapActions$1.mapStopAnimation.type, stopAnimationSaga), takeLatest(mapActions$1.setActiveMapPresetId.type, stopAnimationSaga)]);
8170
8301
 
8171
8302
  case 2:
8172
- _context10.next = 4;
8303
+ _context11.next = 4;
8173
8304
  return takeLatest(mapActions$1.mapStartAnimation.type, startAnimationSaga);
8174
8305
 
8175
8306
  case 4:
8176
- _context10.next = 6;
8307
+ _context11.next = 6;
8177
8308
  return takeLatest(layerActions.layerDelete.type, deleteLayerSaga);
8178
8309
 
8179
8310
  case 6:
8180
- _context10.next = 8;
8311
+ _context11.next = 8;
8181
8312
  return takeLatest(layerActions.onUpdateLayerInformation.type, setLayerDimensionsSaga);
8182
8313
 
8183
8314
  case 8:
8184
- _context10.next = 10;
8315
+ _context11.next = 10;
8185
8316
  return takeLatest(mapActions$1.toggleAutoUpdate.type, toggleAutoUpdateSaga);
8186
8317
 
8187
8318
  case 10:
8188
- _context10.next = 12;
8319
+ _context11.next = 12;
8189
8320
  return takeEvery(mapActions$1.setMapPreset.type, setMapPresetSaga);
8190
8321
 
8191
8322
  case 12:
8192
- _context10.next = 14;
8323
+ _context11.next = 14;
8193
8324
  return all(mapPresetChangeActions.map(function (action) {
8194
8325
  return takeEvery(action, checkMapPresetForChangesSaga);
8195
8326
  }));
8196
8327
 
8197
8328
  case 14:
8329
+ _context11.next = 16;
8330
+ return takeEvery(mapActions$1.unregisterMap.type, unregisterMapSaga);
8331
+
8332
+ case 16:
8198
8333
  case "end":
8199
- return _context10.stop();
8334
+ return _context11.stop();
8200
8335
  }
8201
8336
  }
8202
- }, _marked10);
8337
+ }, _marked11);
8203
8338
  }
8204
8339
 
8205
- /* *
8206
- * Licensed under the Apache License, Version 2.0 (the "License");
8207
- * you may not use this file except in compliance with the License.
8208
- * You may obtain a copy of the License at
8209
- *
8210
- * http://www.apache.org/licenses/LICENSE-2.0
8211
- *
8212
- * Unless required by applicable law or agreed to in writing, software
8213
- * distributed under the License is distributed on an "AS IS" BASIS,
8214
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
8215
- * See the License for the specific language governing permissions and
8216
- * limitations under the License.
8217
- *
8218
- * Copyright 2020 - Koninklijk Nederlands Meteorologisch Instituut (KNMI)
8219
- * Copyright 2020 - Finnish Meteorological Institute (FMI)
8220
- * */
8221
8340
  var moduleConfig = {
8222
8341
  id: 'webmap-module',
8223
- reducerMap: {
8342
+ reducersMap: {
8224
8343
  webmap: reducer$3,
8225
8344
  services: reducer$5,
8226
8345
  layers: reducer$6
@@ -8256,7 +8375,7 @@ var getUserAddedServices = function getUserAddedServices() {
8256
8375
  service = _ref2[1];
8257
8376
 
8258
8377
  return Object.assign(Object.assign({}, userServices), isNoIdService(service) ? _defineProperty({}, serviceUrl, Object.assign(Object.assign({}, service), {
8259
- isUserAddedService: true
8378
+ scope: 'user'
8260
8379
  })) : {});
8261
8380
  }, {});
8262
8381
  }
@@ -8280,17 +8399,27 @@ var isNoIdService = function isNoIdService(param) {
8280
8399
  };
8281
8400
 
8282
8401
  var _marked$1 = /*#__PURE__*/regeneratorRuntime.mark(newServiceAddedSaga),
8283
- _marked2$1 = /*#__PURE__*/regeneratorRuntime.mark(layerSelectRemoveServiceSaga),
8284
- _marked3 = /*#__PURE__*/regeneratorRuntime.mark(rootSaga$1);
8402
+ _marked2$1 = /*#__PURE__*/regeneratorRuntime.mark(layerSelectCloseInfoDialogSaga),
8403
+ _marked3 = /*#__PURE__*/regeneratorRuntime.mark(layerSelectRemoveServiceSaga),
8404
+ _marked4 = /*#__PURE__*/regeneratorRuntime.mark(rootSaga$1);
8285
8405
  function newServiceAddedSaga(capturedAction) {
8286
- var addedService, id, serviceUrl, name, isUserAddedService, _abstract, keywords, groups;
8406
+ var addedService, id, serviceUrl, name, scope, _abstract, isUpdating, keywords, groups;
8287
8407
 
8288
8408
  return regeneratorRuntime.wrap(function newServiceAddedSaga$(_context) {
8289
8409
  while (1) {
8290
8410
  switch (_context.prev = _context.next) {
8291
8411
  case 0:
8292
8412
  addedService = capturedAction.payload;
8293
- id = addedService.id, serviceUrl = addedService.serviceUrl, name = addedService.name, isUserAddedService = addedService.isUserAddedService, _abstract = addedService["abstract"];
8413
+ id = addedService.id, serviceUrl = addedService.serviceUrl, name = addedService.name, scope = addedService.scope, _abstract = addedService["abstract"], isUpdating = addedService.isUpdating;
8414
+
8415
+ if (!isUpdating) {
8416
+ _context.next = 4;
8417
+ break;
8418
+ }
8419
+
8420
+ return _context.abrupt("return");
8421
+
8422
+ case 4:
8294
8423
  keywords = addedService.layers.reduce(function (keywords, layer) {
8295
8424
  var _a;
8296
8425
 
@@ -8309,52 +8438,152 @@ function newServiceAddedSaga(capturedAction) {
8309
8438
 
8310
8439
  return groups;
8311
8440
  }, []);
8312
- _context.next = 6;
8441
+ _context.next = 8;
8313
8442
  return put(layerSelectActions.addFiltersAndActiveServices({
8314
8443
  serviceId: id,
8315
8444
  serviceName: name,
8316
8445
  serviceUrl: serviceUrl,
8317
8446
  keywords: keywords,
8318
- isUserAddedService: isUserAddedService,
8447
+ scope: scope,
8319
8448
  groups: groups,
8320
8449
  "abstract": _abstract
8321
8450
  }));
8322
8451
 
8323
- case 6:
8452
+ case 8:
8324
8453
  case "end":
8325
8454
  return _context.stop();
8326
8455
  }
8327
8456
  }
8328
8457
  }, _marked$1);
8329
8458
  }
8459
+ function layerSelectCloseInfoDialogSaga(_ref) {
8460
+ var type, payload, togglePayload, activeMapIdPayload, isLayerInfoDialogOpen, _isLayerInfoDialogOpen, filteredLayers, dialogInfo;
8461
+
8462
+ return regeneratorRuntime.wrap(function layerSelectCloseInfoDialogSaga$(_context2) {
8463
+ while (1) {
8464
+ switch (_context2.prev = _context2.next) {
8465
+ case 0:
8466
+ type = _ref.type, payload = _ref.payload;
8467
+ _context2.t0 = type;
8468
+ _context2.next = _context2.t0 === uiActions.setToggleOpenDialog.type ? 4 : _context2.t0 === uiActions.setActiveMapIdForDialog.type ? 9 : 18;
8469
+ break;
8470
+
8471
+ case 4:
8472
+ togglePayload = payload;
8473
+
8474
+ if (!(!togglePayload.setOpen && togglePayload.type === DialogTypes.LayerSelect)) {
8475
+ _context2.next = 8;
8476
+ break;
8477
+ }
8478
+
8479
+ _context2.next = 8;
8480
+ return put(uiActions.setToggleOpenDialog({
8481
+ type: DialogTypes.LayerInfo,
8482
+ setOpen: false
8483
+ }));
8484
+
8485
+ case 8:
8486
+ return _context2.abrupt("break", 31);
8487
+
8488
+ case 9:
8489
+ activeMapIdPayload = payload;
8490
+
8491
+ if (activeMapIdPayload.setOpen) {
8492
+ _context2.next = 17;
8493
+ break;
8494
+ }
8495
+
8496
+ _context2.next = 13;
8497
+ return select(getisDialogOpen, DialogTypes.LayerInfo);
8498
+
8499
+ case 13:
8500
+ isLayerInfoDialogOpen = _context2.sent;
8501
+
8502
+ if (!isLayerInfoDialogOpen) {
8503
+ _context2.next = 17;
8504
+ break;
8505
+ }
8506
+
8507
+ _context2.next = 17;
8508
+ return put(uiActions.setToggleOpenDialog({
8509
+ type: DialogTypes.LayerInfo,
8510
+ setOpen: false
8511
+ }));
8512
+
8513
+ case 17:
8514
+ return _context2.abrupt("break", 31);
8515
+
8516
+ case 18:
8517
+ _context2.next = 20;
8518
+ return select(getisDialogOpen, DialogTypes.LayerInfo);
8519
+
8520
+ case 20:
8521
+ _isLayerInfoDialogOpen = _context2.sent;
8522
+
8523
+ if (!_isLayerInfoDialogOpen) {
8524
+ _context2.next = 31;
8525
+ break;
8526
+ }
8527
+
8528
+ _context2.next = 24;
8529
+ return select(getFilteredLayers);
8530
+
8531
+ case 24:
8532
+ filteredLayers = _context2.sent;
8533
+ _context2.next = 27;
8534
+ return select(getActiveLayerInfo);
8535
+
8536
+ case 27:
8537
+ dialogInfo = _context2.sent;
8538
+
8539
+ if (filteredLayers.map(function (layer) {
8540
+ return layer.text;
8541
+ }).includes(dialogInfo.text)) {
8542
+ _context2.next = 31;
8543
+ break;
8544
+ }
8545
+
8546
+ _context2.next = 31;
8547
+ return put(uiActions.setToggleOpenDialog({
8548
+ type: DialogTypes.LayerInfo,
8549
+ setOpen: false
8550
+ }));
8551
+
8552
+ case 31:
8553
+ case "end":
8554
+ return _context2.stop();
8555
+ }
8556
+ }
8557
+ }, _marked2$1);
8558
+ }
8330
8559
  function layerSelectRemoveServiceSaga(capturedAction) {
8331
8560
  var removedService, serviceId, serviceUrl, results, services, servicesEnabled;
8332
- return regeneratorRuntime.wrap(function layerSelectRemoveServiceSaga$(_context2) {
8561
+ return regeneratorRuntime.wrap(function layerSelectRemoveServiceSaga$(_context3) {
8333
8562
  while (1) {
8334
- switch (_context2.prev = _context2.next) {
8563
+ switch (_context3.prev = _context3.next) {
8335
8564
  case 0:
8336
8565
  removedService = capturedAction.payload;
8337
8566
  serviceId = removedService.serviceId, serviceUrl = removedService.serviceUrl;
8338
- _context2.next = 4;
8567
+ _context3.next = 4;
8339
8568
  return select(getActiveServices);
8340
8569
 
8341
8570
  case 4:
8342
- results = _context2.sent;
8571
+ results = _context3.sent;
8343
8572
  services = results;
8344
8573
  servicesEnabled = Object.values(services).find(function (service) {
8345
8574
  return service.enabled;
8346
8575
  });
8347
8576
 
8348
8577
  if (!(servicesEnabled === undefined)) {
8349
- _context2.next = 10;
8578
+ _context3.next = 10;
8350
8579
  break;
8351
8580
  }
8352
8581
 
8353
- _context2.next = 10;
8354
- return all(Object.entries(services).map(function (_ref) {
8355
- var _ref2 = _slicedToArray(_ref, 2),
8356
- serviceId = _ref2[0],
8357
- service = _ref2[1];
8582
+ _context3.next = 10;
8583
+ return all(Object.entries(services).map(function (_ref2) {
8584
+ var _ref3 = _slicedToArray(_ref2, 2),
8585
+ serviceId = _ref3[0],
8586
+ service = _ref3[1];
8358
8587
 
8359
8588
  return put(layerSelectActions.enableActiveService({
8360
8589
  serviceId: serviceId,
@@ -8363,7 +8592,7 @@ function layerSelectRemoveServiceSaga(capturedAction) {
8363
8592
  }));
8364
8593
 
8365
8594
  case 10:
8366
- _context2.next = 12;
8595
+ _context3.next = 12;
8367
8596
  return put(serviceActions.mapStoreRemoveService({
8368
8597
  id: serviceId,
8369
8598
  serviceUrl: serviceUrl
@@ -8371,18 +8600,18 @@ function layerSelectRemoveServiceSaga(capturedAction) {
8371
8600
 
8372
8601
  case 12:
8373
8602
  case "end":
8374
- return _context2.stop();
8603
+ return _context3.stop();
8375
8604
  }
8376
8605
  }
8377
- }, _marked2$1);
8606
+ }, _marked3);
8378
8607
  }
8379
- function addServiceToLocalStorageSaga(_ref3) {
8380
- var payload = _ref3.payload;
8381
- var isUserAddedService = payload.isUserAddedService,
8608
+ function addServiceToLocalStorageSaga(_ref4) {
8609
+ var payload = _ref4.payload;
8610
+ var scope = payload.scope,
8382
8611
  name = payload.name,
8383
8612
  serviceUrl = payload.serviceUrl,
8384
8613
  _abstract2 = payload["abstract"];
8385
- if (!isUserAddedService) return;
8614
+ if (!isUserAddedService(scope)) return;
8386
8615
  var localStorageServices = getUserAddedServices();
8387
8616
  setUserAddedServices(Object.assign(Object.assign({}, localStorageServices), _defineProperty({}, serviceUrl, {
8388
8617
  name: name,
@@ -8390,8 +8619,8 @@ function addServiceToLocalStorageSaga(_ref3) {
8390
8619
  "abstract": _abstract2
8391
8620
  })));
8392
8621
  }
8393
- function removeServiceFromLocalStorageSaga(_ref4) {
8394
- var payload = _ref4.payload;
8622
+ function removeServiceFromLocalStorageSaga(_ref5) {
8623
+ var payload = _ref5.payload;
8395
8624
  var serviceUrl = payload.serviceUrl;
8396
8625
  var localStorageServices = getUserAddedServices();
8397
8626
  if (!localStorageServices[serviceUrl]) return;
@@ -8400,52 +8629,40 @@ function removeServiceFromLocalStorageSaga(_ref4) {
8400
8629
  setUserAddedServices(updatedServices);
8401
8630
  }
8402
8631
  function rootSaga$1() {
8403
- return regeneratorRuntime.wrap(function rootSaga$(_context3) {
8632
+ return regeneratorRuntime.wrap(function rootSaga$(_context4) {
8404
8633
  while (1) {
8405
- switch (_context3.prev = _context3.next) {
8634
+ switch (_context4.prev = _context4.next) {
8406
8635
  case 0:
8407
- _context3.next = 2;
8636
+ _context4.next = 2;
8408
8637
  return takeEvery(serviceActions.serviceSetLayers.type, newServiceAddedSaga);
8409
8638
 
8410
8639
  case 2:
8411
- _context3.next = 4;
8640
+ _context4.next = 4;
8412
8641
  return takeEvery(layerSelectActions.layerSelectRemoveService.type, layerSelectRemoveServiceSaga);
8413
8642
 
8414
8643
  case 4:
8415
- _context3.next = 6;
8644
+ _context4.next = 6;
8416
8645
  return takeEvery(serviceActions.serviceSetLayers.type, addServiceToLocalStorageSaga);
8417
8646
 
8418
8647
  case 6:
8419
- _context3.next = 8;
8648
+ _context4.next = 8;
8420
8649
  return takeEvery(serviceActions.mapStoreRemoveService.type, removeServiceFromLocalStorageSaga);
8421
8650
 
8422
8651
  case 8:
8652
+ _context4.next = 10;
8653
+ return takeEvery([uiActions.setToggleOpenDialog.type, uiActions.setActiveMapIdForDialog.type, layerSelectActions.disableActiveService.type, layerSelectActions.toggleFilter.type, layerSelectActions.setSearchFilter.type], layerSelectCloseInfoDialogSaga);
8654
+
8655
+ case 10:
8423
8656
  case "end":
8424
- return _context3.stop();
8657
+ return _context4.stop();
8425
8658
  }
8426
8659
  }
8427
- }, _marked3);
8660
+ }, _marked4);
8428
8661
  }
8429
8662
 
8430
- /* *
8431
- * Licensed under the Apache License, Version 2.0 (the "License");
8432
- * you may not use this file except in compliance with the License.
8433
- * You may obtain a copy of the License at
8434
- *
8435
- * http://www.apache.org/licenses/LICENSE-2.0
8436
- *
8437
- * Unless required by applicable law or agreed to in writing, software
8438
- * distributed under the License is distributed on an "AS IS" BASIS,
8439
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
8440
- * See the License for the specific language governing permissions and
8441
- * limitations under the License.
8442
- *
8443
- * Copyright 2021 - Koninklijk Nederlands Meteorologisch Instituut (KNMI)
8444
- * Copyright 2021 - Finnish Meteorological Institute (FMI)
8445
- * */
8446
8663
  var layerSelectConfig = {
8447
8664
  id: 'layerSelect-module',
8448
- reducerMap: {
8665
+ reducersMap: {
8449
8666
  layerSelect: reducer$1
8450
8667
  },
8451
8668
  sagas: [rootSaga$1]
@@ -8546,7 +8763,7 @@ function rootSaga() {
8546
8763
  * */
8547
8764
  var snackbarModuleConfig = {
8548
8765
  id: 'snackbar-module',
8549
- reducerMap: {
8766
+ reducersMap: {
8550
8767
  snackbar: reducer
8551
8768
  },
8552
8769
  sagas: [rootSaga]
@@ -8624,6 +8841,7 @@ var getLayersFromService = function getLayersFromService(serviceUrl) {
8624
8841
  return new Promise(function (resolve, reject) {
8625
8842
  var serviceObject = WMGetServiceFromStore(serviceUrl);
8626
8843
  serviceObject.getNodes(function (nodes) {
8844
+ // TODO: Maarten Plieger, 2022-11-02: Harmonize types and use correct types: https://gitlab.com/opengeoweb/opengeoweb/-/issues/2817
8627
8845
  var layerTree = recurseNodes(nodes);
8628
8846
  resolve(layerTree);
8629
8847
  }, function (error) {
@@ -9010,7 +9228,7 @@ var preset = {
9010
9228
  },
9011
9229
  {
9012
9230
  name: "KNMIgeoservicesObs",
9013
- url: "https://geoservices.knmi.nl/adagucserver?dataset=OBS&service=WMS&",
9231
+ url: "https://geoservices.knmi.nl/adagucserver?dataset=OBS",
9014
9232
  id: "KNMIgeoservicesObs"
9015
9233
  },
9016
9234
  {
@@ -9463,14 +9681,14 @@ var LayerSelectButtonConnect = function LayerSelectButtonConnect(_ref) {
9463
9681
  source = _ref$source === void 0 ? 'app' : _ref$source;
9464
9682
  var dispatch = useDispatch();
9465
9683
  var currentActiveMapId = useSelector(function (store) {
9466
- return getDialogMapId(store, 'layerSelect');
9684
+ return getDialogMapId(store, DialogTypes.LayerSelect);
9467
9685
  });
9468
9686
  var isOpenInStore = useSelector(function (store) {
9469
- return getisDialogOpen(store, 'layerSelect');
9687
+ return getisDialogOpen(store, DialogTypes.LayerSelect);
9470
9688
  });
9471
9689
  var openLayerSelectDialog = React.useCallback(function () {
9472
9690
  dispatch(uiActions.setActiveMapIdForDialog({
9473
- type: 'layerSelect',
9691
+ type: DialogTypes.LayerSelect,
9474
9692
  mapId: mapId,
9475
9693
  setOpen: currentActiveMapId !== mapId ? true : !isOpenInStore,
9476
9694
  source: source
@@ -9767,7 +9985,9 @@ var RenderLayers = function RenderLayers(_ref) {
9767
9985
  }, /*#__PURE__*/React.createElement(Typography, {
9768
9986
  variant: "body1",
9769
9987
  sx: {
9770
- fontSize: 'geowebColors.layerManager.tableRowDefaultText.fontSize',
9988
+ fontSize: function fontSize(theme) {
9989
+ return theme.palette.geowebColors.layerManager.tableRowDefaultText.fontSize;
9990
+ },
9771
9991
  color: 'geowebColors.layerManager.tableRowDefaultText.rgba',
9772
9992
  fontWeight: 500
9773
9993
  }
@@ -10157,9 +10377,7 @@ var LayerRow = function LayerRow(_ref) {
10157
10377
  services = _ref.services,
10158
10378
  mapId = _ref.mapId,
10159
10379
  _ref$onLayerRowClick = _ref.onLayerRowClick,
10160
- onLayerRowClick = _ref$onLayerRowClick === void 0 ? function () {
10161
- return null;
10162
- } : _ref$onLayerRowClick,
10380
+ onLayerRowClick = _ref$onLayerRowClick === void 0 ? function () {} : _ref$onLayerRowClick,
10163
10381
  _ref$isEnabled = _ref.isEnabled,
10164
10382
  isEnabled = _ref$isEnabled === void 0 ? true : _ref$isEnabled,
10165
10383
  _ref$isLayerMissing = _ref.isLayerMissing,
@@ -10568,6 +10786,57 @@ var RenderLayersConnect = function RenderLayersConnect(_ref) {
10568
10786
  var isLayerEnabled = useSelector(function (store) {
10569
10787
  return getLayerEnabled(store, layerId);
10570
10788
  });
10789
+ var service = useSelector(function (store) {
10790
+ return getServiceByName(store, layerService);
10791
+ });
10792
+ var serviceSetLayers = React.useCallback(function (payload) {
10793
+ dispatch(serviceActions.serviceSetLayers(payload));
10794
+ }, [dispatch]);
10795
+
10796
+ var addService = function addService(serviceUrl) {
10797
+ return __awaiter(void 0, void 0, void 0, /*#__PURE__*/regeneratorRuntime.mark(function _callee() {
10798
+ var _layers, wmService;
10799
+
10800
+ return regeneratorRuntime.wrap(function _callee$(_context) {
10801
+ while (1) {
10802
+ switch (_context.prev = _context.next) {
10803
+ case 0:
10804
+ _context.prev = 0;
10805
+ _context.next = 3;
10806
+ return getLayersFlattenedFromService(serviceUrl);
10807
+
10808
+ case 3:
10809
+ _layers = _context.sent;
10810
+ wmService = WMGetServiceFromStore(serviceUrl);
10811
+ serviceSetLayers({
10812
+ id: wmService.id,
10813
+ name: wmService.title,
10814
+ serviceUrl: serviceUrl,
10815
+ layers: _layers,
10816
+ scope: 'user',
10817
+ "abstract": wmService["abstract"]
10818
+ });
10819
+ _context.next = 11;
10820
+ break;
10821
+
10822
+ case 8:
10823
+ _context.prev = 8;
10824
+ _context.t0 = _context["catch"](0);
10825
+ console.warn(_context.t0.message);
10826
+
10827
+ case 11:
10828
+ case "end":
10829
+ return _context.stop();
10830
+ }
10831
+ }
10832
+ }, _callee, null, [[0, 8]]);
10833
+ }));
10834
+ };
10835
+
10836
+ if (!service) {
10837
+ addService(layerService);
10838
+ }
10839
+
10571
10840
  var layers = useSelector(function (store) {
10572
10841
  return getLayersFromService$1(store, layerService);
10573
10842
  });
@@ -11354,14 +11623,14 @@ var KeywordFilterButtonConnect = function KeywordFilterButtonConnect(_ref) {
11354
11623
  source = _ref$source === void 0 ? 'app' : _ref$source;
11355
11624
  var dispatch = useDispatch();
11356
11625
  var currentActiveMapId = useSelector(function (store) {
11357
- return getDialogMapId(store, 'keywordFilter');
11626
+ return getDialogMapId(store, DialogTypes.KeywordFilter);
11358
11627
  });
11359
11628
  var isOpenInStore = useSelector(function (store) {
11360
- return getisDialogOpen(store, 'keywordFilter');
11629
+ return getisDialogOpen(store, DialogTypes.KeywordFilter);
11361
11630
  });
11362
11631
  var openFilterResultsDialog = React.useCallback(function () {
11363
11632
  dispatch(uiActions.setActiveMapIdForDialog({
11364
- type: 'keywordFilter',
11633
+ type: DialogTypes.KeywordFilter,
11365
11634
  mapId: mapId,
11366
11635
  setOpen: currentActiveMapId !== mapId ? true : !isOpenInStore,
11367
11636
  source: source
@@ -11498,6 +11767,37 @@ var validateServiceUrl = function validateServiceUrl(value, services) {
11498
11767
 
11499
11768
  return true;
11500
11769
  };
11770
+ var loadWMSService = function loadWMSService(serviceUrl) {
11771
+ var forceReload = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
11772
+ return __awaiter(void 0, void 0, void 0, /*#__PURE__*/regeneratorRuntime.mark(function _callee() {
11773
+ var layers, service;
11774
+ return regeneratorRuntime.wrap(function _callee$(_context) {
11775
+ while (1) {
11776
+ switch (_context.prev = _context.next) {
11777
+ case 0:
11778
+ _context.next = 2;
11779
+ return getLayersFlattenedFromService(serviceUrl, forceReload);
11780
+
11781
+ case 2:
11782
+ layers = _context.sent;
11783
+ service = WMGetServiceFromStore(serviceUrl);
11784
+ return _context.abrupt("return", {
11785
+ id: service.id,
11786
+ name: service.title,
11787
+ serviceUrl: serviceUrl,
11788
+ "abstract": service["abstract"],
11789
+ layers: layers,
11790
+ scope: 'user'
11791
+ });
11792
+
11793
+ case 5:
11794
+ case "end":
11795
+ return _context.stop();
11796
+ }
11797
+ }
11798
+ }, _callee);
11799
+ }));
11800
+ };
11501
11801
 
11502
11802
  var style$1 = {
11503
11803
  textField: {
@@ -11631,8 +11931,7 @@ var ServicePopup = function ServicePopup(_ref2) {
11631
11931
 
11632
11932
  var addNewService = function addNewService(formValues) {
11633
11933
  return __awaiter(void 0, void 0, void 0, /*#__PURE__*/regeneratorRuntime.mark(function _callee2() {
11634
- var layers, serviceLayers, _iterator, _step, object, service;
11635
-
11934
+ var layersForService;
11636
11935
  return regeneratorRuntime.wrap(function _callee2$(_context2) {
11637
11936
  while (1) {
11638
11937
  switch (_context2.prev = _context2.next) {
@@ -11641,55 +11940,26 @@ var ServicePopup = function ServicePopup(_ref2) {
11641
11940
  setIsLoading(true);
11642
11941
  _context2.prev = 2;
11643
11942
  _context2.next = 5;
11644
- return getLayersFromService(formValues.serviceUrl);
11943
+ return loadWMSService(formValues.serviceUrl, true);
11645
11944
 
11646
11945
  case 5:
11647
- layers = _context2.sent;
11648
-
11649
- if (layers.children) {
11650
- serviceLayers = [];
11651
- _iterator = _createForOfIteratorHelper(layers.children);
11652
-
11653
- try {
11654
- for (_iterator.s(); !(_step = _iterator.n()).done;) {
11655
- object = _step.value;
11656
- serviceLayers.push({
11657
- name: object.name,
11658
- text: object.title,
11659
- leaf: object.leaf,
11660
- path: object.path,
11661
- keywords: object.keywords ? object.keywords : [],
11662
- "abstract": object["abstract"] ? object["abstract"] : '',
11663
- styles: object.styles ? object.styles : [],
11664
- dimensions: object.dimensions || [],
11665
- geographicBoundingBox: object.geographicBoundingBox || null
11666
- });
11667
- }
11668
- } catch (err) {
11669
- _iterator.e(err);
11670
- } finally {
11671
- _iterator.f();
11672
- }
11673
-
11674
- service = WMGetServiceFromStore(formValues.serviceUrl);
11675
- serviceSetLayers({
11676
- id: service.id,
11677
- name: formValues.serviceName,
11678
- serviceUrl: formValues.serviceUrl,
11679
- "abstract": formValues.serviceAbstracts,
11680
- layers: serviceLayers,
11681
- isUserAddedService: true
11682
- });
11683
- setIsLoading(false);
11684
- showSnackbar(getSuccesMessage(formValues.serviceName));
11685
- closePopup();
11686
- }
11687
-
11688
- _context2.next = 13;
11946
+ layersForService = _context2.sent;
11947
+ serviceSetLayers({
11948
+ id: layersForService.id,
11949
+ name: formValues.serviceName,
11950
+ serviceUrl: formValues.serviceUrl,
11951
+ "abstract": formValues.serviceAbstracts,
11952
+ layers: layersForService.layers,
11953
+ scope: 'user'
11954
+ });
11955
+ setIsLoading(false);
11956
+ showSnackbar(getSuccesMessage(formValues.serviceName));
11957
+ closePopup();
11958
+ _context2.next = 16;
11689
11959
  break;
11690
11960
 
11691
- case 9:
11692
- _context2.prev = 9;
11961
+ case 12:
11962
+ _context2.prev = 12;
11693
11963
  _context2.t0 = _context2["catch"](2);
11694
11964
  setIsLoading(false);
11695
11965
  setError(fields.serviceUrl.name, {
@@ -11697,12 +11967,12 @@ var ServicePopup = function ServicePopup(_ref2) {
11697
11967
  type: 'SYSTEM'
11698
11968
  });
11699
11969
 
11700
- case 13:
11970
+ case 16:
11701
11971
  case "end":
11702
11972
  return _context2.stop();
11703
11973
  }
11704
11974
  }
11705
- }, _callee2, null, [[2, 9]]);
11975
+ }, _callee2, null, [[2, 12]]);
11706
11976
  }));
11707
11977
  };
11708
11978
 
@@ -11831,8 +12101,8 @@ var ServicePopup = function ServicePopup(_ref2) {
11831
12101
  })
11832
12102
  },
11833
12103
  disabled: isServiceUrlDisabled || isLoading,
12104
+ isReadOnly: isShowPopup,
11834
12105
  InputProps: {
11835
- readOnly: isShowPopup,
11836
12106
  disableUnderline: isShowPopup,
11837
12107
  endAdornment: isShowPopup && /*#__PURE__*/React.createElement(InputAdornment, {
11838
12108
  position: "end"
@@ -11855,8 +12125,8 @@ var ServicePopup = function ServicePopup(_ref2) {
11855
12125
  }
11856
12126
  },
11857
12127
  disabled: isShowPopup || isLoading,
12128
+ isReadOnly: isShowPopup,
11858
12129
  InputProps: {
11859
- readOnly: isShowPopup,
11860
12130
  disableUnderline: isShowPopup
11861
12131
  },
11862
12132
  sx: style$1.textField,
@@ -11867,12 +12137,11 @@ var ServicePopup = function ServicePopup(_ref2) {
11867
12137
  name: fields.serviceAbstracts.name,
11868
12138
  label: fields.serviceAbstracts.label,
11869
12139
  disabled: isShowPopup || isLoading,
11870
- rules: {},
12140
+ isReadOnly: isShowPopup,
11871
12141
  InputProps: {
11872
- readOnly: isShowPopup,
11873
12142
  disableUnderline: isShowPopup
11874
12143
  },
11875
- helperText: !isShowPopup && 'Short description of what this service does',
12144
+ helperText: !isShowPopup ? 'Short description of what this service does' : '',
11876
12145
  sx: style$1.textField,
11877
12146
  defaultValue: ""
11878
12147
  }), !isServiceUrlDisabled && /*#__PURE__*/React.createElement(InitialValidationsTrigger, {
@@ -12101,74 +12370,19 @@ var SearchFieldConnect = function SearchFieldConnect() {
12101
12370
  * See the License for the specific language governing permissions and
12102
12371
  * limitations under the License.
12103
12372
  *
12104
- * Copyright 2021 - Koninklijk Nederlands Meteorologisch Instituut (KNMI)
12105
- * Copyright 2021 - Finnish Meteorological Institute (FMI)
12373
+ * Copyright 2022 - Koninklijk Nederlands Meteorologisch Instituut (KNMI)
12374
+ * Copyright 2022 - Finnish Meteorological Institute (FMI)
12106
12375
  * */
12107
- var filterLayersFromService = function filterLayersFromService(serviceId, services, filterIds, allFiltersActive, searchString) {
12108
- var mapStoreService = services[serviceId];
12109
- if (!mapStoreService) return [];
12110
-
12111
- if (searchString === '' && allFiltersActive) {
12112
- return mapStoreService.layers.filter(function (layer) {
12113
- return layer.leaf;
12114
- });
12115
- }
12116
-
12117
- var searchStringArray = searchString.split(' ');
12118
- return mapStoreService.layers.filter(function (layer) {
12119
- return searchStringArray.every(function (search) {
12120
- var _a, _b, _c;
12121
12376
 
12122
- var searchLowercase = search.toLowerCase();
12123
- var layerFilterIds = layer.path.map(function (group) {
12124
- return "group-".concat(group);
12125
- }).concat(layer.keywords.map(function (keyword) {
12126
- return "keyword-".concat(keyword);
12127
- }));
12128
- var isFilterInLayer = (layerFilterIds === null || layerFilterIds === void 0 ? void 0 : layerFilterIds.some(function (id) {
12129
- return filterIds.includes(id);
12130
- })) || allFiltersActive;
12131
- var isSearchTextInLayerFilter = layerFilterIds === null || layerFilterIds === void 0 ? void 0 : layerFilterIds.some(function (filterId) {
12132
- return filterId.toLowerCase().includes(searchLowercase);
12133
- });
12134
- var isSearchTextInLayerName = (_a = layer.name) === null || _a === void 0 ? void 0 : _a.toLowerCase().includes(searchLowercase);
12135
- var isSearchTextInLayerText = (_b = layer.text) === null || _b === void 0 ? void 0 : _b.toLowerCase().includes(searchLowercase);
12136
- var isSearchTextInLayerAbstract = (_c = layer["abstract"]) === null || _c === void 0 ? void 0 : _c.toLowerCase().includes(searchLowercase);
12137
- var isSearchTextInServiceName = mapStoreService.name.toLowerCase().includes(searchLowercase);
12138
- var isSearchTextInLayer = isSearchTextInLayerName || isSearchTextInLayerText || isSearchTextInLayerAbstract || isSearchTextInLayerFilter || isSearchTextInServiceName;
12139
- return isFilterInLayer && isSearchTextInLayer;
12140
- });
12141
- }).filter(function (layer) {
12142
- return layer.leaf;
12143
- });
12144
- };
12145
-
12146
- /* *
12147
- * Licensed under the Apache License, Version 2.0 (the "License");
12148
- * you may not use this file except in compliance with the License.
12149
- * You may obtain a copy of the License at
12150
- *
12151
- * http://www.apache.org/licenses/LICENSE-2.0
12152
- *
12153
- * Unless required by applicable law or agreed to in writing, software
12154
- * distributed under the License is distributed on an "AS IS" BASIS,
12155
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12156
- * See the License for the specific language governing permissions and
12157
- * limitations under the License.
12158
- *
12159
- * Copyright 2022 - Koninklijk Nederlands Meteorologisch Instituut (KNMI)
12160
- * Copyright 2022 - Finnish Meteorological Institute (FMI)
12161
- * */
12162
-
12163
- var LayerAddRemoveButton = function LayerAddRemoveButton(_ref) {
12164
- var layer = _ref.layer,
12165
- layerIndex = _ref.layerIndex,
12166
- serviceUrl = _ref.serviceUrl,
12167
- addLayer = _ref.addLayer,
12168
- deleteLayer = _ref.deleteLayer,
12169
- mapLayers = _ref.mapLayers;
12170
- var foundLayer = mapLayers.find(function (lr) {
12171
- return lr.name === layer.name && lr.service === serviceUrl;
12377
+ var LayerAddRemoveButton = function LayerAddRemoveButton(_ref) {
12378
+ var layer = _ref.layer,
12379
+ layerIndex = _ref.layerIndex,
12380
+ serviceUrl = _ref.serviceUrl,
12381
+ addLayer = _ref.addLayer,
12382
+ deleteLayer = _ref.deleteLayer,
12383
+ mapLayers = _ref.mapLayers;
12384
+ var foundLayer = mapLayers.find(function (lr) {
12385
+ return lr.name === layer.name && lr.service === serviceUrl;
12172
12386
  });
12173
12387
  return /*#__PURE__*/React.createElement(CustomToggleButton, {
12174
12388
  "data-testid": "layerAddRemoveButton-".concat(layer.name),
@@ -12280,11 +12494,11 @@ var LayerInfoButtonConnect = function LayerInfoButtonConnect(_ref) {
12280
12494
  * Copyright 2022 - Koninklijk Nederlands Meteorologisch Instituut (KNMI)
12281
12495
  * Copyright 2022 - Finnish Meteorological Institute (FMI)
12282
12496
  * */
12283
- var textStyle$1 = {
12497
+ var textStyle = {
12284
12498
  lineHeight: '20px',
12285
12499
  letterSpacing: '0.25px'
12286
12500
  };
12287
- var textStyleWithMargin = Object.assign(Object.assign({}, textStyle$1), {
12501
+ var textStyleWithMargin = Object.assign(Object.assign({}, textStyle), {
12288
12502
  marginBottom: 1
12289
12503
  });
12290
12504
 
@@ -12293,7 +12507,7 @@ var LayerInfoText = function LayerInfoText(_ref) {
12293
12507
  value = _ref.value;
12294
12508
  return /*#__PURE__*/React__default.createElement(React__default.Fragment, null, /*#__PURE__*/React__default.createElement(Typography$1, {
12295
12509
  variant: "subtitle2",
12296
- sx: textStyle$1
12510
+ sx: textStyle
12297
12511
  }, label), /*#__PURE__*/React__default.createElement(Typography$1, {
12298
12512
  variant: "body2",
12299
12513
  sx: textStyleWithMargin
@@ -12316,10 +12530,6 @@ var LayerInfoText = function LayerInfoText(_ref) {
12316
12530
  * Copyright 2022 - Koninklijk Nederlands Meteorologisch Instituut (KNMI)
12317
12531
  * Copyright 2022 - Finnish Meteorological Institute (FMI)
12318
12532
  * */
12319
- var textStyle = {
12320
- lineHeight: '20px',
12321
- letterSpacing: '0.25px'
12322
- };
12323
12533
  var valueStyle = Object.assign(Object.assign({}, textStyle), {
12324
12534
  overflowWrap: 'break-word'
12325
12535
  });
@@ -12330,12 +12540,15 @@ var LayerInfoList = function LayerInfoList(_ref) {
12330
12540
  return /*#__PURE__*/React__default.createElement(React__default.Fragment, null, /*#__PURE__*/React__default.createElement(Typography$1, {
12331
12541
  variant: "subtitle2",
12332
12542
  sx: textStyle
12333
- }, label), /*#__PURE__*/React__default.createElement(Grid$1, {
12543
+ }, label), list.length === 0 ? /*#__PURE__*/React__default.createElement(Typography$1, {
12544
+ variant: "body2",
12545
+ sx: textStyleWithMargin
12546
+ }, "-") : /*#__PURE__*/React__default.createElement(Grid$1, {
12334
12547
  container: true,
12335
12548
  direction: "column"
12336
12549
  }, list.map(function (item) {
12337
12550
  return /*#__PURE__*/React__default.createElement("div", {
12338
- key: item.name
12551
+ key: item.label
12339
12552
  }, /*#__PURE__*/React__default.createElement(Grid$1, {
12340
12553
  item: true,
12341
12554
  container: true,
@@ -12348,7 +12561,7 @@ var LayerInfoList = function LayerInfoList(_ref) {
12348
12561
  }, /*#__PURE__*/React__default.createElement(Typography$1, {
12349
12562
  variant: "body2",
12350
12563
  sx: textStyle
12351
- }, item.name, ":"))), /*#__PURE__*/React__default.createElement(Grid$1, {
12564
+ }, item.label, ":"))), /*#__PURE__*/React__default.createElement(Grid$1, {
12352
12565
  item: true,
12353
12566
  container: true,
12354
12567
  direction: "row",
@@ -12363,6 +12576,41 @@ var LayerInfoList = function LayerInfoList(_ref) {
12363
12576
  })));
12364
12577
  };
12365
12578
 
12579
+ /* *
12580
+ * Licensed under the Apache License, Version 2.0 (the "License");
12581
+ * you may not use this file except in compliance with the License.
12582
+ * You may obtain a copy of the License at
12583
+ *
12584
+ * http://www.apache.org/licenses/LICENSE-2.0
12585
+ *
12586
+ * Unless required by applicable law or agreed to in writing, software
12587
+ * distributed under the License is distributed on an "AS IS" BASIS,
12588
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12589
+ * See the License for the specific language governing permissions and
12590
+ * limitations under the License.
12591
+ *
12592
+ * Copyright 2022 - Koninklijk Nederlands Meteorologisch Instituut (KNMI)
12593
+ * Copyright 2022 - Finnish Meteorological Institute (FMI)
12594
+ * */
12595
+
12596
+ var LayerInfoLegend = function LayerInfoLegend(_ref) {
12597
+ var title = _ref.title,
12598
+ name = _ref.name,
12599
+ dimensions = _ref.dimensions,
12600
+ legendURL = _ref.legendURL;
12601
+ return /*#__PURE__*/React__default.createElement(React__default.Fragment, null, /*#__PURE__*/React__default.createElement(Typography$1, {
12602
+ variant: "subtitle2",
12603
+ sx: textStyleWithMargin
12604
+ }, "Legend"), /*#__PURE__*/React__default.createElement(LegendLayout, {
12605
+ title: title,
12606
+ name: name,
12607
+ dimensions: dimensions
12608
+ }, legendURL ? /*#__PURE__*/React__default.createElement("img", {
12609
+ alt: title,
12610
+ src: legendURL
12611
+ }) : '-'));
12612
+ };
12613
+
12366
12614
  /* *
12367
12615
  * Licensed under the Apache License, Version 2.0 (the "License");
12368
12616
  * you may not use this file except in compliance with the License.
@@ -12394,20 +12642,19 @@ var getLayerStyles = function getLayerStyles(layer) {
12394
12642
 
12395
12643
  return styles.join(', ');
12396
12644
  };
12397
- var getDimensionValue = function getDimensionValue(name, layer, breakAt) {
12398
- var includeUnit = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : false;
12399
-
12400
- var _a;
12401
-
12402
- var dimension = (_a = layer.dimensions) === null || _a === void 0 ? void 0 : _a.find(function (dimension) {
12403
- return dimension.name.toLowerCase() === name;
12645
+ var getDimensionValue = function getDimensionValue(name, dimensions) {
12646
+ var dimension = dimensions === null || dimensions === void 0 ? void 0 : dimensions.find(function (dimension) {
12647
+ return dimension.name.toLowerCase() === name.toLowerCase();
12404
12648
  });
12405
12649
 
12406
- if (!dimension) {
12407
- return '-';
12650
+ if (!dimension || !dimension.currentValue) {
12651
+ return null;
12408
12652
  }
12409
12653
 
12410
- var dimValue = dimension === null || dimension === void 0 ? void 0 : dimension.currentValue.split(breakAt).join("".concat(breakAt, " "));
12654
+ var dimName = dimension.name.toLowerCase();
12655
+ var breakAt = dimName === 'time' ? '/' : ',';
12656
+ var includeUnit = dimName !== 'time' && dimName !== 'reference_time';
12657
+ var dimValue = dimension.currentValue.split(breakAt).join("".concat(breakAt, " "));
12411
12658
 
12412
12659
  if (includeUnit) {
12413
12660
  return "".concat(dimValue, " ").concat(dimension.units);
@@ -12418,6 +12665,64 @@ var getDimensionValue = function getDimensionValue(name, layer, breakAt) {
12418
12665
  var getLayerBbox = function getLayerBbox(layer) {
12419
12666
  return layer.geographicBoundingBox ? "west ".concat(layer.geographicBoundingBox.west, ", east ").concat(layer.geographicBoundingBox.east, ", north ").concat(layer.geographicBoundingBox.north, ", south ").concat(layer.geographicBoundingBox.south) : '-';
12420
12667
  };
12668
+ var getDimensionIcon$1 = function getDimensionIcon(name, dimensions) {
12669
+ var dimension = dimensions === null || dimensions === void 0 ? void 0 : dimensions.find(function (dimension) {
12670
+ return dimension.name.toLowerCase() === name.toLowerCase();
12671
+ });
12672
+
12673
+ if (!dimension) {
12674
+ return null;
12675
+ }
12676
+
12677
+ switch (dimension.name.toLowerCase()) {
12678
+ case 'time':
12679
+ return /*#__PURE__*/React__default.createElement(DimensionsTime, null);
12680
+
12681
+ case 'reference_time':
12682
+ return /*#__PURE__*/React__default.createElement(DimensionsRefTime, null);
12683
+
12684
+ case 'elevation':
12685
+ return /*#__PURE__*/React__default.createElement(DimensionsElevation, null);
12686
+
12687
+ default:
12688
+ return /*#__PURE__*/React__default.createElement(DimensionsOther, null);
12689
+ }
12690
+ };
12691
+ var getDimensionLabel = function getDimensionLabel(name) {
12692
+ var dimName = name.toLowerCase().split('_').join(' ');
12693
+ return dimName.charAt(0).toUpperCase() + dimName.slice(1);
12694
+ };
12695
+ var getDimensionsList = function getDimensionsList(dimensions) {
12696
+ var result = [];
12697
+ dimensions === null || dimensions === void 0 ? void 0 : dimensions.forEach(function (_ref) {
12698
+ var name = _ref.name;
12699
+ var value = getDimensionValue(name, dimensions);
12700
+
12701
+ if (!value) {
12702
+ return;
12703
+ }
12704
+
12705
+ var icon = getDimensionIcon$1(name, dimensions);
12706
+ var label = getDimensionLabel(name);
12707
+ result.push({
12708
+ label: label,
12709
+ value: value,
12710
+ icon: icon
12711
+ });
12712
+ }); // sort alphabetically so other dimensions are sorted
12713
+
12714
+ result.sort(function (a, b) {
12715
+ return a.label.localeCompare(b.label);
12716
+ }); // sort by fixed order
12717
+
12718
+ var preferredOrder = ['Time', 'Reference time', 'Elevation']; // using reverse ordering to make sure the other dimensions come last
12719
+
12720
+ preferredOrder.reverse();
12721
+ result.sort(function (a, b) {
12722
+ return preferredOrder.indexOf(b.label) - preferredOrder.indexOf(a.label);
12723
+ });
12724
+ return result;
12725
+ };
12421
12726
 
12422
12727
  /* *
12423
12728
  * Licensed under the Apache License, Version 2.0 (the "License");
@@ -12448,13 +12753,11 @@ var LayerInfoDialog = function LayerInfoDialog(_ref) {
12448
12753
  source = _ref$source === void 0 ? 'app' : _ref$source,
12449
12754
  dialogHeight = _ref.dialogHeight;
12450
12755
 
12451
- var _a;
12756
+ var _a, _b;
12452
12757
 
12453
12758
  var styles = getLayerStyles(layer);
12454
12759
  var bbox = getLayerBbox(layer);
12455
- var timeValue = getDimensionValue('time', layer, '/');
12456
- var refTimeValue = getDimensionValue('reference_time', layer, ',');
12457
- var elevationValue = getDimensionValue('elevation', layer, ',', true);
12760
+ var dimensions = getDimensionsList(layer.dimensions);
12458
12761
  return /*#__PURE__*/React__default.createElement(ToolContainerDraggable, {
12459
12762
  onClose: onClose,
12460
12763
  headerSize: "xs",
@@ -12489,23 +12792,7 @@ var LayerInfoDialog = function LayerInfoDialog(_ref) {
12489
12792
  value: layer["abstract"] || '-'
12490
12793
  }), /*#__PURE__*/React__default.createElement(LayerInfoList, {
12491
12794
  label: "Dimensions",
12492
- list: [{
12493
- name: 'Time',
12494
- value: timeValue,
12495
- icon: /*#__PURE__*/React__default.createElement(DimensionsTime, null)
12496
- }, {
12497
- name: 'Reference Time',
12498
- value: refTimeValue,
12499
- icon: /*#__PURE__*/React__default.createElement(DimensionsRefTime, null)
12500
- }, {
12501
- name: 'Elevation',
12502
- value: elevationValue,
12503
- icon: /*#__PURE__*/React__default.createElement(DimensionsElevation, null)
12504
- }, {
12505
- name: 'Other dimensions',
12506
- value: '-',
12507
- icon: /*#__PURE__*/React__default.createElement(DimensionsOther, null)
12508
- }]
12795
+ list: dimensions
12509
12796
  }), /*#__PURE__*/React__default.createElement(LayerInfoText, {
12510
12797
  label: "Styles",
12511
12798
  value: styles
@@ -12518,9 +12805,152 @@ var LayerInfoDialog = function LayerInfoDialog(_ref) {
12518
12805
  }), /*#__PURE__*/React__default.createElement(LayerInfoText, {
12519
12806
  label: "Keywords",
12520
12807
  value: ((_a = layer.keywords) === null || _a === void 0 ? void 0 : _a.join(', ')) || '-'
12808
+ }), /*#__PURE__*/React__default.createElement(LayerInfoLegend, {
12809
+ title: layer.text,
12810
+ name: layer.name,
12811
+ dimensions: layer.dimensions,
12812
+ legendURL: ((_b = layer.styles) === null || _b === void 0 ? void 0 : _b.length) ? layer.styles[0].legendURL : undefined
12521
12813
  })));
12522
12814
  };
12523
12815
 
12816
+ /* *
12817
+ * Licensed under the Apache License, Version 2.0 (the "License");
12818
+ * you may not use this file except in compliance with the License.
12819
+ * You may obtain a copy of the License at
12820
+ *
12821
+ * http://www.apache.org/licenses/LICENSE-2.0
12822
+ *
12823
+ * Unless required by applicable law or agreed to in writing, software
12824
+ * distributed under the License is distributed on an "AS IS" BASIS,
12825
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12826
+ * See the License for the specific language governing permissions and
12827
+ * limitations under the License.
12828
+ *
12829
+ * Copyright 2022 - Koninklijk Nederlands Meteorologisch Instituut (KNMI)
12830
+ * Copyright 2022 - Finnish Meteorological Institute (FMI)
12831
+ * */
12832
+
12833
+ var LayerListDimensions = function LayerListDimensions(_ref) {
12834
+ var dimensions = _ref.dimensions;
12835
+
12836
+ if (!dimensions || !dimensions.length) {
12837
+ return null;
12838
+ }
12839
+
12840
+ return /*#__PURE__*/React__default.createElement(React__default.Fragment, null, dimensions.map(function (dimension) {
12841
+ return /*#__PURE__*/React__default.createElement(Tooltip$1, {
12842
+ key: dimension.label,
12843
+ title: "".concat(dimension.label, ": ").concat(dimension.value)
12844
+ }, /*#__PURE__*/React__default.createElement("span", {
12845
+ style: {
12846
+ marginRight: 4
12847
+ }
12848
+ }, dimension.icon));
12849
+ }));
12850
+ };
12851
+
12852
+ /* *
12853
+ * Licensed under the Apache License, Version 2.0 (the "License");
12854
+ * you may not use this file except in compliance with the License.
12855
+ * You may obtain a copy of the License at
12856
+ *
12857
+ * http://www.apache.org/licenses/LICENSE-2.0
12858
+ *
12859
+ * Unless required by applicable law or agreed to in writing, software
12860
+ * distributed under the License is distributed on an "AS IS" BASIS,
12861
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12862
+ * See the License for the specific language governing permissions and
12863
+ * limitations under the License.
12864
+ *
12865
+ * Copyright 2022 - Koninklijk Nederlands Meteorologisch Instituut (KNMI)
12866
+ * Copyright 2022 - Finnish Meteorological Institute (FMI)
12867
+ * */
12868
+ var buttonLarge = 80;
12869
+ var buttonSmall = 60;
12870
+ var layerSelectColumnsLarge = {
12871
+ column1: {
12872
+ width: 112
12873
+ },
12874
+ column2: {
12875
+ marginTop: '6px',
12876
+ width: "calc(100% - 112px)",
12877
+ height: '36px',
12878
+ paddingLeft: '20px'
12879
+ },
12880
+ column3: {
12881
+ height: '12px'
12882
+ },
12883
+ column4: {
12884
+ height: '24px'
12885
+ },
12886
+ column5: {
12887
+ height: '24px',
12888
+ width: 140
12889
+ },
12890
+ column6: {
12891
+ height: '24px',
12892
+ width: "calc(100% - 140px)"
12893
+ },
12894
+ column7: {
12895
+ height: '48px',
12896
+ width: buttonLarge,
12897
+ marginRight: 1,
12898
+ marginLeft: 2
12899
+ },
12900
+ column8: {
12901
+ width: "calc(100% - ".concat(buttonLarge, "px - 24px)")
12902
+ },
12903
+ column9: {
12904
+ width: "calc(".concat(buttonLarge, "px + 24px)")
12905
+ }
12906
+ };
12907
+ var layerSelectColumnsSmall = {
12908
+ column1: {
12909
+ width: '100%'
12910
+ },
12911
+ column2: {
12912
+ marginTop: '4px',
12913
+ width: "calc(100% - 20px)"
12914
+ },
12915
+ column3: {
12916
+ height: '12px'
12917
+ },
12918
+ column4: {
12919
+ height: '48px'
12920
+ },
12921
+ column5: {
12922
+ height: '24px',
12923
+ width: '100%'
12924
+ },
12925
+ column6: {
12926
+ height: '24px',
12927
+ width: '100%'
12928
+ },
12929
+ column7: {
12930
+ height: '48px',
12931
+ width: buttonSmall,
12932
+ marginRight: 0,
12933
+ marginLeft: 1
12934
+ },
12935
+ column8: {
12936
+ width: "calc(100% - ".concat(buttonSmall, "px - 8px)")
12937
+ },
12938
+ column9: {
12939
+ width: "calc(".concat(buttonSmall, "px + 8px)")
12940
+ }
12941
+ };
12942
+ var breakpoint = 500;
12943
+ var widthToColumns = function widthToColumns(width) {
12944
+ if (width <= breakpoint) return layerSelectColumnsSmall;
12945
+ return layerSelectColumnsLarge;
12946
+ };
12947
+ var rowHeightLarge = 68;
12948
+ var rowHeightSmall = 136;
12949
+ var widthToRowHeight = function widthToRowHeight(width) {
12950
+ if (width <= breakpoint) return rowHeightSmall;
12951
+ return rowHeightLarge;
12952
+ };
12953
+
12524
12954
  /* *
12525
12955
  * Licensed under the Apache License, Version 2.0 (the "License");
12526
12956
  * you may not use this file except in compliance with the License.
@@ -12541,7 +12971,8 @@ var layerInfoStyle = {
12541
12971
  fontSize: '10px',
12542
12972
  textOverflow: 'ellipsis',
12543
12973
  overflow: 'hidden',
12544
- whiteSpace: 'nowrap'
12974
+ whiteSpace: 'nowrap',
12975
+ lineHeight: 1
12545
12976
  };
12546
12977
 
12547
12978
  var LayerListRow = function LayerListRow(_ref) {
@@ -12551,31 +12982,32 @@ var LayerListRow = function LayerListRow(_ref) {
12551
12982
  addLayer = _ref.addLayer,
12552
12983
  deleteLayer = _ref.deleteLayer,
12553
12984
  mapLayers = _ref.mapLayers,
12554
- mapId = _ref.mapId;
12985
+ mapId = _ref.mapId,
12986
+ layerSelectWidth = _ref.layerSelectWidth;
12555
12987
 
12556
- var _a, _b, _c;
12988
+ var _a;
12557
12989
 
12990
+ var rowHeight = widthToRowHeight(layerSelectWidth);
12991
+ var columns = widthToColumns(layerSelectWidth);
12992
+ var dimensions = getDimensionsList(layer.dimensions);
12558
12993
  return /*#__PURE__*/React__default.createElement(Grid, {
12559
12994
  "data-testid": "layerListLayerRow",
12560
12995
  container: true,
12561
- item: true,
12562
- xs: 12,
12563
12996
  justifyContent: "center",
12564
12997
  alignItems: "center",
12565
12998
  sx: {
12566
12999
  backgroundColor: 'geowebColors.cards.cardContainer',
12567
13000
  padding: '8px',
12568
13001
  marginBottom: '4px',
12569
- height: '68px',
13002
+ height: rowHeight,
12570
13003
  border: 'solid 1px',
12571
13004
  borderColor: 'geowebColors.cards.cardContainerBorder'
12572
13005
  }
12573
13006
  }, /*#__PURE__*/React__default.createElement(Grid, {
12574
13007
  container: true,
12575
13008
  item: true,
12576
- xs: 10
13009
+ sx: columns.column8
12577
13010
  }, /*#__PURE__*/React__default.createElement(Grid, {
12578
- container: true,
12579
13011
  item: true,
12580
13012
  xs: 12
12581
13013
  }, /*#__PURE__*/React__default.createElement(Box, {
@@ -12584,25 +13016,19 @@ var LayerListRow = function LayerListRow(_ref) {
12584
13016
  height: '14px',
12585
13017
  lineHeight: '14px',
12586
13018
  fontWeight: 500,
12587
- WebkitLineClamp: 1,
12588
- display: '-webkit-box',
12589
- WebkitBoxOrient: 'vertical',
12590
13019
  textOverflow: 'ellipsis',
12591
13020
  overflow: 'hidden'
12592
13021
  }
12593
13022
  }, layer.text)), /*#__PURE__*/React__default.createElement(Grid, {
12594
- container: true,
12595
13023
  item: true,
12596
- xs: 4,
12597
- direction: "column"
13024
+ container: true,
13025
+ direction: "column",
13026
+ sx: columns.column1
12598
13027
  }, /*#__PURE__*/React__default.createElement(Box, {
12599
13028
  sx: {
12600
13029
  fontSize: '12px',
12601
13030
  height: '18px',
12602
13031
  lineHeight: '18px',
12603
- WebkitLineClamp: 1,
12604
- display: '-webkit-box',
12605
- WebkitBoxOrient: 'vertical',
12606
13032
  textOverflow: 'ellipsis',
12607
13033
  overflow: 'hidden'
12608
13034
  }
@@ -12610,44 +13036,41 @@ var LayerListRow = function LayerListRow(_ref) {
12610
13036
  layer: layer,
12611
13037
  mapId: mapId,
12612
13038
  serviceName: service.name
12613
- })), layer["abstract"] || ((_a = layer.keywords) === null || _a === void 0 ? void 0 : _a.length) || layer.path.length ? /*#__PURE__*/React__default.createElement(Grid, {
13039
+ })), /*#__PURE__*/React__default.createElement(Grid, {
13040
+ item: true,
13041
+ sx: columns.column2
13042
+ }, /*#__PURE__*/React__default.createElement(Grid, {
13043
+ item: true,
13044
+ sx: columns.column3
13045
+ }, layer["abstract"] && /*#__PURE__*/React__default.createElement(Typography, {
12614
13046
  "data-testid": "layerAbstract",
13047
+ sx: layerInfoStyle
13048
+ }, layer["abstract"])), /*#__PURE__*/React__default.createElement(Grid, {
13049
+ item: true,
12615
13050
  container: true,
13051
+ sx: columns.column4
13052
+ }, /*#__PURE__*/React__default.createElement(Grid, {
12616
13053
  item: true,
12617
- xs: 8,
12618
- sx: {
12619
- height: '45px',
12620
- paddingLeft: '20px',
12621
- WebkitLineClamp: 2,
12622
- display: '-webkit-box',
12623
- WebkitBoxOrient: 'vertical'
12624
- }
12625
- }, layer["abstract"] && /*#__PURE__*/React__default.createElement(Typography, {
12626
- sx: Object.assign(Object.assign({}, layerInfoStyle), {
12627
- height: 15
12628
- })
12629
- }, layer["abstract"]), layer.path.length > 0 && /*#__PURE__*/React__default.createElement(Typography, {
12630
- sx: Object.assign(Object.assign({}, layerInfoStyle), {
12631
- height: ((_b = layer.keywords) === null || _b === void 0 ? void 0 : _b.length) ? 15 : 30
12632
- })
12633
- }, "Groups: ", layer.path.join(' / ')), ((_c = layer.keywords) === null || _c === void 0 ? void 0 : _c.length) > 0 && /*#__PURE__*/React__default.createElement(Typography, {
12634
- sx: Object.assign(Object.assign({}, layerInfoStyle), {
12635
- height: layer.path.length ? 15 : 30
12636
- })
13054
+ sx: columns.column5
13055
+ }, /*#__PURE__*/React__default.createElement(LayerListDimensions, {
13056
+ dimensions: dimensions
13057
+ })), /*#__PURE__*/React__default.createElement(Grid, {
13058
+ item: true,
13059
+ sx: columns.column6
13060
+ }, layer.path.length > 0 && /*#__PURE__*/React__default.createElement(Typography, {
13061
+ sx: layerInfoStyle
13062
+ }, "Groups: ", layer.path.join(' / ')), ((_a = layer.keywords) === null || _a === void 0 ? void 0 : _a.length) > 0 && /*#__PURE__*/React__default.createElement(Typography, {
13063
+ sx: layerInfoStyle
12637
13064
  }, "Keywords:", ' ', layer.keywords.slice().sort(function (a, b) {
12638
13065
  return a.localeCompare(b);
12639
- }).join(', '))) : null), /*#__PURE__*/React__default.createElement(Grid, {
13066
+ }).join(', ')))))), /*#__PURE__*/React__default.createElement(Grid, {
12640
13067
  container: true,
12641
13068
  item: true,
12642
- xs: 2,
13069
+ sx: columns.column9,
12643
13070
  justifyContent: "flex-end",
12644
13071
  alignItems: "center"
12645
13072
  }, /*#__PURE__*/React__default.createElement(Box, {
12646
- sx: {
12647
- width: '80px',
12648
- height: '48px',
12649
- marginRight: '8px'
12650
- }
13073
+ sx: columns.column7
12651
13074
  }, /*#__PURE__*/React__default.createElement(LayerAddRemoveButton, {
12652
13075
  layer: layer,
12653
13076
  layerIndex: layerIndex,
@@ -12658,42 +13081,36 @@ var LayerListRow = function LayerListRow(_ref) {
12658
13081
  }))));
12659
13082
  };
12660
13083
 
13084
+ /* *
13085
+ * Licensed under the Apache License, Version 2.0 (the "License");
13086
+ * you may not use this file except in compliance with the License.
13087
+ * You may obtain a copy of the License at
13088
+ *
13089
+ * http://www.apache.org/licenses/LICENSE-2.0
13090
+ *
13091
+ * Unless required by applicable law or agreed to in writing, software
13092
+ * distributed under the License is distributed on an "AS IS" BASIS,
13093
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13094
+ * See the License for the specific language governing permissions and
13095
+ * limitations under the License.
13096
+ *
13097
+ * Copyright 2022 - Koninklijk Nederlands Meteorologisch Instituut (KNMI)
13098
+ * Copyright 2022 - Finnish Meteorological Institute (FMI)
13099
+ * */
13100
+
12661
13101
  var LayerList = function LayerList(_ref) {
12662
13102
  var services = _ref.services,
12663
- serviceIds = _ref.serviceIds,
13103
+ filteredLayers = _ref.filteredLayers,
12664
13104
  layerSelectHeight = _ref.layerSelectHeight,
12665
13105
  serviceListHeight = _ref.serviceListHeight,
13106
+ layerSelectWidth = _ref.layerSelectWidth,
12666
13107
  addLayer = _ref.addLayer,
12667
13108
  deleteLayer = _ref.deleteLayer,
12668
- searchString = _ref.searchString,
12669
13109
  mapLayers = _ref.mapLayers,
12670
- filterIds = _ref.filterIds,
12671
- allFiltersActive = _ref.allFiltersActive,
12672
13110
  mapId = _ref.mapId;
13111
+ var rowMargin = 4;
13112
+ var rowHeight = widthToRowHeight(layerSelectWidth);
12673
13113
  var layerSelectFilterHeight = 155 + serviceListHeight;
12674
-
12675
- var _React$useState = React.useState(0),
12676
- _React$useState2 = _slicedToArray(_React$useState, 2),
12677
- numberOfLayers = _React$useState2[0],
12678
- setNumberOfLayers = _React$useState2[1];
12679
-
12680
- var _React$useState3 = React.useState([]),
12681
- _React$useState4 = _slicedToArray(_React$useState3, 2),
12682
- layersFilteredFromService = _React$useState4[0],
12683
- setLayersFilteredFromService = _React$useState4[1];
12684
-
12685
- React.useEffect(function () {
12686
- setNumberOfLayers(serviceIds.reduce(function (totalNumberOfLayers, serviceId) {
12687
- return totalNumberOfLayers + filterLayersFromService(serviceId, services, filterIds, allFiltersActive, searchString).length;
12688
- }, 0));
12689
- setLayersFilteredFromService(serviceIds.reduce(function (layerList, serviceId) {
12690
- return layerList.concat(filterLayersFromService(serviceId, services, filterIds, allFiltersActive, searchString).map(function (layer) {
12691
- return Object.assign(Object.assign({}, layer), {
12692
- serviceId: serviceId
12693
- });
12694
- }));
12695
- }, []));
12696
- }, [serviceIds, filterIds, services, searchString, allFiltersActive]);
12697
13114
  return /*#__PURE__*/React.createElement(Box, {
12698
13115
  "data-testid": "layerList"
12699
13116
  }, /*#__PURE__*/React.createElement(Box, {
@@ -12701,24 +13118,27 @@ var LayerList = function LayerList(_ref) {
12701
13118
  marginBottom: '4px',
12702
13119
  fontSize: '12px'
12703
13120
  }
12704
- }, numberOfLayers, " results"), /*#__PURE__*/React.createElement(FixedSizeList, {
13121
+ }, filteredLayers.length, " results"), /*#__PURE__*/React.createElement(FixedSizeList, {
12705
13122
  height: layerSelectHeight - layerSelectFilterHeight,
12706
- itemCount: numberOfLayers,
12707
- itemSize: 72
13123
+ itemCount: filteredLayers.length,
13124
+ itemSize: rowHeight + rowMargin
12708
13125
  }, function (_ref2) {
12709
13126
  var index = _ref2.index,
12710
13127
  style = _ref2.style;
13128
+ var filter = filteredLayers[index];
13129
+ var service = services[filter.serviceName];
12711
13130
  return /*#__PURE__*/React.createElement("div", {
12712
13131
  style: style,
12713
- key: layersFilteredFromService[index].name
12714
- }, services[layersFilteredFromService[index].serviceId] && /*#__PURE__*/React.createElement(LayerListRow, {
12715
- layer: layersFilteredFromService[index],
13132
+ key: filter.name
13133
+ }, service && /*#__PURE__*/React.createElement(LayerListRow, {
13134
+ layer: filter,
12716
13135
  layerIndex: index,
12717
- service: services[layersFilteredFromService[index].serviceId],
13136
+ service: service,
12718
13137
  addLayer: addLayer,
12719
13138
  deleteLayer: deleteLayer,
12720
13139
  mapLayers: mapLayers,
12721
- mapId: mapId
13140
+ mapId: mapId,
13141
+ layerSelectWidth: layerSelectWidth
12722
13142
  }));
12723
13143
  }));
12724
13144
  };
@@ -12743,14 +13163,12 @@ var LayerList = function LayerList(_ref) {
12743
13163
  var LayerListConnect = function LayerListConnect(_ref) {
12744
13164
  var mapId = _ref.mapId,
12745
13165
  layerSelectHeight = _ref.layerSelectHeight,
12746
- serviceListHeight = _ref.serviceListHeight;
13166
+ serviceListHeight = _ref.serviceListHeight,
13167
+ layerSelectWidth = _ref.layerSelectWidth;
13168
+ var dispatch = useDispatch();
12747
13169
  var services = useSelector(function (store) {
12748
13170
  return getServices(store);
12749
13171
  });
12750
- var dispatch = useDispatch();
12751
- var enabledServiceIds = useSelector(function (store) {
12752
- return getEnabledServiceIds(store);
12753
- });
12754
13172
  var mapLayers = useSelector(function (store) {
12755
13173
  return getMapLayers(store, mapId);
12756
13174
  });
@@ -12765,7 +13183,6 @@ var LayerListConnect = function LayerListConnect(_ref) {
12765
13183
  layerType: LayerType$1.mapLayer
12766
13184
  };
12767
13185
  addMapLayer({
12768
- mapId: mapId,
12769
13186
  layerId: layer.id,
12770
13187
  layer: layer,
12771
13188
  origin: LayerActionOrigin.layerManager
@@ -12793,25 +13210,17 @@ var LayerListConnect = function LayerListConnect(_ref) {
12793
13210
  origin: LayerActionOrigin.layerManager
12794
13211
  }));
12795
13212
  }, [dispatch, mapId]);
12796
- var checkedFilterIds = useSelector(function (store) {
12797
- return getCheckedFilterIds(store);
12798
- });
12799
- var allFiltersActive = useSelector(function (store) {
12800
- return isAllFiltersChecked(store);
12801
- });
12802
- var searchString = useSelector(function (store) {
12803
- return getSearchFilter(store);
13213
+ var filteredLayers = useSelector(function (store) {
13214
+ return getFilteredLayers(store);
12804
13215
  });
12805
13216
  return /*#__PURE__*/React.createElement(LayerList, {
13217
+ filteredLayers: filteredLayers,
12806
13218
  services: services,
12807
- serviceIds: enabledServiceIds,
12808
13219
  layerSelectHeight: layerSelectHeight,
12809
13220
  serviceListHeight: serviceListHeight,
13221
+ layerSelectWidth: layerSelectWidth,
12810
13222
  addLayer: addLayer,
12811
13223
  deleteLayer: deleteLayer,
12812
- filterIds: checkedFilterIds,
12813
- allFiltersActive: allFiltersActive,
12814
- searchString: searchString,
12815
13224
  mapLayers: mapLayers,
12816
13225
  mapId: mapId
12817
13226
  });
@@ -12835,13 +13244,13 @@ var LayerListConnect = function LayerListConnect(_ref) {
12835
13244
  * */
12836
13245
  var style = {
12837
13246
  borderRadius: '20px!important',
12838
- marginRight: '8px',
13247
+ marginRight: '4px',
12839
13248
  whiteSpace: 'nowrap',
12840
- height: '32px!important',
13249
+ height: '24px!important',
12841
13250
  padding: '5px 12px!important',
12842
13251
  textTransform: 'none!important',
12843
13252
  fontWeight: 'normal',
12844
- marginBottom: '5px'
13253
+ marginBottom: '4px'
12845
13254
  };
12846
13255
 
12847
13256
  var ServiceChip = function ServiceChip(_ref) {
@@ -12851,6 +13260,7 @@ var ServiceChip = function ServiceChip(_ref) {
12851
13260
  isSelected = _ref.isSelected,
12852
13261
  isDisabled = _ref.isDisabled,
12853
13262
  toggleChip = _ref.toggleChip;
13263
+ var chip = all ? 'all' : service && service.serviceUrl;
12854
13264
  return /*#__PURE__*/React.createElement(Tooltip, {
12855
13265
  title: (service === null || service === void 0 ? void 0 : service["abstract"]) ? "Abstract: ".concat(service["abstract"]) : ''
12856
13266
  }, /*#__PURE__*/React.createElement(CustomToggleButton, {
@@ -12859,10 +13269,10 @@ var ServiceChip = function ServiceChip(_ref) {
12859
13269
  tabIndex: 0,
12860
13270
  "data-testid": all ? 'serviceChipAll' : 'serviceChip',
12861
13271
  onClick: function onClick() {
12862
- return toggleChip(all ? 'all' : service && service.serviceUrl);
13272
+ return toggleChip(chip);
12863
13273
  },
12864
13274
  onKeyPress: function onKeyPress() {
12865
- return toggleChip(all ? 'all' : service && service.serviceUrl);
13275
+ return toggleChip(chip);
12866
13276
  },
12867
13277
  disabled: isDisabled,
12868
13278
  sx: style
@@ -12996,9 +13406,9 @@ var ServiceList = function ServiceList(_ref) {
12996
13406
  display: 'block',
12997
13407
  alignItems: 'center',
12998
13408
  "float": 'left',
12999
- paddingLeft: '40px',
13000
- paddingRight: '30px',
13001
- marginBottom: '5px',
13409
+ paddingLeft: '48px',
13410
+ paddingRight: '40px',
13411
+ marginBottom: '8px',
13002
13412
  fontSize: '0.875rem'
13003
13413
  },
13004
13414
  ref: ref
@@ -13068,7 +13478,7 @@ var ServiceListConnect = function ServiceListConnect(_ref7) {
13068
13478
  * */
13069
13479
  var styles$1 = {
13070
13480
  servicesContainer: {
13071
- width: '300px',
13481
+ width: '360px',
13072
13482
  maxHeight: '380px',
13073
13483
  top: '140px',
13074
13484
  backgroundColor: 'geowebColors.background.surface',
@@ -13083,6 +13493,10 @@ var styles$1 = {
13083
13493
  backgroundColor: 'geowebColors.background.surface',
13084
13494
  zIndex: 100
13085
13495
  },
13496
+ loading: {
13497
+ position: 'absolute',
13498
+ zIndex: 101
13499
+ },
13086
13500
  footer: {
13087
13501
  display: 'flex',
13088
13502
  justifyContent: 'center',
@@ -13103,8 +13517,11 @@ var styles$1 = {
13103
13517
  var ServiceOptionsDialog = function ServiceOptionsDialog(_ref) {
13104
13518
  var services = _ref.services,
13105
13519
  layerSelectRemoveService = _ref.layerSelectRemoveService,
13520
+ layerSelectReloadService = _ref.layerSelectReloadService,
13106
13521
  selectedLayers = _ref.selectedLayers,
13107
- setServicePopupInfo = _ref.setServicePopupInfo;
13522
+ setServicePopupInfo = _ref.setServicePopupInfo,
13523
+ _ref$isLoading = _ref.isLoading,
13524
+ isLoading = _ref$isLoading === void 0 ? false : _ref$isLoading;
13108
13525
 
13109
13526
  var openAddService = function openAddService() {
13110
13527
  setServicePopupInfo({
@@ -13118,9 +13535,13 @@ var ServiceOptionsDialog = function ServiceOptionsDialog(_ref) {
13118
13535
  "data-testid": "ServiceDialog"
13119
13536
  }, /*#__PURE__*/React.createElement(Box, {
13120
13537
  sx: styles$1.header
13121
- }, "Services"), /*#__PURE__*/React.createElement(Rows, {
13538
+ }, "Services"), /*#__PURE__*/React.createElement(Backdrop, {
13539
+ sx: styles$1.loading,
13540
+ open: isLoading
13541
+ }, /*#__PURE__*/React.createElement(CircularProgress, null)), /*#__PURE__*/React.createElement(Rows, {
13122
13542
  services: services,
13123
13543
  layerSelectRemoveService: layerSelectRemoveService,
13544
+ layerSelectReloadService: layerSelectReloadService,
13124
13545
  setServicePopupInfo: setServicePopupInfo,
13125
13546
  selectedLayers: selectedLayers
13126
13547
  }), /*#__PURE__*/React.createElement(Box, {
@@ -13136,6 +13557,7 @@ var ServiceOptionsDialog = function ServiceOptionsDialog(_ref) {
13136
13557
 
13137
13558
  var Rows = function Rows(_ref2) {
13138
13559
  var services = _ref2.services,
13560
+ layerSelectReloadService = _ref2.layerSelectReloadService,
13139
13561
  layerSelectRemoveService = _ref2.layerSelectRemoveService,
13140
13562
  setServicePopupInfo = _ref2.setServicePopupInfo,
13141
13563
  selectedLayers = _ref2.selectedLayers;
@@ -13154,8 +13576,9 @@ var Rows = function Rows(_ref2) {
13154
13576
  var _services$serviceId = services[serviceId],
13155
13577
  serviceUrl = _services$serviceId.serviceUrl,
13156
13578
  serviceName = _services$serviceId.serviceName,
13157
- isUserAddedService = _services$serviceId.isUserAddedService;
13579
+ scope = _services$serviceId.scope;
13158
13580
  var serviceHasActiveLayers = checkIfServiceHasActiveLayers(serviceUrl);
13581
+ var userAddedService = isUserAddedService(scope);
13159
13582
  return /*#__PURE__*/React.createElement(ListItem, {
13160
13583
  key: serviceUrl
13161
13584
  }, /*#__PURE__*/React.createElement(ListItemText, {
@@ -13166,19 +13589,32 @@ var Rows = function Rows(_ref2) {
13166
13589
  noWrap: true,
13167
13590
  style: {
13168
13591
  textOverflow: 'ellipsis',
13169
- paddingRight: '60px'
13592
+ paddingRight: '70px'
13170
13593
  }
13171
13594
  }, serviceName)), /*#__PURE__*/React.createElement(ListItemSecondaryAction, {
13172
13595
  style: {
13173
- marginRight: '-10px',
13174
- width: 90
13596
+ marginRight: '0px',
13597
+ width: 100
13175
13598
  }
13176
13599
  }, /*#__PURE__*/React.createElement(Grid, {
13177
13600
  container: true
13178
13601
  }, /*#__PURE__*/React.createElement(Grid, {
13179
13602
  item: true,
13180
- xs: 6
13181
- }, isUserAddedService ? /*#__PURE__*/React.createElement(Tooltip, {
13603
+ xs: 4
13604
+ }, /*#__PURE__*/React.createElement(Tooltip, {
13605
+ title: "Update layers from WMS service",
13606
+ "data-testid": "updateServiceTooltip"
13607
+ }, /*#__PURE__*/React.createElement(IconButton, {
13608
+ "data-testid": "updateServiceButton",
13609
+ "aria-label": "Update layers from WMS service",
13610
+ size: "large",
13611
+ onClick: function onClick() {
13612
+ return layerSelectReloadService(serviceUrl);
13613
+ }
13614
+ }, /*#__PURE__*/React.createElement(Cached, null)))), /*#__PURE__*/React.createElement(Grid, {
13615
+ item: true,
13616
+ xs: 4
13617
+ }, userAddedService ? /*#__PURE__*/React.createElement(Tooltip, {
13182
13618
  title: "Edit Service"
13183
13619
  }, /*#__PURE__*/React.createElement("span", null, /*#__PURE__*/React.createElement(IconButton, {
13184
13620
  "aria-label": "edit service",
@@ -13208,8 +13644,8 @@ var Rows = function Rows(_ref2) {
13208
13644
  }
13209
13645
  }, /*#__PURE__*/React.createElement(Visibility, null))))), /*#__PURE__*/React.createElement(Grid, {
13210
13646
  item: true,
13211
- xs: 6
13212
- }, isUserAddedService && /*#__PURE__*/React.createElement(Box, null, /*#__PURE__*/React.createElement(Tooltip, {
13647
+ xs: 4
13648
+ }, userAddedService && /*#__PURE__*/React.createElement(Box, null, /*#__PURE__*/React.createElement(Tooltip, {
13213
13649
  title: serviceHasActiveLayers ? 'Service has active layers. Cannot remove this service' : 'Delete Service',
13214
13650
  "data-testid": "removeServiceTooltip"
13215
13651
  }, /*#__PURE__*/React.createElement("span", null, /*#__PURE__*/React.createElement(IconButton, {
@@ -13224,26 +13660,31 @@ var Rows = function Rows(_ref2) {
13224
13660
  }));
13225
13661
  };
13226
13662
 
13227
- /* *
13228
- * Licensed under the Apache License, Version 2.0 (the "License");
13229
- * you may not use this file except in compliance with the License.
13230
- * You may obtain a copy of the License at
13231
- *
13232
- * http://www.apache.org/licenses/LICENSE-2.0
13233
- *
13234
- * Unless required by applicable law or agreed to in writing, software
13235
- * distributed under the License is distributed on an "AS IS" BASIS,
13236
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13237
- * See the License for the specific language governing permissions and
13238
- * limitations under the License.
13239
- *
13240
- * Copyright 2022 - Koninklijk Nederlands Meteorologisch Instituut (KNMI)
13241
- * Copyright 2022 - Finnish Meteorological Institute (FMI)
13242
- * */
13663
+ var getService = function getService(services, serviceUrl) {
13664
+ var serviceIds = Object.keys(services);
13665
+ var serviceIndex = serviceIds.findIndex(function (serviceId) {
13666
+ return services[serviceId].serviceUrl === serviceUrl;
13667
+ });
13668
+ if (serviceIndex < 0) return null;
13669
+ return services[serviceIds[serviceIndex]];
13670
+ };
13671
+
13672
+ var getServiceSuccesUpdateMessage = function getServiceSuccesUpdateMessage(serviceName) {
13673
+ return "Service \"".concat(serviceName, "\" has been succesfully updated");
13674
+ };
13675
+ var getServiceFailedUpdateMessage = function getServiceFailedUpdateMessage(error) {
13676
+ return "Unable to update service, reason: \"".concat(error.message, "\"");
13677
+ };
13243
13678
 
13244
13679
  var ServiceOptionsDialogConnect = function ServiceOptionsDialogConnect(_ref) {
13245
13680
  var mapId = _ref.mapId,
13246
13681
  setServicePopupInfo = _ref.setServicePopupInfo;
13682
+
13683
+ var _React$useState = React.useState(false),
13684
+ _React$useState2 = _slicedToArray(_React$useState, 2),
13685
+ isLoading = _React$useState2[0],
13686
+ setIsLoading = _React$useState2[1];
13687
+
13247
13688
  var dispatch = useDispatch();
13248
13689
  var layerSelectRemoveService = React.useCallback(function (serviceId, serviceUrl) {
13249
13690
  dispatch(layerSelectActions.layerSelectRemoveService({
@@ -13251,17 +13692,79 @@ var ServiceOptionsDialogConnect = function ServiceOptionsDialogConnect(_ref) {
13251
13692
  serviceUrl: serviceUrl
13252
13693
  }));
13253
13694
  }, [dispatch]);
13695
+ var serviceSetLayers = React.useCallback(function (payload) {
13696
+ dispatch(serviceActions.serviceSetLayers(Object.assign(Object.assign({}, payload), {
13697
+ isUpdating: true
13698
+ })));
13699
+ }, [dispatch]);
13700
+ var showSnackbar = React.useCallback(function (message) {
13701
+ dispatch(snackbarActions.openSnackbar({
13702
+ message: message
13703
+ }));
13704
+ }, [dispatch]);
13254
13705
  var services = useSelector(function (store) {
13255
13706
  return getActiveServices(store);
13256
13707
  });
13257
13708
  var selectedLayers = useSelector(function (store) {
13258
13709
  return getMapLayers(store, mapId);
13259
13710
  });
13711
+ var layerSelectReloadService = React.useCallback(function (serviceUrl) {
13712
+ return __awaiter(void 0, void 0, void 0, /*#__PURE__*/regeneratorRuntime.mark(function _callee() {
13713
+ var layersForService, service, serviceTitle;
13714
+ return regeneratorRuntime.wrap(function _callee$(_context) {
13715
+ while (1) {
13716
+ switch (_context.prev = _context.next) {
13717
+ case 0:
13718
+ setIsLoading(true);
13719
+ _context.prev = 1;
13720
+ _context.next = 4;
13721
+ return loadWMSService(serviceUrl, true);
13722
+
13723
+ case 4:
13724
+ layersForService = _context.sent;
13725
+ service = getService(services, serviceUrl);
13726
+ serviceSetLayers({
13727
+ id: layersForService.id,
13728
+ name: service && service.serviceName || layersForService.name,
13729
+ serviceUrl: serviceUrl,
13730
+ "abstract": service && service["abstract"] || layersForService["abstract"],
13731
+ layers: layersForService.layers,
13732
+ scope: service && service.scope || 'user',
13733
+ isUpdating: true
13734
+ });
13735
+ clearImageCache();
13736
+ serviceTitle = service && service.serviceName || layersForService.name;
13737
+ showSnackbar(getServiceSuccesUpdateMessage(serviceTitle));
13738
+ _context.next = 15;
13739
+ break;
13740
+
13741
+ case 12:
13742
+ _context.prev = 12;
13743
+ _context.t0 = _context["catch"](1);
13744
+ // TODO: Maarten Plieger 2022-11-02: Snackbars should not be used to inform the user that something went wrong.
13745
+ // https://gitlab.com/opengeoweb/opengeoweb/-/issues/2819
13746
+ showSnackbar(getServiceFailedUpdateMessage(_context.t0));
13747
+
13748
+ case 15:
13749
+ _context.prev = 15;
13750
+ setIsLoading(false);
13751
+ return _context.finish(15);
13752
+
13753
+ case 18:
13754
+ case "end":
13755
+ return _context.stop();
13756
+ }
13757
+ }
13758
+ }, _callee, null, [[1, 12, 15, 18]]);
13759
+ }));
13760
+ }, [serviceSetLayers, services, showSnackbar]);
13260
13761
  return /*#__PURE__*/React.createElement(ServiceOptionsDialog, {
13261
13762
  selectedLayers: selectedLayers,
13262
13763
  services: services,
13263
13764
  layerSelectRemoveService: layerSelectRemoveService,
13264
- setServicePopupInfo: setServicePopupInfo
13765
+ layerSelectReloadService: layerSelectReloadService,
13766
+ setServicePopupInfo: setServicePopupInfo,
13767
+ isLoading: isLoading
13265
13768
  });
13266
13769
  };
13267
13770
 
@@ -13308,15 +13811,20 @@ var LayerSelect = function LayerSelect(_ref) {
13308
13811
  _ref$order = _ref.order,
13309
13812
  order = _ref$order === void 0 ? 0 : _ref$order,
13310
13813
  _ref$source = _ref.source,
13311
- source = _ref$source === void 0 ? 'module' : _ref$source;
13814
+ source = _ref$source === void 0 ? 'module' : _ref$source,
13815
+ _ref$startSize = _ref.startSize,
13816
+ startSize = _ref$startSize === void 0 ? {
13817
+ width: 750,
13818
+ height: 500
13819
+ } : _ref$startSize;
13312
13820
  var initialServiceListHeight = 37;
13313
13821
 
13314
- var _React$useState = React.useState(500),
13822
+ var _React$useState = React.useState(startSize.height),
13315
13823
  _React$useState2 = _slicedToArray(_React$useState, 2),
13316
13824
  height = _React$useState2[0],
13317
13825
  setHeight = _React$useState2[1];
13318
13826
 
13319
- var _React$useState3 = React.useState(750),
13827
+ var _React$useState3 = React.useState(startSize.width),
13320
13828
  _React$useState4 = _slicedToArray(_React$useState3, 2),
13321
13829
  width = _React$useState4[0],
13322
13830
  setWidth = _React$useState4[1];
@@ -13345,7 +13853,7 @@ var LayerSelect = function LayerSelect(_ref) {
13345
13853
  width: width,
13346
13854
  height: height
13347
13855
  },
13348
- minWidth: 390,
13856
+ minWidth: 320,
13349
13857
  minHeight: 126,
13350
13858
  startPosition: {
13351
13859
  top: 150,
@@ -13362,13 +13870,13 @@ var LayerSelect = function LayerSelect(_ref) {
13362
13870
  source: source
13363
13871
  }, /*#__PURE__*/React.createElement(Box, {
13364
13872
  sx: {
13365
- padding: '6px'
13873
+ padding: '4px 16px 0 16px'
13366
13874
  }
13367
13875
  }, /*#__PURE__*/React.createElement(SearchFieldConnect, null)), /*#__PURE__*/React.createElement(Box, {
13368
13876
  sx: {
13369
13877
  "float": 'left',
13370
13878
  position: 'absolute',
13371
- margin: '12px 0 0 8px',
13879
+ margin: '8px 8px 0 16px',
13372
13880
  zIndex: 2
13373
13881
  }
13374
13882
  }, /*#__PURE__*/React.createElement(KeywordFilterButtonConnect, {
@@ -13376,7 +13884,7 @@ var LayerSelect = function LayerSelect(_ref) {
13376
13884
  })), /*#__PURE__*/React.createElement(Box, {
13377
13885
  sx: {
13378
13886
  position: 'absolute',
13379
- margin: '12px 0 0 calc(100% - 36px)',
13887
+ margin: '8px 0 0 calc(100% - 40px)',
13380
13888
  zIndex: 2
13381
13889
  }
13382
13890
  }, /*#__PURE__*/React.createElement(ServiceOptionsButton, {
@@ -13385,12 +13893,13 @@ var LayerSelect = function LayerSelect(_ref) {
13385
13893
  setHeight: handleHeightChange
13386
13894
  })), /*#__PURE__*/React.createElement(Box, {
13387
13895
  sx: {
13388
- padding: '0 8px'
13896
+ padding: '0 16px'
13389
13897
  }
13390
13898
  }, /*#__PURE__*/React.createElement(LayerListConnect, {
13391
13899
  mapId: mapId,
13392
13900
  layerSelectHeight: height,
13393
- serviceListHeight: serviceListHeight
13901
+ serviceListHeight: serviceListHeight,
13902
+ layerSelectWidth: width
13394
13903
  })));
13395
13904
  };
13396
13905
 
@@ -13783,7 +14292,7 @@ var KeywordFilterResults = function KeywordFilterResults(_ref) {
13783
14292
  var KeywordFilterResultsConnect = function KeywordFilterResultsConnect(_ref) {
13784
14293
  var bounds = _ref.bounds;
13785
14294
 
13786
- var _useSetupDialog = useSetupDialog('keywordFilter'),
14295
+ var _useSetupDialog = useSetupDialog(DialogTypes.KeywordFilter),
13787
14296
  dialogOrder = _useSetupDialog.dialogOrder,
13788
14297
  onCloseDialog = _useSetupDialog.onCloseDialog,
13789
14298
  setDialogOrder = _useSetupDialog.setDialogOrder,
@@ -13870,10 +14379,10 @@ var LayerSelectConnect = function LayerSelectConnect(_ref) {
13870
14379
  _ref$showTitle = _ref.showTitle,
13871
14380
  showTitle = _ref$showTitle === void 0 ? false : _ref$showTitle;
13872
14381
  var mapId = useSelector(function (store) {
13873
- return getDialogMapId(store, 'layerSelect');
14382
+ return getDialogMapId(store, DialogTypes.LayerSelect);
13874
14383
  });
13875
14384
 
13876
- var _useSetupDialog = useSetupDialog('layerSelect'),
14385
+ var _useSetupDialog = useSetupDialog(DialogTypes.LayerSelect),
13877
14386
  dialogOrder = _useSetupDialog.dialogOrder,
13878
14387
  isDialogOpen = _useSetupDialog.isDialogOpen,
13879
14388
  onCloseDialog = _useSetupDialog.onCloseDialog,
@@ -13905,11 +14414,6 @@ var useFetchServices = function useFetchServices(dialogType) {
13905
14414
  var serviceSetLayers = React.useCallback(function (payload) {
13906
14415
  dispatch(serviceActions.serviceSetLayers(payload));
13907
14416
  }, [dispatch]);
13908
-
13909
- var checkIfUserAddedService = function checkIfUserAddedService(service) {
13910
- return !!service.isUserAddedService;
13911
- };
13912
-
13913
14417
  React.useEffect(function () {
13914
14418
  if (isOpenInStore && preloadedServices && preloadedServices.length > 0) {
13915
14419
  mergePresetsAndUserAddedServices(preloadedServices, getUserAddedServices()).forEach(function (service) {
@@ -13921,7 +14425,7 @@ var useFetchServices = function useFetchServices(dialogType) {
13921
14425
  name: service.name,
13922
14426
  serviceUrl: service.url,
13923
14427
  layers: layers,
13924
- isUserAddedService: checkIfUserAddedService(service),
14428
+ scope: service.scope ? service.scope : 'system',
13925
14429
  // first try to load the user abstract, otherwise the service abstract
13926
14430
  "abstract": service["abstract"] || wmService["abstract"]
13927
14431
  });
@@ -13956,7 +14460,7 @@ var mergePresetsAndUserAddedServices = function mergePresetsAndUserAddedServices
13956
14460
  * Copyright 2021 - Koninklijk Nederlands Meteorologisch Instituut (KNMI)
13957
14461
  * Copyright 2021 - Finnish Meteorological Institute (FMI)
13958
14462
  * */
13959
- var dialogType = 'layerManager';
14463
+ var dialogType = DialogTypes.LayerManager;
13960
14464
  /**
13961
14465
  * Layer Managerconnected to the store displaying the layers forthe active map Id
13962
14466
  * Please note that in order to use this and open/close the dialog, every map on the screen that should be able to show
@@ -14117,7 +14621,7 @@ var ZoomControlConnect = function ZoomControlConnect(_ref) {
14117
14621
  }, [mapId]);
14118
14622
 
14119
14623
  var onZoomIn = function onZoomIn() {
14120
- return adagucRef.current.zoomIn();
14624
+ return adagucRef.current.zoomIn(undefined);
14121
14625
  };
14122
14626
 
14123
14627
  var onZoomOut = function onZoomOut() {
@@ -14204,14 +14708,14 @@ var LayerManagerMapButtonConnect = function LayerManagerMapButtonConnect(_ref) {
14204
14708
  source = _ref$source === void 0 ? 'app' : _ref$source;
14205
14709
  var dispatch = useDispatch();
14206
14710
  var currentActiveMapId = useSelector(function (store) {
14207
- return getDialogMapId(store, 'layerManager');
14711
+ return getDialogMapId(store, DialogTypes.LayerManager);
14208
14712
  });
14209
14713
  var isOpenInStore = useSelector(function (store) {
14210
- return getisDialogOpen(store, 'layerManager');
14714
+ return getisDialogOpen(store, DialogTypes.LayerManager);
14211
14715
  });
14212
14716
  var openLayerManagerDialog = React.useCallback(function () {
14213
14717
  dispatch(uiActions.setActiveMapIdForDialog({
14214
- type: 'layerManager',
14718
+ type: DialogTypes.LayerManager,
14215
14719
  mapId: mapId,
14216
14720
  setOpen: currentActiveMapId !== mapId ? true : !isOpenInStore,
14217
14721
  source: source
@@ -14327,7 +14831,7 @@ var DimensionSelectSlider = function DimensionSelectSlider(_ref) {
14327
14831
  }
14328
14832
 
14329
14833
  var sortedMarks = _toConsumableArray(marks).sort(function (a, b) {
14330
- return typeof a.value === 'number' && typeof b.value === 'number' && a.value - b.value;
14834
+ return Number(typeof a.value === 'number' && typeof b.value === 'number' && a.value - b.value);
14331
14835
  });
14332
14836
 
14333
14837
  var adaptedMarks = reverse ? sortedMarks.reverse() : sortedMarks;
@@ -14815,9 +15319,7 @@ var titleOff = 'Auto update off';
14815
15319
 
14816
15320
  var AutoUpdateButton = function AutoUpdateButton(_ref) {
14817
15321
  var _ref$toggleAutoUpdate = _ref.toggleAutoUpdate,
14818
- toggleAutoUpdate = _ref$toggleAutoUpdate === void 0 ? function () {
14819
- return null;
14820
- } : _ref$toggleAutoUpdate,
15322
+ toggleAutoUpdate = _ref$toggleAutoUpdate === void 0 ? function () {} : _ref$toggleAutoUpdate,
14821
15323
  _ref$isAutoUpdating = _ref.isAutoUpdating,
14822
15324
  isAutoUpdating = _ref$isAutoUpdating === void 0 ? false : _ref$isAutoUpdating,
14823
15325
  _ref$disabled = _ref.disabled,
@@ -15074,9 +15576,7 @@ var TimeStepButton = function TimeStepButton(_ref) {
15074
15576
  timeDimension = _ref.timeDimension,
15075
15577
  onChangeTimeStep = _ref.onChangeTimeStep,
15076
15578
  _ref$onToggleTimestep = _ref.onToggleTimestepAuto,
15077
- onToggleTimestepAuto = _ref$onToggleTimestep === void 0 ? function () {
15078
- return null;
15079
- } : _ref$onToggleTimestep,
15579
+ onToggleTimestepAuto = _ref$onToggleTimestep === void 0 ? function () {} : _ref$onToggleTimestep,
15080
15580
  _ref$isOpenByDefault = _ref.isOpenByDefault,
15081
15581
  isOpenByDefault = _ref$isOpenByDefault === void 0 ? false : _ref$isOpenByDefault;
15082
15582
  var timeStepFromLayer = getActiveLayerTimeStep(timeDimension) || timeStep;
@@ -15107,83 +15607,246 @@ var TimeStepButton = function TimeStepButton(_ref) {
15107
15607
  });
15108
15608
  };
15109
15609
 
15110
- var OptionsPopOver = styled(Popover)(function (_ref) {
15111
- var theme = _ref.theme;
15112
- return {
15113
- '& .MuiPaper-root': {
15114
- padding: '5px',
15115
- overflow: 'visible',
15116
- backgroundColor: theme.palette.geowebColors.background.surface
15117
- }
15118
- };
15610
+ /* *
15611
+ * Licensed under the Apache License, Version 2.0 (the "License");
15612
+ * you may not use this file except in compliance with the License.
15613
+ * You may obtain a copy of the License at
15614
+ *
15615
+ * http://www.apache.org/licenses/LICENSE-2.0
15616
+ *
15617
+ * Unless required by applicable law or agreed to in writing, software
15618
+ * distributed under the License is distributed on an "AS IS" BASIS,
15619
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15620
+ * See the License for the specific language governing permissions and
15621
+ * limitations under the License.
15622
+ *
15623
+ * Copyright 2022 - Koninklijk Nederlands Meteorologisch Instituut (KNMI)
15624
+ * Copyright 2022 - Finnish Meteorological Institute (FMI)
15625
+ * */
15626
+ var marks = [{
15627
+ label: '5 min',
15628
+ value: Scale.Minutes5,
15629
+ text: '5m'
15630
+ }, {
15631
+ label: '1 h',
15632
+ value: Scale.Hour,
15633
+ text: '1h'
15634
+ }, {
15635
+ label: '3 h',
15636
+ value: Scale.Hours3,
15637
+ text: '3h'
15638
+ }, {
15639
+ label: '6 h',
15640
+ value: Scale.Hours6,
15641
+ text: '6h'
15642
+ }, {
15643
+ label: 'day',
15644
+ value: Scale.Day,
15645
+ text: 'd'
15646
+ }, {
15647
+ label: 'week',
15648
+ value: Scale.Week,
15649
+ text: 'w'
15650
+ }, {
15651
+ label: 'month',
15652
+ value: Scale.Month,
15653
+ text: 'm'
15654
+ }, {
15655
+ label: 'year',
15656
+ value: Scale.Year,
15657
+ text: 'y'
15658
+ }, {
15659
+ label: 'data',
15660
+ value: Scale.DataScale,
15661
+ text: 'data'
15662
+ }].sort(function (a, b) {
15663
+ return b.value - a.value;
15119
15664
  });
15665
+ var TimeScaleButton = function TimeScaleButton(_ref) {
15666
+ var layers = _ref.layers,
15667
+ _ref$timeSliderScale = _ref.timeSliderScale,
15668
+ timeSliderScale = _ref$timeSliderScale === void 0 ? Scale.Hour : _ref$timeSliderScale,
15669
+ centerTime = _ref.centerTime,
15670
+ secondsPerPx = _ref.secondsPerPx,
15671
+ selectedTime = _ref.selectedTime,
15672
+ onChangeTimeSliderScale = _ref.onChangeTimeSliderScale;
15120
15673
 
15121
- var OptionsMenuButton = function OptionsMenuButton(_ref2) {
15122
- var autoUpdateBtn = _ref2.autoUpdateBtn,
15123
- speedBtn = _ref2.speedBtn,
15124
- timeStepBtn = _ref2.timeStepBtn;
15674
+ var onChangeSliderValue = function onChangeSliderValue(mark) {
15675
+ var newSliderValue = mark.value;
15676
+ var newValue = newSliderValue ? Math.round(newSliderValue) : 0;
15677
+ var newScale = marks.find(function (el) {
15678
+ return el.value === newValue;
15679
+ }).value;
15680
+ var scaleToSecPerPx = newScale === Scale.DataScale ? getScaleToSecondsPerPxForDataScale(layers) : scaleToSecondsPerPx[newScale];
15681
+ var newCenterTime = getNewCenterOfFixedPointZoom(selectedTime, secondsPerPx, scaleToSecPerPx, centerTime);
15682
+ onChangeTimeSliderScale(newScale, newCenterTime, scaleToSecPerPx);
15683
+ };
15125
15684
 
15126
- var _React$useState = React.useState(null),
15127
- _React$useState2 = _slicedToArray(_React$useState, 2),
15128
- anchorEl = _React$useState2[0],
15129
- setAnchorEl = _React$useState2[1];
15685
+ return /*#__PURE__*/React.createElement(TimeSliderMenu, {
15686
+ handleMenuItemClick: onChangeSliderValue,
15687
+ icon: /*#__PURE__*/React.createElement(Clock, null),
15688
+ marks: marks,
15689
+ title: "Time scale",
15690
+ value: timeSliderScale
15691
+ });
15692
+ };
15130
15693
 
15131
- var onClickButton = function onClickButton(event) {
15132
- setAnchorEl(event.currentTarget);
15133
- };
15694
+ /* *
15695
+ * Licensed under the Apache License, Version 2.0 (the "License");
15696
+ * you may not use this file except in compliance with the License.
15697
+ * You may obtain a copy of the License at
15698
+ *
15699
+ * http://www.apache.org/licenses/LICENSE-2.0
15700
+ *
15701
+ * Unless required by applicable law or agreed to in writing, software
15702
+ * distributed under the License is distributed on an "AS IS" BASIS,
15703
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15704
+ * See the License for the specific language governing permissions and
15705
+ * limitations under the License.
15706
+ *
15707
+ * Copyright 2022 - Koninklijk Nederlands Meteorologisch Instituut (KNMI)
15708
+ * Copyright 2022 - Finnish Meteorological Institute (FMI)
15709
+ * */
15710
+ var title = 'Now';
15134
15711
 
15135
- var handleClose = function handleClose() {
15136
- setAnchorEl(null);
15137
- };
15712
+ var NowButton = function NowButton(_ref) {
15713
+ var _ref$onSetNow = _ref.onSetNow,
15714
+ onSetNow = _ref$onSetNow === void 0 ? function () {} : _ref$onSetNow,
15715
+ _ref$disabled = _ref.disabled,
15716
+ disabled = _ref$disabled === void 0 ? false : _ref$disabled;
15717
+ return /*#__PURE__*/React.createElement(Tooltip, {
15718
+ title: title,
15719
+ "data-testid": "nowButtonTooltip"
15720
+ }, /*#__PURE__*/React.createElement("span", null, /*#__PURE__*/React.createElement(ToolButton, {
15721
+ disabled: disabled,
15722
+ onClick: function onClick() {
15723
+ return onSetNow();
15724
+ },
15725
+ "aria-label": "now"
15726
+ }, /*#__PURE__*/React.createElement(Now, {
15727
+ "data-testid": "now-svg"
15728
+ }))));
15729
+ };
15730
+
15731
+ var OptionsMenuButton = function OptionsMenuButton(_ref) {
15732
+ var nowBtn = _ref.nowBtn,
15733
+ autoUpdateBtn = _ref.autoUpdateBtn,
15734
+ speedBtn = _ref.speedBtn,
15735
+ timeStepBtn = _ref.timeStepBtn,
15736
+ timeScaleBtn = _ref.timeScaleBtn,
15737
+ _ref$isOpenByDefault = _ref.isOpenByDefault,
15738
+ isOpenByDefault = _ref$isOpenByDefault === void 0 ? false : _ref$isOpenByDefault;
15739
+
15740
+ var _useState = useState(null),
15741
+ _useState2 = _slicedToArray(_useState, 2),
15742
+ anchorEl = _useState2[0],
15743
+ setAnchorEl = _useState2[1];
15744
+
15745
+ var _useState3 = useState(false),
15746
+ _useState4 = _slicedToArray(_useState3, 2),
15747
+ open = _useState4[0],
15748
+ setOpen = _useState4[1];
15138
15749
 
15139
- var open = Boolean(anchorEl);
15140
- var id = open ? 'simple-popover' : undefined;
15141
- return /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement(Tooltip, {
15750
+ useEffect(function () {
15751
+ if (anchorEl && isOpenByDefault) {
15752
+ setOpen(true);
15753
+ }
15754
+ }, [anchorEl, isOpenByDefault]);
15755
+ return /*#__PURE__*/React__default.createElement("div", null, /*#__PURE__*/React__default.createElement(Tooltip, {
15142
15756
  title: "Animation options",
15143
15757
  placement: "bottom"
15144
- }, /*#__PURE__*/React.createElement("span", null, /*#__PURE__*/React.createElement(ToolButton, {
15145
- onClick: onClickButton,
15758
+ }, /*#__PURE__*/React__default.createElement("span", {
15759
+ ref: function ref(_ref2) {
15760
+ setAnchorEl(_ref2);
15761
+ }
15762
+ }, /*#__PURE__*/React__default.createElement(ToolButton, {
15763
+ onClick: function onClick() {
15764
+ setOpen(!open);
15765
+ },
15146
15766
  "data-testid": "optionsMenuButton",
15147
- active: open
15148
- }, /*#__PURE__*/React.createElement(Options, {
15149
- "data-testid": "optionsIcon"
15150
- })))), /*#__PURE__*/React.createElement(OptionsPopOver, {
15151
- id: id,
15767
+ active: open,
15768
+ "aria-label": "animation options"
15769
+ }, /*#__PURE__*/React__default.createElement(Options, null)))), /*#__PURE__*/React__default.createElement(Popper, {
15770
+ sx: {
15771
+ zIndex: 3
15772
+ },
15773
+ placement: "top-start",
15152
15774
  open: open,
15153
15775
  "data-testid": "optionsMenuPopOver",
15154
- anchorEl: anchorEl,
15155
- onClose: handleClose,
15156
- anchorOrigin: {
15157
- vertical: -5,
15158
- horizontal: 'left'
15776
+ anchorEl: anchorEl
15777
+ }, /*#__PURE__*/React__default.createElement(Paper, {
15778
+ elevation: 3
15779
+ }, /*#__PURE__*/React__default.createElement(Grid, {
15780
+ sx: {
15781
+ padding: '0px 10px 10px'
15159
15782
  },
15160
- transformOrigin: {
15161
- vertical: 'bottom',
15162
- horizontal: 'left'
15163
- }
15164
- }, /*#__PURE__*/React.createElement(Grid, {
15165
15783
  container: true,
15166
15784
  spacing: 1
15167
- }, /*#__PURE__*/React.createElement(Grid, {
15785
+ }, /*#__PURE__*/React__default.createElement(Grid, {
15786
+ item: true,
15787
+ xs: "auto"
15788
+ }, nowBtn || /*#__PURE__*/React__default.createElement(NowButton, null)), /*#__PURE__*/React__default.createElement(Grid, {
15168
15789
  item: true,
15169
15790
  xs: "auto"
15170
- }, timeStepBtn || /*#__PURE__*/React.createElement(TimeStepButton, {
15791
+ }, timeScaleBtn || /*#__PURE__*/React__default.createElement(TimeScaleButton, {
15792
+ centerTime: 0,
15793
+ onChangeTimeSliderScale: function onChangeTimeSliderScale() {},
15794
+ secondsPerPx: 0,
15795
+ selectedTime: 0,
15796
+ timeSliderScale: 0
15797
+ })), /*#__PURE__*/React__default.createElement(Grid, {
15798
+ item: true,
15799
+ xs: "auto"
15800
+ }, timeStepBtn || /*#__PURE__*/React__default.createElement(TimeStepButton, {
15171
15801
  timeStep: 0,
15172
- onChangeTimeStep: function onChangeTimeStep() {
15173
- return null;
15174
- }
15175
- })), /*#__PURE__*/React.createElement(Grid, {
15802
+ onChangeTimeStep: function onChangeTimeStep() {}
15803
+ })), /*#__PURE__*/React__default.createElement(Grid, {
15176
15804
  item: true,
15177
15805
  xs: "auto"
15178
- }, speedBtn || /*#__PURE__*/React.createElement(SpeedButton, {
15806
+ }, speedBtn || /*#__PURE__*/React__default.createElement(SpeedButton, {
15179
15807
  animationDelay: defaultAnimationDelayAtStart,
15180
- setMapAnimationDelay: function setMapAnimationDelay() {
15181
- return null;
15182
- }
15183
- })), /*#__PURE__*/React.createElement(Grid, {
15808
+ setMapAnimationDelay: function setMapAnimationDelay() {}
15809
+ })), /*#__PURE__*/React__default.createElement(Grid, {
15184
15810
  item: true,
15185
15811
  xs: "auto"
15186
- }, autoUpdateBtn || /*#__PURE__*/React.createElement(AutoUpdateButton, null)))));
15812
+ }, autoUpdateBtn || /*#__PURE__*/React__default.createElement(AutoUpdateButton, null))))));
15813
+ };
15814
+
15815
+ /* *
15816
+ * Licensed under the Apache License, Version 2.0 (the "License");
15817
+ * you may not use this file except in compliance with the License.
15818
+ * You may obtain a copy of the License at
15819
+ *
15820
+ * http://www.apache.org/licenses/LICENSE-2.0
15821
+ *
15822
+ * Unless required by applicable law or agreed to in writing, software
15823
+ * distributed under the License is distributed on an "AS IS" BASIS,
15824
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15825
+ * See the License for the specific language governing permissions and
15826
+ * limitations under the License.
15827
+ *
15828
+ * Copyright 2022 - Koninklijk Nederlands Meteorologisch Instituut (KNMI)
15829
+ * Copyright 2022 - Finnish Meteorological Institute (FMI)
15830
+ * */
15831
+ var forwardTooltipTitle = 'Forward';
15832
+ var backwardTooltipTitle = 'Backward';
15833
+
15834
+ var BackwardForwardStepButton = function BackwardForwardStepButton(_ref) {
15835
+ var isForwardStep = _ref.isForwardStep,
15836
+ isDisabled = _ref.isDisabled,
15837
+ _ref$onClickBFButton = _ref.onClickBFButton,
15838
+ onClickBFButton = _ref$onClickBFButton === void 0 ? function () {} : _ref$onClickBFButton;
15839
+ return /*#__PURE__*/React.createElement(Tooltip, {
15840
+ title: isForwardStep ? forwardTooltipTitle : backwardTooltipTitle
15841
+ }, /*#__PURE__*/React.createElement("span", null, /*#__PURE__*/React.createElement(ToolButton, {
15842
+ disabled: isDisabled,
15843
+ "aria-label": isForwardStep ? 'forward' : 'backward',
15844
+ onClick: onClickBFButton
15845
+ }, isForwardStep ? /*#__PURE__*/React.createElement(StepForward, {
15846
+ "data-testid": "step-forward-svg-path"
15847
+ }) : /*#__PURE__*/React.createElement(StepBackward, {
15848
+ "data-testid": "step-backward-svg-path"
15849
+ }))));
15187
15850
  };
15188
15851
 
15189
15852
  /* *
@@ -15205,19 +15868,28 @@ var OptionsMenuButton = function OptionsMenuButton(_ref2) {
15205
15868
 
15206
15869
  var TimeSliderButtons = function TimeSliderButtons(_ref) {
15207
15870
  var optionsMenuBtn = _ref.optionsMenuBtn,
15208
- playBtn = _ref.playBtn;
15871
+ playBtn = _ref.playBtn,
15872
+ backwardBtn = _ref.backwardBtn,
15873
+ forwardBtn = _ref.forwardBtn;
15209
15874
  return /*#__PURE__*/React.createElement("div", {
15210
15875
  "data-testid": "timeSliderButtons"
15211
15876
  }, /*#__PURE__*/React.createElement(Grid, {
15212
15877
  container: true,
15213
- spacing: 2,
15214
- sx: {
15215
- padding: '20px 0px 0px 16px'
15216
- }
15878
+ spacing: 0.5,
15879
+ alignItems: "center",
15880
+ justifyContent: "center"
15217
15881
  }, /*#__PURE__*/React.createElement(Grid, {
15218
15882
  item: true
15219
15883
  }, optionsMenuBtn || /*#__PURE__*/React.createElement(OptionsMenuButton, null)), /*#__PURE__*/React.createElement(Grid, {
15220
15884
  item: true
15885
+ }, backwardBtn || /*#__PURE__*/React.createElement(BackwardForwardStepButton, {
15886
+ isForwardStep: false
15887
+ })), /*#__PURE__*/React.createElement(Grid, {
15888
+ item: true
15889
+ }, forwardBtn || /*#__PURE__*/React.createElement(BackwardForwardStepButton, {
15890
+ isForwardStep: true
15891
+ })), /*#__PURE__*/React.createElement(Grid, {
15892
+ item: true
15221
15893
  }, playBtn || /*#__PURE__*/React.createElement(PlayButton, null))));
15222
15894
  };
15223
15895
 
@@ -15766,13 +16438,30 @@ var isColorIntervalEven = function isColorIntervalEven(scale, timestep) {
15766
16438
  }
15767
16439
  };
15768
16440
 
15769
- var drawBackground = function drawBackground(context, theme, visibleTimeStart, visibleTimeEnd, animationStartPx, animationEndPx, canvasWidth, height, scale) {
16441
+ var drawBackground = function drawBackground(context, theme, visibleTimeStart, visibleTimeEnd, animationStartPx, animationEndPx, canvasWidth, height, scale, dataStartPx, dataEndPx, currentTimePx) {
15770
16442
  var ctx = context;
15771
16443
  var _theme$palette$geoweb7 = theme.palette.geowebColors.timeSlider,
15772
- timelineTimelineSurface = _theme$palette$geoweb7.timelineTimelineSurface,
15773
- timelineNightTime = _theme$palette$geoweb7.timelineNightTime;
15774
- ctx.fillStyle = timelineTimelineSurface.fill;
15775
- ctx.fillRect(0, 0, canvasWidth, height);
16444
+ timelineNightTime = _theme$palette$geoweb7.timelineNightTime,
16445
+ ledgendObservedBackground = _theme$palette$geoweb7.ledgendObservedBackground,
16446
+ legendForecastBackground = _theme$palette$geoweb7.legendForecastBackground,
16447
+ legendNoDataBackground = _theme$palette$geoweb7.legendNoDataBackground; // top spacing
16448
+
16449
+ var y = 0;
16450
+ ctx.fillStyle = legendNoDataBackground.rgba;
16451
+ ctx.fillRect(0, y, canvasWidth, height); // observed data
16452
+
16453
+ if (dataStartPx < currentTimePx) {
16454
+ ctx.fillStyle = ledgendObservedBackground.fill;
16455
+ ctx.fillRect(Math.max(dataStartPx, 0), y, Math.min(currentTimePx, dataEndPx) - Math.max(dataStartPx, 0), height);
16456
+ } // forecast data
16457
+
16458
+
16459
+ if (dataEndPx > currentTimePx) {
16460
+ ctx.fillStyle = legendForecastBackground.fill;
16461
+ ctx.fillRect(Math.max(currentTimePx, dataStartPx), y, Math.min(canvasWidth, dataEndPx) - Math.max(currentTimePx, dataStartPx), height);
16462
+ } // hovered area
16463
+
16464
+
15776
16465
  ctx.fillStyle = theme.palette.geowebColors.timeSlider.timelineSelectionBackground.rgba;
15777
16466
  ctx.fillRect(animationStartPx, 0, Math.max(animationEndPx - animationStartPx, 0), height);
15778
16467
  var colorChangeUnit = getColorChangeTimestepUnit(scale);
@@ -15873,7 +16562,7 @@ var drawTimeScale = function drawTimeScale(context, theme, visibleTimeStart, vis
15873
16562
  drawLeftSideDateText(ctx, theme, dateText, height);
15874
16563
  };
15875
16564
 
15876
- var renderTimeSliderLegend = function renderTimeSliderLegend(context, theme, canvasWidth, height, centerTime, secondsPerPx, dataScaleToSecondsPerPx, selectedTimeUnix, scale, currentTimeUnix, animationStartTime, animationEndTime) {
16565
+ var renderTimeSliderLegend = function renderTimeSliderLegend(context, theme, canvasWidth, height, centerTime, secondsPerPx, dataScaleToSecondsPerPx, selectedTimeUnix, scale, currentTimeUnix, animationStartTime, animationEndTime, dataStartTime, dataEndTime) {
15877
16566
  var ctx = context;
15878
16567
 
15879
16568
  var _map3 = [0, canvasWidth].map(function (px) {
@@ -15883,14 +16572,18 @@ var renderTimeSliderLegend = function renderTimeSliderLegend(context, theme, can
15883
16572
  visibleTimeStart = _map4[0],
15884
16573
  visibleTimeEnd = _map4[1];
15885
16574
 
15886
- var _map5 = [animationStartTime, animationEndTime].map(function (time) {
16575
+ var _map5 = [animationStartTime, animationEndTime, dataStartTime, dataEndTime, currentTimeUnix].map(function (time) {
15887
16576
  return timestampToPixel(time, centerTime, canvasWidth, secondsPerPx);
15888
16577
  }),
15889
- _map6 = _slicedToArray(_map5, 2),
16578
+ _map6 = _slicedToArray(_map5, 5),
15890
16579
  animationStartPx = _map6[0],
15891
- animationEndPx = _map6[1];
16580
+ animationEndPx = _map6[1],
16581
+ dataStartPx = _map6[2],
16582
+ dataEndPx = _map6[3],
16583
+ currentTimePx = _map6[4];
15892
16584
 
15893
- drawBackground(ctx, theme, visibleTimeStart, visibleTimeEnd, animationStartPx, animationEndPx, canvasWidth, height, scale);
16585
+ ctx.clearRect(0, 0, canvasWidth, height);
16586
+ drawBackground(ctx, theme, visibleTimeStart, visibleTimeEnd, animationStartPx, animationEndPx, canvasWidth, height, scale, dataStartPx, dataEndPx, currentTimePx);
15894
16587
  drawTimeScale(ctx, theme, visibleTimeStart, visibleTimeEnd, canvasWidth, height, scale, dataScaleToSecondsPerPx);
15895
16588
  drawNeedle(ctx, theme, canvasWidth, height, visibleTimeStart, visibleTimeEnd, selectedTimeUnix);
15896
16589
  drawCurrentTime(ctx, theme, canvasWidth, height, visibleTimeStart, visibleTimeEnd, currentTimeUnix);
@@ -15971,19 +16664,7 @@ var TimeSliderLegend = function TimeSliderLegend(_ref) {
15971
16664
  React.useEffect(function () {
15972
16665
  var handleKeyDown = function handleKeyDown(event) {
15973
16666
  if (event.key === 'Home' && mapIsActive) {
15974
- if (dataStartTime < dataEndTime) {
15975
- if (dataEndTime < currentTime) {
15976
- onSetNewDate(moment.utc(dataEndTime * 1000).toISOString());
15977
- onSetCenterTime(dataEndTime);
15978
- } else if (dataStartTime > currentTime) {
15979
- onSetNewDate(moment.utc(dataStartTime * 1000).toISOString());
15980
- onSetCenterTime(dataStartTime);
15981
- } else {
15982
- var closestToCurrent = roundWithTimeStep(currentTime, timeStep);
15983
- onSetNewDate(moment.utc(closestToCurrent * 1000).toISOString());
15984
- onSetCenterTime(closestToCurrent);
15985
- }
15986
- }
16667
+ handleSetNowEvent(timeStep, dataStartTime, dataEndTime, currentTime, onSetNewDate, onSetCenterTime);
15987
16668
  }
15988
16669
  };
15989
16670
 
@@ -16015,7 +16696,9 @@ var TimeSliderLegend = function TimeSliderLegend(_ref) {
16015
16696
  return /*#__PURE__*/React.createElement(Box, {
16016
16697
  "data-testid": "timeSliderLegend",
16017
16698
  sx: {
16018
- height: '50px'
16699
+ height: "".concat(TIME_SLIDER_LEGEND_HEIGHT, "px"),
16700
+ borderRadius: '4.5px',
16701
+ overflow: 'hidden'
16019
16702
  }
16020
16703
  }, /*#__PURE__*/React.createElement(CanvasComponent, {
16021
16704
  ref: node,
@@ -16067,236 +16750,12 @@ var TimeSliderLegend = function TimeSliderLegend(_ref) {
16067
16750
  }
16068
16751
  },
16069
16752
  onRenderCanvas: function onRenderCanvas(ctx, width, height) {
16070
- renderTimeSliderLegend(ctx, theme, width, height, centerTime, secondsPerPx, dataScaleToSecondsPerPx, selectedTime, scale, currentTime, localAnimationStartTime, localAnimationEndTime);
16753
+ renderTimeSliderLegend(ctx, theme, width, height, centerTime, secondsPerPx, dataScaleToSecondsPerPx, selectedTime, scale, currentTime, localAnimationStartTime, localAnimationEndTime, dataStartTime, dataEndTime);
16071
16754
  }
16072
16755
  }));
16073
16756
  };
16074
16757
 
16075
- /* *
16076
- * Licensed under the Apache License, Version 2.0 (the "License");
16077
- * you may not use this file except in compliance with the License.
16078
- * You may obtain a copy of the License at
16079
- *
16080
- * http://www.apache.org/licenses/LICENSE-2.0
16081
- *
16082
- * Unless required by applicable law or agreed to in writing, software
16083
- * distributed under the License is distributed on an "AS IS" BASIS,
16084
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16085
- * See the License for the specific language governing permissions and
16086
- * limitations under the License.
16087
- *
16088
- * Copyright 2022 - Koninklijk Nederlands Meteorologisch Instituut (KNMI)
16089
- * Copyright 2022 - Finnish Meteorological Institute (FMI)
16090
- * */
16091
- var scaleSliderOtherSettings = {
16092
- LEFT_PADDING: '10%'
16093
- };
16094
-
16095
- var thumbComponent = function thumbComponent(props) {
16096
- var children = props.children,
16097
- other = __rest(props, ["children"]);
16098
-
16099
- return /*#__PURE__*/React.createElement(SliderThumb, Object.assign({}, other, {
16100
- "data-testid": "scaleSliderSliderThumb",
16101
- tabIndex: 0
16102
- }), children, /*#__PURE__*/React.createElement(SliderThumb$1, null));
16103
- };
16104
-
16105
- var marks = [{
16106
- text: '5 min scale',
16107
- paddingLeft: '2px',
16108
- value: Scale.Minutes5
16109
- }, {
16110
- text: '1 h scale',
16111
- paddingLeft: '25px',
16112
- value: Scale.Hour
16113
- }, {
16114
- text: '3 h scale',
16115
- paddingLeft: '45px',
16116
- value: Scale.Hours3
16117
- }, {
16118
- text: '6 h scale',
16119
- paddingLeft: '65px',
16120
- value: Scale.Hours6
16121
- }, {
16122
- text: 'day scale',
16123
- paddingLeft: '80px',
16124
- value: Scale.Day
16125
- }, {
16126
- text: 'week scale',
16127
- paddingLeft: '92px',
16128
- value: Scale.Week
16129
- }, {
16130
- text: 'month scale',
16131
- paddingLeft: '107px',
16132
- value: Scale.Month
16133
- }, {
16134
- text: 'year scale',
16135
- paddingLeft: '130px',
16136
- value: Scale.Year
16137
- }, {
16138
- text: 'data scale',
16139
- paddingLeft: '140px',
16140
- value: Scale.DataScale
16141
- }];
16142
-
16143
- var valueLabelFormat = function valueLabelFormat(value) {
16144
- var valueNew = value.toString();
16145
- return valueNew;
16146
- };
16147
-
16148
- var GeoWebScaleSlider = styled(Slider)(function (_ref) {
16149
- var theme = _ref.theme;
16150
- return {
16151
- '&.MuiSlider-root': {
16152
- height: 4,
16153
- width: 167,
16154
- margin: "0 0 18px ".concat(scaleSliderOtherSettings.LEFT_PADDING)
16155
- },
16156
- '& .MuiSlider-thumb': {
16157
- backgroundColor: 'rgba(0,0,0,0)',
16158
- marginTop: 0,
16159
- width: 12,
16160
- height: 12,
16161
- color: theme.palette.geowebColors.timeSlider.timeScalePointer.fill,
16162
- '& svg polygon': {
16163
- filter: theme.palette.geowebColors.timeSlider.timeScaleShadowButtonScale.filter
16164
- },
16165
- '&:before': {
16166
- display: 'none'
16167
- }
16168
- },
16169
- '& .MuiSlider-valueLabel': {
16170
- left: '20px'
16171
- },
16172
- '& .MuiSlider-rail': {
16173
- color: theme.palette.geowebColors.timeSlider.timeScaleHorizontalScale.fill,
16174
- height: 4,
16175
- width: 170,
16176
- borderRadius: 4.5,
16177
- opacity: theme.palette.geowebColors.timeSlider.timeScaleHorizontalScale.opacity
16178
- },
16179
- '& .MuiSlider-mark': {
16180
- backgroundColor: theme.palette.geowebColors.timeSlider.timeScaleTimeIndicators.fill,
16181
- height: 6,
16182
- width: 2,
16183
- marginTop: -9,
16184
- '&.MuiSlider-markActive': {
16185
- backgroundColor: theme.palette.geowebColors.timeSlider.timeScaleTimeIndicatorsActive.fill,
16186
- height: 6,
16187
- width: 2,
16188
- marginTop: -9
16189
- }
16190
- },
16191
- '@media (max-width: 585px)': {
16192
- '&.MuiSlider-root': {
16193
- width: 110
16194
- },
16195
- '& .MuiSlider-rail': {
16196
- width: 110
16197
- }
16198
- },
16199
- '@media (max-width: 395px)': {
16200
- '&.MuiSlider-root': {
16201
- width: 60
16202
- },
16203
- '& .MuiSlider-rail': {
16204
- width: 60
16205
- }
16206
- }
16207
- };
16208
- });
16209
- var RAIL_GUTTER_OFFSET = 0.4;
16210
-
16211
- var TimeSliderScaleSlider = function TimeSliderScaleSlider(_ref2) {
16212
- var layers = _ref2.layers,
16213
- _ref2$timeSliderScale = _ref2.timeSliderScale,
16214
- timeSliderScale = _ref2$timeSliderScale === void 0 ? Scale.Hour : _ref2$timeSliderScale,
16215
- centerTime = _ref2.centerTime,
16216
- secondsPerPx = _ref2.secondsPerPx,
16217
- selectedTime = _ref2.selectedTime,
16218
- onChangeTimeSliderScale = _ref2.onChangeTimeSliderScale;
16219
- var min = 0;
16220
- var max = marks.length - 1;
16221
- var value = marks.findIndex(function (mark) {
16222
- return mark.value === timeSliderScale;
16223
- });
16224
-
16225
- var onChangeSliderValue = function onChangeSliderValue(newSliderValue) {
16226
- var newValue = newSliderValue ? Math.round(newSliderValue) : 0;
16227
- var newScale = marks.find(function (el) {
16228
- return el.value === newValue;
16229
- }).value;
16230
- var scaleToSecPerPx = newScale === Scale.DataScale ? getScaleToSecondsPerPxForDataScale(layers) : scaleToSecondsPerPx[newScale];
16231
- var newCenterTime = getNewCenterOfFixedPointZoom(selectedTime, secondsPerPx, scaleToSecPerPx, centerTime);
16232
- onChangeTimeSliderScale(newScale, newCenterTime, scaleToSecPerPx);
16233
- };
16234
-
16235
- var onChange = function onChange(event, value) {
16236
- if (event.type !== 'keydown') {
16237
- onChangeSliderValue(value);
16238
- }
16239
- };
16240
-
16241
- var onKeyDown = function onKeyDown(event) {
16242
- // disable default Slider behavior
16243
- event.preventDefault();
16244
- event.stopPropagation(); // custom logic
16245
-
16246
- var newValue = getValueFromKeyboardEvent(event, value, min, max, true);
16247
-
16248
- if (newValue !== null) {
16249
- onChangeSliderValue(newValue);
16250
- }
16251
- };
16252
-
16253
- var _marks$find = marks.find(function (mark) {
16254
- return mark.value === value;
16255
- }),
16256
- paddingLeft = _marks$find.paddingLeft,
16257
- text = _marks$find.text;
16258
-
16259
- var scaleTextPadding = {
16260
- paddingLeft: paddingLeft
16261
- };
16262
- return /*#__PURE__*/React.createElement(Box, {
16263
- "data-testid": "scaleSlider",
16264
- sx: {
16265
- backgroundColor: 'geowebColors.background.surface',
16266
- width: '229px',
16267
- height: '40px',
16268
- paddingTop: '4px',
16269
- paddingBottom: '7px',
16270
- boxSizing: 'content-box'
16271
- }
16272
- }, /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement(Box, {
16273
- "data-testid": "scaleSliderText",
16274
- sx: {
16275
- width: '67px',
16276
- height: '15px',
16277
- padding: '0px 10px 0 8px',
16278
- color: 'geowebColors.typographyAndIcons.text',
16279
- font: '12px Roboto'
16280
- },
16281
- style: scaleTextPadding
16282
- }, text)), /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement(GeoWebScaleSlider, {
16283
- "data-testid": "scaleSliderSlider",
16284
- defaultValue: Scale.Hour,
16285
- value: value,
16286
- min: min - RAIL_GUTTER_OFFSET,
16287
- step: 1,
16288
- max: max + RAIL_GUTTER_OFFSET,
16289
- getAriaValueText: valueLabelFormat,
16290
- onChange: onChange,
16291
- onKeyDown: onKeyDown,
16292
- "aria-labelledby": "scale-slider",
16293
- components: {
16294
- Thumb: thumbComponent
16295
- },
16296
- marks: marks,
16297
- track: false
16298
- })));
16299
- };
16758
+ var TIME_SLIDER_LEGEND_HEIGHT = 24;
16300
16759
 
16301
16760
  /* eslint-disable no-param-reassign */
16302
16761
 
@@ -16488,20 +16947,6 @@ var renderTimeSliderRailWithNeedle = function renderTimeSliderRailWithNeedle(ctx
16488
16947
  drawNewNeedleLabel(ctx, selected, selectedPx, animationStartPx, animationEndPx, scale, theme);
16489
16948
  };
16490
16949
 
16491
- var setPreviousTimeStep = function setPreviousTimeStep(timeStep, curTime, dataStartTime, onSetNewDate) {
16492
- var prevTimeStep = moment.utc(curTime).subtract(timeStep, 'm').toISOString();
16493
- if (!prevTimeStep) return;
16494
- if (moment.utc(prevTimeStep) < moment.utc(dataStartTime * 1000)) return;
16495
- onsetNewDateDebounced(prevTimeStep, onSetNewDate);
16496
- };
16497
-
16498
- var setNextTimeStep = function setNextTimeStep(timeStep, curTime, dataEndTime, onSetNewDate) {
16499
- var nextTimeStep = moment.utc(curTime).add(timeStep, 'm').toISOString();
16500
- if (!nextTimeStep) return;
16501
- if (moment.utc(nextTimeStep) > moment.utc(dataEndTime * 1000)) return;
16502
- onsetNewDateDebounced(nextTimeStep, onSetNewDate);
16503
- };
16504
-
16505
16950
  var DRAG_AREA_WIDTH = 10;
16506
16951
  var DRAG_HANDLER_AREA_WIDTH = 30;
16507
16952
 
@@ -16545,12 +16990,12 @@ var TimeSliderRail = function TimeSliderRail(_ref) {
16545
16990
 
16546
16991
  var curTime = selectedTime !== undefined ? selectedTime.toISOString() : moment.utc().toISOString();
16547
16992
 
16548
- var _React$useState = React.useState(animationStartTime && moment.utc(animationStartTime).unix()),
16993
+ var _React$useState = React.useState(animationStartTime ? moment.utc(animationStartTime).unix() : undefined),
16549
16994
  _React$useState2 = _slicedToArray(_React$useState, 2),
16550
16995
  localAnimationStartTime = _React$useState2[0],
16551
16996
  setLocalAnimationStartTime = _React$useState2[1];
16552
16997
 
16553
- var _React$useState3 = React.useState(animationEndTime && moment.utc(animationEndTime).unix()),
16998
+ var _React$useState3 = React.useState(animationEndTime ? moment.utc(animationEndTime).unix() : undefined),
16554
16999
  _React$useState4 = _slicedToArray(_React$useState3, 2),
16555
17000
  localAnimationEndTime = _React$useState4[0],
16556
17001
  setLocalAnimationEndTime = _React$useState4[1];
@@ -16693,8 +17138,8 @@ var TimeSliderRail = function TimeSliderRail(_ref) {
16693
17138
  };
16694
17139
 
16695
17140
  React.useEffect(function () {
16696
- setLocalAnimationStartTime(animationStartTime && moment.utc(animationStartTime).unix());
16697
- setLocalAnimationEndTime(animationEndTime && moment.utc(animationEndTime).unix());
17141
+ setLocalAnimationStartTime(animationStartTime ? moment.utc(animationStartTime).unix() : undefined);
17142
+ setLocalAnimationEndTime(animationEndTime ? moment.utc(animationEndTime).unix() : undefined);
16698
17143
  }, [animationStartTime, animationEndTime]);
16699
17144
  var handleKeyDown = React.useCallback(function (event) {
16700
17145
  if (event.ctrlKey && dataStartTime && dataEndTime && mapIsActive) {
@@ -16801,6 +17246,37 @@ var TimeSliderRail = function TimeSliderRail(_ref) {
16801
17246
  }));
16802
17247
  };
16803
17248
 
17249
+ /* *
17250
+ * Licensed under the Apache License, Version 2.0 (the "License");
17251
+ * you may not use this file except in compliance with the License.
17252
+ * You may obtain a copy of the License at
17253
+ *
17254
+ * http://www.apache.org/licenses/LICENSE-2.0
17255
+ *
17256
+ * Unless required by applicable law or agreed to in writing, software
17257
+ * distributed under the License is distributed on an "AS IS" BASIS,
17258
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17259
+ * See the License for the specific language governing permissions and
17260
+ * limitations under the License.
17261
+ *
17262
+ * Copyright 2022 - Koninklijk Nederlands Meteorologisch Instituut (KNMI)
17263
+ * Copyright 2022 - Finnish Meteorological Institute (FMI)
17264
+ * */
17265
+
17266
+ var HideSliderButton = function HideSliderButton(_ref) {
17267
+ var isVisible = _ref.isVisible,
17268
+ toggleTimeSliderIsVisible = _ref.toggleTimeSliderIsVisible;
17269
+ return /*#__PURE__*/React__default.createElement(Tooltip, {
17270
+ title: isVisible ? 'Hide timeslider' : 'Show timeslider',
17271
+ "data-testid": "autoUpdateButtonTooltip"
17272
+ }, /*#__PURE__*/React__default.createElement("span", null, /*#__PURE__*/React__default.createElement(ToolButton, {
17273
+ onClick: function onClick() {
17274
+ toggleTimeSliderIsVisible(!isVisible);
17275
+ },
17276
+ "data-testid": "hideTimeSliderButton"
17277
+ }, isVisible ? /*#__PURE__*/React__default.createElement(ChevronDown, null) : /*#__PURE__*/React__default.createElement(ChevronUp, null))));
17278
+ };
17279
+
16804
17280
  /* *
16805
17281
  * Licensed under the Apache License, Version 2.0 (the "License");
16806
17282
  * you may not use this file except in compliance with the License.
@@ -16845,7 +17321,6 @@ var defaultProps = {
16845
17321
  var TimeSlider = function TimeSlider(_ref) {
16846
17322
  var buttons = _ref.buttons,
16847
17323
  rail = _ref.rail,
16848
- scaleSlider = _ref.scaleSlider,
16849
17324
  legend = _ref.legend,
16850
17325
  _ref$mapIsActive = _ref.mapIsActive,
16851
17326
  mapIsActive = _ref$mapIsActive === void 0 ? true : _ref$mapIsActive,
@@ -16854,38 +17329,54 @@ var TimeSlider = function TimeSlider(_ref) {
16854
17329
  _ref$onToggleTimeSlid = _ref.onToggleTimeSlider,
16855
17330
  onToggleTimeSlider = _ref$onToggleTimeSlid === void 0 ? function () {} : _ref$onToggleTimeSlid;
16856
17331
  useTimeSliderKeyBoardControl(mapIsActive, isVisible, onToggleTimeSlider);
17332
+ var visibilityState = isVisible ? 'visible' : 'hidden';
16857
17333
  return isVisible ? /*#__PURE__*/React.createElement(Grid, {
17334
+ style: {
17335
+ visibility: visibilityState
17336
+ },
16858
17337
  container: true,
16859
- "data-testid": "timeSlider",
16860
17338
  sx: {
16861
17339
  display: 'grid',
16862
- gridTemplateColumns: 'minmax(100px, 210px) minmax(66%, 1fr)',
16863
- gridTemplateRows: '50px'
16864
- }
17340
+ gridTemplateColumns: 'minmax(100px, 210px) minmax(66%, 1fr) minmax(40px, 40px)',
17341
+ gridTemplateRows: 24,
17342
+ paddingBottom: 1,
17343
+ alignItems: 'center',
17344
+ justifyContent: 'center'
17345
+ },
17346
+ "data-testid": "timeSlider",
17347
+ spacing: 1
16865
17348
  }, /*#__PURE__*/React.createElement(Grid, {
16866
17349
  item: true
16867
- }, " ", buttons || /*#__PURE__*/React.createElement(TimeSliderButtons, null), " "), /*#__PURE__*/React.createElement(Grid, {
17350
+ }), /*#__PURE__*/React.createElement(Grid, {
16868
17351
  item: true
16869
17352
  }, rail || /*#__PURE__*/React.createElement(TimeSliderRail, Object.assign({}, defaultProps, {
16870
17353
  selectedTime: defaultProps.selectedTime,
16871
17354
  mapIsActive: mapIsActive
16872
17355
  })), ' '), /*#__PURE__*/React.createElement(Grid, {
16873
- item: true,
16874
- sx: {
16875
- height: '50px'
16876
- }
16877
- }, scaleSlider || /*#__PURE__*/React.createElement(TimeSliderScaleSlider, Object.assign({}, defaultProps, {
16878
- selectedTime: defaultProps.selectedTime.unix(),
16879
- timeSliderScale: Scale.Hour,
16880
- onChangeTimeSliderScale: function onChangeTimeSliderScale() {
16881
- return null;
16882
- }
16883
- }))), /*#__PURE__*/React.createElement(Grid, {
17356
+ item: true
17357
+ }), /*#__PURE__*/React.createElement(Grid, {
17358
+ item: true
17359
+ }, buttons || /*#__PURE__*/React.createElement(TimeSliderButtons, null)), /*#__PURE__*/React.createElement(Grid, {
16884
17360
  item: true
16885
17361
  }, legend || /*#__PURE__*/React.createElement(TimeSliderLegend, Object.assign({}, defaultProps, {
16886
17362
  selectedTime: defaultProps.selectedTime.unix(),
16887
17363
  mapIsActive: mapIsActive
16888
- })), ' ')) : null;
17364
+ })), ' '), /*#__PURE__*/React.createElement(Grid, {
17365
+ item: true
17366
+ }, /*#__PURE__*/React.createElement(HideSliderButton, {
17367
+ toggleTimeSliderIsVisible: onToggleTimeSlider,
17368
+ isVisible: isVisible
17369
+ }))) : /*#__PURE__*/React.createElement(Grid, {
17370
+ sx: {
17371
+ paddingRight: 1
17372
+ },
17373
+ container: true,
17374
+ alignItems: "center",
17375
+ justifyContent: "flex-end"
17376
+ }, /*#__PURE__*/React.createElement(HideSliderButton, {
17377
+ toggleTimeSliderIsVisible: onToggleTimeSlider,
17378
+ isVisible: isVisible
17379
+ }));
16889
17380
  };
16890
17381
 
16891
17382
  /* *
@@ -16959,74 +17450,190 @@ var SpeedButtonConnect = function SpeedButtonConnect(_ref) {
16959
17450
  var onSetAnimationDelay = function onSetAnimationDelay(animationDelay) {
16960
17451
  dispatch(mapActions$1.setAnimationDelay({
16961
17452
  mapId: mapId,
16962
- animationDelay: animationDelay,
16963
- origin: MapActionOrigin.map
17453
+ animationDelay: animationDelay,
17454
+ origin: MapActionOrigin.map
17455
+ }));
17456
+ };
17457
+
17458
+ return /*#__PURE__*/React.createElement(SpeedButton, {
17459
+ animationDelay: animationDelay,
17460
+ setMapAnimationDelay: onSetAnimationDelay
17461
+ });
17462
+ };
17463
+
17464
+ /* *
17465
+ * Licensed under the Apache License, Version 2.0 (the "License");
17466
+ * you may not use this file except in compliance with the License.
17467
+ * You may obtain a copy of the License at
17468
+ *
17469
+ * http://www.apache.org/licenses/LICENSE-2.0
17470
+ *
17471
+ * Unless required by applicable law or agreed to in writing, software
17472
+ * distributed under the License is distributed on an "AS IS" BASIS,
17473
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17474
+ * See the License for the specific language governing permissions and
17475
+ * limitations under the License.
17476
+ *
17477
+ * Copyright 2020 - Koninklijk Nederlands Meteorologisch Instituut (KNMI)
17478
+ * Copyright 2020 - Finnish Meteorological Institute (FMI)
17479
+ * */
17480
+
17481
+ var TimeStepButtonComponent = function TimeStepButtonComponent(_ref) {
17482
+ var mapId = _ref.mapId;
17483
+ var dispatch = useDispatch();
17484
+ var timeStep = useSelector(function (store) {
17485
+ return getMapTimeStep(store, mapId);
17486
+ });
17487
+ var isAnimating$1 = useSelector(function (store) {
17488
+ return isAnimating(store, mapId);
17489
+ });
17490
+ var isTimestepAuto$1 = useSelector(function (store) {
17491
+ return isTimestepAuto(store, mapId);
17492
+ });
17493
+ var activeLayerId = useSelector(function (store) {
17494
+ return getActiveLayerId(store, mapId);
17495
+ });
17496
+ var activeLayerTimeDimension = useSelector(function (store) {
17497
+ return getLayerTimeDimension(store, activeLayerId);
17498
+ });
17499
+ var onToggleTimestepAuto = React.useCallback(function () {
17500
+ dispatch(mapActions$1.toggleTimestepAuto({
17501
+ mapId: mapId,
17502
+ timestepAuto: !isTimestepAuto$1,
17503
+ origin: MapActionOrigin.map
17504
+ }));
17505
+ }, [dispatch, isTimestepAuto$1, mapId]);
17506
+ var onSetTimeStep = React.useCallback(function (timeStep, origin) {
17507
+ dispatch(mapActions$1.setTimeStep(Object.assign({
17508
+ mapId: mapId,
17509
+ timeStep: timeStep
17510
+ }, origin && {
17511
+ origin: origin
17512
+ })));
17513
+ }, [dispatch, mapId]);
17514
+ return /*#__PURE__*/React.createElement(TimeStepButton, {
17515
+ timeStep: timeStep,
17516
+ onChangeTimeStep: onSetTimeStep,
17517
+ disabled: isAnimating$1,
17518
+ isTimestepAuto: isTimestepAuto$1,
17519
+ onToggleTimestepAuto: onToggleTimestepAuto,
17520
+ timeDimension: activeLayerTimeDimension
17521
+ });
17522
+ };
17523
+
17524
+ /* *
17525
+ * Licensed under the Apache License, Version 2.0 (the "License");
17526
+ * you may not use this file except in compliance with the License.
17527
+ * You may obtain a copy of the License at
17528
+ *
17529
+ * http://www.apache.org/licenses/LICENSE-2.0
17530
+ *
17531
+ * Unless required by applicable law or agreed to in writing, software
17532
+ * distributed under the License is distributed on an "AS IS" BASIS,
17533
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17534
+ * See the License for the specific language governing permissions and
17535
+ * limitations under the License.
17536
+ *
17537
+ * Copyright 2020 - Koninklijk Nederlands Meteorologisch Instituut (KNMI)
17538
+ * Copyright 2020 - Finnish Meteorological Institute (FMI)
17539
+ * */
17540
+ var TimeScaleButtonConnect = function TimeScaleButtonConnect(_ref) {
17541
+ var mapId = _ref.mapId;
17542
+ var layers = useSelector(function (store) {
17543
+ return getMapLayers(store, mapId);
17544
+ });
17545
+ var timeSliderScale = useSelector(function (store) {
17546
+ return getMapTimeSliderScale(store, mapId);
17547
+ });
17548
+ var centerTime = useSelector(function (store) {
17549
+ return getMapTimeSliderCenterTime(store, mapId);
17550
+ });
17551
+ var secondsPerPx = useSelector(function (store) {
17552
+ return getMapTimeSliderSecondsPerPx(store, mapId);
17553
+ });
17554
+ var dimensions = useSelector(function (store) {
17555
+ return getMapDimensions(store, mapId);
17556
+ });
17557
+ var dispatch = useDispatch();
17558
+
17559
+ var onSetTimeSliderScale = function onSetTimeSliderScale(scale, newCenterTime, scaleToSecPerPx) {
17560
+ if (scale === Scale.DataScale) {
17561
+ dispatch(mapActions$1.setTimeSliderDataScaleToSecondsPerPx({
17562
+ mapId: mapId,
17563
+ timeSliderDataScaleToSecondsPerPx: scaleToSecPerPx
17564
+ }));
17565
+ }
17566
+
17567
+ dispatch(mapActions$1.setTimeSliderScale({
17568
+ mapId: mapId,
17569
+ timeSliderScale: scale
17570
+ }));
17571
+ dispatch(mapActions$1.setTimeSliderCenterTime({
17572
+ mapId: mapId,
17573
+ timeSliderCenterTime: newCenterTime
16964
17574
  }));
16965
17575
  };
16966
17576
 
16967
- return /*#__PURE__*/React.createElement(SpeedButton, {
16968
- animationDelay: animationDelay,
16969
- setMapAnimationDelay: onSetAnimationDelay
17577
+ var _getTimeBounds = getTimeBounds(dimensions),
17578
+ selectedTime = _getTimeBounds.selectedTime;
17579
+
17580
+ return /*#__PURE__*/React.createElement(TimeScaleButton, {
17581
+ layers: layers,
17582
+ timeSliderScale: timeSliderScale,
17583
+ onChangeTimeSliderScale: onSetTimeSliderScale,
17584
+ secondsPerPx: secondsPerPx,
17585
+ centerTime: centerTime,
17586
+ selectedTime: selectedTime
16970
17587
  });
16971
17588
  };
16972
17589
 
16973
- /* *
16974
- * Licensed under the Apache License, Version 2.0 (the "License");
16975
- * you may not use this file except in compliance with the License.
16976
- * You may obtain a copy of the License at
16977
- *
16978
- * http://www.apache.org/licenses/LICENSE-2.0
16979
- *
16980
- * Unless required by applicable law or agreed to in writing, software
16981
- * distributed under the License is distributed on an "AS IS" BASIS,
16982
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16983
- * See the License for the specific language governing permissions and
16984
- * limitations under the License.
16985
- *
16986
- * Copyright 2020 - Koninklijk Nederlands Meteorologisch Instituut (KNMI)
16987
- * Copyright 2020 - Finnish Meteorological Institute (FMI)
16988
- * */
16989
-
16990
- var TimeStepButtonComponent = function TimeStepButtonComponent(_ref) {
16991
- var mapId = _ref.mapId;
17590
+ var NowButtonConnect = function NowButtonConnect(_ref) {
17591
+ var sourceId = _ref.sourceId,
17592
+ mapId = _ref.mapId,
17593
+ isDisabled = _ref.isDisabled;
16992
17594
  var dispatch = useDispatch();
17595
+ var currentTime = moment.utc().unix();
16993
17596
  var timeStep = useSelector(function (store) {
16994
17597
  return getMapTimeStep(store, mapId);
16995
17598
  });
17599
+
17600
+ var _getDataLimitsFromLay = getDataLimitsFromLayers(useSelector(function (store) {
17601
+ return getMapLayers(store, mapId);
17602
+ })),
17603
+ _getDataLimitsFromLay2 = _slicedToArray(_getDataLimitsFromLay, 2),
17604
+ dataStartTime = _getDataLimitsFromLay2[0],
17605
+ dataEndTime = _getDataLimitsFromLay2[1];
17606
+
16996
17607
  var isAnimating$1 = useSelector(function (store) {
16997
17608
  return isAnimating(store, mapId);
16998
17609
  });
16999
- var isTimestepAuto$1 = useSelector(function (store) {
17000
- return isTimestepAuto(store, mapId);
17001
- });
17002
- var activeLayerId = useSelector(function (store) {
17003
- return getActiveLayerId(store, mapId);
17004
- });
17005
- var activeLayerTimeDimension = useSelector(function (store) {
17006
- return getLayerTimeDimension(store, activeLayerId);
17007
- });
17008
- var onToggleTimestepAuto = React.useCallback(function () {
17009
- dispatch(mapActions$1.toggleTimestepAuto({
17010
- mapId: mapId,
17011
- timestepAuto: !isTimestepAuto$1,
17012
- origin: MapActionOrigin.map
17610
+
17611
+ var onSetNewDate = function onSetNewDate(newDate) {
17612
+ if (isAnimating$1) {
17613
+ dispatch(mapActions$1.mapStopAnimation({
17614
+ mapId: mapId
17615
+ }));
17616
+ }
17617
+
17618
+ dispatch(genericActions.setTime({
17619
+ sourceId: sourceId,
17620
+ origin: 'NowButtonConnect, 140',
17621
+ value: handleMomentISOString(newDate)
17013
17622
  }));
17014
- }, [dispatch, isTimestepAuto$1, mapId]);
17015
- var onSetTimeStep = React.useCallback(function (timeStep, origin) {
17016
- dispatch(mapActions$1.setTimeStep(Object.assign({
17623
+ };
17624
+
17625
+ var onSetCenterTime = function onSetCenterTime(newTime) {
17626
+ dispatch(mapActions$1.setTimeSliderCenterTime({
17017
17627
  mapId: mapId,
17018
- timeStep: timeStep
17019
- }, origin && {
17020
- origin: origin
17021
- })));
17022
- }, [dispatch, mapId]);
17023
- return /*#__PURE__*/React.createElement(TimeStepButton, {
17024
- timeStep: timeStep,
17025
- onChangeTimeStep: onSetTimeStep,
17026
- disabled: isAnimating$1,
17027
- isTimestepAuto: isTimestepAuto$1,
17028
- onToggleTimestepAuto: onToggleTimestepAuto,
17029
- timeDimension: activeLayerTimeDimension
17628
+ timeSliderCenterTime: newTime
17629
+ }));
17630
+ };
17631
+
17632
+ return /*#__PURE__*/React.createElement(NowButton, {
17633
+ disabled: isDisabled,
17634
+ onSetNow: function onSetNow() {
17635
+ return handleSetNowEvent(timeStep, dataStartTime, dataEndTime, currentTime, onSetNewDate, onSetCenterTime);
17636
+ }
17030
17637
  });
17031
17638
  };
17032
17639
 
@@ -17056,8 +17663,13 @@ var TimeStepButtonComponent = function TimeStepButtonComponent(_ref) {
17056
17663
  */
17057
17664
 
17058
17665
  var OptionsMenuButtonConnect = function OptionsMenuButtonConnect(_ref) {
17059
- var mapId = _ref.mapId;
17666
+ var sourceId = _ref.sourceId,
17667
+ mapId = _ref.mapId;
17060
17668
  return /*#__PURE__*/React.createElement(OptionsMenuButton, {
17669
+ nowBtn: /*#__PURE__*/React.createElement(NowButtonConnect, {
17670
+ mapId: mapId,
17671
+ sourceId: sourceId
17672
+ }),
17061
17673
  autoUpdateBtn: /*#__PURE__*/React.createElement(AutoUpdateButtonConnect, {
17062
17674
  mapId: mapId
17063
17675
  }),
@@ -17066,10 +17678,70 @@ var OptionsMenuButtonConnect = function OptionsMenuButtonConnect(_ref) {
17066
17678
  }),
17067
17679
  timeStepBtn: /*#__PURE__*/React.createElement(TimeStepButtonComponent, {
17068
17680
  mapId: mapId
17681
+ }),
17682
+ timeScaleBtn: /*#__PURE__*/React.createElement(TimeScaleButtonConnect, {
17683
+ mapId: mapId
17069
17684
  })
17070
17685
  });
17071
17686
  };
17072
17687
 
17688
+ var BackwardForwardStepButtonConnect = function BackwardForwardStepButtonConnect(_ref) {
17689
+ var isForwardStep = _ref.isForwardStep,
17690
+ mapId = _ref.mapId;
17691
+ var timeStep = useSelector(function (store) {
17692
+ return getMapTimeStep(store, mapId);
17693
+ });
17694
+ var dispatch = useDispatch();
17695
+
17696
+ var setTime = function setTime(newDate) {
17697
+ dispatch(genericActions.setTime({
17698
+ origin: '',
17699
+ sourceId: mapId,
17700
+ value: handleMomentISOString(newDate)
17701
+ }));
17702
+ };
17703
+
17704
+ var stopAnimation = function stopAnimation() {
17705
+ dispatch(mapActions$1.mapStopAnimation({
17706
+ mapId: mapId,
17707
+ origin: MapActionOrigin.map
17708
+ }));
17709
+ };
17710
+
17711
+ var isAnimating$1 = useSelector(function (store) {
17712
+ return isAnimating(store, mapId);
17713
+ });
17714
+ var timedim = useSelector(function (store) {
17715
+ return getMapDimension(store, mapId, 'time');
17716
+ });
17717
+ var selectedTime = getSelectedTime(timedim);
17718
+ var curTime = moment.unix(selectedTime).toISOString();
17719
+ var layers = useSelector(function (store) {
17720
+ return getMapLayers(store, mapId);
17721
+ });
17722
+
17723
+ var _getDataLimitsFromLay = getDataLimitsFromLayers(layers),
17724
+ _getDataLimitsFromLay2 = _slicedToArray(_getDataLimitsFromLay, 2),
17725
+ dataStartTime = _getDataLimitsFromLay2[0],
17726
+ dataEndTime = _getDataLimitsFromLay2[1];
17727
+
17728
+ var onClickBF = function onClickBF() {
17729
+ if (isAnimating$1) {
17730
+ stopAnimation();
17731
+ }
17732
+
17733
+ isForwardStep ? setNextTimeStep(timeStep, curTime, dataEndTime, setTime) : setPreviousTimeStep(timeStep, curTime, dataStartTime, setTime);
17734
+ };
17735
+
17736
+ return /*#__PURE__*/React__default.createElement(BackwardForwardStepButton, {
17737
+ isDisabled: false,
17738
+ isForwardStep: isForwardStep,
17739
+ onClickBFButton: function onClickBFButton() {
17740
+ onClickBF();
17741
+ }
17742
+ });
17743
+ };
17744
+
17073
17745
  /* *
17074
17746
  * Licensed under the Apache License, Version 2.0 (the "License");
17075
17747
  * you may not use this file except in compliance with the License.
@@ -17096,13 +17768,23 @@ var OptionsMenuButtonConnect = function OptionsMenuButtonConnect(_ref) {
17096
17768
  */
17097
17769
 
17098
17770
  var TimeSliderButtonsConnect = function TimeSliderButtonsConnect(_ref) {
17099
- var mapId = _ref.mapId;
17771
+ var sourceId = _ref.sourceId,
17772
+ mapId = _ref.mapId;
17100
17773
  return /*#__PURE__*/React.createElement(TimeSliderButtons, {
17101
17774
  optionsMenuBtn: /*#__PURE__*/React.createElement(OptionsMenuButtonConnect, {
17102
- mapId: mapId
17775
+ mapId: mapId,
17776
+ sourceId: sourceId
17103
17777
  }),
17104
17778
  playBtn: /*#__PURE__*/React.createElement(PlayButtonConnect, {
17105
17779
  mapId: mapId
17780
+ }),
17781
+ backwardBtn: /*#__PURE__*/React.createElement(BackwardForwardStepButtonConnect, {
17782
+ mapId: mapId,
17783
+ isForwardStep: false
17784
+ }),
17785
+ forwardBtn: /*#__PURE__*/React.createElement(BackwardForwardStepButtonConnect, {
17786
+ mapId: mapId,
17787
+ isForwardStep: true
17106
17788
  })
17107
17789
  });
17108
17790
  };
@@ -17126,8 +17808,6 @@ var connectRedux$2 = connect(function (store, props) {
17126
17808
  }, {
17127
17809
  stopMapAnimation: mapActions$1.mapStopAnimation,
17128
17810
  setTime: genericActions.setTime,
17129
- syncGroupAddSource: genericActions.syncGroupAddSource,
17130
- syncGroupRemoveSource: genericActions.syncGroupRemoveSource,
17131
17811
  mapSetTimeSliderCenterTime: mapActions$1.setTimeSliderCenterTime,
17132
17812
  mapSetTimeSliderSecondsPerPx: mapActions$1.setTimeSliderSecondsPerPx
17133
17813
  });
@@ -17149,8 +17829,6 @@ var TimeSliderLegendConnect = function TimeSliderLegendConnect(_ref) {
17149
17829
  activeWindowId = _ref.activeWindowId,
17150
17830
  stopMapAnimation = _ref.stopMapAnimation,
17151
17831
  setTime = _ref.setTime,
17152
- syncGroupAddSource = _ref.syncGroupAddSource,
17153
- syncGroupRemoveSource = _ref.syncGroupRemoveSource,
17154
17832
  mapSetTimeSliderCenterTime = _ref.mapSetTimeSliderCenterTime,
17155
17833
  mapSetTimeSliderSecondsPerPx = _ref.mapSetTimeSliderSecondsPerPx;
17156
17834
 
@@ -17165,17 +17843,6 @@ var TimeSliderLegendConnect = function TimeSliderLegendConnect(_ref) {
17165
17843
  dataEndTime = _getDataLimitsFromLay2[1];
17166
17844
 
17167
17845
  var mapIsActive = mapId === activeWindowId;
17168
- React.useEffect(function () {
17169
- syncGroupAddSource({
17170
- id: sourceId,
17171
- type: [SYNCGROUPS_TYPE_SETTIME]
17172
- });
17173
- return function () {
17174
- syncGroupRemoveSource({
17175
- id: sourceId
17176
- });
17177
- };
17178
- }, [sourceId, syncGroupAddSource, syncGroupRemoveSource]);
17179
17846
  return /*#__PURE__*/React.createElement(TimeSliderLegend, {
17180
17847
  centerTime: centerTime,
17181
17848
  secondsPerPx: secondsPerPx,
@@ -17253,8 +17920,6 @@ var connectRedux$1 = connect(function (store, props) {
17253
17920
  setAnimationEndTime: mapActions$1.setAnimationEndTime,
17254
17921
  setTime: genericActions.setTime,
17255
17922
  stopMapAnimation: mapActions$1.mapStopAnimation,
17256
- syncGroupAddSource: genericActions.syncGroupAddSource,
17257
- syncGroupRemoveSource: genericActions.syncGroupRemoveSource,
17258
17923
  mapSetTimeSliderCenterTime: mapActions$1.setTimeSliderCenterTime
17259
17924
  });
17260
17925
 
@@ -17276,8 +17941,6 @@ var TimeSliderRailConnectComponent = function TimeSliderRailConnectComponent(_re
17276
17941
  setAnimationEndTime = _ref.setAnimationEndTime,
17277
17942
  stopMapAnimation = _ref.stopMapAnimation,
17278
17943
  setTime = _ref.setTime,
17279
- syncGroupAddSource = _ref.syncGroupAddSource,
17280
- syncGroupRemoveSource = _ref.syncGroupRemoveSource,
17281
17944
  mapSetTimeSliderCenterTime = _ref.mapSetTimeSliderCenterTime;
17282
17945
 
17283
17946
  var _getMomentTimeBounds = getMomentTimeBounds(dimensions),
@@ -17291,17 +17954,6 @@ var TimeSliderRailConnectComponent = function TimeSliderRailConnectComponent(_re
17291
17954
  dataEndTime = _getDataLimitsFromLay2[1];
17292
17955
 
17293
17956
  var mapIsActive = activeWindowId === mapId;
17294
- React.useEffect(function () {
17295
- syncGroupAddSource({
17296
- id: sourceId,
17297
- type: [SYNCGROUPS_TYPE_SETTIME]
17298
- });
17299
- return function () {
17300
- syncGroupRemoveSource({
17301
- id: sourceId
17302
- });
17303
- };
17304
- }, [sourceId, syncGroupAddSource, syncGroupRemoveSource]);
17305
17957
  return /*#__PURE__*/React.createElement(TimeSliderRail, {
17306
17958
  centerTime: centerTime,
17307
17959
  secondsPerPx: secondsPerPx,
@@ -17351,89 +18003,6 @@ var TimeSliderRailConnectComponent = function TimeSliderRailConnectComponent(_re
17351
18003
 
17352
18004
  var TimeSliderRailConnect = connectRedux$1(TimeSliderRailConnectComponent);
17353
18005
 
17354
- /* *
17355
- * Licensed under the Apache License, Version 2.0 (the "License");
17356
- * you may not use this file except in compliance with the License.
17357
- * You may obtain a copy of the License at
17358
- *
17359
- * http://www.apache.org/licenses/LICENSE-2.0
17360
- *
17361
- * Unless required by applicable law or agreed to in writing, software
17362
- * distributed under the License is distributed on an "AS IS" BASIS,
17363
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17364
- * See the License for the specific language governing permissions and
17365
- * limitations under the License.
17366
- *
17367
- * Copyright 2020 - Koninklijk Nederlands Meteorologisch Instituut (KNMI)
17368
- * Copyright 2020 - Finnish Meteorological Institute (FMI)
17369
- * */
17370
- var connectReduxTimeSliderScaleSlider = connect(function (store, props) {
17371
- return {
17372
- layers: getMapLayers(store, props.mapId),
17373
- timeSliderScale: getMapTimeSliderScale(store, props.mapId),
17374
- centerTime: getMapTimeSliderCenterTime(store, props.mapId),
17375
- secondsPerPx: getMapTimeSliderSecondsPerPx(store, props.mapId),
17376
- dimensions: getMapDimensions(store, props.mapId)
17377
- };
17378
- }, {
17379
- mapSetTimeSliderScale: mapActions$1.setTimeSliderScale,
17380
- mapSetTimeSliderDataScaleToSecondsPerPx: mapActions$1.setTimeSliderDataScaleToSecondsPerPx,
17381
- mapSetTimeSliderCenterTime: mapActions$1.setTimeSliderCenterTime
17382
- });
17383
-
17384
- var TimeSliderScaleSliderComponent = function TimeSliderScaleSliderComponent(_ref) {
17385
- var timeSliderScale = _ref.timeSliderScale,
17386
- mapId = _ref.mapId,
17387
- layers = _ref.layers,
17388
- centerTime = _ref.centerTime,
17389
- secondsPerPx = _ref.secondsPerPx,
17390
- dimensions = _ref.dimensions,
17391
- mapSetTimeSliderScale = _ref.mapSetTimeSliderScale,
17392
- mapSetTimeSliderDataScaleToSecondsPerPx = _ref.mapSetTimeSliderDataScaleToSecondsPerPx,
17393
- mapSetTimeSliderCenterTime = _ref.mapSetTimeSliderCenterTime;
17394
-
17395
- var onSetTimeSliderScale = function onSetTimeSliderScale(scale, newCenterTime, scaleToSecPerPx) {
17396
- if (scale === Scale.DataScale) {
17397
- mapSetTimeSliderDataScaleToSecondsPerPx({
17398
- mapId: mapId,
17399
- timeSliderDataScaleToSecondsPerPx: scaleToSecPerPx
17400
- });
17401
- }
17402
-
17403
- mapSetTimeSliderScale({
17404
- mapId: mapId,
17405
- timeSliderScale: scale
17406
- });
17407
- mapSetTimeSliderCenterTime({
17408
- mapId: mapId,
17409
- timeSliderCenterTime: newCenterTime
17410
- });
17411
- };
17412
-
17413
- var _getTimeBounds = getTimeBounds(dimensions),
17414
- selectedTime = _getTimeBounds.selectedTime;
17415
-
17416
- return /*#__PURE__*/React.createElement(TimeSliderScaleSlider, {
17417
- layers: layers,
17418
- timeSliderScale: timeSliderScale,
17419
- onChangeTimeSliderScale: onSetTimeSliderScale,
17420
- secondsPerPx: secondsPerPx,
17421
- centerTime: centerTime,
17422
- selectedTime: selectedTime
17423
- });
17424
- };
17425
- /**
17426
- * TimeSliderScaleSlider component connected to the store displaying a scale slider of the time slider
17427
- *
17428
- * Expects the following props:
17429
- * @param {string} mapId mapId: string - Id of the map
17430
- * @example
17431
- * ``` <TimeSliderScaleSliderConnect mapId={mapId} />```
17432
- */
17433
-
17434
-
17435
- var TimeSliderScaleSliderConnect = connectReduxTimeSliderScaleSlider(TimeSliderScaleSliderComponent);
17436
-
17437
18006
  /* *
17438
18007
  * Licensed under the Apache License, Version 2.0 (the "License");
17439
18008
  * you may not use this file except in compliance with the License.
@@ -17501,15 +18070,13 @@ var ConnectedTimeSlider = function ConnectedTimeSlider(_ref) {
17501
18070
 
17502
18071
  return /*#__PURE__*/React.createElement(TimeSlider, {
17503
18072
  buttons: /*#__PURE__*/React.createElement(TimeSliderButtonsConnect, {
17504
- mapId: mapId
18073
+ mapId: mapId,
18074
+ sourceId: sourceId
17505
18075
  }),
17506
18076
  rail: /*#__PURE__*/React.createElement(TimeSliderRailConnect, {
17507
18077
  mapId: mapId,
17508
18078
  sourceId: sourceId
17509
18079
  }),
17510
- scaleSlider: /*#__PURE__*/React.createElement(TimeSliderScaleSliderConnect, {
17511
- mapId: mapId
17512
- }),
17513
18080
  legend: /*#__PURE__*/React.createElement(TimeSliderLegendConnect$1, {
17514
18081
  mapId: mapId,
17515
18082
  sourceId: sourceId
@@ -18000,7 +18567,7 @@ var setServiceMetadata = function setServiceMetadata(wmLayer, mapId, webMapJSIns
18000
18567
  id: service.id,
18001
18568
  serviceUrl: wmLayer.service,
18002
18569
  layers: layers,
18003
- isUserAddedService: false
18570
+ scope: 'system'
18004
18571
  },
18005
18572
  layerStyle: {
18006
18573
  origin: origin,
@@ -18706,7 +19273,7 @@ var AdagucMapDraw = /*#__PURE__*/function (_React$PureComponent) {
18706
19273
  }
18707
19274
 
18708
19275
  if (!featureCoords) {
18709
- return;
19276
+ return undefined;
18710
19277
  }
18711
19278
 
18712
19279
  var vertexSelected = mouseDown === true && this.mouseIsOverVertexNr !== VERTEX.NONE;
@@ -18730,6 +19297,8 @@ var AdagucMapDraw = /*#__PURE__*/function (_React$PureComponent) {
18730
19297
 
18731
19298
  return false;
18732
19299
  }
19300
+
19301
+ return undefined;
18733
19302
  }
18734
19303
  }, {
18735
19304
  key: "hoverVertex",
@@ -18848,7 +19417,7 @@ var AdagucMapDraw = /*#__PURE__*/function (_React$PureComponent) {
18848
19417
  isInEditMode = _this$props2.isInEditMode,
18849
19418
  featureNrToEdit = _this$props2.featureNrToEdit,
18850
19419
  onHoverFeature = _this$props2.onHoverFeature;
18851
- if (event && event.rightButton === true) return;
19420
+ if (event && event.rightButton === true) return undefined;
18852
19421
  /* adagucMouseMove is an event callback function which is triggered when the mouse moves over the map
18853
19422
  This event is only triggered if the map is in hover state.
18854
19423
  E.g. when the map is dragging/panning, this event is not triggerd
@@ -18889,11 +19458,11 @@ var AdagucMapDraw = /*#__PURE__*/function (_React$PureComponent) {
18889
19458
  }
18890
19459
 
18891
19460
  if (isInEditMode === false) {
18892
- return;
19461
+ return undefined;
18893
19462
  }
18894
19463
 
18895
19464
  var feature = this.geojson.features[featureNrToEdit];
18896
- if (!feature) return;
19465
+ if (!feature) return undefined;
18897
19466
  var webmapjs = this.props.webmapjs;
18898
19467
  this.mouseGeoCoord = webmapjs.getLatLongFromPixelCoord({
18899
19468
  x: mouseX,
@@ -18959,6 +19528,8 @@ var AdagucMapDraw = /*#__PURE__*/function (_React$PureComponent) {
18959
19528
  /* False means that this component will take over entire controll.
18960
19529
  True means that it is still possible to pan and drag the map while editing */
18961
19530
  }
19531
+
19532
+ return undefined;
18962
19533
  }
18963
19534
  /* Returns true if double click is detected */
18964
19535
 
@@ -19266,6 +19837,8 @@ var AdagucMapDraw = /*#__PURE__*/function (_React$PureComponent) {
19266
19837
  return false;
19267
19838
  }
19268
19839
  }
19840
+
19841
+ return undefined;
19269
19842
  }
19270
19843
  }, {
19271
19844
  key: "addPointToLineStringFeature",
@@ -20057,7 +20630,7 @@ var AdagucMapDraw = /*#__PURE__*/function (_React$PureComponent) {
20057
20630
  /* After the image is loaded the canvas will be redrawn and drawIcon will be triggered again
20058
20631
  via the beforecanvasdisplay listener. */
20059
20632
 
20060
- return;
20633
+ return undefined;
20061
20634
  }
20062
20635
 
20063
20636
  if (image.isLoaded()) {
@@ -20070,6 +20643,8 @@ var AdagucMapDraw = /*#__PURE__*/function (_React$PureComponent) {
20070
20643
  ctx.strokeRect(parseInt(_coord.x, 10) - imageWidth / 2, parseInt(_coord.y, 10) - imageHeight / 2, imageWidth, imageHeight);
20071
20644
  }
20072
20645
  }
20646
+
20647
+ return undefined;
20073
20648
  }
20074
20649
  }, {
20075
20650
  key: "drawMarker",
@@ -21322,12 +21897,8 @@ ReactMapView.defaultProps = {
21322
21897
  shouldAutoFetch: true,
21323
21898
  displayMapPin: false,
21324
21899
  disableMapPin: false,
21325
- onMount: function onMount() {
21326
- return null;
21327
- },
21328
- onUnMount: function onUnMount() {
21329
- return null;
21330
- },
21900
+ onMount: function onMount() {},
21901
+ onUnMount: function onUnMount() {},
21331
21902
  onMapChangeDimension: function onMapChangeDimension() {
21332
21903
  /* nothing */
21333
21904
  },
@@ -21436,7 +22007,7 @@ var MapView = function MapView(_a) {
21436
22007
  }
21437
22008
  }, /*#__PURE__*/React.createElement(ZoomControls, {
21438
22009
  onZoomIn: function onZoomIn() {
21439
- return adagucRef.current.zoomIn();
22010
+ return adagucRef.current.zoomIn(undefined);
21440
22011
  },
21441
22012
  onZoomOut: function onZoomOut() {
21442
22013
  return adagucRef.current.zoomOut();
@@ -21494,10 +22065,10 @@ var useTouchZoomPan = function useTouchZoomPan(mapIsActive, mapId) {
21494
22065
  return (touches === null || touches === void 0 ? void 0 : touches.length) === 2;
21495
22066
  };
21496
22067
 
21497
- var isValidMap = React.useCallback(function (map, event) {
22068
+ var isCanvasElement = React.useCallback(function (event) {
21498
22069
  var target = event.target;
21499
- return map && target.tagName !== 'INPUT' && mapIsActive;
21500
- }, [mapIsActive]);
22070
+ return target.tagName === 'CANVAS';
22071
+ }, []);
21501
22072
 
21502
22073
  var distance = function distance(x1, y1, x2, y2) {
21503
22074
  var dx = x1 - x2;
@@ -21505,9 +22076,32 @@ var useTouchZoomPan = function useTouchZoomPan(mapIsActive, mapId) {
21505
22076
  return Math.sqrt(dx * dx + dy * dy);
21506
22077
  };
21507
22078
 
22079
+ var isMatchingWebMapNumbers = function isMatchingWebMapNumbers(firstStr, secondStr) {
22080
+ // Returns true if the same web map (id) number were encountered in both given strings, false otherwise.
22081
+ var webMapNumberBaseFormat = 'WebMapJSMapNo_';
22082
+
22083
+ if (!firstStr.includes(webMapNumberBaseFormat) || !secondStr.includes(webMapNumberBaseFormat)) {
22084
+ return false;
22085
+ }
22086
+
22087
+ var numberMatcher = /\d+/;
22088
+ var firstNumber = firstStr.match(numberMatcher)[0];
22089
+ var secondNumber = secondStr.match(numberMatcher)[0];
22090
+ return Boolean(firstNumber && secondNumber && firstNumber === secondNumber);
22091
+ };
22092
+
22093
+ var isTouchInsideTargetElement = function isTouchInsideTargetElement(elem, touchX, touchY) {
22094
+ var _elem$getBoundingClie = elem.getBoundingClientRect(),
22095
+ left = _elem$getBoundingClie.left,
22096
+ top = _elem$getBoundingClie.top,
22097
+ width = _elem$getBoundingClie.width,
22098
+ height = _elem$getBoundingClie.height;
22099
+
22100
+ var leftMarginWidth = 0.02 * document.body.getBoundingClientRect().width;
22101
+ return touchY > window.scrollY + top && touchY < window.scrollY + top + height - TIME_SLIDER_LEGEND_HEIGHT && touchX > window.scrollX + left + leftMarginWidth && touchX < window.scrollX + left + width;
22102
+ };
22103
+
21508
22104
  var handleStart = React.useCallback(function (event) {
21509
- var map = getWMJSMapById(mapId);
21510
- if (!isValidMap(map, event)) return;
21511
22105
  var targetTouches = event.targetTouches;
21512
22106
  var firstTouch = targetTouches === null || targetTouches === void 0 ? void 0 : targetTouches.item(0);
21513
22107
  setFirstTouchX(firstTouch === null || firstTouch === void 0 ? void 0 : firstTouch.clientX);
@@ -21518,10 +22112,31 @@ var useTouchZoomPan = function useTouchZoomPan(mapIsActive, mapId) {
21518
22112
  setSecondTouchX(secondTouch === null || secondTouch === void 0 ? void 0 : secondTouch.clientX);
21519
22113
  setSecondTouchY(secondTouch === null || secondTouch === void 0 ? void 0 : secondTouch.clientY);
21520
22114
  }
21521
- }, [isValidMap, mapId]);
22115
+ }, []);
21522
22116
  var handleMove = React.useCallback(function (event) {
21523
22117
  var map = getWMJSMapById(mapId);
21524
- if (!isValidMap(map, event)) return;
22118
+ var targetElem = event.target;
22119
+
22120
+ if (!isCanvasElement(event)) {
22121
+ // Elements other than canvas elements are not allowed to be zoomed/panned
22122
+ return;
22123
+ }
22124
+
22125
+ var targetMapId = map.getId();
22126
+ var targetElemId = targetElem.parentElement.id;
22127
+
22128
+ if (!isMatchingWebMapNumbers(targetMapId, targetElemId)) {
22129
+ // Current map (given by map id) was not coupled to the canvas element user touched.
22130
+ // This web map id number comparison is of importance when dealing with multi-window presentations.
22131
+ return;
22132
+ }
22133
+
22134
+ if (!isTouchInsideTargetElement(targetElem, firstTouchX, firstTouchY)) {
22135
+ // A user touch outside the current canvas element will be rejected
22136
+ return;
22137
+ } // Start zooming/panning by touch
22138
+
22139
+
21525
22140
  event.preventDefault();
21526
22141
  var targetTouches = event.targetTouches;
21527
22142
  var firstTouch = targetTouches === null || targetTouches === void 0 ? void 0 : targetTouches.item(0);
@@ -21564,7 +22179,7 @@ var useTouchZoomPan = function useTouchZoomPan(mapIsActive, mapId) {
21564
22179
  setPrevDist(_dist);
21565
22180
  }
21566
22181
  }
21567
- }, [firstTouchX, firstTouchY, isValidMap, mapId, prevDist, secondTouchX, secondTouchY]);
22182
+ }, [mapId, isCanvasElement, firstTouchX, firstTouchY, secondTouchX, secondTouchY, prevDist]);
21568
22183
  var handleEnd = React.useCallback(function () {}, []);
21569
22184
  React.useEffect(function () {
21570
22185
  document.addEventListener('touchstart', handleStart, {
@@ -21813,7 +22428,7 @@ var MapViewConnect = function MapViewConnect(_a) {
21813
22428
  },
21814
22429
  srs: srs,
21815
22430
  bbox: bbox,
21816
- mapPinLocation: displayMapPin && mapPinLocation,
22431
+ mapPinLocation: displayMapPin ? mapPinLocation : undefined,
21817
22432
  dimensions: mapDimensions,
21818
22433
  activeLayerId: activeLayerId,
21819
22434
  animationDelay: animationDelay,
@@ -21933,6 +22548,141 @@ var LegendMapButtonConnect = function LegendMapButtonConnect(_ref) {
21933
22548
  }, /*#__PURE__*/React.createElement(List$1, null));
21934
22549
  };
21935
22550
 
22551
+ var MIN_WIDTH = 170;
22552
+ var MIN_HEIGHT = 32;
22553
+ var MIN_FONT_SIZE = 14;
22554
+ var FONT_SIZE_WIDTH_RATIO = MIN_FONT_SIZE / MIN_WIDTH;
22555
+ var TimeSliderClock = function TimeSliderClock(_ref2) {
22556
+ var time = _ref2.time;
22557
+ var nodeRef = React.useRef(null);
22558
+
22559
+ var _React$useState = React.useState({
22560
+ x: 0,
22561
+ y: 0
22562
+ }),
22563
+ _React$useState2 = _slicedToArray(_React$useState, 2),
22564
+ position = _React$useState2[0],
22565
+ setPosition = _React$useState2[1];
22566
+
22567
+ useMakeSureContainerStaysInsideWindow(nodeRef, position, setPosition);
22568
+
22569
+ var _React$useState3 = React.useState({
22570
+ width: MIN_WIDTH,
22571
+ height: MIN_HEIGHT
22572
+ }),
22573
+ _React$useState4 = _slicedToArray(_React$useState3, 2),
22574
+ size = _React$useState4[0],
22575
+ setSize = _React$useState4[1];
22576
+
22577
+ var _React$useState5 = React.useState(MIN_FONT_SIZE),
22578
+ _React$useState6 = _slicedToArray(_React$useState5, 2),
22579
+ fontSize = _React$useState6[0],
22580
+ setFontSize = _React$useState6[1];
22581
+
22582
+ return /*#__PURE__*/React.createElement(Draggable, {
22583
+ nodeRef: nodeRef,
22584
+ bounds: "parent",
22585
+ position: position,
22586
+ onStop: function onStop(_event, position) {
22587
+ setPosition(position);
22588
+ }
22589
+ }, /*#__PURE__*/React.createElement("div", {
22590
+ style: {
22591
+ position: 'absolute',
22592
+ zIndex: 100,
22593
+ top: '10px',
22594
+ right: '10px'
22595
+ },
22596
+ ref: nodeRef
22597
+ }, /*#__PURE__*/React.createElement(Resizable, {
22598
+ onResizeStart: function onResizeStart(event) {
22599
+ event.stopPropagation();
22600
+ },
22601
+ onResize: function onResize(_event, _direction, _ref, delta) {
22602
+ var width = size.width + delta.width;
22603
+ var fontSize = FONT_SIZE_WIDTH_RATIO * width;
22604
+ setFontSize(fontSize);
22605
+ },
22606
+ onResizeStop: function onResizeStop(_event, _direction, _ref, delta) {
22607
+ var width = size.width + delta.width;
22608
+ var height = size.height + delta.height;
22609
+ setSize({
22610
+ width: width,
22611
+ height: height
22612
+ });
22613
+ },
22614
+ lockAspectRatio: true,
22615
+ minHeight: MIN_HEIGHT,
22616
+ minWidth: MIN_WIDTH,
22617
+ size: size,
22618
+ handleComponent: {
22619
+ bottomLeft: /*#__PURE__*/React.createElement(Resize, {
22620
+ isRightAligned: true,
22621
+ style: {
22622
+ fill: '#FFFFFF'
22623
+ }
22624
+ })
22625
+ },
22626
+ enable: {
22627
+ top: false,
22628
+ right: false,
22629
+ bottom: false,
22630
+ left: false,
22631
+ topRight: false,
22632
+ bottomRight: false,
22633
+ bottomLeft: true,
22634
+ topLeft: false
22635
+ }
22636
+ }, /*#__PURE__*/React.createElement(Box$2, {
22637
+ display: "flex",
22638
+ justifyContent: "center",
22639
+ alignItems: "center",
22640
+ sx: {
22641
+ cursor: 'move',
22642
+ height: '100%',
22643
+ width: '100%',
22644
+ backgroundColor: '#051039',
22645
+ borderRadius: '5px'
22646
+ }
22647
+ }, /*#__PURE__*/React.createElement(Typography, {
22648
+ variant: "subtitle2",
22649
+ sx: {
22650
+ color: '#FFFFFF',
22651
+ fontSize: fontSize
22652
+ }
22653
+ }, moment.utc(time).format('ddd DD MMM HH:mm z'))))));
22654
+ };
22655
+
22656
+ /* *
22657
+ * Licensed under the Apache License, Version 2.0 (the "License");
22658
+ * you may not use this file except in compliance with the License.
22659
+ * You may obtain a copy of the License at
22660
+ *
22661
+ * http://www.apache.org/licenses/LICENSE-2.0
22662
+ *
22663
+ * Unless required by applicable law or agreed to in writing, software
22664
+ * distributed under the License is distributed on an "AS IS" BASIS,
22665
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
22666
+ * See the License for the specific language governing permissions and
22667
+ * limitations under the License.
22668
+ *
22669
+ * Copyright 2022 - Koninklijk Nederlands Meteorologisch Instituut (KNMI)
22670
+ * Copyright 2022 - Finnish Meteorological Institute (FMI)
22671
+ * */
22672
+ var TimeSliderClockConnect = function TimeSliderClockConnect(_ref) {
22673
+ var mapId = _ref.mapId;
22674
+ var dimensions = useSelector(function (store) {
22675
+ return getMapDimensions(store, mapId);
22676
+ });
22677
+
22678
+ var _getMomentTimeBounds = getMomentTimeBounds(dimensions),
22679
+ selectedTime = _getMomentTimeBounds.selectedTime;
22680
+
22681
+ return /*#__PURE__*/React__default.createElement(TimeSliderClock, {
22682
+ time: selectedTime
22683
+ });
22684
+ };
22685
+
21936
22686
  var titleStyle = function titleStyle(theme) {
21937
22687
  return {
21938
22688
  position: 'absolute',
@@ -21982,7 +22732,9 @@ var ConfigurableMapConnect = function ConfigurableMapConnect(_a) {
21982
22732
  _a$multiLegend = _a.multiLegend,
21983
22733
  multiLegend = _a$multiLegend === void 0 ? true : _a$multiLegend,
21984
22734
  shouldShowLayerManager = _a.shouldShowLayerManager,
21985
- props = __rest(_a, ["id", "title", "layers", "shouldAutoUpdate", "shouldAnimate", "bbox", "srs", "shouldShowZoomControls", "displayMapPin", "showTimeSlider", "disableTimeSlider", "displayTimeInMap", "displayLayerManagerAndLegendButtonInMap", "displayDimensionSelectButtonInMap", "multiLegend", "shouldShowLayerManager"]);
22735
+ _a$showClock = _a.showClock,
22736
+ showClock = _a$showClock === void 0 ? true : _a$showClock,
22737
+ props = __rest(_a, ["id", "title", "layers", "shouldAutoUpdate", "shouldAnimate", "bbox", "srs", "shouldShowZoomControls", "displayMapPin", "showTimeSlider", "disableTimeSlider", "displayTimeInMap", "displayLayerManagerAndLegendButtonInMap", "displayDimensionSelectButtonInMap", "multiLegend", "shouldShowLayerManager", "showClock"]);
21986
22738
 
21987
22739
  var dispatch = useDispatch();
21988
22740
  var mapId = React__default.useRef(id || generateMapId()).current;
@@ -22015,7 +22767,7 @@ var ConfigurableMapConnect = function ConfigurableMapConnect(_a) {
22015
22767
 
22016
22768
  if (shouldShowLayerManager !== undefined) {
22017
22769
  dispatch(uiActions.setActiveMapIdForDialog({
22018
- type: 'layerManager',
22770
+ type: DialogTypes.LayerManager,
22019
22771
  mapId: mapId,
22020
22772
  setOpen: shouldShowLayerManager,
22021
22773
  source: 'app'
@@ -22068,6 +22820,8 @@ var ConfigurableMapConnect = function ConfigurableMapConnect(_a) {
22068
22820
  showMapId: true,
22069
22821
  mapId: mapId,
22070
22822
  multiLegend: multiLegend
22823
+ }), showClock && /*#__PURE__*/React__default.createElement(TimeSliderClockConnect, {
22824
+ mapId: mapId
22071
22825
  }));
22072
22826
  };
22073
22827
 
@@ -22107,7 +22861,9 @@ var MultiMapViewConnect = function MultiMapViewConnect(_ref) {
22107
22861
  _ref$showZoomControls = _ref.showZoomControls,
22108
22862
  showZoomControls = _ref$showZoomControls === void 0 ? true : _ref$showZoomControls,
22109
22863
  _ref$multiLegend = _ref.multiLegend,
22110
- multiLegend = _ref$multiLegend === void 0 ? false : _ref$multiLegend;
22864
+ multiLegend = _ref$multiLegend === void 0 ? false : _ref$multiLegend,
22865
+ _ref$showClock = _ref.showClock,
22866
+ showClock = _ref$showClock === void 0 ? true : _ref$showClock;
22111
22867
  var dispatch = useDispatch();
22112
22868
  var syncGroupAddTarget = React__default.useCallback(function (payload) {
22113
22869
  dispatch(genericActions.syncGroupAddTarget(payload));
@@ -22150,6 +22906,8 @@ var MultiMapViewConnect = function MultiMapViewConnect(_ref) {
22150
22906
  showMapId: true,
22151
22907
  mapId: firstMapId,
22152
22908
  multiLegend: multiLegend
22909
+ }), showClock && /*#__PURE__*/React__default.createElement(TimeSliderClockConnect, {
22910
+ mapId: firstMapId
22153
22911
  }), maps.map(function (map, mapIndex) {
22154
22912
  var mapId = map.id;
22155
22913
  return /*#__PURE__*/React__default.createElement(Box, {
@@ -22169,96 +22927,12 @@ var MultiMapViewConnect = function MultiMapViewConnect(_ref) {
22169
22927
  shouldShowZoomControls: showZoomControls && mapIndex === 0,
22170
22928
  showTimeSlider: false,
22171
22929
  disableTimeSlider: true,
22930
+ showClock: false,
22172
22931
  multiLegend: multiLegend
22173
22932
  }));
22174
22933
  }));
22175
22934
  };
22176
22935
 
22177
- var useGetReferenceTimes = function useGetReferenceTimes(inputLayer) {
22178
- var _React$useState = React.useState([]),
22179
- _React$useState2 = _slicedToArray(_React$useState, 2),
22180
- referenceTimes = _React$useState2[0],
22181
- setReferenceTimes = _React$useState2[1];
22182
-
22183
- React.useEffect(function () {
22184
- var referenceTimes = [];
22185
- var wmLayer = new WMLayer(Object.assign({}, inputLayer));
22186
- wmLayer.parseLayerPromise().then(function (layer) {
22187
- var refTimeDim = layer.getDimension('reference_time');
22188
- /* Loop through all values of the dimension.
22189
- A map cannot be used for iterating, as the dimension values are not in an array (it is an API). */
22190
-
22191
- for (var j = 0; j < refTimeDim.size(); j += 1) {
22192
- var referenceTimeValue = refTimeDim.getValueForIndex(j);
22193
- referenceTimes.push(referenceTimeValue);
22194
- }
22195
-
22196
- setReferenceTimes(referenceTimes);
22197
- });
22198
- }, [inputLayer]);
22199
- return referenceTimes;
22200
- };
22201
-
22202
- var HarmonieTempAndPrecipPreset = function HarmonieTempAndPrecipPreset(_ref) {
22203
- var layers = _ref.layers,
22204
- _ref$multiLegend = _ref.multiLegend,
22205
- multiLegend = _ref$multiLegend === void 0 ? false : _ref$multiLegend;
22206
-
22207
- /* Get all the reference times for this layer */
22208
- var referenceTimes = useGetReferenceTimes(layers.topRow);
22209
- if (referenceTimes.length === 0) return /*#__PURE__*/React.createElement("div", null, "Loading...");
22210
- /* Helper to make a map layer prest */
22211
-
22212
- var makeMapPreset = function makeMapPreset(referenceTime, uniqueId, layer, syncGroupsIds, col) {
22213
- return {
22214
- id: uniqueId,
22215
- title: "Harmonie run ".concat("".concat(referenceTime.substring(8, 13).replace('T', ' / '))),
22216
- bbox: {
22217
- left: -450651.2255879827,
22218
- bottom: 6490531.093143953,
22219
- right: 1428345.8183648037,
22220
- top: 7438773.776232235
22221
- },
22222
- srs: 'EPSG:3857',
22223
- layers: [Object.assign(Object.assign({}, layer), {
22224
- id: uniqueId,
22225
- dimensions: [{
22226
- name: 'reference_time',
22227
- currentValue: referenceTime
22228
- }]
22229
- })],
22230
- syncGroupsIds: syncGroupsIds,
22231
- displayLayerManagerAndLegendButtonInMap: col === 0 || !syncGroupsIds,
22232
- displayDimensionSelectButtonInMap: col === 0 || !syncGroupsIds
22233
- };
22234
- };
22235
- /* Make the preset */
22236
-
22237
-
22238
- var nCols = 5;
22239
- /* Add the harmonie air temperature layers with the different referencetimes */
22240
-
22241
- var mapsTemperature = _toConsumableArray(Array(nCols)).map(function (_, index) {
22242
- var refTime = referenceTimes[referenceTimes.length - nCols + index];
22243
- return makeMapPreset(refTime, "harm_air".concat(index), layers.topRow, layers.topRowSyncGroups, index);
22244
- });
22245
- /* Add the harmonie precipitation layers with the different referencetimes */
22246
-
22247
-
22248
- var mapsPrecipitation = _toConsumableArray(Array(nCols)).map(function (_, index) {
22249
- var refTime = referenceTimes[referenceTimes.length - nCols + index];
22250
- return makeMapPreset(refTime, "harm_precip".concat(index), layers.bottomRow, layers.bottomRowSyncGroups, index);
22251
- });
22252
-
22253
- var maps = mapsTemperature.concat(mapsPrecipitation);
22254
- return /*#__PURE__*/React.createElement(MultiMapViewConnect, {
22255
- rows: 2,
22256
- cols: 5,
22257
- maps: maps,
22258
- multiLegend: multiLegend
22259
- });
22260
- };
22261
-
22262
22936
  var useGetLatestReferenceTime = function useGetLatestReferenceTime(inputLayer) {
22263
22937
  var _React$useState = React.useState(''),
22264
22938
  _React$useState2 = _slicedToArray(_React$useState, 2),
@@ -22275,8 +22949,30 @@ var useGetLatestReferenceTime = function useGetLatestReferenceTime(inputLayer) {
22275
22949
  }, [inputLayer]);
22276
22950
  return latestReferenceTime;
22277
22951
  };
22278
- /* Helper to make a map layer preset */
22952
+ /**
22953
+ * Custom hook to find out if the list of syncgroup id's contains a group which is of type SYNCGROUPS_TYPE_SETLAYERACTIONS
22954
+ * @param syncGroupsIds A string array of syncgroup ids
22955
+ * @returns True if indeed a group is included which is of type SYNCGROUPS_TYPE_SETLAYERACTIONS
22956
+ */
22957
+
22958
+
22959
+ var useHasSyncGroupWithLayerActions = function useHasSyncGroupWithLayerActions(syncGroupsIds) {
22960
+ /* Get Syncgroupstate */
22961
+ var syncGroupState = useSelector(function (store) {
22962
+ return getSynchronizationGroupState(store);
22963
+ });
22964
+ if (!syncGroupState) return false;
22965
+ /* Return all syncgroups configured for this component of type SYNCGROUPS_TYPE_SETLAYERACTIONS */
22279
22966
 
22967
+ var syncGroupsWithLayerActions = syncGroupState.groups.allIds.filter(function (syncGroupId) {
22968
+ return syncGroupsIds && syncGroupsIds.includes(syncGroupId) && syncGroupState.groups.byId[syncGroupId].type === 'SYNCGROUPS_TYPE_SETLAYERACTIONS';
22969
+ });
22970
+ /* Figure out if there is a syncgroup which controls layeractions. */
22971
+
22972
+ var displayLayerManagerAndLegendButtonInAllMaps = syncGroupsIds ? syncGroupsWithLayerActions.length === 1 : false;
22973
+ return displayLayerManagerAndLegendButtonInAllMaps;
22974
+ };
22975
+ /* Helper to make a map layer preset */
22280
22976
 
22281
22977
  var makeMapPreset = function makeMapPreset(timeIncrement, uniqueId, referenceTime, layers, syncGroupsIds, displayLayerManagerAndLegendButtonInMap, displayDimensionSelectButtonInMap) {
22282
22978
  var mapTime = moment.utc(referenceTime).add(timeIncrement, 'h').format('YYYY-MM-DDTHH:mm:ss[Z]');
@@ -22318,8 +23014,9 @@ var ModelRunInterval = function ModelRunInterval(_ref) {
22318
23014
  startTimeIncrement = _ref$startTimeIncreme === void 0 ? 3 : _ref$startTimeIncreme,
22319
23015
  _ref$multiLegend = _ref.multiLegend,
22320
23016
  multiLegend = _ref$multiLegend === void 0 ? false : _ref$multiLegend;
22321
-
23017
+ var displayLayerManagerAndLegendButtonInAllMaps = !useHasSyncGroupWithLayerActions(syncGroupsIds);
22322
23018
  /* Get latest reference time for this layer */
23019
+
22323
23020
  var latestReferenceTime = useGetLatestReferenceTime(layers[0]);
22324
23021
  if (latestReferenceTime === '') return /*#__PURE__*/React.createElement("div", null, "Loading...");
22325
23022
  /* Calculate the last time increment based on 15 maps */
@@ -22332,7 +23029,7 @@ var ModelRunInterval = function ModelRunInterval(_ref) {
22332
23029
 
22333
23030
 
22334
23031
  var maps = timeIncrements.map(function (increment, index) {
22335
- return makeMapPreset(increment, "harm_precip".concat(increment), latestReferenceTime, layers, syncGroupsIds, index === 0 || !syncGroupsIds, index === 0 || !syncGroupsIds);
23032
+ return makeMapPreset(increment, "harm_precip".concat(increment), latestReferenceTime, layers, syncGroupsIds, index === 0 || displayLayerManagerAndLegendButtonInAllMaps, index === 0 || displayLayerManagerAndLegendButtonInAllMaps);
22336
23033
  });
22337
23034
  return /*#__PURE__*/React.createElement(MultiMapViewConnect, {
22338
23035
  rows: 3,
@@ -22340,6 +23037,94 @@ var ModelRunInterval = function ModelRunInterval(_ref) {
22340
23037
  maps: maps,
22341
23038
  syncTime: false,
22342
23039
  showTimeSlider: false,
23040
+ multiLegend: multiLegend,
23041
+ showClock: false
23042
+ });
23043
+ };
23044
+
23045
+ var useGetReferenceTimes = function useGetReferenceTimes(inputLayer) {
23046
+ var _React$useState = React.useState([]),
23047
+ _React$useState2 = _slicedToArray(_React$useState, 2),
23048
+ referenceTimes = _React$useState2[0],
23049
+ setReferenceTimes = _React$useState2[1];
23050
+
23051
+ React.useEffect(function () {
23052
+ var referenceTimes = [];
23053
+ var wmLayer = new WMLayer(Object.assign({}, inputLayer));
23054
+ wmLayer.parseLayerPromise().then(function (layer) {
23055
+ var refTimeDim = layer.getDimension('reference_time');
23056
+ /* Loop through all values of the dimension.
23057
+ A map cannot be used for iterating, as the dimension values are not in an array (it is an API). */
23058
+
23059
+ for (var j = 0; j < refTimeDim.size(); j += 1) {
23060
+ var referenceTimeValue = refTimeDim.getValueForIndex(j);
23061
+ referenceTimes.push(referenceTimeValue);
23062
+ }
23063
+
23064
+ setReferenceTimes(referenceTimes);
23065
+ });
23066
+ }, [inputLayer]);
23067
+ return referenceTimes;
23068
+ };
23069
+
23070
+ var HarmonieTempAndPrecipPreset = function HarmonieTempAndPrecipPreset(_ref) {
23071
+ var layers = _ref.layers,
23072
+ _ref$multiLegend = _ref.multiLegend,
23073
+ multiLegend = _ref$multiLegend === void 0 ? false : _ref$multiLegend;
23074
+ var displayLayerManagerAndLegendButtonInAllTopRows = !useHasSyncGroupWithLayerActions(layers && layers.topRowSyncGroups);
23075
+ var displayLayerManagerAndLegendButtonInAllBottomRows = !useHasSyncGroupWithLayerActions(layers && layers.bottomRowSyncGroups);
23076
+ /* Get all the reference times for this layer */
23077
+
23078
+ var referenceTimes = useGetReferenceTimes(layers.topRow);
23079
+ if (referenceTimes.length === 0) return /*#__PURE__*/React.createElement("div", null, "Loading...");
23080
+ /* Helper to make a map layer prest */
23081
+
23082
+ var makeMapPreset = function makeMapPreset(referenceTime, uniqueId, layer, syncGroupsIds, col) {
23083
+ return {
23084
+ id: uniqueId,
23085
+ title: "Harmonie run ".concat("".concat(referenceTime.substring(8, 13).replace('T', ' / '))),
23086
+ bbox: {
23087
+ left: -450651.2255879827,
23088
+ bottom: 6490531.093143953,
23089
+ right: 1428345.8183648037,
23090
+ top: 7438773.776232235
23091
+ },
23092
+ srs: 'EPSG:3857',
23093
+ layers: [Object.assign(Object.assign({}, layer), {
23094
+ id: uniqueId,
23095
+ dimensions: [{
23096
+ name: 'reference_time',
23097
+ currentValue: referenceTime
23098
+ }]
23099
+ })],
23100
+ syncGroupsIds: syncGroupsIds,
23101
+ displayLayerManagerAndLegendButtonInMap: col === 0 || displayLayerManagerAndLegendButtonInAllTopRows,
23102
+ displayDimensionSelectButtonInMap: col === 0 || displayLayerManagerAndLegendButtonInAllBottomRows
23103
+ };
23104
+ };
23105
+ /* Make the preset */
23106
+
23107
+
23108
+ var nCols = 5;
23109
+ /* Add the harmonie air temperature layers with the different referencetimes */
23110
+
23111
+ var mapsTemperature = _toConsumableArray(Array(nCols)).map(function (_, index) {
23112
+ var refTime = referenceTimes[referenceTimes.length - nCols + index];
23113
+ return makeMapPreset(refTime, "harm_air".concat(index), layers.topRow, layers.topRowSyncGroups, index);
23114
+ });
23115
+ /* Add the harmonie precipitation layers with the different referencetimes */
23116
+
23117
+
23118
+ var mapsPrecipitation = _toConsumableArray(Array(nCols)).map(function (_, index) {
23119
+ var refTime = referenceTimes[referenceTimes.length - nCols + index];
23120
+ return makeMapPreset(refTime, "harm_precip".concat(index), layers.bottomRow, layers.bottomRowSyncGroups, index);
23121
+ });
23122
+
23123
+ var maps = mapsTemperature.concat(mapsPrecipitation);
23124
+ return /*#__PURE__*/React.createElement(MultiMapViewConnect, {
23125
+ rows: 2,
23126
+ cols: 5,
23127
+ maps: maps,
22343
23128
  multiLegend: multiLegend
22344
23129
  });
22345
23130
  };
@@ -22755,7 +23540,7 @@ var SyncGroupViewerConnect = function SyncGroupViewerConnect() {
22755
23540
  dispatch(actions.syncGroupRemoveTarget(payload));
22756
23541
  }, [dispatch]);
22757
23542
 
22758
- var _useSetupDialog = useSetupDialog('syncGroups'),
23543
+ var _useSetupDialog = useSetupDialog(DialogTypes.SyncGroups),
22759
23544
  dialogOrder = _useSetupDialog.dialogOrder,
22760
23545
  isDialogOpen = _useSetupDialog.isDialogOpen,
22761
23546
  onCloseDialog = _useSetupDialog.onCloseDialog,
@@ -22791,8 +23576,7 @@ var SyncGroupViewerConnect = function SyncGroupViewerConnect() {
22791
23576
  * Copyright 2020 - Finnish Meteorological Institute (FMI)
22792
23577
  * */
22793
23578
  var store = createStore({
22794
- initialState: {},
22795
- extensions: [getSagaExtension({})]
23579
+ extensions: [getSagaExtension()]
22796
23580
  });
22797
23581
 
22798
23582
  /* *
@@ -22973,9 +23757,7 @@ var SnackbarWrapper = function SnackbarWrapper(_a) {
22973
23757
  * Copyright 2022 - Koninklijk Nederlands Meteorologisch Instituut (KNMI)
22974
23758
  * Copyright 2022 - Finnish Meteorological Institute (FMI)
22975
23759
  * */
22976
- var SnackbarWrapperConnect = function SnackbarWrapperConnect(_a) {
22977
- var props = __rest(_a, []);
22978
-
23760
+ var SnackbarWrapperConnect = withEggs([snackbarModuleConfig])(function (props) {
22979
23761
  var dispatch = useDispatch();
22980
23762
 
22981
23763
  var onCloseSnackbar = function onCloseSnackbar() {
@@ -22985,15 +23767,13 @@ var SnackbarWrapperConnect = function SnackbarWrapperConnect(_a) {
22985
23767
  var currentSnackbarMessage = useSelector(function (store) {
22986
23768
  return getFirstSnackbarMessage(store);
22987
23769
  });
22988
- return /*#__PURE__*/React.createElement(DynamicModuleLoader, {
22989
- modules: [snackbarModuleConfig]
22990
- }, /*#__PURE__*/React.createElement(SnackbarWrapper, Object.assign({
23770
+ return /*#__PURE__*/React.createElement(SnackbarWrapper, Object.assign({
22991
23771
  isOpen: !!currentSnackbarMessage,
22992
23772
  onCloseSnackbar: onCloseSnackbar,
22993
23773
  message: currentSnackbarMessage ? currentSnackbarMessage.message : '',
22994
23774
  id: currentSnackbarMessage ? currentSnackbarMessage.id : ''
22995
- }, props)));
22996
- };
23775
+ }, props));
23776
+ });
22997
23777
 
22998
23778
  /* *
22999
23779
  * Licensed under the Apache License, Version 2.0 (the "License");
@@ -23025,6 +23805,13 @@ var CoreThemeProvider = function CoreThemeProvider(_ref) {
23025
23805
  theme: theme
23026
23806
  }, children);
23027
23807
  };
23808
+ var ThemeWrapperWithModules = withEggs(coreModuleConfig)(function (_ref2) {
23809
+ var theme = _ref2.theme,
23810
+ children = _ref2.children;
23811
+ return /*#__PURE__*/React__default.createElement(CoreThemeProvider, {
23812
+ theme: theme
23813
+ }, children, " ");
23814
+ });
23028
23815
  /**
23029
23816
  * A Provider component which provides the GeoWeb theme and store for the core.
23030
23817
  * Note: Should only be used with core components, as the provided store is only for core.
@@ -23032,18 +23819,16 @@ var CoreThemeProvider = function CoreThemeProvider(_ref) {
23032
23819
  * @returns
23033
23820
  */
23034
23821
 
23035
- var CoreThemeStoreProvider = function CoreThemeStoreProvider(_ref2) {
23036
- var children = _ref2.children,
23037
- _ref2$theme = _ref2.theme,
23038
- theme = _ref2$theme === void 0 ? lightTheme : _ref2$theme,
23039
- store = _ref2.store;
23822
+ var CoreThemeStoreProvider = function CoreThemeStoreProvider(_ref3) {
23823
+ var children = _ref3.children,
23824
+ _ref3$theme = _ref3.theme,
23825
+ theme = _ref3$theme === void 0 ? lightTheme : _ref3$theme,
23826
+ store = _ref3.store;
23040
23827
  return /*#__PURE__*/React__default.createElement(Provider, {
23041
23828
  store: store
23042
- }, /*#__PURE__*/React__default.createElement(DynamicModuleLoader, {
23043
- modules: coreModuleConfig
23044
- }, /*#__PURE__*/React__default.createElement(CoreThemeProvider, {
23829
+ }, /*#__PURE__*/React__default.createElement(ThemeWrapperWithModules, {
23045
23830
  theme: theme
23046
- }, /*#__PURE__*/React__default.createElement(SnackbarWrapperConnect, null, children))));
23831
+ }, /*#__PURE__*/React__default.createElement(SnackbarWrapperConnect, null, children)));
23047
23832
  };
23048
23833
 
23049
23834
  /* *