@opengeoweb/core 12.1.1 → 12.2.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 (23) hide show
  1. package/index.esm.js +347 -293
  2. package/package.json +12 -12
  3. package/src/lib/components/LayerManager/AddLayersPopup/AddLayersPopup.stories.d.ts +7 -0
  4. package/src/lib/components/{Search/SearchDialog.d.ts → LocationSearch/LocationSearch.d.ts} +2 -2
  5. package/src/lib/components/LocationSearch/LocationSearch.stories.d.ts +7 -0
  6. package/src/lib/components/LocationSearch/LocationSearchConnect.d.ts +5 -0
  7. package/src/lib/components/LocationSearch/LocationSearchConnect.stories.d.ts +16 -0
  8. package/src/lib/components/{Search → LocationSearch}/index.d.ts +2 -2
  9. package/src/lib/components/MapViewConnect/OlMapViewConnect.d.ts +15 -6
  10. package/src/lib/components/WMSLoader/WMSLoader.stories.d.ts +5 -0
  11. package/src/lib/index.d.ts +1 -1
  12. package/src/lib/utils/jsonPresetFilter.d.ts +3 -1
  13. package/src/lib/utils/location-api/api.d.ts +1 -1
  14. package/src/lib/utils/location-api/hooks.d.ts +1 -1
  15. package/src/lib/components/Search/SearchDialog.stories.d.ts +0 -7
  16. package/src/lib/components/Search/SearchDialogConnect.d.ts +0 -5
  17. package/src/lib/components/Search/SearchDialogConnect.stories.d.ts +0 -11
  18. /package/src/lib/components/{Search/MyMapLocation.spec.d.ts → LocationSearch/LocationSearchConnect.spec.d.ts} +0 -0
  19. /package/src/lib/components/{Search → LocationSearch}/MyMapLocation.d.ts +0 -0
  20. /package/src/lib/components/{Search/SearchDialogConnect.spec.d.ts → LocationSearch/MyMapLocation.spec.d.ts} +0 -0
  21. /package/src/lib/components/{Search → LocationSearch}/SearchControlButtonConnect.d.ts +0 -0
  22. /package/src/lib/components/{Search → LocationSearch}/types.d.ts +0 -0
  23. /package/src/lib/components/{Search → LocationSearch}/utils.d.ts +0 -0
package/index.esm.js CHANGED
@@ -1,18 +1,18 @@
1
1
  import { jsxs, Fragment, jsx } from 'react/jsx-runtime';
2
2
  import * as React from 'react';
3
3
  import React__default, { useState, useCallback, useEffect, useContext, useMemo } from 'react';
4
- import { Grid2, Box, MenuItem, Typography, useTheme, Popper, Fade, Tooltip, styled, LinearProgress, FormControl, InputLabel, Paper, List, ListItemButton, ListItemText, CircularProgress, ListSubheader, Dialog, DialogTitle, DialogContent, DialogContentText, TextField, InputAdornment, DialogActions, Button, Autocomplete, ListItemIcon, Checkbox, Switch, Select } from '@mui/material';
5
- import { SHARED_NAMESPACE, sharedTranslations, CustomIconButton, CustomTooltip, TooltipSelect, AlertIcon, sliderHeaderStyle, CustomSlider, ToggleMenu, tooltipContainerStyles, renderCounter, AlertBanner, CustomAccordion, PROJECTION, calculateStartSize, useWheelStopPropagation, ToolContainerDraggable, useDebounce, dateUtils, ErrorBoundary } from '@opengeoweb/shared';
6
- import { CollapseSmall, CollapseMedium, CollapseLarge, CollapseWindow, ExpandWindow, LayersAdd, CloudLoading, ColumnCollapsed, ColumnCollapse, Copy, None, FastForward, AutoUpdateActive, Both, Visibility, VisibilityOff, Delete, DragHandle as DragHandle$1, Cached, Add, MapAdd, WorldMapProjection, Layers, Search, Exclamation, MyLocation, Close, ExitDomain, Info, ThemeWrapper, lightTheme, FlagBritain, FlagNetherlands, FlagFinland, FlagNorway } from '@opengeoweb/theme';
4
+ import { Grid2, Box, MenuItem, Typography, useTheme, Popper, Fade, Tooltip, styled, LinearProgress, FormControl, InputLabel, Paper, List, ListItemButton, ListItemText, CircularProgress, ListSubheader, DialogContentText, TextField, InputAdornment, Button, Autocomplete, ListItemIcon, Checkbox, Switch, Select } from '@mui/material';
5
+ import { safelyInitI18nForTestsAndStories, sharedTranslations, SHARED_NAMESPACE, CustomIconButton, CustomTooltip, TooltipSelect, AlertIcon, sliderHeaderStyle, CustomSlider, ToggleMenu, tooltipContainerStyles, renderCounter, AlertBanner, CustomAccordion, CustomDialog, PROJECTION, calculateStartSize, useWheelStopPropagation, ToolContainerDraggable, useDebounce, dateUtils, usePrevious, ErrorBoundary } from '@opengeoweb/shared';
6
+ import { CollapseSmall, CollapseMedium, CollapseLarge, CollapseWindow, ExpandWindow, LayersAdd, CloudLoading, ColumnCollapsed, ColumnCollapse, Copy, None, FastForward, AutoUpdateActive, Both, Delete, Visibility, VisibilityOff, DragHandle as DragHandle$1, Cached, Add, MapAdd, WorldMapProjection, Layers, Search, Exclamation, MyLocation, Close, ExitDomain, Info, ThemeWrapper, lightTheme, FlagBritain, FlagNetherlands, FlagFinland, FlagNorway } from '@opengeoweb/theme';
7
7
  import i18n from 'i18next';
8
- import { initReactI18next, useTranslation, I18nextProvider } from 'react-i18next';
8
+ import { useTranslation, I18nextProvider } from 'react-i18next';
9
9
  import { TIMESLIDER_NAMESPACE, timesliderTranslations, defaultTimeSpan, TIME_SLIDER_LEGEND_HEIGHT, SpeedButton, TimeStepButton, AnimationLengthButton, AnimationLength, TimeSpanButton, secondsPerPxFromCanvasWidth, getNewCenterOfFixedPointZoom, OptionsMenuButton, PlayButton, defaultTimeStep, BackwardForwardStepButton, AutoUpdateButton, NowButton, handleSetNowEvent, TimeSliderButtons, TimeSliderCurrentTimeBox, TimeSliderLegend, onsetNewDateDebounced, defaultSecondsPerPx, moveSelectedTimePx, TimeSlider, getFilteredTime, ControlButtons, OptionsMenu, TimeSliderClock } from '@opengeoweb/timeslider';
10
- import { WEBMAP_REACT_NAMESPACE, webmapReactTranslations, WEBMAP_NAMESPACE, webmapTranslations, LayerInfoButton, LayerInfoDialog, MapControlButton, MapDimensionSelect, dimensionConfig, DimensionSelectDialog, DimensionSelectButton, MapContext, emptyGeoJSON, registerDrawFunction, MapFeatureClass, setMapCenter, ZoomControls, LegendDialog, LegendButton, MapView, MapViewLayer, MapControls, OpenLayersFeatureLayer, OpenLayersMapDraw, getIsInsideAcceptanceTime, OpenLayersLayer, useSetIntervalWhenVisible, openLayersGetMapImageStore, TimeContext, OpenLayersMapView, WMSLayer, genericOpenLayersFeatureStyle, OpenLayersGetFeatureInfo, OpenLayersZoomControl, getLayerUpdateInfo, isOpenLayersEnabled, publicLayers } from '@opengeoweb/webmap-react';
10
+ import { webmapReactTranslations, WEBMAP_REACT_NAMESPACE, webmapTranslations, WEBMAP_NAMESPACE, LayerInfoButton, LayerInfoDialog, MapControlButton, MapDimensionSelect, dimensionConfig, DimensionSelectDialog, DimensionSelectButton, MapContext, emptyGeoJSON, registerDrawFunction, MapFeatureClass, setMapCenter, ZoomControls, LegendDialog, LegendButton, MapView, MapViewLayer, MapControls, OpenLayersFeatureLayer, OpenLayersMapDraw, getIsInsideAcceptanceTime, OpenLayersLayer, useSetIntervalWhenVisible, openLayersGetMapImageStore, TimeContext, OpenLayersMapView, WMSLayer, genericOpenLayersFeatureStyle, OpenLayersGetFeatureInfo, OpenLayersZoomControl, getLayerUpdateInfo, isOpenLayersEnabled, publicLayers } from '@opengeoweb/webmap-react';
11
11
  import { useDispatch, useSelector, connect, useStore, Provider } from 'react-redux';
12
12
  import { ReactSortable } from 'react-sortablejs';
13
13
  import Sortable from 'sortablejs';
14
14
  import { layerTypes, layerUtils, mapSelectors, layerActions, layerSelectors, serviceSelectors, serviceActions, mapActions, mapEnums, uiSelectors, uiTypes, useSetupDialog, filterLayers, getUserAddedServices, uiActions, genericSelectors, genericActions, drawingToolSelectors, syncConstants, loadingIndicatorActions, syncGroupsSelectors, getViewObjectForSyncGroup, getViewObjectForMapId, defaultLayers, getSingularDrawtoolDrawLayerId, syncGroupsSelector, syncGroupsActions, routerUtils } from '@opengeoweb/store';
15
- import { webmapUtils, queryWMSServiceInfo, queryWMSLayers, queryWMSLayersTree, invalidateWMSGetCapabilities, LayerType, getWMSServiceId, generateLayerId, getWMJSMapById, getWMSGetFeatureInfoRequestURL, getMapDimURL, handleDateUtilsISOString, wmServiceListener, EVENT_GETCAPABILITIES_START, EVENT_GETCAPABILITIES_READY, WMJSDimension, getWMLayerById, WMLayer } from '@opengeoweb/webmap';
15
+ import { webmapUtils, queryWMSServiceInfo, queryWMSLayers, queryWMSLayersTree, invalidateWMSGetCapabilities, LayerType, getWMSServiceId, generateLayerId, getWMJSMapById, getWMSGetFeatureInfoRequestURL, getMapDimURL, wmServiceListener, EVENT_GETCAPABILITIES_START, EVENT_GETCAPABILITIES_READY, handleDateUtilsISOString, WMJSDimension, getWMLayerById, WMLayer } from '@opengeoweb/webmap';
16
16
  import _, { isArray, isEqual, debounce, range } from 'lodash';
17
17
  import { Box as Box$1, styled as styled$1 } from '@mui/system';
18
18
  import { LayerSelectButtonConnect, LayerSelectConnect } from '@opengeoweb/layer-select';
@@ -372,14 +372,14 @@ function _asyncToGenerator(n) {
372
372
  function _createForOfIteratorHelperLoose(r, e) {
373
373
  var t = "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"];
374
374
  if (t) return (t = t.call(r)).next.bind(t);
375
- if (Array.isArray(r) || (t = _unsupportedIterableToArray(r)) || e ) {
375
+ if (Array.isArray(r) || (t = _unsupportedIterableToArray(r)) || e) {
376
376
  t && (r = t);
377
377
  var o = 0;
378
378
  return function () {
379
379
  return o >= r.length ? {
380
- done: !0
380
+ done: true
381
381
  } : {
382
- done: !1,
382
+ done: false,
383
383
  value: r[o++]
384
384
  };
385
385
  };
@@ -390,7 +390,7 @@ function _objectWithoutPropertiesLoose(r, e) {
390
390
  if (null == r) return {};
391
391
  var t = {};
392
392
  for (var n in r) if ({}.hasOwnProperty.call(r, n)) {
393
- if (e.indexOf(n) >= 0) continue;
393
+ if (-1 !== e.indexOf(n)) continue;
394
394
  t[n] = r[n];
395
395
  }
396
396
  return t;
@@ -413,9 +413,9 @@ function _regeneratorRuntime() {
413
413
  function define(t, e, r) {
414
414
  return Object.defineProperty(t, e, {
415
415
  value: r,
416
- enumerable: !0,
417
- configurable: !0,
418
- writable: !0
416
+ enumerable: true,
417
+ configurable: true,
418
+ writable: true
419
419
  }), t[e];
420
420
  }
421
421
  try {
@@ -508,7 +508,7 @@ function _regeneratorRuntime() {
508
508
  if ("throw" === i) throw a;
509
509
  return {
510
510
  value: t,
511
- done: !0
511
+ done: true
512
512
  };
513
513
  }
514
514
  for (n.method = i, n.arg = a;;) {
@@ -559,7 +559,7 @@ function _regeneratorRuntime() {
559
559
  function Context(t) {
560
560
  this.tryEntries = [{
561
561
  tryLoc: "root"
562
- }], t.forEach(pushTryEntry, this), this.reset(!0);
562
+ }], t.forEach(pushTryEntry, this), this.reset(true);
563
563
  }
564
564
  function values(e) {
565
565
  if (e || "" === e) {
@@ -569,8 +569,8 @@ function _regeneratorRuntime() {
569
569
  if (!isNaN(e.length)) {
570
570
  var o = -1,
571
571
  i = function next() {
572
- for (; ++o < e.length;) if (n.call(e, o)) return next.value = e[o], next.done = !1, next;
573
- return next.value = t, next.done = !0, next;
572
+ for (; ++o < e.length;) if (n.call(e, o)) return next.value = e[o], next.done = false, next;
573
+ return next.value = t, next.done = true, next;
574
574
  };
575
575
  return i.next = i;
576
576
  }
@@ -579,10 +579,10 @@ function _regeneratorRuntime() {
579
579
  }
580
580
  return GeneratorFunction.prototype = GeneratorFunctionPrototype, o(g, "constructor", {
581
581
  value: GeneratorFunctionPrototype,
582
- configurable: !0
582
+ configurable: true
583
583
  }), o(GeneratorFunctionPrototype, "constructor", {
584
584
  value: GeneratorFunction,
585
- configurable: !0
585
+ configurable: true
586
586
  }), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, u, "GeneratorFunction"), e.isGeneratorFunction = function (t) {
587
587
  var e = "function" == typeof t && t.constructor;
588
588
  return !!e && (e === GeneratorFunction || "GeneratorFunction" === (e.displayName || e.name));
@@ -611,17 +611,17 @@ function _regeneratorRuntime() {
611
611
  return r.reverse(), function next() {
612
612
  for (; r.length;) {
613
613
  var t = r.pop();
614
- if (t in e) return next.value = t, next.done = !1, next;
614
+ if (t in e) return next.value = t, next.done = false, next;
615
615
  }
616
- return next.done = !0, next;
616
+ return next.done = true, next;
617
617
  };
618
618
  }, e.values = values, Context.prototype = {
619
619
  constructor: Context,
620
620
  reset: function (e) {
621
- if (this.prev = 0, this.next = 0, this.sent = this._sent = t, this.done = !1, this.delegate = null, this.method = "next", this.arg = t, this.tryEntries.forEach(resetTryEntry), !e) for (var r in this) "t" === r.charAt(0) && n.call(this, r) && !isNaN(+r.slice(1)) && (this[r] = t);
621
+ if (this.prev = 0, this.next = 0, this.sent = this._sent = t, this.done = false, this.delegate = null, this.method = "next", this.arg = t, this.tryEntries.forEach(resetTryEntry), !e) for (var r in this) "t" === r.charAt(0) && n.call(this, r) && !isNaN(+r.slice(1)) && (this[r] = t);
622
622
  },
623
623
  stop: function () {
624
- this.done = !0;
624
+ this.done = true;
625
625
  var t = this.tryEntries[0].completion;
626
626
  if ("throw" === t.type) throw t.arg;
627
627
  return this.rval;
@@ -640,10 +640,10 @@ function _regeneratorRuntime() {
640
640
  var c = n.call(i, "catchLoc"),
641
641
  u = n.call(i, "finallyLoc");
642
642
  if (c && u) {
643
- if (this.prev < i.catchLoc) return handle(i.catchLoc, !0);
643
+ if (this.prev < i.catchLoc) return handle(i.catchLoc, true);
644
644
  if (this.prev < i.finallyLoc) return handle(i.finallyLoc);
645
645
  } else if (c) {
646
- if (this.prev < i.catchLoc) return handle(i.catchLoc, !0);
646
+ if (this.prev < i.catchLoc) return handle(i.catchLoc, true);
647
647
  } else {
648
648
  if (!u) throw Error("try statement without catch or finally");
649
649
  if (this.prev < i.finallyLoc) return handle(i.finallyLoc);
@@ -723,21 +723,22 @@ function _unsupportedIterableToArray(r, a) {
723
723
  * */
724
724
  var CORE_NAMESPACE = 'core';
725
725
  var initCoreReactI18n = function initCoreReactI18n() {
726
- var _en, _fi, _no, _nl;
727
- void i18n.use(initReactI18next).init({
728
- lng: 'en',
729
- fallbackLng: 'en',
726
+ safelyInitI18nForTestsAndStories(i18n, CORE_NAMESPACE, [{
730
727
  ns: CORE_NAMESPACE,
731
- interpolation: {
732
- escapeValue: false
733
- },
734
- resources: {
735
- en: (_en = {}, _en[CORE_NAMESPACE] = coreTranslations.en, _en[WEBMAP_REACT_NAMESPACE] = webmapReactTranslations.en, _en[WEBMAP_NAMESPACE] = webmapTranslations.en, _en[SHARED_NAMESPACE] = sharedTranslations.en, _en[TIMESLIDER_NAMESPACE] = timesliderTranslations.en, _en),
736
- fi: (_fi = {}, _fi[CORE_NAMESPACE] = coreTranslations.fi, _fi[WEBMAP_REACT_NAMESPACE] = webmapReactTranslations.fi, _fi[WEBMAP_NAMESPACE] = webmapTranslations.fi, _fi[SHARED_NAMESPACE] = sharedTranslations.fi, _fi[TIMESLIDER_NAMESPACE] = timesliderTranslations.fi, _fi),
737
- no: (_no = {}, _no[CORE_NAMESPACE] = coreTranslations.no, _no[WEBMAP_REACT_NAMESPACE] = webmapReactTranslations.no, _no[WEBMAP_NAMESPACE] = webmapTranslations.no, _no[SHARED_NAMESPACE] = sharedTranslations.no, _no[TIMESLIDER_NAMESPACE] = timesliderTranslations.no, _no),
738
- nl: (_nl = {}, _nl[CORE_NAMESPACE] = coreTranslations.nl, _nl[WEBMAP_REACT_NAMESPACE] = webmapReactTranslations.nl, _nl[WEBMAP_NAMESPACE] = webmapTranslations.nl, _nl[SHARED_NAMESPACE] = sharedTranslations.nl, _nl[TIMESLIDER_NAMESPACE] = timesliderTranslations.nl, _nl)
739
- }
740
- });
728
+ translations: coreTranslations
729
+ }, {
730
+ ns: WEBMAP_REACT_NAMESPACE,
731
+ translations: webmapReactTranslations
732
+ }, {
733
+ ns: WEBMAP_NAMESPACE,
734
+ translations: webmapTranslations
735
+ }, {
736
+ ns: SHARED_NAMESPACE,
737
+ translations: sharedTranslations
738
+ }, {
739
+ ns: TIMESLIDER_NAMESPACE,
740
+ translations: timesliderTranslations
741
+ }]);
741
742
  };
742
743
  var ns = [CORE_NAMESPACE, TIMESLIDER_NAMESPACE];
743
744
  var useCoreTranslation = function useCoreTranslation() {
@@ -852,9 +853,7 @@ var columnClasses = {
852
853
  acceptanceTime: 'column-acceptanceTime',
853
854
  loadDuration: 'column-loadDuration',
854
855
  columnHeader: 'columnHeader',
855
- baseLayer: 'baseLayer',
856
- columnTarget: 'columnTarget'
857
- };
856
+ baseLayer: 'baseLayer'};
858
857
  var DRAG_VISIBILITY_LEADING_BUTTONS = 3;
859
858
  var DELETE_MORE_BUTTONS = 3;
860
859
  var MISSING = 4;
@@ -3208,7 +3207,10 @@ var MissingDataConnect = function MissingDataConnect(_ref) {
3208
3207
  var serviceLayer = useSelector(function (store) {
3209
3208
  return serviceSelectors.getLayerFromService(store, layerService, layerName);
3210
3209
  });
3211
- var layerIsMissingOnServer = !serviceLayer;
3210
+ var layerStatus = useSelector(function (store) {
3211
+ return layerSelectors.getLayerStatus(store, layerId);
3212
+ });
3213
+ var layerIsMissingOnServer = !serviceLayer || layerStatus === layerTypes.LayerStatus.error;
3212
3214
  return jsx(MissingData, {
3213
3215
  layerIsInsideAcceptanceTime: layerIsMissingOnServer ? 'outside' : layerIsInsideAcceptanceTime
3214
3216
  });
@@ -3341,6 +3343,9 @@ var LayerRowConnect = /*#__PURE__*/React.memo(function (_ref) {
3341
3343
  var serviceLayer = useSelector(function (store) {
3342
3344
  return serviceSelectors.getLayerFromService(store, layerServiceUrl, layerName);
3343
3345
  });
3346
+ var layerStatus = useSelector(function (store) {
3347
+ return layerSelectors.getLayerStatus(store, layerId);
3348
+ });
3344
3349
  var currentlySelectedLayer = useSelector(function (store) {
3345
3350
  return layerSelectors.getLayerByIdWithoutTimeDimension(store, layerId);
3346
3351
  });
@@ -3356,7 +3361,7 @@ var LayerRowConnect = /*#__PURE__*/React.memo(function (_ref) {
3356
3361
  isEnabled: isEnabled,
3357
3362
  mapId: mapId,
3358
3363
  layerId: layerId,
3359
- isLayerMissing: !serviceLayer,
3364
+ isLayerMissing: !serviceLayer || layerStatus === layerTypes.LayerStatus.error,
3360
3365
  layerName: fullLayerName || layerName,
3361
3366
  layerEnableLayout: jsx(EnableLayerConnect, {
3362
3367
  layerId: layerId,
@@ -3837,6 +3842,9 @@ var WMSLayerTreeHeader = function WMSLayerTreeHeader(_ref) {
3837
3842
  tooltipTitle: t('add-layer-popup-reload-layers'),
3838
3843
  "data-testid": "reloadLayers",
3839
3844
  onClick: onClickReload,
3845
+ style: {
3846
+ top: -6
3847
+ },
3840
3848
  children: jsx(Cached, {})
3841
3849
  })
3842
3850
  })]
@@ -4115,7 +4123,8 @@ var filterMapPresets = function filterMapPresets(initialAppPreset) {
4115
4123
  var layers = preset.layers,
4116
4124
  services = preset.services,
4117
4125
  baseServices = preset.baseServices,
4118
- timeSeriesServices = preset.timeSeriesServices;
4126
+ timeSeriesServices = preset.timeSeriesServices,
4127
+ soundingsCollections = preset.soundingsCollections;
4119
4128
  var _ref = layers ? filterLayers.filterLayers(layers, filterLayers.parseLayer) : filterLayers.createEmtpyFilteredList(undefined),
4120
4129
  baseLayers = _ref.baseLayers,
4121
4130
  mapLayers = _ref.mapLayers;
@@ -4126,6 +4135,7 @@ var filterMapPresets = function filterMapPresets(initialAppPreset) {
4126
4135
  services: filterredServices,
4127
4136
  baseServices: filteredBaseServices,
4128
4137
  timeSeriesServices: filteredTimeSeriesServices,
4138
+ soundingsCollections: soundingsCollections,
4129
4139
  baseLayers: baseLayers,
4130
4140
  mapLayers: mapLayers
4131
4141
  };
@@ -4375,115 +4385,106 @@ var AddLayersPopup = function AddLayersPopup(_ref) {
4375
4385
  }
4376
4386
  // eslint-disable-next-line react-hooks/exhaustive-deps
4377
4387
  }, [preloadedServices]);
4378
- return jsxs(Dialog, {
4388
+ return jsx(CustomDialog, {
4379
4389
  fullWidth: true,
4380
4390
  maxWidth: "md",
4381
4391
  open: open,
4382
- onClose: handleClose,
4392
+ onClose: function onClose() {
4393
+ return handleClose && handleClose();
4394
+ },
4383
4395
  "aria-labelledby": "form-dialog-title",
4384
4396
  "data-testid": "addLayersPopup",
4385
- children: [jsx(DialogTitle, {
4386
- id: "form-dialog-title",
4387
- children: t('add-layer-popup-title')
4388
- }), jsxs(DialogContent, {
4397
+ title: t('add-layer-popup-title'),
4398
+ actions: jsx(Button, {
4399
+ onClick: handleClose,
4400
+ variant: "tertiary",
4401
+ sx: {
4402
+ width: {
4403
+ xs: '100%',
4404
+ sm: 'auto'
4405
+ }
4406
+ },
4407
+ children: t('actions-close')
4408
+ }),
4409
+ children: jsxs(Fragment, {
4389
4410
  children: [jsx(DialogContentText, {
4390
4411
  children: t('wms-loader-description')
4391
- }), jsx(Box, {
4392
- m: 2,
4412
+ }), jsx(Grid2, {
4413
+ container: true,
4414
+ direction: "row",
4415
+ alignItems: "center",
4416
+ mb: 1,
4393
4417
  children: jsx(Grid2, {
4394
- container: true,
4395
- direction: "row",
4396
- alignItems: "center",
4397
- children: jsx(Grid2, {
4398
- size: 12,
4399
- children: jsx(TextField, {
4400
- margin: "dense",
4401
- id: "serviceurl",
4402
- label: t('add-layer-popup-service-url'),
4403
- value: serviceURL,
4404
- type: "url",
4405
- onChange: function onChange(event) {
4406
- var url = event.target.value.trim();
4407
- setServiceURL(url);
4408
- // No error message until new check
4409
- setUrlError('');
4410
- },
4411
- onKeyPress: function onKeyPress(event) {
4412
- if (event.key === 'Enter') {
4413
- handleAddServiceURL();
4414
- }
4415
- },
4416
- fullWidth: true,
4417
- disabled: loading,
4418
- error: urlError !== '',
4419
- helperText: urlError,
4420
- variant: "filled",
4421
- slotProps: {
4422
- input: {
4423
- endAdornment: jsx(InputAdornment, {
4424
- position: "end",
4425
- children: loading ? jsx(CircularProgress, {
4426
- size: 24,
4427
- sx: {
4428
- zIndex: 1
4429
- }
4430
- }) : jsx(CustomIconButton, {
4431
- "data-testid": "add-service",
4432
- onClick: handleAddServiceURL,
4433
- disabled: loading,
4434
- size: "large",
4435
- children: jsx(Add, {})
4436
- })
4418
+ size: 12,
4419
+ children: jsx(TextField, {
4420
+ margin: "dense",
4421
+ id: "serviceurl",
4422
+ label: t('add-layer-popup-service-url'),
4423
+ value: serviceURL,
4424
+ type: "url",
4425
+ onChange: function onChange(event) {
4426
+ var url = event.target.value.trim();
4427
+ setServiceURL(url);
4428
+ // No error message until new check
4429
+ setUrlError('');
4430
+ },
4431
+ onKeyPress: function onKeyPress(event) {
4432
+ if (event.key === 'Enter') {
4433
+ handleAddServiceURL();
4434
+ }
4435
+ },
4436
+ fullWidth: true,
4437
+ disabled: loading,
4438
+ error: urlError !== '',
4439
+ helperText: urlError,
4440
+ variant: "filled",
4441
+ slotProps: {
4442
+ input: {
4443
+ endAdornment: jsx(InputAdornment, {
4444
+ position: "end",
4445
+ children: loading ? jsx(CircularProgress, {
4446
+ size: 24,
4447
+ sx: {
4448
+ zIndex: 1
4449
+ }
4450
+ }) : jsx(CustomIconButton, {
4451
+ "data-testid": "add-service",
4452
+ onClick: handleAddServiceURL,
4453
+ disabled: loading,
4454
+ size: "large",
4455
+ children: jsx(Add, {})
4437
4456
  })
4438
- }
4457
+ })
4439
4458
  }
4440
- })
4459
+ }
4441
4460
  })
4442
4461
  })
4443
- }), jsx(Box, {
4444
- m: 2,
4445
- children: jsxs(Grid2, {
4446
- container: true,
4447
- direction: "row",
4448
- alignItems: "center",
4449
- spacing: 3,
4450
- children: [jsx(Grid2, {
4451
- size: 4,
4452
- children: jsx(WMSServerList, {
4453
- availableServices: services,
4454
- service: activeService,
4455
- handleChangeService: handleChangeService
4456
- })
4457
- }), jsx(Grid2, {
4458
- size: 8,
4459
- children: onRenderTree ? onRenderTree(activeService) : jsx(WMSLayerTreeConnect, {
4460
- mapId: "",
4461
- service: activeService,
4462
- layerType: layerType
4463
- })
4464
- })]
4465
- })
4462
+ }), jsxs(Grid2, {
4463
+ container: true,
4464
+ direction: "row",
4465
+ alignItems: "center",
4466
+ spacing: 3,
4467
+ children: [jsx(Grid2, {
4468
+ size: 4,
4469
+ children: jsx(WMSServerList, {
4470
+ availableServices: services,
4471
+ service: activeService,
4472
+ handleChangeService: handleChangeService
4473
+ })
4474
+ }), jsx(Grid2, {
4475
+ size: 8,
4476
+ children: onRenderTree ? onRenderTree(activeService) : jsx(WMSLayerTreeConnect, {
4477
+ mapId: "",
4478
+ service: activeService,
4479
+ layerType: layerType
4480
+ })
4481
+ })]
4466
4482
  })]
4467
- }), jsx(DialogActions, {
4468
- children: jsx(Button, {
4469
- onClick: handleClose,
4470
- color: "primary",
4471
- children: t('actions-close')
4472
- })
4473
- })]
4483
+ })
4474
4484
  });
4475
4485
  };
4476
4486
 
4477
4487
  var styles$2 = {
4478
- buttonDiv: {
4479
- position: 'relative'
4480
- },
4481
- loadingButton: {
4482
- position: 'absolute',
4483
- top: 7,
4484
- left: 7,
4485
- zIndex: 1
4486
- },
4487
4488
  button: {
4488
4489
  margin: 'auto 0px auto 32px'
4489
4490
  }
@@ -4671,7 +4672,7 @@ var availableProjections = [Object.assign({}, PROJECTION.EPSG_3857, {
4671
4672
  }
4672
4673
  }), Object.assign({}, PROJECTION.EPSG_3067, {
4673
4674
  bbox: {
4674
- left: -1197402.0,
4675
+ left: -1197402,
4675
4676
  bottom: 6439686.0,
4676
4677
  right: 2090705,
4677
4678
  top: 7975202
@@ -4783,14 +4784,7 @@ var styles$1 = {
4783
4784
  height: 'calc(100% - 59px)',
4784
4785
  display: 'inline-block',
4785
4786
  padding: '0 6px'
4786
- },
4787
- layerManagerContainer: {
4788
- position: 'absolute',
4789
- height: '100%',
4790
- width: '100%',
4791
- boxSizing: 'border-box'
4792
- }
4793
- };
4787
+ }};
4794
4788
  var getLayerManagerSizeValue = function getLayerManagerSizeValue(size) {
4795
4789
  if (!size.width || typeof size.width !== 'number') {
4796
4790
  return 'sizeLarge';
@@ -5805,7 +5799,7 @@ var useLocationDetail = function useLocationDetail(id, source) {
5805
5799
  });
5806
5800
  };
5807
5801
 
5808
- var SearchDialog = function SearchDialog(_ref) {
5802
+ var LocationSearch = function LocationSearch(_ref) {
5809
5803
  var isOpen = _ref.isOpen,
5810
5804
  _ref$mapId = _ref.mapId,
5811
5805
  mapId = _ref$mapId === void 0 ? '' : _ref$mapId,
@@ -5998,25 +5992,29 @@ var geometryStyling = {
5998
5992
  'stroke-opacity': 1,
5999
5993
  'stroke-width': 4
6000
5994
  };
6001
- var makeGeoJSONFeatureFromLocation = function makeGeoJSONFeatureFromLocation(location, drawFunctionId, hoverDrawFunctionId, mapFeatureClass) {
5995
+ var makeGeoJSONFeatureFromLocation = function makeGeoJSONFeatureFromLocation(location, drawFunctionId, hoverDrawFunctionId, mapFeatureClass, t) {
6002
5996
  var _location$geometry;
6003
5997
  var collection = {
6004
5998
  type: 'FeatureCollection',
6005
5999
  features: []
6006
6000
  };
6001
+ var name = mapFeatureClass === MapFeatureClass.MyLocation ? t('my-location') : location.name;
6007
6002
  var geometry = Object.assign({}, location.geometry, {
6008
6003
  properties: Object.assign({}, geometryStyling, {
6009
- name: location.name,
6010
- hoverDrawFunctionId: hoverDrawFunctionId
6004
+ name: name,
6005
+ hoverDrawFunctionId: hoverDrawFunctionId,
6006
+ mapFeatureClass: mapFeatureClass,
6007
+ showNameOnHover: true
6011
6008
  })
6012
6009
  });
6013
6010
  var marker = {
6014
6011
  type: 'Feature',
6015
6012
  properties: {
6016
- name: location.name,
6013
+ name: name,
6017
6014
  drawFunctionId: drawFunctionId,
6018
6015
  hoverDrawFunctionId: hoverDrawFunctionId,
6019
- mapFeatureClass: mapFeatureClass
6016
+ mapFeatureClass: mapFeatureClass,
6017
+ showNameOnHover: true
6020
6018
  },
6021
6019
  geometry: {
6022
6020
  type: 'Point',
@@ -6025,7 +6023,6 @@ var makeGeoJSONFeatureFromLocation = function makeGeoJSONFeatureFromLocation(loc
6025
6023
  };
6026
6024
  switch ((_location$geometry = location.geometry) == null ? void 0 : _location$geometry.geometry.type) {
6027
6025
  case 'Point':
6028
- case 'MultiLineString':
6029
6026
  case undefined:
6030
6027
  collection.features.push(marker);
6031
6028
  break;
@@ -6082,6 +6079,8 @@ var hoverDrawFunction = function hoverDrawFunction(args) {
6082
6079
  };
6083
6080
  var useDrawOnMap = function useDrawOnMap(mapId, drawFunction) {
6084
6081
  var dispatch = useDispatch();
6082
+ var _useCoreTranslation = useCoreTranslation(),
6083
+ t = _useCoreTranslation.t;
6085
6084
  var _useContext = useContext(MapContext),
6086
6085
  map = _useContext.map;
6087
6086
  var layerIdRef = React__default.useRef();
@@ -6105,7 +6104,7 @@ var useDrawOnMap = function useDrawOnMap(mapId, drawFunction) {
6105
6104
  geojson: emptyGeoJSON,
6106
6105
  layerType: LayerType.featureLayer
6107
6106
  },
6108
- origin: 'SearchDialogConnect'
6107
+ origin: 'LocationSearchConnect'
6109
6108
  }));
6110
6109
  }
6111
6110
  }, [dispatch, layerId, mapId, shouldAddLayer]);
@@ -6113,12 +6112,12 @@ var useDrawOnMap = function useDrawOnMap(mapId, drawFunction) {
6113
6112
  var hoverDrawFunctionId = React__default.useRef(registerDrawFunction(hoverDrawFunction)).current;
6114
6113
  var updateGeoJSON = React__default.useCallback(function (location) {
6115
6114
  var mapFeatureClass = (location == null ? void 0 : location.source) === 'MyMapLocation' ? MapFeatureClass.MyLocation : MapFeatureClass.GenericMarker;
6116
- var geojson = location ? makeGeoJSONFeatureFromLocation(location, drawFunctionId, hoverDrawFunctionId, mapFeatureClass) : emptyGeoJSON;
6115
+ var geojson = location ? makeGeoJSONFeatureFromLocation(location, drawFunctionId, hoverDrawFunctionId, mapFeatureClass, t) : emptyGeoJSON;
6117
6116
  dispatch(layerActions.updateFeature({
6118
6117
  layerId: layerId,
6119
6118
  geojson: geojson
6120
6119
  }));
6121
- }, [dispatch, drawFunctionId, hoverDrawFunctionId, layerId]);
6120
+ }, [dispatch, drawFunctionId, hoverDrawFunctionId, layerId, t]);
6122
6121
  var zoomToFeature = React__default.useCallback(function (location) {
6123
6122
  var webMap = getWMJSMapById(mapId);
6124
6123
  if (webMap) {
@@ -6136,7 +6135,7 @@ var useDrawOnMap = function useDrawOnMap(mapId, drawFunction) {
6136
6135
  return [onUpdateLocation];
6137
6136
  };
6138
6137
 
6139
- var SearchDialogConnect = function SearchDialogConnect(_ref) {
6138
+ var LocationSearchConnect = function LocationSearchConnect(_ref) {
6140
6139
  var _ref$mapId = _ref.mapId,
6141
6140
  mapId = _ref$mapId === void 0 ? '' : _ref$mapId;
6142
6141
  var dialogType = uiTypes.DialogTypes.Search + "-" + mapId;
@@ -6159,7 +6158,7 @@ var SearchDialogConnect = function SearchDialogConnect(_ref) {
6159
6158
  return false;
6160
6159
  });
6161
6160
  var isMyLocationSelected = !!myLocationLayer;
6162
- return jsx(SearchDialog, {
6161
+ return jsx(LocationSearch, {
6163
6162
  isOpen: isDialogOpen,
6164
6163
  mapId: mapId,
6165
6164
  onSelectLocation: updateMapPin,
@@ -7089,7 +7088,7 @@ var MapViewConnect = function MapViewConnect(_ref) {
7089
7088
  showMapId: true,
7090
7089
  mapId: mapId,
7091
7090
  multiLegend: controls == null ? void 0 : controls.multiLegend
7092
- }), (controls == null ? void 0 : controls.search) && jsx(SearchDialogConnect, {
7091
+ }), (controls == null ? void 0 : controls.search) && jsx(LocationSearchConnect, {
7093
7092
  mapId: mapId
7094
7093
  }), (controls == null ? void 0 : controls.getFeatureInfo) && jsx(GetFeatureInfoConnect, {
7095
7094
  showMapId: true,
@@ -7102,58 +7101,59 @@ var MapViewConnect = function MapViewConnect(_ref) {
7102
7101
  });
7103
7102
  };
7104
7103
 
7105
- /* *
7106
- * Licensed under the Apache License, Version 2.0 (the "License");
7107
- * you may not use this file except in compliance with the License.
7108
- * You may obtain a copy of the License at
7109
- *
7110
- * http://www.apache.org/licenses/LICENSE-2.0
7111
- *
7112
- * Unless required by applicable law or agreed to in writing, software
7113
- * distributed under the License is distributed on an "AS IS" BASIS,
7114
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
7115
- * See the License for the specific language governing permissions and
7116
- * limitations under the License.
7117
- *
7118
- * Copyright 2024 - Koninklijk Nederlands Meteorologisch Instituut (KNMI)
7119
- * Copyright 2024 - Finnish Meteorological Institute (FMI)
7120
- * Copyright 2024 - The Norwegian Meteorological Institute (MET Norway)
7121
- * */
7122
- var useGetOpenLayersView = function useGetOpenLayersView(mapId, store) {
7123
- var _useState = useState(),
7124
- view = _useState[0],
7125
- setView = _useState[1];
7126
- var _useState2 = useState(),
7127
- name = _useState2[0],
7128
- setName = _useState2[1];
7129
- var syncGroupState = syncGroupsSelectors.getSynchronizationGroupState(store.getState());
7130
- var syncGroupView = useMemo(function () {
7131
- var thisAreaSyncGroupId = syncGroupState.groups.allIds.find(function (id) {
7132
- var group = syncGroupState.groups.byId[id];
7133
- return group.type === syncConstants.SYNCGROUPS_TYPE_SETBBOX && group.targets.allIds.indexOf(mapId) !== -1;
7134
- });
7135
- return thisAreaSyncGroupId ? getViewObjectForSyncGroup(thisAreaSyncGroupId) : null;
7136
- }, [mapId, syncGroupState.groups]);
7137
- useEffect(function () {
7138
- var mapBbox = mapSelectors.getBbox(store.getState(), mapId);
7139
- var storedView = syncGroupView || getViewObjectForMapId(mapId);
7140
- if (storedView.view.getCenter() === undefined && mapBbox.left !== undefined) {
7141
- storedView.view.fit([mapBbox.left, mapBbox.bottom, mapBbox.right, mapBbox.top]);
7104
+ var OpenLayersFeatureLayerConnect = function OpenLayersFeatureLayerConnect(_ref) {
7105
+ var layer = _ref.layer,
7106
+ layerId = _ref.layerId,
7107
+ zIndex = _ref.zIndex,
7108
+ style = _ref.style,
7109
+ hoverSelect = _ref.hoverSelect;
7110
+ var store = useStore();
7111
+ var dispatch = useDispatch();
7112
+ var updateFeature = React__default.useCallback(function (geojson, reason) {
7113
+ if (!layerId) {
7114
+ window.console.error('updateFeature without layerId');
7115
+ return;
7142
7116
  }
7143
- setName(storedView.name);
7144
- var setViewFromStoredView = function setViewFromStoredView() {
7145
- setView(storedView.view);
7146
- };
7147
- setViewFromStoredView();
7148
- var eventKey = storedView.on('change', setViewFromStoredView);
7149
- return function () {
7150
- unByKey(eventKey);
7151
- };
7152
- }, [syncGroupView, mapId, store]);
7153
- return {
7154
- view: view,
7155
- name: name
7156
- };
7117
+ var activeDrawToolId = drawingToolSelectors.getActiveDrawToolId(store.getState());
7118
+ var activeDrawMode = drawingToolSelectors.getActiveDrawMode(store.getState(), activeDrawToolId);
7119
+ dispatch(layerActions.updateFeature({
7120
+ geojson: geojson,
7121
+ reason: reason,
7122
+ layerId: layerId,
7123
+ shouldAllowMultipleShapes: drawingToolSelectors.getShouldAllowMultipleShapes(store.getState(), activeDrawToolId),
7124
+ geoJSONIntersectionLayerId: drawingToolSelectors.getGeoJSONIntersectionLayerId(store.getState(), activeDrawToolId),
7125
+ geoJSONIntersectionBoundsLayerId: drawingToolSelectors.getGeoJSONIntersectionBoundsLayerId(store.getState(), activeDrawToolId),
7126
+ selectionType: activeDrawMode == null ? void 0 : activeDrawMode.selectionType
7127
+ }));
7128
+ }, [dispatch, store, layerId]);
7129
+ var exitFeatureDrawMode = React__default.useCallback(function (reason) {
7130
+ if (!layerId) {
7131
+ window.console.error('exitFeatureDrawMode without layerId');
7132
+ return;
7133
+ }
7134
+ var activeDrawToolId = drawingToolSelectors.getActiveDrawToolId(store.getState());
7135
+ dispatch(layerActions.exitFeatureDrawMode({
7136
+ reason: reason,
7137
+ layerId: layerId,
7138
+ shouldAllowMultipleShapes: drawingToolSelectors.getShouldAllowMultipleShapes(store.getState(), activeDrawToolId)
7139
+ }));
7140
+ }, [dispatch, store, layerId]);
7141
+ return jsxs(Fragment, {
7142
+ children: [jsx(OpenLayersFeatureLayer, {
7143
+ featureCollection: !layer.isInEditMode ? layer.geojson : undefined,
7144
+ zIndex: zIndex,
7145
+ style: style,
7146
+ hoverSelect: hoverSelect
7147
+ }), jsx(OpenLayersMapDraw, {
7148
+ drawMode: layer.drawMode,
7149
+ viewOnlyStyle: style,
7150
+ exitDrawModeCallback: exitFeatureDrawMode,
7151
+ geojson: layer.geojson,
7152
+ isInEditMode: layer.isInEditMode || false,
7153
+ selectedFeatureIndex: layer.selectedFeatureIndex || 0,
7154
+ updateGeojson: updateFeature
7155
+ })]
7156
+ });
7157
7157
  };
7158
7158
 
7159
7159
  /* *
@@ -7204,10 +7204,10 @@ var makePrefetchTimeSpan = function makePrefetchTimeSpan(timeSliderStartCenterEn
7204
7204
  var makeLayerInfoPayload = function makeLayerInfoPayload(payload, mapDimensions, mapId) {
7205
7205
  // During intialization, try to base the layer dimension on the current map dimension value.
7206
7206
  var updatedPayLoad = {
7207
- origin: 'OnInitializeLayerProps in MapViewConnect',
7207
+ origin: 'onInitializeLayer in OlMapViewLayerConnect',
7208
7208
  layerDimensions: {
7209
7209
  layerId: payload.layerId,
7210
- origin: 'OnInitializeLayerProps in MapViewConnect',
7210
+ origin: 'onInitializeLayer in OlMapViewLayerConnect',
7211
7211
  dimensions: (payload.dimensions || []).map(function (layerDim) {
7212
7212
  var _find;
7213
7213
  var currentMapDim = ((_find = (mapDimensions || []).find(function (mapDim) {
@@ -7221,7 +7221,7 @@ var makeLayerInfoPayload = function makeLayerInfoPayload(payload, mapDimensions,
7221
7221
  },
7222
7222
  mapDimensions: {
7223
7223
  mapId: mapId,
7224
- origin: 'OnInitializeLayerProps in MapViewConnect',
7224
+ origin: 'onInitializeLayer in OlMapViewLayerConnect',
7225
7225
  dimensions: (payload.dimensions || []).map(function (layerDim) {
7226
7226
  var _find2;
7227
7227
  var currentMapDim = ((_find2 = (mapDimensions || []).find(function (mapDim) {
@@ -7254,61 +7254,6 @@ var getCenterOfLinkedFeature = function getCenterOfLinkedFeature(feature, srs) {
7254
7254
  return null;
7255
7255
  };
7256
7256
 
7257
- var OpenLayersFeatureLayerConnect = function OpenLayersFeatureLayerConnect(_ref) {
7258
- var layer = _ref.layer,
7259
- layerId = _ref.layerId,
7260
- zIndex = _ref.zIndex,
7261
- style = _ref.style,
7262
- hoverSelect = _ref.hoverSelect;
7263
- var store = useStore();
7264
- var dispatch = useDispatch();
7265
- var updateFeature = React__default.useCallback(function (geojson, reason) {
7266
- if (!layerId) {
7267
- window.console.error('updateFeature without layerId');
7268
- return;
7269
- }
7270
- var activeDrawToolId = drawingToolSelectors.getActiveDrawToolId(store.getState());
7271
- var activeDrawMode = drawingToolSelectors.getActiveDrawMode(store.getState(), activeDrawToolId);
7272
- dispatch(layerActions.updateFeature({
7273
- geojson: geojson,
7274
- reason: reason,
7275
- layerId: layerId,
7276
- shouldAllowMultipleShapes: drawingToolSelectors.getShouldAllowMultipleShapes(store.getState(), activeDrawToolId),
7277
- geoJSONIntersectionLayerId: drawingToolSelectors.getGeoJSONIntersectionLayerId(store.getState(), activeDrawToolId),
7278
- geoJSONIntersectionBoundsLayerId: drawingToolSelectors.getGeoJSONIntersectionBoundsLayerId(store.getState(), activeDrawToolId),
7279
- selectionType: activeDrawMode == null ? void 0 : activeDrawMode.selectionType
7280
- }));
7281
- }, [dispatch, store, layerId]);
7282
- var exitFeatureDrawMode = React__default.useCallback(function (reason) {
7283
- if (!layerId) {
7284
- window.console.error('exitFeatureDrawMode without layerId');
7285
- return;
7286
- }
7287
- var activeDrawToolId = drawingToolSelectors.getActiveDrawToolId(store.getState());
7288
- dispatch(layerActions.exitFeatureDrawMode({
7289
- reason: reason,
7290
- layerId: layerId,
7291
- shouldAllowMultipleShapes: drawingToolSelectors.getShouldAllowMultipleShapes(store.getState(), activeDrawToolId)
7292
- }));
7293
- }, [dispatch, store, layerId]);
7294
- return jsxs(Fragment, {
7295
- children: [jsx(OpenLayersFeatureLayer, {
7296
- featureCollection: !layer.isInEditMode ? layer.geojson : undefined,
7297
- zIndex: zIndex,
7298
- style: style,
7299
- hoverSelect: hoverSelect
7300
- }), jsx(OpenLayersMapDraw, {
7301
- drawMode: layer.drawMode,
7302
- viewOnlyStyle: style,
7303
- exitDrawModeCallback: exitFeatureDrawMode,
7304
- geojson: layer.geojson,
7305
- isInEditMode: layer.isInEditMode || false,
7306
- selectedFeatureIndex: layer.selectedFeatureIndex || 0,
7307
- updateGeojson: updateFeature
7308
- })]
7309
- });
7310
- };
7311
-
7312
7257
  var OlMapViewLayerConnect = function OlMapViewLayerConnect(layerProps) {
7313
7258
  var layerId = layerProps.layerId,
7314
7259
  mapId = layerProps.mapId,
@@ -7339,6 +7284,60 @@ var OlMapViewLayerConnect = function OlMapViewLayerConnect(layerProps) {
7339
7284
  }), "layer-" + (layer == null ? void 0 : layer.id));
7340
7285
  };
7341
7286
 
7287
+ /* *
7288
+ * Licensed under the Apache License, Version 2.0 (the "License");
7289
+ * you may not use this file except in compliance with the License.
7290
+ * You may obtain a copy of the License at
7291
+ *
7292
+ * http://www.apache.org/licenses/LICENSE-2.0
7293
+ *
7294
+ * Unless required by applicable law or agreed to in writing, software
7295
+ * distributed under the License is distributed on an "AS IS" BASIS,
7296
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
7297
+ * See the License for the specific language governing permissions and
7298
+ * limitations under the License.
7299
+ *
7300
+ * Copyright 2024 - Koninklijk Nederlands Meteorologisch Instituut (KNMI)
7301
+ * Copyright 2024 - Finnish Meteorological Institute (FMI)
7302
+ * Copyright 2024 - The Norwegian Meteorological Institute (MET Norway)
7303
+ * */
7304
+ var useGetOpenLayersView = function useGetOpenLayersView(mapId, store) {
7305
+ var _useState = useState(),
7306
+ view = _useState[0],
7307
+ setView = _useState[1];
7308
+ var _useState2 = useState(),
7309
+ name = _useState2[0],
7310
+ setName = _useState2[1];
7311
+ var syncGroupState = syncGroupsSelectors.getSynchronizationGroupState(store.getState());
7312
+ var syncGroupView = useMemo(function () {
7313
+ var thisAreaSyncGroupId = syncGroupState.groups.allIds.find(function (id) {
7314
+ var group = syncGroupState.groups.byId[id];
7315
+ return group.type === syncConstants.SYNCGROUPS_TYPE_SETBBOX && group.targets.allIds.indexOf(mapId) !== -1;
7316
+ });
7317
+ return thisAreaSyncGroupId ? getViewObjectForSyncGroup(thisAreaSyncGroupId) : null;
7318
+ }, [mapId, syncGroupState.groups]);
7319
+ useEffect(function () {
7320
+ var mapBbox = mapSelectors.getBbox(store.getState(), mapId);
7321
+ var storedView = syncGroupView || getViewObjectForMapId(mapId);
7322
+ if (storedView.view.getCenter() === undefined && mapBbox.left !== undefined) {
7323
+ storedView.view.fit([mapBbox.left, mapBbox.bottom, mapBbox.right, mapBbox.top]);
7324
+ }
7325
+ setName(storedView.name);
7326
+ var setViewFromStoredView = function setViewFromStoredView() {
7327
+ setView(storedView.view);
7328
+ };
7329
+ setViewFromStoredView();
7330
+ var eventKey = storedView.on('change', setViewFromStoredView);
7331
+ return function () {
7332
+ unByKey(eventKey);
7333
+ };
7334
+ }, [syncGroupView, mapId, store]);
7335
+ return {
7336
+ view: view,
7337
+ name: name
7338
+ };
7339
+ };
7340
+
7342
7341
  /**
7343
7342
  * Connected component used to display the map and selected layers.
7344
7343
  * Includes options to disable the map controls and legend.
@@ -7346,20 +7345,17 @@ var OlMapViewLayerConnect = function OlMapViewLayerConnect(layerProps) {
7346
7345
  * Expects the following props:
7347
7346
  * @param {string} mapId mapId: string - Id of the map
7348
7347
  * @param {object} [controls.zoomControls] **optional** controls: object - toggle the map controls, zoomControls defaults to true
7349
- * @param {boolean} [displayTimeInMap] **optional** displayTimeInMap: boolean, toggles the mapTime, defaults to true
7350
- * @param {boolean} [showScaleBar] **optional** showScaleBar: boolean, toggles the scaleBar, defaults to true
7351
- * @example
7352
- * ```<MapViewConnect mapId={mapId} controls={{ zoomControls: false }} displayTimeInMap={false} showScaleBar={false}/>```
7353
7348
  */
7354
7349
  var OlMapViewConnect = function OlMapViewConnect(_ref) {
7350
+ var _featureProperties$va;
7355
7351
  var mapId = _ref.mapId,
7352
+ children = _ref.children,
7356
7353
  _ref$controls = _ref.controls,
7357
7354
  controls = _ref$controls === void 0 ? {
7358
7355
  mapControlsPositionTop: 0,
7359
7356
  zoomControls: true
7360
7357
  } : _ref$controls,
7361
7358
  initialBbox = _ref.initialBbox,
7362
- children = _ref.children,
7363
7359
  holdShiftToScroll = _ref.holdShiftToScroll;
7364
7360
  var store = useStore();
7365
7361
  var mapRef = React.useRef(null);
@@ -7387,14 +7383,32 @@ var OlMapViewConnect = function OlMapViewConnect(_ref) {
7387
7383
  var _store$syncGroups;
7388
7384
  return genericSelectors.selectLinkedFeatures((_store$syncGroups = store.syncGroups) == null ? void 0 : _store$syncGroups.linkedState, mapId);
7389
7385
  });
7386
+ var linkedFormFeaturesFromState = useSelector(function (store) {
7387
+ var _store$syncGroups2;
7388
+ return genericSelectors.selectLinkedFormFeatures((_store$syncGroups2 = store.syncGroups) == null ? void 0 : _store$syncGroups2.linkedState, mapId);
7389
+ });
7390
7390
  var linkedFeatures = React.useMemo(function () {
7391
7391
  return {
7392
7392
  type: 'FeatureCollection',
7393
7393
  features: linkedFeaturesFromState.flatMap(function (feature) {
7394
- return feature.geoJSON.features;
7394
+ return feature.geoJSON.features.map(function (geoFeature) {
7395
+ return Object.assign({}, geoFeature, {
7396
+ properties: Object.assign({}, geoFeature.properties, {
7397
+ originalId: feature.originalId
7398
+ })
7399
+ });
7400
+ });
7395
7401
  })
7396
7402
  };
7397
7403
  }, [linkedFeaturesFromState]);
7404
+ var linkedFormFeatures = React.useMemo(function () {
7405
+ return {
7406
+ type: 'FeatureCollection',
7407
+ features: linkedFormFeaturesFromState.flatMap(function (feature) {
7408
+ return feature.geoJSON.features;
7409
+ })
7410
+ };
7411
+ }, [linkedFormFeaturesFromState]);
7398
7412
  var srs = useSelector(function (store) {
7399
7413
  return mapSelectors.getSrs(store, mapId);
7400
7414
  });
@@ -7415,10 +7429,10 @@ var OlMapViewConnect = function OlMapViewConnect(_ref) {
7415
7429
  var updateLayerInformation = React.useCallback(function (payload) {
7416
7430
  var _payload$layerDimensi, _payload$layerDimensi2;
7417
7431
  var updatedPayLoad = Object.assign({}, payload, {
7418
- origin: 'OnInitializeLayerProps in MapViewConnect',
7432
+ origin: 'updateLayerInformation in OlMapViewConnect',
7419
7433
  layerDimensions: {
7420
7434
  layerId: ((_payload$layerDimensi = payload.layerDimensions) == null ? void 0 : _payload$layerDimensi.layerId) || '',
7421
- origin: 'OnInitializeLayerProps in MapViewConnect',
7435
+ origin: 'updateLayerInformation in OlMapViewConnect',
7422
7436
  dimensions: (((_payload$layerDimensi2 = payload.layerDimensions) == null ? void 0 : _payload$layerDimensi2.dimensions) || []).map(function (layerDim) {
7423
7437
  return Object.assign({}, layerDim);
7424
7438
  })
@@ -7527,13 +7541,44 @@ var OlMapViewConnect = function OlMapViewConnect(_ref) {
7527
7541
  top: extent[3]
7528
7542
  },
7529
7543
  sourceId: mapId,
7530
- srs: srs
7544
+ srs: srs,
7545
+ mapId: mapId,
7546
+ origin: mapEnums.MapActionOrigin.map
7531
7547
  }));
7532
7548
  });
7533
7549
  return function () {
7534
7550
  unByKey(eventKey);
7535
7551
  };
7536
7552
  }, [view, mapId, srs, dispatch]);
7553
+ var featureProperties = hoverLinkedFeature == null || hoverLinkedFeature.getProperties == null ? void 0 : hoverLinkedFeature.getProperties();
7554
+ var hoverId = (featureProperties == null || (_featureProperties$va = featureProperties.values_) == null ? void 0 : _featureProperties$va.originalId) || (featureProperties == null ? void 0 : featureProperties.originalId);
7555
+ var previousHoverId = usePrevious(hoverId);
7556
+ React.useEffect(function () {
7557
+ var _featureProperties$st;
7558
+ if (!linkedPanelId || hoverId === previousHoverId) {
7559
+ return;
7560
+ }
7561
+ if (!hoverLinkedFeature) {
7562
+ dispatch(genericActions.addSharedData({
7563
+ panelId: linkedPanelId,
7564
+ data: {
7565
+ hoverId: undefined
7566
+ }
7567
+ }));
7568
+ return;
7569
+ }
7570
+ var currentOpacity = (_featureProperties$st = featureProperties == null ? void 0 : featureProperties['stroke-width']) != null ? _featureProperties$st : 1;
7571
+ var increasedOpacity = Math.min(currentOpacity + 0.2, 1);
7572
+ hoverLinkedFeature.setProperties(Object.assign({}, featureProperties, {
7573
+ 'stroke-opacity': increasedOpacity
7574
+ }));
7575
+ dispatch(genericActions.addSharedData({
7576
+ panelId: linkedPanelId,
7577
+ data: {
7578
+ hoverId: hoverId
7579
+ }
7580
+ }));
7581
+ }, [hoverId, previousHoverId, hoverLinkedFeature, featureProperties, linkedPanelId, dispatch]);
7537
7582
  var prefetchTimespan = makePrefetchTimeSpan(timeSliderStartCenterEndTime, animationStartTime, animationEndTime, isAnimating);
7538
7583
  var layerIds = mapLayerIds.join();
7539
7584
  var refetchLayers = React.useCallback(function () {
@@ -7544,35 +7589,38 @@ var OlMapViewConnect = function OlMapViewConnect(_ref) {
7544
7589
  while (1) switch (_context.prev = _context.next) {
7545
7590
  case 0:
7546
7591
  if (!layerId) {
7547
- _context.next = 15;
7592
+ _context.next = 17;
7548
7593
  break;
7549
7594
  }
7550
- _context.prev = 1;
7551
7595
  wmLayer = getWMLayerById(layerId);
7552
7596
  if (!wmLayer) {
7553
7597
  console.warn('No wmLayer exists for layer id', layerId);
7554
7598
  }
7599
+ _context.prev = 3;
7555
7600
  _context.next = 6;
7556
7601
  return wmLayer.parseLayer(true);
7557
7602
  case 6:
7558
- layerInfo = getLayerUpdateInfo(wmLayer, mapId);
7559
- updateLayerInformation && updateLayerInformation(layerInfo);
7560
- _context.next = 13;
7603
+ _context.next = 11;
7561
7604
  break;
7562
- case 10:
7563
- _context.prev = 10;
7564
- _context.t0 = _context["catch"](1);
7605
+ case 8:
7606
+ _context.prev = 8;
7607
+ _context.t0 = _context["catch"](3);
7565
7608
  window.console.error(_context.t0);
7566
- case 13:
7567
- _context.next = 16;
7568
- break;
7609
+ case 11:
7610
+ _context.prev = 11;
7611
+ layerInfo = getLayerUpdateInfo(wmLayer, mapId);
7612
+ updateLayerInformation && updateLayerInformation(layerInfo);
7613
+ return _context.finish(11);
7569
7614
  case 15:
7615
+ _context.next = 18;
7616
+ break;
7617
+ case 17:
7570
7618
  console.warn('Not updating layer, something is wrong.', layerId);
7571
- case 16:
7619
+ case 18:
7572
7620
  case "end":
7573
7621
  return _context.stop();
7574
7622
  }
7575
- }, _callee, null, [[1, 10]]);
7623
+ }, _callee, null, [[3, 8, 11, 15]]);
7576
7624
  }));
7577
7625
  return function (_x) {
7578
7626
  return _ref2.apply(this, arguments);
@@ -7631,6 +7679,12 @@ var OlMapViewConnect = function OlMapViewConnect(_ref) {
7631
7679
  }
7632
7680
  return style;
7633
7681
  }, [isSearchDialogOpen]);
7682
+ var combinedLinkedFeatures = React.useMemo(function () {
7683
+ return {
7684
+ type: 'FeatureCollection',
7685
+ features: [].concat(linkedFeatures.features, linkedFormFeatures.features)
7686
+ };
7687
+ }, [linkedFeatures, linkedFormFeatures]);
7634
7688
  return jsx(TimeContext.Provider, {
7635
7689
  value: prefetchTimespan,
7636
7690
  children: jsxs(OpenLayersMapView, {
@@ -7673,7 +7727,7 @@ var OlMapViewConnect = function OlMapViewConnect(_ref) {
7673
7727
  }, "featurelayer-" + (layer == null ? void 0 : layer.id));
7674
7728
  }), jsx(OpenLayersFeatureLayer, {
7675
7729
  style: genericOpenLayersFeatureStyle,
7676
- featureCollection: linkedFeatures,
7730
+ featureCollection: combinedLinkedFeatures,
7677
7731
  zIndex: 4000,
7678
7732
  hoverSelect: hoverSelect
7679
7733
  }), jsx(OpenLayersGetFeatureInfo, {
@@ -7706,7 +7760,7 @@ var OlMapViewConnect = function OlMapViewConnect(_ref) {
7706
7760
  showMapId: true,
7707
7761
  mapId: mapId,
7708
7762
  multiLegend: controls == null ? void 0 : controls.multiLegend
7709
- }), (controls == null ? void 0 : controls.search) && jsx(SearchDialogConnect, {
7763
+ }), (controls == null ? void 0 : controls.search) && jsx(LocationSearchConnect, {
7710
7764
  mapId: mapId
7711
7765
  }), (controls == null ? void 0 : controls.getFeatureInfo) && jsx(GetFeatureInfoConnect, {
7712
7766
  showMapId: true,
@@ -10063,4 +10117,4 @@ var LanguageSelect = function LanguageSelect(_ref) {
10063
10117
  });
10064
10118
  };
10065
10119
 
10066
- export { CORE_NAMESPACE, ConfigurableMapConnect, CoreI18nProvider, CoreStoreProvider, CoreThemeProvider, CoreThemeStoreProvider, DemoWrapper, DemoWrapperConnect, HarmonieTempAndPrecipPreset, LanguageSelect, LayerInfoButtonConnect, LayerInfoDialogConnect, LayerManager, BaseLayerRow as LayerManagerBaseLayerRow, LayerManagerConnect, DescriptionRow as LayerManagerDescriptionRow, HeaderOptions as LayerManagerHeaderOptions, LayerContainerRow as LayerManagerLayerContainerRow, LayerManagerMapButtonConnect, LegendConnect, LegendMapButtonConnect, MapViewConnect, MultiDimensionSelectMapButtonsConnect, MultiMapMultiDimensionSelectConnect as MultiMapDimensionSelectConnect, MultiMapViewConnect, MyMapLocation, OlMapViewConnect, RouterWrapperConnect, SearchControlButtonConnect, SearchDialog, SearchDialogConnect, SentryRecordButton, SyncGroupViewerConnect, TimeSliderConnect, ZoomControlConnect, componentsLookUp, coreTranslations, defaultBbox, defaultConfigurations, filterMapPresets, filterServices, filterTimeSeriesServices, getCenterOfLinkedFeature, getLanguageFromLocalStorage, languageLocalStorageKey, makeLayerInfoPayload, makePrefetchTimeSpan, saveLanguageToLocalStorage, testLayers, useFetchServices, useUpdateTimeSpan, useUpdateTimestep };
10120
+ export { CORE_NAMESPACE, ConfigurableMapConnect, CoreI18nProvider, CoreStoreProvider, CoreThemeProvider, CoreThemeStoreProvider, DemoWrapper, DemoWrapperConnect, HarmonieTempAndPrecipPreset, LanguageSelect, LayerInfoButtonConnect, LayerInfoDialogConnect, LayerManager, BaseLayerRow as LayerManagerBaseLayerRow, LayerManagerConnect, DescriptionRow as LayerManagerDescriptionRow, HeaderOptions as LayerManagerHeaderOptions, LayerContainerRow as LayerManagerLayerContainerRow, LayerManagerMapButtonConnect, LegendConnect, LegendMapButtonConnect, LocationSearch, LocationSearchConnect, MapViewConnect, MultiDimensionSelectMapButtonsConnect, MultiMapMultiDimensionSelectConnect as MultiMapDimensionSelectConnect, MultiMapViewConnect, MyMapLocation, OlMapViewConnect, RouterWrapperConnect, SearchControlButtonConnect, SentryRecordButton, SyncGroupViewerConnect, TimeSliderConnect, ZoomControlConnect, componentsLookUp, coreTranslations, defaultBbox, defaultConfigurations, filterMapPresets, filterServices, filterTimeSeriesServices, getCenterOfLinkedFeature, getLanguageFromLocalStorage, languageLocalStorageKey, makeLayerInfoPayload, makePrefetchTimeSpan, saveLanguageToLocalStorage, testLayers, useFetchServices, useUpdateTimeSpan, useUpdateTimestep };