@opengeoweb/core 4.5.0 → 4.6.1

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 (46) hide show
  1. package/index.esm.js +1220 -391
  2. package/index.umd.js +1227 -362
  3. package/lib/components/ConfigurableMap/ConfigurableMapConnect.d.ts +1 -0
  4. package/lib/components/FeatureInfo/GetFeatureInfoButtonConnect.d.ts +8 -0
  5. package/lib/components/FeatureInfo/GetFeatureInfoButtonConnect.spec.d.ts +1 -0
  6. package/lib/components/FeatureInfo/GetFeatureInfoConnect.d.ts +8 -0
  7. package/lib/components/FeatureInfo/GetFeatureInfoConnect.spec.d.ts +1 -0
  8. package/lib/components/FeatureInfo/GetFeatureInfoDialog.d.ts +16 -0
  9. package/lib/components/FeatureInfo/GetFeatureInfoDialog.spec.d.ts +1 -0
  10. package/lib/components/FeatureInfo/index.d.ts +3 -0
  11. package/lib/components/FeatureInfo/utils.d.ts +17 -0
  12. package/lib/components/FeatureInfo/utils.spec.d.ts +1 -0
  13. package/lib/components/LayerManager/LayerSelect/LayerSelectUtils.d.ts +2 -2
  14. package/lib/components/LayerManager/LayerSelect/ServiceList/ServiceList.d.ts +2 -2
  15. package/lib/components/LayerManager/LayerSelect/ServiceOptionsDialog/ServiceOptionsDialog.d.ts +2 -2
  16. package/lib/components/LayerManager/LayerSelect/ServicePopup/ServicePopup.d.ts +2 -2
  17. package/lib/components/LayerManager/LayerSelect/ServicePopup/utils.d.ts +3 -3
  18. package/lib/components/MapWarning/MapWarningProperties.d.ts +1 -0
  19. package/lib/components/TimeSlider/TimeSlider.d.ts +1 -0
  20. package/lib/components/TimeSlider/TimeSliderButtons/AnimationLengthButton/AnimationLengthButton.d.ts +9 -0
  21. package/lib/components/TimeSlider/TimeSliderButtons/AnimationLengthButton/AnimationLengthButton.spec.d.ts +1 -0
  22. package/lib/components/TimeSlider/TimeSliderButtons/AnimationLengthButton/AnimationLengthButtonConnect.d.ts +6 -0
  23. package/lib/components/TimeSlider/TimeSliderButtons/AnimationLengthButton/AnimationLengthButtonConnect.spec.d.ts +1 -0
  24. package/lib/components/TimeSlider/TimeSliderButtons/OptionsMenuButton/OptionsMenu.d.ts +1 -0
  25. package/lib/components/TimeSlider/TimeSliderButtons/OptionsMenuButton/OptionsMenuButton.d.ts +6 -0
  26. package/lib/components/TimeSlider/TimeSliderCurrentTimeBox/TimeSliderCurrentTimeBox.d.ts +3 -2
  27. package/lib/components/TimeSlider/TimeSliderCurrentTimeBox/TimeSliderCurrentTimeBoxConnect.d.ts +4 -0
  28. package/lib/components/TimeSlider/TimeSliderCurrentTimeBox/TimeSliderCurrentTimeBoxMouseEvents.d.ts +2 -2
  29. package/lib/components/TimeSlider/TimeSliderLegend/TimeSliderLegend.d.ts +3 -0
  30. package/lib/components/TimeSlider/TimeSliderLegend/TimeSliderLegendConnect.d.ts +4 -0
  31. package/lib/components/TimeSlider/TimeSliderLegend/TimeSliderLegendUtils.d.ts +1 -0
  32. package/lib/hooks/useSetupDialog/useSetupDialog.d.ts +2 -0
  33. package/lib/index.d.ts +1 -3
  34. package/lib/store/layerSelect/reducer.d.ts +3 -1
  35. package/lib/store/layerSelect/selectors.d.ts +6 -39
  36. package/lib/store/layerSelect/types.d.ts +12 -20
  37. package/lib/store/layerSelect/utils.d.ts +5 -0
  38. package/lib/store/layerSelect/utils.spec.d.ts +1 -0
  39. package/lib/store/mapStore/map/reducer.d.ts +4 -8
  40. package/lib/store/mapStore/map/selectors.d.ts +21 -40
  41. package/lib/store/mapStore/map/types.d.ts +15 -14
  42. package/lib/store/ui/reducer.d.ts +5 -1
  43. package/lib/store/ui/selectors.d.ts +24 -0
  44. package/lib/store/ui/types.d.ts +12 -1
  45. package/lib/utils/testUtils.d.ts +1 -0
  46. package/package.json +10 -9
package/index.esm.js CHANGED
@@ -7,7 +7,7 @@ import _, { debounce, isEqual, groupBy, throttle, range } from 'lodash';
7
7
  import { takeLatest, put, select, call, takeEvery, all, delay } from 'redux-saga/effects';
8
8
  import { connect, useDispatch, useSelector, Provider } from 'react-redux';
9
9
  import { CustomTooltip, ToolButton, ToolContainerDraggable, IS_JEST, TooltipSelect, AlertIcon, useControlledTooltip, tooltipContainerStyles, sliderHeaderStyle, CustomSlider, ToggleMenu, ManagerButton, CustomAccordion, EnableButton, ManagerDeleteButton, AlertBanner, calculateDialogSizeAndPosition, useIsMounted, CustomToggleButton, useMakeSureContainerStaysInsideWindow, withEggs } from '@opengeoweb/shared';
10
- import { Pause, Play, Add, Copy, Flag, DragHandle as DragHandle$1, Cached, CollapseSmall, CollapseMedium, CollapseLarge, CollapseWindow, ExpandWindow, Filter, Search, Clear, Close, Info, DimensionsOther, DimensionsElevation, DimensionsRefTime, DimensionsTime, Edit, Visibility, Delete, Home, Minus, Layers, Equalizer, Link, LinkOff, AutoUpdateActive, AutoUpdateInActive, TextIcon, Speed, FastForward, Clock, Now, Options, StepForward, StepBackward, dragHandlePath, ChevronDown, ChevronUp, List as List$1, ChevronRight, ChevronLeft, Resize, ThemeWrapper, lightTheme } from '@opengeoweb/theme';
10
+ import { Pause, Play, Add, Copy, Both, None, DragHandle as DragHandle$1, Cached, CollapseSmall, CollapseMedium, CollapseLarge, CollapseWindow, ExpandWindow, Filter, Search, Clear, Close, Info, DimensionsOther, DimensionsElevation, DimensionsRefTime, DimensionsTime, Edit, Visibility, Delete, Home, Minus, Layers, Equalizer, Link, LinkOff, AutoUpdateActive, AutoUpdateInActive, TextIcon, Speed, FastForward, Clock, Now, Animation, Options, StepForward, StepBackward, dragHandlePath, ChevronDown, ChevronUp, List as List$1, ChevronRight, ChevronLeft, Resize, ExitDomain, ThemeWrapper, lightTheme } from '@opengeoweb/theme';
11
11
  import { Paper, Box, Typography, IconButton, Grid, MenuItem, Button, Popper, FormControl, InputLabel, List, ListItem, ListItemText, CircularProgress, ListSubheader, Dialog, DialogTitle, DialogContent, DialogContentText, TextField, DialogActions, LinearProgress, InputAdornment, Backdrop, ListItemSecondaryAction, ListItemIcon, Checkbox, Switch, styled, Slider, Menu, useTheme, Snackbar } from '@mui/material';
12
12
  import { legendImageStore, WMImageEventType, getLegendGraphicURLForLayer, WMGetServiceFromStore, LayerType as LayerType$1, clearImageCache, getMapImageStore, WMBBOX, debug, DebugType, WMJSMap, WMLayer } from '@opengeoweb/webmap';
13
13
  import { ReactSortable } from 'react-sortablejs';
@@ -25,6 +25,8 @@ import proj4 from 'proj4';
25
25
  import * as turf from '@turf/turf';
26
26
  import Draggable from 'react-draggable';
27
27
  import { Resizable } from 're-resizable';
28
+ import axios from 'axios';
29
+ import { useDebounce } from '@opengeoweb/api';
28
30
  import { createStore } from '@redux-eggs/redux-toolkit';
29
31
  import { getSagaExtension } from '@redux-eggs/saga-extension';
30
32
 
@@ -398,6 +400,19 @@ var Scale;
398
400
  Scale[Scale["DataScale"] = 8] = "DataScale";
399
401
  })(Scale || (Scale = {}));
400
402
 
403
+ var AnimationLength;
404
+
405
+ (function (AnimationLength) {
406
+ AnimationLength[AnimationLength["Minutes15"] = 15] = "Minutes15";
407
+ AnimationLength[AnimationLength["Minutes30"] = 30] = "Minutes30";
408
+ AnimationLength[AnimationLength["Hours1"] = 60] = "Hours1";
409
+ AnimationLength[AnimationLength["Hours2"] = 120] = "Hours2";
410
+ AnimationLength[AnimationLength["Hours3"] = 180] = "Hours3";
411
+ AnimationLength[AnimationLength["Hours6"] = 360] = "Hours6";
412
+ AnimationLength[AnimationLength["Hours12"] = 720] = "Hours12";
413
+ AnimationLength[AnimationLength["Hours24"] = 1440] = "Hours24";
414
+ })(AnimationLength || (AnimationLength = {}));
415
+
401
416
  var MapActionOrigin;
402
417
 
403
418
  (function (MapActionOrigin) {
@@ -591,6 +606,7 @@ var getLastTimeStepForLayerId = function getLastTimeStepForLayerId(layerId) {
591
606
  var types$2 = /*#__PURE__*/Object.freeze({
592
607
  __proto__: null,
593
608
  get Scale () { return Scale; },
609
+ get AnimationLength () { return AnimationLength; },
594
610
  get MapActionOrigin () { return MapActionOrigin; },
595
611
  get LayerType () { return LayerType; },
596
612
  get LayerStatus () { return LayerStatus; },
@@ -1964,7 +1980,9 @@ var createUIDialogElement = function createUIDialogElement(_ref) {
1964
1980
  activeMapId: activeMapId,
1965
1981
  isOpen: setOpen,
1966
1982
  type: type,
1967
- source: source
1983
+ source: source,
1984
+ isLoading: false,
1985
+ error: undefined
1968
1986
  };
1969
1987
  };
1970
1988
  var initialState$4 = {
@@ -2047,6 +2065,18 @@ var slice$4 = createSlice({
2047
2065
  setActiveWindowId: function setActiveWindowId(draft, action) {
2048
2066
  var activeWindowId = action.payload.activeWindowId;
2049
2067
  draft.activeWindowId = activeWindowId;
2068
+ },
2069
+ toggleIsLoadingDialog: function toggleIsLoadingDialog(draft, action) {
2070
+ var _action$payload3 = action.payload,
2071
+ isLoading = _action$payload3.isLoading,
2072
+ type = _action$payload3.type;
2073
+ draft.dialogs[type].isLoading = isLoading;
2074
+ },
2075
+ setErrorDialog: function setErrorDialog(draft, action) {
2076
+ var _action$payload4 = action.payload,
2077
+ error = _action$payload4.error,
2078
+ type = _action$payload4.type;
2079
+ draft.dialogs[type].error = error;
2050
2080
  }
2051
2081
  }
2052
2082
  });
@@ -2255,50 +2285,50 @@ var slice$3 = createSlice({
2255
2285
 
2256
2286
  draft.byId[mapId].animationDelay = animationDelay;
2257
2287
  },
2258
- setAnimationInterval: function setAnimationInterval(draft, action) {
2288
+ layerMoveLayer: function layerMoveLayer(draft, action) {
2259
2289
  var _action$payload9 = action.payload,
2260
- mapId = _action$payload9.mapId,
2261
- interval = _action$payload9.interval;
2290
+ oldIndex = _action$payload9.oldIndex,
2291
+ newIndex = _action$payload9.newIndex,
2292
+ mapId = _action$payload9.mapId;
2262
2293
 
2263
2294
  if (!draft.byId[mapId]) {
2264
2295
  return;
2265
2296
  }
2266
2297
 
2267
- draft.byId[mapId].timeStep = interval;
2298
+ draft.byId[mapId].mapLayers = moveArrayElements(draft.byId[mapId].mapLayers, oldIndex, newIndex);
2268
2299
  },
2269
- layerMoveLayer: function layerMoveLayer(draft, action) {
2300
+ setActiveLayerId: function setActiveLayerId(draft, action) {
2270
2301
  var _action$payload10 = action.payload,
2271
- oldIndex = _action$payload10.oldIndex,
2272
- newIndex = _action$payload10.newIndex,
2273
- mapId = _action$payload10.mapId;
2302
+ mapId = _action$payload10.mapId,
2303
+ layerId = _action$payload10.layerId;
2274
2304
 
2275
2305
  if (!draft.byId[mapId]) {
2276
2306
  return;
2277
2307
  }
2278
2308
 
2279
- draft.byId[mapId].mapLayers = moveArrayElements(draft.byId[mapId].mapLayers, oldIndex, newIndex);
2309
+ draft.byId[mapId].activeLayerId = layerId;
2280
2310
  },
2281
- setActiveLayerId: function setActiveLayerId(draft, action) {
2311
+ setTimeSliderCenterTime: function setTimeSliderCenterTime(draft, action) {
2282
2312
  var _action$payload11 = action.payload,
2283
2313
  mapId = _action$payload11.mapId,
2284
- layerId = _action$payload11.layerId;
2314
+ timeSliderCenterTime = _action$payload11.timeSliderCenterTime;
2285
2315
 
2286
2316
  if (!draft.byId[mapId]) {
2287
2317
  return;
2288
2318
  }
2289
2319
 
2290
- draft.byId[mapId].activeLayerId = layerId;
2320
+ draft.byId[mapId].timeSliderCenterTime = timeSliderCenterTime;
2291
2321
  },
2292
- setTimeSliderCenterTime: function setTimeSliderCenterTime(draft, action) {
2322
+ setTimeSliderUnfilteredSelectedTime: function setTimeSliderUnfilteredSelectedTime(draft, action) {
2293
2323
  var _action$payload12 = action.payload,
2294
2324
  mapId = _action$payload12.mapId,
2295
- timeSliderCenterTime = _action$payload12.timeSliderCenterTime;
2325
+ timeSliderUnfilteredSelectedTime = _action$payload12.timeSliderUnfilteredSelectedTime;
2296
2326
 
2297
2327
  if (!draft.byId[mapId]) {
2298
2328
  return;
2299
2329
  }
2300
2330
 
2301
- draft.byId[mapId].timeSliderCenterTime = timeSliderCenterTime;
2331
+ draft.byId[mapId].timeSliderUnfilteredSelectedTime = timeSliderUnfilteredSelectedTime;
2302
2332
  },
2303
2333
  setTimeSliderSecondsPerPx: function setTimeSliderSecondsPerPx(draft, action) {
2304
2334
  var _action$payload13 = action.payload,
@@ -2424,21 +2454,10 @@ var slice$3 = createSlice({
2424
2454
 
2425
2455
  draft.byId[mapId].activeMapPresetId = presetId;
2426
2456
  },
2427
- setIsMapPresetLoading: function setIsMapPresetLoading(draft, action) {
2457
+ setHasMapPresetChanges: function setHasMapPresetChanges(draft, action) {
2428
2458
  var _action$payload24 = action.payload,
2429
2459
  mapId = _action$payload24.mapId,
2430
- isLoading = _action$payload24.isLoading;
2431
-
2432
- if (!draft.byId[mapId]) {
2433
- return;
2434
- }
2435
-
2436
- draft.byId[mapId].isMapPresetLoading = isLoading;
2437
- },
2438
- setHasMapPresetChanges: function setHasMapPresetChanges(draft, action) {
2439
- var _action$payload25 = action.payload,
2440
- mapId = _action$payload25.mapId,
2441
- hasChanges = _action$payload25.hasChanges;
2460
+ hasChanges = _action$payload24.hasChanges;
2442
2461
 
2443
2462
  if (!draft.byId[mapId]) {
2444
2463
  return;
@@ -2446,21 +2465,10 @@ var slice$3 = createSlice({
2446
2465
 
2447
2466
  draft.byId[mapId].hasMapPresetChanges = hasChanges;
2448
2467
  },
2449
- setMapPresetError: function setMapPresetError(draft, action) {
2450
- var _action$payload26 = action.payload,
2451
- mapId = _action$payload26.mapId,
2452
- error = _action$payload26.error;
2453
-
2454
- if (!draft.byId[mapId]) {
2455
- return;
2456
- }
2457
-
2458
- draft.byId[mapId].mapPresetError = error;
2459
- },
2460
2468
  toggleDockedLayerManager: function toggleDockedLayerManager(draft, action) {
2461
- var _action$payload27 = action.payload,
2462
- mapId = _action$payload27.mapId,
2463
- openDockedLayerManager = _action$payload27.openDockedLayerManager;
2469
+ var _action$payload25 = action.payload,
2470
+ mapId = _action$payload25.mapId,
2471
+ openDockedLayerManager = _action$payload25.openDockedLayerManager;
2464
2472
 
2465
2473
  if (!draft.byId[mapId]) {
2466
2474
  return;
@@ -2473,9 +2481,9 @@ var slice$3 = createSlice({
2473
2481
  },
2474
2482
  extraReducers: function extraReducers(builder) {
2475
2483
  builder.addCase(addLayer$1, function (draft, action) {
2476
- var _action$payload28 = action.payload,
2477
- layerId = _action$payload28.layerId,
2478
- mapId = _action$payload28.mapId;
2484
+ var _action$payload26 = action.payload,
2485
+ layerId = _action$payload26.layerId,
2486
+ mapId = _action$payload26.mapId;
2479
2487
 
2480
2488
  if (!draft.byId[mapId]) {
2481
2489
  return;
@@ -2492,10 +2500,10 @@ var slice$3 = createSlice({
2492
2500
 
2493
2501
  draft.byId[mapId].mapLayers.unshift(layerId);
2494
2502
  }).addCase(addBaseLayer, function (draft, action) {
2495
- var _action$payload29 = action.payload,
2496
- layer = _action$payload29.layer,
2497
- layerId = _action$payload29.layerId,
2498
- mapId = _action$payload29.mapId;
2503
+ var _action$payload27 = action.payload,
2504
+ layer = _action$payload27.layer,
2505
+ layerId = _action$payload27.layerId,
2506
+ mapId = _action$payload27.mapId;
2499
2507
 
2500
2508
  if (!draft.byId[mapId]) {
2501
2509
  return;
@@ -2545,9 +2553,9 @@ var slice$3 = createSlice({
2545
2553
  }
2546
2554
  }
2547
2555
  }).addCase(setBaseLayers$1, function (draft, action) {
2548
- var _action$payload30 = action.payload,
2549
- layers = _action$payload30.layers,
2550
- mapId = _action$payload30.mapId; // Split into base and overlayers
2556
+ var _action$payload28 = action.payload,
2557
+ layers = _action$payload28.layers,
2558
+ mapId = _action$payload28.mapId; // Split into base and overlayers
2551
2559
 
2552
2560
  var baseLayers = [];
2553
2561
  var overLayers = [];
@@ -2574,9 +2582,9 @@ var slice$3 = createSlice({
2574
2582
  if (overLayerIds.length !== 0) draft.byId[mapId].overLayers = overLayerIds;
2575
2583
  }
2576
2584
  }).addCase(layerDelete$1, function (draft, action) {
2577
- var _action$payload31 = action.payload,
2578
- mapId = _action$payload31.mapId,
2579
- layerId = _action$payload31.layerId;
2585
+ var _action$payload29 = action.payload,
2586
+ mapId = _action$payload29.mapId,
2587
+ layerId = _action$payload29.layerId;
2580
2588
 
2581
2589
  if (!draft.byId[mapId]) {
2582
2590
  return;
@@ -2597,9 +2605,9 @@ var slice$3 = createSlice({
2597
2605
  draft.byId[mapId].activeLayerId = '';
2598
2606
  }
2599
2607
  }).addCase(baseLayerDelete, function (draft, action) {
2600
- var _action$payload32 = action.payload,
2601
- mapId = _action$payload32.mapId,
2602
- layerId = _action$payload32.layerId;
2608
+ var _action$payload30 = action.payload,
2609
+ mapId = _action$payload30.mapId,
2610
+ layerId = _action$payload30.layerId;
2603
2611
 
2604
2612
  if (!draft.byId[mapId]) {
2605
2613
  return;
@@ -2612,14 +2620,14 @@ var slice$3 = createSlice({
2612
2620
  return id !== layerId;
2613
2621
  });
2614
2622
  }).addCase(layerChangeDimension$1, function (draft, action) {
2615
- var _action$payload33 = action.payload,
2616
- layerId = _action$payload33.layerId,
2617
- dimension = _action$payload33.dimension;
2623
+ var _action$payload31 = action.payload,
2624
+ layerId = _action$payload31.layerId,
2625
+ dimension = _action$payload31.dimension;
2618
2626
  produceDraftStateSetMapDimensionFromLayerChangeDimension(draft, layerId, dimension);
2619
2627
  }).addCase(setTimeSync, function (draft, action) {
2620
- var _action$payload34 = action.payload,
2621
- targetsFromAction = _action$payload34.targets,
2622
- source = _action$payload34.source;
2628
+ var _action$payload32 = action.payload,
2629
+ targetsFromAction = _action$payload32.targets,
2630
+ source = _action$payload32.source;
2623
2631
  /* Because we want backwards compatibility with the previous code, we also need to listen to the original source action */
2624
2632
 
2625
2633
  var targets = [{
@@ -2643,9 +2651,9 @@ var slice$3 = createSlice({
2643
2651
  }
2644
2652
  });
2645
2653
  }).addCase(setBboxSync, function (draft, action) {
2646
- var _action$payload35 = action.payload,
2647
- targetsFromAction = _action$payload35.targets,
2648
- source = _action$payload35.source;
2654
+ var _action$payload33 = action.payload,
2655
+ targetsFromAction = _action$payload33.targets,
2656
+ source = _action$payload33.source;
2649
2657
  /* Because we want backwards compatibility with the previous code, we also need to listen to the original source action */
2650
2658
 
2651
2659
  var targets = [{
@@ -2676,9 +2684,9 @@ var slice$3 = createSlice({
2676
2684
  * These targets can be used as payloads in new Layer actions.
2677
2685
  * These actions are here handled via the layer reducer, as it is the same logic
2678
2686
  */
2679
- var _action$payload36 = action.payload,
2680
- targets = _action$payload36.targets,
2681
- source = _action$payload36.source;
2687
+ var _action$payload34 = action.payload,
2688
+ targets = _action$payload34.targets,
2689
+ source = _action$payload34.source;
2682
2690
  return targets.reduce(function (prevState, target) {
2683
2691
  var action = {
2684
2692
  payload: target,
@@ -2694,9 +2702,9 @@ var slice$3 = createSlice({
2694
2702
  var mapAction = mapActions$1.mapUpdateAllMapDimensions(mapDimensions);
2695
2703
  return reducer$3(draft, mapAction);
2696
2704
  }).addCase(mapChangeDimension, function (draft, action) {
2697
- var _action$payload37 = action.payload,
2698
- mapId = _action$payload37.mapId,
2699
- dimensionFromAction = _action$payload37.dimension;
2705
+ var _action$payload35 = action.payload,
2706
+ mapId = _action$payload35.mapId,
2707
+ dimensionFromAction = _action$payload35.dimension;
2700
2708
  produceDraftStateSetWebMapDimension(draft, mapId, dimensionFromAction, true);
2701
2709
  }).addCase(setMapPreset, function (draft, action) {
2702
2710
  var mapId = action.payload.mapId;
@@ -2719,9 +2727,9 @@ var slice$3 = createSlice({
2719
2727
  draft.byId[mapId].timeStep = defaultTimeStep;
2720
2728
  draft.byId[mapId].animationDelay = defaultAnimationDelayAtStart;
2721
2729
  }).addCase(uiActions.registerDialog, function (draft, action) {
2722
- var _action$payload38 = action.payload,
2723
- mapId = _action$payload38.mapId,
2724
- type = _action$payload38.type;
2730
+ var _action$payload36 = action.payload,
2731
+ mapId = _action$payload36.mapId,
2732
+ type = _action$payload36.type;
2725
2733
 
2726
2734
  if (!draft.byId[mapId]) {
2727
2735
  return;
@@ -3150,6 +3158,12 @@ var getActiveWindowId = function getActiveWindowId(store) {
3150
3158
 
3151
3159
  return (_a = store === null || store === void 0 ? void 0 : store.ui) === null || _a === void 0 ? void 0 : _a.activeWindowId;
3152
3160
  };
3161
+ var getDialogIsLoading = createSelector(getDialogDetailsByType, function (details) {
3162
+ return details && details.isLoading || false;
3163
+ });
3164
+ var getDialogError = createSelector(getDialogDetailsByType, function (details) {
3165
+ return details && details.error || '';
3166
+ });
3153
3167
 
3154
3168
  var selectors$1 = /*#__PURE__*/Object.freeze({
3155
3169
  __proto__: null,
@@ -3160,7 +3174,9 @@ var selectors$1 = /*#__PURE__*/Object.freeze({
3160
3174
  getDialogOrder: getDialogOrder,
3161
3175
  getDialogIsOrderedOnTop: getDialogIsOrderedOnTop,
3162
3176
  getDialogSource: getDialogSource,
3163
- getActiveWindowId: getActiveWindowId
3177
+ getActiveWindowId: getActiveWindowId,
3178
+ getDialogIsLoading: getDialogIsLoading,
3179
+ getDialogError: getDialogError
3164
3180
  });
3165
3181
 
3166
3182
  /* *
@@ -3969,6 +3985,19 @@ var getMapAnimationDelay = createSelector(getMapById, function (store) {
3969
3985
  var getMapTimeSliderCenterTime = createSelector(getMapById, function (store) {
3970
3986
  return store ? store.timeSliderCenterTime : moment().unix();
3971
3987
  });
3988
+ /**
3989
+ * Returns the unflitered selected time of time slider
3990
+ * This is not used to set the selected time itself, which is controlled by TimeBounds where values are rounded.
3991
+ *
3992
+ * Example: selectedTime = getTimeSliderUnfliteredSelectedTime(store, 'mapid_1')
3993
+ * @param {object} store store: object - store object
3994
+ * @param {string} mapId mapId: string - Id of the map
3995
+ * @returns {number} returnType: number - unfiltered selected time as a unix timestamp
3996
+ */
3997
+
3998
+ var getTimeSliderUnfilteredSelectedTime = createSelector(getMapById, function (store) {
3999
+ return store ? store.timeSliderUnfilteredSelectedTime : null;
4000
+ });
3972
4001
  /**
3973
4002
  * Returns the number of seconds per pixel on the time slider
3974
4003
  *
@@ -4275,18 +4304,6 @@ var getMapPreset = createSelector(getMapLayers, getMapBaseLayers, getMapOverLaye
4275
4304
  shouldShowLegend: shouldShowLegend
4276
4305
  });
4277
4306
  }, selectorMemoizationOptions);
4278
- /**
4279
- * Returns the loading state of the map preset
4280
- *
4281
- * Example getIsMapPresetLoading(store, mapId);
4282
- * @param {object} store store: object - store object
4283
- * @param {string} mapId mapId: string - Id of the map
4284
- * @returns {boolean} returnType: boolean
4285
- */
4286
-
4287
- var getIsMapPresetLoading = createSelector(getMapById, function (store) {
4288
- return store && store.isMapPresetLoading ? store.isMapPresetLoading : false;
4289
- });
4290
4307
  /**
4291
4308
  * Returns the has changes state of the map preset
4292
4309
  *
@@ -4299,18 +4316,6 @@ var getIsMapPresetLoading = createSelector(getMapById, function (store) {
4299
4316
  var getHasMapPresetChanges = createSelector(getMapById, function (store) {
4300
4317
  return store && store.hasMapPresetChanges ? store.hasMapPresetChanges : false;
4301
4318
  });
4302
- /**
4303
- * Returns the error state of the map preset
4304
- *
4305
- * Example getMapPresetError(store, mapId);
4306
- * @param {object} store store: object - store object
4307
- * @param {string} mapId mapId: string - Id of the map
4308
- * @returns {Error} returnType: string
4309
- */
4310
-
4311
- var getMapPresetError = createSelector(getMapById, function (store) {
4312
- return store === null || store === void 0 ? void 0 : store.mapPresetError;
4313
- });
4314
4319
  /**
4315
4320
  * Returns whether the docked layer manager is open
4316
4321
  *
@@ -4353,6 +4358,7 @@ var selectors = /*#__PURE__*/Object.freeze({
4353
4358
  getMapTimeStep: getMapTimeStep,
4354
4359
  getMapAnimationDelay: getMapAnimationDelay,
4355
4360
  getMapTimeSliderCenterTime: getMapTimeSliderCenterTime,
4361
+ getTimeSliderUnfilteredSelectedTime: getTimeSliderUnfilteredSelectedTime,
4356
4362
  getMapTimeSliderSecondsPerPx: getMapTimeSliderSecondsPerPx,
4357
4363
  getMapTimeSliderDataScaleToSecondsPerPx: getMapTimeSliderDataScaleToSecondsPerPx,
4358
4364
  isTimestepAuto: isTimestepAuto,
@@ -4372,9 +4378,7 @@ var selectors = /*#__PURE__*/Object.freeze({
4372
4378
  getActiveMapPresetId: getActiveMapPresetId,
4373
4379
  getLegendId: getLegendId,
4374
4380
  getMapPreset: getMapPreset,
4375
- getIsMapPresetLoading: getIsMapPresetLoading,
4376
4381
  getHasMapPresetChanges: getHasMapPresetChanges,
4377
- getMapPresetError: getMapPresetError,
4378
4382
  getIsDockedLayerManagerOpen: getIsDockedLayerManagerOpen
4379
4383
  });
4380
4384
 
@@ -4420,17 +4424,54 @@ var FilterType;
4420
4424
  FilterType["Group"] = "groups";
4421
4425
  })(FilterType || (FilterType = {}));
4422
4426
 
4427
+ /* *
4428
+ * Licensed under the Apache License, Version 2.0 (the "License");
4429
+ * you may not use this file except in compliance with the License.
4430
+ * You may obtain a copy of the License at
4431
+ *
4432
+ * http://www.apache.org/licenses/LICENSE-2.0
4433
+ *
4434
+ * Unless required by applicable law or agreed to in writing, software
4435
+ * distributed under the License is distributed on an "AS IS" BASIS,
4436
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
4437
+ * See the License for the specific language governing permissions and
4438
+ * limitations under the License.
4439
+ *
4440
+ * Copyright 2022 - Koninklijk Nederlands Meteorologisch Instituut (KNMI)
4441
+ * Copyright 2022 - Finnish Meteorological Institute (FMI)
4442
+ * */
4443
+ var getFilterId = function getFilterId(filterType, filterName) {
4444
+ return "".concat(filterType, "-").concat(filterName);
4445
+ };
4446
+ var produceFilters = function produceFilters(filterNames, filterType, draft, layerSelectFilterAdapter) {
4447
+ filterNames.forEach(function (filterName) {
4448
+ var id = getFilterId(filterType, filterName);
4449
+
4450
+ if (!draft.filters.filters.entities[id]) {
4451
+ // If this filter doesn't exit yet, add it
4452
+ layerSelectFilterAdapter.addOne(draft.filters.filters, {
4453
+ id: id,
4454
+ name: filterName,
4455
+ amount: 1,
4456
+ amountVisible: 1,
4457
+ checked: true,
4458
+ type: filterType
4459
+ });
4460
+ } else {
4461
+ // If it exists already, up the amounts
4462
+ draft.filters.filters.entities[id].amount += 1;
4463
+ draft.filters.filters.entities[id].amountVisible += 1;
4464
+ }
4465
+ });
4466
+ };
4467
+
4468
+ var layerSelectFilterAdapter = createEntityAdapter();
4469
+ var layerSelectActiveServicesAdapter = createEntityAdapter();
4423
4470
  var initialState$1 = {
4424
4471
  filters: {
4425
4472
  searchFilter: '',
4426
- activeServices: {
4427
- byId: {},
4428
- allIds: []
4429
- },
4430
- filters: {
4431
- byId: {},
4432
- allIds: []
4433
- }
4473
+ activeServices: layerSelectActiveServicesAdapter.getInitialState(),
4474
+ filters: layerSelectFilterAdapter.getInitialState()
4434
4475
  },
4435
4476
  allServicesEnabled: true,
4436
4477
  activeLayerInfo: {
@@ -4454,6 +4495,8 @@ var slice$1 = createSlice({
4454
4495
  draft.allServicesEnabled = allServicesEnabled;
4455
4496
  },
4456
4497
  addFiltersAndActiveServices: function addFiltersAndActiveServices(draft, action) {
4498
+ var _a, _b;
4499
+
4457
4500
  var _action$payload = action.payload,
4458
4501
  serviceId = _action$payload.serviceId,
4459
4502
  serviceName = _action$payload.serviceName,
@@ -4461,59 +4504,59 @@ var slice$1 = createSlice({
4461
4504
  _abstract = _action$payload["abstract"],
4462
4505
  keywords = _action$payload.keywords,
4463
4506
  scope = _action$payload.scope,
4464
- groups = _action$payload.groups;
4465
-
4466
- if (!draft.filters.activeServices.byId[serviceId]) {
4467
- draft.filters.activeServices.byId[serviceId] = {};
4468
-
4469
- var addFilters = function addFilters(filterNames, filterType) {
4470
- filterNames.forEach(function (filterName) {
4471
- var id = "".concat(filterType, "-").concat(filterName);
4472
-
4473
- if (!draft.filters.filters.byId[id]) {
4474
- draft.filters.filters.byId[id] = {
4475
- id: id,
4476
- name: filterName,
4477
- amount: 1,
4478
- amountVisible: 1,
4479
- checked: true,
4480
- type: filterType
4481
- };
4482
- draft.filters.filters.allIds.push(id);
4483
- } else {
4484
- draft.filters.filters.byId[id].amount += 1;
4485
- draft.filters.filters.byId[id].amountVisible += 1;
4486
- }
4487
- });
4507
+ groups = _action$payload.groups,
4508
+ isLoading = _action$payload.isLoading;
4509
+
4510
+ if (isLoading) {
4511
+ // If service is still loading, add without filters
4512
+ draft.filters.activeServices.entities[serviceId] = {
4513
+ serviceId: serviceId,
4514
+ enabled: draft.allServicesEnabled,
4515
+ filterIds: [],
4516
+ scope: scope,
4517
+ serviceName: serviceName,
4518
+ serviceUrl: serviceUrl,
4519
+ "abstract": _abstract,
4520
+ isLoading: isLoading
4488
4521
  };
4522
+ }
4523
+
4524
+ if (!isLoading) {
4525
+ // If service is done loading, add with filters
4526
+ if (!((_b = (_a = draft.filters.activeServices.entities[serviceId]) === null || _a === void 0 ? void 0 : _a.filterIds) === null || _b === void 0 ? void 0 : _b.length)) {
4527
+ // If the service has no filters yet, add them
4528
+ produceFilters(groups, FilterType.Group, draft, layerSelectFilterAdapter);
4529
+ produceFilters(keywords, FilterType.Keyword, draft, layerSelectFilterAdapter);
4530
+ }
4489
4531
 
4490
- addFilters(groups, FilterType.Group);
4491
- addFilters(keywords, FilterType.Keyword);
4532
+ var filterIds = groups.map(function (group) {
4533
+ return getFilterId(FilterType.Group, group);
4534
+ }).concat(keywords.map(function (keyword) {
4535
+ return getFilterId(FilterType.Keyword, keyword);
4536
+ }));
4537
+ draft.filters.activeServices.entities[serviceId] = {
4538
+ serviceId: serviceId,
4539
+ enabled: draft.allServicesEnabled,
4540
+ filterIds: filterIds,
4541
+ scope: scope,
4542
+ serviceName: serviceName,
4543
+ serviceUrl: serviceUrl,
4544
+ "abstract": _abstract,
4545
+ isLoading: isLoading
4546
+ };
4492
4547
  }
4493
4548
 
4494
- var filterIds = groups.map(function (group) {
4495
- return "".concat(FilterType.Group, "-").concat(group);
4496
- }).concat(keywords.map(function (keyword) {
4497
- return "".concat(FilterType.Keyword, "-").concat(keyword);
4498
- }));
4499
- draft.filters.activeServices.byId[serviceId] = {
4500
- serviceId: serviceId,
4501
- enabled: draft.allServicesEnabled,
4502
- filterIds: filterIds,
4503
- scope: scope,
4504
- serviceName: serviceName,
4505
- serviceUrl: serviceUrl,
4506
- "abstract": _abstract
4507
- };
4508
- if (!draft.filters.activeServices.allIds.includes(serviceId)) draft.filters.activeServices.allIds.push(serviceId);
4549
+ if (!draft.filters.activeServices.ids.includes(serviceId)) {
4550
+ draft.filters.activeServices.ids.push(serviceId);
4551
+ }
4509
4552
  },
4510
4553
  layerSelectRemoveService: function layerSelectRemoveService(draft, action) {
4511
4554
  var serviceId = action.payload.serviceId; // 1. Find a service that is to be removed
4512
4555
 
4513
- var foundService = draft.filters.activeServices.byId[serviceId]; // 2. Go through all keywords for removed service, and decrement the amount of all found keywords
4556
+ var foundService = draft.filters.activeServices.entities[serviceId]; // 2. Go through all keywords for removed service, and decrement the amount of all found keywords
4514
4557
 
4515
4558
  foundService.filterIds.forEach(function (filterId) {
4516
- var foundObject = draft.filters.filters.byId[filterId];
4559
+ var foundObject = draft.filters.filters.entities[filterId];
4517
4560
 
4518
4561
  if (foundObject && foundObject.amount) {
4519
4562
  foundObject.amount -= 1;
@@ -4521,23 +4564,20 @@ var slice$1 = createSlice({
4521
4564
  }
4522
4565
 
4523
4566
  if (foundObject && foundObject.amount === 0) {
4524
- delete draft.filters.filters.byId[filterId];
4525
- draft.filters.filters.allIds = draft.filters.filters.allIds.filter(function (serviceId) {
4567
+ delete draft.filters.filters.entities[filterId];
4568
+ draft.filters.filters.ids = draft.filters.filters.ids.filter(function (serviceId) {
4526
4569
  return serviceId !== filterId;
4527
4570
  });
4528
4571
  }
4529
4572
  }); // Finally remove object from activeServices, so if the service is added again later on, new object and keywords will be re-added
4530
4573
 
4531
- delete draft.filters.activeServices.byId[serviceId];
4532
- draft.filters.activeServices.allIds = draft.filters.activeServices.allIds.filter(function (id) {
4533
- return id !== serviceId;
4534
- });
4574
+ layerSelectActiveServicesAdapter.removeOne(draft.filters.activeServices, serviceId);
4535
4575
  },
4536
4576
  enableActiveService: function enableActiveService(draft, action) {
4537
4577
  var _action$payload2 = action.payload,
4538
4578
  serviceId = _action$payload2.serviceId,
4539
4579
  keywords = _action$payload2.filters;
4540
- draft.filters.activeServices.byId[serviceId].enabled = true;
4580
+ draft.filters.activeServices.entities[serviceId].enabled = true;
4541
4581
 
4542
4582
  var _iterator = _createForOfIteratorHelper(keywords),
4543
4583
  _step;
@@ -4545,7 +4585,7 @@ var slice$1 = createSlice({
4545
4585
  try {
4546
4586
  for (_iterator.s(); !(_step = _iterator.n()).done;) {
4547
4587
  var keyword = _step.value;
4548
- draft.filters.filters.byId[keyword].amountVisible += 1;
4588
+ draft.filters.filters.entities[keyword].amountVisible += 1;
4549
4589
  }
4550
4590
  } catch (err) {
4551
4591
  _iterator.e(err);
@@ -4557,7 +4597,7 @@ var slice$1 = createSlice({
4557
4597
  var _action$payload3 = action.payload,
4558
4598
  serviceId = _action$payload3.serviceId,
4559
4599
  keywords = _action$payload3.filters;
4560
- draft.filters.activeServices.byId[serviceId].enabled = false;
4600
+ draft.filters.activeServices.entities[serviceId].enabled = false;
4561
4601
 
4562
4602
  var _iterator2 = _createForOfIteratorHelper(keywords),
4563
4603
  _step2;
@@ -4565,7 +4605,7 @@ var slice$1 = createSlice({
4565
4605
  try {
4566
4606
  for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {
4567
4607
  var keyword = _step2.value;
4568
- draft.filters.filters.byId[keyword].amountVisible -= 1;
4608
+ draft.filters.filters.entities[keyword].amountVisible -= 1;
4569
4609
  }
4570
4610
  } catch (err) {
4571
4611
  _iterator2.e(err);
@@ -4576,15 +4616,15 @@ var slice$1 = createSlice({
4576
4616
  toggleFilter: function toggleFilter(draft, action) {
4577
4617
  var filterIds = action.payload.filterIds;
4578
4618
  filterIds.forEach(function (filterId) {
4579
- draft.filters.filters.byId[filterId].checked = !draft.filters.filters.byId[filterId].checked;
4619
+ draft.filters.filters.entities[filterId].checked = !draft.filters.filters.entities[filterId].checked;
4580
4620
  });
4581
4621
  },
4582
4622
  enableOnlyOneFilter: function enableOnlyOneFilter(draft, action) {
4583
4623
  var filterId = action.payload.filterId;
4584
- draft.filters.filters.allIds.forEach(function (filterId) {
4585
- draft.filters.filters.byId[filterId].checked = false;
4624
+ draft.filters.filters.ids.forEach(function (filterId) {
4625
+ draft.filters.filters.entities[filterId].checked = false;
4586
4626
  });
4587
- draft.filters.filters.byId[filterId].checked = true;
4627
+ draft.filters.filters.entities[filterId].checked = true;
4588
4628
  },
4589
4629
  setActiveLayerInfo: function setActiveLayerInfo(draft, action) {
4590
4630
  var layer = action.payload.layer;
@@ -4680,21 +4720,32 @@ var layerSelectStore = function layerSelectStore(store) {
4680
4720
 
4681
4721
 
4682
4722
  var getSearchFilter = createSelector(layerSelectStore, function (store) {
4683
- return store ? store.filters.searchFilter : '';
4723
+ var _a;
4724
+
4725
+ return ((_a = store === null || store === void 0 ? void 0 : store.filters) === null || _a === void 0 ? void 0 : _a.searchFilter) || '';
4684
4726
  });
4685
4727
  /**
4686
4728
  * Returns active services array
4687
4729
  *
4688
4730
  * Example getActiveServices(store);
4689
4731
  * @param {object} store store: object - store object
4690
- * @returns {object} returnType: object of active services
4732
+ * @returns {ActiveServiceObjectEntities} returnType: ActiveServiceObjectEntitiesobject of active services
4691
4733
  */
4734
+ // cast to usable type - selectEntities returns Dictionary<ActiveServiceObject> which is not usable inside of the code
4692
4735
 
4693
- var getActiveServices = createSelector(layerSelectStore, function (store) {
4694
- var _a;
4736
+ var getActiveServices = function getActiveServices(store) {
4737
+ return getActiveServicesDictionary(store);
4738
+ };
4695
4739
 
4696
- return store ? (_a = store === null || store === void 0 ? void 0 : store.filters) === null || _a === void 0 ? void 0 : _a.activeServices.byId : {};
4697
- }, selectorMemoizationOptions);
4740
+ var _layerSelectActiveSer = layerSelectActiveServicesAdapter.getSelectors(function (store) {
4741
+ var _a, _b;
4742
+
4743
+ return ((_b = (_a = store === null || store === void 0 ? void 0 : store.layerSelect) === null || _a === void 0 ? void 0 : _a.filters) === null || _b === void 0 ? void 0 : _b.activeServices) || {
4744
+ entities: {},
4745
+ ids: []
4746
+ };
4747
+ }),
4748
+ getActiveServicesDictionary = _layerSelectActiveSer.selectEntities;
4698
4749
  /**
4699
4750
  * Returns active services by id
4700
4751
  *
@@ -4704,10 +4755,11 @@ var getActiveServices = createSelector(layerSelectStore, function (store) {
4704
4755
  * @returns {object} returnType: object of active service
4705
4756
  */
4706
4757
 
4758
+
4707
4759
  var getActiveServiceById = function getActiveServiceById(store, serviceId) {
4708
- var _a, _b;
4760
+ var _a, _b, _c;
4709
4761
 
4710
- var enabledServices = ((_b = (_a = store === null || store === void 0 ? void 0 : store.layerSelect) === null || _a === void 0 ? void 0 : _a.filters) === null || _b === void 0 ? void 0 : _b.activeServices.byId[serviceId]) || {};
4762
+ var enabledServices = ((_c = (_b = (_a = store === null || store === void 0 ? void 0 : store.layerSelect) === null || _a === void 0 ? void 0 : _a.filters) === null || _b === void 0 ? void 0 : _b.activeServices) === null || _c === void 0 ? void 0 : _c.entities[serviceId]) || {};
4711
4763
  return enabledServices;
4712
4764
  };
4713
4765
  /**
@@ -4721,10 +4773,10 @@ var getActiveServiceById = function getActiveServiceById(store, serviceId) {
4721
4773
  var getEnabledServiceIds = createSelector(layerSelectStore, function (store) {
4722
4774
  var _a, _b;
4723
4775
 
4724
- var enabledServices = (_b = (_a = store === null || store === void 0 ? void 0 : store.filters) === null || _a === void 0 ? void 0 : _a.activeServices.allIds.filter(function (serviceId) {
4725
- var _a;
4776
+ var enabledServices = (_b = (_a = store === null || store === void 0 ? void 0 : store.filters) === null || _a === void 0 ? void 0 : _a.activeServices.ids.filter(function (serviceId) {
4777
+ var _a, _b, _c;
4726
4778
 
4727
- return (_a = store === null || store === void 0 ? void 0 : store.filters) === null || _a === void 0 ? void 0 : _a.activeServices.byId[serviceId].enabled;
4779
+ return (_c = (_b = (_a = store === null || store === void 0 ? void 0 : store.filters) === null || _a === void 0 ? void 0 : _a.activeServices) === null || _b === void 0 ? void 0 : _b.entities[serviceId]) === null || _c === void 0 ? void 0 : _c.enabled;
4728
4780
  })) !== null && _b !== void 0 ? _b : [];
4729
4781
  return enabledServices;
4730
4782
  }, selectorMemoizationOptions);
@@ -4737,17 +4789,17 @@ var getEnabledServiceIds = createSelector(layerSelectStore, function (store) {
4737
4789
  */
4738
4790
 
4739
4791
  var getCheckedFilterIds = createSelector(layerSelectStore, function (store) {
4740
- var _a, _b;
4792
+ var _a, _b, _c;
4741
4793
 
4742
- var checkedFilters = (_b = (_a = store === null || store === void 0 ? void 0 : store.filters) === null || _a === void 0 ? void 0 : _a.filters.allIds.filter(function (filterId) {
4743
- var _a, _b;
4794
+ var checkedFilters = (_c = (_b = (_a = store === null || store === void 0 ? void 0 : store.filters) === null || _a === void 0 ? void 0 : _a.filters) === null || _b === void 0 ? void 0 : _b.ids.filter(function (filterId) {
4795
+ var _a, _b, _c;
4744
4796
 
4745
- return (_b = (_a = store === null || store === void 0 ? void 0 : store.filters) === null || _a === void 0 ? void 0 : _a.filters.byId[filterId]) === null || _b === void 0 ? void 0 : _b.checked;
4746
- })) !== null && _b !== void 0 ? _b : [];
4797
+ return (_c = (_b = (_a = store === null || store === void 0 ? void 0 : store.filters) === null || _a === void 0 ? void 0 : _a.filters) === null || _b === void 0 ? void 0 : _b.entities[filterId]) === null || _c === void 0 ? void 0 : _c.checked;
4798
+ })) !== null && _c !== void 0 ? _c : [];
4747
4799
  return checkedFilters.map(function (filterId) {
4748
- var _a;
4800
+ var _a, _b, _c;
4749
4801
 
4750
- return (_a = store === null || store === void 0 ? void 0 : store.filters) === null || _a === void 0 ? void 0 : _a.filters.byId[filterId].id;
4802
+ return (_c = (_b = (_a = store === null || store === void 0 ? void 0 : store.filters) === null || _a === void 0 ? void 0 : _a.filters) === null || _b === void 0 ? void 0 : _b.entities[filterId]) === null || _c === void 0 ? void 0 : _c.id;
4751
4803
  });
4752
4804
  }, selectorMemoizationOptions);
4753
4805
  /**
@@ -4757,12 +4809,21 @@ var getCheckedFilterIds = createSelector(layerSelectStore, function (store) {
4757
4809
  * @param {object} store store: object - store object
4758
4810
  * @returns {array} returnType: array of all keyword ids
4759
4811
  */
4812
+ // cast to usable type - selectIds returns EntityId[] which is not usable inside of the code
4760
4813
 
4761
- var getAllFilterIds = createSelector(layerSelectStore, function (store) {
4814
+ var getAllFilterIds = function getAllFilterIds(store) {
4815
+ return getAllFilterIdsEntity(store);
4816
+ };
4817
+
4818
+ var _layerSelectFilterAda = layerSelectFilterAdapter.getSelectors(function (store) {
4762
4819
  var _a, _b;
4763
4820
 
4764
- return (_b = (_a = store === null || store === void 0 ? void 0 : store.filters) === null || _a === void 0 ? void 0 : _a.filters.allIds) !== null && _b !== void 0 ? _b : [];
4765
- }, selectorMemoizationOptions);
4821
+ return ((_b = (_a = store === null || store === void 0 ? void 0 : store.layerSelect) === null || _a === void 0 ? void 0 : _a.filters) === null || _b === void 0 ? void 0 : _b.filters) || {
4822
+ entities: {},
4823
+ ids: []
4824
+ };
4825
+ }),
4826
+ getAllFilterIdsEntity = _layerSelectFilterAda.selectIds;
4766
4827
  /**
4767
4828
  * Returns all filters
4768
4829
  *
@@ -4771,40 +4832,43 @@ var getAllFilterIds = createSelector(layerSelectStore, function (store) {
4771
4832
  * @returns {array} returnType: array of all filters
4772
4833
  */
4773
4834
 
4774
- var getAllFilters = createSelector(layerSelectStore, function (store) {
4775
- var filters = store === null || store === void 0 ? void 0 : store.filters.filters.byId;
4776
-
4777
- if (filters) {
4778
- return Object.values(filters);
4779
- }
4780
4835
 
4781
- return [];
4782
- });
4783
- /**
4784
- * Returns if all keywords are checked
4785
- *
4786
- * Example isAllKeywordsChecked(store);
4787
- * @param {object} store store: object - store object
4788
- * @returns {array} returnType: boolean if all keywords are checked
4789
- */
4836
+ var _layerSelectFilterAda2 = layerSelectFilterAdapter.getSelectors(function (store) {
4837
+ var _a, _b;
4790
4838
 
4839
+ return ((_b = (_a = store === null || store === void 0 ? void 0 : store.layerSelect) === null || _a === void 0 ? void 0 : _a.filters) === null || _b === void 0 ? void 0 : _b.filters) || {
4840
+ entities: {},
4841
+ ids: []
4842
+ };
4843
+ }),
4844
+ getAllFilters = _layerSelectFilterAda2.selectAll;
4791
4845
  var isAllFiltersChecked = createSelector(layerSelectStore, function (store) {
4792
4846
  var _a, _b;
4793
4847
 
4794
- return (_b = (_a = store === null || store === void 0 ? void 0 : store.filters) === null || _a === void 0 ? void 0 : _a.filters) === null || _b === void 0 ? void 0 : _b.allIds.every(function (filterId) {
4848
+ return (_b = (_a = store === null || store === void 0 ? void 0 : store.filters) === null || _a === void 0 ? void 0 : _a.filters) === null || _b === void 0 ? void 0 : _b.ids.every(function (filterId) {
4795
4849
  var _a, _b, _c;
4796
4850
 
4797
- return (_c = (_b = (_a = store === null || store === void 0 ? void 0 : store.filters) === null || _a === void 0 ? void 0 : _a.filters) === null || _b === void 0 ? void 0 : _b.byId[filterId]) === null || _c === void 0 ? void 0 : _c.checked;
4851
+ return (_c = (_b = (_a = store === null || store === void 0 ? void 0 : store.filters) === null || _a === void 0 ? void 0 : _a.filters) === null || _b === void 0 ? void 0 : _b.entities[filterId]) === null || _c === void 0 ? void 0 : _c.checked;
4798
4852
  });
4799
4853
  });
4800
4854
  /**
4801
- * Returns the active layer info
4855
+ * Gets a KeywordObject by its id
4802
4856
  *
4803
- * Example getActiveLayerInfo(store);
4804
- * @param {object} store store: object - store object
4805
- * @returns {object} returnType: ActiveLayerObject
4857
+ * Example: keywordObject = getKeywordObjectById(store, 'keywordId')
4858
+ * @param {object} store object from which the keyword state will be extracted
4859
+ * @param {string} filterId Id of the keyword
4860
+ * @returns {object} object containing keyword information (id, amount, amountVisible, checked)
4806
4861
  */
4807
4862
 
4863
+ var _layerSelectFilterAda3 = layerSelectFilterAdapter.getSelectors(function (store) {
4864
+ var _a, _b;
4865
+
4866
+ return ((_b = (_a = store === null || store === void 0 ? void 0 : store.layerSelect) === null || _a === void 0 ? void 0 : _a.filters) === null || _b === void 0 ? void 0 : _b.filters) || {
4867
+ entities: {},
4868
+ ids: []
4869
+ };
4870
+ });
4871
+ _layerSelectFilterAda3.selectById;
4808
4872
  var getActiveLayerInfo = createSelector(layerSelectStore, function (store) {
4809
4873
  return store === null || store === void 0 ? void 0 : store.activeLayerInfo;
4810
4874
  });
@@ -8149,9 +8213,9 @@ function setMapPresetSaga(_ref6) {
8149
8213
  }
8150
8214
 
8151
8215
  _context8.next = 42;
8152
- return put(mapActions$1.setAnimationInterval({
8216
+ return put(mapActions$1.setTimeStep({
8153
8217
  mapId: mapId,
8154
- interval: interval
8218
+ timeStep: interval
8155
8219
  }));
8156
8220
 
8157
8221
  case 42:
@@ -8481,7 +8545,8 @@ function newServiceAddedSaga(capturedAction) {
8481
8545
  keywords: keywords,
8482
8546
  scope: scope,
8483
8547
  groups: groups,
8484
- "abstract": _abstract
8548
+ "abstract": _abstract,
8549
+ isLoading: false
8485
8550
  }));
8486
8551
 
8487
8552
  case 8:
@@ -8606,7 +8671,7 @@ function layerSelectRemoveServiceSaga(capturedAction) {
8606
8671
  results = _context3.sent;
8607
8672
  services = results;
8608
8673
  servicesEnabled = Object.values(services).find(function (service) {
8609
- return service.enabled;
8674
+ return service === null || service === void 0 ? void 0 : service.enabled;
8610
8675
  });
8611
8676
 
8612
8677
  if (!(servicesEnabled === undefined)) {
@@ -8622,7 +8687,7 @@ function layerSelectRemoveServiceSaga(capturedAction) {
8622
8687
 
8623
8688
  return put(layerSelectActions.enableActiveService({
8624
8689
  serviceId: serviceId,
8625
- filters: service.filterIds
8690
+ filters: service === null || service === void 0 ? void 0 : service.filterIds
8626
8691
  }));
8627
8692
  }));
8628
8693
 
@@ -9379,7 +9444,7 @@ var RenderLayers = function RenderLayers(_ref) {
9379
9444
  }));
9380
9445
  };
9381
9446
 
9382
- var marks$2 = [{
9447
+ var marks$3 = [{
9383
9448
  value: 0,
9384
9449
  label: '0 %'
9385
9450
  }, {
@@ -9517,7 +9582,7 @@ var OpacitySelect = function OpacitySelect(_ref) {
9517
9582
  step: 0.01,
9518
9583
  max: 1,
9519
9584
  min: 0,
9520
- marks: marks$2,
9585
+ marks: marks$3,
9521
9586
  onChange: function onChange(event, newValue) {
9522
9587
  event.stopPropagation();
9523
9588
  onLayerChangeOpacity(newValue);
@@ -9695,7 +9760,9 @@ var ActivateLayer = function ActivateLayer(_ref) {
9695
9760
  return /*#__PURE__*/React.createElement(ManagerButton, {
9696
9761
  tooltipTitle: tooltipTitle,
9697
9762
  onClick: onClick,
9698
- icon: /*#__PURE__*/React.createElement(Flag, {
9763
+ icon: isActive ? /*#__PURE__*/React.createElement(Both, {
9764
+ sx: iconStyle
9765
+ }) : /*#__PURE__*/React.createElement(None, {
9699
9766
  sx: iconStyle
9700
9767
  }),
9701
9768
  testId: id,
@@ -11767,6 +11834,9 @@ var HeaderOptions = function HeaderOptions(_ref) {
11767
11834
  onClick: function onClick() {
11768
11835
  return onChangeSize(sizeSmall);
11769
11836
  },
11837
+ onTouchEnd: function onTouchEnd() {
11838
+ return onChangeSize(sizeSmall);
11839
+ },
11770
11840
  sx: iconStyle,
11771
11841
  className: "collapseSmall-btn"
11772
11842
  }, /*#__PURE__*/React.createElement(CollapseSmall, null))), /*#__PURE__*/React.createElement(CustomTooltip, {
@@ -11777,6 +11847,9 @@ var HeaderOptions = function HeaderOptions(_ref) {
11777
11847
  onClick: function onClick() {
11778
11848
  return onChangeSize(sizeMedium);
11779
11849
  },
11850
+ onTouchEnd: function onTouchEnd() {
11851
+ return onChangeSize(sizeMedium);
11852
+ },
11780
11853
  sx: iconStyle,
11781
11854
  className: "collapseMedium-btn"
11782
11855
  }, /*#__PURE__*/React.createElement(CollapseMedium, null))), /*#__PURE__*/React.createElement(CustomTooltip, {
@@ -11787,6 +11860,9 @@ var HeaderOptions = function HeaderOptions(_ref) {
11787
11860
  onClick: function onClick() {
11788
11861
  return onChangeSize(sizeLarge);
11789
11862
  },
11863
+ onTouchEnd: function onTouchEnd() {
11864
+ return onChangeSize(sizeLarge);
11865
+ },
11790
11866
  sx: iconStyle,
11791
11867
  className: "collapseLarge-btn"
11792
11868
  }, /*#__PURE__*/React.createElement(CollapseLarge, null))), /*#__PURE__*/React.createElement(CustomTooltip, {
@@ -11798,6 +11874,9 @@ var HeaderOptions = function HeaderOptions(_ref) {
11798
11874
  sx: iconStyle,
11799
11875
  onClick: function onClick() {
11800
11876
  return onClickDockButton();
11877
+ },
11878
+ onTouchEnd: function onTouchEnd() {
11879
+ return onClickDockButton();
11801
11880
  }
11802
11881
  }, isDockedLayerManager ? /*#__PURE__*/React.createElement(CollapseWindow, {
11803
11882
  "data-testid": "dockedLayerManager-collapse"
@@ -11914,7 +11993,11 @@ var LayerManager = function LayerManager(_ref) {
11914
11993
  setSize(dragSize);
11915
11994
  }
11916
11995
  }
11917
- }, /*#__PURE__*/React.createElement(Box, null, isLoading && /*#__PURE__*/React.createElement(LinearProgress, {
11996
+ }, /*#__PURE__*/React.createElement(Box, {
11997
+ onKeyDown: function onKeyDown(event) {
11998
+ event.stopPropagation();
11999
+ }
12000
+ }, isLoading && /*#__PURE__*/React.createElement(LinearProgress, {
11918
12001
  "data-testid": "loading-bar",
11919
12002
  color: "secondary",
11920
12003
  sx: {
@@ -12021,12 +12104,20 @@ var useSetupDialog = function useSetupDialog(dialogType) {
12021
12104
  var isDialogOpen = useSelector(function (store) {
12022
12105
  return getisDialogOpen(store, dialogType);
12023
12106
  });
12107
+ var uiIsLoading = useSelector(function (store) {
12108
+ return getDialogIsLoading(store, dialogType);
12109
+ });
12110
+ var uiError = useSelector(function (store) {
12111
+ return getDialogError(store, dialogType);
12112
+ });
12024
12113
  return {
12025
12114
  setDialogOrder: setDialogOrder,
12026
12115
  dialogOrder: dialogOrder,
12027
12116
  onCloseDialog: onCloseDialog,
12028
12117
  uiSource: uiSource,
12029
- isDialogOpen: isDialogOpen
12118
+ isDialogOpen: isDialogOpen,
12119
+ uiIsLoading: uiIsLoading,
12120
+ uiError: uiError
12030
12121
  };
12031
12122
  };
12032
12123
 
@@ -12043,18 +12134,36 @@ var useFetchServices = function useFetchServices(dialogType) {
12043
12134
  var serviceSetLayers = React.useCallback(function (payload) {
12044
12135
  dispatch(serviceActions.serviceSetLayers(payload));
12045
12136
  }, [dispatch]);
12137
+ var addFiltersAndActiveServices = React.useCallback(function (payload) {
12138
+ dispatch(layerSelectActions.addFiltersAndActiveServices(payload));
12139
+ }, [dispatch]);
12046
12140
  React.useEffect(function () {
12047
12141
  if (isOpenInStore && preloadedServices && preloadedServices.length > 0) {
12048
12142
  mergePresetsAndUserAddedServices(preloadedServices, getUserAddedServices()).forEach(function (service) {
12143
+ var wmService = WMGetServiceFromStore(service.url);
12144
+ var scope = service.scope ? service.scope : 'system';
12145
+
12146
+ if (isMounted.current) {
12147
+ addFiltersAndActiveServices({
12148
+ serviceId: wmService.id,
12149
+ serviceName: service.name,
12150
+ serviceUrl: service.url,
12151
+ keywords: [],
12152
+ scope: scope,
12153
+ groups: [],
12154
+ "abstract": service["abstract"] || wmService["abstract"],
12155
+ isLoading: true
12156
+ });
12157
+ }
12158
+
12049
12159
  getLayersFlattenedFromService(service.url).then(function (layers) {
12050
12160
  if (isMounted.current) {
12051
- var wmService = WMGetServiceFromStore(service.url);
12052
12161
  serviceSetLayers({
12053
12162
  id: wmService.id,
12054
12163
  name: service.name,
12055
12164
  serviceUrl: service.url,
12056
12165
  layers: layers,
12057
- scope: service.scope ? service.scope : 'system',
12166
+ scope: scope,
12058
12167
  // first try to load the user abstract, otherwise the service abstract
12059
12168
  "abstract": service["abstract"] || wmService["abstract"]
12060
12169
  });
@@ -12063,9 +12172,8 @@ var useFetchServices = function useFetchServices(dialogType) {
12063
12172
  return null;
12064
12173
  });
12065
12174
  });
12066
- } // eslint-disable-next-line react-hooks/exhaustive-deps
12067
-
12068
- }, [isOpenInStore, preloadedServices, serviceSetLayers]);
12175
+ }
12176
+ }, [addFiltersAndActiveServices, isMounted, isOpenInStore, preloadedServices, serviceSetLayers]);
12069
12177
  };
12070
12178
  var mergePresetsAndUserAddedServices = function mergePresetsAndUserAddedServices(presets, userAddedServices) {
12071
12179
  return Object.values(Object.assign(Object.assign({}, presets.reduce(function (byUrl, preset) {
@@ -12115,19 +12223,15 @@ var LayerManagerConnect = function LayerManagerConnect(_ref) {
12115
12223
  var mapId = useSelector(function (store) {
12116
12224
  return getDialogMapId(store, dialogType);
12117
12225
  });
12118
- var isMapPresetLoading = useSelector(function (store) {
12119
- return getIsMapPresetLoading(store, mapId);
12120
- });
12121
- var mapPresetError = useSelector(function (store) {
12122
- return getMapPresetError(store, mapId);
12123
- });
12124
12226
 
12125
12227
  var _useSetupDialog = useSetupDialog(dialogType),
12126
12228
  dialogOrder = _useSetupDialog.dialogOrder,
12127
12229
  setDialogOrder = _useSetupDialog.setDialogOrder,
12128
12230
  onCloseDialog = _useSetupDialog.onCloseDialog,
12129
12231
  isDialogOpen = _useSetupDialog.isDialogOpen,
12130
- uiSource = _useSetupDialog.uiSource;
12232
+ uiSource = _useSetupDialog.uiSource,
12233
+ uiIsLoading = _useSetupDialog.uiIsLoading,
12234
+ uiError = _useSetupDialog.uiError;
12131
12235
 
12132
12236
  useFetchServices(dialogType, preloadedMapServices);
12133
12237
 
@@ -12152,8 +12256,8 @@ var LayerManagerConnect = function LayerManagerConnect(_ref) {
12152
12256
  order: dialogOrder,
12153
12257
  source: uiSource,
12154
12258
  leftHeaderComponent: leftHeaderComponent,
12155
- isLoading: isMapPresetLoading,
12156
- error: mapPresetError,
12259
+ isLoading: uiIsLoading,
12260
+ error: uiError,
12157
12261
  onToggleDock: onToggleDock
12158
12262
  });
12159
12263
  };
@@ -12371,7 +12475,9 @@ var validateServiceName = function validateServiceName(value, services) {
12371
12475
  var ownServiceName = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : '';
12372
12476
  var serviceName = value === null || value === void 0 ? void 0 : value.toLowerCase();
12373
12477
  var foundName = Object.keys(services).find(function (serviceId) {
12374
- return services[serviceId].serviceName.toLowerCase() === serviceName && serviceName !== ownServiceName.toLocaleLowerCase();
12478
+ var _a;
12479
+
12480
+ return ((_a = services[serviceId]) === null || _a === void 0 ? void 0 : _a.serviceName.toLowerCase()) === serviceName && serviceName !== ownServiceName.toLocaleLowerCase();
12375
12481
  });
12376
12482
  return foundName === undefined ? true : VALIDATIONS_NAME_EXISTING;
12377
12483
  };
@@ -12401,7 +12507,9 @@ var validateServiceUrl = function validateServiceUrl(value, services) {
12401
12507
 
12402
12508
 
12403
12509
  var foundUrl = Object.keys(services).find(function (serviceId) {
12404
- return services[serviceId].serviceUrl === serviceUrl;
12510
+ var _a;
12511
+
12512
+ return ((_a = services[serviceId]) === null || _a === void 0 ? void 0 : _a.serviceUrl) === serviceUrl;
12405
12513
  });
12406
12514
 
12407
12515
  if (foundUrl) {
@@ -13606,7 +13714,7 @@ var sortByService = function sortByService(serviceObj) {
13606
13714
  var _ref4 = _slicedToArray(_ref2, 2),
13607
13715
  b = _ref4[1];
13608
13716
 
13609
- return a.serviceName.localeCompare(b.serviceName);
13717
+ return a.serviceName.localeCompare(b === null || b === void 0 ? void 0 : b.serviceName);
13610
13718
  }).reduce(function (r, _ref5) {
13611
13719
  var _ref6 = _slicedToArray(_ref5, 2),
13612
13720
  key = _ref6[0],
@@ -13776,6 +13884,7 @@ var LayerList = function LayerList(_ref) {
13776
13884
  var rowMargin = 4;
13777
13885
  var rowHeight = widthToRowHeight(layerSelectWidth);
13778
13886
  var layerSelectFilterHeight = 155 + serviceListHeight;
13887
+ var minHeight = 400;
13779
13888
  return /*#__PURE__*/React.createElement(Box, {
13780
13889
  "data-testid": "layerList"
13781
13890
  }, /*#__PURE__*/React.createElement(Box, {
@@ -13784,7 +13893,7 @@ var LayerList = function LayerList(_ref) {
13784
13893
  fontSize: '12px'
13785
13894
  }
13786
13895
  }, filteredLayers.length, " results"), /*#__PURE__*/React.createElement(FixedSizeList, {
13787
- height: layerSelectHeight - layerSelectFilterHeight,
13896
+ height: layerSelectHeight - layerSelectFilterHeight < minHeight ? minHeight : layerSelectHeight - layerSelectFilterHeight,
13788
13897
  itemCount: filteredLayers.length,
13789
13898
  itemSize: rowHeight + rowMargin
13790
13899
  }, function (_ref2) {
@@ -13928,7 +14037,7 @@ var ServiceChip = function ServiceChip(_ref) {
13928
14037
  var chip = all ? 'all' : service && service.serviceUrl;
13929
14038
  return /*#__PURE__*/React.createElement(CustomTooltip, {
13930
14039
  title: (service === null || service === void 0 ? void 0 : service["abstract"]) ? "Abstract: ".concat(service["abstract"]) : ''
13931
- }, /*#__PURE__*/React.createElement(CustomToggleButton, {
14040
+ }, /*#__PURE__*/React.createElement("span", null, /*#__PURE__*/React.createElement(CustomToggleButton, {
13932
14041
  variant: "boxed",
13933
14042
  selected: isSelected,
13934
14043
  tabIndex: 0,
@@ -13941,7 +14050,7 @@ var ServiceChip = function ServiceChip(_ref) {
13941
14050
  },
13942
14051
  disabled: isDisabled,
13943
14052
  sx: style
13944
- }, service ? service.serviceName : 'All'));
14053
+ }, service ? service.serviceName : 'All')));
13945
14054
  };
13946
14055
 
13947
14056
  var ServiceChipConnect = function ServiceChipConnect(_ref) {
@@ -14082,7 +14191,7 @@ var ServiceList = function ServiceList(_ref) {
14082
14191
  all: true,
14083
14192
  isSelected: isAllSelected
14084
14193
  }), Object.keys(activeServices).map(function (serviceId) {
14085
- var _a;
14194
+ var _a, _b;
14086
14195
 
14087
14196
  var service = activeServices[serviceId];
14088
14197
  return /*#__PURE__*/React.createElement(ServiceChipConnect, {
@@ -14091,7 +14200,7 @@ var ServiceList = function ServiceList(_ref) {
14091
14200
  service: service,
14092
14201
  isSelected: (_a = activeServices[serviceId]) === null || _a === void 0 ? void 0 : _a.enabled,
14093
14202
  isAllSelected: isAllSelected,
14094
- isDisabled: activeServices[serviceId] === undefined
14203
+ isDisabled: activeServices[serviceId] === undefined || ((_b = activeServices[serviceId]) === null || _b === void 0 ? void 0 : _b.isLoading) === true
14095
14204
  });
14096
14205
  })));
14097
14206
  };
@@ -14344,7 +14453,9 @@ var Rows = function Rows(_ref2) {
14344
14453
  var getService = function getService(services, serviceUrl) {
14345
14454
  var serviceIds = Object.keys(services);
14346
14455
  var serviceIndex = serviceIds.findIndex(function (serviceId) {
14347
- return services[serviceId].serviceUrl === serviceUrl;
14456
+ var _a;
14457
+
14458
+ return ((_a = services[serviceId]) === null || _a === void 0 ? void 0 : _a.serviceUrl) === serviceUrl;
14348
14459
  });
14349
14460
  if (serviceIndex < 0) return null;
14350
14461
  return services[serviceIds[serviceIndex]];
@@ -14543,7 +14654,14 @@ var LayerSelect = function LayerSelect(_ref) {
14543
14654
  left: 100
14544
14655
  },
14545
14656
  isOpen: isOpen,
14546
- onChangeSize: onChangeSize,
14657
+ onResizeStop: function onResizeStop(_event, _direction, node) {
14658
+ var width = node.offsetWidth,
14659
+ height = node.offsetHeight;
14660
+ onChangeSize({
14661
+ width: width,
14662
+ height: height
14663
+ });
14664
+ },
14547
14665
  onClose: onClose,
14548
14666
  headerSize: "small",
14549
14667
  bounds: bounds,
@@ -15168,7 +15286,8 @@ var MapControls = function MapControls(_a) {
15168
15286
  left: 0,
15169
15287
  margin: 1,
15170
15288
  zIndex: 50,
15171
- top: '96px'
15289
+ top: '96px',
15290
+ userSelect: 'none'
15172
15291
  }
15173
15292
  }, props), /*#__PURE__*/React.createElement(Grid, {
15174
15293
  sx: {
@@ -15996,7 +16115,7 @@ var SpeedButton = function SpeedButton(_ref) {
15996
16115
  * Copyright 2020 - Koninklijk Nederlands Meteorologisch Instituut (KNMI)
15997
16116
  * Copyright 2020 - Finnish Meteorological Institute (FMI)
15998
16117
  * */
15999
- var marks$1 = [{
16118
+ var marks$2 = [{
16000
16119
  label: '1 min',
16001
16120
  value: 1,
16002
16121
  text: '1m'
@@ -16091,18 +16210,11 @@ var TimeStepButton = function TimeStepButton(_ref) {
16091
16210
  disabled = _ref$disabled === void 0 ? false : _ref$disabled,
16092
16211
  _ref$isTimestepAuto = _ref.isTimestepAuto,
16093
16212
  isTimestepAuto = _ref$isTimestepAuto === void 0 ? false : _ref$isTimestepAuto,
16094
- timeDimension = _ref.timeDimension,
16095
16213
  onChangeTimeStep = _ref.onChangeTimeStep,
16096
16214
  _ref$onToggleTimestep = _ref.onToggleTimestepAuto,
16097
16215
  onToggleTimestepAuto = _ref$onToggleTimestep === void 0 ? function () {} : _ref$onToggleTimestep,
16098
16216
  _ref$isOpenByDefault = _ref.isOpenByDefault,
16099
16217
  isOpenByDefault = _ref$isOpenByDefault === void 0 ? false : _ref$isOpenByDefault;
16100
- var timeStepFromLayer = getActiveLayerTimeStep(timeDimension) || timeStep;
16101
- React.useEffect(function () {
16102
- if (isTimestepAuto) {
16103
- onChangeTimeStep(timeStepFromLayer);
16104
- }
16105
- }, [timeStepFromLayer, isTimestepAuto, onChangeTimeStep]);
16106
16218
 
16107
16219
  var handleMenuItemClick = function handleMenuItemClick(mark) {
16108
16220
  if (isTimestepAuto) {
@@ -16115,7 +16227,7 @@ var TimeStepButton = function TimeStepButton(_ref) {
16115
16227
  return /*#__PURE__*/React.createElement(TimeSliderMenu, {
16116
16228
  title: timeStepTitle,
16117
16229
  isOpenByDefault: isOpenByDefault,
16118
- marks: marks$1,
16230
+ marks: marks$2,
16119
16231
  value: timeStep,
16120
16232
  handleMenuItemClick: handleMenuItemClick,
16121
16233
  isDisabled: disabled,
@@ -16142,7 +16254,7 @@ var TimeStepButton = function TimeStepButton(_ref) {
16142
16254
  * Copyright 2022 - Koninklijk Nederlands Meteorologisch Instituut (KNMI)
16143
16255
  * Copyright 2022 - Finnish Meteorological Institute (FMI)
16144
16256
  * */
16145
- var marks = [{
16257
+ var marks$1 = [{
16146
16258
  label: '5 min',
16147
16259
  value: Scale.Minutes5,
16148
16260
  text: '5m'
@@ -16193,7 +16305,7 @@ var TimeScaleButton = function TimeScaleButton(_ref) {
16193
16305
  var onChangeSliderValue = function onChangeSliderValue(mark) {
16194
16306
  var newSliderValue = mark.value;
16195
16307
  var newValue = newSliderValue ? Math.round(newSliderValue) : 0;
16196
- var newScale = marks.find(function (el) {
16308
+ var newScale = marks$1.find(function (el) {
16197
16309
  return el.value === newValue;
16198
16310
  }).value;
16199
16311
  var scaleToSecPerPx = newScale === Scale.DataScale ? getScaleToSecondsPerPxForDataScale(layers) : scaleToSecondsPerPx[newScale];
@@ -16204,7 +16316,7 @@ var TimeScaleButton = function TimeScaleButton(_ref) {
16204
16316
  return /*#__PURE__*/React.createElement(TimeSliderMenu, {
16205
16317
  handleMenuItemClick: onChangeSliderValue,
16206
16318
  icon: /*#__PURE__*/React.createElement(Clock, null),
16207
- marks: marks,
16319
+ marks: marks$1,
16208
16320
  title: "Time scale",
16209
16321
  value: timeSliderScale,
16210
16322
  onChangeMouseWheel: onChangeSliderValue
@@ -16227,7 +16339,7 @@ var TimeScaleButton = function TimeScaleButton(_ref) {
16227
16339
  * Copyright 2022 - Koninklijk Nederlands Meteorologisch Instituut (KNMI)
16228
16340
  * Copyright 2022 - Finnish Meteorological Institute (FMI)
16229
16341
  * */
16230
- var title = 'Now';
16342
+ var title$1 = 'Now';
16231
16343
 
16232
16344
  var NowButton = function NowButton(_ref) {
16233
16345
  var _ref$onSetNow = _ref.onSetNow,
@@ -16235,7 +16347,7 @@ var NowButton = function NowButton(_ref) {
16235
16347
  _ref$disabled = _ref.disabled,
16236
16348
  disabled = _ref$disabled === void 0 ? false : _ref$disabled;
16237
16349
  return /*#__PURE__*/React.createElement(CustomTooltip, {
16238
- title: title,
16350
+ title: title$1,
16239
16351
  "data-testid": "nowButtonTooltip"
16240
16352
  }, /*#__PURE__*/React.createElement("span", null, /*#__PURE__*/React.createElement(ToolButton, {
16241
16353
  disabled: disabled,
@@ -16264,19 +16376,100 @@ var NowButton = function NowButton(_ref) {
16264
16376
  * Copyright 2022 - Koninklijk Nederlands Meteorologisch Instituut (KNMI)
16265
16377
  * Copyright 2022 - Finnish Meteorological Institute (FMI)
16266
16378
  * */
16267
- var OptionsMenu = function OptionsMenu(_ref) {
16268
- var autoUpdateBtn = _ref.autoUpdateBtn,
16269
- nowBtn = _ref.nowBtn,
16270
- speedBtn = _ref.speedBtn,
16271
- timeScaleBtn = _ref.timeScaleBtn,
16272
- timeStepBtn = _ref.timeStepBtn;
16273
- return /*#__PURE__*/React__default.createElement(React__default.Fragment, null, /*#__PURE__*/React__default.createElement(Grid, {
16274
- item: true,
16275
- xs: "auto"
16276
- }, nowBtn || /*#__PURE__*/React__default.createElement(NowButton, null)), /*#__PURE__*/React__default.createElement(Grid, {
16277
- item: true,
16278
- xs: "auto"
16279
- }, timeScaleBtn || /*#__PURE__*/React__default.createElement(TimeScaleButton, {
16379
+ var title = 'Animation';
16380
+ var marks = [{
16381
+ label: '15 min',
16382
+ value: AnimationLength.Minutes15,
16383
+ text: '15m'
16384
+ }, {
16385
+ label: '30 min',
16386
+ value: AnimationLength.Minutes30,
16387
+ text: '30m'
16388
+ }, {
16389
+ label: '1 h',
16390
+ value: AnimationLength.Hours1,
16391
+ text: '1h'
16392
+ }, {
16393
+ label: '2 h',
16394
+ value: AnimationLength.Hours2,
16395
+ text: '2h'
16396
+ }, {
16397
+ label: '3 h',
16398
+ value: AnimationLength.Hours3,
16399
+ text: '3h'
16400
+ }, {
16401
+ label: '6 h',
16402
+ value: AnimationLength.Hours6,
16403
+ text: '6h'
16404
+ }, {
16405
+ label: '12 h',
16406
+ value: AnimationLength.Hours12,
16407
+ text: '12h'
16408
+ }, {
16409
+ label: '24 h',
16410
+ value: AnimationLength.Hours24,
16411
+ text: '24h'
16412
+ }].sort(function (a, b) {
16413
+ return b.value - a.value;
16414
+ });
16415
+
16416
+ var AnimationLengthButton = function AnimationLengthButton(_ref) {
16417
+ var _ref$disabled = _ref.disabled,
16418
+ disabled = _ref$disabled === void 0 ? false : _ref$disabled,
16419
+ _ref$animationLength = _ref.animationLength,
16420
+ animationLength = _ref$animationLength === void 0 ? AnimationLength.Hours1 : _ref$animationLength,
16421
+ onChangeAnimationLength = _ref.onChangeAnimationLength;
16422
+
16423
+ var onChangeSliderValue = function onChangeSliderValue(mark) {
16424
+ var newSliderValue = mark.value;
16425
+ var newValue = newSliderValue ? Math.round(newSliderValue) : 0;
16426
+ var newLength = marks.find(function (el) {
16427
+ return el.value === newValue;
16428
+ }).value;
16429
+ onChangeAnimationLength(newLength);
16430
+ };
16431
+
16432
+ return /*#__PURE__*/React.createElement(TimeSliderMenu, {
16433
+ handleMenuItemClick: onChangeSliderValue,
16434
+ icon: /*#__PURE__*/React.createElement(Animation, null),
16435
+ marks: marks,
16436
+ title: title,
16437
+ isDisabled: disabled,
16438
+ value: animationLength,
16439
+ onChangeMouseWheel: onChangeSliderValue
16440
+ });
16441
+ };
16442
+
16443
+ /* *
16444
+ * Licensed under the Apache License, Version 2.0 (the "License");
16445
+ * you may not use this file except in compliance with the License.
16446
+ * You may obtain a copy of the License at
16447
+ *
16448
+ * http://www.apache.org/licenses/LICENSE-2.0
16449
+ *
16450
+ * Unless required by applicable law or agreed to in writing, software
16451
+ * distributed under the License is distributed on an "AS IS" BASIS,
16452
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16453
+ * See the License for the specific language governing permissions and
16454
+ * limitations under the License.
16455
+ *
16456
+ * Copyright 2022 - Koninklijk Nederlands Meteorologisch Instituut (KNMI)
16457
+ * Copyright 2022 - Finnish Meteorological Institute (FMI)
16458
+ * */
16459
+ var OptionsMenu = function OptionsMenu(_ref) {
16460
+ var autoUpdateBtn = _ref.autoUpdateBtn,
16461
+ nowBtn = _ref.nowBtn,
16462
+ speedBtn = _ref.speedBtn,
16463
+ timeScaleBtn = _ref.timeScaleBtn,
16464
+ timeStepBtn = _ref.timeStepBtn,
16465
+ animationLengthBtn = _ref.animationLengthBtn;
16466
+ return /*#__PURE__*/React__default.createElement(React__default.Fragment, null, /*#__PURE__*/React__default.createElement(Grid, {
16467
+ item: true,
16468
+ xs: "auto"
16469
+ }, nowBtn || /*#__PURE__*/React__default.createElement(NowButton, null)), /*#__PURE__*/React__default.createElement(Grid, {
16470
+ item: true,
16471
+ xs: "auto"
16472
+ }, timeScaleBtn || /*#__PURE__*/React__default.createElement(TimeScaleButton, {
16280
16473
  centerTime: 0,
16281
16474
  onChangeTimeSliderScale: function onChangeTimeSliderScale() {},
16282
16475
  secondsPerPx: 0,
@@ -16285,6 +16478,11 @@ var OptionsMenu = function OptionsMenu(_ref) {
16285
16478
  })), /*#__PURE__*/React__default.createElement(Grid, {
16286
16479
  item: true,
16287
16480
  xs: "auto"
16481
+ }, animationLengthBtn || /*#__PURE__*/React__default.createElement(AnimationLengthButton, {
16482
+ onChangeAnimationLength: function onChangeAnimationLength() {}
16483
+ })), /*#__PURE__*/React__default.createElement(Grid, {
16484
+ item: true,
16485
+ xs: "auto"
16288
16486
  }, timeStepBtn || /*#__PURE__*/React__default.createElement(TimeStepButton, {
16289
16487
  timeStep: 0,
16290
16488
  onChangeTimeStep: function onChangeTimeStep() {}
@@ -16306,8 +16504,14 @@ var OptionsMenuButton = function OptionsMenuButton(_ref) {
16306
16504
  speedBtn = _ref.speedBtn,
16307
16505
  timeStepBtn = _ref.timeStepBtn,
16308
16506
  timeScaleBtn = _ref.timeScaleBtn,
16507
+ animationLengthBtn = _ref.animationLengthBtn,
16309
16508
  _ref$isOpenByDefault = _ref.isOpenByDefault,
16310
- isOpenByDefault = _ref$isOpenByDefault === void 0 ? false : _ref$isOpenByDefault;
16509
+ isOpenByDefault = _ref$isOpenByDefault === void 0 ? false : _ref$isOpenByDefault,
16510
+ timeStep = _ref.timeStep,
16511
+ timeDimension = _ref.timeDimension,
16512
+ onChangeTimeStep = _ref.onChangeTimeStep,
16513
+ _ref$isTimestepAuto = _ref.isTimestepAuto,
16514
+ isTimestepAuto = _ref$isTimestepAuto === void 0 ? false : _ref$isTimestepAuto;
16311
16515
 
16312
16516
  var _useState = useState(null),
16313
16517
  _useState2 = _slicedToArray(_useState, 2),
@@ -16324,6 +16528,12 @@ var OptionsMenuButton = function OptionsMenuButton(_ref) {
16324
16528
  setOpen(true);
16325
16529
  }
16326
16530
  }, [anchorEl, isOpenByDefault]);
16531
+ var timeStepFromLayer = getActiveLayerTimeStep(timeDimension) || timeStep;
16532
+ React__default.useEffect(function () {
16533
+ if (isTimestepAuto) {
16534
+ onChangeTimeStep(timeStepFromLayer);
16535
+ }
16536
+ }, [timeStepFromLayer, isTimestepAuto, onChangeTimeStep]);
16327
16537
  return /*#__PURE__*/React__default.createElement("div", null, /*#__PURE__*/React__default.createElement(CustomTooltip, {
16328
16538
  title: "Animation options",
16329
16539
  placement: "bottom"
@@ -16359,6 +16569,7 @@ var OptionsMenuButton = function OptionsMenuButton(_ref) {
16359
16569
  timeScaleBtn: timeScaleBtn,
16360
16570
  timeStepBtn: timeStepBtn,
16361
16571
  speedBtn: speedBtn,
16572
+ animationLengthBtn: animationLengthBtn,
16362
16573
  autoUpdateBtn: autoUpdateBtn
16363
16574
  })))));
16364
16575
  };
@@ -16625,11 +16836,12 @@ var drawStepPxLine = function drawStepPxLine(ctx, theme, stepPx, height, scale,
16625
16836
  var drawTimeText = function drawTimeText(ctx, theme, stepPx, height, timeText, scale) {
16626
16837
  var ctx2 = ctx;
16627
16838
  var _theme$palette$geoweb = theme.palette.geowebColors.timeSlider.timelineText,
16839
+ fontSize = _theme$palette$geoweb.fontSize,
16628
16840
  fontFamily = _theme$palette$geoweb.fontFamily,
16629
16841
  color = _theme$palette$geoweb.color;
16630
16842
  ctx2.fillStyle = color; // time text has smaller font than other timeline text
16631
16843
 
16632
- ctx2.font = "12px ".concat(fontFamily);
16844
+ ctx2.font = "".concat(fontSize, "px ").concat(fontFamily);
16633
16845
  ctx2.textAlign = 'left';
16634
16846
 
16635
16847
  if (scale === Scale.Year || scale === Scale.Month || scale === Scale.Week || scale === Scale.Day) {
@@ -16661,7 +16873,7 @@ var drawYearScaleText = function drawYearScaleText(ctx, theme, newDate, stepPx,
16661
16873
  ctx2.fillStyle = color;
16662
16874
  ctx2.font = "".concat(fontSize, "px ").concat(fontFamily);
16663
16875
  ctx2.textAlign = 'left';
16664
- ctx2.fillText(newDate, stepPx + 2, height - 30);
16876
+ ctx2.fillText(newDate, stepPx + 2, height - 10);
16665
16877
  };
16666
16878
 
16667
16879
  var drawLeftSideDateText = function drawLeftSideDateText(ctx, theme, newDate, height) {
@@ -17127,9 +17339,9 @@ var drawBackground = function drawBackground(context, theme, visibleTimeStart, v
17127
17339
  drawDefaultBackground();
17128
17340
  drawObservedData();
17129
17341
  drawForecastData();
17342
+ drawNightOrAlternateTime();
17130
17343
  drawAnimationArea();
17131
17344
  drawDraggableIcons();
17132
- drawNightOrAlternateTime();
17133
17345
 
17134
17346
  function drawDefaultBackground() {
17135
17347
  ctx.fillStyle = legendNoDataBackground.rgba;
@@ -17152,18 +17364,23 @@ var drawBackground = function drawBackground(context, theme, visibleTimeStart, v
17152
17364
 
17153
17365
  function drawAnimationArea() {
17154
17366
  ctx.fillStyle = theme.palette.geowebColors.timeSlider.timelineSelectionBackground.rgba;
17155
- ctx.fillRect(animationStartPx, y, Math.max(animationEndPx - animationStartPx, y), height);
17367
+ ctx.strokeStyle = theme.palette.geowebColors.timeSlider.timelineSelectionOutline.rgba;
17368
+ ctx.lineWidth = 3;
17369
+ ctx.rect(animationStartPx, y, Math.max(animationEndPx - animationStartPx, y), height);
17370
+ ctx.fill();
17371
+ ctx.stroke();
17156
17372
  }
17157
17373
 
17158
17374
  function drawDraggableIcons() {
17159
17375
  ctx.save();
17160
17376
  var path = new Path2D(dragHandlePath);
17161
17377
  ctx.translate(animationStartPx, y);
17162
- ctx.fillStyle = theme.palette.geowebColors.timeSlider.timelineSelectionBackground.rgba;
17378
+ ctx.fillStyle = theme.palette.geowebColors.timeSlider.timelineTimeScale.fill;
17163
17379
  ctx.fill(path);
17164
17380
  ctx.restore();
17165
17381
  ctx.save();
17166
17382
  ctx.translate(animationEndPx - 24, y);
17383
+ ctx.fillStyle = theme.palette.geowebColors.timeSlider.timelineTimeScale.fill;
17167
17384
  ctx.fill(path);
17168
17385
  ctx.restore();
17169
17386
  }
@@ -17301,6 +17518,11 @@ var isSelectedTimeIconArea = function isSelectedTimeIconArea(x, selectedTimePx,
17301
17518
  var isRightAnimationIconArea = function isRightAnimationIconArea(x, rightMarkerPx, width) {
17302
17519
  return x >= rightMarkerPx - width && x <= rightMarkerPx;
17303
17520
  };
17521
+ var isInsideAnimationArea = function isInsideAnimationArea(x, leftMarkerPx, rightMarkerPx) {
17522
+ var isInsideOnLeftSide = x >= leftMarkerPx;
17523
+ var isInsideOnRightSide = x <= rightMarkerPx;
17524
+ return isInsideOnLeftSide && isInsideOnRightSide;
17525
+ };
17304
17526
  /**
17305
17527
  * @param x The pin location
17306
17528
  * @param selectedTimePx The selected px
@@ -17315,7 +17537,8 @@ var isLeftAnimationIconArea = function isLeftAnimationIconArea(x, leftMarkerPx,
17315
17537
  var DRAG_AREA_WIDTH = 24;
17316
17538
 
17317
17539
  var TimeSliderLegend = function TimeSliderLegend(_ref) {
17318
- var centerTime = _ref.centerTime,
17540
+ var mapId = _ref.mapId,
17541
+ centerTime = _ref.centerTime,
17319
17542
  secondsPerPx = _ref.secondsPerPx,
17320
17543
  _ref$dataScaleToSecon = _ref.dataScaleToSecondsPerPx,
17321
17544
  dataScaleToSecondsPerPx = _ref$dataScaleToSecon === void 0 ? defaultDataScaleToSecondsPerPx : _ref$dataScaleToSecon,
@@ -17327,10 +17550,11 @@ var TimeSliderLegend = function TimeSliderLegend(_ref) {
17327
17550
  dataEndTime = _ref.dataEndTime,
17328
17551
  animationStartTime = _ref.animationStartTime,
17329
17552
  animationEndTime = _ref.animationEndTime,
17330
- isTimeSliderHoverOn = _ref.isTimeSliderHoverOn,
17331
17553
  timeStep = _ref.timeStep,
17332
17554
  _ref$mapIsActive = _ref.mapIsActive,
17333
17555
  mapIsActive = _ref$mapIsActive === void 0 ? true : _ref$mapIsActive,
17556
+ unfilteredSelectedTime = _ref.unfilteredSelectedTime,
17557
+ setUnfilteredSelectedTime = _ref.setUnfilteredSelectedTime,
17334
17558
  onSetNewDate = _ref.onSetNewDate,
17335
17559
  onSetCenterTime = _ref.onSetCenterTime,
17336
17560
  onSetAnimationStartTime = _ref.onSetAnimationStartTime,
@@ -17367,26 +17591,45 @@ var TimeSliderLegend = function TimeSliderLegend(_ref) {
17367
17591
 
17368
17592
  var _React$useState11 = React.useState(false),
17369
17593
  _React$useState12 = _slicedToArray(_React$useState11, 2),
17370
- mouseDownInLegend = _React$useState12[0],
17371
- setMouseDownInLegend = _React$useState12[1];
17594
+ dragTooltipOpen = _React$useState12[0],
17595
+ setDragTooltipOpen = _React$useState12[1];
17372
17596
 
17373
- var _React$useState13 = React.useState(animationStartTime && moment.utc(animationStartTime).unix()),
17597
+ var _React$useState13 = React.useState(false),
17374
17598
  _React$useState14 = _slicedToArray(_React$useState13, 2),
17375
- localAnimationStartTime = _React$useState14[0],
17376
- setLocalAnimationStartTime = _React$useState14[1];
17599
+ mouseDownInLegend = _React$useState14[0],
17600
+ setMouseDownInLegend = _React$useState14[1];
17377
17601
 
17378
- var _React$useState15 = React.useState(animationEndTime && moment.utc(animationEndTime).unix()),
17602
+ var _React$useState15 = React.useState(animationStartTime && moment.utc(animationStartTime).unix()),
17379
17603
  _React$useState16 = _slicedToArray(_React$useState15, 2),
17380
- localAnimationEndTime = _React$useState16[0],
17381
- setLocalAnimationEndTime = _React$useState16[1];
17382
-
17383
- var elem = document.querySelector('.timeSliderLegend');
17384
- var pixelsToLeft = elem === null || elem === void 0 ? void 0 : elem.getBoundingClientRect()['left']; // we need to subtract the left padding so event.x start within the canvas.
17604
+ localAnimationStartTime = _React$useState16[0],
17605
+ setLocalAnimationStartTime = _React$useState16[1];
17385
17606
 
17386
- var _React$useState17 = React.useState('auto'),
17607
+ var _React$useState17 = React.useState(animationEndTime && moment.utc(animationEndTime).unix()),
17387
17608
  _React$useState18 = _slicedToArray(_React$useState17, 2),
17388
- cursorStyle = _React$useState18[0],
17389
- setCursorStyle = _React$useState18[1];
17609
+ localAnimationEndTime = _React$useState18[0],
17610
+ setLocalAnimationEndTime = _React$useState18[1];
17611
+
17612
+ var _React$useState19 = React.useState(moment.utc(0)),
17613
+ _React$useState20 = _slicedToArray(_React$useState19, 2),
17614
+ tooltipTime = _React$useState20[0],
17615
+ setTooltipTime = _React$useState20[1];
17616
+
17617
+ var _React$useState21 = React.useState(false),
17618
+ _React$useState22 = _slicedToArray(_React$useState21, 2),
17619
+ animationAreaDragging = _React$useState22[0],
17620
+ setAnimationAreaDragging = _React$useState22[1];
17621
+
17622
+ var animationDiff = React.useRef();
17623
+ var isClickOrDrag = React.useRef();
17624
+ var pixelsMovedSinceStartDragging = React.useRef(0);
17625
+ var elem = document.querySelector(".timeSliderLegend_".concat(mapId));
17626
+ var pixelsToLeft = elem === null || elem === void 0 ? void 0 : elem.getBoundingClientRect()['left'];
17627
+ var pixelsToTop = elem === null || elem === void 0 ? void 0 : elem.getBoundingClientRect()['top'];
17628
+
17629
+ var _React$useState23 = React.useState('auto'),
17630
+ _React$useState24 = _slicedToArray(_React$useState23, 2),
17631
+ cursorStyle = _React$useState24[0],
17632
+ setCursorStyle = _React$useState24[1];
17390
17633
 
17391
17634
  var curTime = selectedTime !== undefined ? moment.unix(selectedTime).toISOString() : moment.utc().toISOString();
17392
17635
  React.useEffect(function () {
@@ -17416,7 +17659,7 @@ var TimeSliderLegend = function TimeSliderLegend(_ref) {
17416
17659
  return function () {
17417
17660
  document.removeEventListener('keydown', handleKeyDown);
17418
17661
  };
17419
- }, [timeStep, isTimeSliderHoverOn, currentTime, dataStartTime, dataEndTime, mapIsActive, onSetCenterTime, onSetNewDate, curTime]);
17662
+ }, [curTime, currentTime, dataEndTime, dataStartTime, mapIsActive, onSetCenterTime, onSetNewDate, timeStep]);
17420
17663
  /**
17421
17664
  * remove active drag. can happen outside canvas.
17422
17665
  */
@@ -17429,13 +17672,18 @@ var TimeSliderLegend = function TimeSliderLegend(_ref) {
17429
17672
  setRightMarkerDragging(false);
17430
17673
  setMouseDownInLegend(false);
17431
17674
  setCenterTimeDragging(false);
17675
+ setDragTooltipOpen(false);
17676
+ setAnimationAreaDragging(false);
17677
+ startDraggingPosition.current = 0;
17678
+ pixelsMovedSinceStartDragging.current = 0;
17679
+ animationDiff.current = undefined;
17432
17680
  };
17433
17681
 
17434
17682
  document.addEventListener('mouseup', handleMouseUp);
17435
17683
  return function () {
17436
17684
  document.removeEventListener('mouseup', handleMouseUp);
17437
17685
  };
17438
- });
17686
+ }, [centerTimeDragging]);
17439
17687
  var onMouseTouchMoveActions = useCallback(function (x) {
17440
17688
  if (!localAnimationStartTime || !localAnimationEndTime) return;
17441
17689
 
@@ -17447,44 +17695,80 @@ var TimeSliderLegend = function TimeSliderLegend(_ref) {
17447
17695
  rightMarkerPx = _map2[1];
17448
17696
 
17449
17697
  if (leftMarkerDragging) {
17698
+ var mousePosition = leftMarkerPx + x;
17699
+ var rightAnimationPosition = rightMarkerPx - DRAG_AREA_WIDTH * 2; // update tooltip position while dragging
17450
17700
  // Prevent dragging if it would cause markers to cross over, except if the markers
17451
17701
  // are moved away from being crossed over
17452
- if (x >= rightMarkerPx - DRAG_AREA_WIDTH * 2 || x <= 0) return; // change local time bounds according to either dragged marker
17453
17702
 
17454
- var mouseTimeUnix = pixelToTimestamp(x - DRAG_AREA_WIDTH / 2, // lets us drag on the marker
17703
+ if (mousePosition >= rightAnimationPosition || mousePosition <= 0) return; // set animation drag info dialog location
17704
+
17705
+ dragTooltipPosition.current = pixelsToLeft ? mousePosition + pixelsToLeft : mousePosition; // change local time bounds according to either dragged marker
17706
+
17707
+ var mouseTimeUnix = pixelToTimestamp(mousePosition, // lets us drag on the marker
17455
17708
  centerTime, canvasWidth, secondsPerPx);
17456
17709
  setLocalAnimationStartTime(mouseTimeUnix);
17710
+ setTooltipTime(moment.unix(mouseTimeUnix));
17457
17711
  return;
17458
17712
  }
17459
17713
 
17460
17714
  if (rightMarkerDragging) {
17461
- // Similar condition for other marker
17462
- if (x <= leftMarkerPx + DRAG_AREA_WIDTH * 2 || x >= canvasWidth) return; // change local time bounds according to either dragged marker
17715
+ var _mousePosition = rightMarkerPx + x;
17716
+
17717
+ var leftAnimationPosition = leftMarkerPx + DRAG_AREA_WIDTH * 2; // Similar condition for other marker
17718
+
17719
+ if (leftAnimationPosition >= _mousePosition || _mousePosition >= canvasWidth) return; // set animation drag info dialog location
17720
+
17721
+ dragTooltipPosition.current = pixelsToLeft ? _mousePosition + pixelsToLeft : _mousePosition; // change local time bounds according to either dragged marker
17463
17722
 
17464
- var _mouseTimeUnix = pixelToTimestamp(x + DRAG_AREA_WIDTH / 2, // lets us drag on the marker
17723
+ var _mouseTimeUnix = pixelToTimestamp(_mousePosition, // lets us drag on the marker
17465
17724
  centerTime, canvasWidth, secondsPerPx);
17466
17725
 
17467
17726
  setLocalAnimationEndTime(_mouseTimeUnix);
17727
+ setTooltipTime(moment.unix(_mouseTimeUnix));
17728
+ return;
17729
+ }
17730
+
17731
+ if (animationAreaDragging) {
17732
+ if (animationDiff.current === undefined) {
17733
+ var startDraggingPositionTimestamp = pixelToTimestamp(startDraggingPosition.current, centerTime, canvasWidth, secondsPerPx);
17734
+ var diffLeftAnimationToStartDraggingPosition = startDraggingPositionTimestamp - localAnimationStartTime;
17735
+ var diffRightAnimationToStartDraggingPosition = localAnimationEndTime - startDraggingPositionTimestamp;
17736
+ animationDiff.current = {
17737
+ diffStartToRight: diffRightAnimationToStartDraggingPosition,
17738
+ diffStartToLeft: diffLeftAnimationToStartDraggingPosition
17739
+ };
17740
+ return;
17741
+ }
17742
+
17743
+ pixelsMovedSinceStartDragging.current += x;
17744
+ var currentPositionTimestamp = pixelToTimestamp(startDraggingPosition.current + pixelsMovedSinceStartDragging.current, centerTime, canvasWidth, secondsPerPx);
17745
+ var _animationDiff$curren = animationDiff.current,
17746
+ diffStartToRight = _animationDiff$curren.diffStartToRight,
17747
+ diffStartToLeft = _animationDiff$curren.diffStartToLeft;
17748
+ var startTime = currentPositionTimestamp - diffStartToLeft;
17749
+ var endTime = currentPositionTimestamp + diffStartToRight;
17750
+ setLocalAnimationStartTime(startTime);
17751
+ setLocalAnimationEndTime(endTime);
17468
17752
  }
17469
- }, [centerTime, leftMarkerDragging, localAnimationEndTime, localAnimationStartTime, rightMarkerDragging, secondsPerPx, canvasWidth]);
17753
+ }, [localAnimationStartTime, localAnimationEndTime, leftMarkerDragging, rightMarkerDragging, animationAreaDragging, centerTime, canvasWidth, secondsPerPx, pixelsToLeft, animationDiff]);
17470
17754
  var setSelectedTime = useCallback(function (x) {
17471
- setNewRoundedTime(x, centerTime, canvasWidth, secondsPerPx, timeStep, dataStartTime, dataEndTime, onSetNewDate);
17472
- }, [canvasWidth, centerTime, dataEndTime, dataStartTime, onSetNewDate, secondsPerPx, timeStep]);
17755
+ var unfliteredSelectedTimePx = timestampToPixel(unfilteredSelectedTime, centerTime, canvasWidth, secondsPerPx) + x;
17756
+ setUnfilteredSelectedTime(pixelToTimestamp(unfliteredSelectedTimePx, centerTime, canvasWidth, secondsPerPx));
17757
+ setNewRoundedTime(unfliteredSelectedTimePx, centerTime, canvasWidth, secondsPerPx, timeStep, dataStartTime, dataEndTime, onSetNewDate);
17758
+ }, [canvasWidth, centerTime, dataEndTime, dataStartTime, onSetNewDate, secondsPerPx, setUnfilteredSelectedTime, timeStep, unfilteredSelectedTime]);
17473
17759
  React.useEffect(function () {
17474
17760
  var handleMouseMove = function handleMouseMove(event) {
17761
+ if (event.movementX === 0) return;
17762
+
17475
17763
  if (mouseDownInLegend) {
17476
17764
  setCenterTimeDragging(true);
17477
17765
  var dragDistanceTime = event.movementX * secondsPerPx;
17478
17766
  var newCenterTime = centerTime - dragDistanceTime;
17479
17767
  onSetCenterTime && onSetCenterTime(newCenterTime);
17480
- } else {
17481
- if (!pixelsToLeft) return;
17482
-
17483
- if (leftMarkerDragging || rightMarkerDragging) {
17484
- onMouseTouchMoveActions(event.clientX - pixelsToLeft);
17485
- } else if (selectedTimeDragging) {
17486
- setSelectedTime(event.clientX - pixelsToLeft);
17487
- }
17768
+ } else if (leftMarkerDragging || rightMarkerDragging || animationAreaDragging) {
17769
+ onMouseTouchMoveActions(event.movementX);
17770
+ } else if (selectedTimeDragging) {
17771
+ setSelectedTime(event.movementX);
17488
17772
  }
17489
17773
  };
17490
17774
 
@@ -17492,10 +17776,14 @@ var TimeSliderLegend = function TimeSliderLegend(_ref) {
17492
17776
  return function () {
17493
17777
  document.removeEventListener('mousemove', handleMouseMove);
17494
17778
  };
17495
- }, [centerTime, secondsPerPx, onSetCenterTime, mouseDownInLegend, leftMarkerDragging, rightMarkerDragging, onMouseTouchMoveActions, selectedTimeDragging, setSelectedTime, pixelsToLeft]);
17779
+ }, [animationAreaDragging, centerTime, leftMarkerDragging, mouseDownInLegend, onMouseTouchMoveActions, onSetCenterTime, rightMarkerDragging, secondsPerPx, selectedTimeDragging, setSelectedTime]);
17496
17780
  var theme = useTheme();
17781
+ var startDraggingPosition = React.useRef(0);
17497
17782
 
17498
17783
  var onMouseDown = function onMouseDown(x, y, width) {
17784
+ isClickOrDrag.current = 'click';
17785
+ startDraggingPosition.current = x;
17786
+
17499
17787
  var _map3 = [localAnimationStartTime, localAnimationEndTime, selectedTime].map(function (timestamp) {
17500
17788
  return timestampToPixel(timestamp, centerTime, width, secondsPerPx);
17501
17789
  }),
@@ -17512,16 +17800,27 @@ var TimeSliderLegend = function TimeSliderLegend(_ref) {
17512
17800
  }
17513
17801
 
17514
17802
  if (animationStartTime && animationEndTime && onSetAnimationStartTime && onSetAnimationEndTime) {
17515
- // start dragging either marker
17803
+ dragTooltipPosition.current = pixelsToLeft ? x + pixelsToLeft : x; // start dragging either marker
17804
+
17516
17805
  if (isLeftAnimationIconArea(x, leftMarkerPx, DRAG_AREA_WIDTH) && !rightMarkerDragging) {
17517
17806
  setCursorStyle('grabbing');
17518
17807
  setLeftMarkerDragging(true);
17808
+ setTooltipTime(moment.utc(animationStartTime));
17809
+ setDragTooltipOpen(true);
17519
17810
  return;
17520
17811
  }
17521
17812
 
17522
17813
  if (isRightAnimationIconArea(x, rightMarkerPx, DRAG_AREA_WIDTH) && !leftMarkerDragging) {
17523
17814
  setCursorStyle('grabbing');
17524
17815
  setRightMarkerDragging(true);
17816
+ setTooltipTime(moment.utc(animationEndTime));
17817
+ setDragTooltipOpen(true);
17818
+ return;
17819
+ }
17820
+
17821
+ if (isInsideAnimationArea(x, leftMarkerPx, rightMarkerPx) && !animationAreaDragging) {
17822
+ setCursorStyle('grabbing');
17823
+ setAnimationAreaDragging(true);
17525
17824
  return;
17526
17825
  }
17527
17826
  } // clicking the timeslider
@@ -17530,18 +17829,36 @@ var TimeSliderLegend = function TimeSliderLegend(_ref) {
17530
17829
  setMouseDownInLegend(true);
17531
17830
  };
17532
17831
 
17832
+ React.useEffect(function () {
17833
+ var stoppedDragging = !leftMarkerDragging && !rightMarkerDragging && !animationAreaDragging;
17834
+
17835
+ if (stoppedDragging) {
17836
+ if (localAnimationStartTime !== convertStringTimeToUnix(animationStartTime)) {
17837
+ onSetAnimationStartTime(moment.utc(localAnimationStartTime * 1000).format(dateFormat));
17838
+ }
17839
+
17840
+ if (localAnimationEndTime !== convertStringTimeToUnix(animationEndTime)) {
17841
+ onSetAnimationEndTime(moment.utc(localAnimationEndTime * 1000).format(dateFormat));
17842
+ }
17843
+ } // eslint-disable-next-line react-hooks/exhaustive-deps
17844
+
17845
+ }, [leftMarkerDragging, rightMarkerDragging, animationAreaDragging]);
17846
+
17533
17847
  var onMouseUpTouchEnd = function onMouseUpTouchEnd(x) {
17534
- // Dispatch changes when releasing mouse
17535
- if (leftMarkerDragging) {
17536
- onSetAnimationStartTime(moment.utc(localAnimationStartTime * 1000).format(dateFormat));
17537
- } else if (rightMarkerDragging) {
17538
- onSetAnimationEndTime(moment.utc(localAnimationEndTime * 1000).format(dateFormat));
17539
- } else if (!selectedTimeDragging && !centerTimeDragging) {
17540
- setSelectedTime(x);
17848
+ if (isClickOrDrag.current === 'click') {
17849
+ // we need to set the unfiltered time, so the timebox will update accordingly
17850
+ setUnfilteredSelectedTime(pixelToTimestamp(x, centerTime, canvasWidth, secondsPerPx));
17851
+ setNewRoundedTime(x, centerTime, canvasWidth, secondsPerPx, timeStep, dataStartTime, dataEndTime, onSetNewDate);
17541
17852
  }
17853
+
17854
+ isClickOrDrag.current = undefined;
17542
17855
  };
17543
17856
 
17544
17857
  var onMouseMove = function onMouseMove(x, y, event, width) {
17858
+ if (isClickOrDrag.current === 'click') {
17859
+ isClickOrDrag.current = 'drag';
17860
+ }
17861
+
17545
17862
  if (selectedTimeDragging || leftMarkerDragging || rightMarkerDragging) return;
17546
17863
 
17547
17864
  var _map5 = [localAnimationStartTime, localAnimationEndTime, selectedTime].map(function (timestamp) {
@@ -17556,18 +17873,41 @@ var TimeSliderLegend = function TimeSliderLegend(_ref) {
17556
17873
  var leftAnimationIconArea = isLeftAnimationIconArea(x, leftMarkerPx, DRAG_AREA_WIDTH);
17557
17874
  var rightAnimationIconArea = isRightAnimationIconArea(x, rightMarkerPx, DRAG_AREA_WIDTH);
17558
17875
  var selectedTimeArea = isSelectedTimeIconArea(x, selectedTimePx, DRAG_AREA_WIDTH);
17876
+ var insideAnimationArea = isInsideAnimationArea(x, leftMarkerPx, rightMarkerPx);
17559
17877
  var hoveringLegendHandles = leftAnimationIconArea || rightAnimationIconArea || selectedTimeArea || mouseDownInLegend;
17560
17878
 
17561
17879
  if (hoveringLegendHandles) {
17562
17880
  setCursorStyle('ew-resize');
17881
+ } else if (insideAnimationArea && !animationAreaDragging) {
17882
+ setCursorStyle('grab');
17883
+ } else if (insideAnimationArea && animationAreaDragging) {
17884
+ setCursorStyle('grabbing');
17563
17885
  } else {
17564
17886
  setCursorStyle('auto');
17565
17887
  }
17566
17888
  };
17567
17889
 
17568
- return /*#__PURE__*/React.createElement(Box, {
17890
+ var dragTooltipPosition = React.useRef();
17891
+ var popperRef = React.useRef(null);
17892
+
17893
+ var setTooltipPosition = function setTooltipPosition() {
17894
+ var tooltipX = dragTooltipPosition.current;
17895
+ var tooltipY = pixelsToTop && pixelsToTop - TIME_SLIDER_LEGEND_HEIGHT * 2.5;
17896
+ return new DOMRect(tooltipX, tooltipY, 0, 0);
17897
+ };
17898
+
17899
+ return /*#__PURE__*/React.createElement(CustomTooltip, {
17900
+ title: tooltipTime.format('HH:mm'),
17901
+ open: dragTooltipOpen,
17902
+ PopperProps: {
17903
+ popperRef: popperRef,
17904
+ anchorEl: {
17905
+ getBoundingClientRect: setTooltipPosition
17906
+ }
17907
+ }
17908
+ }, /*#__PURE__*/React.createElement(Box, {
17569
17909
  "data-testid": "timeSliderLegend",
17570
- className: "timeSliderLegend",
17910
+ className: "timeSliderLegend_".concat(mapId),
17571
17911
  sx: {
17572
17912
  height: "".concat(TIME_SLIDER_LEGEND_HEIGHT, "px"),
17573
17913
  borderRadius: '4.5px',
@@ -17589,9 +17929,13 @@ var TimeSliderLegend = function TimeSliderLegend(_ref) {
17589
17929
  setCanvasWidth(width);
17590
17930
  drawTimeSliderLegend(ctx, theme, width, height, centerTime, secondsPerPx, dataScaleToSecondsPerPx, selectedTime, scale, currentTime, localAnimationStartTime, localAnimationEndTime, dataStartTime, dataEndTime);
17591
17931
  }
17592
- }));
17932
+ })));
17593
17933
  };
17594
17934
 
17935
+ function convertStringTimeToUnix(time) {
17936
+ return time ? moment.utc(time).unix() : undefined;
17937
+ }
17938
+
17595
17939
  var TIME_SLIDER_LEGEND_HEIGHT = 24;
17596
17940
 
17597
17941
  /* *
@@ -17643,7 +17987,7 @@ var HideSliderButton = function HideSliderButton(_ref) {
17643
17987
  * */
17644
17988
  var onMouseMove = function onMouseMove(x, width, selectedTime, centerTime, secondsPerPx, mouseDownInTimeBox, isTimeBoxArea, setCursorStyle) {
17645
17989
  if (!selectedTime || mouseDownInTimeBox) return;
17646
- var selectedTimePx = timestampToPixel(selectedTime.unix(), centerTime, width, secondsPerPx);
17990
+ var selectedTimePx = timestampToPixel(selectedTime, centerTime, width, secondsPerPx);
17647
17991
 
17648
17992
  if (isTimeBoxArea(x, selectedTimePx)) {
17649
17993
  setCursorStyle('grab');
@@ -17653,7 +17997,7 @@ var onMouseMove = function onMouseMove(x, width, selectedTime, centerTime, secon
17653
17997
  };
17654
17998
  var onMouseDown = function onMouseDown(x, width, selectedTime, centerTime, secondsPerPx, isTimeBoxArea, setCursorStyle, setMouseDownInTimeBox) {
17655
17999
  if (!selectedTime) return;
17656
- var selectedTimePx = timestampToPixel(selectedTime.unix(), centerTime, width, secondsPerPx);
18000
+ var selectedTimePx = timestampToPixel(selectedTime, centerTime, width, secondsPerPx);
17657
18001
 
17658
18002
  if (isTimeBoxArea(x, selectedTimePx)) {
17659
18003
  setCursorStyle('grabbing');
@@ -17735,7 +18079,9 @@ var TimeSliderCurrentTimeBox = function TimeSliderCurrentTimeBox(_ref) {
17735
18079
  timeStep = _ref.timeStep,
17736
18080
  dataStartTime = _ref.dataStartTime,
17737
18081
  dataEndTime = _ref.dataEndTime,
17738
- onSetNewDate = _ref.onSetNewDate;
18082
+ unfilteredSelectedTime = _ref.unfilteredSelectedTime,
18083
+ onSetNewDate = _ref.onSetNewDate,
18084
+ setUnfilteredSelectedTime = _ref.setUnfilteredSelectedTime;
17739
18085
  var TIME_BOX_WIDTH = 140;
17740
18086
  var theme = useTheme();
17741
18087
 
@@ -17780,11 +18126,9 @@ var TimeSliderCurrentTimeBox = function TimeSliderCurrentTimeBox(_ref) {
17780
18126
  React__default.useEffect(function () {
17781
18127
  var handleMouseMove = function handleMouseMove(event) {
17782
18128
  if (mouseDownInTimeBox) {
17783
- var elem = document.querySelector('.timeSliderTimeBox');
17784
- var rect = elem === null || elem === void 0 ? void 0 : elem.getBoundingClientRect(); // we need to subtract the left padding so event.x start within the canvas.
17785
-
17786
- if (!rect) return;
17787
- setNewRoundedTime(event.clientX - rect['left'], centerTime, canvasWidth, secondsPerPx, timeStep, dataStartTime, dataEndTime, onSetNewDate);
18129
+ var localSelectedTimePx = timestampToPixel(unfilteredSelectedTime, centerTime, canvasWidth, secondsPerPx) + event.movementX;
18130
+ setUnfilteredSelectedTime(pixelToTimestamp(localSelectedTimePx, centerTime, canvasWidth, secondsPerPx));
18131
+ setNewRoundedTime(localSelectedTimePx, centerTime, canvasWidth, secondsPerPx, timeStep, dataStartTime, dataEndTime, onSetNewDate);
17788
18132
  }
17789
18133
  };
17790
18134
 
@@ -17792,7 +18136,7 @@ var TimeSliderCurrentTimeBox = function TimeSliderCurrentTimeBox(_ref) {
17792
18136
  return function () {
17793
18137
  document.removeEventListener('mousemove', handleMouseMove);
17794
18138
  };
17795
- });
18139
+ }, [canvasWidth, centerTime, dataEndTime, dataStartTime, mouseDownInTimeBox, onSetNewDate, secondsPerPx, setUnfilteredSelectedTime, timeStep, unfilteredSelectedTime]);
17796
18140
  return /*#__PURE__*/React__default.createElement(Box$2, {
17797
18141
  "data-testid": "timeSliderTimeBox",
17798
18142
  className: "timeSliderTimeBox",
@@ -17813,32 +18157,18 @@ var TimeSliderCurrentTimeBox = function TimeSliderCurrentTimeBox(_ref) {
17813
18157
  onMouseDown(x, width, selectedTime, centerTime, secondsPerPx, isTimeBoxArea, setCursorStyle, setMouseDownInTimeBox);
17814
18158
  },
17815
18159
  onMouseUp: function onMouseUp(x) {
17816
- setNewRoundedTime(x, centerTime, canvasWidth, secondsPerPx, timeStep, dataStartTime, dataEndTime, onSetNewDate);
18160
+ if (mouseDownInTimeBox) {
18161
+ setUnfilteredSelectedTime(pixelToTimestamp(x, centerTime, canvasWidth, secondsPerPx));
18162
+ setNewRoundedTime(x, centerTime, canvasWidth, secondsPerPx, timeStep, dataStartTime, dataEndTime, onSetNewDate);
18163
+ }
17817
18164
  },
17818
18165
  onRenderCanvas: function onRenderCanvas(ctx, width, height) {
17819
18166
  setCanvasWidth(width);
17820
- renderTimeSliderCurrentTimeBox(ctx, theme, width, height, centerTime, selectedTime.unix(), secondsPerPx, scale);
18167
+ renderTimeSliderCurrentTimeBox(ctx, theme, width, height, centerTime, selectedTime, secondsPerPx, scale);
17821
18168
  }
17822
18169
  }));
17823
18170
  };
17824
18171
 
17825
- /* *
17826
- * Licensed under the Apache License, Version 2.0 (the "License");
17827
- * you may not use this file except in compliance with the License.
17828
- * You may obtain a copy of the License at
17829
- *
17830
- * http://www.apache.org/licenses/LICENSE-2.0
17831
- *
17832
- * Unless required by applicable law or agreed to in writing, software
17833
- * distributed under the License is distributed on an "AS IS" BASIS,
17834
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17835
- * See the License for the specific language governing permissions and
17836
- * limitations under the License.
17837
- *
17838
- * Copyright 2022 - Koninklijk Nederlands Meteorologisch Instituut (KNMI)
17839
- * Copyright 2022 - Finnish Meteorological Institute (FMI)
17840
- * */
17841
-
17842
18172
  var useTimeSliderKeyBoardControl = function useTimeSliderKeyBoardControl(mapIsActive, isVisible, onToggleTimeSlider) {
17843
18173
  React.useEffect(function () {
17844
18174
  var handleKeyDown = function handleKeyDown(event) {
@@ -17859,12 +18189,13 @@ var useTimeSliderKeyBoardControl = function useTimeSliderKeyBoardControl(mapIsAc
17859
18189
  var defaultProps = {
17860
18190
  centerTime: moment.utc().startOf('day').hours(12).unix(),
17861
18191
  secondsPerPx: 5,
17862
- selectedTime: moment.utc().startOf('day').hours(12),
18192
+ selectedTime: moment.utc().startOf('day').hours(12).unix(),
17863
18193
  dataScaleToSecondsPerPx: defaultDataScaleToSecondsPerPx
17864
18194
  };
17865
18195
 
17866
18196
  var TimeSlider = function TimeSlider(_ref) {
17867
- var buttons = _ref.buttons,
18197
+ var mapId = _ref.mapId,
18198
+ buttons = _ref.buttons,
17868
18199
  timeBox = _ref.timeBox,
17869
18200
  legend = _ref.legend,
17870
18201
  _ref$mapIsActive = _ref.mapIsActive,
@@ -17874,6 +18205,12 @@ var TimeSlider = function TimeSlider(_ref) {
17874
18205
  _ref$onToggleTimeSlid = _ref.onToggleTimeSlider,
17875
18206
  onToggleTimeSlider = _ref$onToggleTimeSlid === void 0 ? function () {} : _ref$onToggleTimeSlid;
17876
18207
  useTimeSliderKeyBoardControl(mapIsActive, isVisible, onToggleTimeSlider);
18208
+
18209
+ var _React$useState = React.useState(defaultProps.selectedTime),
18210
+ _React$useState2 = _slicedToArray(_React$useState, 2),
18211
+ unfilteredSelectedTime = _React$useState2[0],
18212
+ setUnfilteredSelectedTime = _React$useState2[1];
18213
+
17877
18214
  var visibilityState = isVisible ? 'visible' : 'hidden';
17878
18215
  return isVisible ? /*#__PURE__*/React.createElement(Grid, {
17879
18216
  style: {
@@ -17898,7 +18235,8 @@ var TimeSlider = function TimeSlider(_ref) {
17898
18235
  zIndex: 99
17899
18236
  }
17900
18237
  }, timeBox || /*#__PURE__*/React.createElement(TimeSliderCurrentTimeBox, Object.assign({}, defaultProps, {
17901
- selectedTime: defaultProps.selectedTime
18238
+ unfilteredSelectedTime: unfilteredSelectedTime,
18239
+ setUnfilteredSelectedTime: setUnfilteredSelectedTime
17902
18240
  }))), /*#__PURE__*/React.createElement(Grid, {
17903
18241
  item: true
17904
18242
  }), /*#__PURE__*/React.createElement(Grid, {
@@ -17906,8 +18244,10 @@ var TimeSlider = function TimeSlider(_ref) {
17906
18244
  }, buttons || /*#__PURE__*/React.createElement(TimeSliderButtons, null)), /*#__PURE__*/React.createElement(Grid, {
17907
18245
  item: true
17908
18246
  }, legend || /*#__PURE__*/React.createElement(TimeSliderLegend, Object.assign({}, defaultProps, {
17909
- selectedTime: defaultProps.selectedTime.unix(),
17910
- mapIsActive: mapIsActive
18247
+ mapId: mapId,
18248
+ mapIsActive: mapIsActive,
18249
+ unfilteredSelectedTime: unfilteredSelectedTime,
18250
+ setUnfilteredSelectedTime: setUnfilteredSelectedTime
17911
18251
  })), ' '), /*#__PURE__*/React.createElement(Grid, {
17912
18252
  item: true,
17913
18253
  sx: {
@@ -18041,12 +18381,6 @@ var TimeStepButtonComponent = function TimeStepButtonComponent(_ref) {
18041
18381
  var isTimestepAuto$1 = useSelector(function (store) {
18042
18382
  return isTimestepAuto(store, mapId);
18043
18383
  });
18044
- var activeLayerId = useSelector(function (store) {
18045
- return getActiveLayerId(store, mapId);
18046
- });
18047
- var activeLayerTimeDimension = useSelector(function (store) {
18048
- return getLayerTimeDimension(store, activeLayerId);
18049
- });
18050
18384
  var onToggleTimestepAuto = React.useCallback(function () {
18051
18385
  dispatch(mapActions$1.toggleTimestepAuto({
18052
18386
  mapId: mapId,
@@ -18066,9 +18400,7 @@ var TimeStepButtonComponent = function TimeStepButtonComponent(_ref) {
18066
18400
  timeStep: timeStep,
18067
18401
  onChangeTimeStep: onSetTimeStep,
18068
18402
  disabled: isAnimating$1,
18069
- isTimestepAuto: isTimestepAuto$1,
18070
- onToggleTimestepAuto: onToggleTimestepAuto,
18071
- timeDimension: activeLayerTimeDimension
18403
+ onToggleTimestepAuto: onToggleTimestepAuto
18072
18404
  });
18073
18405
  };
18074
18406
 
@@ -18188,6 +18520,57 @@ var NowButtonConnect = function NowButtonConnect(_ref) {
18188
18520
  });
18189
18521
  };
18190
18522
 
18523
+ /* *
18524
+ * Licensed under the Apache License, Version 2.0 (the "License");
18525
+ * you may not use this file except in compliance with the License.
18526
+ * You may obtain a copy of the License at
18527
+ *
18528
+ * http://www.apache.org/licenses/LICENSE-2.0
18529
+ *
18530
+ * Unless required by applicable law or agreed to in writing, software
18531
+ * distributed under the License is distributed on an "AS IS" BASIS,
18532
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
18533
+ * See the License for the specific language governing permissions and
18534
+ * limitations under the License.
18535
+ *
18536
+ * Copyright 2022 - Koninklijk Nederlands Meteorologisch Instituut (KNMI)
18537
+ * Copyright 2022 - Finnish Meteorological Institute (FMI)
18538
+ * */
18539
+
18540
+ var AnimationLengthButtonConnect = function AnimationLengthButtonConnect(_ref) {
18541
+ var mapId = _ref.mapId;
18542
+ var dispatch = useDispatch();
18543
+ var isAnimating$1 = useSelector(function (store) {
18544
+ return isAnimating(store, mapId);
18545
+ });
18546
+ var animationStartTime = useSelector(function (store) {
18547
+ return getAnimationStartTime(store, mapId);
18548
+ });
18549
+ var animationEndTime = useSelector(function (store) {
18550
+ return getAnimationEndTime(store, mapId);
18551
+ });
18552
+ var currentDiffInMinutes = moment(animationEndTime).diff(moment(animationStartTime), 'minutes');
18553
+ var currentLength = Object.values(AnimationLength).map(function (val) {
18554
+ return Number(val);
18555
+ }).find(function (val) {
18556
+ return val >= currentDiffInMinutes;
18557
+ });
18558
+
18559
+ var handlechangeAnimationLength = function handlechangeAnimationLength(length) {
18560
+ var animationEndTime = moment(animationStartTime).add(length, 'minutes').toISOString();
18561
+ dispatch(mapActions$1.setAnimationEndTime({
18562
+ mapId: mapId,
18563
+ animationEndTime: animationEndTime
18564
+ }));
18565
+ };
18566
+
18567
+ return /*#__PURE__*/React.createElement(AnimationLengthButton, {
18568
+ disabled: isAnimating$1,
18569
+ animationLength: currentLength || Number(AnimationLength.Hours24),
18570
+ onChangeAnimationLength: handlechangeAnimationLength
18571
+ });
18572
+ };
18573
+
18191
18574
  /* *
18192
18575
  * Licensed under the Apache License, Version 2.0 (the "License");
18193
18576
  * you may not use this file except in compliance with the License.
@@ -18216,11 +18599,35 @@ var NowButtonConnect = function NowButtonConnect(_ref) {
18216
18599
  var OptionsMenuButtonConnect = function OptionsMenuButtonConnect(_ref) {
18217
18600
  var sourceId = _ref.sourceId,
18218
18601
  mapId = _ref.mapId;
18602
+ var dispatch = useDispatch();
18603
+ var isTimestepAuto$1 = useSelector(function (store) {
18604
+ return isTimestepAuto(store, mapId);
18605
+ });
18606
+ var timeStep = useSelector(function (store) {
18607
+ return getMapTimeStep(store, mapId);
18608
+ });
18609
+ var activeLayerId = useSelector(function (store) {
18610
+ return getActiveLayerId(store, mapId);
18611
+ });
18612
+ var activeLayerTimeDimension = useSelector(function (store) {
18613
+ return getLayerTimeDimension(store, activeLayerId);
18614
+ });
18615
+ var onSetTimeStep = React.useCallback(function (timeStep, origin) {
18616
+ dispatch(mapActions$1.setTimeStep(Object.assign({
18617
+ mapId: mapId,
18618
+ timeStep: timeStep
18619
+ }, origin && {
18620
+ origin: origin
18621
+ })));
18622
+ }, [dispatch, mapId]);
18219
18623
  return /*#__PURE__*/React.createElement(OptionsMenuButton, {
18220
18624
  nowBtn: /*#__PURE__*/React.createElement(NowButtonConnect, {
18221
18625
  mapId: mapId,
18222
18626
  sourceId: sourceId
18223
18627
  }),
18628
+ animationLengthBtn: /*#__PURE__*/React.createElement(AnimationLengthButtonConnect, {
18629
+ mapId: mapId
18630
+ }),
18224
18631
  autoUpdateBtn: /*#__PURE__*/React.createElement(AutoUpdateButtonConnect, {
18225
18632
  mapId: mapId
18226
18633
  }),
@@ -18232,7 +18639,11 @@ var OptionsMenuButtonConnect = function OptionsMenuButtonConnect(_ref) {
18232
18639
  }),
18233
18640
  timeScaleBtn: /*#__PURE__*/React.createElement(TimeScaleButtonConnect, {
18234
18641
  mapId: mapId
18235
- })
18642
+ }),
18643
+ timeStep: timeStep,
18644
+ isTimestepAuto: isTimestepAuto$1,
18645
+ onChangeTimeStep: onSetTimeStep,
18646
+ timeDimension: activeLayerTimeDimension
18236
18647
  });
18237
18648
  };
18238
18649
 
@@ -18354,9 +18765,11 @@ var connectRedux$2 = connect(function (store, props) {
18354
18765
  timeValue: getTime(getSynchronizationGroupStore(store), props.sourceId),
18355
18766
  animationStartTime: getAnimationStartTime(store, props.mapId),
18356
18767
  animationEndTime: getAnimationEndTime(store, props.mapId),
18357
- activeWindowId: getActiveWindowId(store)
18768
+ activeWindowId: getActiveWindowId(store),
18769
+ unfilteredSelectedTime: getTimeSliderUnfilteredSelectedTime(store, props.mapId)
18358
18770
  };
18359
18771
  }, {
18772
+ setTimeSliderUnfilteredSelectedTime: mapActions$1.setTimeSliderUnfilteredSelectedTime,
18360
18773
  stopMapAnimation: mapActions$1.mapStopAnimation,
18361
18774
  setTime: genericActions.setTime,
18362
18775
  mapSetTimeSliderCenterTime: mapActions$1.setTimeSliderCenterTime,
@@ -18385,7 +18798,9 @@ var TimeSliderLegendConnect = function TimeSliderLegendConnect(_ref) {
18385
18798
  mapSetTimeSliderCenterTime = _ref.mapSetTimeSliderCenterTime,
18386
18799
  mapSetTimeSliderSecondsPerPx = _ref.mapSetTimeSliderSecondsPerPx,
18387
18800
  setAnimationStartTime = _ref.setAnimationStartTime,
18388
- setAnimationEndTime = _ref.setAnimationEndTime;
18801
+ setAnimationEndTime = _ref.setAnimationEndTime,
18802
+ unfilteredSelectedTime = _ref.unfilteredSelectedTime,
18803
+ setTimeSliderUnfilteredSelectedTime = _ref.setTimeSliderUnfilteredSelectedTime;
18389
18804
 
18390
18805
  var _getTimeBounds = getTimeBounds(dimensions),
18391
18806
  selectedTime = _getTimeBounds.selectedTime;
@@ -18399,6 +18814,7 @@ var TimeSliderLegendConnect = function TimeSliderLegendConnect(_ref) {
18399
18814
 
18400
18815
  var mapIsActive = mapId === activeWindowId;
18401
18816
  return /*#__PURE__*/React.createElement(TimeSliderLegend, {
18817
+ mapId: mapId,
18402
18818
  centerTime: centerTime,
18403
18819
  secondsPerPx: secondsPerPx,
18404
18820
  dataScaleToSecondsPerPx: dataScaleToSecondsPerPx,
@@ -18412,6 +18828,13 @@ var TimeSliderLegendConnect = function TimeSliderLegendConnect(_ref) {
18412
18828
  animationEndTime: animationEndTime,
18413
18829
  timeStep: timeStep,
18414
18830
  mapIsActive: mapIsActive,
18831
+ unfilteredSelectedTime: unfilteredSelectedTime || selectedTime,
18832
+ setUnfilteredSelectedTime: function setUnfilteredSelectedTime(timeSliderUnfilteredSelectedTime) {
18833
+ if (setTimeSliderUnfilteredSelectedTime) setTimeSliderUnfilteredSelectedTime({
18834
+ timeSliderUnfilteredSelectedTime: timeSliderUnfilteredSelectedTime,
18835
+ mapId: mapId
18836
+ });
18837
+ },
18415
18838
  onSetNewDate: function onSetNewDate(newDate) {
18416
18839
  if (isAnimating) {
18417
18840
  stopMapAnimation({
@@ -18475,9 +18898,11 @@ var connectRedux$1 = connect(function (store, props) {
18475
18898
  secondsPerPx: getMapTimeSliderSecondsPerPx(store, props.mapId),
18476
18899
  scale: getMapTimeSliderScale(store, props.mapId),
18477
18900
  timeStep: getMapTimeStep(store, props.mapId),
18478
- isAnimating: isAnimating(store, props.mapId)
18901
+ isAnimating: isAnimating(store, props.mapId),
18902
+ unfilteredSelectedTime: getTimeSliderUnfilteredSelectedTime(store, props.mapId)
18479
18903
  };
18480
18904
  }, {
18905
+ setTimeSliderUnfilteredSelectedTime: mapActions$1.setTimeSliderUnfilteredSelectedTime,
18481
18906
  stopMapAnimation: mapActions$1.mapStopAnimation,
18482
18907
  setTime: genericActions.setTime
18483
18908
  });
@@ -18493,10 +18918,12 @@ var TimeSliderCurrentTimeBoxConnectComponent = function TimeSliderCurrentTimeBox
18493
18918
  timeStep = _ref.timeStep,
18494
18919
  isAnimating = _ref.isAnimating,
18495
18920
  stopMapAnimation = _ref.stopMapAnimation,
18921
+ unfilteredSelectedTime = _ref.unfilteredSelectedTime,
18922
+ setTimeSliderUnfilteredSelectedTime = _ref.setTimeSliderUnfilteredSelectedTime,
18496
18923
  setTime = _ref.setTime;
18497
18924
 
18498
- var _getMomentTimeBounds = getMomentTimeBounds(dimensions),
18499
- selectedTime = _getMomentTimeBounds.selectedTime;
18925
+ var _getTimeBounds = getTimeBounds(dimensions),
18926
+ selectedTime = _getTimeBounds.selectedTime;
18500
18927
 
18501
18928
  var _getDataLimitsFromLay = getDataLimitsFromLayers(layers),
18502
18929
  _getDataLimitsFromLay2 = _slicedToArray(_getDataLimitsFromLay, 2),
@@ -18511,6 +18938,13 @@ var TimeSliderCurrentTimeBoxConnectComponent = function TimeSliderCurrentTimeBox
18511
18938
  dataStartTime: dataStartTime,
18512
18939
  dataEndTime: dataEndTime,
18513
18940
  timeStep: timeStep,
18941
+ unfilteredSelectedTime: unfilteredSelectedTime || selectedTime,
18942
+ setUnfilteredSelectedTime: function setUnfilteredSelectedTime(timeSliderUnfilteredSelectedTime) {
18943
+ if (setTimeSliderUnfilteredSelectedTime) setTimeSliderUnfilteredSelectedTime({
18944
+ timeSliderUnfilteredSelectedTime: timeSliderUnfilteredSelectedTime,
18945
+ mapId: mapId
18946
+ });
18947
+ },
18514
18948
  onSetNewDate: function onSetNewDate(newDate) {
18515
18949
  if (isAnimating) {
18516
18950
  stopMapAnimation({
@@ -18595,6 +19029,7 @@ var ConnectedTimeSlider = function ConnectedTimeSlider(_ref) {
18595
19029
  };
18596
19030
 
18597
19031
  return /*#__PURE__*/React.createElement(TimeSlider, {
19032
+ mapId: mapId,
18598
19033
  buttons: /*#__PURE__*/React.createElement(TimeSliderButtonsConnect, {
18599
19034
  mapId: mapId,
18600
19035
  sourceId: sourceId
@@ -22749,12 +23184,11 @@ var useKeyboardZoomAndPan = function useKeyboardZoomAndPan(mapIsActive, mapId) {
22749
23184
  var handleKeyPress = function handleKeyPress(event) {
22750
23185
  var target = event.target;
22751
23186
  var map = getWMJSMapById(mapId);
23187
+ var key = event.key,
23188
+ type = event.type;
23189
+ keysPressedDown[key] = type === 'keydown';
22752
23190
 
22753
23191
  if (map && target.tagName !== 'INPUT' && mapIsActive) {
22754
- var key = event.key,
22755
- type = event.type;
22756
- keysPressedDown[key] = type === 'keydown';
22757
-
22758
23192
  if (keysPressedDown['+']) {
22759
23193
  map.zoomIn(1);
22760
23194
  } else if (keysPressedDown['-']) {
@@ -23131,6 +23565,9 @@ var OptionsMenuConnect = function OptionsMenuConnect(_ref) {
23131
23565
  mapId: mapId,
23132
23566
  sourceId: sourceId
23133
23567
  }),
23568
+ animationLengthBtn: /*#__PURE__*/React__default.createElement(AnimationLengthButtonConnect, {
23569
+ mapId: mapId
23570
+ }),
23134
23571
  autoUpdateBtn: /*#__PURE__*/React__default.createElement(AutoUpdateButtonConnect, {
23135
23572
  mapId: mapId
23136
23573
  }),
@@ -23565,13 +24002,389 @@ var TimeSliderClockConnect = function TimeSliderClockConnect(_ref) {
23565
24002
  });
23566
24003
  };
23567
24004
 
24005
+ /* *
24006
+ * Licensed under the Apache License, Version 2.0 (the "License");
24007
+ * you may not use this file except in compliance with the License.
24008
+ * You may obtain a copy of the License at
24009
+ *
24010
+ * http://www.apache.org/licenses/LICENSE-2.0
24011
+ *
24012
+ * Unless required by applicable law or agreed to in writing, software
24013
+ * distributed under the License is distributed on an "AS IS" BASIS,
24014
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
24015
+ * See the License for the specific language governing permissions and
24016
+ * limitations under the License.
24017
+ *
24018
+ * Copyright 2022 - Koninklijk Nederlands Meteorologisch Instituut (KNMI)
24019
+ * Copyright 2022 - Finnish Meteorological Institute (FMI)
24020
+ * */
24021
+ /**
24022
+ * Get the title for this WMS layer based on its layerId. If not defined, layerId is used instead.
24023
+ * @param layerId
24024
+ * @returns Title for the layer
24025
+ */
24026
+
24027
+ var getTitle = function getTitle(layerId) {
24028
+ var wmjsLayer = getWMLayerById(layerId);
24029
+ return wmjsLayer ? wmjsLayer.title || wmjsLayer.name : layerId;
24030
+ };
24031
+ /**
24032
+ * Make a list of GFI Layers to display.
24033
+ * @param layers
24034
+ * @param mapId
24035
+ * @returns
24036
+ */
24037
+
24038
+
24039
+ var getLayersToUpdate = function getLayersToUpdate(layers, mapId) {
24040
+ var wmjsMap = getWMJSMapById(mapId);
24041
+ if (!wmjsMap || !layers || layers.length === 0) return [];
24042
+ return layers.filter(function (layer) {
24043
+ return layer && layer.enabled && !!getWMLayerById(layer.id);
24044
+ }).map(function (layer) {
24045
+ /*
24046
+ We need a wmjsLayer to build the getfeatureinfo url (getWMSGetFeatureInfoRequestURL function).
24047
+ But it seems that its dimension are lazely updated (by ReactMapView).
24048
+ Therefore make a clone of this layer and set its dimensions based on the layer object.
24049
+ Otherwise we risk making a getfeatureinfo call with outdated dimension values.
24050
+ */
24051
+ var wmjsLayer = getWMLayerById(layer.id).cloneLayer();
24052
+ layer.dimensions && layer.dimensions.forEach(function (dim) {
24053
+ var wmDim = wmjsLayer.getDimension(dim.name);
24054
+
24055
+ if (wmDim && wmDim.getValue() !== dim.currentValue) {
24056
+ wmDim.setValue(dim.currentValue);
24057
+ }
24058
+ });
24059
+ return {
24060
+ layerId: layer.id,
24061
+ url: wmjsMap.getWMSGetFeatureInfoRequestURL(wmjsLayer, "".concat(wmjsMap.getMapPin().getXY().x), "".concat(wmjsMap.getMapPin().getXY().y), 'text/html'),
24062
+ title: getTitle(layer.id)
24063
+ };
24064
+ });
24065
+ };
24066
+
24067
+ var GetFeatureInfoDialog = function GetFeatureInfoDialog(_ref) {
24068
+ var layers = _ref.layers,
24069
+ isOpen = _ref.isOpen,
24070
+ onClose = _ref.onClose,
24071
+ _ref$onMouseDown = _ref.onMouseDown,
24072
+ onMouseDown = _ref$onMouseDown === void 0 ? function () {} : _ref$onMouseDown,
24073
+ mapId = _ref.mapId,
24074
+ _ref$showMapId = _ref.showMapId,
24075
+ showMapId = _ref$showMapId === void 0 ? false : _ref$showMapId,
24076
+ _ref$order = _ref.order,
24077
+ order = _ref$order === void 0 ? 0 : _ref$order,
24078
+ _ref$source = _ref.source,
24079
+ source = _ref$source === void 0 ? 'app' : _ref$source,
24080
+ mapPinLocation = _ref.mapPinLocation;
24081
+
24082
+ /* Ref and state for maplocation */
24083
+ var mapLocationWasChanged = React__default.useRef(false);
24084
+
24085
+ var _React$useState = React__default.useState(false),
24086
+ _React$useState2 = _slicedToArray(_React$useState, 2),
24087
+ isInitialMapLocationChanged = _React$useState2[0],
24088
+ setInitialMapLocationIsChanged = _React$useState2[1];
24089
+ /* Ref, state and update function for results per layer map */
24090
+
24091
+
24092
+ var gfiResultMap = React__default.useRef(new Map()).current;
24093
+
24094
+ var _React$useState3 = React__default.useState(),
24095
+ _React$useState4 = _slicedToArray(_React$useState3, 2),
24096
+ triggerRerender = _React$useState4[1];
24097
+
24098
+ var updateLayerResult = function updateLayerResult(_ref2) {
24099
+ var layerId = _ref2.layerId,
24100
+ data = _ref2.data,
24101
+ isLoading = _ref2.isLoading;
24102
+ gfiResultMap.set(layerId, {
24103
+ data: data,
24104
+ isLoading: isLoading
24105
+ });
24106
+ triggerRerender("".concat(layerId).concat(isLoading));
24107
+ };
24108
+ /* Build a layerlist array with a set of arguments per layer to do the query for */
24109
+
24110
+
24111
+ var layerToUpdateList = getLayersToUpdate(layers, mapId);
24112
+ /*
24113
+ Build a string based on the GFI urls. If this changes for whatever reason we need to update.
24114
+ These strings can change very often, therefore they need to be debounced and only use the most recent result must be used.
24115
+ */
24116
+
24117
+ var debouncedlayerListString = useDebounce(layerToUpdateList.map(function (layer) {
24118
+ return layer.url;
24119
+ }).join(','), 100);
24120
+ /* Do a GFI call to the server and use the updateLayerResult to provide the results. */
24121
+
24122
+ var fetchLayerInfo = function fetchLayerInfo(url, layerId) {
24123
+ return __awaiter(void 0, void 0, void 0, /*#__PURE__*/regeneratorRuntime.mark(function _callee() {
24124
+ var _yield$axios$get, data, errorMessage;
24125
+
24126
+ return regeneratorRuntime.wrap(function _callee$(_context) {
24127
+ while (1) {
24128
+ switch (_context.prev = _context.next) {
24129
+ case 0:
24130
+ _context.prev = 0;
24131
+ updateLayerResult({
24132
+ layerId: layerId,
24133
+ data: '',
24134
+ isLoading: true
24135
+ });
24136
+ _context.next = 4;
24137
+ return axios.get(url);
24138
+
24139
+ case 4:
24140
+ _yield$axios$get = _context.sent;
24141
+ data = _yield$axios$get.data;
24142
+ updateLayerResult({
24143
+ layerId: layerId,
24144
+ data: data,
24145
+ isLoading: false
24146
+ });
24147
+ _context.next = 13;
24148
+ break;
24149
+
24150
+ case 9:
24151
+ _context.prev = 9;
24152
+ _context.t0 = _context["catch"](0);
24153
+ errorMessage = _context.t0.message();
24154
+ updateLayerResult({
24155
+ layerId: layerId,
24156
+ data: errorMessage,
24157
+ isLoading: false
24158
+ });
24159
+
24160
+ case 13:
24161
+ case "end":
24162
+ return _context.stop();
24163
+ }
24164
+ }
24165
+ }, _callee, null, [[0, 9]]);
24166
+ }));
24167
+ };
24168
+ /* Wait till the user has clicked the map. */
24169
+
24170
+
24171
+ React__default.useEffect(function () {
24172
+ if (mapLocationWasChanged.current !== false) {
24173
+ setInitialMapLocationIsChanged(true);
24174
+ }
24175
+
24176
+ mapLocationWasChanged.current = true;
24177
+ }, [mapPinLocation]);
24178
+ /* For each changed getfeature url string, load new data using WMS GetFeatureInfo */
24179
+
24180
+ React__default.useEffect(function () {
24181
+ if (isInitialMapLocationChanged && isOpen) {
24182
+ layerToUpdateList.forEach(function (_ref3) {
24183
+ var url = _ref3.url,
24184
+ layerId = _ref3.layerId;
24185
+ fetchLayerInfo(url, layerId);
24186
+ });
24187
+ } // eslint-disable-next-line react-hooks/exhaustive-deps
24188
+
24189
+ }, [debouncedlayerListString]);
24190
+ var hasLayers = layers && layers.length > 0;
24191
+ return /*#__PURE__*/React__default.createElement(ToolContainerDraggable, {
24192
+ startPosition: {
24193
+ right: 10,
24194
+ top: 80
24195
+ },
24196
+ minWidth: 300,
24197
+ onClose: onClose,
24198
+ title: showMapId ? "Event marker info ".concat(mapId) : 'Event marker info',
24199
+ headerSize: "small",
24200
+ initialMaxHeight: 440,
24201
+ isOpen: isOpen,
24202
+ "data-testid": "moveable-getfeatureinfo",
24203
+ bounds: "parent",
24204
+ onMouseDown: onMouseDown,
24205
+ order: order,
24206
+ source: source
24207
+ }, /*#__PURE__*/React__default.createElement(Box, {
24208
+ sx: {
24209
+ padding: 0
24210
+ }
24211
+ }, isOpen && hasLayers && isInitialMapLocationChanged && /*#__PURE__*/React__default.createElement(Box, {
24212
+ "data-testid": "GetFeatureInfoList"
24213
+ }, layerToUpdateList.map(function (layer) {
24214
+ var layerId = layer.layerId,
24215
+ title = layer.title,
24216
+ url = layer.url;
24217
+ var result = gfiResultMap.get(layerId);
24218
+ if (!result) return null;
24219
+ return /*#__PURE__*/React__default.createElement(Grid, {
24220
+ key: layerId,
24221
+ sx: {
24222
+ margin: '4px 6px 4px 6px',
24223
+ padding: '6px',
24224
+ backgroundColor: 'geowebColors.cards.cardContainer',
24225
+ border: 'solid 1px',
24226
+ borderColor: 'geowebColors.cards.cardContainerBorder'
24227
+ }
24228
+ }, /*#__PURE__*/React__default.createElement(Typography, {
24229
+ variant: "subtitle1"
24230
+ }, title, "\xA0", /*#__PURE__*/React__default.createElement(IconButton, {
24231
+ sx: {
24232
+ "float": 'right'
24233
+ },
24234
+ size: "small",
24235
+ "aria-label": "Open layer featureinfo in another page",
24236
+ onClick: function onClick() {
24237
+ window.open(url);
24238
+ }
24239
+ }, /*#__PURE__*/React__default.createElement(ExitDomain, null))), !result.isLoading ? /*#__PURE__*/React__default.createElement("div", {
24240
+ style: {
24241
+ fontSize: '11px',
24242
+ padding: '6px',
24243
+ margin: '0',
24244
+ fontFamily: 'Roboto,Helvetica,Arial,sans-serif',
24245
+ fontWeight: '400',
24246
+ lineHeight: '1.75',
24247
+ letterSpacing: '0.25px'
24248
+ },
24249
+ "data-testid": "layer-result-ready-".concat(layerId),
24250
+ // eslint-disable-next-line react/no-danger
24251
+ dangerouslySetInnerHTML: {
24252
+ __html: result.data.replace(/<hr\/>/g, '')
24253
+ }
24254
+ }) : /*#__PURE__*/React__default.createElement("div", {
24255
+ "data-testid": "layer-result-loading-".concat(layerId)
24256
+ }, /*#__PURE__*/React__default.createElement(CircularProgress, {
24257
+ "data-testid": "spinner",
24258
+ color: "inherit"
24259
+ })));
24260
+ })), hasLayers && !isInitialMapLocationChanged && /*#__PURE__*/React__default.createElement(Typography, {
24261
+ "data-testid": "click-on-map-for-info",
24262
+ variant: "subtitle1",
24263
+ sx: {
24264
+ padding: '10px'
24265
+ }
24266
+ }, "Click on the map for info."), !hasLayers && /*#__PURE__*/React__default.createElement(Typography, {
24267
+ "data-testid": "NoLayers",
24268
+ variant: "subtitle1",
24269
+ sx: {
24270
+ padding: '10px'
24271
+ }
24272
+ }, "No layers added to the map.")));
24273
+ };
24274
+
24275
+ /* *
24276
+ * Licensed under the Apache License, Version 2.0 (the "License");
24277
+ * you may not use this file except in compliance with the License.
24278
+ * You may obtain a copy of the License at
24279
+ *
24280
+ * http://www.apache.org/licenses/LICENSE-2.0
24281
+ *
24282
+ * Unless required by applicable law or agreed to in writing, software
24283
+ * distributed under the License is distributed on an "AS IS" BASIS,
24284
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
24285
+ * See the License for the specific language governing permissions and
24286
+ * limitations under the License.
24287
+ *
24288
+ * Copyright 2022 - Koninklijk Nederlands Meteorologisch Instituut (KNMI)
24289
+ * Copyright 2022 - Finnish Meteorological Institute (FMI)
24290
+ * */
24291
+
24292
+ var GetFeatureInfoConnect = function GetFeatureInfoConnect(_ref) {
24293
+ var _ref$showMapId = _ref.showMapId,
24294
+ showMapId = _ref$showMapId === void 0 ? false : _ref$showMapId,
24295
+ mapId = _ref.mapId;
24296
+ var dispatch = useDispatch();
24297
+ var getFeatureInfoType = "getfeatureinfo-".concat(mapId);
24298
+ var isMapPinVisible = useSelector(function (store) {
24299
+ return getDisplayMapPin(store, mapId);
24300
+ });
24301
+ var mapPinLocation = useSelector(function (store) {
24302
+ return getPinLocation(store, mapId);
24303
+ });
24304
+ var toggleMapPinIsVisible = React.useCallback(function (displayMapPin) {
24305
+ dispatch(mapActions$1.toggleMapPinIsVisible({
24306
+ mapId: mapId,
24307
+ displayMapPin: displayMapPin
24308
+ }));
24309
+ }, [dispatch, mapId]);
24310
+ var mapLayers = useSelector(function (store) {
24311
+ return getMapLayers(store, mapId);
24312
+ });
24313
+
24314
+ var _useSetupDialog = useSetupDialog(getFeatureInfoType),
24315
+ dialogOrder = _useSetupDialog.dialogOrder,
24316
+ isDialogOpen = _useSetupDialog.isDialogOpen,
24317
+ uiSource = _useSetupDialog.uiSource,
24318
+ setDialogOrder = _useSetupDialog.setDialogOrder,
24319
+ onCloseDialog = _useSetupDialog.onCloseDialog;
24320
+
24321
+ React.useEffect(function () {
24322
+ toggleMapPinIsVisible(isDialogOpen);
24323
+ }, [isDialogOpen, toggleMapPinIsVisible, isMapPinVisible]);
24324
+ return /*#__PURE__*/React.createElement(GetFeatureInfoDialog, {
24325
+ layers: mapLayers,
24326
+ isOpen: isDialogOpen,
24327
+ onClose: onCloseDialog,
24328
+ mapId: mapId,
24329
+ showMapId: showMapId,
24330
+ onMouseDown: setDialogOrder,
24331
+ order: dialogOrder,
24332
+ source: uiSource,
24333
+ mapPinLocation: mapPinLocation
24334
+ });
24335
+ };
24336
+
24337
+ /* *
24338
+ * Licensed under the Apache License, Version 2.0 (the "License");
24339
+ * you may not use this file except in compliance with the License.
24340
+ * You may obtain a copy of the License at
24341
+ *
24342
+ * http://www.apache.org/licenses/LICENSE-2.0
24343
+ *
24344
+ * Unless required by applicable law or agreed to in writing, software
24345
+ * distributed under the License is distributed on an "AS IS" BASIS,
24346
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
24347
+ * See the License for the specific language governing permissions and
24348
+ * limitations under the License.
24349
+ *
24350
+ * Copyright 2022 - Koninklijk Nederlands Meteorologisch Instituut (KNMI)
24351
+ * Copyright 2022 - Finnish Meteorological Institute (FMI)
24352
+ * */
24353
+
24354
+ var GetFeatureInfoButtonConnect = function GetFeatureInfoButtonConnect(_ref) {
24355
+ var mapId = _ref.mapId,
24356
+ _ref$source = _ref.source,
24357
+ source = _ref$source === void 0 ? 'app' : _ref$source;
24358
+ var dispatch = useDispatch();
24359
+ var gfiType = "getfeatureinfo-".concat(mapId);
24360
+ var isOpenInStore = useSelector(function (store) {
24361
+ return getisDialogOpen(store, gfiType);
24362
+ });
24363
+ var openGfiDialog = React.useCallback(function () {
24364
+ dispatch(uiActions.setActiveMapIdForDialog({
24365
+ type: gfiType,
24366
+ mapId: mapId,
24367
+ setOpen: !isOpenInStore,
24368
+ source: source,
24369
+ origin: MapActionOrigin.map
24370
+ }));
24371
+ }, [mapId, dispatch, isOpenInStore, source, gfiType]);
24372
+ return /*#__PURE__*/React.createElement(MapControlButton, {
24373
+ title: "Get information for a specific location",
24374
+ "data-testid": "open-getfeatureinfo",
24375
+ onClick: openGfiDialog,
24376
+ isActive: isOpenInStore
24377
+ }, /*#__PURE__*/React.createElement(Info, null));
24378
+ };
24379
+
23568
24380
  var titleStyle = function titleStyle(theme) {
23569
24381
  return {
23570
24382
  position: 'absolute',
23571
24383
  padding: '5px',
23572
24384
  zIndex: 50,
23573
24385
  color: theme.palette.common.black,
23574
- whiteSpace: 'nowrap'
24386
+ whiteSpace: 'nowrap',
24387
+ userSelect: 'none'
23575
24388
  };
23576
24389
  };
23577
24390
 
@@ -23616,8 +24429,10 @@ var ConfigurableMapConnect = function ConfigurableMapConnect(_a) {
23616
24429
  shouldShowLayerManager = _a.shouldShowLayerManager,
23617
24430
  _a$showClock = _a.showClock,
23618
24431
  showClock = _a$showClock === void 0 ? true : _a$showClock,
24432
+ _a$displayGetFeatureI = _a.displayGetFeatureInfoButtonInMap,
24433
+ displayGetFeatureInfoButtonInMap = _a$displayGetFeatureI === void 0 ? false : _a$displayGetFeatureI,
23619
24434
  children = _a.children,
23620
- props = __rest(_a, ["id", "title", "layers", "shouldAutoUpdate", "shouldAnimate", "bbox", "srs", "shouldShowZoomControls", "displayMapPin", "showTimeSlider", "disableTimeSlider", "displayTimeInMap", "displayLayerManagerAndLegendButtonInMap", "displayDimensionSelectButtonInMap", "multiLegend", "shouldShowLayerManager", "showClock", "children"]);
24435
+ props = __rest(_a, ["id", "title", "layers", "shouldAutoUpdate", "shouldAnimate", "bbox", "srs", "shouldShowZoomControls", "displayMapPin", "showTimeSlider", "disableTimeSlider", "displayTimeInMap", "displayLayerManagerAndLegendButtonInMap", "displayDimensionSelectButtonInMap", "multiLegend", "shouldShowLayerManager", "showClock", "displayGetFeatureInfoButtonInMap", "children"]);
23621
24436
 
23622
24437
  var dispatch = useDispatch();
23623
24438
  var mapId = React__default.useRef(id || generateMapId()).current;
@@ -23683,6 +24498,8 @@ var ConfigurableMapConnect = function ConfigurableMapConnect(_a) {
23683
24498
  multiLegend: multiLegend
23684
24499
  }), displayDimensionSelectButtonInMap && /*#__PURE__*/React__default.createElement(MultiDimensionSelectMapButtonsConnect, {
23685
24500
  mapId: mapId
24501
+ }), displayGetFeatureInfoButtonInMap && /*#__PURE__*/React__default.createElement(GetFeatureInfoButtonConnect, {
24502
+ mapId: mapId
23686
24503
  })), !disableTimeSlider && /*#__PURE__*/React__default.createElement(Box, {
23687
24504
  sx: {
23688
24505
  position: 'absolute',
@@ -23705,6 +24522,9 @@ var ConfigurableMapConnect = function ConfigurableMapConnect(_a) {
23705
24522
  multiLegend: multiLegend
23706
24523
  }), showClock && /*#__PURE__*/React__default.createElement(TimeSliderClockConnect, {
23707
24524
  mapId: mapId
24525
+ }), displayGetFeatureInfoButtonInMap && /*#__PURE__*/React__default.createElement(GetFeatureInfoConnect, {
24526
+ showMapId: true,
24527
+ mapId: mapId
23708
24528
  }), /*#__PURE__*/React__default.createElement(DockedLayerManagerConnect, {
23709
24529
  mapId: mapId,
23710
24530
  bounds: "parent"
@@ -24042,7 +24862,8 @@ var componentsLookUp = function componentsLookUp(_ref) {
24042
24862
  var mapPreset = initialProps.mapPreset;
24043
24863
  return /*#__PURE__*/React__default.createElement(ConfigurableMapConnect, Object.assign({}, mapPreset, {
24044
24864
  id: id,
24045
- "data-testid": "coreConfigurableMapConnect"
24865
+ "data-testid": "coreConfigurableMapConnect",
24866
+ displayGetFeatureInfoButtonInMap: true
24046
24867
  }));
24047
24868
  }
24048
24869
 
@@ -24735,21 +25556,29 @@ var CoreThemeStoreProvider = function CoreThemeStoreProvider(_ref3) {
24735
25556
  * */
24736
25557
  var MapWarningProperties = function MapWarningProperties(_ref) {
24737
25558
  var selectedFeatureProperties = _ref.selectedFeatureProperties,
24738
- languageIndex = _ref.languageIndex;
25559
+ languageIndex = _ref.languageIndex,
25560
+ parentSize = _ref.parentSize;
24739
25561
  var language = languageIndex || 0;
25562
+ var newWidth = parentSize ? parentSize - 100 : 350;
24740
25563
  return /*#__PURE__*/React__default.createElement("div", {
25564
+ style: {
25565
+ position: 'fixed',
25566
+ width: "".concat(newWidth, "px"),
25567
+ height: '1px',
25568
+ display: 'flex',
25569
+ justifyContent: 'center',
25570
+ left: '50px'
25571
+ }
25572
+ }, /*#__PURE__*/React__default.createElement("div", {
24741
25573
  "data-testid": "map-warning-properties",
24742
25574
  style: {
24743
- width: '100%',
24744
- height: '15%',
24745
- marginTop: '30px',
24746
- marginLeft: '100px',
24747
- position: 'relative',
24748
- zIndex: 10000,
24749
- backgroundColor: '#CCCCCCC0',
25575
+ marginTop: '50px',
25576
+ width: '350px',
25577
+ height: '190px',
24750
25578
  padding: '0px 20px 20px',
24751
25579
  overflow: 'auto',
24752
- fontSize: '11px'
25580
+ fontSize: '11px',
25581
+ backgroundColor: '#CCCCCCC0'
24753
25582
  }
24754
25583
  }, /*#__PURE__*/React__default.createElement("h1", {
24755
25584
  "data-testid": "map-warning-properties-title"
@@ -24763,7 +25592,7 @@ var MapWarningProperties = function MapWarningProperties(_ref) {
24763
25592
  "data-testid": "map-warning-properties-row"
24764
25593
  }, "Sender: ", selectedFeatureProperties.languages[language].senderName), selectedFeatureProperties.identifier && /*#__PURE__*/React__default.createElement("pre", {
24765
25594
  "data-testid": "map-warning-properties-row"
24766
- }, "Identifier: ", selectedFeatureProperties.identifier));
25595
+ }, "Identifier: ", selectedFeatureProperties.identifier)));
24767
25596
  };
24768
25597
 
24769
25598
  /* *