@opengeoweb/time-series 19.4.0 → 19.5.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.esm.js CHANGED
@@ -1447,6 +1447,18 @@ var panelSlice = createSlice({
1447
1447
  draft.locationData = Object.assign({}, draft.locationData, {
1448
1448
  currentLocation: location
1449
1449
  });
1450
+ },
1451
+ setLocationMenuSizeAndPosition: function setLocationMenuSizeAndPosition(draft, action) {
1452
+ draft.locationData = Object.assign({}, draft.locationData, {
1453
+ locationMenuSize: action.payload.size
1454
+ }, action.payload.position !== undefined && {
1455
+ locationMenuPosition: action.payload.position
1456
+ });
1457
+ },
1458
+ setLocationsDialogOpen: function setLocationsDialogOpen(draft, action) {
1459
+ draft.locationData = Object.assign({}, draft.locationData, {
1460
+ isLocationsDialogOpen: action.payload.isLocationsDialogOpen
1461
+ });
1450
1462
  }
1451
1463
  }
1452
1464
  });
@@ -1637,7 +1649,7 @@ var timeSeriesReducer = function timeSeriesReducer(state, action) {
1637
1649
  return didChange ? nextById : byId;
1638
1650
  };
1639
1651
  if (action.type === timeSeriesActions.registerTimeSeriesPreset.type) {
1640
- var _normalizedState$byId, _payload2$services, _Object$assign;
1652
+ var _normalizedState$byId, _payload2$services, _Object$assign, _normalizedState$loca;
1641
1653
  var _payload2 = action.payload;
1642
1654
  if (!panelId) {
1643
1655
  return Object.assign({}, normalizedState, {
@@ -1717,6 +1729,18 @@ var timeSeriesReducer = function timeSeriesReducer(state, action) {
1717
1729
  payload: newServicesAdded,
1718
1730
  type: timeSeriesActions.setServiceFilterChipsInStore.type
1719
1731
  });
1732
+ if (!draft.locationData) {
1733
+ draft.locationData = {};
1734
+ }
1735
+ if (_payload2.locationMenuSize) {
1736
+ draft.locationData.locationMenuSize = _payload2.locationMenuSize;
1737
+ }
1738
+ if (_payload2.locationMenuPosition) {
1739
+ draft.locationData.locationMenuPosition = _payload2.locationMenuPosition;
1740
+ }
1741
+ if (_payload2.isLocationsDialogOpen !== undefined) {
1742
+ draft.locationData.isLocationsDialogOpen = _payload2.isLocationsDialogOpen;
1743
+ }
1720
1744
  });
1721
1745
  var updatedById = Object.assign({}, normalizedState.byId, (_Object$assign = {}, _Object$assign[panelId] = _nextPanelState, _Object$assign));
1722
1746
  var servicesToSyncFromPreset = Array.from(new Map([].concat(newServicesAdded.map(function (service) {
@@ -1734,7 +1758,8 @@ var timeSeriesReducer = function timeSeriesReducer(state, action) {
1734
1758
  })).values());
1735
1759
  return Object.assign({}, normalizedState, {
1736
1760
  services: nextServices,
1737
- byId: syncServiceChipsAcrossPanels(updatedById, servicesToSyncFromPreset)
1761
+ byId: syncServiceChipsAcrossPanels(updatedById, servicesToSyncFromPreset),
1762
+ locationDialogRestoreVersion: ((_normalizedState$loca = normalizedState.locationDialogRestoreVersion) != null ? _normalizedState$loca : 0) + 1
1738
1763
  });
1739
1764
  }
1740
1765
  if (!panelId) {
@@ -1969,7 +1994,45 @@ var getServicePopupDetails = createSelector(getTimeSeriesState, function (store)
1969
1994
  var _store$timeseriesSele6;
1970
1995
  return (store == null || (_store$timeseriesSele6 = store.timeseriesSelect) == null ? void 0 : _store$timeseriesSele6.servicePopup) || initialPanelState.timeseriesSelect.servicePopup;
1971
1996
  });
1972
- var getTimeSeriesPreset = createSelector(getPlotState, getServices, function (plotState, services) {
1997
+ var getLocationDialogRestoreVersion = function getLocationDialogRestoreVersion(state) {
1998
+ var ts = state.timeSeries;
1999
+ if (!ts || !('byId' in ts)) {
2000
+ return 0;
2001
+ }
2002
+ var version = ts.locationDialogRestoreVersion;
2003
+ return typeof version === 'number' ? version : 0;
2004
+ };
2005
+ /**
2006
+ * Returns the panelId of the first panel that has isLocationsDialogOpen: true or undefined.
2007
+ * @param {object} state store: object - store object
2008
+ * @returns {string | undefined} returnType: string | undefined
2009
+ */
2010
+ var getDialogOpenPanelId = function getDialogOpenPanelId(state) {
2011
+ var _Object$entries$find;
2012
+ var ts = state.timeSeries;
2013
+ if (!ts || !('byId' in ts)) {
2014
+ return undefined;
2015
+ }
2016
+ var byId = ts.byId;
2017
+ return (_Object$entries$find = Object.entries(byId).find(function (_ref) {
2018
+ var _panel$locationData;
2019
+ var panel = _ref[1];
2020
+ return ((_panel$locationData = panel.locationData) == null ? void 0 : _panel$locationData.isLocationsDialogOpen) === true;
2021
+ })) == null ? void 0 : _Object$entries$find[0];
2022
+ };
2023
+ var getLocationMenuSize = function getLocationMenuSize(state, panelId) {
2024
+ var _getPanelState3;
2025
+ return (_getPanelState3 = getPanelState(state, panelId)) == null || (_getPanelState3 = _getPanelState3.locationData) == null ? void 0 : _getPanelState3.locationMenuSize;
2026
+ };
2027
+ var getLocationMenuPosition = function getLocationMenuPosition(state, panelId) {
2028
+ var _getPanelState4;
2029
+ return (_getPanelState4 = getPanelState(state, panelId)) == null || (_getPanelState4 = _getPanelState4.locationData) == null ? void 0 : _getPanelState4.locationMenuPosition;
2030
+ };
2031
+ var getLocationsDialogOpen = function getLocationsDialogOpen(state, panelId) {
2032
+ var _getPanelState$locati, _getPanelState5;
2033
+ return (_getPanelState$locati = (_getPanelState5 = getPanelState(state, panelId)) == null || (_getPanelState5 = _getPanelState5.locationData) == null ? void 0 : _getPanelState5.isLocationsDialogOpen) != null ? _getPanelState$locati : false;
2034
+ };
2035
+ var getTimeSeriesPreset = createSelector(getPlotState, getServices, getLocationMenuSize, getLocationMenuPosition, getLocationsDialogOpen, function (plotState, services, locationMenuSize, locationMenuPosition, isLocationsDialogOpen) {
1973
2036
  if (!plotState || !services) {
1974
2037
  return undefined;
1975
2038
  }
@@ -1994,7 +2057,10 @@ var getTimeSeriesPreset = createSelector(getPlotState, getServices, function (pl
1994
2057
  parameters: presetParameters
1995
2058
  }),
1996
2059
  services: usedServices,
1997
- syncGroupsIds: []
2060
+ syncGroupsIds: [],
2061
+ locationMenuSize: locationMenuSize,
2062
+ locationMenuPosition: locationMenuPosition,
2063
+ isLocationsDialogOpen: isLocationsDialogOpen
1998
2064
  };
1999
2065
  });
2000
2066
  var getGeoJSONWithService = createSelector([getServices, function (state, panelId) {
@@ -2053,9 +2119,14 @@ var selectors = /*#__PURE__*/Object.freeze({
2053
2119
  getAllFilterChipsEnabled: getAllFilterChipsEnabled,
2054
2120
  getCurrentLocation: getCurrentLocation,
2055
2121
  getCurrentParameterInfoDisplayed: getCurrentParameterInfoDisplayed,
2122
+ getDialogOpenPanelId: getDialogOpenPanelId,
2056
2123
  getGeoJSONWithService: getGeoJSONWithService,
2057
2124
  getIsLegendVisible: getIsLegendVisible,
2058
2125
  getIsMapPinDisabled: getIsMapPinDisabled,
2126
+ getLocationDialogRestoreVersion: getLocationDialogRestoreVersion,
2127
+ getLocationMenuPosition: getLocationMenuPosition,
2128
+ getLocationMenuSize: getLocationMenuSize,
2129
+ getLocationsDialogOpen: getLocationsDialogOpen,
2059
2130
  getMapId: getMapId,
2060
2131
  getPanelState: getPanelState,
2061
2132
  getParameterById: getParameterById,
@@ -3177,7 +3248,7 @@ var useGetPlotsWithData = function useGetPlotsWithData(plotsWithoutData, selecte
3177
3248
  // Create here so if new data is advertised by the collection/instance a new request is made
3178
3249
  var intervalParam = constructTimeInterval(collection, instanceInfo, syncgroupTimeState);
3179
3250
  return {
3180
- queryKey: generateTimeSeriesQueryKeys(['get-parameter-data', parameter.plotId, parameter.propertyName, parameter.serviceId, parameter.collectionId, parameter.instanceId || 'undefined', ((_parameter$dimension = parameter.dimension) == null ? void 0 : _parameter$dimension.value) || 'undefined', intervalParam, selectedLocation.lat.toString() || 'undefined', selectedLocation.lon.toString() || 'undefined']),
3251
+ queryKey: generateTimeSeriesQueryKeys(['get-parameter-data', parameter.id || 'undefined', parameter.plotId, parameter.propertyName, parameter.serviceId, parameter.collectionId, parameter.instanceId || 'undefined', ((_parameter$dimension = parameter.dimension) == null ? void 0 : _parameter$dimension.value) || 'undefined', intervalParam, selectedLocation.lat.toString() || 'undefined', selectedLocation.lon.toString() || 'undefined']),
3181
3252
  queryFn: function () {
3182
3253
  var _queryFn7 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee7() {
3183
3254
  var edrResponse;
@@ -3792,14 +3863,16 @@ var ParameterList = function ParameterList(_ref) {
3792
3863
  },
3793
3864
  id: plot.plotId,
3794
3865
  list: plot.parameters ? (_plot$parameters = plot.parameters) == null ? void 0 : _plot$parameters.map(function (param) {
3866
+ var _param$id, _param$instanceId;
3795
3867
  return {
3796
- id: param.plotId
3868
+ id: (_param$id = param.id) != null ? _param$id : param.propertyName + "-" + param.collectionId + "-" + param.serviceId + "-" + ((_param$instanceId = param.instanceId) != null ? _param$instanceId : '')
3797
3869
  };
3798
3870
  }) : [],
3799
3871
  onEnd: onSortEnd,
3800
3872
  setList: function setList() {},
3801
3873
  swapThreshold: 0.3,
3802
3874
  children: (_plot$parameters2 = plot.parameters) == null ? void 0 : _plot$parameters2.map(function (parameter) {
3875
+ var _parameter$id, _parameter$instanceId;
3803
3876
  var parameterIsEnabled = parameter.enabled !== false;
3804
3877
  var rowIsEnabled = plotIsEnabled && parameterIsEnabled;
3805
3878
  var styles = getStyles$1(rowIsEnabled);
@@ -3903,7 +3976,7 @@ var ParameterList = function ParameterList(_ref) {
3903
3976
  }),
3904
3977
  sx: styles.row
3905
3978
  })]
3906
- }, "" + parameter.id);
3979
+ }, (_parameter$id = parameter.id) != null ? _parameter$id : parameter.propertyName + "-" + parameter.collectionId + "-" + parameter.serviceId + "-" + ((_parameter$instanceId = parameter.instanceId) != null ? _parameter$instanceId : ''));
3907
3980
  })
3908
3981
  });
3909
3982
  };
@@ -3963,22 +4036,24 @@ var TimeSeriesSelectButtonConnect = function TimeSeriesSelectButtonConnect(_ref)
3963
4036
  var isOpenForPanel = isOpenInStore && currentSourcePanelId === panelId;
3964
4037
  return jsx(CustomTooltip, {
3965
4038
  title: t('timeseries-add-param-to-plot'),
3966
- children: jsx(CustomToggleButton, {
3967
- "data-testid": "timeSeriesSelectButton",
3968
- disabled: !isEnabled,
3969
- onClick: handleClick,
3970
- selected: !!isOpenForPanel && isSelectOpenForCurrentPlot,
3971
- sx: {
3972
- marginLeft: '4px',
3973
- height: '24px!important',
3974
- width: '24px',
3975
- paddingLeft: '5px',
3976
- svg: {
3977
- marginLeft: '8px'
3978
- }
3979
- },
3980
- variant: "tool",
3981
- children: jsx(TimeSeriesSelect$1, {})
4039
+ children: jsx("span", {
4040
+ children: jsx(CustomToggleButton, {
4041
+ "data-testid": "timeSeriesSelectButton",
4042
+ disabled: !isEnabled,
4043
+ onClick: handleClick,
4044
+ selected: !!isOpenForPanel && isSelectOpenForCurrentPlot,
4045
+ sx: {
4046
+ marginLeft: '4px',
4047
+ height: '24px!important',
4048
+ width: '24px',
4049
+ paddingLeft: '5px',
4050
+ svg: {
4051
+ marginLeft: '8px'
4052
+ }
4053
+ },
4054
+ variant: "tool",
4055
+ children: jsx(TimeSeriesSelect$1, {})
4056
+ })
3982
4057
  })
3983
4058
  });
3984
4059
  };
@@ -6919,11 +6994,17 @@ var LocationSelectButtonConnect = function LocationSelectButtonConnect(_ref) {
6919
6994
  }, [isLocationsDialogOpen, currentSourcePanelId]);
6920
6995
  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
6996
  var toggleLocationsDialog = function toggleLocationsDialog() {
6997
+ var newIsOpen = currentSourcePanelId !== panelId ? true : !isLocationsDialogOpen;
6922
6998
  dispatch(uiActions.setToggleOpenDialog({
6923
6999
  type: uiTypes.DialogTypes.TimeseriesLocations,
6924
- setOpen: currentSourcePanelId !== panelId ? true : !isLocationsDialogOpen,
7000
+ setOpen: newIsOpen,
6925
7001
  sourcePanelId: panelId
6926
7002
  }));
7003
+ dispatch(timeSeriesActions.setLocationsDialogOpen({
7004
+ panelId: panelId,
7005
+ isLocationsDialogOpen: newIsOpen,
7006
+ origin: TimeSeriesActionOrigin.timeSeriesManager
7007
+ }));
6927
7008
  };
6928
7009
  React.useEffect(function () {
6929
7010
  return function () {
@@ -7035,9 +7116,9 @@ var createParameterNames = function createParameterNames(plotsWithData) {
7035
7116
  // count per plot how many duplicate names there are
7036
7117
  var perBaseNamePlotCounters = new Map();
7037
7118
  return parameters.map(function (parameter) {
7038
- var _parameter$id, _duplicateParameterCo, _plotCounters$get, _parameter$enabled3;
7119
+ var _duplicateParameterCo, _plotCounters$get, _parameter$enabled3;
7039
7120
  var name = getParameterDisplayName(parameter);
7040
- var id = (_parameter$id = parameter.id) != null ? _parameter$id : '';
7121
+ var id = getParameterKey$1(parameter);
7041
7122
  var totalCount = (_duplicateParameterCo = duplicateParameterCount.get(name)) != null ? _duplicateParameterCo : 0;
7042
7123
  if (totalCount === 1) {
7043
7124
  var _parameter$enabled;
@@ -7285,6 +7366,14 @@ var isTimeSeriesParam = function isTimeSeriesParam(param) {
7285
7366
  var getParameterDisplayName = function getParameterDisplayName(parameter) {
7286
7367
  return parameter.propertyName + " - " + parameter.collectionId;
7287
7368
  };
7369
+ // Stable unique key: uses id when present, otherwise a composite fallback.
7370
+ var getParameterKey$1 = function getParameterKey(parameter) {
7371
+ var _parameter$instanceId, _parameter$dimension$, _parameter$dimension, _parameter$dimension$2, _parameter$dimension2;
7372
+ if (parameter.id) {
7373
+ return parameter.id;
7374
+ }
7375
+ return [parameter.plotId, parameter.propertyName, parameter.collectionId, (_parameter$instanceId = parameter.instanceId) != null ? _parameter$instanceId : '', (_parameter$dimension$ = (_parameter$dimension = parameter.dimension) == null ? void 0 : _parameter$dimension.id) != null ? _parameter$dimension$ : '', (_parameter$dimension$2 = (_parameter$dimension2 = parameter.dimension) == null ? void 0 : _parameter$dimension2.value) != null ? _parameter$dimension$2 : ''].join('|');
7376
+ };
7288
7377
  var roundDecimalValues = function roundDecimalValues(value) {
7289
7378
  if (isNaN(value) || value === null || value === undefined) {
7290
7379
  return 'no data';
@@ -7485,7 +7574,7 @@ var getSeries = function getSeries(plotCharts, parameterNames) {
7485
7574
  return Object.assign({
7486
7575
  data: getEChartsSeriesDataByTimestep(uniqueTimesteps, parameter),
7487
7576
  name: (_parameterNames$find = parameterNames.find(function (pName) {
7488
- return pName.id === parameter.id;
7577
+ return pName.id === getParameterKey$1(parameter);
7489
7578
  })) == null ? void 0 : _parameterNames$find.name,
7490
7579
  type: type,
7491
7580
  xAxisIndex: plotIndex,
@@ -7551,6 +7640,44 @@ function getPlotCharts(plotsWithData) {
7551
7640
  return plotCharts;
7552
7641
  }
7553
7642
 
7643
+ // Guard: mocked ReactECharts (forwardRef) has no real prototype chain.
7644
+ var reactEChartsProto = ReactECharts.prototype;
7645
+ var echartsReactCoreProto = reactEChartsProto ? Object.getPrototypeOf(reactEChartsProto) : null;
7646
+ if (echartsReactCoreProto != null && echartsReactCoreProto.renderNewEcharts) {
7647
+ var originalRenderNewEcharts = echartsReactCoreProto.renderNewEcharts;
7648
+ echartsReactCoreProto.renderNewEcharts = /*#__PURE__*/function () {
7649
+ var _patchedRenderNewEcharts = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee() {
7650
+ var _t;
7651
+ return _regenerator().w(function (_context) {
7652
+ while (1) switch (_context.p = _context.n) {
7653
+ case 0:
7654
+ _context.p = 0;
7655
+ _context.n = 1;
7656
+ return originalRenderNewEcharts.call(this);
7657
+ case 1:
7658
+ _context.n = 4;
7659
+ break;
7660
+ case 2:
7661
+ _context.p = 2;
7662
+ _t = _context.v;
7663
+ if (this.ele) {
7664
+ _context.n = 3;
7665
+ break;
7666
+ }
7667
+ return _context.a(2);
7668
+ case 3:
7669
+ throw _t;
7670
+ case 4:
7671
+ return _context.a(2);
7672
+ }
7673
+ }, _callee, this, [[0, 2]]);
7674
+ }));
7675
+ function patchedRenderNewEcharts() {
7676
+ return _patchedRenderNewEcharts.apply(this, arguments);
7677
+ }
7678
+ return patchedRenderNewEcharts;
7679
+ }();
7680
+ }
7554
7681
  var useChartHeight = function useChartHeight(_ref) {
7555
7682
  var plotsWithData = _ref.plotsWithData,
7556
7683
  shouldShowLegend = _ref.shouldShowLegend,
@@ -7564,6 +7691,9 @@ var useChartHeight = function useChartHeight(_ref) {
7564
7691
  setChartHeight = _React$useState[1];
7565
7692
  var chartRef = React.useRef(null);
7566
7693
  var updateHeight = React.useCallback(function (echartsInstance) {
7694
+ if (echartsInstance.isDisposed()) {
7695
+ return;
7696
+ }
7567
7697
  var legendApi = echartsInstance;
7568
7698
  if (legendApi.getModel() !== null) {
7569
7699
  var _option$grid;
@@ -7596,7 +7726,7 @@ var useChartHeight = function useChartHeight(_ref) {
7596
7726
  React.useEffect(function () {
7597
7727
  var _chartRef$current;
7598
7728
  var instance = (_chartRef$current = chartRef.current) == null ? void 0 : _chartRef$current.getEchartsInstance();
7599
- if (instance) {
7729
+ if (instance && !instance.isDisposed()) {
7600
7730
  instance.setOption({
7601
7731
  legend: {
7602
7732
  top: 0,
@@ -7610,7 +7740,7 @@ var useChartHeight = function useChartHeight(_ref) {
7610
7740
  var onHeight = function onHeight() {
7611
7741
  var _chartRef$current2;
7612
7742
  var instance = (_chartRef$current2 = chartRef.current) == null ? void 0 : _chartRef$current2.getEchartsInstance();
7613
- if (instance) {
7743
+ if (instance && !instance.isDisposed()) {
7614
7744
  updateHeight(instance);
7615
7745
  }
7616
7746
  };
@@ -8347,7 +8477,10 @@ var componentsLookUp = function componentsLookUp(_ref) {
8347
8477
  timeSeriesPreset: {
8348
8478
  plotPreset: initialProps.plotPreset,
8349
8479
  services: initialProps.services,
8350
- syncGroupsIds: initialProps.syncGroupsIds
8480
+ syncGroupsIds: initialProps.syncGroupsIds,
8481
+ locationMenuSize: initialProps.locationMenuSize,
8482
+ locationMenuPosition: initialProps.locationMenuPosition,
8483
+ isLocationsDialogOpen: initialProps.isLocationsDialogOpen
8351
8484
  }
8352
8485
  });
8353
8486
  }
@@ -8901,6 +9034,44 @@ var LocationSelectDialogConnect = function LocationSelectDialogConnect() {
8901
9034
  var timeSeriesLocation = useSelector(function (state) {
8902
9035
  return panelId ? getCurrentLocation(state, panelId) : undefined;
8903
9036
  });
9037
+ var locationMenuSize = useSelector(function (state) {
9038
+ return panelId ? getLocationMenuSize(state, panelId) : undefined;
9039
+ });
9040
+ var locationMenuPosition = useSelector(function (state) {
9041
+ return panelId ? getLocationMenuPosition(state, panelId) : undefined;
9042
+ });
9043
+ var locationDialogRestoreVersion = useSelector(function (state) {
9044
+ return getLocationDialogRestoreVersion(state);
9045
+ });
9046
+ var dialogOpenPanelId = useSelector(function (state) {
9047
+ return getDialogOpenPanelId(state);
9048
+ });
9049
+ useEffect(function () {
9050
+ if (locationDialogRestoreVersion === 0) {
9051
+ return;
9052
+ }
9053
+ if (dialogOpenPanelId) {
9054
+ dispatch(uiActions.setToggleOpenDialog({
9055
+ type: uiTypes.DialogTypes.TimeseriesLocations,
9056
+ setOpen: true,
9057
+ sourcePanelId: dialogOpenPanelId
9058
+ }));
9059
+ } else {
9060
+ dispatch(uiActions.setToggleOpenDialog({
9061
+ type: uiTypes.DialogTypes.TimeseriesLocations,
9062
+ setOpen: false
9063
+ }));
9064
+ }
9065
+ }, [locationDialogRestoreVersion, dialogOpenPanelId, dispatch]);
9066
+ useEffect(function () {
9067
+ if (!panelId) {
9068
+ return;
9069
+ }
9070
+ dispatch(timeSeriesActions.setLocationsDialogOpen({
9071
+ panelId: panelId,
9072
+ isLocationsDialogOpen: isDialogOpen
9073
+ }));
9074
+ }, [isDialogOpen, panelId, dispatch]);
8904
9075
  var _useTimeSeriesLocatio = useTimeSeriesLocations(panelId || ''),
8905
9076
  combinedGeoJson = _useTimeSeriesLocatio.combinedGeoJson,
8906
9077
  splitGeoJsonByCollection = _useTimeSeriesLocatio.splitGeoJsonByCollection;
@@ -8921,6 +9092,34 @@ var LocationSelectDialogConnect = function LocationSelectDialogConnect() {
8921
9092
  location: location
8922
9093
  }));
8923
9094
  }, [dispatch, panelId]);
9095
+ var handleClose = useCallback(function () {
9096
+ onCloseDialog();
9097
+ if (!panelId) {
9098
+ return;
9099
+ }
9100
+ dispatch(timeSeriesActions.setLocationsDialogOpen({
9101
+ panelId: panelId,
9102
+ isLocationsDialogOpen: false,
9103
+ origin: TimeSeriesActionOrigin.timeSeriesManager
9104
+ }));
9105
+ }, [dispatch, onCloseDialog, panelId]);
9106
+ var handleDragEnd = useCallback(function (position, size) {
9107
+ if (!panelId || typeof size.width !== 'number' || typeof size.height !== 'number') {
9108
+ return;
9109
+ }
9110
+ dispatch(timeSeriesActions.setLocationMenuSizeAndPosition({
9111
+ panelId: panelId,
9112
+ size: {
9113
+ width: size.width,
9114
+ height: size.height
9115
+ },
9116
+ position: {
9117
+ x: position.x,
9118
+ y: position.y
9119
+ },
9120
+ origin: TimeSeriesActionOrigin.timeSeriesManager
9121
+ }));
9122
+ }, [dispatch, panelId]);
8924
9123
  var setMapPinLocation = function setMapPinLocation(mapPinLocation) {
8925
9124
  selectedMapIds.forEach(function (mapId) {
8926
9125
  dispatch(mapActions.setMapPinLocation({
@@ -8976,14 +9175,20 @@ var LocationSelectDialogConnect = function LocationSelectDialogConnect() {
8976
9175
  bounds: "parent",
8977
9176
  isOpen: isDialogOpen,
8978
9177
  minWidth: 264,
8979
- onClose: onCloseDialog,
9178
+ onClose: handleClose,
9179
+ onDragEnd: handleDragEnd,
8980
9180
  onMouseDown: setDialogOrder,
8981
9181
  order: dialogOrder,
9182
+ resetPositionOnOpen: true,
9183
+ startDraggablePosition: locationMenuPosition != null ? locationMenuPosition : {
9184
+ x: 0,
9185
+ y: 0
9186
+ },
8982
9187
  startPosition: {
8983
9188
  top: 60,
8984
9189
  left: 200
8985
9190
  },
8986
- startSize: {
9191
+ startSize: locationMenuSize != null ? locationMenuSize : {
8987
9192
  width: 320,
8988
9193
  height: 500
8989
9194
  },
@@ -6,6 +6,15 @@ interface InitialTimeseriesProps {
6
6
  services: TimeSeriesService[];
7
7
  hideLocationMarkers?: boolean;
8
8
  syncGroupsIds: string[];
9
+ locationMenuSize?: {
10
+ width: number;
11
+ height: number;
12
+ };
13
+ locationMenuPosition?: {
14
+ x: number;
15
+ y: number;
16
+ };
17
+ isLocationsDialogOpen?: boolean;
9
18
  }
10
19
  export type SupportedComponentTypes = 'TimeSeries';
11
20
  export type InitialProps = InitialTimeseriesProps;
@@ -1,6 +1,6 @@
1
1
  import type { Reducer } from '@reduxjs/toolkit';
2
2
  import type { TimeSeriesService } from '@opengeoweb/shared';
3
- import type { ServiceFilterChipsObject, SetCurrentParameterInfo, SetSearchFilterPayload, MovePlotPayload, SetTimeSeriesServicesPayload, TimeSeriesState, TimeSeriesStoreType, ParameterManipulationPayload, UpdateTitlePayload, MoveParameterPayload, SetTimeSeriesServicePopupPayload, UpsertTimeSeriesServicePayload, RemoveServiceFilterChipFromStorePayload, RemoveTimeSeriesServicePayload, ParameterActionPayload, PlotActionPayload, AddPlotPayload, ParameterPatchPayload, ToggleDisableMapPinPayload, ToggleLocationMarkersPayload, ToggleTimeSeriesLegendPayload, SetTimeSeriesLocationPayload, RegisterTimeSeriesPresetPayload } from './types';
3
+ import type { ServiceFilterChipsObject, SetCurrentParameterInfo, SetSearchFilterPayload, MovePlotPayload, SetTimeSeriesServicesPayload, TimeSeriesState, TimeSeriesStoreType, ParameterManipulationPayload, UpdateTitlePayload, MoveParameterPayload, SetTimeSeriesServicePopupPayload, UpsertTimeSeriesServicePayload, RemoveServiceFilterChipFromStorePayload, RemoveTimeSeriesServicePayload, ParameterActionPayload, PlotActionPayload, AddPlotPayload, ParameterPatchPayload, ToggleDisableMapPinPayload, ToggleLocationMarkersPayload, ToggleTimeSeriesLegendPayload, SetTimeSeriesLocationPayload, RegisterTimeSeriesPresetPayload, SetLocationMenuSizeAndPositionPayload, SetLocationsDialogOpenPayload } from './types';
4
4
  export declare const timeseriesSelectServiceFilterChipsAdapter: import("@reduxjs/toolkit").EntityAdapter<ServiceFilterChipsObject, string>;
5
5
  export declare const initialState: TimeSeriesState;
6
6
  export declare const createPanelState: () => TimeSeriesStoreType;
@@ -49,6 +49,8 @@ export declare const timeSeriesActions: {
49
49
  toggleLocationMarkers: import("@reduxjs/toolkit").ActionCreatorWithPayload<ToggleLocationMarkersPayload, "timeseriesPanel/toggleLocationMarkers">;
50
50
  toggleLegend: import("@reduxjs/toolkit").ActionCreatorWithPayload<ToggleTimeSeriesLegendPayload, "timeseriesPanel/toggleLegend">;
51
51
  setCurrentLocation: import("@reduxjs/toolkit").ActionCreatorWithPayload<SetTimeSeriesLocationPayload, "timeseriesPanel/setCurrentLocation">;
52
+ setLocationMenuSizeAndPosition: import("@reduxjs/toolkit").ActionCreatorWithPayload<SetLocationMenuSizeAndPositionPayload, "timeseriesPanel/setLocationMenuSizeAndPosition">;
53
+ setLocationsDialogOpen: import("@reduxjs/toolkit").ActionCreatorWithPayload<SetLocationsDialogOpenPayload, "timeseriesPanel/setLocationsDialogOpen">;
52
54
  };
53
55
  export declare const timeSeriesReducer: Reducer<TimeSeriesState>;
54
56
  export declare const generateServiceId: () => string;
@@ -264,13 +264,41 @@ export declare const getServicePopupDetails: ((state: TimeSeriesStateSlice, pane
264
264
  memoize: typeof import("reselect").weakMapMemoize;
265
265
  argsMemoize: typeof import("reselect").weakMapMemoize;
266
266
  };
267
+ export declare const getLocationDialogRestoreVersion: (state: TimeSeriesStateSlice) => number;
268
+ /**
269
+ * Returns the panelId of the first panel that has isLocationsDialogOpen: true or undefined.
270
+ * @param {object} state store: object - store object
271
+ * @returns {string | undefined} returnType: string | undefined
272
+ */
273
+ export declare const getDialogOpenPanelId: (state: TimeSeriesStateSlice) => string | undefined;
274
+ export declare const getLocationMenuSize: (state: TimeSeriesStateSlice, panelId?: string) => {
275
+ width: number;
276
+ height: number;
277
+ } | undefined;
278
+ export declare const getLocationMenuPosition: (state: TimeSeriesStateSlice, panelId?: string) => {
279
+ x: number;
280
+ y: number;
281
+ } | undefined;
282
+ export declare const getLocationsDialogOpen: (state: TimeSeriesStateSlice, panelId?: string) => boolean;
267
283
  export declare const getTimeSeriesPreset: ((state: TimeSeriesStateSlice, panelId?: string | undefined) => TimeSeriesPreset | undefined) & {
268
284
  clearCache: () => void;
269
285
  resultsCount: () => number;
270
286
  resetResultsCount: () => void;
271
287
  } & {
272
- resultFunc: (resultFuncArgs_0: PlotPreset | undefined, resultFuncArgs_1: TimeSeriesService[] | undefined) => TimeSeriesPreset | undefined;
273
- memoizedResultFunc: ((resultFuncArgs_0: PlotPreset | undefined, resultFuncArgs_1: TimeSeriesService[] | undefined) => TimeSeriesPreset | undefined) & {
288
+ resultFunc: (resultFuncArgs_0: PlotPreset | undefined, resultFuncArgs_1: TimeSeriesService[] | undefined, resultFuncArgs_2: {
289
+ width: number;
290
+ height: number;
291
+ } | undefined, resultFuncArgs_3: {
292
+ x: number;
293
+ y: number;
294
+ } | undefined, resultFuncArgs_4: boolean) => TimeSeriesPreset | undefined;
295
+ memoizedResultFunc: ((resultFuncArgs_0: PlotPreset | undefined, resultFuncArgs_1: TimeSeriesService[] | undefined, resultFuncArgs_2: {
296
+ width: number;
297
+ height: number;
298
+ } | undefined, resultFuncArgs_3: {
299
+ x: number;
300
+ y: number;
301
+ } | undefined, resultFuncArgs_4: boolean) => TimeSeriesPreset | undefined) & {
274
302
  clearCache: () => void;
275
303
  resultsCount: () => number;
276
304
  resetResultsCount: () => void;
@@ -296,7 +324,13 @@ export declare const getTimeSeriesPreset: ((state: TimeSeriesStateSlice, panelId
296
324
  } & {
297
325
  memoize: typeof import("reselect").weakMapMemoize;
298
326
  argsMemoize: typeof import("reselect").weakMapMemoize;
299
- }];
327
+ }, (state: TimeSeriesStateSlice, panelId?: string) => {
328
+ width: number;
329
+ height: number;
330
+ } | undefined, (state: TimeSeriesStateSlice, panelId?: string) => {
331
+ x: number;
332
+ y: number;
333
+ } | undefined, (state: TimeSeriesStateSlice, panelId?: string) => boolean];
300
334
  recomputations: () => number;
301
335
  resetRecomputations: () => void;
302
336
  dependencyRecomputations: () => number;
@@ -43,6 +43,15 @@ export interface TimeseriesLocationData {
43
43
  shouldHideLocationMarkers?: boolean;
44
44
  isLegendVisible?: boolean;
45
45
  currentLocation?: TimeSeriesLocation | undefined;
46
+ locationMenuSize?: {
47
+ width: number;
48
+ height: number;
49
+ };
50
+ locationMenuPosition?: {
51
+ x: number;
52
+ y: number;
53
+ };
54
+ isLocationsDialogOpen?: boolean;
46
55
  }
47
56
  export interface TimeSeriesStoreType {
48
57
  plotPreset?: PlotPreset;
@@ -53,11 +62,22 @@ export interface TimeSeriesStoreType {
53
62
  export interface TimeSeriesState {
54
63
  byId: Record<string, TimeSeriesStoreType>;
55
64
  services: TimeSeriesService[];
65
+ /** Increments whenever any panel's preset is registered; triggers dialog-state restore in LocationSelectDialogConnect. */
66
+ locationDialogRestoreVersion?: number;
56
67
  }
57
68
  export interface TimeSeriesPreset {
58
69
  plotPreset: PlotPreset;
59
70
  services: TimeSeriesService[];
60
71
  syncGroupsIds: string[];
72
+ locationMenuSize?: {
73
+ width: number;
74
+ height: number;
75
+ };
76
+ locationMenuPosition?: {
77
+ x: number;
78
+ y: number;
79
+ };
80
+ isLocationsDialogOpen?: boolean;
61
81
  }
62
82
  export interface TimeSeriesPayload {
63
83
  panelId?: string;
@@ -66,6 +86,15 @@ export interface TimeSeriesPayload {
66
86
  export interface RegisterTimeSeriesPresetPayload extends TimeSeriesPayload {
67
87
  plotPreset: PlotPreset;
68
88
  services?: TimeSeriesService[];
89
+ locationMenuSize?: {
90
+ width: number;
91
+ height: number;
92
+ };
93
+ locationMenuPosition?: {
94
+ x: number;
95
+ y: number;
96
+ };
97
+ isLocationsDialogOpen?: boolean;
69
98
  }
70
99
  export interface ParameterManipulationPayload extends TimeSeriesPayload {
71
100
  parameter: Parameter;
@@ -150,3 +179,16 @@ export interface SetTimeSeriesLocationPayload {
150
179
  panelId?: string;
151
180
  location: TimeSeriesLocation | undefined;
152
181
  }
182
+ export interface SetLocationMenuSizeAndPositionPayload extends TimeSeriesPayload {
183
+ size: {
184
+ width: number;
185
+ height: number;
186
+ };
187
+ position?: {
188
+ x: number;
189
+ y: number;
190
+ };
191
+ }
192
+ export interface SetLocationsDialogOpenPayload extends TimeSeriesPayload {
193
+ isLocationsDialogOpen: boolean;
194
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@opengeoweb/time-series",
3
- "version": "19.4.0",
3
+ "version": "19.5.1",
4
4
  "description": "GeoWeb time-series library for the opengeoweb project",
5
5
  "license": "Apache-2.0",
6
6
  "repository": {