@opengeoweb/core 4.7.1 → 4.8.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (39) hide show
  1. package/index.esm.js +1877 -1371
  2. package/index.umd.js +3119 -2573
  3. package/lib/components/AppWrapper/AppWrapperConnect.d.ts +6 -0
  4. package/lib/components/AppWrapper/index.d.ts +1 -0
  5. package/lib/components/ConfigurableMap/ConfigurableMapConnect.d.ts +3 -1
  6. package/lib/components/LayerManager/LayerManagerUtils.d.ts +3 -0
  7. package/lib/components/LayerManager/LayerSelect/LayerList/LayerList.d.ts +1 -0
  8. package/lib/components/LayerManager/LayerSelect/LayerList/LayerListRow.d.ts +1 -0
  9. package/lib/components/LayerManager/LayerSelect/LayerList/SearchHighlight.d.ts +7 -0
  10. package/lib/components/LayerManager/LayerSelect/LayerList/SearchHighlight.spec.d.ts +1 -0
  11. package/lib/components/LayerManager/LayerSelect/LayerManagerUtils.spec.d.ts +1 -0
  12. package/lib/components/LayerManager/LayerSelect/SearchField/SearchField.d.ts +1 -0
  13. package/lib/components/LayerManager/LayerSelect/ServiceOptionsDialog/ServiceOptionsDialog.d.ts +2 -3
  14. package/lib/components/LayerManager/LayerSelect/ServiceOptionsDialog/ServiceOptionsDialogConnect.d.ts +0 -2
  15. package/lib/components/LayerManager/LayerSelect/ServicePopup/ServicePopup.d.ts +1 -2
  16. package/lib/components/LayerManager/LayerSelect/ServicePopup/ServicePopupConnect.d.ts +1 -10
  17. package/lib/components/LayerManager/LayerSelect/ServicePopup/ServicePopupConnect.spec.d.ts +1 -0
  18. package/lib/components/LayerManager/LayerSelect/ServicePopup/ServicePopupConnect.stories.d.ts +0 -3
  19. package/lib/components/LayerManager/LayerSelect/ServicePopup/ServicePopupDialogConnect.d.ts +11 -0
  20. package/lib/components/ReactMapView/ReactMapView.d.ts +8 -31
  21. package/lib/components/ReactMapView/ReactMapViewParseLayer.d.ts +2 -2
  22. package/lib/components/ReactMapView/utils.d.ts +22 -0
  23. package/lib/components/ReactMapView/utils.spec.d.ts +1 -0
  24. package/lib/index.d.ts +4 -2
  25. package/lib/store/app/config.d.ts +5 -0
  26. package/lib/store/app/index.d.ts +1 -0
  27. package/lib/store/app/reducer.d.ts +12 -0
  28. package/lib/store/app/reducer.spec.d.ts +1 -0
  29. package/lib/store/app/types.d.ts +6 -0
  30. package/lib/store/index.d.ts +1 -0
  31. package/lib/store/layerSelect/reducer.d.ts +4 -1
  32. package/lib/store/layerSelect/selectors.d.ts +9 -1
  33. package/lib/store/layerSelect/types.d.ts +14 -0
  34. package/lib/store/mapStore/map/reducer.d.ts +3 -1
  35. package/lib/store/mapStore/map/sagas.d.ts +2 -0
  36. package/lib/store/mapStore/map/selectors.d.ts +20 -0
  37. package/lib/store/mapStore/map/types.d.ts +9 -0
  38. package/lib/store/mapStore/utils/helpers.d.ts +2 -0
  39. package/package.json +12 -12
package/index.esm.js CHANGED
@@ -3,21 +3,21 @@ import produce$1, { current, produce } from 'immer';
3
3
  import moment from 'moment';
4
4
  import * as React from 'react';
5
5
  import React__default, { Component, useRef, useState, useEffect, useCallback } from 'react';
6
- import _, { debounce, isEqual, groupBy, throttle, range } from 'lodash';
6
+ import _, { debounce, isEqual, escapeRegExp, groupBy, throttle, range } from 'lodash';
7
7
  import { takeLatest, put, select, call, takeEvery, all, delay } from 'redux-saga/effects';
8
8
  import { connect, useDispatch, useSelector, Provider } from 'react-redux';
9
9
  import { CustomTooltip, ToolButton, ToolContainerDraggable, IS_JEST, TooltipSelect, AlertIcon, useControlledTooltip, tooltipContainerStyles, sliderHeaderStyle, CustomSlider, ToggleMenu, ManagerButton, CustomAccordion, EnableButton, ManagerDeleteButton, AlertBanner, calculateDialogSizeAndPosition, useIsMounted, CustomToggleButton, useMakeSureContainerStaysInsideWindow, withEggs } from '@opengeoweb/shared';
10
- import { Pause, Play, Add, Copy, Both, None, DragHandle as DragHandle$1, Cached, CollapseSmall, CollapseMedium, CollapseLarge, CollapseWindow, ExpandWindow, Filter, Search, Clear, Close, Info, DimensionsOther, DimensionsElevation, DimensionsRefTime, DimensionsTime, Edit, Visibility, Delete, Home, Minus, Layers, Equalizer, Link, LinkOff, AutoUpdateActive, AutoUpdateInActive, TextIcon, Speed, FastForward, Clock, Now, Animation, Options, StepForward, StepBackward, dragHandlePath, ChevronDown, ChevronUp, List as List$1, ChevronRight, ChevronLeft, Resize, ExitDomain, ThemeWrapper, lightTheme } from '@opengeoweb/theme';
10
+ import { Pause, Play, CollapseSmall, CollapseMedium, CollapseLarge, CollapseWindow, ExpandWindow, Add, Copy, Both, None, DragHandle as DragHandle$1, Cached, Filter, Search, Clear, Info, DimensionsOther, DimensionsElevation, DimensionsRefTime, DimensionsTime, Edit, Visibility, Delete, Close, 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';
14
14
  import Sortable from 'sortablejs';
15
- import { ReactHookFormProvider, defaultFormOptions, ReactHookFormTextField } from '@opengeoweb/form-fields';
16
- import { useFormContext } from 'react-hook-form';
17
15
  import { FixedSizeList } from 'react-window';
18
16
  import Box$1 from '@mui/material/Box';
19
17
  import Typography$1 from '@mui/material/Typography';
20
18
  import Grid$1 from '@mui/material/Grid';
19
+ import { ReactHookFormProvider, defaultFormOptions, ReactHookFormTextField } from '@opengeoweb/form-fields';
20
+ import { useFormContext } from 'react-hook-form';
21
21
  import { Box as Box$2 } from '@mui/system';
22
22
  import { debounce as debounce$1 } from 'throttle-debounce';
23
23
  import cloneDeep from 'lodash.clonedeep';
@@ -480,6 +480,13 @@ var registerWMLayer = function registerWMLayer(wmLayer, layerId) {
480
480
  var getWMLayerById = function getWMLayerById(layerId) {
481
481
  return registeredWMLayersForReactLayerId[layerId];
482
482
  };
483
+ var unRegisterWMJSLayer = function unRegisterWMJSLayer(layerId) {
484
+ var layer = registeredWMLayersForReactLayerId[layerId];
485
+
486
+ if (layer) {
487
+ delete registeredWMLayersForReactLayerId[layerId];
488
+ }
489
+ };
483
490
  /**
484
491
  * Map for registering wmlayers with their id's
485
492
  */
@@ -492,8 +499,33 @@ var registeredWMMapForReactMapId = {};
492
499
  */
493
500
 
494
501
  var registerWMJSMap = function registerWMJSMap(wmjsMap, wmjsMapId) {
502
+ if (registeredWMMapForReactMapId[wmjsMapId]) {
503
+ console.warn("Map with id ".concat(wmjsMapId, " already made"));
504
+ }
505
+
495
506
  registeredWMMapForReactMapId[wmjsMapId] = wmjsMap;
496
507
  };
508
+ var unRegisterWMJSMap = function unRegisterWMJSMap(wmjsMapId) {
509
+ var wmjsMap = registeredWMMapForReactMapId[wmjsMapId];
510
+
511
+ if (wmjsMap) {
512
+ wmjsMap.getListener().suspendEvents();
513
+
514
+ try {
515
+ wmjsMap.stopAnimating && wmjsMap.stopAnimating(); // eslint-disable-next-line no-empty
516
+ } catch (e) {}
517
+
518
+ Object.keys(registeredWMLayersForReactLayerId).forEach(function (layerId) {
519
+ var wmLayer = getWMLayerById(layerId);
520
+
521
+ if (wmLayer.parentMap === wmjsMap) {
522
+ unRegisterWMJSLayer(layerId);
523
+ }
524
+ });
525
+ wmjsMap.destroy();
526
+ delete registeredWMMapForReactMapId[wmjsMapId];
527
+ }
528
+ };
497
529
  /**
498
530
  * Get the wmjsMap from the lookuptable with wmjsMapId
499
531
  * @param {string} wmjsMapId
@@ -1597,7 +1629,7 @@ var createLayer = function createLayer(_a) {
1597
1629
  status: status
1598
1630
  });
1599
1631
  };
1600
- var initialState$6 = {
1632
+ var initialState$7 = {
1601
1633
  byId: {},
1602
1634
  allIds: [],
1603
1635
  availableBaseLayers: {
@@ -1605,8 +1637,8 @@ var initialState$6 = {
1605
1637
  allIds: []
1606
1638
  }
1607
1639
  };
1608
- var slice$6 = createSlice({
1609
- initialState: initialState$6,
1640
+ var slice$7 = createSlice({
1641
+ initialState: initialState$7,
1610
1642
  name: 'layerReducer',
1611
1643
  reducers: {
1612
1644
  addLayer: function addLayer(draft, action) {
@@ -1850,9 +1882,9 @@ var slice$6 = createSlice({
1850
1882
  layerDimensions = _action$payload12.layerDimensions;
1851
1883
  var layerStyleAction = layerActions.layerChangeStyle(layerStyle);
1852
1884
  var state = current(draft);
1853
- var intermediateState = layerStyle === null ? state : reducer$6(state, layerStyleAction);
1885
+ var intermediateState = layerStyle === null ? state : reducer$7(state, layerStyleAction);
1854
1886
  var dimensionsAction = layerActions.layerSetDimensions(layerDimensions);
1855
- var newState = layerDimensions === null ? intermediateState : reducer$6(intermediateState, dimensionsAction);
1887
+ var newState = layerDimensions === null ? intermediateState : reducer$7(intermediateState, dimensionsAction);
1856
1888
  return newState;
1857
1889
  },
1858
1890
  setSelectedFeature: function setSelectedFeature(draft, action) {
@@ -1908,7 +1940,7 @@ var slice$6 = createSlice({
1908
1940
  };
1909
1941
  /* Handle the Layer action with the same logic, using the same reducer */
1910
1942
 
1911
- return reducer$6(prevState, action);
1943
+ return reducer$7(prevState, action);
1912
1944
  }, state);
1913
1945
  }).addCase(setMapPreset, function (draft, action) {
1914
1946
  var mapId = action.payload.mapId;
@@ -1928,8 +1960,8 @@ var slice$6 = createSlice({
1928
1960
  });
1929
1961
  }
1930
1962
  });
1931
- var reducer$6 = slice$6.reducer;
1932
- var layerActions = slice$6.actions;
1963
+ var reducer$7 = slice$7.reducer;
1964
+ var layerActions = slice$7.actions;
1933
1965
 
1934
1966
  /* *
1935
1967
  * Licensed under the Apache License, Version 2.0 (the "License");
@@ -1947,12 +1979,12 @@ var layerActions = slice$6.actions;
1947
1979
  * Copyright 2020 - Koninklijk Nederlands Meteorologisch Instituut (KNMI)
1948
1980
  * Copyright 2020 - Finnish Meteorological Institute (FMI)
1949
1981
  * */
1950
- var initialState$5 = {
1982
+ var initialState$6 = {
1951
1983
  byId: {},
1952
1984
  allIds: []
1953
1985
  };
1954
- var slice$5 = createSlice({
1955
- initialState: initialState$5,
1986
+ var slice$6 = createSlice({
1987
+ initialState: initialState$6,
1956
1988
  name: 'serviceReducer',
1957
1989
  reducers: {
1958
1990
  serviceSetLayers: function serviceSetLayers(draft, action) {
@@ -1979,13 +2011,13 @@ var slice$5 = createSlice({
1979
2011
  var serviceLayers = action.payload.serviceLayers;
1980
2012
  if (serviceLayers === null) return draft;
1981
2013
  var mapAction = serviceActions.serviceSetLayers(serviceLayers);
1982
- var newState = reducer$5(draft, mapAction);
2014
+ var newState = reducer$6(draft, mapAction);
1983
2015
  return newState;
1984
2016
  });
1985
2017
  }
1986
2018
  });
1987
- var reducer$5 = slice$5.reducer;
1988
- var serviceActions = slice$5.actions;
2019
+ var reducer$6 = slice$6.reducer;
2020
+ var serviceActions = slice$6.actions;
1989
2021
 
1990
2022
  /* *
1991
2023
  * Licensed under the Apache License, Version 2.0 (the "License");
@@ -2156,13 +2188,13 @@ var createUIDialogElement = function createUIDialogElement(_ref) {
2156
2188
  error: undefined
2157
2189
  };
2158
2190
  };
2159
- var initialState$4 = {
2191
+ var initialState$5 = {
2160
2192
  order: [],
2161
2193
  dialogs: {},
2162
2194
  activeWindowId: undefined
2163
2195
  };
2164
- var slice$4 = createSlice({
2165
- initialState: initialState$4,
2196
+ var slice$5 = createSlice({
2197
+ initialState: initialState$5,
2166
2198
  name: 'uiReducer',
2167
2199
  reducers: {
2168
2200
  registerDialog: function registerDialog(draft, action) {
@@ -2251,8 +2283,8 @@ var slice$4 = createSlice({
2251
2283
  }
2252
2284
  }
2253
2285
  });
2254
- var reducer$4 = slice$4.reducer;
2255
- var uiActions = slice$4.actions;
2286
+ var reducer$5 = slice$5.reducer;
2287
+ var uiActions = slice$5.actions;
2256
2288
 
2257
2289
  var addBaseLayer = layerActions.addBaseLayer,
2258
2290
  addLayer$1 = layerActions.addLayer,
@@ -2303,12 +2335,12 @@ var createLayersWithIds = function createLayersWithIds(state, layers) {
2303
2335
  });
2304
2336
  };
2305
2337
 
2306
- var initialState$3 = {
2338
+ var initialState$4 = {
2307
2339
  byId: {},
2308
2340
  allIds: []
2309
2341
  };
2310
- var slice$3 = createSlice({
2311
- initialState: initialState$3,
2342
+ var slice$4 = createSlice({
2343
+ initialState: initialState$4,
2312
2344
  name: 'mapReducer',
2313
2345
  reducers: {
2314
2346
  registerMap: function registerMap(draft, action) {
@@ -2602,13 +2634,24 @@ var slice$3 = createSlice({
2602
2634
  }
2603
2635
 
2604
2636
  draft.byId[mapId].displayMapPin = displayMapPin;
2637
+ },
2638
+ setDockedLayerManagerSize: function setDockedLayerManagerSize(draft, action) {
2639
+ var _action$payload22 = action.payload,
2640
+ mapId = _action$payload22.mapId,
2641
+ dockedLayerManagerSize = _action$payload22.dockedLayerManagerSize;
2642
+
2643
+ if (!draft.byId[mapId]) {
2644
+ return;
2645
+ }
2646
+
2647
+ draft.byId[mapId].dockedLayerManagerSize = dockedLayerManagerSize;
2605
2648
  }
2606
2649
  },
2607
2650
  extraReducers: function extraReducers(builder) {
2608
2651
  builder.addCase(addLayer$1, function (draft, action) {
2609
- var _action$payload22 = action.payload,
2610
- layerId = _action$payload22.layerId,
2611
- mapId = _action$payload22.mapId;
2652
+ var _action$payload23 = action.payload,
2653
+ layerId = _action$payload23.layerId,
2654
+ mapId = _action$payload23.mapId;
2612
2655
 
2613
2656
  if (!draft.byId[mapId]) {
2614
2657
  return;
@@ -2625,10 +2668,10 @@ var slice$3 = createSlice({
2625
2668
 
2626
2669
  draft.byId[mapId].mapLayers.unshift(layerId);
2627
2670
  }).addCase(addBaseLayer, function (draft, action) {
2628
- var _action$payload23 = action.payload,
2629
- layer = _action$payload23.layer,
2630
- layerId = _action$payload23.layerId,
2631
- mapId = _action$payload23.mapId;
2671
+ var _action$payload24 = action.payload,
2672
+ layer = _action$payload24.layer,
2673
+ layerId = _action$payload24.layerId,
2674
+ mapId = _action$payload24.mapId;
2632
2675
 
2633
2676
  if (!draft.byId[mapId]) {
2634
2677
  return;
@@ -2678,9 +2721,9 @@ var slice$3 = createSlice({
2678
2721
  }
2679
2722
  }
2680
2723
  }).addCase(setBaseLayers$1, function (draft, action) {
2681
- var _action$payload24 = action.payload,
2682
- layers = _action$payload24.layers,
2683
- mapId = _action$payload24.mapId; // Split into base and overlayers
2724
+ var _action$payload25 = action.payload,
2725
+ layers = _action$payload25.layers,
2726
+ mapId = _action$payload25.mapId; // Split into base and overlayers
2684
2727
 
2685
2728
  var baseLayers = [];
2686
2729
  var overLayers = [];
@@ -2707,9 +2750,9 @@ var slice$3 = createSlice({
2707
2750
  if (overLayerIds.length !== 0) draft.byId[mapId].overLayers = overLayerIds;
2708
2751
  }
2709
2752
  }).addCase(layerDelete$1, function (draft, action) {
2710
- var _action$payload25 = action.payload,
2711
- mapId = _action$payload25.mapId,
2712
- layerId = _action$payload25.layerId;
2753
+ var _action$payload26 = action.payload,
2754
+ mapId = _action$payload26.mapId,
2755
+ layerId = _action$payload26.layerId;
2713
2756
 
2714
2757
  if (!draft.byId[mapId]) {
2715
2758
  return;
@@ -2730,9 +2773,9 @@ var slice$3 = createSlice({
2730
2773
  draft.byId[mapId].activeLayerId = '';
2731
2774
  }
2732
2775
  }).addCase(baseLayerDelete, function (draft, action) {
2733
- var _action$payload26 = action.payload,
2734
- mapId = _action$payload26.mapId,
2735
- layerId = _action$payload26.layerId;
2776
+ var _action$payload27 = action.payload,
2777
+ mapId = _action$payload27.mapId,
2778
+ layerId = _action$payload27.layerId;
2736
2779
 
2737
2780
  if (!draft.byId[mapId]) {
2738
2781
  return;
@@ -2745,14 +2788,14 @@ var slice$3 = createSlice({
2745
2788
  return id !== layerId;
2746
2789
  });
2747
2790
  }).addCase(layerChangeDimension$1, function (draft, action) {
2748
- var _action$payload27 = action.payload,
2749
- layerId = _action$payload27.layerId,
2750
- dimension = _action$payload27.dimension;
2791
+ var _action$payload28 = action.payload,
2792
+ layerId = _action$payload28.layerId,
2793
+ dimension = _action$payload28.dimension;
2751
2794
  produceDraftStateSetMapDimensionFromLayerChangeDimension(draft, layerId, dimension);
2752
2795
  }).addCase(setTimeSync, function (draft, action) {
2753
- var _action$payload28 = action.payload,
2754
- targetsFromAction = _action$payload28.targets,
2755
- source = _action$payload28.source;
2796
+ var _action$payload29 = action.payload,
2797
+ targetsFromAction = _action$payload29.targets,
2798
+ source = _action$payload29.source;
2756
2799
  /* Because we want backwards compatibility with the previous code, we also need to listen to the original source action */
2757
2800
 
2758
2801
  var targets = [{
@@ -2776,9 +2819,9 @@ var slice$3 = createSlice({
2776
2819
  }
2777
2820
  });
2778
2821
  }).addCase(setBboxSync, function (draft, action) {
2779
- var _action$payload29 = action.payload,
2780
- targetsFromAction = _action$payload29.targets,
2781
- source = _action$payload29.source;
2822
+ var _action$payload30 = action.payload,
2823
+ targetsFromAction = _action$payload30.targets,
2824
+ source = _action$payload30.source;
2782
2825
  /* Because we want backwards compatibility with the previous code, we also need to listen to the original source action */
2783
2826
 
2784
2827
  var targets = [{
@@ -2809,9 +2852,9 @@ var slice$3 = createSlice({
2809
2852
  * These targets can be used as payloads in new Layer actions.
2810
2853
  * These actions are here handled via the layer reducer, as it is the same logic
2811
2854
  */
2812
- var _action$payload30 = action.payload,
2813
- targets = _action$payload30.targets,
2814
- source = _action$payload30.source;
2855
+ var _action$payload31 = action.payload,
2856
+ targets = _action$payload31.targets,
2857
+ source = _action$payload31.source;
2815
2858
  return targets.reduce(function (prevState, target) {
2816
2859
  var action = {
2817
2860
  payload: target,
@@ -2819,17 +2862,17 @@ var slice$3 = createSlice({
2819
2862
  };
2820
2863
  /* Handle the Layer action with the same logic, using the same reducer */
2821
2864
 
2822
- return reducer$3(prevState, action);
2865
+ return reducer$4(prevState, action);
2823
2866
  }, draft);
2824
2867
  }).addCase(onUpdateLayerInformation, function (draft, action) {
2825
2868
  var mapDimensions = action.payload.mapDimensions;
2826
2869
  if (mapDimensions === null) return draft;
2827
2870
  var mapAction = mapActions$1.mapUpdateAllMapDimensions(mapDimensions);
2828
- return reducer$3(draft, mapAction);
2871
+ return reducer$4(draft, mapAction);
2829
2872
  }).addCase(mapChangeDimension, function (draft, action) {
2830
- var _action$payload31 = action.payload,
2831
- mapId = _action$payload31.mapId,
2832
- dimensionFromAction = _action$payload31.dimension;
2873
+ var _action$payload32 = action.payload,
2874
+ mapId = _action$payload32.mapId,
2875
+ dimensionFromAction = _action$payload32.dimension;
2833
2876
  produceDraftStateSetWebMapDimension(draft, mapId, dimensionFromAction, true);
2834
2877
  }).addCase(setMapPreset, function (draft, action) {
2835
2878
  var mapId = action.payload.mapId;
@@ -2846,14 +2889,14 @@ var slice$3 = createSlice({
2846
2889
  draft.byId[mapId].isAnimating = false;
2847
2890
  draft.byId[mapId].isTimeSliderVisible = true;
2848
2891
  draft.byId[mapId].isTimestepAuto = true;
2849
- draft.byId[mapId].displayMapPin = false;
2850
2892
  draft.byId[mapId].shouldShowZoomControls = true;
2851
2893
  draft.byId[mapId].timeStep = undefined;
2852
2894
  draft.byId[mapId].animationDelay = defaultAnimationDelayAtStart;
2895
+ draft.byId[mapId].dockedLayerManagerSize = '';
2853
2896
  }).addCase(uiActions.registerDialog, function (draft, action) {
2854
- var _action$payload32 = action.payload,
2855
- mapId = _action$payload32.mapId,
2856
- type = _action$payload32.type;
2897
+ var _action$payload33 = action.payload,
2898
+ mapId = _action$payload33.mapId,
2899
+ type = _action$payload33.type;
2857
2900
 
2858
2901
  if (!draft.byId[mapId]) {
2859
2902
  return;
@@ -2863,11 +2906,11 @@ var slice$3 = createSlice({
2863
2906
  });
2864
2907
  }
2865
2908
  });
2866
- var mapActions$1 = Object.assign(Object.assign({}, slice$3.actions), {
2909
+ var mapActions$1 = Object.assign(Object.assign({}, slice$4.actions), {
2867
2910
  setMapPreset: setMapPreset,
2868
2911
  mapChangeDimension: mapChangeDimension
2869
2912
  });
2870
- var reducer$3 = slice$3.reducer;
2913
+ var reducer$4 = slice$4.reducer;
2871
2914
 
2872
2915
  /* *
2873
2916
  * Licensed under the Apache License, Version 2.0 (the "License");
@@ -3450,7 +3493,7 @@ var removeInPlace = function removeInPlace(inDraftArray, condition) {
3450
3493
  * Copyright 2020 - Koninklijk Nederlands Meteorologisch Instituut (KNMI)
3451
3494
  * Copyright 2020 - Finnish Meteorological Institute (FMI)
3452
3495
  * */
3453
- var initialState$2 = {
3496
+ var initialState$3 = {
3454
3497
  sources: {
3455
3498
  byId: {},
3456
3499
  allIds: []
@@ -3474,8 +3517,8 @@ var initialState$2 = {
3474
3517
  }
3475
3518
  }
3476
3519
  };
3477
- var slice$2 = createSlice({
3478
- initialState: initialState$2,
3520
+ var slice$3 = createSlice({
3521
+ initialState: initialState$3,
3479
3522
  name: 'synchronizationGroupsReducer',
3480
3523
  reducers: {
3481
3524
  syncGroupAddSource: function syncGroupAddSource(draft, action) {
@@ -3619,7 +3662,7 @@ var slice$2 = createSlice({
3619
3662
  });
3620
3663
  },
3621
3664
  syncGroupClear: function syncGroupClear() {
3622
- return initialState$2;
3665
+ return initialState$3;
3623
3666
  },
3624
3667
  syncGroupSetViewState: function syncGroupSetViewState(draft, action) {
3625
3668
  var viewState = action.payload.viewState;
@@ -3691,7 +3734,7 @@ var setBboxOrTimeSync = function setBboxOrTimeSync(state, action) {
3691
3734
  });
3692
3735
  };
3693
3736
 
3694
- var _slice$actions = slice$2.actions,
3737
+ var _slice$actions = slice$3.actions,
3695
3738
  syncGroupAddGroup = _slice$actions.syncGroupAddGroup,
3696
3739
  syncGroupAddSource = _slice$actions.syncGroupAddSource,
3697
3740
  syncGroupAddTarget = _slice$actions.syncGroupAddTarget;
@@ -3701,8 +3744,8 @@ var _slice$actions = slice$2.actions,
3701
3744
  syncGroupRemoveSource = _slice$actions.syncGroupRemoveSource,
3702
3745
  syncGroupRemoveTarget = _slice$actions.syncGroupRemoveTarget,
3703
3746
  syncGroupSetViewState = _slice$actions.syncGroupSetViewState;
3704
- var actions = slice$2.actions,
3705
- reducer$2 = slice$2.reducer;
3747
+ var actions = slice$3.actions,
3748
+ reducer$3 = slice$3.reducer;
3706
3749
 
3707
3750
  /* *
3708
3751
  * Licensed under the Apache License, Version 2.0 (the "License");
@@ -3759,7 +3802,7 @@ var index = /*#__PURE__*/Object.freeze({
3759
3802
  actions: actions,
3760
3803
  constants: constants,
3761
3804
  types: types$1,
3762
- initialState: initialState$2
3805
+ initialState: initialState$3
3763
3806
  });
3764
3807
 
3765
3808
  /* *
@@ -4097,7 +4140,7 @@ var getAnimationStartTime = createSelector(getMapById, function (store) {
4097
4140
  * @returns {string} returnType: string
4098
4141
  */
4099
4142
 
4100
- var getAnimationEndTime = createSelector(getMapById, function (store) {
4143
+ var getAnimationEndTime$1 = createSelector(getMapById, function (store) {
4101
4144
  return store ? store.animationEndTime : moment.utc().subtract(10, 'm').format(dateFormat);
4102
4145
  });
4103
4146
  /**
@@ -4506,6 +4549,18 @@ var getIsEnabledLayersForMapDimension = createSelector(getMapLayerIdsEnabled, fu
4506
4549
  return enabledMapLayerIds.includes(layerId);
4507
4550
  });
4508
4551
  }, selectorMemoizationOptions);
4552
+ /**
4553
+ * Returns the dockedLayerManagerSize originally set in mapPresets
4554
+ *
4555
+ * Example getDockedLayerManagerSize(store);
4556
+ * @param {object} store store: object - store object
4557
+ * @param {string} mapId mapId: string - Id of the map
4558
+ * @returns {DockedLayerManagerSize} returnType: string
4559
+ */
4560
+
4561
+ var getDockedLayerManagerSize = createSelector(getMapById, function (store) {
4562
+ return store ? store.dockedLayerManagerSize : 'sizeLarge';
4563
+ });
4509
4564
 
4510
4565
  var selectors = /*#__PURE__*/Object.freeze({
4511
4566
  __proto__: null,
@@ -4527,7 +4582,7 @@ var selectors = /*#__PURE__*/Object.freeze({
4527
4582
  isAnimating: isAnimating,
4528
4583
  linkedMapAnimationInfo: linkedMapAnimationInfo,
4529
4584
  getAnimationStartTime: getAnimationStartTime,
4530
- getAnimationEndTime: getAnimationEndTime,
4585
+ getAnimationEndTime: getAnimationEndTime$1,
4531
4586
  isAutoUpdating: isAutoUpdating,
4532
4587
  getActiveLayerId: getActiveLayerId,
4533
4588
  getMapTimeSliderScale: getMapTimeSliderScale,
@@ -4554,7 +4609,8 @@ var selectors = /*#__PURE__*/Object.freeze({
4554
4609
  getLegendId: getLegendId,
4555
4610
  getMapPreset: getMapPreset,
4556
4611
  getMapLayerIdsEnabled: getMapLayerIdsEnabled,
4557
- getIsEnabledLayersForMapDimension: getIsEnabledLayersForMapDimension
4612
+ getIsEnabledLayersForMapDimension: getIsEnabledLayersForMapDimension,
4613
+ getDockedLayerManagerSize: getDockedLayerManagerSize
4558
4614
  });
4559
4615
 
4560
4616
  var DialogTypes;
@@ -4643,7 +4699,13 @@ var produceFilters = function produceFilters(filterNames, filterType, draft, lay
4643
4699
 
4644
4700
  var layerSelectFilterAdapter = createEntityAdapter();
4645
4701
  var layerSelectActiveServicesAdapter = createEntityAdapter();
4646
- var initialState$1 = {
4702
+ var initialServicePopupState = {
4703
+ isOpen: false,
4704
+ url: '',
4705
+ serviceId: '',
4706
+ variant: 'add'
4707
+ };
4708
+ var initialState$2 = {
4647
4709
  filters: {
4648
4710
  searchFilter: '',
4649
4711
  activeServices: layerSelectActiveServicesAdapter.getInitialState(),
@@ -4656,10 +4718,11 @@ var initialState$1 = {
4656
4718
  leaf: true,
4657
4719
  path: [],
4658
4720
  serviceName: ''
4659
- }
4721
+ },
4722
+ servicePopup: initialServicePopupState
4660
4723
  };
4661
- var slice$1 = createSlice({
4662
- initialState: initialState$1,
4724
+ var slice$2 = createSlice({
4725
+ initialState: initialState$2,
4663
4726
  name: DialogTypes.LayerSelect,
4664
4727
  reducers: {
4665
4728
  setSearchFilter: function setSearchFilter(draft, action) {
@@ -4670,18 +4733,30 @@ var slice$1 = createSlice({
4670
4733
  var allServicesEnabled = action.payload.allServicesEnabled;
4671
4734
  draft.allServicesEnabled = allServicesEnabled;
4672
4735
  },
4736
+ closeServicePopupOpen: function closeServicePopupOpen(draft) {
4737
+ draft.servicePopup.isOpen = false;
4738
+ },
4739
+ toggleServicePopup: function toggleServicePopup(draft, action) {
4740
+ var _action$payload = action.payload,
4741
+ variant = _action$payload.variant,
4742
+ isOpen = _action$payload.isOpen;
4743
+ draft.servicePopup.isOpen = isOpen;
4744
+ draft.servicePopup.url = action.payload.url ? action.payload.url : '';
4745
+ draft.servicePopup.variant = variant;
4746
+ draft.servicePopup.serviceId = action.payload.serviceId ? action.payload.serviceId : '';
4747
+ },
4673
4748
  addFiltersAndActiveServices: function addFiltersAndActiveServices(draft, action) {
4674
4749
  var _a, _b;
4675
4750
 
4676
- var _action$payload = action.payload,
4677
- serviceId = _action$payload.serviceId,
4678
- serviceName = _action$payload.serviceName,
4679
- serviceUrl = _action$payload.serviceUrl,
4680
- _abstract = _action$payload["abstract"],
4681
- keywords = _action$payload.keywords,
4682
- scope = _action$payload.scope,
4683
- groups = _action$payload.groups,
4684
- isLoading = _action$payload.isLoading;
4751
+ var _action$payload2 = action.payload,
4752
+ serviceId = _action$payload2.serviceId,
4753
+ serviceName = _action$payload2.serviceName,
4754
+ serviceUrl = _action$payload2.serviceUrl,
4755
+ _abstract = _action$payload2["abstract"],
4756
+ keywords = _action$payload2.keywords,
4757
+ scope = _action$payload2.scope,
4758
+ groups = _action$payload2.groups,
4759
+ isLoading = _action$payload2.isLoading;
4685
4760
 
4686
4761
  if (isLoading) {
4687
4762
  // If service is still loading, add without filters
@@ -4750,9 +4825,9 @@ var slice$1 = createSlice({
4750
4825
  layerSelectActiveServicesAdapter.removeOne(draft.filters.activeServices, serviceId);
4751
4826
  },
4752
4827
  enableActiveService: function enableActiveService(draft, action) {
4753
- var _action$payload2 = action.payload,
4754
- serviceId = _action$payload2.serviceId,
4755
- keywords = _action$payload2.filters;
4828
+ var _action$payload3 = action.payload,
4829
+ serviceId = _action$payload3.serviceId,
4830
+ keywords = _action$payload3.filters;
4756
4831
  draft.filters.activeServices.entities[serviceId].enabled = true;
4757
4832
 
4758
4833
  var _iterator = _createForOfIteratorHelper(keywords),
@@ -4770,9 +4845,9 @@ var slice$1 = createSlice({
4770
4845
  }
4771
4846
  },
4772
4847
  disableActiveService: function disableActiveService(draft, action) {
4773
- var _action$payload3 = action.payload,
4774
- serviceId = _action$payload3.serviceId,
4775
- keywords = _action$payload3.filters;
4848
+ var _action$payload4 = action.payload,
4849
+ serviceId = _action$payload4.serviceId,
4850
+ keywords = _action$payload4.filters;
4776
4851
  draft.filters.activeServices.entities[serviceId].enabled = false;
4777
4852
 
4778
4853
  var _iterator2 = _createForOfIteratorHelper(keywords),
@@ -4808,8 +4883,8 @@ var slice$1 = createSlice({
4808
4883
  }
4809
4884
  }
4810
4885
  });
4811
- var reducer$1 = slice$1.reducer;
4812
- var layerSelectActions = slice$1.actions;
4886
+ var reducer$2 = slice$2.reducer;
4887
+ var layerSelectActions = slice$2.actions;
4813
4888
 
4814
4889
  /* *
4815
4890
  * Licensed under the Apache License, Version 2.0 (the "License");
@@ -4935,8 +5010,11 @@ var _layerSelectActiveSer = layerSelectActiveServicesAdapter.getSelectors(functi
4935
5010
  var getActiveServiceById = function getActiveServiceById(store, serviceId) {
4936
5011
  var _a, _b, _c;
4937
5012
 
4938
- var enabledServices = ((_c = (_b = (_a = store === null || store === void 0 ? void 0 : store.layerSelect) === null || _a === void 0 ? void 0 : _a.filters) === null || _b === void 0 ? void 0 : _b.activeServices) === null || _c === void 0 ? void 0 : _c.entities[serviceId]) || {};
4939
- return enabledServices;
5013
+ if (serviceId === '') {
5014
+ return {};
5015
+ }
5016
+
5017
+ return ((_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]) || {};
4940
5018
  };
4941
5019
  /**
4942
5020
  * Returns all ids of enabled services
@@ -5064,6 +5142,19 @@ var getFilteredLayers = createSelector([getEnabledServiceIds, getServices, getCh
5064
5142
  }));
5065
5143
  }, []);
5066
5144
  }, selectorMemoizationOptions);
5145
+ /**
5146
+ * Returns service popup details
5147
+ *
5148
+ * Example getActiveServices(store, 'server-id');
5149
+ * @param {object} store store: object - store object
5150
+ * @returns {object} returnType: object of active service
5151
+ */
5152
+
5153
+ var getServicePopupDetails = function getServicePopupDetails(store) {
5154
+ var _a;
5155
+
5156
+ return ((_a = store === null || store === void 0 ? void 0 : store.layerSelect) === null || _a === void 0 ? void 0 : _a.servicePopup) || initialServicePopupState;
5157
+ };
5067
5158
 
5068
5159
  /* *
5069
5160
  * Licensed under the Apache License, Version 2.0 (the "License");
@@ -5082,9 +5173,9 @@ var getFilteredLayers = createSelector([getEnabledServiceIds, getServices, getCh
5082
5173
  * Copyright 2022 - Finnish Meteorological Institute (FMI)
5083
5174
  * */
5084
5175
  var snackbarAdapter = createEntityAdapter();
5085
- var initialState = snackbarAdapter.getInitialState();
5086
- var slice = createSlice({
5087
- initialState: initialState,
5176
+ var initialState$1 = snackbarAdapter.getInitialState();
5177
+ var slice$1 = createSlice({
5178
+ initialState: initialState$1,
5088
5179
  name: 'snackbar',
5089
5180
  reducers: {
5090
5181
  // To open the snackbar call this action
@@ -5106,8 +5197,8 @@ var slice = createSlice({
5106
5197
  }
5107
5198
  }
5108
5199
  });
5109
- var reducer = slice.reducer;
5110
- var snackbarActions = slice.actions;
5200
+ var reducer$1 = slice$1.reducer;
5201
+ var snackbarActions = slice$1.actions;
5111
5202
 
5112
5203
  /* *
5113
5204
  * Licensed under the Apache License, Version 2.0 (the "License");
@@ -5139,6 +5230,37 @@ var getFirstSnackbarMessage = createSelector(getCurrentSnackbarMessages, functio
5139
5230
  return currentMessages.length > 0 ? currentMessages[0] : undefined;
5140
5231
  });
5141
5232
 
5233
+ /* *
5234
+ * Licensed under the Apache License, Version 2.0 (the "License");
5235
+ * you may not use this file except in compliance with the License.
5236
+ * You may obtain a copy of the License at
5237
+ *
5238
+ * http://www.apache.org/licenses/LICENSE-2.0
5239
+ *
5240
+ * Unless required by applicable law or agreed to in writing, software
5241
+ * distributed under the License is distributed on an "AS IS" BASIS,
5242
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
5243
+ * See the License for the specific language governing permissions and
5244
+ * limitations under the License.
5245
+ *
5246
+ * Copyright 2022 - Koninklijk Nederlands Meteorologisch Instituut (KNMI)
5247
+ * Copyright 2022 - Finnish Meteorological Institute (FMI)
5248
+ * */
5249
+ var initialState = {
5250
+ isInitialised: false
5251
+ };
5252
+ var slice = createSlice({
5253
+ initialState: initialState,
5254
+ name: 'app',
5255
+ reducers: {
5256
+ initialiseApp: function initialiseApp(draft) {
5257
+ draft.isInitialised = true;
5258
+ }
5259
+ }
5260
+ });
5261
+ var reducer = slice.reducer;
5262
+ var appActions = slice.actions;
5263
+
5142
5264
  /* *
5143
5265
  * Licensed under the Apache License, Version 2.0 (the "License");
5144
5266
  * you may not use this file except in compliance with the License.
@@ -6119,7 +6241,7 @@ function rootSaga$4() {
6119
6241
  var synchronizationGroupConfig = {
6120
6242
  id: 'syncronizationGroupStore-module',
6121
6243
  reducersMap: {
6122
- syncronizationGroupStore: reducer$2
6244
+ syncronizationGroupStore: reducer$3
6123
6245
  },
6124
6246
  sagas: [rootSaga$5, rootSaga$4]
6125
6247
  };
@@ -6255,7 +6377,7 @@ function rootSaga$3() {
6255
6377
  var uiModuleConfig = {
6256
6378
  id: 'ui-module',
6257
6379
  reducersMap: {
6258
- ui: reducer$4
6380
+ ui: reducer$5
6259
6381
  },
6260
6382
  sagas: [rootSaga$3]
6261
6383
  };
@@ -6361,7 +6483,7 @@ var animationIntervalDefault = 5;
6361
6483
  var connectRedux$5 = connect(function (store, props) {
6362
6484
  return {
6363
6485
  animationStartTime: getAnimationStartTime(store, props.mapId),
6364
- animationEndTime: getAnimationEndTime(store, props.mapId),
6486
+ animationEndTime: getAnimationEndTime$1(store, props.mapId),
6365
6487
  timeStep: getMapTimeStep(store, props.mapId),
6366
6488
  linkedMapAnimationInfo: linkedMapAnimationInfo(store, props.mapId)
6367
6489
  };
@@ -7876,6 +7998,19 @@ var generateTimeList = function generateTimeList(start, end, interval) {
7876
7998
 
7877
7999
  return timeList;
7878
8000
  };
8001
+ var getAnimationEndTime = function getAnimationEndTime(animationEndTime) {
8002
+ var calculateFromNow = animationEndTime.split(/[-+]/)[0] === 'NOW';
8003
+ var isAddingTime = animationEndTime.indexOf('+') !== -1;
8004
+ var timeInMinutes = moment.duration(animationEndTime.split(/[-+]/)[1]).asMinutes();
8005
+ var startingTime = calculateFromNow ? moment().utc() : moment().utc().startOf('day');
8006
+ var newAnimationEndTime = isAddingTime ? moment(startingTime).add(timeInMinutes, 'minutes').toISOString() : moment(startingTime).subtract(timeInMinutes, 'minutes').toISOString();
8007
+ return newAnimationEndTime;
8008
+ };
8009
+ var isAnimationEndTimeValid = function isAnimationEndTimeValid(animationEndTime) {
8010
+ var hasValidPrefix = animationEndTime.split(/[-+]/)[0] === 'NOW' || animationEndTime.split(/[-+]/)[0] === 'TODAY';
8011
+ var hasValidDate = moment.isDuration(moment.duration(animationEndTime.split(/[-+]/)[1]));
8012
+ return hasValidPrefix && hasValidDate;
8013
+ };
7879
8014
  function updateMapDraw(mapId, draw) {
7880
8015
  var webMap = getWMJSMapById(mapId);
7881
8016
 
@@ -7973,7 +8108,7 @@ function updateAnimation(mapId, maxValue) {
7973
8108
  animationStart = _context4.sent;
7974
8109
  animationStartUnix = moment.utc(animationStart).unix();
7975
8110
  _context4.next = 6;
7976
- return select(getAnimationEndTime, mapId);
8111
+ return select(getAnimationEndTime$1, mapId);
7977
8112
 
7978
8113
  case 6:
7979
8114
  animationEnd = _context4.sent;
@@ -8283,7 +8418,7 @@ function handleBaseLayersSaga(mapId, baseLayers) {
8283
8418
  }, _marked7);
8284
8419
  }
8285
8420
  function setMapPresetSaga(_ref6) {
8286
- var payload, mapId, initialProps, mapPreset, layers, activeLayerId, proj, shouldAutoUpdate, shouldAnimate, animationPayload, toggleTimestepAuto, showTimeSlider, displayMapPin, shouldShowZoomControls, shouldShowLegend, _filterLayers, mapLayers, baseLayers, overLayers, _yield$call, layersNewIds, activeLayerNewId, newActiveLayerId, baseLayersWithDefaultLayer, overLayersWithDefaultLayer, allBaseLayers, interval, duration, shouldOpenLegend, legendId;
8421
+ var payload, mapId, initialProps, mapPreset, layers, activeLayerId, proj, shouldAutoUpdate, shouldAnimate, animationPayload, toggleTimestepAuto, showTimeSlider, displayMapPin, shouldShowZoomControls, shouldShowLegend, dockedLayerManagerSize, _filterLayers, mapLayers, baseLayers, overLayers, _yield$call, layersNewIds, activeLayerNewId, newActiveLayerId, baseLayersWithDefaultLayer, overLayersWithDefaultLayer, allBaseLayers, animationLength, animationEndTime, interval, animationEnd, _animationEnd, duration, shouldOpenLegend, legendId, fiveMinuteDelayForAnimation, _animationEnd2, animationStart;
8287
8422
 
8288
8423
  return regeneratorRuntime.wrap(function setMapPresetSaga$(_context8) {
8289
8424
  while (1) {
@@ -8295,11 +8430,11 @@ function setMapPresetSaga(_ref6) {
8295
8430
  mapPreset = initialProps.mapPreset;
8296
8431
 
8297
8432
  if (!mapPreset) {
8298
- _context8.next = 64;
8433
+ _context8.next = 100;
8299
8434
  break;
8300
8435
  }
8301
8436
 
8302
- layers = mapPreset.layers, activeLayerId = mapPreset.activeLayerId, proj = mapPreset.proj, shouldAutoUpdate = mapPreset.shouldAutoUpdate, shouldAnimate = mapPreset.shouldAnimate, animationPayload = mapPreset.animationPayload, toggleTimestepAuto = mapPreset.toggleTimestepAuto, showTimeSlider = mapPreset.showTimeSlider, displayMapPin = mapPreset.displayMapPin, shouldShowZoomControls = mapPreset.shouldShowZoomControls, shouldShowLegend = mapPreset.shouldShowLegend;
8437
+ layers = mapPreset.layers, activeLayerId = mapPreset.activeLayerId, proj = mapPreset.proj, shouldAutoUpdate = mapPreset.shouldAutoUpdate, shouldAnimate = mapPreset.shouldAnimate, animationPayload = mapPreset.animationPayload, toggleTimestepAuto = mapPreset.toggleTimestepAuto, showTimeSlider = mapPreset.showTimeSlider, displayMapPin = mapPreset.displayMapPin, shouldShowZoomControls = mapPreset.shouldShowZoomControls, shouldShowLegend = mapPreset.shouldShowLegend, dockedLayerManagerSize = mapPreset.dockedLayerManagerSize;
8303
8438
  _filterLayers = filterLayers(layers), mapLayers = _filterLayers.mapLayers, baseLayers = _filterLayers.baseLayers, overLayers = _filterLayers.overLayers;
8304
8439
 
8305
8440
  if (!layers) {
@@ -8356,89 +8491,139 @@ function setMapPresetSaga(_ref6) {
8356
8491
  }));
8357
8492
 
8358
8493
  case 26:
8359
- if (!(shouldAutoUpdate !== undefined)) {
8360
- _context8.next = 29;
8494
+ animationLength = animationPayload && animationPayload.duration;
8495
+ animationEndTime = animationPayload && animationPayload.endTime && isAnimationEndTimeValid(animationPayload.endTime) && animationPayload.endTime;
8496
+
8497
+ if (!(shouldAutoUpdate !== undefined && !animationEndTime)) {
8498
+ _context8.next = 31;
8361
8499
  break;
8362
8500
  }
8363
8501
 
8364
- _context8.next = 29;
8502
+ _context8.next = 31;
8365
8503
  return put(mapActions$1.toggleAutoUpdate({
8366
8504
  mapId: mapId,
8367
8505
  shouldAutoUpdate: shouldAutoUpdate
8368
8506
  }));
8369
8507
 
8370
- case 29:
8508
+ case 31:
8371
8509
  if (!(showTimeSlider !== undefined)) {
8372
- _context8.next = 32;
8510
+ _context8.next = 34;
8373
8511
  break;
8374
8512
  }
8375
8513
 
8376
- _context8.next = 32;
8514
+ _context8.next = 34;
8377
8515
  return put(mapActions$1.toggleTimeSliderIsVisible({
8378
8516
  mapId: mapId,
8379
8517
  isTimeSliderVisible: showTimeSlider
8380
8518
  }));
8381
8519
 
8382
- case 32:
8520
+ case 34:
8383
8521
  if (!(shouldShowZoomControls !== undefined)) {
8384
- _context8.next = 35;
8522
+ _context8.next = 37;
8385
8523
  break;
8386
8524
  }
8387
8525
 
8388
- _context8.next = 35;
8526
+ _context8.next = 37;
8389
8527
  return put(mapActions$1.toggleZoomControls({
8390
8528
  mapId: mapId,
8391
8529
  shouldShowZoomControls: shouldShowZoomControls
8392
8530
  }));
8393
8531
 
8394
- case 35:
8532
+ case 37:
8395
8533
  if (!(displayMapPin !== undefined)) {
8396
- _context8.next = 38;
8534
+ _context8.next = 40;
8397
8535
  break;
8398
8536
  }
8399
8537
 
8400
- _context8.next = 38;
8538
+ _context8.next = 40;
8401
8539
  return put(mapActions$1.toggleMapPinIsVisible({
8402
8540
  mapId: mapId,
8403
8541
  displayMapPin: displayMapPin
8404
8542
  }));
8405
8543
 
8406
- case 38:
8544
+ case 40:
8407
8545
  // sets timestep by interval of animationPayload
8408
8546
  interval = animationPayload && animationPayload.interval;
8409
8547
 
8410
8548
  if (!interval) {
8411
- _context8.next = 42;
8549
+ _context8.next = 44;
8412
8550
  break;
8413
8551
  }
8414
8552
 
8415
- _context8.next = 42;
8553
+ _context8.next = 44;
8416
8554
  return put(mapActions$1.setTimeStep({
8417
8555
  mapId: mapId,
8418
8556
  timeStep: interval
8419
8557
  }));
8420
8558
 
8421
- case 42:
8559
+ case 44:
8560
+ if (!animationEndTime) {
8561
+ _context8.next = 53;
8562
+ break;
8563
+ }
8564
+
8565
+ _context8.next = 47;
8566
+ return put(mapActions$1.setAnimationEndTime({
8567
+ mapId: mapId,
8568
+ animationEndTime: getAnimationEndTime(animationEndTime)
8569
+ }));
8570
+
8571
+ case 47:
8572
+ if (animationLength) {
8573
+ _context8.next = 53;
8574
+ break;
8575
+ }
8576
+
8577
+ _context8.next = 50;
8578
+ return select(getAnimationEndTime$1, mapId);
8579
+
8580
+ case 50:
8581
+ animationEnd = _context8.sent;
8582
+ _context8.next = 53;
8583
+ return put(mapActions$1.setAnimationStartTime({
8584
+ mapId: mapId,
8585
+ animationStartTime: moment(animationEnd).subtract(5 * 60, 'minutes') // set to default of 5 hours
8586
+ .toISOString()
8587
+ }));
8588
+
8589
+ case 53:
8590
+ if (!animationLength) {
8591
+ _context8.next = 59;
8592
+ break;
8593
+ }
8594
+
8595
+ _context8.next = 56;
8596
+ return select(getAnimationEndTime$1, mapId);
8597
+
8598
+ case 56:
8599
+ _animationEnd = _context8.sent;
8600
+ _context8.next = 59;
8601
+ return put(mapActions$1.setAnimationStartTime({
8602
+ mapId: mapId,
8603
+ animationStartTime: moment(_animationEnd).subtract(animationLength, 'minutes').toISOString()
8604
+ }));
8605
+
8606
+ case 59:
8422
8607
  if (!(animationPayload && animationPayload.speed)) {
8423
- _context8.next = 45;
8608
+ _context8.next = 62;
8424
8609
  break;
8425
8610
  }
8426
8611
 
8427
- _context8.next = 45;
8612
+ _context8.next = 62;
8428
8613
  return put(mapActions$1.setAnimationDelay({
8429
8614
  mapId: mapId,
8430
8615
  animationDelay: getSpeedDelay(animationPayload.speed)
8431
8616
  }));
8432
8617
 
8433
- case 45:
8618
+ case 62:
8434
8619
  if (!(shouldAnimate === true)) {
8435
- _context8.next = 54;
8620
+ _context8.next = 71;
8436
8621
  break;
8437
8622
  }
8438
8623
 
8439
8624
  duration = animationPayload && animationPayload.duration ? animationPayload.duration : 5 * 60; // set to default of 5 hours
8440
8625
 
8441
- _context8.next = 49;
8626
+ _context8.next = 66;
8442
8627
  return put(mapActions$1.mapStartAnimation({
8443
8628
  mapId: mapId,
8444
8629
  start: moment.utc().subtract(duration, 'minutes').format(dateFormat),
@@ -8446,69 +8631,119 @@ function setMapPresetSaga(_ref6) {
8446
8631
  interval: interval || animationIntervalDefault
8447
8632
  }));
8448
8633
 
8449
- case 49:
8634
+ case 66:
8450
8635
  if (!interval) {
8451
- _context8.next = 52;
8636
+ _context8.next = 69;
8452
8637
  break;
8453
8638
  }
8454
8639
 
8455
- _context8.next = 52;
8640
+ _context8.next = 69;
8456
8641
  return put(mapActions$1.toggleTimestepAuto({
8457
8642
  mapId: mapId,
8458
8643
  timestepAuto: false
8459
8644
  }));
8460
8645
 
8461
- case 52:
8462
- _context8.next = 57;
8646
+ case 69:
8647
+ _context8.next = 74;
8463
8648
  break;
8464
8649
 
8465
- case 54:
8650
+ case 71:
8466
8651
  if (!(toggleTimestepAuto !== undefined)) {
8467
- _context8.next = 57;
8652
+ _context8.next = 74;
8468
8653
  break;
8469
8654
  }
8470
8655
 
8471
- _context8.next = 57;
8656
+ _context8.next = 74;
8472
8657
  return put(mapActions$1.toggleTimestepAuto({
8473
8658
  mapId: mapId,
8474
8659
  timestepAuto: toggleTimestepAuto
8475
8660
  }));
8476
8661
 
8477
- case 57:
8662
+ case 74:
8478
8663
  // show legend
8479
8664
  shouldOpenLegend = shouldShowLegend !== undefined ? shouldShowLegend : IS_LEGEND_OPEN_BY_DEFAULT;
8480
- _context8.next = 60;
8665
+ _context8.next = 77;
8481
8666
  return select(getLegendId, mapId);
8482
8667
 
8483
- case 60:
8668
+ case 77:
8484
8669
  legendId = _context8.sent;
8485
8670
 
8486
8671
  if (!legendId) {
8487
- _context8.next = 64;
8672
+ _context8.next = 81;
8488
8673
  break;
8489
8674
  }
8490
8675
 
8491
- _context8.next = 64;
8676
+ _context8.next = 81;
8492
8677
  return put(uiActions.setToggleOpenDialog({
8493
8678
  type: legendId,
8494
8679
  setOpen: shouldOpenLegend
8495
8680
  }));
8496
8681
 
8497
- case 64:
8498
- _context8.next = 69;
8682
+ case 81:
8683
+ if (!dockedLayerManagerSize) {
8684
+ _context8.next = 84;
8685
+ break;
8686
+ }
8687
+
8688
+ _context8.next = 84;
8689
+ return put(mapActions$1.setDockedLayerManagerSize({
8690
+ mapId: mapId,
8691
+ dockedLayerManagerSize: dockedLayerManagerSize
8692
+ }));
8693
+
8694
+ case 84:
8695
+ if (!animationEndTime) {
8696
+ _context8.next = 100;
8697
+ break;
8698
+ }
8699
+
8700
+ fiveMinuteDelayForAnimation = 1000 * 60 * 5;
8701
+ _context8.next = 88;
8702
+ return delay(fiveMinuteDelayForAnimation);
8703
+
8704
+ case 88:
8705
+ _context8.next = 90;
8706
+ return select(getAnimationEndTime$1, mapId);
8707
+
8708
+ case 90:
8709
+ _animationEnd2 = _context8.sent;
8710
+ _context8.next = 93;
8711
+ return put(mapActions$1.setAnimationEndTime({
8712
+ mapId: mapId,
8713
+ animationEndTime: moment(_animationEnd2).add(60, 'minutes').toISOString()
8714
+ }));
8715
+
8716
+ case 93:
8717
+ _context8.next = 95;
8718
+ return select(getAnimationStartTime, mapId);
8719
+
8720
+ case 95:
8721
+ animationStart = _context8.sent;
8722
+ _context8.next = 98;
8723
+ return put(mapActions$1.setAnimationStartTime({
8724
+ mapId: mapId,
8725
+ animationStartTime: moment(animationStart).add(60, 'minutes').toISOString()
8726
+ }));
8727
+
8728
+ case 98:
8729
+ _context8.next = 84;
8499
8730
  break;
8500
8731
 
8501
- case 66:
8502
- _context8.prev = 66;
8732
+ case 100:
8733
+ _context8.next = 105;
8734
+ break;
8735
+
8736
+ case 102:
8737
+ _context8.prev = 102;
8503
8738
  _context8.t0 = _context8["catch"](1);
8504
8739
  console.error(_context8.t0);
8505
8740
 
8506
- case 69:
8741
+ case 105:
8507
8742
  case "end":
8508
8743
  return _context8.stop();
8509
8744
  }
8510
8745
  }
8511
- }, _marked8, null, [[1, 66]]);
8746
+ }, _marked8, null, [[1, 102]]);
8512
8747
  }
8513
8748
  function unregisterMapSaga(_ref7) {
8514
8749
  var payload, mapId, layerList;
@@ -8583,9 +8818,9 @@ function rootSaga$2() {
8583
8818
  var moduleConfig = {
8584
8819
  id: 'webmap-module',
8585
8820
  reducersMap: {
8586
- webmap: reducer$3,
8587
- services: reducer$5,
8588
- layers: reducer$6
8821
+ webmap: reducer$4,
8822
+ services: reducer$6,
8823
+ layers: reducer$7
8589
8824
  },
8590
8825
  sagas: [rootSaga$2]
8591
8826
  };
@@ -8907,7 +9142,7 @@ function rootSaga$1() {
8907
9142
  var layerSelectConfig = {
8908
9143
  id: 'layerSelect-module',
8909
9144
  reducersMap: {
8910
- layerSelect: reducer$1
9145
+ layerSelect: reducer$2
8911
9146
  },
8912
9147
  sagas: [rootSaga$1]
8913
9148
  };
@@ -9008,7 +9243,7 @@ function rootSaga() {
9008
9243
  var snackbarModuleConfig = {
9009
9244
  id: 'snackbar-module',
9010
9245
  reducersMap: {
9011
- snackbar: reducer
9246
+ snackbar: reducer$1
9012
9247
  },
9013
9248
  sagas: [rootSaga]
9014
9249
  };
@@ -9047,31 +9282,143 @@ var coreModuleConfig = [moduleConfig, synchronizationGroupConfig, uiModuleConfig
9047
9282
  * Copyright 2022 - Koninklijk Nederlands Meteorologisch Instituut (KNMI)
9048
9283
  * Copyright 2022 - Finnish Meteorological Institute (FMI)
9049
9284
  * */
9050
- var iconButtonSize = 30;
9051
- var totalButtons = 5;
9052
- var columnClasses = {
9053
- column1: 'column-1',
9054
- column2: 'column-2',
9055
- column3: 'column-3',
9056
- column4: 'column-4',
9057
- column5: 'column-5',
9058
- column6: 'column-6',
9059
- column7: 'column-7'
9285
+ var iconStyle = {
9286
+ height: 24,
9287
+ width: 24
9060
9288
  };
9061
- var layerManagerStyle = Object.assign({
9062
- '.layerManagerContainer': {
9063
- containerType: 'inline-size'
9064
- },
9065
- // disable overflow while dragging to prevent issues with scrollbar
9066
- '.is-dragging header+.MuiBox-root': {
9067
- overflow: 'hidden'
9068
- },
9069
- // columns layout
9070
- '.column-1': {
9071
- width: iconButtonSize * 3,
9072
- display: 'flex',
9073
- background: 'transparent'
9074
- },
9289
+ var sizeSmall = {
9290
+ width: 100,
9291
+ height: 300
9292
+ };
9293
+ var sizeMedium = {
9294
+ width: 360,
9295
+ height: 300
9296
+ };
9297
+ var sizeLarge = {
9298
+ width: 720,
9299
+ height: 300
9300
+ };
9301
+
9302
+ var HeaderOptions = function HeaderOptions(_ref) {
9303
+ var isDockedLayerManager = _ref.isDockedLayerManager,
9304
+ onClickDockButton = _ref.onClickDockButton,
9305
+ onChangeSize = _ref.onChangeSize;
9306
+ React.useEffect(function () {
9307
+ var handleKeyDown = function handleKeyDown(event) {
9308
+ if (event.ctrlKey && event.altKey && event.code === 'KeyS') {
9309
+ onChangeSize(sizeSmall);
9310
+ } else if (event.ctrlKey && event.altKey && event.code === 'KeyM') {
9311
+ onChangeSize(sizeMedium);
9312
+ } else if (event.ctrlKey && event.altKey && event.code === 'KeyL') {
9313
+ onChangeSize(sizeLarge);
9314
+ }
9315
+ };
9316
+
9317
+ document.addEventListener('keydown', handleKeyDown);
9318
+ return function () {
9319
+ document.removeEventListener('keydown', handleKeyDown);
9320
+ };
9321
+ }, [onChangeSize]);
9322
+ return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(CustomTooltip, {
9323
+ title: "small"
9324
+ }, /*#__PURE__*/React.createElement(IconButton, {
9325
+ "data-testid": "collapseSmall-btn",
9326
+ size: "small",
9327
+ onClick: function onClick() {
9328
+ return onChangeSize(sizeSmall);
9329
+ },
9330
+ onTouchEnd: function onTouchEnd() {
9331
+ return onChangeSize(sizeSmall);
9332
+ },
9333
+ sx: iconStyle,
9334
+ className: "collapseSmall-btn"
9335
+ }, /*#__PURE__*/React.createElement(CollapseSmall, null))), /*#__PURE__*/React.createElement(CustomTooltip, {
9336
+ title: "medium"
9337
+ }, /*#__PURE__*/React.createElement(IconButton, {
9338
+ "data-testid": "collapseMedium-btn",
9339
+ size: "small",
9340
+ onClick: function onClick() {
9341
+ return onChangeSize(sizeMedium);
9342
+ },
9343
+ onTouchEnd: function onTouchEnd() {
9344
+ return onChangeSize(sizeMedium);
9345
+ },
9346
+ sx: iconStyle,
9347
+ className: "collapseMedium-btn"
9348
+ }, /*#__PURE__*/React.createElement(CollapseMedium, null))), /*#__PURE__*/React.createElement(CustomTooltip, {
9349
+ title: "large"
9350
+ }, /*#__PURE__*/React.createElement(IconButton, {
9351
+ "data-testid": "collapseLarge-btn",
9352
+ size: "small",
9353
+ onClick: function onClick() {
9354
+ return onChangeSize(sizeLarge);
9355
+ },
9356
+ onTouchEnd: function onTouchEnd() {
9357
+ return onChangeSize(sizeLarge);
9358
+ },
9359
+ sx: iconStyle,
9360
+ className: "collapseLarge-btn"
9361
+ }, /*#__PURE__*/React.createElement(CollapseLarge, null))), /*#__PURE__*/React.createElement(CustomTooltip, {
9362
+ title: isDockedLayerManager ? 'Undock' : 'Dock'
9363
+ }, /*#__PURE__*/React.createElement(IconButton, {
9364
+ "data-testid": "dockedBtn",
9365
+ disableRipple: true,
9366
+ size: "small",
9367
+ sx: iconStyle,
9368
+ onClick: function onClick() {
9369
+ return onClickDockButton();
9370
+ },
9371
+ onTouchEnd: function onTouchEnd() {
9372
+ return onClickDockButton();
9373
+ }
9374
+ }, isDockedLayerManager ? /*#__PURE__*/React.createElement(CollapseWindow, {
9375
+ "data-testid": "dockedLayerManager-collapse"
9376
+ }) : /*#__PURE__*/React.createElement(ExpandWindow, {
9377
+ "data-testid": "dockedLayerManager-uncollapse"
9378
+ }))));
9379
+ };
9380
+
9381
+ /* *
9382
+ * Licensed under the Apache License, Version 2.0 (the "License");
9383
+ * you may not use this file except in compliance with the License.
9384
+ * You may obtain a copy of the License at
9385
+ *
9386
+ * http://www.apache.org/licenses/LICENSE-2.0
9387
+ *
9388
+ * Unless required by applicable law or agreed to in writing, software
9389
+ * distributed under the License is distributed on an "AS IS" BASIS,
9390
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
9391
+ * See the License for the specific language governing permissions and
9392
+ * limitations under the License.
9393
+ *
9394
+ * Copyright 2022 - Koninklijk Nederlands Meteorologisch Instituut (KNMI)
9395
+ * Copyright 2022 - Finnish Meteorological Institute (FMI)
9396
+ * */
9397
+ var iconButtonSize = 30;
9398
+ var totalButtons = 5;
9399
+ var columnClasses = {
9400
+ column1: 'column-1',
9401
+ column2: 'column-2',
9402
+ column3: 'column-3',
9403
+ column4: 'column-4',
9404
+ column5: 'column-5',
9405
+ column6: 'column-6',
9406
+ column7: 'column-7'
9407
+ };
9408
+ var layerManagerStyle = Object.assign({
9409
+ '.layerManagerContainer': {
9410
+ containerType: 'inline-size'
9411
+ },
9412
+ // disable overflow while dragging to prevent issues with scrollbar
9413
+ '.is-dragging header+.MuiBox-root': {
9414
+ overflow: 'hidden'
9415
+ },
9416
+ // columns layout
9417
+ '.column-1': {
9418
+ width: iconButtonSize * 3,
9419
+ display: 'flex',
9420
+ background: 'transparent'
9421
+ },
9075
9422
  '.column-2': {
9076
9423
  width: "calc((100% - ".concat(iconButtonSize * totalButtons, "px) * 0.25)")
9077
9424
  },
@@ -9207,6 +9554,12 @@ var layerManagerStyle = Object.assign({
9207
9554
  }
9208
9555
  }
9209
9556
  });
9557
+ var returnCorrectSize = function returnCorrectSize(sizeResult) {
9558
+ if (sizeResult === 'sizeSmall') return sizeSmall;
9559
+ if (sizeResult === 'sizeMedium') return sizeMedium;
9560
+ if (sizeResult === 'sizeLarge') return sizeLarge;
9561
+ return sizeLarge;
9562
+ };
9210
9563
 
9211
9564
  /* *
9212
9565
  * Licensed under the Apache License, Version 2.0 (the "License");
@@ -11933,102 +12286,6 @@ var BaseLayerRow = function BaseLayerRow(_ref) {
11933
12286
  })));
11934
12287
  };
11935
12288
 
11936
- /* *
11937
- * Licensed under the Apache License, Version 2.0 (the "License");
11938
- * you may not use this file except in compliance with the License.
11939
- * You may obtain a copy of the License at
11940
- *
11941
- * http://www.apache.org/licenses/LICENSE-2.0
11942
- *
11943
- * Unless required by applicable law or agreed to in writing, software
11944
- * distributed under the License is distributed on an "AS IS" BASIS,
11945
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11946
- * See the License for the specific language governing permissions and
11947
- * limitations under the License.
11948
- *
11949
- * Copyright 2022 - Koninklijk Nederlands Meteorologisch Instituut (KNMI)
11950
- * Copyright 2022 - Finnish Meteorological Institute (FMI)
11951
- * */
11952
- var iconStyle = {
11953
- height: 24,
11954
- width: 24
11955
- };
11956
- var sizeSmall = {
11957
- width: 100,
11958
- height: 300
11959
- };
11960
- var sizeMedium = {
11961
- width: 360,
11962
- height: 300
11963
- };
11964
- var sizeLarge = {
11965
- width: 720,
11966
- height: 300
11967
- };
11968
-
11969
- var HeaderOptions = function HeaderOptions(_ref) {
11970
- var isDockedLayerManager = _ref.isDockedLayerManager,
11971
- onClickDockButton = _ref.onClickDockButton,
11972
- onChangeSize = _ref.onChangeSize;
11973
- return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(CustomTooltip, {
11974
- title: "small"
11975
- }, /*#__PURE__*/React.createElement(IconButton, {
11976
- "data-testid": "collapseSmall-btn",
11977
- size: "small",
11978
- onClick: function onClick() {
11979
- return onChangeSize(sizeSmall);
11980
- },
11981
- onTouchEnd: function onTouchEnd() {
11982
- return onChangeSize(sizeSmall);
11983
- },
11984
- sx: iconStyle,
11985
- className: "collapseSmall-btn"
11986
- }, /*#__PURE__*/React.createElement(CollapseSmall, null))), /*#__PURE__*/React.createElement(CustomTooltip, {
11987
- title: "medium"
11988
- }, /*#__PURE__*/React.createElement(IconButton, {
11989
- "data-testid": "collapseMedium-btn",
11990
- size: "small",
11991
- onClick: function onClick() {
11992
- return onChangeSize(sizeMedium);
11993
- },
11994
- onTouchEnd: function onTouchEnd() {
11995
- return onChangeSize(sizeMedium);
11996
- },
11997
- sx: iconStyle,
11998
- className: "collapseMedium-btn"
11999
- }, /*#__PURE__*/React.createElement(CollapseMedium, null))), /*#__PURE__*/React.createElement(CustomTooltip, {
12000
- title: "large"
12001
- }, /*#__PURE__*/React.createElement(IconButton, {
12002
- "data-testid": "collapseLarge-btn",
12003
- size: "small",
12004
- onClick: function onClick() {
12005
- return onChangeSize(sizeLarge);
12006
- },
12007
- onTouchEnd: function onTouchEnd() {
12008
- return onChangeSize(sizeLarge);
12009
- },
12010
- sx: iconStyle,
12011
- className: "collapseLarge-btn"
12012
- }, /*#__PURE__*/React.createElement(CollapseLarge, null))), /*#__PURE__*/React.createElement(CustomTooltip, {
12013
- title: isDockedLayerManager ? 'Undock' : 'Dock'
12014
- }, /*#__PURE__*/React.createElement(IconButton, {
12015
- "data-testid": "dockedBtn",
12016
- disableRipple: true,
12017
- size: "small",
12018
- sx: iconStyle,
12019
- onClick: function onClick() {
12020
- return onClickDockButton();
12021
- },
12022
- onTouchEnd: function onTouchEnd() {
12023
- return onClickDockButton();
12024
- }
12025
- }, isDockedLayerManager ? /*#__PURE__*/React.createElement(CollapseWindow, {
12026
- "data-testid": "dockedLayerManager-collapse"
12027
- }) : /*#__PURE__*/React.createElement(ExpandWindow, {
12028
- "data-testid": "dockedLayerManager-uncollapse"
12029
- }))));
12030
- };
12031
-
12032
12289
  var styles$2 = {
12033
12290
  layerRowContainer: {
12034
12291
  position: 'relative',
@@ -12079,7 +12336,7 @@ var LayerManager = function LayerManager(_ref) {
12079
12336
  _ref$onToggleDock = _ref.onToggleDock,
12080
12337
  onToggleDock = _ref$onToggleDock === void 0 ? function () {} : _ref$onToggleDock,
12081
12338
  _ref$size = _ref.size,
12082
- prefSize = _ref$size === void 0 ? sizeLarge : _ref$size,
12339
+ size = _ref$size === void 0 ? sizeLarge : _ref$size,
12083
12340
  _ref$startPosition = _ref.startPosition,
12084
12341
  startPosition = _ref$startPosition === void 0 ? {
12085
12342
  top: 85,
@@ -12089,16 +12346,22 @@ var LayerManager = function LayerManager(_ref) {
12089
12346
  width: 100,
12090
12347
  height: 126
12091
12348
  };
12092
- var startSizeCalc = calculateStartSize(minSize, prefSize, startPosition);
12349
+ var startSizeCalc = calculateStartSize(minSize, size, startPosition);
12093
12350
 
12094
12351
  var _React$useState = React.useState(startSizeCalc),
12095
12352
  _React$useState2 = _slicedToArray(_React$useState, 2),
12096
- size = _React$useState2[0],
12097
- setSize = _React$useState2[1];
12353
+ sizeInState = _React$useState2[0],
12354
+ setSizeInState = _React$useState2[1];
12355
+
12356
+ React.useEffect(function () {
12357
+ if (size !== sizeInState && isDockedLayerManager && isOpen) {
12358
+ setSizeInState(size);
12359
+ } // eslint-disable-next-line react-hooks/exhaustive-deps
12098
12360
 
12361
+ }, [size, isOpen]);
12099
12362
  return /*#__PURE__*/React.createElement(ToolContainerDraggable, {
12100
12363
  title: showTitle ? "Layer Manager ".concat(mapId) : 'Layer Manager',
12101
- startSize: size,
12364
+ startSize: sizeInState,
12102
12365
  minWidth: minSize.width,
12103
12366
  minHeight: minSize.height,
12104
12367
  startPosition: startPosition,
@@ -12116,7 +12379,7 @@ var LayerManager = function LayerManager(_ref) {
12116
12379
  onClickDockButton: onToggleDock,
12117
12380
  onChangeSize: function onChangeSize(_ref2) {
12118
12381
  var width = _ref2.width;
12119
- setSize(Object.assign(Object.assign({}, size), {
12382
+ setSizeInState(Object.assign(Object.assign({}, sizeInState), {
12120
12383
  width: width
12121
12384
  }));
12122
12385
  }
@@ -12126,14 +12389,14 @@ var LayerManager = function LayerManager(_ref) {
12126
12389
  onResizeStop: function onResizeStop(_event, _direction, node) {
12127
12390
  var width = node.offsetWidth,
12128
12391
  height = node.offsetHeight;
12129
- setSize({
12392
+ setSizeInState({
12130
12393
  width: width,
12131
12394
  height: height
12132
12395
  });
12133
12396
  },
12134
12397
  onDragEnd: function onDragEnd(_position, dragSize) {
12135
- if (dragSize !== size) {
12136
- setSize(dragSize);
12398
+ if (dragSize !== sizeInState) {
12399
+ setSizeInState(dragSize);
12137
12400
  }
12138
12401
  }
12139
12402
  }, /*#__PURE__*/React.createElement(Box, {
@@ -12400,6 +12663,7 @@ var LayerManagerConnect = function LayerManagerConnect(_ref) {
12400
12663
  onMouseDown: setDialogOrder,
12401
12664
  order: dialogOrder,
12402
12665
  source: uiSource,
12666
+ size: sizeLarge,
12403
12667
  leftHeaderComponent: leftHeaderComponent,
12404
12668
  isLoading: uiIsLoading,
12405
12669
  error: uiError,
@@ -12442,7 +12706,10 @@ var DockedLayerManagerConnect = function DockedLayerManagerConnect(_ref) {
12442
12706
  leftHeaderComponent = _ref$leftHeaderCompon === void 0 ? undefined : _ref$leftHeaderCompon,
12443
12707
  _ref$source = _ref.source,
12444
12708
  source = _ref$source === void 0 ? 'app' : _ref$source;
12445
- var dispatch = useDispatch(); // TODO: Uncomment when adding the presets: https://gitlab.com/opengeoweb/opengeoweb/-/issues/2881
12709
+ var dispatch = useDispatch();
12710
+ var dockedLayerManagerSize = useSelector(function (store) {
12711
+ return getDockedLayerManagerSize(store, mapId);
12712
+ }); // TODO: Uncomment when adding the presets: https://gitlab.com/opengeoweb/opengeoweb/-/issues/2881
12446
12713
  // const isMapPresetLoading = useSelector((store: AppStore) =>
12447
12714
  // mapSelectors.getIsMapPresetLoading(store, mapId),
12448
12715
  // );
@@ -12482,7 +12749,7 @@ var DockedLayerManagerConnect = function DockedLayerManagerConnect(_ref) {
12482
12749
  // error={mapPresetError}
12483
12750
  onToggleDock: onToggleDock,
12484
12751
  isDockedLayerManager: true,
12485
- size: sizeSmall,
12752
+ size: returnCorrectSize(dockedLayerManagerSize),
12486
12753
  startPosition: {
12487
12754
  top: 60,
12488
12755
  right: 16
@@ -12597,713 +12864,173 @@ var SearchFieldButtonContainer = function SearchFieldButtonContainer(_ref) {
12597
12864
  }, /*#__PURE__*/React__default.createElement(Search, null)));
12598
12865
  };
12599
12866
 
12600
- /* *
12601
- * Licensed under the Apache License, Version 2.0 (the "License");
12602
- * you may not use this file except in compliance with the License.
12603
- * You may obtain a copy of the License at
12604
- *
12605
- * http://www.apache.org/licenses/LICENSE-2.0
12606
- *
12607
- * Unless required by applicable law or agreed to in writing, software
12608
- * distributed under the License is distributed on an "AS IS" BASIS,
12609
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12610
- * See the License for the specific language governing permissions and
12611
- * limitations under the License.
12612
- *
12613
- * Copyright 2022 - Koninklijk Nederlands Meteorologisch Instituut (KNMI)
12614
- * Copyright 2022 - Finnish Meteorological Institute (FMI)
12615
- * */
12616
- var VALIDATIONS_NAME_EXISTING = 'This name already exists. Choose another name.';
12617
- var VALIDATIONS_SERVICE_EXISTING = 'URL already exists.';
12618
- var VALIDATIONS_SERVICE_VALID_URL = 'Not a valid URL.';
12619
- var VALIDATIONS_REQUEST_FAILED = 'Download failed. Check the URL.';
12620
- var validateServiceName = function validateServiceName(value, services) {
12621
- var ownServiceName = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : '';
12622
- var serviceName = value === null || value === void 0 ? void 0 : value.toLowerCase();
12623
- var foundName = Object.keys(services).find(function (serviceId) {
12624
- var _a;
12625
-
12626
- return ((_a = services[serviceId]) === null || _a === void 0 ? void 0 : _a.serviceName.toLowerCase()) === serviceName && serviceName !== ownServiceName.toLocaleLowerCase();
12627
- });
12628
- return foundName === undefined ? true : VALIDATIONS_NAME_EXISTING;
12629
- };
12630
-
12631
- var isValidUrl = function isValidUrl(url) {
12632
- if (url === '' || url === null || typeof url === 'undefined') {
12633
- return false;
12634
- }
12635
-
12636
- var matcher = /^(?:\w+:)?\/\/([^\s.]+\.\S{2}|[0-9a-zA-Z]+[:?\d]*)\S*$/;
12637
-
12638
- if (!matcher.test(url)) {
12639
- return false;
12640
- }
12641
-
12642
- return true;
12643
- };
12644
-
12645
- var validateServiceUrl = function validateServiceUrl(value, services) {
12646
- var serviceUrl = value; // validate valid url
12647
-
12648
- var isServiceUrlValid = isValidUrl(serviceUrl);
12649
-
12650
- if (!isServiceUrlValid) {
12651
- return VALIDATIONS_SERVICE_VALID_URL;
12652
- } // check url existing
12867
+ var SearchField = function SearchField(_ref) {
12868
+ var searchFilter = _ref.searchFilter,
12869
+ setSearchFilter = _ref.setSearchFilter,
12870
+ onOpenServicePopup = _ref.onOpenServicePopup;
12653
12871
 
12872
+ var _React$useState = React.useState(''),
12873
+ _React$useState2 = _slicedToArray(_React$useState, 2),
12874
+ localSearchString = _React$useState2[0],
12875
+ setLocalSearchString = _React$useState2[1];
12654
12876
 
12655
- var foundUrl = Object.keys(services).find(function (serviceId) {
12656
- var _a;
12877
+ var _React$useState3 = React.useState(false),
12878
+ _React$useState4 = _slicedToArray(_React$useState3, 2),
12879
+ urlIsValid = _React$useState4[0],
12880
+ setUrlIsValid = _React$useState4[1]; // eslint-disable-next-line react-hooks/exhaustive-deps
12657
12881
 
12658
- return ((_a = services[serviceId]) === null || _a === void 0 ? void 0 : _a.serviceUrl) === serviceUrl;
12659
- });
12660
12882
 
12661
- if (foundUrl) {
12662
- return VALIDATIONS_SERVICE_EXISTING;
12663
- }
12883
+ var setSearchFilterDebounced = React.useCallback(debounce(setSearchFilter, 300), []);
12664
12884
 
12665
- return true;
12666
- };
12667
- var loadWMSService = function loadWMSService(serviceUrl) {
12668
- var forceReload = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
12669
- return __awaiter(void 0, void 0, void 0, /*#__PURE__*/regeneratorRuntime.mark(function _callee() {
12670
- var layers, service;
12671
- return regeneratorRuntime.wrap(function _callee$(_context) {
12672
- while (1) {
12673
- switch (_context.prev = _context.next) {
12674
- case 0:
12675
- _context.next = 2;
12676
- return getLayersFlattenedFromService(serviceUrl, forceReload);
12885
+ var handleChange = function handleChange(text) {
12886
+ setLocalSearchString(text);
12887
+ if (!isURL(text)) setSearchFilterDebounced(text);else if (searchFilter) setSearchFilterDebounced('');
12888
+ };
12677
12889
 
12678
- case 2:
12679
- layers = _context.sent;
12680
- service = WMGetServiceFromStore(serviceUrl);
12681
- return _context.abrupt("return", {
12682
- id: service.id,
12683
- name: service.title,
12684
- serviceUrl: serviceUrl,
12685
- "abstract": service["abstract"],
12686
- layers: layers,
12687
- scope: 'user'
12688
- });
12890
+ React.useEffect(function () {
12891
+ if (isURL(localSearchString)) {
12892
+ setUrlIsValid(true);
12893
+ }
12894
+ }, [localSearchString]);
12895
+ React.useEffect(function () {
12896
+ var keyDownHandler = function keyDownHandler(event) {
12897
+ if (event.key === 'Enter') {
12898
+ event.preventDefault();
12689
12899
 
12690
- case 5:
12691
- case "end":
12692
- return _context.stop();
12900
+ if (urlIsValid) {
12901
+ onOpenServicePopup(localSearchString);
12902
+ setLocalSearchString('');
12693
12903
  }
12694
12904
  }
12695
- }, _callee);
12696
- }));
12697
- };
12905
+ };
12698
12906
 
12699
- var style$1 = {
12700
- textField: {
12701
- width: '100%',
12702
- marginBottom: 2
12703
- }
12704
- };
12705
- var ADD_HEADING = 'Add a new service';
12706
- var EDIT_HEADING = 'Edit service';
12707
- var SAVE_HEADING = 'Save service';
12708
- var COPY_URL_MESSAGE = 'Service URL copied to clipboard';
12709
- var getSuccesMessage = function getSuccesMessage(serviceName) {
12710
- return "Service \"".concat(serviceName, "\" has been saved succesfully");
12907
+ document.addEventListener('keydown', keyDownHandler);
12908
+ return function () {
12909
+ document.removeEventListener('keydown', keyDownHandler);
12910
+ };
12911
+ }, [urlIsValid, localSearchString, onOpenServicePopup]); // mirror store unless typing a URL
12912
+
12913
+ React.useEffect(function () {
12914
+ if (isURL(localSearchString)) return;
12915
+ setLocalSearchString(searchFilter); // eslint-disable-next-line react-hooks/exhaustive-deps
12916
+ }, [searchFilter]);
12917
+ return /*#__PURE__*/React.createElement(TextField, {
12918
+ variant: "filled",
12919
+ label: "Search through services or enter a service URL",
12920
+ value: localSearchString,
12921
+ onChange: function onChange(e) {
12922
+ handleChange(e.target.value);
12923
+ },
12924
+ autoFocus: true,
12925
+ fullWidth: true,
12926
+ InputProps: {
12927
+ endAdornment: /*#__PURE__*/React.createElement(InputAdornment, {
12928
+ position: "end"
12929
+ }, /*#__PURE__*/React.createElement(SearchFieldButtonContainer, {
12930
+ setPopupIsOpen: function setPopupIsOpen() {
12931
+ onOpenServicePopup(localSearchString);
12932
+ setLocalSearchString('');
12933
+ },
12934
+ localSearchString: localSearchString,
12935
+ onClickClear: function onClickClear() {
12936
+ setLocalSearchString('');
12937
+ setSearchFilterDebounced('');
12938
+ setUrlIsValid(false);
12939
+ }
12940
+ }))
12941
+ }
12942
+ });
12711
12943
  };
12712
12944
 
12713
- var getTitleForVariant = function getTitleForVariant(variant) {
12714
- switch (variant) {
12715
- case 'add':
12716
- return ADD_HEADING;
12945
+ /* *
12946
+ * Licensed under the Apache License, Version 2.0 (the "License");
12947
+ * you may not use this file except in compliance with the License.
12948
+ * You may obtain a copy of the License at
12949
+ *
12950
+ * http://www.apache.org/licenses/LICENSE-2.0
12951
+ *
12952
+ * Unless required by applicable law or agreed to in writing, software
12953
+ * distributed under the License is distributed on an "AS IS" BASIS,
12954
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12955
+ * See the License for the specific language governing permissions and
12956
+ * limitations under the License.
12957
+ *
12958
+ * Copyright 2021 - Koninklijk Nederlands Meteorologisch Instituut (KNMI)
12959
+ * Copyright 2021 - Finnish Meteorological Institute (FMI)
12960
+ * */
12717
12961
 
12718
- case 'edit':
12719
- return EDIT_HEADING;
12962
+ var SearchFieldConnect = function SearchFieldConnect() {
12963
+ var dispatch = useDispatch();
12964
+ var searchFilter = useSelector(function (store) {
12965
+ return getSearchFilter(store);
12966
+ });
12720
12967
 
12721
- case 'save':
12722
- return SAVE_HEADING;
12968
+ var toggleServicePopup = function toggleServicePopup(url) {
12969
+ dispatch(layerSelectActions.toggleServicePopup({
12970
+ isOpen: true,
12971
+ url: url,
12972
+ variant: 'save'
12973
+ }));
12974
+ };
12723
12975
 
12724
- default:
12725
- return 'Service';
12726
- }
12727
- };
12976
+ var setSearchFilter = function setSearchFilter(filterText) {
12977
+ dispatch(layerSelectActions.setSearchFilter({
12978
+ filterText: filterText
12979
+ }));
12980
+ };
12728
12981
 
12729
- var fields = {
12730
- serviceUrl: {
12731
- name: 'serviceUrl',
12732
- label: 'This service refers to this URL'
12733
- },
12734
- serviceName: {
12735
- name: 'serviceName',
12736
- label: 'Service name'
12737
- },
12738
- serviceAbstracts: {
12739
- name: 'serviceAbstracts',
12740
- label: 'Abstracts'
12741
- }
12982
+ return /*#__PURE__*/React.createElement(SearchField, {
12983
+ setSearchFilter: setSearchFilter,
12984
+ searchFilter: searchFilter,
12985
+ onOpenServicePopup: toggleServicePopup
12986
+ });
12742
12987
  };
12743
12988
 
12744
- var InitialValidationsTrigger = function InitialValidationsTrigger(_ref) {
12745
- var trigger = _ref.trigger,
12746
- getValues = _ref.getValues,
12747
- onValidField = _ref.onValidField;
12748
- React.useEffect(function () {
12749
- var value = getValues(fields.serviceUrl.name);
12989
+ /* *
12990
+ * Licensed under the Apache License, Version 2.0 (the "License");
12991
+ * you may not use this file except in compliance with the License.
12992
+ * You may obtain a copy of the License at
12993
+ *
12994
+ * http://www.apache.org/licenses/LICENSE-2.0
12995
+ *
12996
+ * Unless required by applicable law or agreed to in writing, software
12997
+ * distributed under the License is distributed on an "AS IS" BASIS,
12998
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12999
+ * See the License for the specific language governing permissions and
13000
+ * limitations under the License.
13001
+ *
13002
+ * Copyright 2022 - Koninklijk Nederlands Meteorologisch Instituut (KNMI)
13003
+ * Copyright 2022 - Finnish Meteorological Institute (FMI)
13004
+ * */
12750
13005
 
12751
- if (value) {
12752
- trigger(fields.serviceUrl.name).then(function (isValid) {
12753
- return isValid && onValidField(value);
13006
+ var LayerAddRemoveButton = function LayerAddRemoveButton(_ref) {
13007
+ var layer = _ref.layer,
13008
+ layerIndex = _ref.layerIndex,
13009
+ serviceUrl = _ref.serviceUrl,
13010
+ addLayer = _ref.addLayer,
13011
+ deleteLayer = _ref.deleteLayer,
13012
+ mapLayers = _ref.mapLayers;
13013
+ var foundLayer = mapLayers.find(function (lr) {
13014
+ return lr.name === layer.name && lr.service === serviceUrl;
13015
+ });
13016
+ return /*#__PURE__*/React.createElement(CustomToggleButton, {
13017
+ "data-testid": "layerAddRemoveButton-".concat(layer.name),
13018
+ onClick: function onClick() {
13019
+ !foundLayer ? addLayer({
13020
+ serviceUrl: serviceUrl,
13021
+ layerName: layer.name
13022
+ }) : deleteLayer({
13023
+ layerId: foundLayer.id,
13024
+ layerIndex: layerIndex
12754
13025
  });
12755
- } // eslint-disable-next-line react-hooks/exhaustive-deps
12756
-
12757
- }, []);
12758
- return null;
12759
- };
12760
-
12761
- var ServicePopup = function ServicePopup(_ref2) {
12762
- var servicePopupVariant = _ref2.servicePopupVariant,
12763
- _ref2$hideBackdrop = _ref2.hideBackdrop,
12764
- hideBackdrop = _ref2$hideBackdrop === void 0 ? false : _ref2$hideBackdrop,
12765
- isOpen = _ref2.isOpen,
12766
- closePopup = _ref2.closePopup,
12767
- shouldDisableAutoFocus = _ref2.shouldDisableAutoFocus,
12768
- services = _ref2.services,
12769
- serviceSetLayers = _ref2.serviceSetLayers,
12770
- serviceUrl = _ref2.serviceUrl,
12771
- serviceName = _ref2.serviceName,
12772
- serviceAbstracts = _ref2.serviceAbstracts,
12773
- _ref2$showSnackbar = _ref2.showSnackbar,
12774
- showSnackbar = _ref2$showSnackbar === void 0 ? function () {} : _ref2$showSnackbar;
12775
-
12776
- var _useFormContext = useFormContext(),
12777
- reset = _useFormContext.reset,
12778
- errors = _useFormContext.formState.errors,
12779
- handleSubmit = _useFormContext.handleSubmit,
12780
- setError = _useFormContext.setError,
12781
- clearErrors = _useFormContext.clearErrors,
12782
- watch = _useFormContext.watch,
12783
- trigger = _useFormContext.trigger,
12784
- getValues = _useFormContext.getValues,
12785
- setValue = _useFormContext.setValue;
12786
-
12787
- var _React$useState = React.useState(false),
12788
- _React$useState2 = _slicedToArray(_React$useState, 2),
12789
- isLoading = _React$useState2[0],
12790
- setIsLoading = _React$useState2[1];
12791
-
12792
- var fetchServiceData = function fetchServiceData(newServiceUrl) {
12793
- return __awaiter(void 0, void 0, void 0, /*#__PURE__*/regeneratorRuntime.mark(function _callee() {
12794
- var service;
12795
- return regeneratorRuntime.wrap(function _callee$(_context) {
12796
- while (1) {
12797
- switch (_context.prev = _context.next) {
12798
- case 0:
12799
- _context.prev = 0;
12800
- setIsLoading(true);
12801
- _context.next = 4;
12802
- return getLayersFromService(newServiceUrl);
12803
-
12804
- case 4:
12805
- service = WMGetServiceFromStore(newServiceUrl);
12806
- setValue(fields.serviceName.name, service.title);
12807
- setValue(fields.serviceAbstracts.name, service["abstract"]);
12808
- setIsLoading(false);
12809
- _context.next = 14;
12810
- break;
12811
-
12812
- case 10:
12813
- _context.prev = 10;
12814
- _context.t0 = _context["catch"](0);
12815
- setIsLoading(false);
12816
- setError(fields.serviceUrl.name, {
12817
- message: VALIDATIONS_REQUEST_FAILED,
12818
- type: 'SYSTEM'
12819
- });
12820
-
12821
- case 14:
12822
- case "end":
12823
- return _context.stop();
12824
- }
12825
- }
12826
- }, _callee, null, [[0, 10]]);
12827
- }));
12828
- };
12829
-
12830
- var addNewService = function addNewService(formValues) {
12831
- return __awaiter(void 0, void 0, void 0, /*#__PURE__*/regeneratorRuntime.mark(function _callee2() {
12832
- var layersForService;
12833
- return regeneratorRuntime.wrap(function _callee2$(_context2) {
12834
- while (1) {
12835
- switch (_context2.prev = _context2.next) {
12836
- case 0:
12837
- clearErrors(fields.serviceUrl.name);
12838
- setIsLoading(true);
12839
- _context2.prev = 2;
12840
- _context2.next = 5;
12841
- return loadWMSService(formValues.serviceUrl, true);
12842
-
12843
- case 5:
12844
- layersForService = _context2.sent;
12845
- serviceSetLayers({
12846
- id: layersForService.id,
12847
- name: formValues.serviceName,
12848
- serviceUrl: formValues.serviceUrl,
12849
- "abstract": formValues.serviceAbstracts,
12850
- layers: layersForService.layers,
12851
- scope: 'user'
12852
- });
12853
- setIsLoading(false);
12854
- showSnackbar(getSuccesMessage(formValues.serviceName));
12855
- closePopup();
12856
- _context2.next = 16;
12857
- break;
12858
-
12859
- case 12:
12860
- _context2.prev = 12;
12861
- _context2.t0 = _context2["catch"](2);
12862
- setIsLoading(false);
12863
- setError(fields.serviceUrl.name, {
12864
- message: VALIDATIONS_REQUEST_FAILED,
12865
- type: 'SYSTEM'
12866
- });
12867
-
12868
- case 16:
12869
- case "end":
12870
- return _context2.stop();
12871
- }
12872
- }
12873
- }, _callee2, null, [[2, 12]]);
12874
- }));
12875
- };
12876
-
12877
- var onValidateServiceUrl = function onValidateServiceUrl(value) {
12878
- return validateServiceUrl(value, services);
12879
- };
12880
-
12881
- var onFocusServiceUrl = function onFocusServiceUrl() {
12882
- var hasValue = getValues(fields.serviceUrl.name);
12883
-
12884
- if (!errors[fields.serviceUrl.name] && hasValue) {
12885
- trigger(fields.serviceUrl.name);
12886
- }
12887
- };
12888
-
12889
- var onBlurServiceUrl = function onBlurServiceUrl() {
12890
- if (!errors[fields.serviceUrl.name]) {
12891
- fetchServiceData(getValues(fields.serviceUrl.name));
12892
- }
12893
- };
12894
-
12895
- var onValidateServiceName = function onValidateServiceName(value) {
12896
- return validateServiceName(value, services, serviceName);
12897
- };
12898
-
12899
- var getFormAreRequiredFieldsEmpty = function getFormAreRequiredFieldsEmpty() {
12900
- var serviceNameField = watch(fields.serviceName.name);
12901
- var serviceUrlField = watch(fields.serviceUrl.name);
12902
- return serviceNameField === '' || serviceNameField === undefined || serviceUrlField === '' || serviceUrlField === undefined;
12903
- };
12904
-
12905
- var getFormHasformErrors = function getFormHasformErrors() {
12906
- var totalErrors = Object.keys(errors).length;
12907
-
12908
- if (totalErrors > 0) {
12909
- // prevent SYSTEM error types from blocking the save button
12910
- if (totalErrors === 1 && errors.serviceUrl) {
12911
- return errors.serviceUrl.type !== undefined && errors.serviceUrl.type !== 'SYSTEM';
12912
- }
12913
-
12914
- return true;
12915
- }
12916
-
12917
- return false;
12918
- };
12919
-
12920
- var isSubmitDisabled = getFormHasformErrors() || getFormAreRequiredFieldsEmpty();
12921
- React.useEffect(function () {
12922
- reset({
12923
- serviceUrl: serviceUrl,
12924
- serviceName: serviceName,
12925
- serviceAbstracts: serviceAbstracts
12926
- });
12927
- }, [serviceUrl, serviceName, serviceAbstracts, reset]);
12928
- var isShowPopup = servicePopupVariant === 'show';
12929
- var isServiceUrlDisabled = isShowPopup || servicePopupVariant === 'edit';
12930
- return /*#__PURE__*/React.createElement(Dialog, {
12931
- open: isOpen,
12932
- hideBackdrop: hideBackdrop,
12933
- fullWidth: true,
12934
- maxWidth: "xs",
12935
- "data-testid": "servicePopup",
12936
- sx: {
12937
- '& .MuiDialog-paper': {
12938
- backgroundColor: "geowebColors.cards.cardContainer",
12939
- maxWidth: 458
12940
- }
12941
- }
12942
- }, /*#__PURE__*/React.createElement("form", {
12943
- onSubmit: handleSubmit(addNewService)
12944
- }, /*#__PURE__*/React.createElement(DialogTitle, {
12945
- sx: {
12946
- alignItems: 'center',
12947
- padding: '16px 16px 24px 16px'
12948
- }
12949
- }, /*#__PURE__*/React.createElement(Box, {
12950
- sx: {
12951
- display: 'flex',
12952
- justifyContent: 'space-between',
12953
- alignItems: 'center',
12954
- ' span': {
12955
- fontSize: '1rem',
12956
- fontWeight: 500,
12957
- fontStyle: 'normal',
12958
- lineHeight: '1.38',
12959
- letterSpacing: '0.12px'
12960
- }
12961
- }
12962
- }, /*#__PURE__*/React.createElement(Typography, {
12963
- variant: "h5",
12964
- component: "span"
12965
- }, getTitleForVariant(servicePopupVariant)), /*#__PURE__*/React.createElement(IconButton, {
12966
- "aria-label": "close",
12967
- size: "small",
12968
- onClick: closePopup,
12969
- "data-testid": "closePopupButtonCross",
12970
- sx: {
12971
- color: 'geowebColors.captions.captionDisabled.color',
12972
- marginTop: 'auto',
12973
- marginBottom: 'auto'
12974
- }
12975
- }, /*#__PURE__*/React.createElement(Close, null))), isLoading && /*#__PURE__*/React.createElement(Box, {
12976
- sx: {
12977
- position: 'relative'
12978
- }
12979
- }, /*#__PURE__*/React.createElement(LinearProgress, {
12980
- "data-testid": "loadingIndicator",
12981
- color: "secondary",
12982
- sx: {
12983
- position: 'absolute',
12984
- width: '100%',
12985
- top: 8
12986
- }
12987
- }))), /*#__PURE__*/React.createElement(DialogContent, {
12988
- sx: {
12989
- padding: '8px 16px'
12990
- }
12991
- }, /*#__PURE__*/React.createElement(ReactHookFormTextField, {
12992
- name: fields.serviceUrl.name,
12993
- label: fields.serviceUrl.label,
12994
- onFocus: onFocusServiceUrl,
12995
- autoFocus: !shouldDisableAutoFocus,
12996
- onBlur: onBlurServiceUrl,
12997
- sx: style$1.textField,
12998
- rules: {
12999
- required: true,
13000
- validate: Object.assign({}, !isServiceUrlDisabled && {
13001
- onValidateServiceUrl: onValidateServiceUrl
13002
- })
13003
- },
13004
- disabled: isServiceUrlDisabled || isLoading,
13005
- isReadOnly: isShowPopup,
13006
- InputProps: {
13007
- disableUnderline: isShowPopup,
13008
- endAdornment: isShowPopup && /*#__PURE__*/React.createElement(InputAdornment, {
13009
- position: "end"
13010
- }, /*#__PURE__*/React.createElement(IconButton, {
13011
- "aria-label": "copy url",
13012
- onClick: function onClick() {
13013
- navigator.clipboard.writeText(serviceUrl);
13014
- showSnackbar(COPY_URL_MESSAGE);
13015
- }
13016
- }, /*#__PURE__*/React.createElement(Copy, null)))
13017
- },
13018
- defaultValue: serviceUrl
13019
- }), /*#__PURE__*/React.createElement(ReactHookFormTextField, {
13020
- name: fields.serviceName.name,
13021
- label: fields.serviceName.label,
13022
- rules: {
13023
- required: true,
13024
- validate: {
13025
- onValidateServiceName: onValidateServiceName
13026
- }
13027
- },
13028
- disabled: isShowPopup || isLoading,
13029
- isReadOnly: isShowPopup,
13030
- InputProps: {
13031
- disableUnderline: isShowPopup
13032
- },
13033
- sx: style$1.textField,
13034
- defaultValue: serviceName
13035
- }), /*#__PURE__*/React.createElement(ReactHookFormTextField, {
13036
- multiline: true,
13037
- rows: 4,
13038
- name: fields.serviceAbstracts.name,
13039
- label: fields.serviceAbstracts.label,
13040
- disabled: isShowPopup || isLoading,
13041
- isReadOnly: isShowPopup,
13042
- InputProps: {
13043
- disableUnderline: isShowPopup
13044
- },
13045
- helperText: !isShowPopup ? 'Short description of what this service does' : '',
13046
- sx: style$1.textField,
13047
- defaultValue: ""
13048
- }), !isServiceUrlDisabled && /*#__PURE__*/React.createElement(InitialValidationsTrigger, {
13049
- trigger: trigger,
13050
- getValues: getValues,
13051
- onValidField: fetchServiceData
13052
- })), /*#__PURE__*/React.createElement(DialogActions, {
13053
- sx: {
13054
- padding: 2
13055
- }
13056
- }, isShowPopup ? /*#__PURE__*/React.createElement(Button, {
13057
- onClick: function onClick() {
13058
- return closePopup();
13059
- },
13060
- variant: "tertiary",
13061
- sx: {
13062
- width: '117px'
13063
- }
13064
- }, "close") : /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(Button, {
13065
- onClick: closePopup,
13066
- "data-testid": "closePopupButtonCancel",
13067
- variant: "tertiary",
13068
- sx: {
13069
- width: '117px'
13070
- }
13071
- }, "cancel"), /*#__PURE__*/React.createElement(Button, {
13072
- type: "submit",
13073
- variant: "primary",
13074
- disabled: isSubmitDisabled || isLoading,
13075
- "data-testid": "saveServiceButton",
13076
- sx: {
13077
- width: '117px',
13078
- marginLeft: '16px!important'
13079
- }
13080
- }, "save")))));
13081
- };
13082
-
13083
- var ServicePopupWrapper = function ServicePopupWrapper(_a) {
13084
- var props = __rest(_a, []);
13085
-
13086
- return /*#__PURE__*/React.createElement(ReactHookFormProvider, {
13087
- options: defaultFormOptions
13088
- }, /*#__PURE__*/React.createElement(ServicePopup, Object.assign({}, props)));
13089
- };
13090
-
13091
- /* *
13092
- * Licensed under the Apache License, Version 2.0 (the "License");
13093
- * you may not use this file except in compliance with the License.
13094
- * You may obtain a copy of the License at
13095
- *
13096
- * http://www.apache.org/licenses/LICENSE-2.0
13097
- *
13098
- * Unless required by applicable law or agreed to in writing, software
13099
- * distributed under the License is distributed on an "AS IS" BASIS,
13100
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13101
- * See the License for the specific language governing permissions and
13102
- * limitations under the License.
13103
- *
13104
- * Copyright 2022 - Koninklijk Nederlands Meteorologisch Instituut (KNMI)
13105
- * Copyright 2022 - Finnish Meteorological Institute (FMI)
13106
- * */
13107
-
13108
- var ServicePopupConnect = function ServicePopupConnect(_ref) {
13109
- var servicePopupVariant = _ref.servicePopupVariant,
13110
- hideBackdrop = _ref.hideBackdrop,
13111
- isOpen = _ref.isOpen,
13112
- closePopup = _ref.closePopup,
13113
- serviceId = _ref.serviceId,
13114
- url = _ref.url;
13115
- var dispatch = useDispatch();
13116
- var services = useSelector(function (store) {
13117
- return getActiveServices(store);
13118
- });
13119
- var serviceSetLayers = React__default.useCallback(function (payload) {
13120
- dispatch(serviceActions.serviceSetLayers(payload));
13121
- }, [dispatch]);
13122
- var activeService = useSelector(function (store) {
13123
- return getActiveServiceById(store, serviceId);
13124
- });
13125
- var showSnackbar = React__default.useCallback(function (message) {
13126
- dispatch(snackbarActions.openSnackbar({
13127
- message: message
13128
- }));
13129
- }, [dispatch]);
13130
- return /*#__PURE__*/React__default.createElement(ServicePopupWrapper, {
13131
- servicePopupVariant: servicePopupVariant,
13132
- hideBackdrop: hideBackdrop,
13133
- isOpen: isOpen,
13134
- closePopup: closePopup,
13135
- services: services,
13136
- serviceSetLayers: serviceSetLayers,
13137
- serviceId: serviceId,
13138
- serviceUrl: url || (activeService === null || activeService === void 0 ? void 0 : activeService.serviceUrl),
13139
- serviceName: activeService === null || activeService === void 0 ? void 0 : activeService.serviceName,
13140
- serviceAbstracts: activeService === null || activeService === void 0 ? void 0 : activeService["abstract"],
13141
- showSnackbar: showSnackbar
13142
- });
13143
- };
13144
-
13145
- var SearchField = function SearchField(_ref) {
13146
- var searchFilter = _ref.searchFilter,
13147
- setSearchFilter = _ref.setSearchFilter;
13148
-
13149
- var _React$useState = React.useState(''),
13150
- _React$useState2 = _slicedToArray(_React$useState, 2),
13151
- localSearchString = _React$useState2[0],
13152
- setLocalSearchString = _React$useState2[1];
13153
-
13154
- var _React$useState3 = React.useState(false),
13155
- _React$useState4 = _slicedToArray(_React$useState3, 2),
13156
- urlIsValid = _React$useState4[0],
13157
- setUrlIsValid = _React$useState4[1];
13158
-
13159
- var _React$useState5 = React.useState(false),
13160
- _React$useState6 = _slicedToArray(_React$useState5, 2),
13161
- popupIsOpen = _React$useState6[0],
13162
- setPopupIsOpen = _React$useState6[1]; // eslint-disable-next-line react-hooks/exhaustive-deps
13163
-
13164
-
13165
- var setSearchFilterDebounced = React.useCallback(debounce(setSearchFilter, 300), []);
13166
-
13167
- var handleChange = function handleChange(text) {
13168
- setLocalSearchString(text);
13169
- if (!isURL(text)) setSearchFilterDebounced(text);else if (searchFilter) setSearchFilterDebounced('');
13170
- };
13171
-
13172
- React.useEffect(function () {
13173
- if (isURL(localSearchString)) {
13174
- setUrlIsValid(true);
13175
- }
13176
- }, [localSearchString]);
13177
- React.useEffect(function () {
13178
- var keyDownHandler = function keyDownHandler(event) {
13179
- if (event.key === 'Enter') {
13180
- event.preventDefault();
13181
-
13182
- if (urlIsValid) {
13183
- setPopupIsOpen(true);
13184
- }
13185
- }
13186
- };
13187
-
13188
- document.addEventListener('keydown', keyDownHandler);
13189
- return function () {
13190
- document.removeEventListener('keydown', keyDownHandler);
13191
- };
13192
- }, [urlIsValid]); // mirror store unless typing a URL
13193
-
13194
- React.useEffect(function () {
13195
- if (isURL(localSearchString)) return;
13196
- setLocalSearchString(searchFilter); // eslint-disable-next-line react-hooks/exhaustive-deps
13197
- }, [searchFilter]);
13198
- return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(TextField, {
13199
- variant: "filled",
13200
- label: "Search through services or enter a service URL",
13201
- value: localSearchString,
13202
- onChange: function onChange(e) {
13203
- handleChange(e.target.value);
13204
- },
13205
- autoFocus: true,
13206
- fullWidth: true,
13207
- InputProps: {
13208
- endAdornment: /*#__PURE__*/React.createElement(InputAdornment, {
13209
- position: "end"
13210
- }, /*#__PURE__*/React.createElement(SearchFieldButtonContainer, {
13211
- setPopupIsOpen: setPopupIsOpen,
13212
- localSearchString: localSearchString,
13213
- onClickClear: function onClickClear() {
13214
- setLocalSearchString('');
13215
- setSearchFilterDebounced('');
13216
- }
13217
- }))
13218
- }
13219
- }), /*#__PURE__*/React.createElement(ServicePopupConnect, {
13220
- servicePopupVariant: "save",
13221
- isOpen: popupIsOpen,
13222
- closePopup: function closePopup() {
13223
- setPopupIsOpen(false);
13224
- setLocalSearchString('');
13225
- },
13226
- url: localSearchString
13227
- }));
13228
- };
13229
-
13230
- /* *
13231
- * Licensed under the Apache License, Version 2.0 (the "License");
13232
- * you may not use this file except in compliance with the License.
13233
- * You may obtain a copy of the License at
13234
- *
13235
- * http://www.apache.org/licenses/LICENSE-2.0
13236
- *
13237
- * Unless required by applicable law or agreed to in writing, software
13238
- * distributed under the License is distributed on an "AS IS" BASIS,
13239
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13240
- * See the License for the specific language governing permissions and
13241
- * limitations under the License.
13242
- *
13243
- * Copyright 2021 - Koninklijk Nederlands Meteorologisch Instituut (KNMI)
13244
- * Copyright 2021 - Finnish Meteorological Institute (FMI)
13245
- * */
13246
-
13247
- var SearchFieldConnect = function SearchFieldConnect() {
13248
- var dispatch = useDispatch();
13249
- var searchFilter = useSelector(function (store) {
13250
- return getSearchFilter(store);
13251
- });
13252
- return /*#__PURE__*/React.createElement(SearchField, {
13253
- setSearchFilter: function setSearchFilter(filterText) {
13254
- dispatch(layerSelectActions.setSearchFilter({
13255
- filterText: filterText
13256
- }));
13257
- },
13258
- searchFilter: searchFilter
13259
- });
13260
- };
13261
-
13262
- /* *
13263
- * Licensed under the Apache License, Version 2.0 (the "License");
13264
- * you may not use this file except in compliance with the License.
13265
- * You may obtain a copy of the License at
13266
- *
13267
- * http://www.apache.org/licenses/LICENSE-2.0
13268
- *
13269
- * Unless required by applicable law or agreed to in writing, software
13270
- * distributed under the License is distributed on an "AS IS" BASIS,
13271
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13272
- * See the License for the specific language governing permissions and
13273
- * limitations under the License.
13274
- *
13275
- * Copyright 2022 - Koninklijk Nederlands Meteorologisch Instituut (KNMI)
13276
- * Copyright 2022 - Finnish Meteorological Institute (FMI)
13277
- * */
13278
-
13279
- var LayerAddRemoveButton = function LayerAddRemoveButton(_ref) {
13280
- var layer = _ref.layer,
13281
- layerIndex = _ref.layerIndex,
13282
- serviceUrl = _ref.serviceUrl,
13283
- addLayer = _ref.addLayer,
13284
- deleteLayer = _ref.deleteLayer,
13285
- mapLayers = _ref.mapLayers;
13286
- var foundLayer = mapLayers.find(function (lr) {
13287
- return lr.name === layer.name && lr.service === serviceUrl;
13288
- });
13289
- return /*#__PURE__*/React.createElement(CustomToggleButton, {
13290
- "data-testid": "layerAddRemoveButton-".concat(layer.name),
13291
- onClick: function onClick() {
13292
- !foundLayer ? addLayer({
13293
- serviceUrl: serviceUrl,
13294
- layerName: layer.name
13295
- }) : deleteLayer({
13296
- layerId: foundLayer.id,
13297
- layerIndex: layerIndex
13298
- });
13299
- },
13300
- selected: !!foundLayer,
13301
- variant: "tool",
13302
- fullWidth: true,
13303
- sx: {
13304
- fontSize: '12px'
13305
- }
13306
- }, !foundLayer ? 'Add' : 'Remove');
13026
+ },
13027
+ selected: !!foundLayer,
13028
+ variant: "tool",
13029
+ fullWidth: true,
13030
+ sx: {
13031
+ fontSize: '12px'
13032
+ }
13033
+ }, !foundLayer ? 'Add' : 'Remove');
13307
13034
  };
13308
13035
 
13309
13036
  /* *
@@ -13870,6 +13597,43 @@ var sortByService = function sortByService(serviceObj) {
13870
13597
  }, {});
13871
13598
  };
13872
13599
 
13600
+ var highlightStyle = {
13601
+ background: '#ffeecc'
13602
+ };
13603
+
13604
+ var SearchHighlight = function SearchHighlight(_ref) {
13605
+ var text = _ref.text,
13606
+ search = _ref.search;
13607
+
13608
+ if (search === '') {
13609
+ return /*#__PURE__*/React__default.createElement("span", null, text);
13610
+ }
13611
+
13612
+ var searchWords = search.split(' ').reduce(function (words, word) {
13613
+ return word ? [].concat(_toConsumableArray(words), [word.toLocaleLowerCase()]) : words;
13614
+ }, []);
13615
+ var searchRegex = searchWords.map(function (word) {
13616
+ return escapeRegExp(word);
13617
+ }).join('|');
13618
+ var textParts = text.split(new RegExp("(".concat(searchRegex, ")"), 'gi'));
13619
+ return /*#__PURE__*/React__default.createElement(React__default.Fragment, null, textParts.map(function (part, index) {
13620
+ var key = "".concat(part, "-").concat(index);
13621
+
13622
+ if (searchWords.some(function (search) {
13623
+ return part.toLocaleLowerCase().includes(search);
13624
+ })) {
13625
+ return /*#__PURE__*/React__default.createElement("mark", {
13626
+ key: key,
13627
+ style: highlightStyle
13628
+ }, part);
13629
+ }
13630
+
13631
+ return /*#__PURE__*/React__default.createElement("span", {
13632
+ key: key
13633
+ }, part);
13634
+ }));
13635
+ };
13636
+
13873
13637
  /* *
13874
13638
  * Licensed under the Apache License, Version 2.0 (the "License");
13875
13639
  * you may not use this file except in compliance with the License.
@@ -13902,7 +13666,8 @@ var LayerListRow = function LayerListRow(_ref) {
13902
13666
  deleteLayer = _ref.deleteLayer,
13903
13667
  mapLayers = _ref.mapLayers,
13904
13668
  mapId = _ref.mapId,
13905
- layerSelectWidth = _ref.layerSelectWidth;
13669
+ layerSelectWidth = _ref.layerSelectWidth,
13670
+ searchFilter = _ref.searchFilter;
13906
13671
 
13907
13672
  var _a;
13908
13673
 
@@ -13938,7 +13703,10 @@ var LayerListRow = function LayerListRow(_ref) {
13938
13703
  textOverflow: 'ellipsis',
13939
13704
  overflow: 'hidden'
13940
13705
  }
13941
- }, layer.text)), /*#__PURE__*/React__default.createElement(Grid, {
13706
+ }, /*#__PURE__*/React__default.createElement(SearchHighlight, {
13707
+ text: layer.text,
13708
+ search: searchFilter
13709
+ }))), /*#__PURE__*/React__default.createElement(Grid, {
13942
13710
  item: true,
13943
13711
  container: true,
13944
13712
  direction: "column",
@@ -13951,7 +13719,10 @@ var LayerListRow = function LayerListRow(_ref) {
13951
13719
  textOverflow: 'ellipsis',
13952
13720
  overflow: 'hidden'
13953
13721
  }
13954
- }, service.name), /*#__PURE__*/React__default.createElement(LayerInfoButtonConnect, {
13722
+ }, /*#__PURE__*/React__default.createElement(SearchHighlight, {
13723
+ text: service.name,
13724
+ search: searchFilter
13725
+ })), /*#__PURE__*/React__default.createElement(LayerInfoButtonConnect, {
13955
13726
  layer: layer,
13956
13727
  mapId: mapId,
13957
13728
  serviceName: service.name
@@ -13964,7 +13735,10 @@ var LayerListRow = function LayerListRow(_ref) {
13964
13735
  }, layer["abstract"] && /*#__PURE__*/React__default.createElement(Typography, {
13965
13736
  "data-testid": "layerAbstract",
13966
13737
  sx: layerInfoStyle
13967
- }, layer["abstract"])), /*#__PURE__*/React__default.createElement(Grid, {
13738
+ }, /*#__PURE__*/React__default.createElement(SearchHighlight, {
13739
+ text: layer["abstract"],
13740
+ search: searchFilter
13741
+ }))), /*#__PURE__*/React__default.createElement(Grid, {
13968
13742
  item: true,
13969
13743
  container: true,
13970
13744
  sx: columns.column4
@@ -13978,11 +13752,17 @@ var LayerListRow = function LayerListRow(_ref) {
13978
13752
  sx: columns.column6
13979
13753
  }, layer.path.length > 0 && /*#__PURE__*/React__default.createElement(Typography, {
13980
13754
  sx: layerInfoStyle
13981
- }, "Groups: ", layer.path.join(' / ')), ((_a = layer.keywords) === null || _a === void 0 ? void 0 : _a.length) > 0 && /*#__PURE__*/React__default.createElement(Typography, {
13755
+ }, "Groups:", ' ', /*#__PURE__*/React__default.createElement(SearchHighlight, {
13756
+ text: layer.path.join(' / '),
13757
+ search: searchFilter
13758
+ })), ((_a = layer.keywords) === null || _a === void 0 ? void 0 : _a.length) > 0 && /*#__PURE__*/React__default.createElement(Typography, {
13982
13759
  sx: layerInfoStyle
13983
- }, "Keywords:", ' ', layer.keywords.slice().sort(function (a, b) {
13984
- return a.localeCompare(b);
13985
- }).join(', ')))))), /*#__PURE__*/React__default.createElement(Grid, {
13760
+ }, "Keywords:", ' ', /*#__PURE__*/React__default.createElement(SearchHighlight, {
13761
+ text: layer.keywords.slice().sort(function (a, b) {
13762
+ return a.localeCompare(b);
13763
+ }).join(', '),
13764
+ search: searchFilter
13765
+ })))))), /*#__PURE__*/React__default.createElement(Grid, {
13986
13766
  container: true,
13987
13767
  item: true,
13988
13768
  sx: columns.column9,
@@ -14026,11 +13806,12 @@ var LayerList = function LayerList(_ref) {
14026
13806
  addLayer = _ref.addLayer,
14027
13807
  deleteLayer = _ref.deleteLayer,
14028
13808
  mapLayers = _ref.mapLayers,
14029
- mapId = _ref.mapId;
13809
+ mapId = _ref.mapId,
13810
+ searchFilter = _ref.searchFilter;
14030
13811
  var rowMargin = 4;
14031
13812
  var rowHeight = widthToRowHeight(layerSelectWidth);
14032
13813
  var layerSelectFilterHeight = 155 + serviceListHeight;
14033
- var minHeight = 400;
13814
+ var minHeight = 320;
14034
13815
  return /*#__PURE__*/React.createElement(Box, {
14035
13816
  "data-testid": "layerList"
14036
13817
  }, /*#__PURE__*/React.createElement(Box, {
@@ -14058,7 +13839,8 @@ var LayerList = function LayerList(_ref) {
14058
13839
  deleteLayer: deleteLayer,
14059
13840
  mapLayers: mapLayers,
14060
13841
  mapId: mapId,
14061
- layerSelectWidth: layerSelectWidth
13842
+ layerSelectWidth: layerSelectWidth,
13843
+ searchFilter: searchFilter
14062
13844
  }));
14063
13845
  }));
14064
13846
  };
@@ -14133,6 +13915,9 @@ var LayerListConnect = function LayerListConnect(_ref) {
14133
13915
  var filteredLayers = useSelector(function (store) {
14134
13916
  return getFilteredLayers(store);
14135
13917
  });
13918
+ var searchFilter = useSelector(function (store) {
13919
+ return getSearchFilter(store);
13920
+ });
14136
13921
  return /*#__PURE__*/React.createElement(LayerList, {
14137
13922
  filteredLayers: filteredLayers,
14138
13923
  services: services,
@@ -14142,7 +13927,8 @@ var LayerListConnect = function LayerListConnect(_ref) {
14142
13927
  addLayer: addLayer,
14143
13928
  deleteLayer: deleteLayer,
14144
13929
  mapLayers: mapLayers,
14145
- mapId: mapId
13930
+ mapId: mapId,
13931
+ searchFilter: searchFilter
14146
13932
  });
14147
13933
  };
14148
13934
 
@@ -14162,7 +13948,7 @@ var LayerListConnect = function LayerListConnect(_ref) {
14162
13948
  * Copyright 2022 - Koninklijk Nederlands Meteorologisch Instituut (KNMI)
14163
13949
  * Copyright 2022 - Finnish Meteorological Institute (FMI)
14164
13950
  * */
14165
- var style = {
13951
+ var style$1 = {
14166
13952
  borderRadius: '20px!important',
14167
13953
  marginRight: '4px',
14168
13954
  whiteSpace: 'nowrap',
@@ -14195,7 +13981,7 @@ var ServiceChip = function ServiceChip(_ref) {
14195
13981
  return toggleChip(chip);
14196
13982
  },
14197
13983
  disabled: isDisabled,
14198
- sx: style
13984
+ sx: style$1
14199
13985
  }, service ? service.serviceName : 'All')));
14200
13986
  };
14201
13987
 
@@ -14451,7 +14237,7 @@ var ServiceOptionsDialog = function ServiceOptionsDialog(_ref) {
14451
14237
  var openAddService = function openAddService() {
14452
14238
  setServicePopupInfo({
14453
14239
  isOpen: true,
14454
- popupVariant: 'add'
14240
+ variant: 'add'
14455
14241
  });
14456
14242
  };
14457
14243
 
@@ -14559,7 +14345,7 @@ var Rows = function Rows(_ref2) {
14559
14345
  isOpen: true,
14560
14346
  serviceId: serviceId,
14561
14347
  serviceUrl: serviceUrl,
14562
- popupVariant: 'edit'
14348
+ variant: 'edit'
14563
14349
  });
14564
14350
  }
14565
14351
  }, /*#__PURE__*/React.createElement(Edit, null)))) : /*#__PURE__*/React.createElement(CustomTooltip, {
@@ -14574,7 +14360,7 @@ var Rows = function Rows(_ref2) {
14574
14360
  isOpen: true,
14575
14361
  serviceId: serviceId,
14576
14362
  serviceUrl: serviceUrl,
14577
- popupVariant: 'show'
14363
+ variant: 'show'
14578
14364
  });
14579
14365
  }
14580
14366
  }, /*#__PURE__*/React.createElement(Visibility, null))))), /*#__PURE__*/React.createElement(Grid, {
@@ -14592,7 +14378,106 @@ var Rows = function Rows(_ref2) {
14592
14378
  onClick: function onClick() {
14593
14379
  return layerSelectRemoveService(serviceId, serviceUrl, serviceName);
14594
14380
  }
14595
- }, /*#__PURE__*/React.createElement(Delete, null)))))))));
14381
+ }, /*#__PURE__*/React.createElement(Delete, null)))))))));
14382
+ }));
14383
+ };
14384
+
14385
+ /* *
14386
+ * Licensed under the Apache License, Version 2.0 (the "License");
14387
+ * you may not use this file except in compliance with the License.
14388
+ * You may obtain a copy of the License at
14389
+ *
14390
+ * http://www.apache.org/licenses/LICENSE-2.0
14391
+ *
14392
+ * Unless required by applicable law or agreed to in writing, software
14393
+ * distributed under the License is distributed on an "AS IS" BASIS,
14394
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14395
+ * See the License for the specific language governing permissions and
14396
+ * limitations under the License.
14397
+ *
14398
+ * Copyright 2022 - Koninklijk Nederlands Meteorologisch Instituut (KNMI)
14399
+ * Copyright 2022 - Finnish Meteorological Institute (FMI)
14400
+ * */
14401
+ var VALIDATIONS_NAME_EXISTING = 'This name already exists. Choose another name.';
14402
+ var VALIDATIONS_SERVICE_EXISTING = 'URL already exists.';
14403
+ var VALIDATIONS_SERVICE_VALID_URL = 'Not a valid URL.';
14404
+ var VALIDATIONS_REQUEST_FAILED = 'Download failed. Check the URL.';
14405
+ var validateServiceName = function validateServiceName(value, services) {
14406
+ var ownServiceName = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : '';
14407
+ var serviceName = value === null || value === void 0 ? void 0 : value.toLowerCase();
14408
+ var foundName = Object.keys(services).find(function (serviceId) {
14409
+ var _a;
14410
+
14411
+ return ((_a = services[serviceId]) === null || _a === void 0 ? void 0 : _a.serviceName.toLowerCase()) === serviceName && serviceName !== ownServiceName.toLocaleLowerCase();
14412
+ });
14413
+ return foundName === undefined ? true : VALIDATIONS_NAME_EXISTING;
14414
+ };
14415
+
14416
+ var isValidUrl = function isValidUrl(url) {
14417
+ if (url === '' || url === null || typeof url === 'undefined') {
14418
+ return false;
14419
+ }
14420
+
14421
+ var matcher = /^(?:\w+:)?\/\/([^\s.]+\.\S{2}|[0-9a-zA-Z]+[:?\d]*)\S*$/;
14422
+
14423
+ if (!matcher.test(url)) {
14424
+ return false;
14425
+ }
14426
+
14427
+ return true;
14428
+ };
14429
+
14430
+ var validateServiceUrl = function validateServiceUrl(value, services) {
14431
+ var serviceUrl = value; // validate valid url
14432
+
14433
+ var isServiceUrlValid = isValidUrl(serviceUrl);
14434
+
14435
+ if (!isServiceUrlValid) {
14436
+ return VALIDATIONS_SERVICE_VALID_URL;
14437
+ } // check url existing
14438
+
14439
+
14440
+ var foundUrl = Object.keys(services).find(function (serviceId) {
14441
+ var _a;
14442
+
14443
+ return ((_a = services[serviceId]) === null || _a === void 0 ? void 0 : _a.serviceUrl) === serviceUrl;
14444
+ });
14445
+
14446
+ if (foundUrl) {
14447
+ return VALIDATIONS_SERVICE_EXISTING;
14448
+ }
14449
+
14450
+ return true;
14451
+ };
14452
+ var loadWMSService = function loadWMSService(serviceUrl) {
14453
+ var forceReload = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
14454
+ return __awaiter(void 0, void 0, void 0, /*#__PURE__*/regeneratorRuntime.mark(function _callee() {
14455
+ var layers, service;
14456
+ return regeneratorRuntime.wrap(function _callee$(_context) {
14457
+ while (1) {
14458
+ switch (_context.prev = _context.next) {
14459
+ case 0:
14460
+ _context.next = 2;
14461
+ return getLayersFlattenedFromService(serviceUrl, forceReload);
14462
+
14463
+ case 2:
14464
+ layers = _context.sent;
14465
+ service = WMGetServiceFromStore(serviceUrl);
14466
+ return _context.abrupt("return", {
14467
+ id: service.id,
14468
+ name: service.title,
14469
+ serviceUrl: serviceUrl,
14470
+ "abstract": service["abstract"],
14471
+ layers: layers,
14472
+ scope: 'user'
14473
+ });
14474
+
14475
+ case 5:
14476
+ case "end":
14477
+ return _context.stop();
14478
+ }
14479
+ }
14480
+ }, _callee);
14596
14481
  }));
14597
14482
  };
14598
14483
 
@@ -14615,8 +14500,7 @@ var getServiceFailedUpdateMessage = function getServiceFailedUpdateMessage(error
14615
14500
  };
14616
14501
 
14617
14502
  var ServiceOptionsDialogConnect = function ServiceOptionsDialogConnect(_ref) {
14618
- var mapId = _ref.mapId,
14619
- setServicePopupInfo = _ref.setServicePopupInfo;
14503
+ var mapId = _ref.mapId;
14620
14504
 
14621
14505
  var _React$useState = React.useState(false),
14622
14506
  _React$useState2 = _slicedToArray(_React$useState, 2),
@@ -14629,6 +14513,9 @@ var ServiceOptionsDialogConnect = function ServiceOptionsDialogConnect(_ref) {
14629
14513
  isUpdating: true
14630
14514
  })));
14631
14515
  }, [dispatch]);
14516
+ var setServicePopupInfo = React.useCallback(function (payload) {
14517
+ dispatch(layerSelectActions.toggleServicePopup(Object.assign({}, payload)));
14518
+ }, [dispatch]);
14632
14519
  var showSnackbar = React.useCallback(function (message) {
14633
14520
  dispatch(snackbarActions.openSnackbar({
14634
14521
  message: message
@@ -14708,34 +14595,30 @@ var ServiceOptionsDialogConnect = function ServiceOptionsDialogConnect(_ref) {
14708
14595
  });
14709
14596
  };
14710
14597
 
14598
+ /* *
14599
+ * Licensed under the Apache License, Version 2.0 (the "License");
14600
+ * you may not use this file except in compliance with the License.
14601
+ * You may obtain a copy of the License at
14602
+ *
14603
+ * http://www.apache.org/licenses/LICENSE-2.0
14604
+ *
14605
+ * Unless required by applicable law or agreed to in writing, software
14606
+ * distributed under the License is distributed on an "AS IS" BASIS,
14607
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14608
+ * See the License for the specific language governing permissions and
14609
+ * limitations under the License.
14610
+ *
14611
+ * Copyright 2021 - Koninklijk Nederlands Meteorologisch Instituut (KNMI)
14612
+ * Copyright 2021 - Finnish Meteorological Institute (FMI)
14613
+ * */
14614
+
14711
14615
  var ServiceOptionsButton = function ServiceOptionsButton(_ref) {
14712
14616
  var mapId = _ref.mapId;
14713
-
14714
- var _React$useState = React.useState({
14715
- isOpen: false
14716
- }),
14717
- _React$useState2 = _slicedToArray(_React$useState, 2),
14718
- servicePopupInfo = _React$useState2[0],
14719
- setServicePopupInfo = _React$useState2[1];
14720
-
14721
- var closePopup = function closePopup() {
14722
- setServicePopupInfo({
14723
- isOpen: false
14724
- });
14725
- };
14726
-
14727
- return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(ToggleMenu, {
14617
+ return /*#__PURE__*/React.createElement(ToggleMenu, {
14728
14618
  buttonTestId: "serviceOptionsButton",
14729
14619
  menuPosition: "bottom"
14730
14620
  }, /*#__PURE__*/React.createElement(ServiceOptionsDialogConnect, {
14731
- setServicePopupInfo: setServicePopupInfo,
14732
14621
  mapId: mapId
14733
- })), /*#__PURE__*/React.createElement(ServicePopupConnect, {
14734
- servicePopupVariant: servicePopupInfo.popupVariant,
14735
- isOpen: servicePopupInfo.isOpen,
14736
- closePopup: closePopup,
14737
- serviceId: servicePopupInfo.serviceId,
14738
- url: servicePopupInfo.serviceUrl
14739
14622
  }));
14740
14623
  };
14741
14624
 
@@ -14978,23 +14861,215 @@ var FilterListItem = function FilterListItem(_ref) {
14978
14861
  * Copyright 2021 - Finnish Meteorological Institute (FMI)
14979
14862
  * */
14980
14863
 
14981
- var KeywordFilterResultsListItemConnect = function KeywordFilterResultsListItemConnect(_ref) {
14982
- var filter = _ref.filter;
14983
- var dispatch = useDispatch();
14984
- var toggleFilter = React.useCallback(function (filterIds) {
14985
- dispatch(layerSelectActions.toggleFilter({
14986
- filterIds: filterIds
14987
- }));
14988
- }, [dispatch]);
14989
- var enableOnlyOneFilter = React.useCallback(function (filterId) {
14990
- dispatch(layerSelectActions.enableOnlyOneFilter({
14991
- filterId: filterId
14992
- }));
14993
- }, [dispatch]);
14994
- return /*#__PURE__*/React.createElement(FilterListItem, {
14995
- filter: filter,
14996
- toggleFilter: toggleFilter,
14997
- enableOnlyOneFilter: enableOnlyOneFilter
14864
+ var KeywordFilterResultsListItemConnect = function KeywordFilterResultsListItemConnect(_ref) {
14865
+ var filter = _ref.filter;
14866
+ var dispatch = useDispatch();
14867
+ var toggleFilter = React.useCallback(function (filterIds) {
14868
+ dispatch(layerSelectActions.toggleFilter({
14869
+ filterIds: filterIds
14870
+ }));
14871
+ }, [dispatch]);
14872
+ var enableOnlyOneFilter = React.useCallback(function (filterId) {
14873
+ dispatch(layerSelectActions.enableOnlyOneFilter({
14874
+ filterId: filterId
14875
+ }));
14876
+ }, [dispatch]);
14877
+ return /*#__PURE__*/React.createElement(FilterListItem, {
14878
+ filter: filter,
14879
+ toggleFilter: toggleFilter,
14880
+ enableOnlyOneFilter: enableOnlyOneFilter
14881
+ });
14882
+ };
14883
+
14884
+ /* *
14885
+ * Licensed under the Apache License, Version 2.0 (the "License");
14886
+ * you may not use this file except in compliance with the License.
14887
+ * You may obtain a copy of the License at
14888
+ *
14889
+ * http://www.apache.org/licenses/LICENSE-2.0
14890
+ *
14891
+ * Unless required by applicable law or agreed to in writing, software
14892
+ * distributed under the License is distributed on an "AS IS" BASIS,
14893
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14894
+ * See the License for the specific language governing permissions and
14895
+ * limitations under the License.
14896
+ *
14897
+ * Copyright 2021 - Koninklijk Nederlands Meteorologisch Instituut (KNMI)
14898
+ * Copyright 2021 - Finnish Meteorological Institute (FMI)
14899
+ * */
14900
+
14901
+ var KeywordFilterSelectAllSwitchConnect = function KeywordFilterSelectAllSwitchConnect() {
14902
+ var dispatch = useDispatch();
14903
+ var allFiltersActive = useSelector(function (store) {
14904
+ return isAllFiltersChecked(store);
14905
+ });
14906
+ var allFilterIds = useSelector(function (store) {
14907
+ return getAllFilterIds(store);
14908
+ });
14909
+ var checkedFilterIds = useSelector(function (store) {
14910
+ return getCheckedFilterIds(store);
14911
+ });
14912
+ var toggleFilters = React.useCallback(function () {
14913
+ var filterIds = allFiltersActive ? checkedFilterIds : allFilterIds.filter(function (id) {
14914
+ return !checkedFilterIds.includes(id);
14915
+ });
14916
+ dispatch(layerSelectActions.toggleFilter({
14917
+ filterIds: filterIds
14918
+ }));
14919
+ }, [allFilterIds, allFiltersActive, checkedFilterIds, dispatch]);
14920
+ return /*#__PURE__*/React.createElement(Switch, {
14921
+ checked: allFiltersActive,
14922
+ onChange: toggleFilters,
14923
+ "data-testid": "customSwitch"
14924
+ });
14925
+ };
14926
+
14927
+ var DIALOG_TITLE = 'Groups & Keywords';
14928
+ var listStyle = {
14929
+ padding: '0px'
14930
+ };
14931
+ var accordionDetailsStyle = {
14932
+ padding: '0px',
14933
+ margin: '0px'
14934
+ };
14935
+
14936
+ var KeywordFilterResults = function KeywordFilterResults(_ref) {
14937
+ var filters = _ref.filters,
14938
+ bounds = _ref.bounds,
14939
+ _ref$onClose = _ref.onClose,
14940
+ onClose = _ref$onClose === void 0 ? function () {} : _ref$onClose,
14941
+ isOpen = _ref.isOpen,
14942
+ _ref$onMouseDown = _ref.onMouseDown,
14943
+ onMouseDown = _ref$onMouseDown === void 0 ? function () {} : _ref$onMouseDown,
14944
+ _ref$order = _ref.order,
14945
+ order = _ref$order === void 0 ? 0 : _ref$order,
14946
+ _ref$source = _ref.source,
14947
+ source = _ref$source === void 0 ? 'module' : _ref$source;
14948
+
14949
+ var _a, _b;
14950
+
14951
+ var filtersGroupedByType = groupBy(filters, function (filter) {
14952
+ return filter.type;
14953
+ });
14954
+ var groups = (_a = filtersGroupedByType[FilterType.Group]) !== null && _a !== void 0 ? _a : [];
14955
+
14956
+ var groupsSorted = _toConsumableArray(groups).sort(function (a, b) {
14957
+ return a.name.localeCompare(b.name);
14958
+ });
14959
+
14960
+ var keywords = (_b = filtersGroupedByType[FilterType.Keyword]) !== null && _b !== void 0 ? _b : [];
14961
+
14962
+ var keywordsSorted = _toConsumableArray(keywords).sort(function (a, b) {
14963
+ return a.name.localeCompare(b.name);
14964
+ });
14965
+
14966
+ return /*#__PURE__*/React.createElement(ToolContainerDraggable, {
14967
+ title: DIALOG_TITLE,
14968
+ "data-testid": "keywordFilterResults",
14969
+ startSize: {
14970
+ width: 349,
14971
+ height: 600
14972
+ },
14973
+ minWidth: 312,
14974
+ minHeight: 192,
14975
+ isOpen: isOpen,
14976
+ onClose: onClose,
14977
+ headerSize: "small",
14978
+ bounds: bounds,
14979
+ onMouseDown: onMouseDown,
14980
+ order: order,
14981
+ source: source
14982
+ }, /*#__PURE__*/React.createElement(Grid, {
14983
+ container: true,
14984
+ item: true,
14985
+ xs: 12,
14986
+ justifyContent: "space-between",
14987
+ alignItems: "center",
14988
+ sx: {
14989
+ backgroundColor: 'background.paper',
14990
+ position: 'sticky',
14991
+ top: 0,
14992
+ zIndex: 100
14993
+ }
14994
+ }, /*#__PURE__*/React.createElement(Grid, {
14995
+ container: true,
14996
+ item: true,
14997
+ xs: 6,
14998
+ justifyContent: "flex-start",
14999
+ alignItems: "center",
15000
+ sx: {
15001
+ padding: '15px 15px 0 24px'
15002
+ }
15003
+ }, "Select all"), /*#__PURE__*/React.createElement(Grid, {
15004
+ container: true,
15005
+ item: true,
15006
+ xs: 6,
15007
+ justifyContent: "flex-end",
15008
+ alignContent: "center",
15009
+ sx: {
15010
+ padding: '15px 15px 0 15px'
15011
+ }
15012
+ }, /*#__PURE__*/React.createElement(KeywordFilterSelectAllSwitchConnect, null))), /*#__PURE__*/React.createElement(CustomAccordion, {
15013
+ title: "Groups",
15014
+ detailsSx: accordionDetailsStyle
15015
+ }, /*#__PURE__*/React.createElement(List, {
15016
+ dense: true,
15017
+ style: listStyle
15018
+ }, groupsSorted.map(function (group) {
15019
+ return /*#__PURE__*/React.createElement(KeywordFilterResultsListItemConnect, {
15020
+ key: group.id,
15021
+ filter: group
15022
+ });
15023
+ }))), /*#__PURE__*/React.createElement(CustomAccordion, {
15024
+ title: "Keywords",
15025
+ detailsSx: accordionDetailsStyle
15026
+ }, /*#__PURE__*/React.createElement(List, {
15027
+ dense: true,
15028
+ style: listStyle
15029
+ }, keywordsSorted.map(function (keyword) {
15030
+ return /*#__PURE__*/React.createElement(KeywordFilterResultsListItemConnect, {
15031
+ key: keyword.id,
15032
+ filter: keyword
15033
+ });
15034
+ }))));
15035
+ };
15036
+
15037
+ /* *
15038
+ * Licensed under the Apache License, Version 2.0 (the "License");
15039
+ * you may not use this file except in compliance with the License.
15040
+ * You may obtain a copy of the License at
15041
+ *
15042
+ * http://www.apache.org/licenses/LICENSE-2.0
15043
+ *
15044
+ * Unless required by applicable law or agreed to in writing, software
15045
+ * distributed under the License is distributed on an "AS IS" BASIS,
15046
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15047
+ * See the License for the specific language governing permissions and
15048
+ * limitations under the License.
15049
+ *
15050
+ * Copyright 2021 - Koninklijk Nederlands Meteorologisch Instituut (KNMI)
15051
+ * Copyright 2021 - Finnish Meteorological Institute (FMI)
15052
+ * */
15053
+
15054
+ var KeywordFilterResultsConnect = function KeywordFilterResultsConnect(_ref) {
15055
+ var bounds = _ref.bounds;
15056
+
15057
+ var _useSetupDialog = useSetupDialog(DialogTypes.KeywordFilter),
15058
+ dialogOrder = _useSetupDialog.dialogOrder,
15059
+ onCloseDialog = _useSetupDialog.onCloseDialog,
15060
+ setDialogOrder = _useSetupDialog.setDialogOrder,
15061
+ isDialogOpen = _useSetupDialog.isDialogOpen,
15062
+ uiSource = _useSetupDialog.uiSource;
15063
+
15064
+ var filters = useSelector(getAllFilters);
15065
+ return /*#__PURE__*/React.createElement(KeywordFilterResults, {
15066
+ bounds: bounds,
15067
+ isOpen: isDialogOpen,
15068
+ onClose: onCloseDialog,
15069
+ onMouseDown: setDialogOrder,
15070
+ order: dialogOrder,
15071
+ source: uiSource,
15072
+ filters: filters
14998
15073
  });
14999
15074
  };
15000
15075
 
@@ -15011,144 +15086,427 @@ var KeywordFilterResultsListItemConnect = function KeywordFilterResultsListItemC
15011
15086
  * See the License for the specific language governing permissions and
15012
15087
  * limitations under the License.
15013
15088
  *
15014
- * Copyright 2021 - Koninklijk Nederlands Meteorologisch Instituut (KNMI)
15015
- * Copyright 2021 - Finnish Meteorological Institute (FMI)
15089
+ * Copyright 2022 - Koninklijk Nederlands Meteorologisch Instituut (KNMI)
15090
+ * Copyright 2022 - Finnish Meteorological Institute (FMI)
15016
15091
  * */
15017
15092
 
15018
- var KeywordFilterSelectAllSwitchConnect = function KeywordFilterSelectAllSwitchConnect() {
15019
- var dispatch = useDispatch();
15020
- var allFiltersActive = useSelector(function (store) {
15021
- return isAllFiltersChecked(store);
15022
- });
15023
- var allFilterIds = useSelector(function (store) {
15024
- return getAllFilterIds(store);
15025
- });
15026
- var checkedFilterIds = useSelector(function (store) {
15027
- return getCheckedFilterIds(store);
15093
+ var LayerInfoDialogConnect = function LayerInfoDialogConnect() {
15094
+ var layer = useSelector(function (store) {
15095
+ return getActiveLayerInfo(store);
15028
15096
  });
15029
- var toggleFilters = React.useCallback(function () {
15030
- var filterIds = allFiltersActive ? checkedFilterIds : allFilterIds.filter(function (id) {
15031
- return !checkedFilterIds.includes(id);
15032
- });
15033
- dispatch(layerSelectActions.toggleFilter({
15034
- filterIds: filterIds
15035
- }));
15036
- }, [allFilterIds, allFiltersActive, checkedFilterIds, dispatch]);
15037
- return /*#__PURE__*/React.createElement(Switch, {
15038
- checked: allFiltersActive,
15039
- onChange: toggleFilters,
15040
- "data-testid": "customSwitch"
15097
+
15098
+ var _useSetupDialog = useSetupDialog(DialogTypes.LayerInfo),
15099
+ dialogOrder = _useSetupDialog.dialogOrder,
15100
+ onCloseDialog = _useSetupDialog.onCloseDialog,
15101
+ setDialogOrder = _useSetupDialog.setDialogOrder,
15102
+ uiSource = _useSetupDialog.uiSource,
15103
+ isDialogOpen = _useSetupDialog.isDialogOpen;
15104
+
15105
+ if (!layer) return null;
15106
+ return /*#__PURE__*/React__default.createElement(LayerInfoDialog, {
15107
+ isOpen: isDialogOpen,
15108
+ onClose: onCloseDialog,
15109
+ onMouseDown: setDialogOrder,
15110
+ order: dialogOrder,
15111
+ source: uiSource,
15112
+ layer: layer
15041
15113
  });
15042
15114
  };
15043
15115
 
15044
- var DIALOG_TITLE = 'Groups & Keywords';
15045
- var listStyle = {
15046
- padding: '0px'
15047
- };
15048
- var accordionDetailsStyle = {
15049
- padding: '0px',
15050
- margin: '0px'
15051
- };
15116
+ var style = {
15117
+ textField: {
15118
+ width: '100%',
15119
+ marginBottom: 2
15120
+ }
15121
+ };
15122
+ var ADD_HEADING = 'Add a new service';
15123
+ var EDIT_HEADING = 'Edit service';
15124
+ var SAVE_HEADING = 'Save service';
15125
+ var COPY_URL_MESSAGE = 'Service URL copied to clipboard';
15126
+ var getSuccesMessage = function getSuccesMessage(serviceName) {
15127
+ return "Service \"".concat(serviceName, "\" has been saved succesfully");
15128
+ };
15129
+
15130
+ var getTitleForVariant = function getTitleForVariant(variant) {
15131
+ switch (variant) {
15132
+ case 'add':
15133
+ return ADD_HEADING;
15134
+
15135
+ case 'edit':
15136
+ return EDIT_HEADING;
15137
+
15138
+ case 'save':
15139
+ return SAVE_HEADING;
15140
+
15141
+ default:
15142
+ return 'Service';
15143
+ }
15144
+ };
15145
+
15146
+ var fields = {
15147
+ serviceUrl: {
15148
+ name: 'serviceUrl',
15149
+ label: 'This service refers to this URL'
15150
+ },
15151
+ serviceName: {
15152
+ name: 'serviceName',
15153
+ label: 'Service name'
15154
+ },
15155
+ serviceAbstracts: {
15156
+ name: 'serviceAbstracts',
15157
+ label: 'Abstracts'
15158
+ }
15159
+ };
15160
+
15161
+ var InitialValidationsTrigger = function InitialValidationsTrigger(_ref) {
15162
+ var trigger = _ref.trigger,
15163
+ getValues = _ref.getValues,
15164
+ onValidField = _ref.onValidField;
15165
+ React.useEffect(function () {
15166
+ var value = getValues(fields.serviceUrl.name);
15167
+
15168
+ if (value) {
15169
+ trigger(fields.serviceUrl.name).then(function (isValid) {
15170
+ return isValid && onValidField(value);
15171
+ });
15172
+ } // eslint-disable-next-line react-hooks/exhaustive-deps
15173
+
15174
+ }, []);
15175
+ return null;
15176
+ };
15177
+
15178
+ var ServicePopup = function ServicePopup(_ref2) {
15179
+ var servicePopupVariant = _ref2.servicePopupVariant,
15180
+ _ref2$hideBackdrop = _ref2.hideBackdrop,
15181
+ hideBackdrop = _ref2$hideBackdrop === void 0 ? false : _ref2$hideBackdrop,
15182
+ isOpen = _ref2.isOpen,
15183
+ closePopup = _ref2.closePopup,
15184
+ shouldDisableAutoFocus = _ref2.shouldDisableAutoFocus,
15185
+ services = _ref2.services,
15186
+ serviceSetLayers = _ref2.serviceSetLayers,
15187
+ serviceUrl = _ref2.serviceUrl,
15188
+ serviceName = _ref2.serviceName,
15189
+ _ref2$showSnackbar = _ref2.showSnackbar,
15190
+ showSnackbar = _ref2$showSnackbar === void 0 ? function () {} : _ref2$showSnackbar;
15191
+
15192
+ var _useFormContext = useFormContext(),
15193
+ errors = _useFormContext.formState.errors,
15194
+ handleSubmit = _useFormContext.handleSubmit,
15195
+ setError = _useFormContext.setError,
15196
+ clearErrors = _useFormContext.clearErrors,
15197
+ watch = _useFormContext.watch,
15198
+ trigger = _useFormContext.trigger,
15199
+ getValues = _useFormContext.getValues,
15200
+ setValue = _useFormContext.setValue;
15201
+
15202
+ var _React$useState = React.useState(false),
15203
+ _React$useState2 = _slicedToArray(_React$useState, 2),
15204
+ isLoading = _React$useState2[0],
15205
+ setIsLoading = _React$useState2[1];
15206
+
15207
+ var fetchServiceData = function fetchServiceData(newServiceUrl) {
15208
+ return __awaiter(void 0, void 0, void 0, /*#__PURE__*/regeneratorRuntime.mark(function _callee() {
15209
+ var service;
15210
+ return regeneratorRuntime.wrap(function _callee$(_context) {
15211
+ while (1) {
15212
+ switch (_context.prev = _context.next) {
15213
+ case 0:
15214
+ _context.prev = 0;
15215
+ setIsLoading(true);
15216
+ _context.next = 4;
15217
+ return getLayersFromService(newServiceUrl);
15218
+
15219
+ case 4:
15220
+ service = WMGetServiceFromStore(newServiceUrl);
15221
+ setValue(fields.serviceName.name, service.title);
15222
+ setValue(fields.serviceAbstracts.name, service["abstract"]);
15223
+ setIsLoading(false);
15224
+ _context.next = 14;
15225
+ break;
15226
+
15227
+ case 10:
15228
+ _context.prev = 10;
15229
+ _context.t0 = _context["catch"](0);
15230
+ setIsLoading(false);
15231
+ setError(fields.serviceUrl.name, {
15232
+ message: VALIDATIONS_REQUEST_FAILED,
15233
+ type: 'SYSTEM'
15234
+ });
15235
+
15236
+ case 14:
15237
+ case "end":
15238
+ return _context.stop();
15239
+ }
15240
+ }
15241
+ }, _callee, null, [[0, 10]]);
15242
+ }));
15243
+ };
15244
+
15245
+ var addNewService = function addNewService(formValues) {
15246
+ return __awaiter(void 0, void 0, void 0, /*#__PURE__*/regeneratorRuntime.mark(function _callee2() {
15247
+ var layersForService;
15248
+ return regeneratorRuntime.wrap(function _callee2$(_context2) {
15249
+ while (1) {
15250
+ switch (_context2.prev = _context2.next) {
15251
+ case 0:
15252
+ clearErrors(fields.serviceUrl.name);
15253
+ setIsLoading(true);
15254
+ _context2.prev = 2;
15255
+ _context2.next = 5;
15256
+ return loadWMSService(formValues.serviceUrl, true);
15257
+
15258
+ case 5:
15259
+ layersForService = _context2.sent;
15260
+ serviceSetLayers({
15261
+ id: layersForService.id,
15262
+ name: formValues.serviceName,
15263
+ serviceUrl: formValues.serviceUrl,
15264
+ "abstract": formValues.serviceAbstracts,
15265
+ layers: layersForService.layers,
15266
+ scope: 'user'
15267
+ });
15268
+ setIsLoading(false);
15269
+ showSnackbar(getSuccesMessage(formValues.serviceName));
15270
+ closePopup();
15271
+ _context2.next = 16;
15272
+ break;
15273
+
15274
+ case 12:
15275
+ _context2.prev = 12;
15276
+ _context2.t0 = _context2["catch"](2);
15277
+ setIsLoading(false);
15278
+ setError(fields.serviceUrl.name, {
15279
+ message: VALIDATIONS_REQUEST_FAILED,
15280
+ type: 'SYSTEM'
15281
+ });
15282
+
15283
+ case 16:
15284
+ case "end":
15285
+ return _context2.stop();
15286
+ }
15287
+ }
15288
+ }, _callee2, null, [[2, 12]]);
15289
+ }));
15290
+ };
15291
+
15292
+ var onValidateServiceUrl = function onValidateServiceUrl(value) {
15293
+ return validateServiceUrl(value, services);
15294
+ };
15052
15295
 
15053
- var KeywordFilterResults = function KeywordFilterResults(_ref) {
15054
- var filters = _ref.filters,
15055
- bounds = _ref.bounds,
15056
- _ref$onClose = _ref.onClose,
15057
- onClose = _ref$onClose === void 0 ? function () {} : _ref$onClose,
15058
- isOpen = _ref.isOpen,
15059
- _ref$onMouseDown = _ref.onMouseDown,
15060
- onMouseDown = _ref$onMouseDown === void 0 ? function () {} : _ref$onMouseDown,
15061
- _ref$order = _ref.order,
15062
- order = _ref$order === void 0 ? 0 : _ref$order,
15063
- _ref$source = _ref.source,
15064
- source = _ref$source === void 0 ? 'module' : _ref$source;
15296
+ var onFocusServiceUrl = function onFocusServiceUrl() {
15297
+ var hasValue = getValues(fields.serviceUrl.name);
15065
15298
 
15066
- var _a, _b;
15299
+ if (!errors[fields.serviceUrl.name] && hasValue) {
15300
+ trigger(fields.serviceUrl.name);
15301
+ }
15302
+ };
15067
15303
 
15068
- var filtersGroupedByType = groupBy(filters, function (filter) {
15069
- return filter.type;
15070
- });
15071
- var groups = (_a = filtersGroupedByType[FilterType.Group]) !== null && _a !== void 0 ? _a : [];
15304
+ var onBlurServiceUrl = function onBlurServiceUrl() {
15305
+ if (!errors[fields.serviceUrl.name]) {
15306
+ fetchServiceData(getValues(fields.serviceUrl.name));
15307
+ }
15308
+ };
15072
15309
 
15073
- var groupsSorted = _toConsumableArray(groups).sort(function (a, b) {
15074
- return a.name.localeCompare(b.name);
15075
- });
15310
+ var onKeyDownServiceUrl = function onKeyDownServiceUrl(event) {
15311
+ if (event.key === 'Enter') {
15312
+ onBlurServiceUrl();
15313
+ }
15314
+ };
15076
15315
 
15077
- var keywords = (_b = filtersGroupedByType[FilterType.Keyword]) !== null && _b !== void 0 ? _b : [];
15316
+ var onValidateServiceName = function onValidateServiceName(value) {
15317
+ return validateServiceName(value, services, serviceName);
15318
+ };
15078
15319
 
15079
- var keywordsSorted = _toConsumableArray(keywords).sort(function (a, b) {
15080
- return a.name.localeCompare(b.name);
15081
- });
15320
+ var getFormAreRequiredFieldsEmpty = function getFormAreRequiredFieldsEmpty() {
15321
+ var serviceNameField = watch(fields.serviceName.name);
15322
+ var serviceUrlField = watch(fields.serviceUrl.name);
15323
+ return serviceNameField === '' || serviceNameField === undefined || serviceUrlField === '' || serviceUrlField === undefined;
15324
+ };
15082
15325
 
15083
- return /*#__PURE__*/React.createElement(ToolContainerDraggable, {
15084
- title: DIALOG_TITLE,
15085
- "data-testid": "keywordFilterResults",
15086
- startSize: {
15087
- width: 349,
15088
- height: 600
15326
+ var getFormHasformErrors = function getFormHasformErrors() {
15327
+ var totalErrors = Object.keys(errors).length;
15328
+
15329
+ if (totalErrors > 0) {
15330
+ // prevent SYSTEM error types from blocking the save button
15331
+ if (totalErrors === 1 && errors.serviceUrl) {
15332
+ return errors.serviceUrl.type !== undefined && errors.serviceUrl.type !== 'SYSTEM';
15333
+ }
15334
+
15335
+ return true;
15336
+ }
15337
+
15338
+ return false;
15339
+ };
15340
+
15341
+ var isSubmitDisabled = getFormHasformErrors() || getFormAreRequiredFieldsEmpty();
15342
+ var isShowPopup = servicePopupVariant === 'show';
15343
+ var isServiceUrlDisabled = isShowPopup || servicePopupVariant === 'edit';
15344
+ return /*#__PURE__*/React.createElement(Dialog, {
15345
+ open: isOpen,
15346
+ hideBackdrop: hideBackdrop,
15347
+ fullWidth: true,
15348
+ maxWidth: "xs",
15349
+ "data-testid": "servicePopup",
15350
+ sx: {
15351
+ '& .MuiDialog-paper': {
15352
+ backgroundColor: "geowebColors.cards.cardContainer",
15353
+ maxWidth: 458
15354
+ }
15355
+ }
15356
+ }, /*#__PURE__*/React.createElement("form", {
15357
+ onSubmit: handleSubmit(addNewService)
15358
+ }, /*#__PURE__*/React.createElement(DialogTitle, {
15359
+ sx: {
15360
+ alignItems: 'center',
15361
+ padding: '16px 16px 24px 16px'
15362
+ }
15363
+ }, /*#__PURE__*/React.createElement(Box, {
15364
+ sx: {
15365
+ display: 'flex',
15366
+ justifyContent: 'space-between',
15367
+ alignItems: 'center',
15368
+ ' span': {
15369
+ fontSize: '1rem',
15370
+ fontWeight: 500,
15371
+ fontStyle: 'normal',
15372
+ lineHeight: '1.38',
15373
+ letterSpacing: '0.12px'
15374
+ }
15375
+ }
15376
+ }, /*#__PURE__*/React.createElement(Typography, {
15377
+ variant: "h5",
15378
+ component: "span"
15379
+ }, getTitleForVariant(servicePopupVariant)), /*#__PURE__*/React.createElement(IconButton, {
15380
+ "aria-label": "close",
15381
+ size: "small",
15382
+ onClick: closePopup,
15383
+ "data-testid": "closePopupButtonCross",
15384
+ sx: {
15385
+ color: 'geowebColors.captions.captionDisabled.color',
15386
+ marginTop: 'auto',
15387
+ marginBottom: 'auto'
15388
+ }
15389
+ }, /*#__PURE__*/React.createElement(Close, null))), isLoading && /*#__PURE__*/React.createElement(Box, {
15390
+ sx: {
15391
+ position: 'relative'
15392
+ }
15393
+ }, /*#__PURE__*/React.createElement(LinearProgress, {
15394
+ "data-testid": "loadingIndicator",
15395
+ color: "secondary",
15396
+ sx: {
15397
+ position: 'absolute',
15398
+ width: '100%',
15399
+ top: 8
15400
+ }
15401
+ }))), /*#__PURE__*/React.createElement(DialogContent, {
15402
+ sx: {
15403
+ padding: '8px 16px'
15404
+ }
15405
+ }, /*#__PURE__*/React.createElement(ReactHookFormTextField, {
15406
+ name: fields.serviceUrl.name,
15407
+ label: fields.serviceUrl.label,
15408
+ onFocus: onFocusServiceUrl,
15409
+ autoFocus: !shouldDisableAutoFocus,
15410
+ onBlur: onBlurServiceUrl,
15411
+ onKeyDown: onKeyDownServiceUrl,
15412
+ sx: style.textField,
15413
+ rules: {
15414
+ required: true,
15415
+ validate: Object.assign({}, !isServiceUrlDisabled && {
15416
+ onValidateServiceUrl: onValidateServiceUrl
15417
+ })
15089
15418
  },
15090
- minWidth: 312,
15091
- minHeight: 192,
15092
- isOpen: isOpen,
15093
- onClose: onClose,
15094
- headerSize: "small",
15095
- bounds: bounds,
15096
- onMouseDown: onMouseDown,
15097
- order: order,
15098
- source: source
15099
- }, /*#__PURE__*/React.createElement(Grid, {
15100
- container: true,
15101
- item: true,
15102
- xs: 12,
15103
- justifyContent: "space-between",
15104
- alignItems: "center",
15419
+ disabled: isServiceUrlDisabled || isLoading,
15420
+ isReadOnly: isShowPopup,
15421
+ InputProps: {
15422
+ disableUnderline: isShowPopup,
15423
+ endAdornment: isShowPopup && /*#__PURE__*/React.createElement(InputAdornment, {
15424
+ position: "end"
15425
+ }, /*#__PURE__*/React.createElement(IconButton, {
15426
+ "aria-label": "copy url",
15427
+ onClick: function onClick() {
15428
+ navigator.clipboard.writeText(serviceUrl);
15429
+ showSnackbar(COPY_URL_MESSAGE);
15430
+ }
15431
+ }, /*#__PURE__*/React.createElement(Copy, null)))
15432
+ },
15433
+ defaultValue: serviceUrl
15434
+ }), /*#__PURE__*/React.createElement(ReactHookFormTextField, {
15435
+ name: fields.serviceName.name,
15436
+ label: fields.serviceName.label,
15437
+ rules: {
15438
+ required: true,
15439
+ validate: {
15440
+ onValidateServiceName: onValidateServiceName
15441
+ }
15442
+ },
15443
+ disabled: isShowPopup || isLoading,
15444
+ isReadOnly: isShowPopup,
15445
+ InputProps: {
15446
+ disableUnderline: isShowPopup
15447
+ },
15448
+ sx: style.textField,
15449
+ defaultValue: serviceName
15450
+ }), /*#__PURE__*/React.createElement(ReactHookFormTextField, {
15451
+ multiline: true,
15452
+ rows: 4,
15453
+ name: fields.serviceAbstracts.name,
15454
+ label: fields.serviceAbstracts.label,
15455
+ disabled: isShowPopup || isLoading,
15456
+ isReadOnly: isShowPopup,
15457
+ InputProps: {
15458
+ disableUnderline: isShowPopup
15459
+ },
15460
+ helperText: !isShowPopup ? 'Short description of what this service does' : '',
15461
+ sx: style.textField,
15462
+ defaultValue: ""
15463
+ }), !isServiceUrlDisabled && /*#__PURE__*/React.createElement(InitialValidationsTrigger, {
15464
+ trigger: trigger,
15465
+ getValues: getValues,
15466
+ onValidField: fetchServiceData
15467
+ })), /*#__PURE__*/React.createElement(DialogActions, {
15105
15468
  sx: {
15106
- backgroundColor: 'background.paper',
15107
- position: 'sticky',
15108
- top: 0,
15109
- zIndex: 100
15469
+ padding: 2
15110
15470
  }
15111
- }, /*#__PURE__*/React.createElement(Grid, {
15112
- container: true,
15113
- item: true,
15114
- xs: 6,
15115
- justifyContent: "flex-start",
15116
- alignItems: "center",
15471
+ }, isShowPopup ? /*#__PURE__*/React.createElement(Button, {
15472
+ onClick: function onClick() {
15473
+ return closePopup();
15474
+ },
15475
+ variant: "tertiary",
15117
15476
  sx: {
15118
- padding: '15px 15px 0 24px'
15477
+ width: '117px'
15119
15478
  }
15120
- }, "Select all"), /*#__PURE__*/React.createElement(Grid, {
15121
- container: true,
15122
- item: true,
15123
- xs: 6,
15124
- justifyContent: "flex-end",
15125
- alignContent: "center",
15479
+ }, "close") : /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(Button, {
15480
+ onClick: closePopup,
15481
+ "data-testid": "closePopupButtonCancel",
15482
+ variant: "tertiary",
15126
15483
  sx: {
15127
- padding: '15px 15px 0 15px'
15484
+ width: '117px'
15485
+ }
15486
+ }, "cancel"), /*#__PURE__*/React.createElement(Button, {
15487
+ type: "submit",
15488
+ variant: "primary",
15489
+ disabled: isSubmitDisabled || isLoading,
15490
+ "data-testid": "saveServiceButton",
15491
+ sx: {
15492
+ width: '117px',
15493
+ marginLeft: '16px!important'
15128
15494
  }
15129
- }, /*#__PURE__*/React.createElement(KeywordFilterSelectAllSwitchConnect, null))), /*#__PURE__*/React.createElement(CustomAccordion, {
15130
- title: "Groups",
15131
- detailsSx: accordionDetailsStyle
15132
- }, /*#__PURE__*/React.createElement(List, {
15133
- dense: true,
15134
- style: listStyle
15135
- }, groupsSorted.map(function (group) {
15136
- return /*#__PURE__*/React.createElement(KeywordFilterResultsListItemConnect, {
15137
- key: group.id,
15138
- filter: group
15139
- });
15140
- }))), /*#__PURE__*/React.createElement(CustomAccordion, {
15141
- title: "Keywords",
15142
- detailsSx: accordionDetailsStyle
15143
- }, /*#__PURE__*/React.createElement(List, {
15144
- dense: true,
15145
- style: listStyle
15146
- }, keywordsSorted.map(function (keyword) {
15147
- return /*#__PURE__*/React.createElement(KeywordFilterResultsListItemConnect, {
15148
- key: keyword.id,
15149
- filter: keyword
15150
- });
15151
- }))));
15495
+ }, "save")))));
15496
+ };
15497
+
15498
+ var ServicePopupWrapper = function ServicePopupWrapper(_a) {
15499
+ var props = __rest(_a, []);
15500
+
15501
+ return /*#__PURE__*/React.createElement(ReactHookFormProvider, {
15502
+ options: Object.assign(Object.assign({}, defaultFormOptions), {
15503
+ defaultValues: {
15504
+ serviceUrl: props.serviceUrl,
15505
+ serviceName: props.serviceName,
15506
+ serviceAbstracts: props.serviceAbstracts
15507
+ }
15508
+ })
15509
+ }, /*#__PURE__*/React.createElement(ServicePopup, Object.assign({}, props)));
15152
15510
  };
15153
15511
 
15154
15512
  /* *
@@ -15164,29 +15522,46 @@ var KeywordFilterResults = function KeywordFilterResults(_ref) {
15164
15522
  * See the License for the specific language governing permissions and
15165
15523
  * limitations under the License.
15166
15524
  *
15167
- * Copyright 2021 - Koninklijk Nederlands Meteorologisch Instituut (KNMI)
15168
- * Copyright 2021 - Finnish Meteorological Institute (FMI)
15525
+ * Copyright 2022 - Koninklijk Nederlands Meteorologisch Instituut (KNMI)
15526
+ * Copyright 2022 - Finnish Meteorological Institute (FMI)
15169
15527
  * */
15170
-
15171
- var KeywordFilterResultsConnect = function KeywordFilterResultsConnect(_ref) {
15172
- var bounds = _ref.bounds;
15173
-
15174
- var _useSetupDialog = useSetupDialog(DialogTypes.KeywordFilter),
15175
- dialogOrder = _useSetupDialog.dialogOrder,
15176
- onCloseDialog = _useSetupDialog.onCloseDialog,
15177
- setDialogOrder = _useSetupDialog.setDialogOrder,
15178
- isDialogOpen = _useSetupDialog.isDialogOpen,
15179
- uiSource = _useSetupDialog.uiSource;
15180
-
15181
- var filters = useSelector(getAllFilters);
15182
- return /*#__PURE__*/React.createElement(KeywordFilterResults, {
15183
- bounds: bounds,
15184
- isOpen: isDialogOpen,
15185
- onClose: onCloseDialog,
15186
- onMouseDown: setDialogOrder,
15187
- order: dialogOrder,
15188
- source: uiSource,
15189
- filters: filters
15528
+ // Result in many rerenders. By extracting we're able to only render this component and these selectors
15529
+ // when the dialog is open
15530
+
15531
+ var ServicePopupDialogConnect = function ServicePopupDialogConnect(_ref) {
15532
+ var isOpen = _ref.isOpen,
15533
+ _ref$serviceId = _ref.serviceId,
15534
+ serviceId = _ref$serviceId === void 0 ? '' : _ref$serviceId,
15535
+ variant = _ref.variant,
15536
+ _ref$url = _ref.url,
15537
+ url = _ref$url === void 0 ? '' : _ref$url,
15538
+ setServicePopupClosed = _ref.setServicePopupClosed;
15539
+ var dispatch = useDispatch();
15540
+ var services = useSelector(function (store) {
15541
+ return getActiveServices(store);
15542
+ });
15543
+ var activeService = useSelector(function (store) {
15544
+ return getActiveServiceById(store, serviceId);
15545
+ });
15546
+ var serviceSetLayers = React__default.useCallback(function (payload) {
15547
+ dispatch(serviceActions.serviceSetLayers(payload));
15548
+ }, [dispatch]);
15549
+ var showSnackbar = React__default.useCallback(function (message) {
15550
+ dispatch(snackbarActions.openSnackbar({
15551
+ message: message
15552
+ }));
15553
+ }, [dispatch]);
15554
+ return /*#__PURE__*/React__default.createElement(ServicePopupWrapper, {
15555
+ servicePopupVariant: variant,
15556
+ isOpen: isOpen,
15557
+ closePopup: setServicePopupClosed,
15558
+ services: services,
15559
+ serviceSetLayers: serviceSetLayers,
15560
+ serviceId: serviceId,
15561
+ serviceUrl: url || (activeService === null || activeService === void 0 ? void 0 : activeService.serviceUrl),
15562
+ serviceName: activeService === null || activeService === void 0 ? void 0 : activeService.serviceName,
15563
+ serviceAbstracts: activeService === null || activeService === void 0 ? void 0 : activeService["abstract"],
15564
+ showSnackbar: showSnackbar
15190
15565
  });
15191
15566
  };
15192
15567
 
@@ -15207,26 +15582,31 @@ var KeywordFilterResultsConnect = function KeywordFilterResultsConnect(_ref) {
15207
15582
  * Copyright 2022 - Finnish Meteorological Institute (FMI)
15208
15583
  * */
15209
15584
 
15210
- var LayerInfoDialogConnect = function LayerInfoDialogConnect() {
15211
- var layer = useSelector(function (store) {
15212
- return getActiveLayerInfo(store);
15213
- });
15585
+ var ServicePopupConnect = function ServicePopupConnect() {
15586
+ var dispatch = useDispatch();
15214
15587
 
15215
- var _useSetupDialog = useSetupDialog(DialogTypes.LayerInfo),
15216
- dialogOrder = _useSetupDialog.dialogOrder,
15217
- onCloseDialog = _useSetupDialog.onCloseDialog,
15218
- setDialogOrder = _useSetupDialog.setDialogOrder,
15219
- uiSource = _useSetupDialog.uiSource,
15220
- isDialogOpen = _useSetupDialog.isDialogOpen;
15588
+ var _useSelector = useSelector(function (store) {
15589
+ return getServicePopupDetails(store);
15590
+ }),
15591
+ isOpen = _useSelector.isOpen,
15592
+ url = _useSelector.url,
15593
+ serviceId = _useSelector.serviceId,
15594
+ variant = _useSelector.variant;
15221
15595
 
15222
- if (!layer) return null;
15223
- return /*#__PURE__*/React__default.createElement(LayerInfoDialog, {
15224
- isOpen: isDialogOpen,
15225
- onClose: onCloseDialog,
15226
- onMouseDown: setDialogOrder,
15227
- order: dialogOrder,
15228
- source: uiSource,
15229
- layer: layer
15596
+ var setServicePopupClosed = React__default.useCallback(function () {
15597
+ dispatch(layerSelectActions.closeServicePopupOpen());
15598
+ }, [dispatch]);
15599
+
15600
+ if (!isOpen) {
15601
+ return null;
15602
+ }
15603
+
15604
+ return /*#__PURE__*/React__default.createElement(ServicePopupDialogConnect, {
15605
+ isOpen: isOpen,
15606
+ serviceId: serviceId,
15607
+ variant: variant,
15608
+ url: url,
15609
+ setServicePopupClosed: setServicePopupClosed
15230
15610
  });
15231
15611
  };
15232
15612
 
@@ -15278,7 +15658,7 @@ var LayerSelectConnect = function LayerSelectConnect(_ref) {
15278
15658
  onMouseDown: setDialogOrder,
15279
15659
  order: dialogOrder,
15280
15660
  source: uiSource
15281
- }), /*#__PURE__*/React.createElement(KeywordFilterResultsConnect, null), /*#__PURE__*/React.createElement(LayerInfoDialogConnect, null));
15661
+ }), /*#__PURE__*/React.createElement(KeywordFilterResultsConnect, null), /*#__PURE__*/React.createElement(LayerInfoDialogConnect, null), /*#__PURE__*/React.createElement(ServicePopupConnect, null));
15282
15662
  };
15283
15663
 
15284
15664
  /* *
@@ -18746,7 +19126,7 @@ var AnimationLengthButtonConnect = function AnimationLengthButtonConnect(_ref) {
18746
19126
  return getAnimationStartTime(store, mapId);
18747
19127
  });
18748
19128
  var animationEndTime = useSelector(function (store) {
18749
- return getAnimationEndTime(store, mapId);
19129
+ return getAnimationEndTime$1(store, mapId);
18750
19130
  });
18751
19131
  var currentDiffInMinutes = moment(animationEndTime).diff(moment(animationStartTime), 'minutes');
18752
19132
  var currentLength = Object.values(AnimationLength).map(function (val) {
@@ -18939,7 +19319,7 @@ var connectRedux$2 = connect(function (store, props) {
18939
19319
  isTimeSliderHoverOn: isTimeSliderHoverOn(store, props.mapId),
18940
19320
  timeValue: getTime(getSynchronizationGroupStore(store), props.sourceId),
18941
19321
  animationStartTime: getAnimationStartTime(store, props.mapId),
18942
- animationEndTime: getAnimationEndTime(store, props.mapId),
19322
+ animationEndTime: getAnimationEndTime$1(store, props.mapId),
18943
19323
  activeWindowId: getActiveWindowId(store),
18944
19324
  unfilteredSelectedTime: getTimeSliderUnfilteredSelectedTime(store, props.mapId)
18945
19325
  };
@@ -19689,10 +20069,11 @@ var getCurrentDimensionValue = function getCurrentDimensionValue() {
19689
20069
  });
19690
20070
  return currentDimension === null || currentDimension === void 0 ? void 0 : currentDimension.currentValue;
19691
20071
  };
19692
- var setServiceMetadata = function setServiceMetadata(wmLayer, mapId, webMapJSInstance, mapProperties, onUpdateLayerInformation) {
20072
+ var setServiceMetadata = function setServiceMetadata(wmLayer, mapId, mapProperties, onUpdateLayerInformation) {
19693
20073
  var origin = LayerActionOrigin.ReactMapViewParseLayer;
19694
20074
  var service = WMGetServiceFromStore(wmLayer.service);
19695
20075
  var serviceName = mapProperties.services[service.id].name;
20076
+ var webMapJSInstance = getWMJSMapById(mapId);
19696
20077
  /* Update list of layers for service */
19697
20078
 
19698
20079
  var done = function done(layers) {
@@ -22236,6 +22617,22 @@ var AdagucMapDrawContainer = function AdagucMapDrawContainer(_ref) {
22236
22617
  }));
22237
22618
  };
22238
22619
 
22620
+ /* *
22621
+ * Licensed under the Apache License, Version 2.0 (the "License");
22622
+ * you may not use this file except in compliance with the License.
22623
+ * You may obtain a copy of the License at
22624
+ *
22625
+ * http://www.apache.org/licenses/LICENSE-2.0
22626
+ *
22627
+ * Unless required by applicable law or agreed to in writing, software
22628
+ * distributed under the License is distributed on an "AS IS" BASIS,
22629
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
22630
+ * See the License for the specific language governing permissions and
22631
+ * limitations under the License.
22632
+ *
22633
+ * Copyright 2022 - Koninklijk Nederlands Meteorologisch Instituut (KNMI)
22634
+ * Copyright 2022 - Finnish Meteorological Institute (FMI)
22635
+ * */
22239
22636
  /**
22240
22637
  * Returns filtered list of props with geoJson
22241
22638
  * @param children React.ReactNode, layers with geoJson
@@ -22258,7 +22655,7 @@ var getFeatureLayers = function getFeatureLayers(children) {
22258
22655
  */
22259
22656
 
22260
22657
  var isAMapLayer = function isAMapLayer(layer) {
22261
- return layer.layerType === LayerType.mapLayer;
22658
+ return layer.layerType === LayerType$1.mapLayer;
22262
22659
  };
22263
22660
  /**
22264
22661
  * Returns true if this is a geojsonlayer (layer containing geojson field)
@@ -22268,6 +22665,46 @@ var isAMapLayer = function isAMapLayer(layer) {
22268
22665
  var isAGeoJSONLayer = function isAGeoJSONLayer(layer) {
22269
22666
  return layer.geojson !== undefined;
22270
22667
  };
22668
+ var getWMJSLayerFromReactLayer = function getWMJSLayerFromReactLayer(mapId, wmLayers, reactWebMapJSLayer, wmLayerIndex) {
22669
+ var _reactWebMapJSLayer$p = reactWebMapJSLayer.props,
22670
+ reactLayerId = _reactWebMapJSLayer$p.id,
22671
+ layerName = _reactWebMapJSLayer$p.name;
22672
+ var wmjsMap = getWMJSMapById(mapId);
22673
+ /* Some safety checks */
22674
+
22675
+ if (!wmjsMap || !wmLayers || !reactLayerId || !layerName) return {
22676
+ layer: null,
22677
+ layerArrayMutated: false
22678
+ };
22679
+ /* Find the wmlayer by its react layer id */
22680
+
22681
+ var matchingLayerIndex = wmLayers.findIndex(function (wmLayer) {
22682
+ return wmLayer.id === reactLayerId;
22683
+ });
22684
+ if (matchingLayerIndex === -1) return {
22685
+ layer: null,
22686
+ layerArrayMutated: false
22687
+ };
22688
+ /*
22689
+ The layer order in the react children array index is
22690
+ reversed compared to the layer order in the wmLayer array index
22691
+ */
22692
+
22693
+ var reactLayerIndex = wmLayers.length - 1 - wmLayerIndex;
22694
+ var isMapLayer = isAMapLayer(reactWebMapJSLayer.props);
22695
+ var mapLayerArrayShouldBeMutated = isMapLayer && matchingLayerIndex !== reactLayerIndex;
22696
+ /* It seems that a layer was moved in the layerlist, move it in the wmjsMap too */
22697
+
22698
+ if (mapLayerArrayShouldBeMutated) {
22699
+ wmjsMap.swapLayers(wmLayers[matchingLayerIndex], wmLayers[reactLayerIndex]);
22700
+ wmjsMap.draw();
22701
+ }
22702
+
22703
+ return {
22704
+ layer: wmLayers[matchingLayerIndex],
22705
+ layerArrayMutated: mapLayerArrayShouldBeMutated
22706
+ };
22707
+ };
22271
22708
 
22272
22709
  var getDisplayText = function getDisplayText(currentAdagucTime) {
22273
22710
  var timeFormat = 'ddd DD MMM YYYY HH:mm [UTC]';
@@ -22291,20 +22728,21 @@ var ReactMapView = /*#__PURE__*/function (_React$Component) {
22291
22728
 
22292
22729
  _this = _super.call(this, props);
22293
22730
  _this.adaguc = {
22294
- webMapJSCreated: false,
22295
22731
  initialized: false,
22296
22732
  baseLayers: [],
22297
- webMapJS: undefined,
22298
- oldbbox: undefined
22733
+ oldbbox: undefined,
22734
+ currentWidth: -1,
22735
+ currentHeight: -1,
22736
+ currentMapProps: {
22737
+ children: []
22738
+ }
22299
22739
  };
22300
22740
  _this.mapTimer = undefined;
22301
22741
  _this.featureLayerUpdateTimer = undefined;
22302
- _this.currentWidth = undefined;
22303
- _this.currentHeight = undefined;
22304
22742
  _this.refetchTimer = null;
22305
22743
 
22306
22744
  _this.componentDidUpdate = function (prevProps) {
22307
- _this.checkNewProps(prevProps, _this.props);
22745
+ _this.updateWMJSMapProps(prevProps, _this.props);
22308
22746
  };
22309
22747
 
22310
22748
  _this.onStartRefetchTimer = function () {
@@ -22319,8 +22757,9 @@ var ReactMapView = /*#__PURE__*/function (_React$Component) {
22319
22757
  var fetchSpeed = 60000; // 1 minute
22320
22758
 
22321
22759
  _this.refetchTimer = setInterval(function () {
22322
- var layers = _this.adaguc.webMapJS.getLayers();
22323
-
22760
+ var mapId = _this.props.mapId;
22761
+ var wmjsMap = getWMJSMapById(mapId);
22762
+ var layers = wmjsMap.getLayers();
22324
22763
  layers.forEach(function (layer) {
22325
22764
  if (layer.enabled !== false) {
22326
22765
  _this.parseWMJSLayer(layer, true);
@@ -22340,15 +22779,16 @@ var ReactMapView = /*#__PURE__*/function (_React$Component) {
22340
22779
  var _this$props = _this.props,
22341
22780
  onUpdateLayerInformation = _this$props.onUpdateLayerInformation,
22342
22781
  mapId = _this$props.mapId;
22343
- setServiceMetadata(wmLayer, mapId, _this.adaguc.webMapJS, _this.props, onUpdateLayerInformation);
22782
+ setServiceMetadata(wmLayer, mapId, _this.props, onUpdateLayerInformation);
22783
+ var wmjsMap = getWMJSMapById(mapId);
22344
22784
 
22345
22785
  if (child) {
22346
22786
  if (wmLayer.hasError) {
22347
22787
  if (child.props.onLayerError) {
22348
- child.props.onLayerError(wmLayer, new Error(wmLayer.lastError), _this.adaguc.webMapJS);
22788
+ child.props.onLayerError(wmLayer, new Error(wmLayer.lastError), wmjsMap);
22349
22789
  }
22350
22790
  } else if (child.props.onLayerReady) {
22351
- child.props.onLayerReady(wmLayer, _this.adaguc.webMapJS);
22791
+ child.props.onLayerReady(wmLayer, wmjsMap);
22352
22792
  }
22353
22793
  }
22354
22794
  };
@@ -22362,12 +22802,11 @@ var ReactMapView = /*#__PURE__*/function (_React$Component) {
22362
22802
  _this.resize = _this.resize.bind(_assertThisInitialized(_this));
22363
22803
  _this.handleWindowResize = _this.handleWindowResize.bind(_assertThisInitialized(_this));
22364
22804
  _this.drawDebounced = debounce$1(600, _this.drawDebounced);
22365
- _this.checkNewProps = _this.checkNewProps.bind(_assertThisInitialized(_this));
22366
- _this.checkAdaguc = _this.checkAdaguc.bind(_assertThisInitialized(_this));
22805
+ _this.updateWMJSMapProps = _this.updateWMJSMapProps.bind(_assertThisInitialized(_this));
22806
+ _this.mountWMJSMap = _this.mountWMJSMap.bind(_assertThisInitialized(_this));
22367
22807
  _this.onAfterSetBBoxListener = _this.onAfterSetBBoxListener.bind(_assertThisInitialized(_this));
22368
22808
  _this.onUpdateBBoxListener = _this.onUpdateBBoxListener.bind(_assertThisInitialized(_this));
22369
22809
  _this.onDimChangeListener = _this.onDimChangeListener.bind(_assertThisInitialized(_this));
22370
- _this.currentMapProps = {};
22371
22810
  _this.adagucContainerRef = /*#__PURE__*/React.createRef();
22372
22811
  _this.adagucWebMapJSRef = /*#__PURE__*/React.createRef();
22373
22812
  return _this;
@@ -22377,36 +22816,38 @@ var ReactMapView = /*#__PURE__*/function (_React$Component) {
22377
22816
  key: "componentDidMount",
22378
22817
  value: function componentDidMount() {
22379
22818
  var _this$props2 = this.props,
22819
+ shouldAutoFetch = _this$props2.shouldAutoFetch,
22380
22820
  onWMJSMount = _this$props2.onWMJSMount,
22381
- mapId = _this$props2.mapId,
22382
- shouldAutoFetch = _this$props2.shouldAutoFetch;
22383
- this.checkAdaguc();
22384
- this.checkNewProps(null, this.props);
22385
- window.addEventListener('resize', this.handleWindowResize);
22821
+ mapId = _this$props2.mapId;
22822
+ /* If this components re-mounts, make sure that the initialized state is set back to false */
22386
22823
 
22387
- if (this.adaguc.initialized === false && this.adaguc.webMapJS) {
22388
- this.adaguc.initialized = true;
22389
- }
22390
-
22391
- onWMJSMount(mapId);
22824
+ this.setState({
22825
+ adagucInitialised: false
22826
+ });
22827
+ window.addEventListener('resize', this.handleWindowResize);
22828
+ this.mountWMJSMap();
22392
22829
 
22393
22830
  if (shouldAutoFetch) {
22394
22831
  this.onStartRefetchTimer();
22395
22832
  }
22833
+
22834
+ onWMJSMount(mapId);
22396
22835
  }
22397
22836
  }, {
22398
22837
  key: "componentWillUnmount",
22399
22838
  value: function componentWillUnmount() {
22839
+ var mapId = this.props.mapId;
22400
22840
  window.removeEventListener('resize', this.handleWindowResize);
22401
- this.adaguc.webMapJS.getListener().suspendEvents();
22402
-
22403
- if (typeof this.adaguc.webMapJS.stopAnimating === 'function') {
22404
- this.adaguc.webMapJS.stopAnimating();
22405
- this.adaguc.webMapJS.destroy();
22406
- this.adaguc.webMapJSCreated = false;
22407
- }
22408
-
22409
22841
  this.clearRefetchTimer();
22842
+ unRegisterWMJSMap(mapId);
22843
+ /* Reset adaguc properties */
22844
+
22845
+ this.adaguc.initialized = false;
22846
+ this.adaguc.currentHeight = -1;
22847
+ this.adaguc.currentWidth = -1;
22848
+ this.adaguc.baseLayers = [];
22849
+ this.adaguc.oldbbox = new WMBBOX();
22850
+ this.adaguc.currentMapProps.children = null;
22410
22851
  }
22411
22852
  }, {
22412
22853
  key: "onDimChangeListener",
@@ -22414,9 +22855,10 @@ var ReactMapView = /*#__PURE__*/function (_React$Component) {
22414
22855
  var _this$props3 = this.props,
22415
22856
  mapId = _this$props3.mapId,
22416
22857
  onMapChangeDimension = _this$props3.onMapChangeDimension;
22858
+ var wmjsMap = getWMJSMapById(mapId);
22417
22859
 
22418
- if (this.adaguc && this.adaguc.webMapJS) {
22419
- var timeDimension = this.adaguc.webMapJS.getDimension('time');
22860
+ if (wmjsMap) {
22861
+ var timeDimension = wmjsMap.getDimension('time');
22420
22862
 
22421
22863
  if (timeDimension) {
22422
22864
  onMapChangeDimension({
@@ -22432,16 +22874,17 @@ var ReactMapView = /*#__PURE__*/function (_React$Component) {
22432
22874
  }
22433
22875
  }, {
22434
22876
  key: "onAfterSetBBoxListener",
22435
- value: function onAfterSetBBoxListener(wmjsMap) {
22877
+ value: function onAfterSetBBoxListener() {
22436
22878
  var _this2 = this;
22437
22879
 
22438
- var _this$props4 = this.props,
22439
- mapId = _this$props4.mapId,
22440
- onMapZoomEnd = _this$props4.onMapZoomEnd;
22441
22880
  /* Update the map after 100 ms */
22442
-
22443
22881
  window.setTimeout(function () {
22444
- var MapViewBBOX = _this2.props.bbox;
22882
+ var _this2$props = _this2.props,
22883
+ MapViewBBOX = _this2$props.bbox,
22884
+ mapId = _this2$props.mapId,
22885
+ onMapZoomEnd = _this2$props.onMapZoomEnd;
22886
+ var wmjsMap = getWMJSMapById(mapId);
22887
+ if (!wmjsMap) return;
22445
22888
  var projectionInfo = wmjsMap.getProjection();
22446
22889
  /* Trigger onMapZoomEnd callback */
22447
22890
 
@@ -22475,55 +22918,32 @@ var ReactMapView = /*#__PURE__*/function (_React$Component) {
22475
22918
  }
22476
22919
  }
22477
22920
  }, {
22478
- key: "getWMJSLayerFromReactLayer",
22479
- value: function getWMJSLayerFromReactLayer(wmLayers, reactWebMapJSLayer, index) {
22480
- var foundLayer = null;
22481
-
22482
- if (reactWebMapJSLayer.props.name && reactWebMapJSLayer.props.id) {
22483
- if (index >= 0 && index < wmLayers.length) {
22484
- for (var layerIndex = 0; layerIndex < wmLayers.length; layerIndex += 1) {
22485
- var secondIndex = wmLayers.length - 1 - index;
22486
- var layer = wmLayers[layerIndex];
22487
-
22488
- if (layer === getWMLayerById(reactWebMapJSLayer.props.id)) {
22489
- foundLayer = layer;
22490
-
22491
- if (isAMapLayer(reactWebMapJSLayer.props) && layerIndex !== secondIndex) {
22492
- this.adaguc.webMapJS.swapLayers(wmLayers[layerIndex], wmLayers[secondIndex]);
22493
- this.adaguc.webMapJS.draw();
22494
- return {
22495
- layer: foundLayer,
22496
- layerArrayMutated: true
22497
- };
22498
- }
22499
- }
22500
- }
22501
- }
22502
- }
22503
-
22504
- return {
22505
- layer: foundLayer,
22506
- layerArrayMutated: false
22507
- };
22508
- }
22509
- }, {
22510
- key: "checkNewProps",
22511
- value: function checkNewProps(prevProps, props) {
22921
+ key: "updateWMJSMapProps",
22922
+ value: function updateWMJSMapProps(prevProps, props) {
22512
22923
  var _this3 = this;
22513
22924
 
22514
22925
  if (!props) {
22515
22926
  return;
22516
22927
  }
22517
22928
 
22929
+ var mapId = props.mapId,
22930
+ children = props.children;
22931
+ var wmjsMap = getWMJSMapById(mapId);
22932
+
22933
+ if (!wmjsMap) {
22934
+ console.warn('No wmjsMap');
22935
+ return;
22936
+ }
22937
+
22518
22938
  var needsRedraw = false;
22519
22939
  /* Check map props */
22520
22940
 
22521
22941
  if (!prevProps || prevProps.showLegend !== props.showLegend) {
22522
- this.adaguc.webMapJS.displayLegendInMap(props.showLegend !== false);
22942
+ wmjsMap.displayLegendInMap(props.showLegend !== false);
22523
22943
  }
22524
22944
 
22525
22945
  if (!prevProps || prevProps.showScaleBar !== props.showScaleBar) {
22526
- this.adaguc.webMapJS.displayScaleBarInMap(props.showScaleBar !== false);
22946
+ wmjsMap.displayScaleBarInMap(props.showScaleBar !== false);
22527
22947
  needsRedraw = true;
22528
22948
  }
22529
22949
  /* Check map dimensions */
@@ -22533,16 +22953,16 @@ var ReactMapView = /*#__PURE__*/function (_React$Component) {
22533
22953
  if (props.dimensions) {
22534
22954
  for (var d = 0; d < props.dimensions.length; d += 1) {
22535
22955
  var propDimension = props.dimensions[d];
22536
- var mapDim = this.adaguc.webMapJS.getDimension(propDimension.name);
22956
+ var mapDim = wmjsMap.getDimension(propDimension.name);
22537
22957
 
22538
22958
  if (mapDim && mapDim.currentValue !== propDimension.currentValue) {
22539
- this.adaguc.webMapJS.setDimension(propDimension.name, propDimension.currentValue, false, false);
22959
+ wmjsMap.setDimension(propDimension.name, propDimension.currentValue, false, false);
22540
22960
  }
22541
22961
 
22542
22962
  if (props.displayTimeInMap && propDimension.name === 'time' && propDimension.currentValue !== undefined) {
22543
22963
  needsRedraw = true;
22544
22964
  var displayText = getDisplayText(propDimension.currentValue);
22545
- this.adaguc.webMapJS.setTimeOffset(displayText);
22965
+ wmjsMap.setTimeOffset(displayText);
22546
22966
  }
22547
22967
  }
22548
22968
  }
@@ -22552,14 +22972,14 @@ var ReactMapView = /*#__PURE__*/function (_React$Component) {
22552
22972
 
22553
22973
  if (!prevProps || prevProps.bbox !== props.bbox) {
22554
22974
  if (props.bbox.left !== undefined) {
22555
- var projectionInfo = this.adaguc.webMapJS.getProjection();
22975
+ var projectionInfo = wmjsMap.getProjection();
22556
22976
  var mapBBOX = projectionInfo.bbox;
22557
22977
 
22558
22978
  if (props.bbox.left !== mapBBOX.left || props.bbox.right !== mapBBOX.right || props.bbox.bottom !== mapBBOX.bottom || props.bbox.top !== mapBBOX.top) {
22559
- this.adaguc.webMapJS.suspendEvent('onupdatebbox');
22560
- this.adaguc.webMapJS.setProjection(props.srs, new WMBBOX(props.bbox));
22561
- this.adaguc.webMapJS.resumeEvent('onupdatebbox');
22562
- this.adaguc.webMapJS.draw();
22979
+ wmjsMap.suspendEvent('onupdatebbox');
22980
+ wmjsMap.setProjection(props.srs, new WMBBOX(props.bbox));
22981
+ wmjsMap.resumeEvent('onupdatebbox');
22982
+ wmjsMap.draw();
22563
22983
  }
22564
22984
  }
22565
22985
  }
@@ -22568,9 +22988,9 @@ var ReactMapView = /*#__PURE__*/function (_React$Component) {
22568
22988
 
22569
22989
  if (!prevProps || prevProps.displayMapPin !== props.displayMapPin) {
22570
22990
  if (props.displayMapPin === true) {
22571
- this.adaguc.webMapJS.getMapPin().showMapPin();
22991
+ wmjsMap.getMapPin().showMapPin();
22572
22992
  } else if (props.displayMapPin === false) {
22573
- this.adaguc.webMapJS.getMapPin().hideMapPin();
22993
+ wmjsMap.getMapPin().hideMapPin();
22574
22994
  }
22575
22995
  }
22576
22996
  /* Set map cursor location */
@@ -22578,7 +22998,7 @@ var ReactMapView = /*#__PURE__*/function (_React$Component) {
22578
22998
 
22579
22999
  if (!prevProps || prevProps.mapPinLocation !== props.mapPinLocation) {
22580
23000
  if (props.mapPinLocation) {
22581
- this.adaguc.webMapJS.getMapPin().positionMapPinByLatLon({
23001
+ wmjsMap.getMapPin().positionMapPinByLatLon({
22582
23002
  x: props.mapPinLocation.lon,
22583
23003
  y: props.mapPinLocation.lat
22584
23004
  });
@@ -22589,9 +23009,9 @@ var ReactMapView = /*#__PURE__*/function (_React$Component) {
22589
23009
 
22590
23010
  if (!prevProps || prevProps.disableMapPin !== props.disableMapPin) {
22591
23011
  if (props.disableMapPin === true) {
22592
- this.adaguc.webMapJS.getMapPin().setMapPinDisabled();
23012
+ wmjsMap.getMapPin().setMapPinDisabled();
22593
23013
  } else if (props.disableMapPin === false) {
22594
- this.adaguc.webMapJS.getMapPin().setMapPinEnabled();
23014
+ wmjsMap.getMapPin().setMapPinEnabled();
22595
23015
  }
22596
23016
  }
22597
23017
  /* Change the animation delay */
@@ -22599,8 +23019,8 @@ var ReactMapView = /*#__PURE__*/function (_React$Component) {
22599
23019
 
22600
23020
  if (!prevProps || prevProps.animationDelay !== props.animationDelay) {
22601
23021
  if (props.animationDelay) {
22602
- if (typeof this.adaguc.webMapJS.setAnimationDelay === 'function') {
22603
- this.adaguc.webMapJS.setAnimationDelay(props.animationDelay);
23022
+ if (typeof wmjsMap.setAnimationDelay === 'function') {
23023
+ wmjsMap.setAnimationDelay(props.animationDelay);
22604
23024
  }
22605
23025
  }
22606
23026
  }
@@ -22609,13 +23029,11 @@ var ReactMapView = /*#__PURE__*/function (_React$Component) {
22609
23029
 
22610
23030
  if (!prevProps || prevProps.showLayerInfo !== props.showLayerInfo) {
22611
23031
  if (props.showLayerInfo) {
22612
- this.adaguc.webMapJS.showLayerInfo = props.showLayerInfo;
23032
+ wmjsMap.showLayerInfo = props.showLayerInfo;
22613
23033
  }
22614
23034
  }
22615
23035
 
22616
- var children = props.children;
22617
-
22618
- if (children !== this.currentMapProps.children) {
23036
+ if (children !== this.adaguc.currentMapProps.children) {
22619
23037
  var _ret = function () {
22620
23038
  var myChildren = [];
22621
23039
  var takenIds = new Set();
@@ -22628,7 +23046,7 @@ var ReactMapView = /*#__PURE__*/function (_React$Component) {
22628
23046
  myChildren.push(child);
22629
23047
  takenIds.add(childProps.id);
22630
23048
  } else {
22631
- childProps.onLayerError(childProps, new Error("Duplicate layer id \"".concat(childProps.id, "\" encountered within this WebMap")), _this3.adaguc.webMapJS);
23049
+ childProps.onLayerError(childProps, new Error("Duplicate layer id \"".concat(childProps.id, "\" encountered within this WebMap")), wmjsMap);
22632
23050
  console.warn('ReactWMJSLayer has a duplicate id', child);
22633
23051
  }
22634
23052
  } else {
@@ -22637,11 +23055,9 @@ var ReactMapView = /*#__PURE__*/function (_React$Component) {
22637
23055
  }
22638
23056
  });
22639
23057
  myChildren.reverse();
22640
-
22641
- var wmjsLayers = _this3.adaguc.webMapJS.getLayers();
23058
+ var wmjsLayers = wmjsMap.getLayers();
22642
23059
  /* ReactWMJSLayer Layer Childs: Detect all ReactLayers connected to WMJSLayers, remove WMJSLayer if there is no ReactLayer */
22643
23060
 
22644
-
22645
23061
  var _loop = function _loop(l) {
22646
23062
  if (myChildren.filter(function (c) {
22647
23063
  return c && c.props && c.props.id === wmjsLayers[l].ReactWMJSLayerId;
@@ -22651,7 +23067,7 @@ var ReactMapView = /*#__PURE__*/function (_React$Component) {
22651
23067
  /* Trigger update of all map dimensions */
22652
23068
 
22653
23069
  var onUpdateLayerInformation = props.onUpdateLayerInformation,
22654
- mapId = props.mapId;
23070
+ _mapId = props.mapId;
22655
23071
  onUpdateLayerInformation && onUpdateLayerInformation({
22656
23072
  origin: ORIGIN_REACTMAPVIEW_ONUPDATELAYERINFO,
22657
23073
  serviceLayers: null,
@@ -22659,8 +23075,8 @@ var ReactMapView = /*#__PURE__*/function (_React$Component) {
22659
23075
  layerDimensions: null,
22660
23076
  mapDimensions: {
22661
23077
  origin: origin,
22662
- mapId: mapId,
22663
- dimensions: _this3.adaguc.webMapJS.mapdimensions.map(function (_ref) {
23078
+ mapId: _mapId,
23079
+ dimensions: wmjsMap.mapdimensions.map(function (_ref) {
22664
23080
  var name = _ref.name,
22665
23081
  units = _ref.units,
22666
23082
  currentValue = _ref.currentValue,
@@ -22675,7 +23091,7 @@ var ReactMapView = /*#__PURE__*/function (_React$Component) {
22675
23091
  }
22676
23092
  });
22677
23093
 
22678
- _this3.checkNewProps(prevProps, props);
23094
+ _this3.updateWMJSMapProps(prevProps, props);
22679
23095
 
22680
23096
  return {
22681
23097
  v: {
@@ -22693,22 +23109,20 @@ var ReactMapView = /*#__PURE__*/function (_React$Component) {
22693
23109
  /* ReactWMJSLayer BaseLayer Childs: For the baseLayers, detect all ReactLayers connected to WMJSLayers, remove WMJSLayer if there is no ReactLayer */
22694
23110
 
22695
23111
 
22696
- var webmapJSBaselayers = _this3.adaguc.webMapJS.getBaseLayers();
23112
+ var webmapJSBaselayers = wmjsMap.getBaseLayers();
22697
23113
 
22698
23114
  var _loop2 = function _loop2(_l) {
22699
- var wmjsBaseLayers = _this3.adaguc.webMapJS.getBaseLayers();
23115
+ var wmjsBaseLayers = wmjsMap.getBaseLayers();
22700
23116
 
22701
23117
  if (myChildren.filter(function (c) {
22702
23118
  return c && c.props ? c.props.id === wmjsBaseLayers[_l].ReactWMJSLayerId : false;
22703
23119
  }).length === 0) {
22704
23120
  /* TODO (Maarten Plieger, 2020-03-19):The remove property for the baselayer is not working yet */
22705
23121
  wmjsBaseLayers.splice(_l, 1);
23122
+ wmjsMap.setBaseLayers(wmjsBaseLayers);
23123
+ wmjsBaseLayers = wmjsMap.getBaseLayers();
22706
23124
 
22707
- _this3.adaguc.webMapJS.setBaseLayers(wmjsBaseLayers);
22708
-
22709
- wmjsBaseLayers = _this3.adaguc.webMapJS.getBaseLayers();
22710
-
22711
- _this3.checkNewProps(prevProps, props);
23125
+ _this3.updateWMJSMapProps(prevProps, props);
22712
23126
 
22713
23127
  return {
22714
23128
  v: {
@@ -22723,11 +23137,10 @@ var ReactMapView = /*#__PURE__*/function (_React$Component) {
22723
23137
 
22724
23138
  if (_typeof(_ret3) === "object") return _ret3.v;
22725
23139
  }
22726
- /* Loop through all layers and update WMJSLayer properties where needed */
22727
-
22728
23140
 
22729
23141
  var adagucWMJSLayerIndex = 0;
22730
23142
  var adagucWMJSBaseLayerIndex = 0;
23143
+ /* Loop through all React layers and update WMJSLayer properties where needed */
22731
23144
 
22732
23145
  var _loop3 = function _loop3(c) {
22733
23146
  var child = myChildren[c];
@@ -22737,12 +23150,11 @@ var ReactMapView = /*#__PURE__*/function (_React$Component) {
22737
23150
  if (_typeof(child.type) === _typeof(MapViewLayer)) {
22738
23151
  /* Feature layer (with child.props.geojson), these are handled collectively by the setState commando above. */
22739
23152
  var isBaselayer = !isAMapLayer(child.props) && !isAGeoJSONLayer(child.props);
22740
- var adagucWMJSLayers = isBaselayer ? _this3.adaguc.webMapJS.getBaseLayers() : _this3.adaguc.webMapJS.getLayers();
22741
-
22742
- var obj = _this3.getWMJSLayerFromReactLayer(adagucWMJSLayers, child, isBaselayer ? adagucWMJSBaseLayerIndex : adagucWMJSLayerIndex);
23153
+ var adagucWMJSLayers = isBaselayer ? wmjsMap.getBaseLayers() : wmjsMap.getLayers();
23154
+ var obj = getWMJSLayerFromReactLayer(mapId, adagucWMJSLayers, child, isBaselayer ? adagucWMJSBaseLayerIndex : adagucWMJSLayerIndex);
22743
23155
 
22744
23156
  if (obj.layerArrayMutated) {
22745
- _this3.checkNewProps(prevProps, props);
23157
+ _this3.updateWMJSMapProps(prevProps, props);
22746
23158
 
22747
23159
  return {
22748
23160
  v: {
@@ -22758,6 +23170,8 @@ var ReactMapView = /*#__PURE__*/function (_React$Component) {
22758
23170
  } else {
22759
23171
  adagucWMJSLayerIndex += 1;
22760
23172
  }
23173
+ /* Layer was not yet added */
23174
+
22761
23175
 
22762
23176
  if (wmLayer === null) {
22763
23177
  var keepOnTop = child.props.layerType === LayerType.overLayer || false;
@@ -22771,11 +23185,11 @@ var ReactMapView = /*#__PURE__*/function (_React$Component) {
22771
23185
  /* Add ADAGUC WebMapJS Baselayer */
22772
23186
  _this3.adaguc.baseLayers.push(newWMLayer);
22773
23187
 
22774
- _this3.adaguc.webMapJS.setBaseLayers(_this3.adaguc.baseLayers.reverse());
23188
+ wmjsMap.setBaseLayers(_this3.adaguc.baseLayers.reverse());
22775
23189
  } else {
22776
23190
  /* Add ADAGUC WebMapJS Layer */
22777
- _this3.adaguc.webMapJS.addLayer(newWMLayer).then(function () {
22778
- _this3.adaguc.webMapJS.draw();
23191
+ wmjsMap.addLayer(newWMLayer).then(function () {
23192
+ wmjsMap.draw();
22779
23193
  });
22780
23194
  }
22781
23195
 
@@ -22838,18 +23252,14 @@ var ReactMapView = /*#__PURE__*/function (_React$Component) {
22838
23252
  }
22839
23253
 
22840
23254
  if (child.props.isProfileLayer) {
22841
- var currentBbox = _this3.adaguc.webMapJS.getBBOX();
22842
-
23255
+ var currentBbox = wmjsMap.getBBOX();
22843
23256
  var newBbox = new WMBBOX(props.bbox);
22844
23257
 
22845
23258
  if (currentBbox !== newBbox) {
22846
- _this3.adaguc.webMapJS.suspendEvent('onupdatebbox');
22847
-
22848
- _this3.adaguc.webMapJS.setBBOX(new WMBBOX(props.bbox));
22849
-
23259
+ wmjsMap.suspendEvent('onupdatebbox');
23260
+ wmjsMap.setBBOX(new WMBBOX(props.bbox));
22850
23261
  needsRedraw = true;
22851
-
22852
- _this3.adaguc.webMapJS.resumeEvent('onupdatebbox');
23262
+ wmjsMap.resumeEvent('onupdatebbox');
22853
23263
  }
22854
23264
  }
22855
23265
  }
@@ -22864,12 +23274,12 @@ var ReactMapView = /*#__PURE__*/function (_React$Component) {
22864
23274
  }
22865
23275
 
22866
23276
  if (needsRedraw) {
22867
- _this3.adaguc.webMapJS.draw();
23277
+ wmjsMap.draw();
22868
23278
  }
22869
23279
  /* Children have been processed */
22870
23280
 
22871
23281
 
22872
- _this3.currentMapProps.children = children;
23282
+ _this3.adaguc.currentMapProps.children = children;
22873
23283
  }();
22874
23284
 
22875
23285
  if (_typeof(_ret) === "object") return _ret.v;
@@ -22878,9 +23288,11 @@ var ReactMapView = /*#__PURE__*/function (_React$Component) {
22878
23288
  }, {
22879
23289
  key: "drawDebounced",
22880
23290
  value: function drawDebounced() {
22881
- this.adaguc.webMapJS.getListener().suspendEvents();
22882
- this.adaguc.webMapJS.draw();
22883
- this.adaguc.webMapJS.getListener().resumeEvents();
23291
+ var mapId = this.props.mapId;
23292
+ var wmjsMap = getWMJSMapById(mapId);
23293
+ wmjsMap.getListener().suspendEvents();
23294
+ wmjsMap.draw();
23295
+ wmjsMap.getListener().resumeEvents();
22884
23296
  }
22885
23297
  }, {
22886
23298
  key: "handleWindowResize",
@@ -22888,54 +23300,72 @@ var ReactMapView = /*#__PURE__*/function (_React$Component) {
22888
23300
  this.resize();
22889
23301
  }
22890
23302
  }, {
22891
- key: "checkAdaguc",
22892
- value: function checkAdaguc() {
23303
+ key: "mountWMJSMap",
23304
+ value: function mountWMJSMap() {
22893
23305
  var _this4 = this;
22894
23306
 
22895
- var _this$props5 = this.props,
22896
- mapId = _this$props5.mapId,
22897
- listeners = _this$props5.listeners,
22898
- srs = _this$props5.srs,
22899
- bbox = _this$props5.bbox,
22900
- onMapPinChangeLocation = _this$props5.onMapPinChangeLocation;
23307
+ var _this$props4 = this.props,
23308
+ mapId = _this$props4.mapId,
23309
+ listeners = _this$props4.listeners,
23310
+ srs = _this$props4.srs,
23311
+ bbox = _this$props4.bbox,
23312
+ onMapPinChangeLocation = _this$props4.onMapPinChangeLocation;
23313
+ /* Check if we have something to mount WMJSMap on */
23314
+
23315
+ if (this.adagucWebMapJSRef.current === null) {
23316
+ console.warn('No this.adagucWebMapJSRef.current yet ');
23317
+ return null;
23318
+ }
23319
+ /* Check if webmapjs was not already initialized */
22901
23320
 
22902
- if (this.adaguc.webMapJSCreated) {
22903
- return;
23321
+
23322
+ var existingWMJSMap = getWMJSMapById(mapId);
23323
+
23324
+ if (existingWMJSMap) {
23325
+ console.warn("Somehow ".concat(mapId, "unRegisterWMJSMap already exists"));
23326
+ unRegisterWMJSMap(mapId);
22904
23327
  }
22905
23328
 
22906
- this.adaguc.webMapJSCreated = true;
22907
- this.adaguc.webMapJS = new WMJSMap(this.adagucWebMapJSRef.current);
22908
- this.adaguc.webMapJS.showLayerInfo = false;
23329
+ var wmjsMap = new WMJSMap(this.adagucWebMapJSRef.current);
23330
+ this.adaguc.currentMapProps = {};
23331
+ this.adaguc.currentMapProps.children = null;
23332
+ this.adaguc.baseLayers = [];
23333
+ registerWMJSMap(wmjsMap, mapId);
23334
+ this.adaguc.initialized = true;
22909
23335
  /* Enable to show actual layer properties in the map */
22910
23336
 
22911
- registerWMJSMap(this.adaguc.webMapJS, mapId);
22912
- this.adaguc.webMapJS.removeAllLayers();
22913
- this.adaguc.webMapJS.setProjection(srs, new WMBBOX(bbox));
22914
- this.adaguc.webMapJS.setWMTileRendererTileSettings(tileRenderSettings);
23337
+ wmjsMap.showLayerInfo = false;
23338
+ wmjsMap.removeAllLayers();
23339
+
23340
+ if (srs) {
23341
+ wmjsMap.setProjection(srs, new WMBBOX(bbox));
23342
+ }
23343
+
23344
+ wmjsMap.setWMTileRendererTileSettings(tileRenderSettings);
22915
23345
 
22916
23346
  if (listeners) {
22917
23347
  listeners.forEach(function (listener) {
22918
- _this4.adaguc.webMapJS.addListener(listener.name, function (data) {
22919
- listener.callbackfunction(_this4.adaguc.webMapJS, data);
23348
+ wmjsMap.addListener(listener.name, function (data) {
23349
+ listener.callbackfunction(wmjsMap, data);
22920
23350
  }, listener.keep);
22921
23351
  });
22922
23352
  }
22923
23353
 
22924
- this.adaguc.webMapJS.addListener('ondimchange', function () {
23354
+ wmjsMap.addListener('ondimchange', function () {
22925
23355
  _this4.onDimChangeListener();
22926
23356
  }, true);
22927
- this.adaguc.webMapJS.addListener('onmapready', function () {
23357
+ wmjsMap.addListener('onmapready', function () {
22928
23358
  _this4.setState({
22929
23359
  adagucInitialised: true
22930
23360
  });
22931
23361
  });
22932
- this.adaguc.webMapJS.addListener('aftersetbbox', function (wmjsMap) {
22933
- _this4.onAfterSetBBoxListener(wmjsMap);
23362
+ wmjsMap.addListener('aftersetbbox', function () {
23363
+ _this4.onAfterSetBBoxListener();
22934
23364
  }, true);
22935
- this.adaguc.webMapJS.addListener('onupdatebbox', function (newBbox) {
23365
+ wmjsMap.addListener('onupdatebbox', function (newBbox) {
22936
23366
  _this4.onUpdateBBoxListener(newBbox);
22937
23367
  }, true);
22938
- this.adaguc.webMapJS.addListener('onsetmappin', function (mapPinLatLonCoordinate) {
23368
+ wmjsMap.addListener('onsetmappin', function (mapPinLatLonCoordinate) {
22939
23369
  // only change location when mapPin is visible and enabled
22940
23370
  if (onMapPinChangeLocation && // eslint-disable-next-line react/destructuring-assignment
22941
23371
  _this4.props.displayMapPin && // eslint-disable-next-line react/destructuring-assignment
@@ -22950,7 +23380,9 @@ var ReactMapView = /*#__PURE__*/function (_React$Component) {
22950
23380
  }
22951
23381
  }, true);
22952
23382
  this.resize();
22953
- this.adaguc.webMapJS.draw();
23383
+ wmjsMap.draw();
23384
+ this.updateWMJSMapProps(null, this.props);
23385
+ return wmjsMap;
22954
23386
  }
22955
23387
  }, {
22956
23388
  key: "resize",
@@ -22961,22 +23393,26 @@ var ReactMapView = /*#__PURE__*/function (_React$Component) {
22961
23393
  var newWidth = element.clientWidth;
22962
23394
  var newHeight = element.clientHeight;
22963
23395
 
22964
- if (this.currentWidth !== newWidth || this.currentHeight !== newHeight) {
22965
- this.currentWidth = newWidth;
22966
- this.currentHeight = newHeight;
22967
- this.adaguc.webMapJS.setSize(newWidth, newHeight);
23396
+ if (this.adaguc.currentWidth !== newWidth || this.adaguc.currentHeight !== newHeight) {
23397
+ this.adaguc.currentWidth = newWidth;
23398
+ this.adaguc.currentHeight = newHeight;
23399
+ var mapId = this.props.mapId;
23400
+ var wmjsMap = getWMJSMapById(mapId);
23401
+ wmjsMap.setSize(newWidth, newHeight);
22968
23402
  }
22969
23403
  }
22970
23404
  }
22971
23405
  }, {
22972
23406
  key: "render",
22973
23407
  value: function render() {
22974
- var _this$props6 = this.props,
22975
- passiveMap = _this$props6.passiveMap,
22976
- children = _this$props6.children,
22977
- onClick = _this$props6.onClick;
23408
+ var _this$props5 = this.props,
23409
+ passiveMap = _this$props5.passiveMap,
23410
+ children = _this$props5.children,
23411
+ onClick = _this$props5.onClick,
23412
+ mapId = _this$props5.mapId;
22978
23413
  var adagucInitialised = this.state.adagucInitialised;
22979
23414
  var featureLayers = getFeatureLayers(children);
23415
+ var wmjsMap = getWMJSMapById(mapId);
22980
23416
  return /*#__PURE__*/React.createElement("div", {
22981
23417
  className: "MapView",
22982
23418
  style: {
@@ -23020,7 +23456,7 @@ var ReactMapView = /*#__PURE__*/function (_React$Component) {
23020
23456
  }
23021
23457
  }, /*#__PURE__*/React.createElement("div", null, children), adagucInitialised && featureLayers && featureLayers.length ? /*#__PURE__*/React.createElement(AdagucMapDrawContainer, {
23022
23458
  featureLayers: featureLayers,
23023
- webMapJS: this.adaguc.webMapJS
23459
+ webMapJS: wmjsMap
23024
23460
  }) : null), passiveMap &&
23025
23461
  /*#__PURE__*/
23026
23462
  // eslint-disable-next-line jsx-a11y/click-events-have-key-events, jsx-a11y/control-has-associated-label, jsx-a11y/interactive-supports-focus
@@ -23504,10 +23940,10 @@ var MapViewConnect = function MapViewConnect(_a) {
23504
23940
  return getServices(store);
23505
23941
  });
23506
23942
  var dispatch = useDispatch();
23507
- var map = getWMJSMapById(mapId);
23508
23943
  var mapChangeDimension = React.useCallback(function (mapDimensionPayload) {
23509
23944
  if (mapDimensionPayload.dimension) {
23510
- var dimension = map.getDimension(mapDimensionPayload.dimension.name);
23945
+ var wmjsMap = getWMJSMapById(mapId);
23946
+ var dimension = wmjsMap.getDimension(mapDimensionPayload.dimension.name);
23511
23947
 
23512
23948
  if (dimension && dimension.currentValue === mapDimensionPayload.dimension.currentValue) {
23513
23949
  return;
@@ -23515,15 +23951,17 @@ var MapViewConnect = function MapViewConnect(_a) {
23515
23951
  }
23516
23952
 
23517
23953
  dispatch(mapActions$1.mapChangeDimension(mapDimensionPayload));
23518
- }, [dispatch, map]);
23954
+ }, [dispatch, mapId]);
23519
23955
  var setTime = React.useCallback(function (setTimePayload) {
23956
+ var wmjsMap = getWMJSMapById(mapId);
23520
23957
  /* Check if the map not already has this value set, otherwise this component will re-render */
23521
- if (map.getDimension('time').currentValue === setTimePayload.value) {
23958
+
23959
+ if (wmjsMap.getDimension('time').currentValue === setTimePayload.value) {
23522
23960
  return;
23523
23961
  }
23524
23962
 
23525
23963
  dispatch(genericActions.setTime(setTimePayload));
23526
- }, [dispatch, map]);
23964
+ }, [dispatch, mapId]);
23527
23965
  var updateLayerInformation = React.useCallback(function (payload) {
23528
23966
  dispatch(layerActions.onUpdateLayerInformation(payload));
23529
23967
  }, [dispatch]);
@@ -24607,6 +25045,7 @@ var defaultBbox = {
24607
25045
  };
24608
25046
  var ConfigurableMapConnect = function ConfigurableMapConnect(_a) {
24609
25047
  var id = _a.id,
25048
+ dockedLayerManagerSize = _a.dockedLayerManagerSize,
24610
25049
  title = _a.title,
24611
25050
  _a$layers = _a.layers,
24612
25051
  layers = _a$layers === void 0 ? [] : _a$layers,
@@ -24635,12 +25074,13 @@ var ConfigurableMapConnect = function ConfigurableMapConnect(_a) {
24635
25074
  _a$multiLegend = _a.multiLegend,
24636
25075
  multiLegend = _a$multiLegend === void 0 ? true : _a$multiLegend,
24637
25076
  shouldShowLayerManager = _a.shouldShowLayerManager,
25077
+ shouldShowDockedLayerManager = _a.shouldShowDockedLayerManager,
24638
25078
  _a$showClock = _a.showClock,
24639
25079
  showClock = _a$showClock === void 0 ? true : _a$showClock,
24640
25080
  _a$displayGetFeatureI = _a.displayGetFeatureInfoButtonInMap,
24641
25081
  displayGetFeatureInfoButtonInMap = _a$displayGetFeatureI === void 0 ? false : _a$displayGetFeatureI,
24642
25082
  children = _a.children,
24643
- props = __rest(_a, ["id", "title", "layers", "shouldAutoUpdate", "shouldAnimate", "bbox", "srs", "shouldShowZoomControls", "displayMapPin", "showTimeSlider", "disableTimeSlider", "displayTimeInMap", "displayLayerManagerAndLegendButtonInMap", "displayDimensionSelectButtonInMap", "multiLegend", "shouldShowLayerManager", "showClock", "displayGetFeatureInfoButtonInMap", "children"]);
25083
+ props = __rest(_a, ["id", "dockedLayerManagerSize", "title", "layers", "shouldAutoUpdate", "shouldAnimate", "bbox", "srs", "shouldShowZoomControls", "displayMapPin", "showTimeSlider", "disableTimeSlider", "displayTimeInMap", "displayLayerManagerAndLegendButtonInMap", "displayDimensionSelectButtonInMap", "multiLegend", "shouldShowLayerManager", "shouldShowDockedLayerManager", "showClock", "displayGetFeatureInfoButtonInMap", "children"]);
24644
25084
 
24645
25085
  var dispatch = useDispatch();
24646
25086
  var mapId = React__default.useRef(id || generateMapId()).current;
@@ -24661,7 +25101,8 @@ var ConfigurableMapConnect = function ConfigurableMapConnect(_a) {
24661
25101
  shouldAnimate: shouldAnimate,
24662
25102
  shouldShowZoomControls: shouldShowZoomControls,
24663
25103
  displayMapPin: displayMapPin,
24664
- showTimeSlider: showTimeSlider
25104
+ showTimeSlider: showTimeSlider,
25105
+ dockedLayerManagerSize: dockedLayerManagerSize
24665
25106
  }, props);
24666
25107
  var initialProps = {
24667
25108
  mapPreset: mapPreset
@@ -24678,6 +25119,19 @@ var ConfigurableMapConnect = function ConfigurableMapConnect(_a) {
24678
25119
  setOpen: shouldShowLayerManager,
24679
25120
  source: 'app'
24680
25121
  }));
25122
+ }
25123
+
25124
+ if (shouldShowDockedLayerManager) {
25125
+ dispatch(uiActions.setToggleOpenDialog({
25126
+ type: DialogTypes.LayerManager,
25127
+ mapId: mapId,
25128
+ setOpen: false
25129
+ }));
25130
+ dispatch(uiActions.setToggleOpenDialog({
25131
+ type: "".concat(DialogTypes.DockedLayerManager, "-").concat(mapId),
25132
+ mapId: mapId,
25133
+ setOpen: true
25134
+ }));
24681
25135
  } // eslint-disable-next-line react-hooks/exhaustive-deps
24682
25136
 
24683
25137
  }, []);
@@ -25746,6 +26200,58 @@ var CoreThemeStoreProvider = function CoreThemeStoreProvider(_ref3) {
25746
26200
  }, /*#__PURE__*/React__default.createElement(SnackbarWrapperConnect, null, children)));
25747
26201
  };
25748
26202
 
26203
+ /* *
26204
+ * Licensed under the Apache License, Version 2.0 (the "License");
26205
+ * you may not use this file except in compliance with the License.
26206
+ * You may obtain a copy of the License at
26207
+ *
26208
+ * http://www.apache.org/licenses/LICENSE-2.0
26209
+ *
26210
+ * Unless required by applicable law or agreed to in writing, software
26211
+ * distributed under the License is distributed on an "AS IS" BASIS,
26212
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
26213
+ * See the License for the specific language governing permissions and
26214
+ * limitations under the License.
26215
+ *
26216
+ * Copyright 2022 - Koninklijk Nederlands Meteorologisch Instituut (KNMI)
26217
+ * Copyright 2022 - Finnish Meteorological Institute (FMI)
26218
+ * */
26219
+ var appModuleConfig = {
26220
+ id: 'app-module',
26221
+ reducersMap: {
26222
+ app: reducer
26223
+ }
26224
+ };
26225
+
26226
+ /* *
26227
+ * Licensed under the Apache License, Version 2.0 (the "License");
26228
+ * you may not use this file except in compliance with the License.
26229
+ * You may obtain a copy of the License at
26230
+ *
26231
+ * http://www.apache.org/licenses/LICENSE-2.0
26232
+ *
26233
+ * Unless required by applicable law or agreed to in writing, software
26234
+ * distributed under the License is distributed on an "AS IS" BASIS,
26235
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
26236
+ * See the License for the specific language governing permissions and
26237
+ * limitations under the License.
26238
+ *
26239
+ * Copyright 2022 - Koninklijk Nederlands Meteorologisch Instituut (KNMI)
26240
+ * Copyright 2022 - Finnish Meteorological Institute (FMI)
26241
+ * */
26242
+ var AppWrapperConnect = withEggs([appModuleConfig])(function (_ref) {
26243
+ var children = _ref.children;
26244
+ var dispatch = useDispatch();
26245
+ var initialiseApp = React.useCallback(function () {
26246
+ dispatch(appActions.initialiseApp());
26247
+ }, [dispatch]);
26248
+ React.useEffect(function () {
26249
+ // Call initialisation
26250
+ initialiseApp(); // eslint-disable-next-line react-hooks/exhaustive-deps
26251
+ }, []);
26252
+ return children;
26253
+ });
26254
+
25749
26255
  /* *
25750
26256
  * Licensed under the Apache License, Version 2.0 (the "License");
25751
26257
  * you may not use this file except in compliance with the License.
@@ -25821,4 +26327,4 @@ var MapWarningProperties = function MapWarningProperties(_ref) {
25821
26327
  * */
25822
26328
  var mapActions = Object.assign(Object.assign(Object.assign({}, layerActions), mapActions$1), serviceActions);
25823
26329
 
25824
- export { ConfigurableMapConnect, CoreThemeProvider, CoreThemeStoreProvider, DockedLayerManagerConnect, HarmonieTempAndPrecipPreset, LayerManagerConnect, LayerManagerMapButtonConnect, LayerSelectConnect, Legend, LegendConnect, LegendMapButtonConnect, MapControls, MapView, MapViewConnect, MapViewLayer, MapWarningProperties, MultiDimensionSelectMapButtonsConnect, MultiMapMultiDimensionSelectConnect as MultiMapDimensionSelectConnect, MultiMapViewConnect, ReactMapView, ReactMapViewLayer, SnackbarWrapperConnect, SyncGroupViewerConnect, index as SyncGroups, TimeSliderConnect, ZoomControlConnect, ZoomControls, componentsLookUp, coreModuleConfig, dateFormat, defaultBbox, defaultConfigurations, filterLayers, filterMapPresets, filterNonTimeDimensions, filterServices, generateLayerId, generateMapId, generateTimesliderId, getDrawFunctionFromStore, getFirstTimeStepForLayerId, getInitialAppPresets, getLastTimeStepForLayerId, getNextTimeStepForLayerId, getPreviousTimeStepForLayerId, getWMJSDimensionForLayerAndDimension, getWMJSMapById, getWMJSTimeDimensionForLayerId, getWMLayerById, layerActions, reducer$6 as layerReducer, selectors$2 as layerSelectors, types$3 as layerTypes, mapActions, moduleConfig as mapModuleConfig, selectors as mapSelectors, types$2 as mapTypes, utils as mapUtils, parseBoolean, parseLayer, publicLayers, publicServices, registerDrawFunction, registerWMJSMap, registerWMLayer, snackbarActions, store, genericActions as syncGroupActions, synchronizationGroupConfig as synchronizationGroupModuleConfig, synchronizationGroupConfig as synchronizationGroupsConfig, testLayers, TimeSliderUtils as timeSliderUtils, uiActions, uiModuleConfig, selectors$1 as uiSelectors, types as uiTypes, useSetupDialog };
26330
+ export { AppWrapperConnect, ConfigurableMapConnect, CoreThemeProvider, CoreThemeStoreProvider, DockedLayerManagerConnect, HarmonieTempAndPrecipPreset, LayerManagerConnect, LayerManagerMapButtonConnect, LayerSelectConnect, Legend, LegendConnect, LegendMapButtonConnect, MapControls, MapView, MapViewConnect, MapViewLayer, MapWarningProperties, MultiDimensionSelectMapButtonsConnect, MultiMapMultiDimensionSelectConnect as MultiMapDimensionSelectConnect, MultiMapViewConnect, ReactMapView, ReactMapViewLayer, SnackbarWrapperConnect, SyncGroupViewerConnect, index as SyncGroups, TimeSliderConnect, ZoomControlConnect, ZoomControls, appActions, componentsLookUp, coreModuleConfig, dateFormat, defaultBbox, defaultConfigurations, filterLayers, filterMapPresets, filterNonTimeDimensions, filterServices, generateLayerId, generateMapId, generateTimesliderId, getDrawFunctionFromStore, getFirstTimeStepForLayerId, getInitialAppPresets, getLastTimeStepForLayerId, getNextTimeStepForLayerId, getPreviousTimeStepForLayerId, getWMJSDimensionForLayerAndDimension, getWMJSMapById, getWMJSTimeDimensionForLayerId, getWMLayerById, layerActions, reducer$7 as layerReducer, selectors$2 as layerSelectors, types$3 as layerTypes, mapActions, moduleConfig as mapModuleConfig, selectors as mapSelectors, types$2 as mapTypes, utils as mapUtils, parseBoolean, parseLayer, publicLayers, publicServices, registerDrawFunction, registerWMJSMap, registerWMLayer, snackbarActions, store, genericActions as syncGroupActions, synchronizationGroupConfig as synchronizationGroupModuleConfig, synchronizationGroupConfig as synchronizationGroupsConfig, testLayers, TimeSliderUtils as timeSliderUtils, uiActions, uiModuleConfig, selectors$1 as uiSelectors, types as uiTypes, unRegisterWMJSLayer, unRegisterWMJSMap, useSetupDialog };