@opengeoweb/core 10.1.0 → 10.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.
package/index.esm.js CHANGED
@@ -1,21 +1,24 @@
1
1
  import { jsxs, Fragment, jsx } from 'react/jsx-runtime';
2
2
  import * as React from 'react';
3
- import React__default, { useState, useCallback, useRef, 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, circularProgressClasses, ListItemIcon, Checkbox, Switch, Select } from '@mui/material';
3
+ import React__default, { useState, useCallback, useEffect, 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
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
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';
7
7
  import i18n from 'i18next';
8
8
  import { initReactI18next, 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, TimeSlider, onsetNewDateDebounced, getFilteredTime, ControlButtons, OptionsMenu, TimeSliderClock } from '@opengeoweb/timeslider';
10
- import { WEBMAP_REACT_NAMESPACE, webmapReactTranslations, WEBMAP_NAMESPACE, webmapTranslations, LayerInfoButton, LayerInfoDialog, MapControlButton, MapDimensionSelect, dimensionConfig, DimensionSelectDialog, DimensionSelectButton, registerDrawFunction, ZoomControls, LegendDialog, LegendButton, MapView, MapViewLayer, MapControls, emptyGeoJSON, publicLayers } from '@opengeoweb/webmap-react';
10
+ import { WEBMAP_REACT_NAMESPACE, webmapReactTranslations, WEBMAP_NAMESPACE, webmapTranslations, LayerInfoButton, LayerInfoDialog, MapControlButton, MapDimensionSelect, dimensionConfig, DimensionSelectDialog, DimensionSelectButton, emptyGeoJSON, registerDrawFunction, simplePointsGeojson, ZoomControls, LegendDialog, LegendButton, MapView, MapViewLayer, MapControls, 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, drawtoolSelectors, syncConstants, loadingIndicatorActions, syncGroupsSelectors, defaultLayers, getSingularDrawtoolDrawLayerId, syncGroupsSelector, syncGroupsActions, routerUtils } from '@opengeoweb/store';
15
- import _, { isArray, isEqual, debounce, range } from 'lodash';
16
- import { webmapUtils, queryWMSServiceInfo, queryWMSLayers, queryWMSLayersTree, invalidateWMSGetCapabilities, LayerType, getWMSServiceId, getWMSGetFeatureInfoRequestURL, handleDateUtilsISOString, wmServiceListener, EVENT_GETCAPABILITIES_START, EVENT_GETCAPABILITIES_READY, WMLayer } from '@opengeoweb/webmap';
15
+ import _, { isArray, isEqual, cloneDeep, debounce, range } from 'lodash';
16
+ import { webmapUtils, queryWMSServiceInfo, queryWMSLayers, queryWMSLayersTree, invalidateWMSGetCapabilities, LayerType, getWMSServiceId, generateLayerId, getWMJSMapById, getWMSGetFeatureInfoRequestURL, handleDateUtilsISOString, wmServiceListener, EVENT_GETCAPABILITIES_START, EVENT_GETCAPABILITIES_READY, WMLayer } from '@opengeoweb/webmap';
17
17
  import { Box as Box$1, styled as styled$1 } from '@mui/system';
18
18
  import { LayerSelectButtonConnect, LayerSelectConnect } from '@opengeoweb/layer-select';
19
+ import { useQuery, QueryClient, QueryClientProvider } from '@tanstack/react-query';
20
+ import { getConfig } from '@opengeoweb/authentication';
21
+ import { handleResponse } from '@opengeoweb/api';
19
22
  import axios from 'axios';
20
23
  import DOMPurify from 'dompurify';
21
24
  import { snackbarTypes, snackbarActions, SnackbarWrapperConnect } from '@opengeoweb/snackbar';
@@ -65,10 +68,13 @@ var en = {
65
68
  "wms-loader-error-http": "Use https or allow Mixed Content in your browser to use this WMS service",
66
69
  "wms-loader-error-valid-service": "Please enter a valid WMS service",
67
70
  "wms-loader-error-valid-url": "Please enter a valid URL",
68
- "search-title": "Search",
69
- "search-title-aria": "Map search",
70
- "search-find-location": "Find my location",
71
- "search-error": "Geolocation error: {{error}}",
71
+ "search-title": "Find location",
72
+ "search-title-aria": "Find location on the map",
73
+ "search-my-location": "Find my location",
74
+ "search-title-long": "Find location, area, postal code, GPS, ...",
75
+ "search-no-results": "No results",
76
+ "my-location": "My location",
77
+ "search-clear": "Clear",
72
78
  "syncgroups-title": "Sync",
73
79
  "syncgroups-zoom": "ZoomPane",
74
80
  "syncgroups-timeslider": "Timeslider",
@@ -140,8 +146,11 @@ var fi = {
140
146
  "wms-loader-error-valid-url": "Lisää toimiva URL",
141
147
  "search-title": "Etsi",
142
148
  "search-title-aria": "Karttahaku",
143
- "search-find-location": "Etsi sijaintini",
144
- "search-error": "Maantieteellisen sijainnin virhe: {{error}}",
149
+ "search-my-location": "Etsi sijaintini",
150
+ "search-title-long": "Find location, area, postal code, GPS, ...",
151
+ "search-no-results": "No results",
152
+ "my-location": "My location",
153
+ "search-clear": "Clear",
145
154
  "syncgroups-title": "Sync",
146
155
  "syncgroups-zoom": "ZoomPane",
147
156
  "syncgroups-timeslider": "TimeSlider",
@@ -213,8 +222,11 @@ var no = {
213
222
  "wms-loader-error-valid-url": "Vennligst skriv inn en gyldig URL",
214
223
  "search-title": "Søk",
215
224
  "search-title-aria": "Kart søk",
216
- "search-find-location": "Finn min lokasjon",
217
- "search-error": "Geolocation error: {{error}}",
225
+ "search-my-location": "Finn min lokasjon",
226
+ "search-title-long": "Find location, area, postal code, GPS, ...",
227
+ "search-no-results": "No results",
228
+ "my-location": "Min lokasjon",
229
+ "search-clear": "Clear",
218
230
  "syncgroups-title": "Synkroniser",
219
231
  "syncgroups-zoom": "Zoom/Paner",
220
232
  "syncgroups-timeslider": "Timeslider",
@@ -286,8 +298,11 @@ var nl = {
286
298
  "wms-loader-error-valid-url": "Voer een geldige URL in",
287
299
  "search-title": "Zoeken",
288
300
  "search-title-aria": "Zoeken op de kaart",
289
- "search-find-location": "Vind mijn locatie",
290
- "search-error": "Geolocatie fout: {{error}}",
301
+ "search-my-location": "Vind mijn locatie",
302
+ "search-title-long": "Vind locatie, gebied, postcode, GPS, ...",
303
+ "search-no-results": "Geen resultaten",
304
+ "my-location": "Mijn locatie",
305
+ "search-clear": "Wissen",
291
306
  "syncgroups-title": "Synchroniseren",
292
307
  "syncgroups-zoom": "Zoomvenster",
293
308
  "syncgroups-timeslider": "Timeslider",
@@ -5627,230 +5642,469 @@ var SearchControlButtonConnect = function SearchControlButtonConnect(_ref) {
5627
5642
  });
5628
5643
  };
5629
5644
 
5630
- var MY_LOCATION = 'MyLocation';
5645
+ var MY_LOCATION = 'My location';
5631
5646
  var locationOptions = {
5632
5647
  enableHighAccuracy: false,
5633
- timeout: 5000,
5648
+ timeout: 10000,
5634
5649
  maximumAge: 0
5635
5650
  };
5636
- var circleDrawFunction = function circleDrawFunction(args, fillColor, radius) {
5637
- if (fillColor === void 0) {
5638
- fillColor = '#88F';
5639
- }
5640
- if (radius === void 0) {
5641
- radius = 12;
5642
- }
5643
- var ctx = args.context,
5644
- coord = args.coord;
5645
- ctx.strokeStyle = '#000';
5646
- ctx.fillStyle = fillColor || '#88F';
5647
- ctx.lineWidth = 1;
5648
- ctx.beginPath();
5649
- ctx.arc(coord.x, coord.y, radius || 10, 0, 2 * Math.PI);
5650
- ctx.fill();
5651
- ctx.stroke();
5652
- ctx.fillStyle = '#000';
5653
- ctx.beginPath();
5654
- ctx.arc(coord.x, coord.y, 2, 0, 2 * Math.PI);
5655
- ctx.fill();
5656
- };
5657
5651
  var MyMapLocation = function MyMapLocation(_ref) {
5658
- var _sx;
5659
- var mapId = _ref.mapId,
5660
- isLoading = _ref.isLoading,
5661
- hasFailed = _ref.hasFailed,
5662
- setIsLoading = _ref.setIsLoading,
5663
- setHasFailed = _ref.setHasFailed;
5652
+ var _ref$mapId = _ref.mapId,
5653
+ mapId = _ref$mapId === void 0 ? '' : _ref$mapId,
5654
+ _ref$isSelected = _ref.isSelected,
5655
+ isSelected = _ref$isSelected === void 0 ? false : _ref$isSelected,
5656
+ _ref$onUpdateMyLocati = _ref.onUpdateMyLocation,
5657
+ onUpdateMyLocation = _ref$onUpdateMyLocati === void 0 ? function () {} : _ref$onUpdateMyLocati;
5658
+ var theme = useTheme();
5659
+ var _useState = useState(false),
5660
+ isLoading = _useState[0],
5661
+ setIsLoading = _useState[1];
5662
+ var _useState2 = useState(false),
5663
+ hasFailed = _useState2[0],
5664
+ setHasFailed = _useState2[1];
5664
5665
  var _useCoreTranslation = useCoreTranslation(),
5665
5666
  t = _useCoreTranslation.t;
5666
- var dispatch = useDispatch();
5667
- var layersBelongsToCurrentMapId = useSelector(function (store) {
5668
- return layerSelectors.getLayersByMapId(store, mapId || '');
5669
- });
5670
- var layerLocation = layersBelongsToCurrentMapId.find(function (layer) {
5671
- var _layer$geojson$featur;
5672
- if (layer.geojson && layer.geojson.features[0] && layer.geojson.features[0].properties && (_layer$geojson$featur = layer.geojson.features[0].properties) != null && _layer$geojson$featur.name) {
5673
- if (layer.geojson.features[0].properties.name === MY_LOCATION) {
5674
- return layer;
5675
- }
5676
- }
5677
- return undefined;
5678
- });
5679
- var layerLocationId = (layerLocation == null ? void 0 : layerLocation.id) || '';
5680
- var circleDrawFunctionId = useRef(registerDrawFunction(circleDrawFunction));
5681
5667
  var handleLocationClick = function handleLocationClick() {
5682
- setIsLoading(true);
5683
- if (mapId && layerLocationId !== '') {
5684
- dispatch(layerActions.layerDelete({
5685
- mapId: mapId,
5686
- layerId: layerLocationId
5687
- }));
5688
- setIsLoading(false);
5689
- } else if (navigator.geolocation && mapId && layerLocationId === '' && circleDrawFunctionId) {
5668
+ if (mapId && isSelected) {
5669
+ onUpdateMyLocation(undefined);
5670
+ } else if (navigator.geolocation && mapId && !isSelected) {
5671
+ setIsLoading(true);
5672
+ setHasFailed(false);
5690
5673
  navigator.geolocation.getCurrentPosition(function (success) {
5691
5674
  setIsLoading(false);
5692
- setHasFailed(false);
5693
5675
  var _success$coords = success.coords,
5694
5676
  latitude = _success$coords.latitude,
5695
5677
  longitude = _success$coords.longitude;
5696
- var geojson = {
5697
- type: 'FeatureCollection',
5698
- features: [{
5699
- type: 'Feature',
5700
- properties: {
5701
- name: MY_LOCATION,
5702
- drawFunctionId: circleDrawFunctionId.current
5703
- },
5704
- geometry: {
5705
- type: 'Point',
5706
- coordinates: [longitude, latitude]
5707
- }
5708
- }]
5678
+ var location = {
5679
+ lat: latitude,
5680
+ lon: longitude,
5681
+ name: MY_LOCATION,
5682
+ source: 'MyMapLocation',
5683
+ id: MY_LOCATION
5709
5684
  };
5710
- var layerId = webmapUtils.generateLayerId();
5711
- dispatch(layerActions.addLayer({
5712
- mapId: mapId,
5713
- layer: {
5714
- geojson: geojson,
5715
- layerType: LayerType.featureLayer
5716
- },
5717
- layerId: layerId,
5718
- origin: MY_LOCATION
5719
- }));
5720
- var wmjsMap = webmapUtils.getWMJSMapById(mapId);
5721
- if (!wmjsMap) {
5722
- return;
5723
- }
5724
- wmjsMap.calculateBoundingBoxAndZoom(latitude, longitude);
5725
- }, function (error) {
5685
+ onUpdateMyLocation(location);
5686
+ }, function () {
5726
5687
  setIsLoading(false);
5727
5688
  setHasFailed(true);
5728
- console.warn(t('search-error', {
5729
- error: error.message
5730
- }));
5689
+ onUpdateMyLocation(undefined);
5731
5690
  }, locationOptions);
5732
5691
  }
5733
5692
  };
5734
5693
  var chooseIcon = function chooseIcon() {
5735
5694
  return hasFailed ? jsx(Exclamation, {
5736
5695
  style: {
5737
- color: 'red'
5696
+ color: theme.palette.geowebColors.functional.error
5738
5697
  },
5739
5698
  "aria-label": "location error"
5740
5699
  }) : jsx(MyLocation, {
5741
5700
  "aria-label": "location default"
5742
5701
  });
5743
5702
  };
5744
- return jsx("div", {
5745
- children: isLoading ? jsxs(Fragment, {
5746
- children: [jsx(CircularProgress, {
5747
- value: 100,
5748
- variant: "determinate",
5749
- sx: {
5750
- height: '100%',
5751
- width: '100%',
5752
- color: function color(theme) {
5753
- return theme.palette.mode === 'light' ? '#1a90ff' : '#bad4ff';
5754
- },
5755
- padding: '8px'
5756
- },
5757
- thickness: 6,
5758
- "aria-label": "location loading"
5759
- }), jsx(CircularProgress, {
5760
- variant: "indeterminate",
5761
- disableShrink: true,
5762
- sx: (_sx = {
5763
- height: '100%',
5764
- width: '100%',
5765
- color: function color(theme) {
5766
- return theme.palette.mode === 'light' ? '#bad4ff' : '#45556F';
5767
- },
5768
- animationDuration: '1000ms',
5769
- position: 'absolute',
5770
- left: 0
5771
- }, _sx["& ." + circularProgressClasses.circle] = {
5772
- strokeLinecap: 'round'
5773
- }, _sx.padding = '8px', _sx),
5774
- thickness: 6
5775
- })]
5703
+ return jsx(Box, {
5704
+ sx: {
5705
+ height: 40,
5706
+ padding: 1
5707
+ },
5708
+ children: isLoading ? jsx(CircularProgress, {
5709
+ size: 24,
5710
+ "aria-label": "Location loading",
5711
+ color: "secondary"
5776
5712
  }) : jsx(CustomIconButton, {
5777
- title: t('search-find-location'),
5778
- "aria-label": MY_LOCATION,
5713
+ tooltipTitle: t('search-my-location'),
5714
+ "aria-label": t('search-my-location'),
5779
5715
  onClick: handleLocationClick,
5780
- isSelected: layerLocationId !== '',
5781
- size: "large",
5716
+ isSelected: isSelected,
5717
+ variant: "tool",
5718
+ size: "small",
5782
5719
  children: chooseIcon()
5783
5720
  })
5784
5721
  });
5785
5722
  };
5786
5723
 
5724
+ /* *
5725
+ * Licensed under the Apache License, Version 2.0 (the "License");
5726
+ * you may not use this file except in compliance with the License.
5727
+ * You may obtain a copy of the License at
5728
+ *
5729
+ * http://www.apache.org/licenses/LICENSE-2.0
5730
+ *
5731
+ * Unless required by applicable law or agreed to in writing, software
5732
+ * distributed under the License is distributed on an "AS IS" BASIS,
5733
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
5734
+ * See the License for the specific language governing permissions and
5735
+ * limitations under the License.
5736
+ *
5737
+ * Copyright 2025 - Koninklijk Nederlands Meteorologisch Instituut (KNMI)
5738
+ * Copyright 2025 - Finnish Meteorological Institute (FMI)
5739
+ * Copyright 2025 - The Norwegian Meteorological Institute (MET Norway)
5740
+ * */
5741
+ var config = getConfig();
5742
+ var locationBaseUrl = config.GW_LOCATION_BASE_URL || '';
5743
+ var getLocationList = function getLocationList(search) {
5744
+ return fetch(locationBaseUrl + "/locations?search=" + search).then(handleResponse);
5745
+ };
5746
+ var getLocationDetail = function getLocationDetail(id, source) {
5747
+ return fetch(locationBaseUrl + "/locationdetail?id=" + id + "&source=" + source).then(handleResponse);
5748
+ };
5749
+
5750
+ /* *
5751
+ * Licensed under the Apache License, Version 2.0 (the "License");
5752
+ * you may not use this file except in compliance with the License.
5753
+ * You may obtain a copy of the License at
5754
+ *
5755
+ * http://www.apache.org/licenses/LICENSE-2.0
5756
+ *
5757
+ * Unless required by applicable law or agreed to in writing, software
5758
+ * distributed under the License is distributed on an "AS IS" BASIS,
5759
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
5760
+ * See the License for the specific language governing permissions and
5761
+ * limitations under the License.
5762
+ *
5763
+ * Copyright 2025 - Koninklijk Nederlands Meteorologisch Instituut (KNMI)
5764
+ * Copyright 2025 - Finnish Meteorological Institute (FMI)
5765
+ * Copyright 2025 - The Norwegian Meteorological Institute (MET Norway)
5766
+ * */
5767
+ var useLocationList = function useLocationList(search) {
5768
+ return useQuery({
5769
+ queryKey: ['location-list', search],
5770
+ queryFn: function queryFn() {
5771
+ return getLocationList(search);
5772
+ },
5773
+ enabled: !!search
5774
+ });
5775
+ };
5776
+ var useLocationDetail = function useLocationDetail(_ref) {
5777
+ var id = _ref.id,
5778
+ source = _ref.source;
5779
+ return useQuery({
5780
+ queryKey: ['location-detail', {
5781
+ id: id,
5782
+ source: source
5783
+ }],
5784
+ queryFn: function queryFn() {
5785
+ return getLocationDetail(id, source);
5786
+ },
5787
+ enabled: !!id
5788
+ });
5789
+ };
5790
+
5787
5791
  var SearchDialog = function SearchDialog(_ref) {
5788
5792
  var isOpen = _ref.isOpen,
5789
- onClose = _ref.onClose,
5790
5793
  _ref$mapId = _ref.mapId,
5791
- mapId = _ref$mapId === void 0 ? '' : _ref$mapId;
5794
+ mapId = _ref$mapId === void 0 ? '' : _ref$mapId,
5795
+ _ref$onSelectLocation = _ref.onSelectLocation,
5796
+ onSelectLocation = _ref$onSelectLocation === void 0 ? function () {} : _ref$onSelectLocation,
5797
+ _ref$onUpdateMyLocati = _ref.onUpdateMyLocation,
5798
+ onUpdateMyLocation = _ref$onUpdateMyLocati === void 0 ? function () {} : _ref$onUpdateMyLocati,
5799
+ _ref$isMyLocationSele = _ref.isMyLocationSelected,
5800
+ isMyLocationSelected = _ref$isMyLocationSele === void 0 ? false : _ref$isMyLocationSele;
5801
+ var theme = useTheme();
5792
5802
  var _useCoreTranslation = useCoreTranslation(),
5793
5803
  t = _useCoreTranslation.t;
5794
- var _useState = useState(false),
5795
- isLoading = _useState[0],
5796
- setIsLoading = _useState[1];
5797
- var _useState2 = useState(false),
5798
- hasFailed = _useState2[0],
5799
- setHasFailed = _useState2[1];
5800
- return isOpen && mapId ? jsxs(Box$1, {
5804
+ var _useState = useState(''),
5805
+ inputValue = _useState[0],
5806
+ setInputValue = _useState[1];
5807
+ var _useState2 = useState(null),
5808
+ selectedValue = _useState2[0],
5809
+ setSelectedValue = _useState2[1];
5810
+ var debouncedInputValue = useDebounce(inputValue, 300);
5811
+ var _useLocationList = useLocationList(debouncedInputValue),
5812
+ locationListData = _useLocationList.data;
5813
+ var _useLocationDetail = useLocationDetail({
5814
+ id: (selectedValue == null ? void 0 : selectedValue.id) || '',
5815
+ source: (selectedValue == null ? void 0 : selectedValue.source) || ''
5816
+ }),
5817
+ locationDetail = _useLocationDetail.data;
5818
+ useEffect(function () {
5819
+ onSelectLocation(locationDetail);
5820
+ }, [locationDetail, onSelectLocation]);
5821
+ return isOpen && mapId ? jsxs(Box, {
5801
5822
  sx: {
5802
5823
  display: 'flex',
5803
5824
  flexDirection: 'row',
5804
5825
  alignItems: 'center',
5805
5826
  position: 'absolute',
5806
5827
  pointerEvents: 'all',
5807
- zIndex: 999,
5828
+ zIndex: 99,
5808
5829
  left: 50,
5809
- top: 15,
5810
- borderBottom: '1px solid grey',
5811
- backgroundColor: function backgroundColor(theme) {
5812
- return theme.palette.background.paper;
5813
- }
5830
+ top: 8,
5831
+ backgroundColor: theme.palette.geowebColors.textInputField["default"].fill,
5832
+ height: 40,
5833
+ boxShadow: theme.shadows[6],
5834
+ width: 'calc(100% - 50px)',
5835
+ maxWidth: 380
5814
5836
  },
5815
5837
  children: [jsx(MyMapLocation, {
5816
5838
  mapId: mapId,
5817
- isLoading: isLoading,
5818
- hasFailed: hasFailed,
5819
- setIsLoading: setIsLoading,
5820
- setHasFailed: setHasFailed
5821
- }), jsx(TextField, {
5822
- id: "dummy-search-field",
5823
- label: t('search-title'),
5824
- variant: "filled",
5825
- slotProps: {
5826
- input: {
5827
- disableUnderline: true,
5828
- endAdornment: jsx(InputAdornment, {
5829
- position: "end",
5830
- children: jsx(CustomIconButton, {
5831
- tooltipTitle: t('actions-close'),
5832
- edge: "end",
5833
- onClick: onClose,
5834
- size: "large",
5839
+ onUpdateMyLocation: onUpdateMyLocation,
5840
+ isSelected: isMyLocationSelected
5841
+ }), jsx(Autocomplete, {
5842
+ disablePortal: true,
5843
+ selectOnFocus: true,
5844
+ sx: {
5845
+ width: '100%',
5846
+ '&.MuiAutocomplete-root .MuiFilledInput-root': {
5847
+ height: 40,
5848
+ padding: '0px!important',
5849
+ '&:before, &:hover:before': {
5850
+ borderColor: 'transparent'
5851
+ }
5852
+ },
5853
+ '&.MuiAutocomplete-root .MuiInputLabel-root': {
5854
+ lineHeight: '16px',
5855
+ maxWidth: 'calc(100% - 40px)',
5856
+ ':not(.MuiInputLabel-shrink)': {
5857
+ transform: 'translate(12px, 12px) scale(1)'
5858
+ }
5859
+ },
5860
+ '&.MuiAutocomplete-root .MuiFilledInput-input': {
5861
+ lineHeight: '20px',
5862
+ paddingLeft: '12px',
5863
+ paddingTop: '20px'
5864
+ }
5865
+ },
5866
+ getOptionLabel: function getOptionLabel(option) {
5867
+ return option.name;
5868
+ },
5869
+ filterOptions: function filterOptions(x) {
5870
+ return x;
5871
+ },
5872
+ options: locationListData || [],
5873
+ noOptionsText: t('search-no-results'),
5874
+ popupIcon: null,
5875
+ clearIcon: null,
5876
+ onChange: function onChange(_event, newValue) {
5877
+ if (newValue && typeof newValue !== 'string') {
5878
+ setSelectedValue(newValue);
5879
+ setInputValue(newValue.name);
5880
+ }
5881
+ },
5882
+ value: selectedValue,
5883
+ inputValue: inputValue,
5884
+ isOptionEqualToValue: function isOptionEqualToValue(option, value) {
5885
+ return option.id === value.id;
5886
+ },
5887
+ renderInput: function renderInput(params) {
5888
+ return jsx(TextField, Object.assign({}, params, {
5889
+ autoFocus: true,
5890
+ size: "medium",
5891
+ label: t('search-title-long'),
5892
+ fullWidth: true,
5893
+ variant: "filled",
5894
+ onChange: function onChange(event) {
5895
+ setInputValue(event.target.value);
5896
+ if (selectedValue) {
5897
+ setSelectedValue(null);
5898
+ }
5899
+ },
5900
+ InputProps: Object.assign({}, params.InputProps, {
5901
+ endAdornment: jsx(CustomIconButton, {
5902
+ tooltipTitle: t('search-clear'),
5903
+ onClick: function onClick() {
5904
+ setInputValue('');
5905
+ setSelectedValue(null);
5906
+ },
5907
+ sx: {
5908
+ marginRight: 1
5909
+ },
5835
5910
  children: jsx(Close, {})
5836
5911
  })
5837
5912
  })
5838
- }
5913
+ }));
5839
5914
  }
5840
5915
  })]
5841
5916
  }) : null;
5842
5917
  };
5843
5918
 
5844
- var SearchControlConnect = function SearchControlConnect(_ref) {
5845
- var mapId = _ref.mapId;
5919
+ /* *
5920
+ * Licensed under the Apache License, Version 2.0 (the "License");
5921
+ * you may not use this file except in compliance with the License.
5922
+ * You may obtain a copy of the License at
5923
+ *
5924
+ * http://www.apache.org/licenses/LICENSE-2.0
5925
+ *
5926
+ * Unless required by applicable law or agreed to in writing, software
5927
+ * distributed under the License is distributed on an "AS IS" BASIS,
5928
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
5929
+ * See the License for the specific language governing permissions and
5930
+ * limitations under the License.
5931
+ *
5932
+ * Copyright 2025 - Koninklijk Nederlands Meteorologisch Instituut (KNMI)
5933
+ * Copyright 2025 - Finnish Meteorological Institute (FMI)
5934
+ * Copyright 2025 - The Norwegian Meteorological Institute (MET Norway)
5935
+ * */
5936
+ var myLocationDrawFunction = function myLocationDrawFunction(args) {
5937
+ var ctx = args.context,
5938
+ coord = args.coord;
5939
+ // Draw outer circle
5940
+ ctx.fillStyle = '#fff';
5941
+ ctx.shadowColor = '#00000080';
5942
+ ctx.shadowBlur = 4;
5943
+ ctx.beginPath();
5944
+ ctx.arc(coord.x, coord.y, 14, 0, 2 * Math.PI);
5945
+ ctx.fill();
5946
+ ctx.shadowBlur = 0;
5947
+ // Draw inner circle
5948
+ ctx.fillStyle = '#186dff';
5949
+ ctx.beginPath();
5950
+ ctx.arc(coord.x, coord.y, 10, 0, 2 * Math.PI);
5951
+ ctx.fill();
5952
+ };
5953
+ var selectedLocationDrawFunction = function selectedLocationDrawFunction(args) {
5954
+ var ctx = args.context,
5955
+ coord = args.coord;
5956
+ ctx.fillStyle = '#051039';
5957
+ ctx.beginPath();
5958
+ var topRadius = 7;
5959
+ var topHeight = 2 * topRadius;
5960
+ ctx.arc(coord.x, coord.y - topHeight, topRadius, Math.PI, Math.PI * 2);
5961
+ ctx.bezierCurveTo(coord.x + topRadius, coord.y - topHeight, coord.x + topRadius / 1.6, coord.y - topRadius, coord.x, coord.y);
5962
+ ctx.bezierCurveTo(coord.x, coord.y, coord.x - topRadius / 1.6, coord.y - topRadius, coord.x - topRadius, coord.y - topHeight);
5963
+ ctx.stroke();
5964
+ ctx.fill();
5965
+ /* Fill center circle */
5966
+ ctx.fillStyle = '#FFF';
5967
+ ctx.beginPath();
5968
+ ctx.arc(coord.x, coord.y - topHeight, topRadius / 2.5, Math.PI * 2, 0);
5969
+ ctx.fill();
5970
+ };
5971
+ var makeGeoJSONFeatureFromLocation = function makeGeoJSONFeatureFromLocation(location, drawFunctionId, hoverDrawFunctionId) {
5972
+ var newGeoJSON = cloneDeep(simplePointsGeojson);
5973
+ newGeoJSON.features = [{
5974
+ type: 'Feature',
5975
+ properties: {
5976
+ name: location.name,
5977
+ drawFunctionId: drawFunctionId,
5978
+ hoverDrawFunctionId: hoverDrawFunctionId
5979
+ },
5980
+ geometry: {
5981
+ type: 'Point',
5982
+ coordinates: [location.lon, location.lat]
5983
+ }
5984
+ }];
5985
+ return newGeoJSON;
5986
+ };
5987
+ var fitText = function fitText(ctx, text, x, y, lineheight) {
5988
+ var lines = text.split('\n');
5989
+ for (var i = 0; i < lines.length; i += 1) {
5990
+ ctx.fillText(lines[i], x, y + i * lineheight);
5991
+ }
5992
+ };
5993
+ var roundRect = function roundRect(ctx, w, h, x, y, radius) {
5994
+ if (radius === void 0) {
5995
+ radius = 2;
5996
+ }
5997
+ var r = x + w;
5998
+ var b = y + h;
5999
+ ctx.beginPath();
6000
+ ctx.moveTo(x + radius, y);
6001
+ ctx.lineTo(r - radius, y);
6002
+ ctx.quadraticCurveTo(r, y, r, y + radius);
6003
+ ctx.lineTo(r, y + h - radius);
6004
+ ctx.quadraticCurveTo(r, b, r - radius, b);
6005
+ ctx.lineTo(x + radius, b);
6006
+ ctx.quadraticCurveTo(x, b, x, b - radius);
6007
+ ctx.lineTo(x, y + radius);
6008
+ ctx.quadraticCurveTo(x, y, x + radius, y);
6009
+ ctx.stroke();
6010
+ ctx.fill();
6011
+ };
6012
+ var hoverDrawFunction = function hoverDrawFunction(args) {
6013
+ var ctx = args.context,
6014
+ coord = args.coord,
6015
+ feature = args.feature;
6016
+ var fontSize = 16;
6017
+ var padding = 20;
6018
+ // eslint-disable-next-line no-param-reassign
6019
+ ctx.font = fontSize + "px Roboto";
6020
+ var x = coord.x,
6021
+ y = coord.y;
6022
+ ctx.fillStyle = '#000';
6023
+ roundRect(ctx, ctx.measureText(feature.properties.name).width + padding, fontSize + padding, x - padding * 0.5 - ctx.measureText(feature.properties.name).width * 0.5, y + padding);
6024
+ // eslint-disable-next-line no-param-reassign
6025
+ ctx.fillStyle = '#FFF';
6026
+ // eslint-disable-next-line no-param-reassign
6027
+ ctx.textAlign = 'left';
6028
+ if (feature && feature.properties) {
6029
+ fitText(ctx, feature.properties.name, x - ctx.measureText(feature.properties.name).width * 0.5, y + padding * 2, fontSize);
6030
+ }
6031
+ };
6032
+ var useDrawOnMap = function useDrawOnMap(mapId, drawFunction) {
6033
+ var dispatch = useDispatch();
6034
+ var layerId = React__default.useRef(generateLayerId()).current;
6035
+ var isMapPresent = useSelector(function (store) {
6036
+ return mapSelectors.getIsMapPresent(store, mapId);
6037
+ });
6038
+ var isLayerPresent = useSelector(function (store) {
6039
+ return layerSelectors.getIsLayerPresent(store, layerId);
6040
+ });
6041
+ var shouldAddLayer = isMapPresent && !isLayerPresent;
6042
+ React__default.useEffect(function () {
6043
+ if (shouldAddLayer) {
6044
+ dispatch(layerActions.addLayer({
6045
+ mapId: mapId,
6046
+ layerId: layerId,
6047
+ layer: {
6048
+ geojson: emptyGeoJSON,
6049
+ layerType: LayerType.featureLayer
6050
+ },
6051
+ origin: 'SearchDialogConnect'
6052
+ }));
6053
+ }
6054
+ }, [dispatch, layerId, mapId, shouldAddLayer]);
6055
+ var drawFunctionId = React__default.useRef(registerDrawFunction(drawFunction)).current;
6056
+ var hoverDrawFunctionId = React__default.useRef(registerDrawFunction(hoverDrawFunction)).current;
6057
+ var updateGeoJSON = React__default.useCallback(function (location) {
6058
+ var geojson = location ? makeGeoJSONFeatureFromLocation(location, drawFunctionId, hoverDrawFunctionId) : emptyGeoJSON;
6059
+ dispatch(layerActions.updateFeature({
6060
+ layerId: layerId,
6061
+ geojson: geojson
6062
+ }));
6063
+ }, [dispatch, drawFunctionId, hoverDrawFunctionId, layerId]);
6064
+ var zoomToFeature = React__default.useCallback(function (location) {
6065
+ var webMap = getWMJSMapById(mapId);
6066
+ if (webMap) {
6067
+ webMap.calculateBoundingBoxAndZoom(location.lat, location.lon);
6068
+ }
6069
+ }, [mapId]);
6070
+ var onUpdateLocation = React__default.useCallback(function (location) {
6071
+ updateGeoJSON(location);
6072
+ if (location) {
6073
+ zoomToFeature(location);
6074
+ }
6075
+ }, [updateGeoJSON, zoomToFeature]);
6076
+ return [onUpdateLocation];
6077
+ };
6078
+
6079
+ var SearchDialogConnect = function SearchDialogConnect(_ref) {
6080
+ var _ref$mapId = _ref.mapId,
6081
+ mapId = _ref$mapId === void 0 ? '' : _ref$mapId;
5846
6082
  var dialogType = uiTypes.DialogTypes.Search + "-" + mapId;
5847
6083
  var _useSetupDialog = useSetupDialog(dialogType),
5848
- isDialogOpen = _useSetupDialog.isDialogOpen,
5849
- onCloseDialog = _useSetupDialog.onCloseDialog;
6084
+ isDialogOpen = _useSetupDialog.isDialogOpen;
6085
+ var _useDrawOnMap = useDrawOnMap(mapId, selectedLocationDrawFunction),
6086
+ updateMapPin = _useDrawOnMap[0];
6087
+ var _useDrawOnMap2 = useDrawOnMap(mapId, myLocationDrawFunction),
6088
+ updateMyLocation = _useDrawOnMap2[0];
6089
+ var mapLayers = useSelector(function (store) {
6090
+ return layerSelectors.getLayersByMapId(store, mapId);
6091
+ });
6092
+ var myLocationLayer = mapLayers.find(function (layer) {
6093
+ var _layer$geojson;
6094
+ if ((_layer$geojson = layer.geojson) != null && (_layer$geojson = _layer$geojson.features[0]) != null && (_layer$geojson = _layer$geojson.properties) != null && _layer$geojson.name) {
6095
+ if (layer.geojson.features[0].properties.name === MY_LOCATION) {
6096
+ return true;
6097
+ }
6098
+ }
6099
+ return false;
6100
+ });
6101
+ var isMyLocationSelected = !!myLocationLayer;
5850
6102
  return jsx(SearchDialog, {
5851
6103
  isOpen: isDialogOpen,
5852
- onClose: onCloseDialog,
5853
- mapId: mapId
6104
+ mapId: mapId,
6105
+ onSelectLocation: updateMapPin,
6106
+ onUpdateMyLocation: updateMyLocation,
6107
+ isMyLocationSelected: isMyLocationSelected
5854
6108
  });
5855
6109
  };
5856
6110
 
@@ -6754,7 +7008,7 @@ var MapViewConnect = function MapViewConnect(_ref) {
6754
7008
  showMapId: true,
6755
7009
  mapId: mapId,
6756
7010
  multiLegend: controls == null ? void 0 : controls.multiLegend
6757
- }), jsx(SearchControlConnect, {
7011
+ }), (controls == null ? void 0 : controls.search) && jsx(SearchDialogConnect, {
6758
7012
  mapId: mapId
6759
7013
  }), (controls == null ? void 0 : controls.getFeatureInfo) && jsx(GetFeatureInfoConnect, {
6760
7014
  showMapId: true,
@@ -6981,7 +7235,8 @@ var TimeSpanButtonConnect = function TimeSpanButtonConnect(_ref) {
6981
7235
  }));
6982
7236
  dispatch(mapActions.setTimeSliderSpan({
6983
7237
  mapId: mapId,
6984
- timeSliderSpan: spanInSeconds
7238
+ timeSliderSpan: spanInSeconds,
7239
+ origin: mapEnums.MapActionOrigin.map
6985
7240
  }));
6986
7241
  dispatch(mapActions.setTimeSliderCenterTime({
6987
7242
  mapId: mapId,
@@ -7450,10 +7705,7 @@ var useUpdateTimeSpan = function useUpdateTimeSpan(mapId, myOnSetTimeSliderSpan)
7450
7705
  }
7451
7706
  };
7452
7707
  React.useEffect(function () {
7453
- if (!activeLayerTimeDimension) {
7454
- return;
7455
- }
7456
- if (isTimeSpanAuto && autoTimeStepLayerId) {
7708
+ if (isTimeSpanAuto && autoTimeStepLayerId && activeLayerTimeDimension) {
7457
7709
  var _getTimeBounds = getTimeBounds([activeLayerTimeDimension]),
7458
7710
  startTime = _getTimeBounds.startTime,
7459
7711
  endTime = _getTimeBounds.endTime;
@@ -8138,6 +8390,9 @@ var useGetReferenceTimes = function useGetReferenceTimes(inputLayer) {
8138
8390
  var _React$useState = React.useState([]),
8139
8391
  referenceTimes = _React$useState[0],
8140
8392
  setReferenceTimes = _React$useState[1];
8393
+ var _React$useState2 = React.useState(null),
8394
+ error = _React$useState2[0],
8395
+ setError = _React$useState2[1];
8141
8396
  React.useEffect(function () {
8142
8397
  var referenceTimes = [];
8143
8398
  var wmLayer = new WMLayer(Object.assign({}, inputLayer));
@@ -8150,9 +8405,14 @@ var useGetReferenceTimes = function useGetReferenceTimes(inputLayer) {
8150
8405
  referenceTimes.push(referenceTimeValue);
8151
8406
  }
8152
8407
  setReferenceTimes(referenceTimes);
8153
- })["catch"](console.error);
8408
+ })["catch"](function (error) {
8409
+ setError(error);
8410
+ });
8154
8411
  }, [inputLayer]);
8155
- return referenceTimes;
8412
+ return {
8413
+ referenceTimes: referenceTimes,
8414
+ error: error
8415
+ };
8156
8416
  };
8157
8417
  var HarmonieTempAndPrecipPreset = function HarmonieTempAndPrecipPreset(_ref) {
8158
8418
  var layers = _ref.layers,
@@ -8161,7 +8421,14 @@ var HarmonieTempAndPrecipPreset = function HarmonieTempAndPrecipPreset(_ref) {
8161
8421
  var displayLayerManagerAndLegendButtonInAllTopRows = !useHasSyncGroupWithLayerActions(layers && layers.topRowSyncGroups);
8162
8422
  var displayLayerManagerAndLegendButtonInAllBottomRows = !useHasSyncGroupWithLayerActions(layers && layers.bottomRowSyncGroups);
8163
8423
  /* Get all the reference times for this layer */
8164
- var referenceTimes = useGetReferenceTimes(layers.topRow);
8424
+ var _useGetReferenceTimes = useGetReferenceTimes(layers.topRow),
8425
+ referenceTimes = _useGetReferenceTimes.referenceTimes,
8426
+ error = _useGetReferenceTimes.error;
8427
+ if (error) {
8428
+ return jsx(AlertBanner, {
8429
+ title: error.message
8430
+ });
8431
+ }
8165
8432
  if (referenceTimes.length === 0) {
8166
8433
  return jsx("div", {
8167
8434
  children: "Loading..."
@@ -8756,17 +9023,19 @@ var CoreThemeProvider = function CoreThemeProvider(_ref) {
8756
9023
  var children = _ref.children,
8757
9024
  _ref$theme = _ref.theme,
8758
9025
  theme = _ref$theme === void 0 ? lightTheme : _ref$theme;
8759
- return jsx(ThemeWrapper, {
8760
- theme: theme,
8761
- children: children
9026
+ var queryClient = new QueryClient({
9027
+ defaultOptions: {
9028
+ queries: {
9029
+ retry: false
9030
+ }
9031
+ }
8762
9032
  });
8763
- };
8764
- var ThemeWrapperWithModules = function ThemeWrapperWithModules(_ref2) {
8765
- var theme = _ref2.theme,
8766
- children = _ref2.children;
8767
- return jsx(CoreThemeProvider, {
9033
+ return jsx(ThemeWrapper, {
8768
9034
  theme: theme,
8769
- children: children
9035
+ children: jsx(QueryClientProvider, {
9036
+ client: queryClient,
9037
+ children: children
9038
+ })
8770
9039
  });
8771
9040
  };
8772
9041
  /**
@@ -8775,14 +9044,14 @@ var ThemeWrapperWithModules = function ThemeWrapperWithModules(_ref2) {
8775
9044
  * @param children
8776
9045
  * @returns
8777
9046
  */
8778
- var CoreThemeStoreProvider = function CoreThemeStoreProvider(_ref3) {
8779
- var children = _ref3.children,
8780
- _ref3$theme = _ref3.theme,
8781
- theme = _ref3$theme === void 0 ? lightTheme : _ref3$theme,
8782
- store = _ref3.store;
9047
+ var CoreThemeStoreProvider = function CoreThemeStoreProvider(_ref2) {
9048
+ var children = _ref2.children,
9049
+ _ref2$theme = _ref2.theme,
9050
+ theme = _ref2$theme === void 0 ? lightTheme : _ref2$theme,
9051
+ store = _ref2.store;
8783
9052
  return jsx(Provider, {
8784
9053
  store: store,
8785
- children: jsx(ThemeWrapperWithModules, {
9054
+ children: jsx(CoreThemeProvider, {
8786
9055
  theme: theme,
8787
9056
  children: jsx(SnackbarWrapperConnect, {
8788
9057
  children: children
@@ -8790,8 +9059,8 @@ var CoreThemeStoreProvider = function CoreThemeStoreProvider(_ref3) {
8790
9059
  })
8791
9060
  });
8792
9061
  };
8793
- var CoreI18nProvider = function CoreI18nProvider(_ref4) {
8794
- var children = _ref4.children;
9062
+ var CoreI18nProvider = function CoreI18nProvider(_ref3) {
9063
+ var children = _ref3.children;
8795
9064
  initCoreReactI18n();
8796
9065
  return jsx(I18nextProvider, {
8797
9066
  i18n: i18n,
@@ -9017,4 +9286,4 @@ var LanguageSelect = function LanguageSelect(_ref) {
9017
9286
  });
9018
9287
  };
9019
9288
 
9020
- export { CORE_NAMESPACE, ConfigurableMapConnect, CoreI18nProvider, 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, RouterWrapperConnect, SearchControlButtonConnect, SearchControlConnect, SearchDialog, SentryRecordButton, SyncGroupViewerConnect, ThemeWrapperWithModules, TimeSliderConnect, ZoomControlConnect, componentsLookUp, coreTranslations, defaultBbox, defaultConfigurations, filterMapPresets, filterServices, filterTimeSeriesServices, getLanguageFromLocalStorage, languageLocalStorageKey, saveLanguageToLocalStorage, testLayers, useFetchServices, useUpdateTimeSpan, useUpdateTimestep };
9289
+ export { CORE_NAMESPACE, ConfigurableMapConnect, CoreI18nProvider, 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, RouterWrapperConnect, SearchControlButtonConnect, SearchDialog, SearchDialogConnect, SentryRecordButton, SyncGroupViewerConnect, TimeSliderConnect, ZoomControlConnect, componentsLookUp, coreTranslations, defaultBbox, defaultConfigurations, filterMapPresets, filterServices, filterTimeSeriesServices, getLanguageFromLocalStorage, languageLocalStorageKey, saveLanguageToLocalStorage, testLayers, useFetchServices, useUpdateTimeSpan, useUpdateTimestep };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@opengeoweb/core",
3
- "version": "10.1.0",
3
+ "version": "10.2.0",
4
4
  "description": "GeoWeb Core library for the opengeoweb project",
5
5
  "license": "Apache-2.0",
6
6
  "repository": {
@@ -29,7 +29,11 @@
29
29
  "react-i18next": "^15.1.1",
30
30
  "dompurify": "^3.0.6",
31
31
  "@mui/material": "^6.1.1",
32
- "@sentry/react": "^8.34.0"
32
+ "@sentry/react": "^8.34.0",
33
+ "@tanstack/react-query": "^5.62.7",
34
+ "@opengeoweb/authentication": "*",
35
+ "@opengeoweb/api": "*",
36
+ "msw": "^1.3.3"
33
37
  },
34
38
  "peerDependencies": {
35
39
  "react": "18",
@@ -1,6 +1,5 @@
1
1
  import React from 'react';
2
2
  import { Theme } from '@mui/material';
3
- import { ThemeProviderProps } from '@opengeoweb/theme';
4
3
  import { Store } from '@reduxjs/toolkit';
5
4
  interface CoreThemeProviderProps {
6
5
  children?: React.ReactNode;
@@ -15,7 +14,6 @@ interface CoreTranslationWrapperProps {
15
14
  * @returns
16
15
  */
17
16
  export declare const CoreThemeProvider: React.FC<CoreThemeProviderProps>;
18
- export declare const ThemeWrapperWithModules: React.FC<ThemeProviderProps>;
19
17
  interface CoreThemeStoreProviderProps extends CoreThemeProviderProps {
20
18
  store: Store;
21
19
  }
@@ -1,10 +1,9 @@
1
1
  import React from 'react';
2
+ import { LocationDetail } from './types';
2
3
  export interface MyMapLocationProps {
3
- mapId: string | undefined;
4
- isLoading: boolean;
5
- hasFailed: boolean;
6
- setIsLoading: (value: boolean) => void;
7
- setHasFailed: (value: boolean) => void;
4
+ mapId?: string;
5
+ isSelected?: boolean;
6
+ onUpdateMyLocation?: (location?: LocationDetail) => void;
8
7
  }
9
- export declare const MY_LOCATION = "MyLocation";
8
+ export declare const MY_LOCATION = "My location";
10
9
  export declare const MyMapLocation: React.FC<MyMapLocationProps>;
@@ -1,7 +1,10 @@
1
1
  import React from 'react';
2
+ import { LocationDetail } from './types';
2
3
  export interface SearchDialogProps {
3
4
  isOpen: boolean;
4
- onClose: () => void;
5
5
  mapId?: string;
6
+ onSelectLocation?: (location?: LocationDetail) => void;
7
+ onUpdateMyLocation?: (location?: LocationDetail) => void;
8
+ isMyLocationSelected?: boolean;
6
9
  }
7
10
  export declare const SearchDialog: React.FC<SearchDialogProps>;
@@ -3,11 +3,11 @@ declare const _default: {
3
3
  title: string;
4
4
  };
5
5
  export default _default;
6
- export declare const SearchControlConnectStoryLight: {
6
+ export declare const SearchDialogLight: {
7
7
  (): React.ReactElement;
8
- storyName: string;
8
+ tags: string[];
9
9
  };
10
- export declare const SearchControlConnectStoryDark: {
10
+ export declare const SearchDialogDark: {
11
11
  (): React.ReactElement;
12
- storyName: string;
12
+ tags: string[];
13
13
  };
@@ -0,0 +1,5 @@
1
+ import React from 'react';
2
+ export interface SearchDialogConnectProps {
3
+ mapId?: string;
4
+ }
5
+ export declare const SearchDialogConnect: React.FC<SearchDialogConnectProps>;
@@ -0,0 +1,7 @@
1
+ import * as React from 'react';
2
+ declare const _default: {
3
+ title: string;
4
+ };
5
+ export default _default;
6
+ export declare const SearchDialogConnectLight: () => React.ReactElement;
7
+ export declare const SearchDialogConnectDark: () => React.ReactElement;
@@ -1,4 +1,4 @@
1
1
  export { SearchControlButtonConnect } from './SearchControlButtonConnect';
2
- export { SearchControlConnect } from './SearchControlConnect';
2
+ export { SearchDialogConnect } from './SearchDialogConnect';
3
3
  export { SearchDialog } from './SearchDialog';
4
4
  export { MyMapLocation } from './MyMapLocation';
@@ -0,0 +1,13 @@
1
+ export interface LocationDetail {
2
+ id: string;
3
+ name: string;
4
+ source: string;
5
+ lat: number;
6
+ lon: number;
7
+ geometry?: GeoJSON.GeoJSON;
8
+ }
9
+ export interface LocationListResult {
10
+ id: string;
11
+ name: string;
12
+ source: string;
13
+ }
@@ -0,0 +1,6 @@
1
+ import { MapDrawDrawFunctionArgs } from '@opengeoweb/webmap-react';
2
+ import { LocationDetail } from './types';
3
+ export declare const myLocationDrawFunction: (args: MapDrawDrawFunctionArgs) => void;
4
+ export declare const selectedLocationDrawFunction: (args: MapDrawDrawFunctionArgs) => void;
5
+ export declare const hoverDrawFunction: (args: MapDrawDrawFunctionArgs) => void;
6
+ export declare const useDrawOnMap: (mapId: string, drawFunction: (args: MapDrawDrawFunctionArgs) => void) => [(location?: LocationDetail) => void];
@@ -0,0 +1,3 @@
1
+ import { LocationListResult, LocationDetail } from '../../components/Search/types';
2
+ export declare const getLocationList: (search: string) => Promise<LocationListResult[]>;
3
+ export declare const getLocationDetail: (id: string, source: string) => Promise<LocationDetail>;
@@ -0,0 +1,40 @@
1
+ export declare const fakeLocationList: {
2
+ id: string;
3
+ name: string;
4
+ source: string;
5
+ }[];
6
+ export declare const fakeLocationDetailList: ({
7
+ id: string;
8
+ name: string;
9
+ source: string;
10
+ lon: number;
11
+ lat: number;
12
+ geometry?: undefined;
13
+ } | {
14
+ lat: number;
15
+ lon: number;
16
+ source: string;
17
+ id: string;
18
+ name: string;
19
+ geometry: {
20
+ type: string;
21
+ geometry: {
22
+ type: string;
23
+ coordinates: number[];
24
+ };
25
+ };
26
+ } | {
27
+ lat: number;
28
+ lon: number;
29
+ source: string;
30
+ id: string;
31
+ name: string;
32
+ geometry: {
33
+ type: string;
34
+ geometry: {
35
+ type: string;
36
+ coordinates: number[][][];
37
+ };
38
+ };
39
+ })[];
40
+ export declare const locationApiEndpoints: import("msw").RestHandler<import("msw").MockedRequest<import("msw").DefaultBodyType>>[];
@@ -0,0 +1,9 @@
1
+ import { UseQueryResult } from '@tanstack/react-query';
2
+ import { LocationDetail, LocationListResult } from '../../components/Search/types';
3
+ export declare const useLocationList: (search: string) => UseQueryResult<LocationListResult[]>;
4
+ interface DetailProps {
5
+ id: string;
6
+ source: string;
7
+ }
8
+ export declare const useLocationDetail: ({ id, source, }: DetailProps) => UseQueryResult<LocationDetail>;
9
+ export {};
@@ -1,5 +0,0 @@
1
- import React from 'react';
2
- export interface SearchControlConnectProps {
3
- mapId?: string;
4
- }
5
- export declare const SearchControlConnect: React.FC<SearchControlConnectProps>;