@opengeoweb/time-series 19.2.0 → 19.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.esm.js +339 -247
- package/dist/src/lib/components/TimeSeries/TimeSeriesConnect.d.ts +0 -4
- package/dist/src/lib/components/TimeSeries/constants.d.ts +2 -0
- package/dist/src/lib/components/TimeSeries/useTimeSeriesLocations.d.ts +12 -0
- package/dist/src/lib/components/TimeSeries/utils.d.ts +1 -0
- package/package.json +1 -1
package/dist/index.esm.js
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
|
|
2
2
|
import React, { useCallback, useMemo, useState, useEffect, memo } from 'react';
|
|
3
3
|
import { useDispatch, useSelector } from 'react-redux';
|
|
4
|
-
import { CustomIconButton, dateUtils, TooltipSelect, referenceTimeUtils, CustomAccordion, CustomTooltip, CustomToggleButton, ToolContainerDraggable, ToggleMenu, CustomDialog, SearchField, SearchHighlight, AlertBanner, useConfirmationDialog, SwitchButton, useResizeObserver } from '@opengeoweb/shared';
|
|
4
|
+
import { CustomIconButton, dateUtils, TooltipSelect, referenceTimeUtils, CustomAccordion, CustomTooltip, CustomToggleButton, ToolContainerDraggable, ToggleMenu, CustomDialog, SearchField, SearchHighlight, AlertBanner, useConfirmationDialog, SwitchButton, LegendToggleButton, useResizeObserver } from '@opengeoweb/shared';
|
|
5
5
|
import { snackbarActions, snackbarTypes, snackbarListener, snackbarReducer } from '@opengeoweb/snackbar';
|
|
6
6
|
import { mapUtils, selectorMemoizationOptions, genericSelectors, uiSelectors, uiTypes, uiActions, useSetupDialog, mapSelectors, mapListener, serviceListener, layersListener, syncGroupsListener, genericListener, openlayersListener, uiReducer, syncGroupsReducer, layerReducer, serviceReducer, mapReducer, loadingIndicatorActions, useRegisterFeatureSyncSource, useUpdateFeatureSyncLayers, useSyncgroupTimeState, mapActions, layerActions } from '@opengeoweb/store';
|
|
7
7
|
import { useTheme, MenuItem, LinearProgress, Grid, Box, Typography, ClickAwayListener, Input, Collapse, Button, List, ListItem, ListItemText, InputAdornment, ListItemButton, styled, Card, Stack, Tooltip, ListItemIcon, Checkbox } from '@mui/material';
|
|
8
8
|
import { isString, trim, trimStart, compact, chain, groupBy, countBy, sortBy, uniqBy, isEqual } from 'lodash';
|
|
9
9
|
import { ReactSortable } from 'react-sortablejs';
|
|
10
|
-
import { Info, ArrowDropDownDown, Copy, Delete, Visibility, VisibilityOff, TimeSeriesSelect as TimeSeriesSelect$1, DragHandle, ChevronUp, ChevronDown, Add, DimensionsTime, DrawRegion, Cached, Edit, useThemeContext, EChartsDarkTheme, EChartsLightTheme, Layers,
|
|
10
|
+
import { Info, ArrowDropDownDown, Copy, Delete, Visibility, VisibilityOff, TimeSeriesSelect as TimeSeriesSelect$1, DragHandle, ChevronUp, ChevronDown, Add, DimensionsTime, DrawRegion, Cached, Edit, Location, useThemeContext, EChartsDarkTheme, EChartsLightTheme, Layers, LockLocked, LockUnlocked } from '@opengeoweb/theme';
|
|
11
11
|
import i18n from 'i18next';
|
|
12
12
|
import { useTranslation } from 'react-i18next';
|
|
13
13
|
import '@opengeoweb/core';
|
|
@@ -2582,7 +2582,8 @@ var createGeoJsonArrays = function createGeoJsonArrays(locations, services, hide
|
|
|
2582
2582
|
});
|
|
2583
2583
|
return acc;
|
|
2584
2584
|
}, initialAccumulator),
|
|
2585
|
-
obj = _locations$reduce.obj
|
|
2585
|
+
obj = _locations$reduce.obj,
|
|
2586
|
+
collectionMap = _locations$reduce.collectionMap;
|
|
2586
2587
|
var combinedGeoJson = {
|
|
2587
2588
|
type: 'FeatureCollection',
|
|
2588
2589
|
features: Object.keys(obj).map(function (key) {
|
|
@@ -2601,7 +2602,8 @@ var createGeoJsonArrays = function createGeoJsonArrays(locations, services, hide
|
|
|
2601
2602
|
})
|
|
2602
2603
|
};
|
|
2603
2604
|
return {
|
|
2604
|
-
combinedGeoJson: combinedGeoJson
|
|
2605
|
+
combinedGeoJson: combinedGeoJson,
|
|
2606
|
+
splitGeoJsonByCollection: Object.values(collectionMap)
|
|
2605
2607
|
};
|
|
2606
2608
|
};
|
|
2607
2609
|
var getNearbyLocation = function getNearbyLocation(parameter, service, selectedLocation, geojsonMap) {
|
|
@@ -6797,6 +6799,27 @@ var createMockStore = function createMockStore(mockState) {
|
|
|
6797
6799
|
});
|
|
6798
6800
|
};
|
|
6799
6801
|
|
|
6802
|
+
/* *
|
|
6803
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
6804
|
+
* you may not use this file except in compliance with the License.
|
|
6805
|
+
* You may obtain a copy of the License at
|
|
6806
|
+
*
|
|
6807
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
6808
|
+
*
|
|
6809
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
6810
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
6811
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
6812
|
+
* See the License for the specific language governing permissions and
|
|
6813
|
+
* limitations under the License.
|
|
6814
|
+
*
|
|
6815
|
+
* Copyright 2026 - Koninklijk Nederlands Meteorologisch Instituut (KNMI)
|
|
6816
|
+
* Copyright 2026 - Finnish Meteorological Institute (FMI)
|
|
6817
|
+
* Copyright 2026 - The Norwegian Meteorological Institute (MET Norway)
|
|
6818
|
+
* */
|
|
6819
|
+
var TIME_SERIES_CONTAINER_BREAKPOINT_PX = '720px';
|
|
6820
|
+
var TIME_SERIES_CONTAINER_NAME = 'time-series-container';
|
|
6821
|
+
|
|
6822
|
+
var _styled;
|
|
6800
6823
|
var _excluded$1 = ["icon", "shortText", "longText"];
|
|
6801
6824
|
var TimeSeriesTopRowButtonUnstyled = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
|
|
6802
6825
|
var icon = _ref.icon,
|
|
@@ -6815,30 +6838,27 @@ var TimeSeriesTopRowButtonUnstyled = /*#__PURE__*/React.forwardRef(function (_re
|
|
|
6815
6838
|
})]
|
|
6816
6839
|
}));
|
|
6817
6840
|
});
|
|
6818
|
-
var TimeSeriesTopRowButton = styled(TimeSeriesTopRowButtonUnstyled)({
|
|
6819
|
-
height: '10px !important'
|
|
6820
|
-
|
|
6821
|
-
|
|
6822
|
-
|
|
6823
|
-
|
|
6824
|
-
},
|
|
6825
|
-
'& svg': {
|
|
6826
|
-
marginRight: '0 !important'
|
|
6827
|
-
}
|
|
6828
|
-
},
|
|
6829
|
-
'@container time-series-container (width >= 720px)': {
|
|
6830
|
-
width: '130px',
|
|
6831
|
-
'& .shortText': {
|
|
6832
|
-
display: 'none'
|
|
6833
|
-
}
|
|
6841
|
+
var TimeSeriesTopRowButton = styled(TimeSeriesTopRowButtonUnstyled)((_styled = {
|
|
6842
|
+
height: '10px !important'
|
|
6843
|
+
}, _styled["@container " + TIME_SERIES_CONTAINER_NAME + " (width < " + TIME_SERIES_CONTAINER_BREAKPOINT_PX + ")"] = {
|
|
6844
|
+
maxWidth: '90px',
|
|
6845
|
+
'& .longText': {
|
|
6846
|
+
display: 'none'
|
|
6834
6847
|
},
|
|
6835
|
-
'&
|
|
6836
|
-
|
|
6837
|
-
whiteSpace: 'nowrap',
|
|
6838
|
-
textOverflow: 'ellipsis',
|
|
6839
|
-
overflow: 'hidden'
|
|
6848
|
+
'& svg': {
|
|
6849
|
+
marginRight: '0 !important'
|
|
6840
6850
|
}
|
|
6841
|
-
})
|
|
6851
|
+
}, _styled["@container " + TIME_SERIES_CONTAINER_NAME + " (min-width: " + TIME_SERIES_CONTAINER_BREAKPOINT_PX + ")"] = {
|
|
6852
|
+
width: '130px',
|
|
6853
|
+
'& .shortText': {
|
|
6854
|
+
display: 'none'
|
|
6855
|
+
}
|
|
6856
|
+
}, _styled['& span'] = {
|
|
6857
|
+
fontSize: '9pt',
|
|
6858
|
+
whiteSpace: 'nowrap',
|
|
6859
|
+
textOverflow: 'ellipsis',
|
|
6860
|
+
overflow: 'hidden'
|
|
6861
|
+
}, _styled));
|
|
6842
6862
|
|
|
6843
6863
|
var LocationInfoButtonConnect = function LocationInfoButtonConnect(_ref) {
|
|
6844
6864
|
var panelId = _ref.panelId,
|
|
@@ -6873,13 +6893,78 @@ var LocationInfoButtonConnect = function LocationInfoButtonConnect(_ref) {
|
|
|
6873
6893
|
});
|
|
6874
6894
|
};
|
|
6875
6895
|
|
|
6896
|
+
var LocationSelectButtonConnect = function LocationSelectButtonConnect(_ref) {
|
|
6897
|
+
var _timeSeriesLocation$o, _sx;
|
|
6898
|
+
var panelId = _ref.panelId;
|
|
6899
|
+
var dispatch = useDispatch();
|
|
6900
|
+
var _useTimeseriesTransla = useTimeseriesTranslation(),
|
|
6901
|
+
t = _useTimeseriesTransla.t;
|
|
6902
|
+
var timeSeriesLocation = useSelector(function (state) {
|
|
6903
|
+
return getCurrentLocation(state, panelId);
|
|
6904
|
+
});
|
|
6905
|
+
var currentSourcePanelId = useSelector(function (store) {
|
|
6906
|
+
return uiSelectors.getSourcePanelId(store, uiTypes.DialogTypes.TimeseriesLocations);
|
|
6907
|
+
});
|
|
6908
|
+
var isLocationsDialogOpen = useSelector(function (store) {
|
|
6909
|
+
return uiSelectors.getisDialogOpen(store, uiTypes.DialogTypes.TimeseriesLocations);
|
|
6910
|
+
});
|
|
6911
|
+
var isMapPinDisabled = useSelector(function (state) {
|
|
6912
|
+
return getIsMapPinDisabled(state, panelId);
|
|
6913
|
+
});
|
|
6914
|
+
var isLocationsDialogOpenRef = React.useRef(isLocationsDialogOpen);
|
|
6915
|
+
var currentSourcePanelIdRef = React.useRef(currentSourcePanelId);
|
|
6916
|
+
React.useEffect(function () {
|
|
6917
|
+
isLocationsDialogOpenRef.current = isLocationsDialogOpen;
|
|
6918
|
+
currentSourcePanelIdRef.current = currentSourcePanelId;
|
|
6919
|
+
}, [isLocationsDialogOpen, currentSourcePanelId]);
|
|
6920
|
+
var selectedLocationName = typeof (timeSeriesLocation == null || (_timeSeriesLocation$o = timeSeriesLocation.occurrences) == null || (_timeSeriesLocation$o = _timeSeriesLocation$o[0]) == null || (_timeSeriesLocation$o = _timeSeriesLocation$o.properties) == null ? void 0 : _timeSeriesLocation$o.name) === 'string' ? timeSeriesLocation.occurrences[0].properties.name : '';
|
|
6921
|
+
var toggleLocationsDialog = function toggleLocationsDialog() {
|
|
6922
|
+
dispatch(uiActions.setToggleOpenDialog({
|
|
6923
|
+
type: uiTypes.DialogTypes.TimeseriesLocations,
|
|
6924
|
+
setOpen: currentSourcePanelId !== panelId ? true : !isLocationsDialogOpen,
|
|
6925
|
+
sourcePanelId: panelId
|
|
6926
|
+
}));
|
|
6927
|
+
};
|
|
6928
|
+
React.useEffect(function () {
|
|
6929
|
+
return function () {
|
|
6930
|
+
if (isLocationsDialogOpenRef.current && currentSourcePanelIdRef.current === panelId) {
|
|
6931
|
+
dispatch(uiActions.setToggleOpenDialog({
|
|
6932
|
+
setOpen: false,
|
|
6933
|
+
type: uiTypes.DialogTypes.TimeseriesLocations,
|
|
6934
|
+
sourcePanelId: panelId
|
|
6935
|
+
}));
|
|
6936
|
+
}
|
|
6937
|
+
};
|
|
6938
|
+
}, [dispatch, panelId]);
|
|
6939
|
+
return jsx(CustomTooltip, {
|
|
6940
|
+
title: selectedLocationName || t('timeseries-select-location'),
|
|
6941
|
+
children: jsx("span", {
|
|
6942
|
+
children: jsx(TimeSeriesTopRowButton, {
|
|
6943
|
+
"aria-label": t('timeseries-location'),
|
|
6944
|
+
"data-testid": "locationSelectButton",
|
|
6945
|
+
disabled: isMapPinDisabled,
|
|
6946
|
+
icon: jsx(Location, {
|
|
6947
|
+
sx: (_sx = {}, _sx["@container " + TIME_SERIES_CONTAINER_NAME + " (width < " + TIME_SERIES_CONTAINER_BREAKPOINT_PX + ")"] = {
|
|
6948
|
+
display: 'none'
|
|
6949
|
+
}, _sx)
|
|
6950
|
+
}),
|
|
6951
|
+
longText: selectedLocationName || t('timeseries-location'),
|
|
6952
|
+
onClick: toggleLocationsDialog,
|
|
6953
|
+
selected: isLocationsDialogOpen ? currentSourcePanelId === panelId : null,
|
|
6954
|
+
shortText: selectedLocationName || t('timeseries-location')
|
|
6955
|
+
})
|
|
6956
|
+
})
|
|
6957
|
+
});
|
|
6958
|
+
};
|
|
6959
|
+
|
|
6876
6960
|
var TimeSeriesMarkersSwitch = function TimeSeriesMarkersSwitch(_ref) {
|
|
6961
|
+
var _sx;
|
|
6877
6962
|
var shouldHideMarkers = _ref.shouldHideMarkers,
|
|
6878
6963
|
toggleMarkers = _ref.toggleMarkers;
|
|
6879
6964
|
var _useTimeseriesTransla = useTimeseriesTranslation(),
|
|
6880
6965
|
t = _useTimeseriesTransla.t;
|
|
6881
6966
|
return jsxs(Box, {
|
|
6882
|
-
sx: {
|
|
6967
|
+
sx: (_sx = {
|
|
6883
6968
|
display: 'flex',
|
|
6884
6969
|
flexWrap: 'wrap',
|
|
6885
6970
|
alignItems: 'flex-start',
|
|
@@ -6895,14 +6980,13 @@ var TimeSeriesMarkersSwitch = function TimeSeriesMarkersSwitch(_ref) {
|
|
|
6895
6980
|
},
|
|
6896
6981
|
'.markers-label': {
|
|
6897
6982
|
display: 'none'
|
|
6898
|
-
},
|
|
6899
|
-
'@container time-series-container (min-width: 720px)': {
|
|
6900
|
-
minWidth: '146px',
|
|
6901
|
-
'.markers-label, .switch-button label': {
|
|
6902
|
-
display: 'initial'
|
|
6903
|
-
}
|
|
6904
6983
|
}
|
|
6905
|
-
},
|
|
6984
|
+
}, _sx["@container " + TIME_SERIES_CONTAINER_NAME + " (min-width: " + TIME_SERIES_CONTAINER_BREAKPOINT_PX + ")"] = {
|
|
6985
|
+
minWidth: '146px',
|
|
6986
|
+
'.markers-label, .switch-button label': {
|
|
6987
|
+
display: 'initial'
|
|
6988
|
+
}
|
|
6989
|
+
}, _sx),
|
|
6906
6990
|
children: [jsx(Typography, {
|
|
6907
6991
|
className: "markers-label",
|
|
6908
6992
|
sx: {
|
|
@@ -7825,6 +7909,109 @@ var TimeSeriesView = /*#__PURE__*/React.memo(function (_ref2) {
|
|
|
7825
7909
|
return samePreset && sameLocation && sameGeoJson && sameLegend && sameServices && sameTime;
|
|
7826
7910
|
});
|
|
7827
7911
|
|
|
7912
|
+
/* *
|
|
7913
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
7914
|
+
* you may not use this file except in compliance with the License.
|
|
7915
|
+
* You may obtain a copy of the License at
|
|
7916
|
+
*
|
|
7917
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
7918
|
+
*
|
|
7919
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
7920
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
7921
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
7922
|
+
* See the License for the specific language governing permissions and
|
|
7923
|
+
* limitations under the License.
|
|
7924
|
+
*
|
|
7925
|
+
* Copyright 2026 - Koninklijk Nederlands Meteorologisch Instituut (KNMI)
|
|
7926
|
+
* Copyright 2026 - Finnish Meteorological Institute (FMI)
|
|
7927
|
+
* Copyright 2026 - The Norwegian Meteorological Institute (MET Norway)
|
|
7928
|
+
* */
|
|
7929
|
+
var getUniqueServicesFromPreset = function getUniqueServicesFromPreset(parameters, services) {
|
|
7930
|
+
if (!parameters.length || !services.length) {
|
|
7931
|
+
return [];
|
|
7932
|
+
}
|
|
7933
|
+
var options = parameters.map(function (_ref) {
|
|
7934
|
+
var serviceId = _ref.serviceId,
|
|
7935
|
+
collectionId = _ref.collectionId;
|
|
7936
|
+
var service = services.find(function (item) {
|
|
7937
|
+
return item.id === serviceId;
|
|
7938
|
+
});
|
|
7939
|
+
return service ? {
|
|
7940
|
+
service: service,
|
|
7941
|
+
collectionId: collectionId
|
|
7942
|
+
} : null;
|
|
7943
|
+
}).filter(function (item) {
|
|
7944
|
+
return item !== null;
|
|
7945
|
+
});
|
|
7946
|
+
return options.filter(function (current, index, array) {
|
|
7947
|
+
return index === array.findIndex(function (item) {
|
|
7948
|
+
return item.service.id === current.service.id && item.collectionId === current.collectionId;
|
|
7949
|
+
});
|
|
7950
|
+
});
|
|
7951
|
+
};
|
|
7952
|
+
var useTimeSeriesLocations = function useTimeSeriesLocations(panelId) {
|
|
7953
|
+
var _linkedMapIds$;
|
|
7954
|
+
var services = useSelector(function (state) {
|
|
7955
|
+
return getServices(state);
|
|
7956
|
+
});
|
|
7957
|
+
var shouldHideLocationMarkers = useSelector(function (state) {
|
|
7958
|
+
return getShouldHideLocationMarkers(state, panelId);
|
|
7959
|
+
});
|
|
7960
|
+
var plotPresetState = useSelector(function (state) {
|
|
7961
|
+
return getPlotState(state, panelId);
|
|
7962
|
+
});
|
|
7963
|
+
var linkedMapIds = useSelector(function (state) {
|
|
7964
|
+
return genericSelectors.getLinkedTargetIds(state, panelId);
|
|
7965
|
+
});
|
|
7966
|
+
var panelMapId = (_linkedMapIds$ = linkedMapIds == null ? void 0 : linkedMapIds[0]) != null ? _linkedMapIds$ : plotPresetState == null ? void 0 : plotPresetState.mapId;
|
|
7967
|
+
var selectedFeatureFromPanel = useSelector(function (state) {
|
|
7968
|
+
return genericSelectors.getSelectedFeature(state, panelId);
|
|
7969
|
+
});
|
|
7970
|
+
var selectedFeatureFromMap = useSelector(function (state) {
|
|
7971
|
+
return panelMapId ? genericSelectors.getSelectedFeature(state, panelMapId) : null;
|
|
7972
|
+
});
|
|
7973
|
+
var selectedFeature = selectedFeatureFromPanel != null ? selectedFeatureFromPanel : selectedFeatureFromMap;
|
|
7974
|
+
var memoizedSelectedFeature = React.useMemo(function () {
|
|
7975
|
+
if (!selectedFeature) {
|
|
7976
|
+
return null;
|
|
7977
|
+
}
|
|
7978
|
+
return {
|
|
7979
|
+
lat: selectedFeature.lat,
|
|
7980
|
+
lon: selectedFeature.lon,
|
|
7981
|
+
id: selectedFeature.id,
|
|
7982
|
+
occurrences: selectedFeature.occurrences
|
|
7983
|
+
};
|
|
7984
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
7985
|
+
}, [selectedFeature == null ? void 0 : selectedFeature.lat, selectedFeature == null ? void 0 : selectedFeature.lon]);
|
|
7986
|
+
var parameters = React.useMemo(function () {
|
|
7987
|
+
return (plotPresetState == null ? void 0 : plotPresetState.parameters) || [];
|
|
7988
|
+
}, [plotPresetState == null ? void 0 : plotPresetState.parameters]);
|
|
7989
|
+
var stableServices = React.useMemo(function () {
|
|
7990
|
+
return services || [];
|
|
7991
|
+
}, [services]);
|
|
7992
|
+
var serviceListForLocations = React.useMemo(function () {
|
|
7993
|
+
return getUniqueServicesFromPreset(parameters, stableServices);
|
|
7994
|
+
}, [parameters, stableServices]);
|
|
7995
|
+
var _useGetLocations = useGetLocations(serviceListForLocations),
|
|
7996
|
+
locationsData = _useGetLocations.data,
|
|
7997
|
+
isLocationsFetching = _useGetLocations.isFetching;
|
|
7998
|
+
var locationsGeoJson = React.useMemo(function () {
|
|
7999
|
+
return stableServices.length ? createGeoJsonArrays(locationsData, stableServices, shouldHideLocationMarkers, memoizedSelectedFeature) : {
|
|
8000
|
+
combinedGeoJson: {
|
|
8001
|
+
type: 'FeatureCollection',
|
|
8002
|
+
features: []
|
|
8003
|
+
},
|
|
8004
|
+
splitGeoJsonByCollection: []
|
|
8005
|
+
};
|
|
8006
|
+
}, [locationsData, memoizedSelectedFeature, shouldHideLocationMarkers, stableServices]);
|
|
8007
|
+
return {
|
|
8008
|
+
combinedGeoJson: locationsGeoJson.combinedGeoJson,
|
|
8009
|
+
isLocationsFetching: isLocationsFetching,
|
|
8010
|
+
serviceListForLocations: serviceListForLocations,
|
|
8011
|
+
splitGeoJsonByCollection: locationsGeoJson.splitGeoJsonByCollection
|
|
8012
|
+
};
|
|
8013
|
+
};
|
|
8014
|
+
|
|
7828
8015
|
var TOOLTIP_TITLE = 'Timeseries Manager';
|
|
7829
8016
|
var TimeSeriesManagerMapButtonConnect = function TimeSeriesManagerMapButtonConnect(_ref) {
|
|
7830
8017
|
var viewId = _ref.viewId;
|
|
@@ -7860,102 +8047,9 @@ var TimeSeriesManagerMapButtonConnect = function TimeSeriesManagerMapButtonConne
|
|
|
7860
8047
|
});
|
|
7861
8048
|
};
|
|
7862
8049
|
|
|
7863
|
-
var
|
|
7864
|
-
var _timeSeriesLocation$o;
|
|
8050
|
+
var useMapPin = function useMapPin(_ref) {
|
|
7865
8051
|
var panelId = _ref.panelId;
|
|
7866
8052
|
var dispatch = useDispatch();
|
|
7867
|
-
var _useTimeseriesTransla = useTimeseriesTranslation(),
|
|
7868
|
-
t = _useTimeseriesTransla.t;
|
|
7869
|
-
var timeSeriesLocation = useSelector(function (state) {
|
|
7870
|
-
return getCurrentLocation(state, panelId);
|
|
7871
|
-
});
|
|
7872
|
-
var currentSourcePanelId = useSelector(function (store) {
|
|
7873
|
-
return uiSelectors.getSourcePanelId(store, uiTypes.DialogTypes.TimeseriesLocations);
|
|
7874
|
-
});
|
|
7875
|
-
var isLocationsDialogOpen = useSelector(function (store) {
|
|
7876
|
-
return uiSelectors.getisDialogOpen(store, uiTypes.DialogTypes.TimeseriesLocations);
|
|
7877
|
-
});
|
|
7878
|
-
var isMapPinDisabled = useSelector(function (state) {
|
|
7879
|
-
return getIsMapPinDisabled(state, panelId);
|
|
7880
|
-
});
|
|
7881
|
-
var isLocationsDialogOpenRef = React.useRef(isLocationsDialogOpen);
|
|
7882
|
-
var currentSourcePanelIdRef = React.useRef(currentSourcePanelId);
|
|
7883
|
-
React.useEffect(function () {
|
|
7884
|
-
isLocationsDialogOpenRef.current = isLocationsDialogOpen;
|
|
7885
|
-
currentSourcePanelIdRef.current = currentSourcePanelId;
|
|
7886
|
-
}, [isLocationsDialogOpen, currentSourcePanelId]);
|
|
7887
|
-
var selectedLocationName = typeof (timeSeriesLocation == null || (_timeSeriesLocation$o = timeSeriesLocation.occurrences) == null || (_timeSeriesLocation$o = _timeSeriesLocation$o[0]) == null || (_timeSeriesLocation$o = _timeSeriesLocation$o.properties) == null ? void 0 : _timeSeriesLocation$o.name) === 'string' ? timeSeriesLocation.occurrences[0].properties.name : '';
|
|
7888
|
-
var toggleLocationsDialog = function toggleLocationsDialog() {
|
|
7889
|
-
dispatch(uiActions.setToggleOpenDialog({
|
|
7890
|
-
type: uiTypes.DialogTypes.TimeseriesLocations,
|
|
7891
|
-
setOpen: currentSourcePanelId !== panelId ? true : !isLocationsDialogOpen,
|
|
7892
|
-
sourcePanelId: panelId
|
|
7893
|
-
}));
|
|
7894
|
-
};
|
|
7895
|
-
React.useEffect(function () {
|
|
7896
|
-
return function () {
|
|
7897
|
-
if (isLocationsDialogOpenRef.current && currentSourcePanelIdRef.current === panelId) {
|
|
7898
|
-
dispatch(uiActions.setToggleOpenDialog({
|
|
7899
|
-
setOpen: false,
|
|
7900
|
-
type: uiTypes.DialogTypes.TimeseriesLocations,
|
|
7901
|
-
sourcePanelId: panelId
|
|
7902
|
-
}));
|
|
7903
|
-
}
|
|
7904
|
-
};
|
|
7905
|
-
}, [dispatch, panelId]);
|
|
7906
|
-
return jsx(CustomTooltip, {
|
|
7907
|
-
title: selectedLocationName || t('timeseries-select-location'),
|
|
7908
|
-
children: jsx("span", {
|
|
7909
|
-
children: jsx(TimeSeriesTopRowButton, {
|
|
7910
|
-
"aria-label": t('timeseries-location'),
|
|
7911
|
-
"data-testid": "locationSelectButton",
|
|
7912
|
-
disabled: isMapPinDisabled,
|
|
7913
|
-
icon: jsx(Location, {
|
|
7914
|
-
sx: {
|
|
7915
|
-
'@container time-series-container (width < 720px)': {
|
|
7916
|
-
display: 'none'
|
|
7917
|
-
}
|
|
7918
|
-
}
|
|
7919
|
-
}),
|
|
7920
|
-
longText: selectedLocationName || t('timeseries-location'),
|
|
7921
|
-
onClick: toggleLocationsDialog,
|
|
7922
|
-
selected: isLocationsDialogOpen ? currentSourcePanelId === panelId : null,
|
|
7923
|
-
shortText: selectedLocationName || t('timeseries-location')
|
|
7924
|
-
})
|
|
7925
|
-
})
|
|
7926
|
-
});
|
|
7927
|
-
};
|
|
7928
|
-
|
|
7929
|
-
var getUniqueServicesFromPreset = function getUniqueServicesFromPreset(parameters, services) {
|
|
7930
|
-
if (!parameters.length || !services.length) {
|
|
7931
|
-
return [];
|
|
7932
|
-
}
|
|
7933
|
-
var options = parameters.map(function (_ref) {
|
|
7934
|
-
var serviceId = _ref.serviceId,
|
|
7935
|
-
collectionId = _ref.collectionId;
|
|
7936
|
-
var service = services.find(function (item) {
|
|
7937
|
-
return item.id === serviceId;
|
|
7938
|
-
});
|
|
7939
|
-
return service ? {
|
|
7940
|
-
service: service,
|
|
7941
|
-
collectionId: collectionId
|
|
7942
|
-
} : null;
|
|
7943
|
-
})
|
|
7944
|
-
// Filter out null values
|
|
7945
|
-
.filter(function (item) {
|
|
7946
|
-
return item !== null;
|
|
7947
|
-
});
|
|
7948
|
-
// Remove duplicates
|
|
7949
|
-
var uniqueOptions = options.filter(function (current, index, array) {
|
|
7950
|
-
return index === array.findIndex(function (item) {
|
|
7951
|
-
return item.service.id === current.service.id && item.collectionId === current.collectionId;
|
|
7952
|
-
});
|
|
7953
|
-
});
|
|
7954
|
-
return uniqueOptions;
|
|
7955
|
-
};
|
|
7956
|
-
var useMapPin = function useMapPin(_ref2) {
|
|
7957
|
-
var panelId = _ref2.panelId;
|
|
7958
|
-
var dispatch = useDispatch();
|
|
7959
8053
|
var selectedMapIds = useSelector(function (state) {
|
|
7960
8054
|
return genericSelectors.getLinkedTargetIds(state, panelId);
|
|
7961
8055
|
});
|
|
@@ -7996,9 +8090,9 @@ var useMapPin = function useMapPin(_ref2) {
|
|
|
7996
8090
|
isMapPinDisabled: isMapPinDisabled
|
|
7997
8091
|
};
|
|
7998
8092
|
};
|
|
7999
|
-
var TimeSeriesConnect = function TimeSeriesConnect(
|
|
8000
|
-
var _linkedMapIds
|
|
8001
|
-
var panelId =
|
|
8093
|
+
var TimeSeriesConnect = function TimeSeriesConnect(_ref2) {
|
|
8094
|
+
var _linkedMapIds$, _sx;
|
|
8095
|
+
var panelId = _ref2.panelId;
|
|
8002
8096
|
var dispatch = useDispatch();
|
|
8003
8097
|
var _useTimeseriesTransla = useTimeseriesTranslation(),
|
|
8004
8098
|
t = _useTimeseriesTransla.t;
|
|
@@ -8007,7 +8101,7 @@ var TimeSeriesConnect = function TimeSeriesConnect(_ref3) {
|
|
|
8007
8101
|
return getIsLegendVisible(state, panelId);
|
|
8008
8102
|
});
|
|
8009
8103
|
var services = useSelector(function (state) {
|
|
8010
|
-
return getServices(state);
|
|
8104
|
+
return getServices(state) || [];
|
|
8011
8105
|
});
|
|
8012
8106
|
var shouldHideLocationMarkers = useSelector(function (state) {
|
|
8013
8107
|
return getShouldHideLocationMarkers(state, panelId);
|
|
@@ -8037,13 +8131,6 @@ var TimeSeriesConnect = function TimeSeriesConnect(_ref3) {
|
|
|
8037
8131
|
}),
|
|
8038
8132
|
toggleDisableMapPin = _useMapPin.toggleDisableMapPin,
|
|
8039
8133
|
isMapPinDisabled = _useMapPin.isMapPinDisabled;
|
|
8040
|
-
var geoJSONWithService = useSelector(function (state) {
|
|
8041
|
-
return getGeoJSONWithService(state, panelId);
|
|
8042
|
-
});
|
|
8043
|
-
var geojson = useSelector(function (state) {
|
|
8044
|
-
var _genericSelectors$sel;
|
|
8045
|
-
return (_genericSelectors$sel = genericSelectors.selectFeatureSyncLayersForPanel(state, panelId)[0]) == null ? void 0 : _genericSelectors$sel.geojson;
|
|
8046
|
-
});
|
|
8047
8134
|
var isLoading = useCallback(function (startOrFinish) {
|
|
8048
8135
|
dispatch(loadingIndicatorActions.setEDRIsLoading({
|
|
8049
8136
|
id: panelId,
|
|
@@ -8088,34 +8175,21 @@ var TimeSeriesConnect = function TimeSeriesConnect(_ref3) {
|
|
|
8088
8175
|
}
|
|
8089
8176
|
}, [panelMapId, selectedFeature, setTimeSeriesLocation, memoizedSelectedFeature, allMaps]);
|
|
8090
8177
|
useRegisterFeatureSyncSource(panelId);
|
|
8091
|
-
var
|
|
8092
|
-
|
|
8093
|
-
|
|
8094
|
-
|
|
8095
|
-
|
|
8096
|
-
}, [services]);
|
|
8097
|
-
var serviceListForLocations = useMemo(function () {
|
|
8098
|
-
return getUniqueServicesFromPreset(parameters, stableServices);
|
|
8099
|
-
}, [parameters, stableServices]);
|
|
8100
|
-
var _useGetLocations = useGetLocations(serviceListForLocations),
|
|
8101
|
-
locationsData = _useGetLocations.data,
|
|
8102
|
-
isLocationsFetching = _useGetLocations.isFetching;
|
|
8103
|
-
var combinedGeoJson = useMemo(function () {
|
|
8104
|
-
return stableServices.length ? createGeoJsonArrays(locationsData, stableServices, shouldHideLocationMarkers, memoizedSelectedFeature).combinedGeoJson : {
|
|
8105
|
-
type: 'FeatureCollection',
|
|
8106
|
-
features: []
|
|
8107
|
-
};
|
|
8108
|
-
}, [locationsData, memoizedSelectedFeature, shouldHideLocationMarkers, stableServices]);
|
|
8178
|
+
var _useTimeSeriesLocatio = useTimeSeriesLocations(panelId),
|
|
8179
|
+
combinedGeoJson = _useTimeSeriesLocatio.combinedGeoJson,
|
|
8180
|
+
isLocationsFetching = _useTimeSeriesLocatio.isLocationsFetching,
|
|
8181
|
+
serviceListForLocations = _useTimeSeriesLocatio.serviceListForLocations,
|
|
8182
|
+
splitGeoJsonByCollection = _useTimeSeriesLocatio.splitGeoJsonByCollection;
|
|
8109
8183
|
var featureSyncLayersById = useMemo(function () {
|
|
8110
|
-
var
|
|
8111
|
-
return
|
|
8184
|
+
var _ref3;
|
|
8185
|
+
return serviceListForLocations.length ? (_ref3 = {}, _ref3[geojsonLayerId] = {
|
|
8112
8186
|
id: geojsonLayerId,
|
|
8113
8187
|
geojson: consolidateFeatures([{
|
|
8114
8188
|
id: 'combined-layer',
|
|
8115
8189
|
geoJSON: combinedGeoJson
|
|
8116
8190
|
}])
|
|
8117
|
-
},
|
|
8118
|
-
}, [combinedGeoJson, geojsonLayerId,
|
|
8191
|
+
}, _ref3) : {};
|
|
8192
|
+
}, [combinedGeoJson, geojsonLayerId, serviceListForLocations.length]);
|
|
8119
8193
|
useUpdateFeatureSyncLayers(featureSyncLayersById, panelId);
|
|
8120
8194
|
/* Set the loading state based on the locations fetching status */
|
|
8121
8195
|
useEffect(function () {
|
|
@@ -8123,12 +8197,12 @@ var TimeSeriesConnect = function TimeSeriesConnect(_ref3) {
|
|
|
8123
8197
|
}, [isLoading, isLocationsFetching]);
|
|
8124
8198
|
/* Create GeoJSON arrays and draw the geojson layer based on the locationsData */
|
|
8125
8199
|
useEffect(function () {
|
|
8126
|
-
if (
|
|
8200
|
+
if (serviceListForLocations.length) {
|
|
8127
8201
|
if (combinedGeoJson.features.length === 0) {
|
|
8128
8202
|
setTimeSeriesLocation(undefined);
|
|
8129
8203
|
}
|
|
8130
8204
|
}
|
|
8131
|
-
}, [combinedGeoJson.features.length,
|
|
8205
|
+
}, [combinedGeoJson.features.length, serviceListForLocations.length, setTimeSeriesLocation]);
|
|
8132
8206
|
var toggleLocationMarkers = function toggleLocationMarkers(shouldHide) {
|
|
8133
8207
|
dispatch(timeSeriesActions.toggleLocationMarkers({
|
|
8134
8208
|
panelId: panelId,
|
|
@@ -8156,7 +8230,7 @@ var TimeSeriesConnect = function TimeSeriesConnect(_ref3) {
|
|
|
8156
8230
|
height: '100%',
|
|
8157
8231
|
backgroundColor: 'geowebColors.background.surfaceApp',
|
|
8158
8232
|
containerType: 'inline-size',
|
|
8159
|
-
containerName:
|
|
8233
|
+
containerName: TIME_SERIES_CONTAINER_NAME
|
|
8160
8234
|
},
|
|
8161
8235
|
children: [jsxs(Stack, {
|
|
8162
8236
|
direction: "row",
|
|
@@ -8168,7 +8242,7 @@ var TimeSeriesConnect = function TimeSeriesConnect(_ref3) {
|
|
|
8168
8242
|
},
|
|
8169
8243
|
children: [jsx(TimeSeriesManagerMapButtonConnect, {
|
|
8170
8244
|
viewId: panelId
|
|
8171
|
-
}), !!
|
|
8245
|
+
}), !!serviceListForLocations.length && jsx(LocationSelectButtonConnect, {
|
|
8172
8246
|
panelId: panelId
|
|
8173
8247
|
}), jsx(LocationInfoButtonConnect, {
|
|
8174
8248
|
panelId: panelId,
|
|
@@ -8189,29 +8263,36 @@ var TimeSeriesConnect = function TimeSeriesConnect(_ref3) {
|
|
|
8189
8263
|
}), jsx(TimeSeriesMarkersSwitch, {
|
|
8190
8264
|
shouldHideMarkers: shouldHideLocationMarkers,
|
|
8191
8265
|
toggleMarkers: toggleLocationMarkers
|
|
8192
|
-
}), jsx(
|
|
8193
|
-
|
|
8194
|
-
|
|
8195
|
-
|
|
8196
|
-
|
|
8197
|
-
|
|
8198
|
-
|
|
8199
|
-
|
|
8200
|
-
|
|
8201
|
-
|
|
8266
|
+
}), jsx(LegendToggleButton, {
|
|
8267
|
+
hideTooltipText: t('timeseries-legend-tooltip-hide'),
|
|
8268
|
+
isLegendVisible: shouldShowLegend,
|
|
8269
|
+
legendLabel: t('timeseries-legend'),
|
|
8270
|
+
onToggle: toggleLegend,
|
|
8271
|
+
showTooltipText: t('timeseries-legend-tooltip-show'),
|
|
8272
|
+
sx: (_sx = {}, _sx["@container " + TIME_SERIES_CONTAINER_NAME + " (width < " + TIME_SERIES_CONTAINER_BREAKPOINT_PX + ")"] = {
|
|
8273
|
+
maxWidth: '90px',
|
|
8274
|
+
'& .longText': {
|
|
8275
|
+
display: 'none'
|
|
8276
|
+
},
|
|
8277
|
+
'& svg': {
|
|
8278
|
+
marginRight: '0 !important'
|
|
8279
|
+
}
|
|
8280
|
+
}, _sx["@container " + TIME_SERIES_CONTAINER_NAME + " (min-width: " + TIME_SERIES_CONTAINER_BREAKPOINT_PX + ")"] = {
|
|
8281
|
+
width: '130px'
|
|
8282
|
+
}, _sx)
|
|
8202
8283
|
})]
|
|
8203
8284
|
}), !!timeSeriesLocation && !!plotPresetState && jsx(Box, {
|
|
8204
8285
|
sx: {
|
|
8205
8286
|
overflow: 'auto'
|
|
8206
8287
|
},
|
|
8207
|
-
children: !!
|
|
8288
|
+
children: !!plotPresetState && jsx(TimeSeriesView, {
|
|
8208
8289
|
isLoading: isLoading,
|
|
8209
8290
|
onToggleLegendParam: onToggleLegendParam,
|
|
8210
8291
|
plotPreset: plotPresetState,
|
|
8211
8292
|
selectedLocation: timeSeriesLocation,
|
|
8212
8293
|
services: services,
|
|
8213
8294
|
shouldShowLegend: shouldShowLegend,
|
|
8214
|
-
splitGeoJsonByCollection:
|
|
8295
|
+
splitGeoJsonByCollection: splitGeoJsonByCollection,
|
|
8215
8296
|
syncgroupTimeState: syncgroupTimeState
|
|
8216
8297
|
})
|
|
8217
8298
|
})]
|
|
@@ -8552,7 +8633,7 @@ var RowComponent = function RowComponent(_ref) {
|
|
|
8552
8633
|
handleChange: handleChange,
|
|
8553
8634
|
isDisabled: isDisabled,
|
|
8554
8635
|
location: (_feature$properties = feature.properties) == null ? void 0 : _feature$properties.name,
|
|
8555
|
-
selectedLocation: selectedLocation
|
|
8636
|
+
selectedLocation: selectedLocation != null ? selectedLocation : ''
|
|
8556
8637
|
}, feature.id)
|
|
8557
8638
|
});
|
|
8558
8639
|
};
|
|
@@ -8633,44 +8714,18 @@ var FocusableListWrapper = function FocusableListWrapper(_ref2) {
|
|
|
8633
8714
|
children: children
|
|
8634
8715
|
});
|
|
8635
8716
|
};
|
|
8636
|
-
var
|
|
8637
|
-
var
|
|
8638
|
-
|
|
8639
|
-
|
|
8640
|
-
|
|
8641
|
-
selectedLocation = _ref3.selectedLocation,
|
|
8642
|
-
_ref3$isDisabled = _ref3.isDisabled,
|
|
8643
|
-
isDisabled = _ref3$isDisabled === void 0 ? false : _ref3$isDisabled,
|
|
8644
|
-
defaultExpanded = _ref3.defaultExpanded;
|
|
8717
|
+
var FocusableList = function FocusableList(_ref3) {
|
|
8718
|
+
var rowCount = _ref3.rowCount,
|
|
8719
|
+
rowHeight = _ref3.rowHeight,
|
|
8720
|
+
rowProps = _ref3.rowProps,
|
|
8721
|
+
style = _ref3.style;
|
|
8645
8722
|
var listRef = useListRef(null);
|
|
8646
|
-
var _React$useState2 = React.useState(''),
|
|
8647
|
-
searchTerm = _React$useState2[0],
|
|
8648
|
-
setSearchTerm = _React$useState2[1];
|
|
8649
|
-
var combinedSelectedLocation = geoJson == null ? void 0 : geoJson.features.find(function (feature) {
|
|
8650
|
-
var _feature$properties2;
|
|
8651
|
-
return selectedLocation === ((_feature$properties2 = feature.properties) == null ? void 0 : _feature$properties2.name);
|
|
8652
|
-
});
|
|
8653
|
-
var selectedLocationNames = combinedSelectedLocation ? Object.keys(combinedSelectedLocation == null || (_combinedSelectedLoca = combinedSelectedLocation.properties) == null ? void 0 : _combinedSelectedLoca.names) : [];
|
|
8654
|
-
var filteredResults = useMemo(function () {
|
|
8655
|
-
return splitGeoJson == null ? void 0 : splitGeoJson.map(function (dataset) {
|
|
8656
|
-
var filteredFeatures = dataset.geoJson.features.filter(function (feature) {
|
|
8657
|
-
var _feature$properties3;
|
|
8658
|
-
return (_feature$properties3 = feature.properties) == null ? void 0 : _feature$properties3.name.toLowerCase().includes(searchTerm.toLowerCase());
|
|
8659
|
-
});
|
|
8660
|
-
return Object.assign({}, dataset, {
|
|
8661
|
-
geoJson: Object.assign({}, dataset.geoJson, {
|
|
8662
|
-
features: filteredFeatures
|
|
8663
|
-
})
|
|
8664
|
-
});
|
|
8665
|
-
});
|
|
8666
|
-
}, [searchTerm, splitGeoJson]);
|
|
8667
|
-
var listContainerRef = React.useRef(null);
|
|
8668
|
-
var heightObserver = useResizeObserver(listContainerRef, filteredResults);
|
|
8669
8723
|
var handleKeyDown = function handleKeyDown(e) {
|
|
8670
|
-
var
|
|
8724
|
+
var _listRef$current, _element$scrollTop;
|
|
8671
8725
|
var lineHeight = 40;
|
|
8672
|
-
var page = 8 * lineHeight;
|
|
8673
|
-
var
|
|
8726
|
+
var page = 8 * lineHeight;
|
|
8727
|
+
var element = (_listRef$current = listRef.current) == null ? void 0 : _listRef$current.element;
|
|
8728
|
+
var next = (_element$scrollTop = element == null ? void 0 : element.scrollTop) != null ? _element$scrollTop : 0;
|
|
8674
8729
|
switch (e.key) {
|
|
8675
8730
|
case 'ArrowDown':
|
|
8676
8731
|
e.preventDefault();
|
|
@@ -8695,18 +8750,62 @@ var LocationDropdown = function LocationDropdown(_ref3) {
|
|
|
8695
8750
|
default:
|
|
8696
8751
|
return;
|
|
8697
8752
|
}
|
|
8698
|
-
|
|
8753
|
+
element == null || element.scrollTo({
|
|
8699
8754
|
top: Math.max(0, next),
|
|
8700
8755
|
behavior: 'smooth'
|
|
8701
8756
|
});
|
|
8702
8757
|
};
|
|
8758
|
+
return jsx(FocusableListWrapper, {
|
|
8759
|
+
"aria-label": "Locations list",
|
|
8760
|
+
onKeyDown: handleKeyDown,
|
|
8761
|
+
children: jsx(List$1, {
|
|
8762
|
+
listRef: listRef,
|
|
8763
|
+
rowComponent: RowComponent,
|
|
8764
|
+
rowCount: rowCount,
|
|
8765
|
+
rowHeight: rowHeight,
|
|
8766
|
+
rowProps: rowProps,
|
|
8767
|
+
style: style
|
|
8768
|
+
})
|
|
8769
|
+
});
|
|
8770
|
+
};
|
|
8771
|
+
var LocationDropdown = function LocationDropdown(_ref4) {
|
|
8772
|
+
var _combinedSelectedLoca;
|
|
8773
|
+
var geoJson = _ref4.geoJson,
|
|
8774
|
+
splitGeoJson = _ref4.splitGeoJson,
|
|
8775
|
+
handleChange = _ref4.handleChange,
|
|
8776
|
+
selectedLocation = _ref4.selectedLocation,
|
|
8777
|
+
_ref4$isDisabled = _ref4.isDisabled,
|
|
8778
|
+
isDisabled = _ref4$isDisabled === void 0 ? false : _ref4$isDisabled,
|
|
8779
|
+
defaultExpanded = _ref4.defaultExpanded;
|
|
8780
|
+
var _React$useState2 = React.useState(''),
|
|
8781
|
+
searchTerm = _React$useState2[0],
|
|
8782
|
+
setSearchTerm = _React$useState2[1];
|
|
8783
|
+
var combinedSelectedLocation = geoJson == null ? void 0 : geoJson.features.find(function (feature) {
|
|
8784
|
+
var _feature$properties2;
|
|
8785
|
+
return selectedLocation === ((_feature$properties2 = feature.properties) == null ? void 0 : _feature$properties2.name);
|
|
8786
|
+
});
|
|
8787
|
+
var selectedLocationNames = combinedSelectedLocation ? Object.keys(combinedSelectedLocation == null || (_combinedSelectedLoca = combinedSelectedLocation.properties) == null ? void 0 : _combinedSelectedLoca.names) : [];
|
|
8788
|
+
var filteredResults = useMemo(function () {
|
|
8789
|
+
return splitGeoJson == null ? void 0 : splitGeoJson.map(function (dataset) {
|
|
8790
|
+
var filteredFeatures = dataset.geoJson.features.filter(function (feature) {
|
|
8791
|
+
var _feature$properties3;
|
|
8792
|
+
return (_feature$properties3 = feature.properties) == null ? void 0 : _feature$properties3.name.toLowerCase().includes(searchTerm.toLowerCase());
|
|
8793
|
+
});
|
|
8794
|
+
return Object.assign({}, dataset, {
|
|
8795
|
+
geoJson: Object.assign({}, dataset.geoJson, {
|
|
8796
|
+
features: filteredFeatures
|
|
8797
|
+
})
|
|
8798
|
+
});
|
|
8799
|
+
});
|
|
8800
|
+
}, [searchTerm, splitGeoJson]);
|
|
8801
|
+
var listContainerRef = React.useRef(null);
|
|
8802
|
+
var heightObserver = useResizeObserver(listContainerRef, filteredResults);
|
|
8703
8803
|
return jsx(Box, {
|
|
8704
8804
|
"data-testid": "locationDropdownContainer",
|
|
8705
8805
|
ref: listContainerRef,
|
|
8706
8806
|
sx: {
|
|
8707
8807
|
width: '100%',
|
|
8708
8808
|
height: '100%',
|
|
8709
|
-
overflowY: 'auto',
|
|
8710
8809
|
backgroundColor: 'geowebColors.background.surface'
|
|
8711
8810
|
},
|
|
8712
8811
|
children: jsxs(Grid, {
|
|
@@ -8745,31 +8844,28 @@ var LocationDropdown = function LocationDropdown(_ref3) {
|
|
|
8745
8844
|
amountOfItems: collectionGeoJson.features.length || 0,
|
|
8746
8845
|
"data-testid": "locationDropdownCollectionAccordion",
|
|
8747
8846
|
defaultExpanded: defaultExpanded || false,
|
|
8847
|
+
detailsSx: {
|
|
8848
|
+
padding: 0
|
|
8849
|
+
},
|
|
8748
8850
|
sx: {
|
|
8749
8851
|
mx: 1,
|
|
8750
8852
|
mb: 1
|
|
8751
8853
|
},
|
|
8752
8854
|
title: collectionName,
|
|
8753
8855
|
title2: serviceName,
|
|
8754
|
-
children: jsx(
|
|
8755
|
-
|
|
8756
|
-
|
|
8757
|
-
|
|
8758
|
-
|
|
8759
|
-
|
|
8760
|
-
|
|
8761
|
-
|
|
8762
|
-
|
|
8763
|
-
|
|
8764
|
-
|
|
8765
|
-
|
|
8766
|
-
|
|
8767
|
-
},
|
|
8768
|
-
style: {
|
|
8769
|
-
height: heightObserver,
|
|
8770
|
-
width: '100%'
|
|
8771
|
-
}
|
|
8772
|
-
})
|
|
8856
|
+
children: jsx(FocusableList, {
|
|
8857
|
+
rowCount: collectionGeoJson.features.length,
|
|
8858
|
+
rowHeight: 40,
|
|
8859
|
+
rowProps: {
|
|
8860
|
+
handleChange: handleChange,
|
|
8861
|
+
selectedLocation: collectionSelectedLocation == null || (_collectionSelectedLo = collectionSelectedLocation.properties) == null ? void 0 : _collectionSelectedLo.name,
|
|
8862
|
+
features: collectionGeoJson.features,
|
|
8863
|
+
isDisabled: isDisabled
|
|
8864
|
+
},
|
|
8865
|
+
style: {
|
|
8866
|
+
height: heightObserver,
|
|
8867
|
+
width: '100%'
|
|
8868
|
+
}
|
|
8773
8869
|
})
|
|
8774
8870
|
})
|
|
8775
8871
|
}, collectionName + "-" + serviceName);
|
|
@@ -8793,12 +8889,6 @@ var LocationSelectDialogConnect = function LocationSelectDialogConnect() {
|
|
|
8793
8889
|
onCloseDialog = _useSetupDialog.onCloseDialog,
|
|
8794
8890
|
dialogOrder = _useSetupDialog.dialogOrder,
|
|
8795
8891
|
setDialogOrder = _useSetupDialog.setDialogOrder;
|
|
8796
|
-
var geoJSONWithService = useSelector(function (state) {
|
|
8797
|
-
return panelId ? getGeoJSONWithService(state, panelId) : undefined;
|
|
8798
|
-
});
|
|
8799
|
-
var sharedFeature = useSelector(function (state) {
|
|
8800
|
-
return panelId ? genericSelectors.selectFeatureSyncLayersForPanel(state, panelId)[0] : undefined;
|
|
8801
|
-
});
|
|
8802
8892
|
var featureSyncLayerIds = useSelector(function (state) {
|
|
8803
8893
|
return panelId ? genericSelectors.selectFeatureSyncLayerIdsForPanel(state, panelId) : emptyMapIdList;
|
|
8804
8894
|
});
|
|
@@ -8811,6 +8901,9 @@ var LocationSelectDialogConnect = function LocationSelectDialogConnect() {
|
|
|
8811
8901
|
var timeSeriesLocation = useSelector(function (state) {
|
|
8812
8902
|
return panelId ? getCurrentLocation(state, panelId) : undefined;
|
|
8813
8903
|
});
|
|
8904
|
+
var _useTimeSeriesLocatio = useTimeSeriesLocations(panelId || ''),
|
|
8905
|
+
combinedGeoJson = _useTimeSeriesLocatio.combinedGeoJson,
|
|
8906
|
+
splitGeoJsonByCollection = _useTimeSeriesLocatio.splitGeoJsonByCollection;
|
|
8814
8907
|
var setSelectedFeatureIds = function setSelectedFeatureIds(selectedFeatureIds) {
|
|
8815
8908
|
featureSyncLayerIds.forEach(function (layerId) {
|
|
8816
8909
|
dispatch(layerActions.setSelectedFeatures({
|
|
@@ -8836,20 +8929,19 @@ var LocationSelectDialogConnect = function LocationSelectDialogConnect() {
|
|
|
8836
8929
|
}));
|
|
8837
8930
|
});
|
|
8838
8931
|
};
|
|
8839
|
-
var geojson = sharedFeature == null ? void 0 : sharedFeature.geojson;
|
|
8840
8932
|
var selectedLocationName = typeof (timeSeriesLocation == null || (_timeSeriesLocation$o = timeSeriesLocation.occurrences) == null || (_timeSeriesLocation$o = _timeSeriesLocation$o[0]) == null || (_timeSeriesLocation$o = _timeSeriesLocation$o.properties) == null ? void 0 : _timeSeriesLocation$o.name) === 'string' ? timeSeriesLocation.occurrences[0].properties.name : '';
|
|
8841
8933
|
var onChangeLocation = function onChangeLocation(newSelectedLocation) {
|
|
8842
|
-
var
|
|
8934
|
+
var _feature$properties;
|
|
8843
8935
|
if (!panelId) {
|
|
8844
8936
|
return;
|
|
8845
8937
|
}
|
|
8846
|
-
if (!
|
|
8938
|
+
if (!combinedGeoJson.features.length) {
|
|
8847
8939
|
return;
|
|
8848
8940
|
}
|
|
8849
|
-
var selectedFeatureIndex =
|
|
8941
|
+
var selectedFeatureIndex = combinedGeoJson.features.findIndex(function (feature) {
|
|
8850
8942
|
return Object.keys(feature.properties.names).includes(newSelectedLocation);
|
|
8851
8943
|
});
|
|
8852
|
-
var feature =
|
|
8944
|
+
var feature = combinedGeoJson.features[selectedFeatureIndex];
|
|
8853
8945
|
setSelectedFeatureIds(feature != null && feature.id ? [String(feature.id)] : []);
|
|
8854
8946
|
var _getFeatureCenterPoin = getFeatureCenterPoint(feature),
|
|
8855
8947
|
lon = _getFeatureCenterPoin[0],
|
|
@@ -8897,11 +8989,11 @@ var LocationSelectDialogConnect = function LocationSelectDialogConnect() {
|
|
|
8897
8989
|
},
|
|
8898
8990
|
title: t('locations'),
|
|
8899
8991
|
children: jsx(LocationDropdown, {
|
|
8900
|
-
geoJson:
|
|
8992
|
+
geoJson: combinedGeoJson,
|
|
8901
8993
|
handleChange: onChangeLocation,
|
|
8902
8994
|
isDisabled: isMapPinDisabled,
|
|
8903
8995
|
selectedLocation: selectedLocationName,
|
|
8904
|
-
splitGeoJson:
|
|
8996
|
+
splitGeoJson: splitGeoJsonByCollection
|
|
8905
8997
|
})
|
|
8906
8998
|
});
|
|
8907
8999
|
};
|
|
@@ -1,8 +1,4 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import type { TimeSeriesService } from '@opengeoweb/shared';
|
|
3
|
-
import type { Parameter } from './types';
|
|
4
|
-
import type { GetLocationsOption } from '../../utils/timeseries-api/hooks';
|
|
5
|
-
export declare const getUniqueServicesFromPreset: (parameters: Parameter[], services: TimeSeriesService[]) => GetLocationsOption[];
|
|
6
2
|
export interface TimeSeriesConnectProps {
|
|
7
3
|
panelId: string;
|
|
8
4
|
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { TimeSeriesService } from '@opengeoweb/shared';
|
|
2
|
+
import type { GeoJsonWithService, Parameter } from './types';
|
|
3
|
+
import type { GetLocationsOption } from '../../utils/timeseries-api/hooks';
|
|
4
|
+
export declare const getUniqueServicesFromPreset: (parameters: Parameter[], services: TimeSeriesService[]) => GetLocationsOption[];
|
|
5
|
+
interface UseTimeSeriesLocationsResult {
|
|
6
|
+
combinedGeoJson: GeoJSON.FeatureCollection;
|
|
7
|
+
isLocationsFetching: boolean;
|
|
8
|
+
serviceListForLocations: GetLocationsOption[];
|
|
9
|
+
splitGeoJsonByCollection: GeoJsonWithService[];
|
|
10
|
+
}
|
|
11
|
+
export declare const useTimeSeriesLocations: (panelId: string) => UseTimeSeriesLocationsResult;
|
|
12
|
+
export {};
|
|
@@ -8,6 +8,7 @@ export type PlotErrorsMap = Record<Plot['plotId'], string[]>;
|
|
|
8
8
|
export type FailedParametersMap = Record<Plot['plotId'], FailedParameterInfo[]>;
|
|
9
9
|
export declare const createGeoJsonArrays: (locations: (FeatureCollection<GeometryObject, UseGetLocationReturnTypeProperties> | undefined)[], services: TimeSeriesService[] | undefined, hideFeatures: boolean, memoizedSelectedFeature: TimeSeriesLocation | null) => {
|
|
10
10
|
combinedGeoJson: FeatureCollection<GeometryObject, syncGroupsTypes.PotentialDataProperties>;
|
|
11
|
+
splitGeoJsonByCollection: GeoJsonWithService[];
|
|
11
12
|
};
|
|
12
13
|
export declare const getNearbyLocation: (parameter: Parameter, service: TimeSeriesService, selectedLocation: PointerLocation, geojsonMap: Map<string, GeoJsonWithService>) => TimeSeriesLocation | null;
|
|
13
14
|
export declare const getPlotsWithParameters: (plots: Plot[], parameters: ParameterWithData[], plotErrors?: PlotErrorsMap, failedParameters?: FailedParametersMap) => PlotWithData[];
|