@opengeoweb/store 9.35.0 → 9.36.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
@@ -5,7 +5,7 @@ export { defaultLayers } from '@opengeoweb/webmap-react';
5
5
  import { dateUtils, PROJECTION, defaultDelay, withEggs } from '@opengeoweb/shared';
6
6
  import { defaultTimeStep, defaultTimeSpan, defaultAnimationDelayAtStart, defaultSecondsPerPx, roundWithTimeStep, getSpeedDelay } from '@opengeoweb/timeslider';
7
7
  import { produce } from 'immer';
8
- import { isEqual, isEmpty, pick, compact } from 'lodash';
8
+ import { isEqual, isEmpty, compact } from 'lodash';
9
9
  import { useSelector, useDispatch, Provider } from 'react-redux';
10
10
  import { useCallback, useEffect } from 'react';
11
11
  import { metronome } from '@opengeoweb/metronome';
@@ -3463,17 +3463,32 @@ var initialState$3 = {
3463
3463
  sourcesById: []
3464
3464
  }
3465
3465
  },
3466
- isTimeScrollingEnabled: false,
3467
3466
  linkedState: {
3468
3467
  links: {},
3469
3468
  sharedData: {}
3470
- }
3469
+ },
3470
+ isTimeScrollingEnabled: false
3471
3471
  };
3472
3472
  var slice$4 = createSlice({
3473
3473
  initialState: initialState$3,
3474
3474
  name: 'synchronizationGroupsReducer',
3475
3475
  reducers: {
3476
- changeLinkedMap: function changeLinkedMap(draft, action) {
3476
+ /** Sets the links map.
3477
+ * This is used to override the links when changing workspaces.
3478
+ * @param draft sync state
3479
+ * @param {Record<string, string[]>} action.newLinks the new links object
3480
+ */
3481
+ setLinkedMap: function setLinkedMap(draft, action) {
3482
+ var newLinks = action.payload.newLinks;
3483
+ draft.linkedState.links = newLinks;
3484
+ },
3485
+ /** Updates the links map.
3486
+ * This is used to update the links when operating the link menu.
3487
+ * @param draft sync state
3488
+ * @param {string} action.panelId id of the panel updating it's links
3489
+ * @param {string[]} action.mapIds the new linked maps
3490
+ */
3491
+ updateLinkedMap: function updateLinkedMap(draft, action) {
3477
3492
  var _action$payload = action.payload,
3478
3493
  panelId = _action$payload.panelId,
3479
3494
  mapIds = _action$payload.mapIds;
@@ -3487,7 +3502,6 @@ var slice$4 = createSlice({
3487
3502
  },
3488
3503
  deleteSharedData: function deleteSharedData(draft, action) {
3489
3504
  var panelId = action.payload.panelId;
3490
- delete draft.linkedState.links[panelId];
3491
3505
  delete draft.linkedState.sharedData[panelId];
3492
3506
  },
3493
3507
  syncGroupAddSource: function syncGroupAddSource(draft, action) {
@@ -4131,27 +4145,85 @@ var getLinkedFeatureProviders = function getLinkedFeatureProviders(linkedState,
4131
4145
  var selectSharedData = createSelector([selectLinkedState, function (store, panelId) {
4132
4146
  return panelId;
4133
4147
  }], function (linkedState, panelId) {
4134
- return pick(linkedState.sharedData, [panelId]);
4148
+ return (linkedState == null ? void 0 : linkedState.sharedData[panelId]) || {};
4149
+ });
4150
+ var selectLinkedPanelId = createSelector([selectLinkedState, function (_, mapViewId) {
4151
+ return mapViewId;
4152
+ }], function (linkedState, mapViewId) {
4153
+ if (!linkedState || !linkedState.links) {
4154
+ return undefined;
4155
+ }
4156
+ // Find the panelId where mapView(s) is linked
4157
+ var panelId = Object.keys(linkedState.links).find(function (panelId) {
4158
+ var _linkedState$links$pa;
4159
+ return (_linkedState$links$pa = linkedState.links[panelId]) == null ? void 0 : _linkedState$links$pa.includes(mapViewId);
4160
+ });
4161
+ return panelId;
4162
+ });
4163
+ var selectMapViewsForPanelId = createSelector([function (linkedState, panelId) {
4164
+ return linkedState.links[panelId];
4165
+ }], function (mapViews) {
4166
+ if (!mapViews) {
4167
+ return undefined;
4168
+ }
4169
+ return mapViews;
4135
4170
  });
4136
4171
  var selectLinkedFeatures = createSelector([function (linkedState) {
4137
4172
  return linkedState;
4138
4173
  }, getLinkedFeatureProviders], function (linkedState, featureProviders) {
4139
4174
  var features = featureProviders.flatMap(function (providerId) {
4140
4175
  var _linkedState$sharedDa;
4141
- return (_linkedState$sharedDa = linkedState.sharedData[providerId]) == null ? void 0 : _linkedState$sharedDa.features;
4176
+ return ((_linkedState$sharedDa = linkedState.sharedData[providerId]) == null ? void 0 : _linkedState$sharedDa.features) || [];
4142
4177
  }).filter(function (f) {
4143
4178
  return f !== undefined;
4144
4179
  });
4145
4180
  return features;
4146
4181
  });
4182
+ var getSelectedFeature = createSelector([
4183
+ // eslint-disable-next-line @typescript-eslint/explicit-function-return-type
4184
+ function (state, mapId) {
4185
+ var _state$linkedState;
4186
+ var sharedData = (_state$linkedState = state.linkedState) == null ? void 0 : _state$linkedState.sharedData[mapId];
4187
+ var _ref = sharedData || {},
4188
+ _ref$features = _ref.features,
4189
+ features = _ref$features === void 0 ? [] : _ref$features,
4190
+ selectedFeatureId = _ref.selectedFeatureId;
4191
+ return {
4192
+ features: features,
4193
+ selectedFeatureId: selectedFeatureId
4194
+ };
4195
+ }], function (_ref2) {
4196
+ var _features$;
4197
+ var features = _ref2.features,
4198
+ selectedFeatureId = _ref2.selectedFeatureId;
4199
+ var selectedFeature = (_features$ = features[0]) == null ? void 0 : _features$.geoJSON.features.find(function (feature) {
4200
+ return feature.id === selectedFeatureId;
4201
+ });
4202
+ if (selectedFeature && selectedFeature.geometry.type === 'Point') {
4203
+ var _selectedFeature$prop, _selectedFeature$prop2, _selectedFeature$prop3;
4204
+ var coordinates = selectedFeature.geometry.coordinates;
4205
+ return {
4206
+ lat: coordinates[1],
4207
+ lon: coordinates[0],
4208
+ id: selectedFeature.id,
4209
+ serviceId: (_selectedFeature$prop = selectedFeature.properties) == null ? void 0 : _selectedFeature$prop.serviceId,
4210
+ collectionId: (_selectedFeature$prop2 = selectedFeature.properties) == null ? void 0 : _selectedFeature$prop2.collectionId,
4211
+ name: (_selectedFeature$prop3 = selectedFeature.properties) == null ? void 0 : _selectedFeature$prop3.name
4212
+ };
4213
+ }
4214
+ return null;
4215
+ });
4147
4216
 
4148
4217
  var selectors$4 = /*#__PURE__*/Object.freeze({
4149
4218
  __proto__: null,
4150
4219
  getLinkedFeatureProviders: getLinkedFeatureProviders,
4151
4220
  getLinkedMaps: getLinkedMaps,
4221
+ getSelectedFeature: getSelectedFeature,
4152
4222
  getSynchronizationGroupStore: getSynchronizationGroupStore,
4153
4223
  getTime: getTime,
4154
4224
  selectLinkedFeatures: selectLinkedFeatures,
4225
+ selectLinkedPanelId: selectLinkedPanelId,
4226
+ selectMapViewsForPanelId: selectMapViewsForPanelId,
4155
4227
  selectSharedData: selectSharedData
4156
4228
  });
4157
4229
 
@@ -4173,6 +4245,9 @@ var selectors$4 = /*#__PURE__*/Object.freeze({
4173
4245
  * Copyright 2024 - The Norwegian Meteorological Institute (MET Norway)
4174
4246
  * */
4175
4247
  var useUpdateSharedData = function useUpdateSharedData(data, panelId) {
4248
+ var sharedData = useSelector(function (state) {
4249
+ return selectSharedData(state, panelId);
4250
+ });
4176
4251
  var linkedMaps = useSelector(function (store) {
4177
4252
  return getLinkedMaps(store, panelId);
4178
4253
  });
@@ -4187,13 +4262,15 @@ var useUpdateSharedData = function useUpdateSharedData(data, panelId) {
4187
4262
  };
4188
4263
  }, [dispatch, panelId]);
4189
4264
  useEffect(function () {
4190
- if (panelId && (linkedMaps == null ? void 0 : linkedMaps.length) > 0) {
4265
+ var diff = Object.assign({}, sharedData, data);
4266
+ if (panelId && (linkedMaps == null ? void 0 : linkedMaps.length) > 0 && !isEqual(diff, sharedData)) {
4191
4267
  dispatch(actions.addSharedData({
4192
4268
  panelId: panelId,
4193
4269
  data: data
4194
4270
  }));
4195
4271
  }
4196
- }, [panelId, linkedMaps, data, dispatch]);
4272
+ }, [panelId, linkedMaps, data, sharedData, dispatch]);
4273
+ return sharedData;
4197
4274
  };
4198
4275
 
4199
4276
  /* *
@@ -5016,8 +5093,8 @@ var getPinLocation = createSelector(getMapById, function (store) {
5016
5093
  * @param {string} mapId mapId: string - Id of the map
5017
5094
  * @returns {boolean} returnType: boolean
5018
5095
  */
5019
- var getDisableMapPin = createSelector(getMapById, function (store) {
5020
- return store ? store.disableMapPin : false;
5096
+ var getDisableMapPin = createSelector([getMapById], function (map) {
5097
+ return map == null ? void 0 : map.disableMapPin;
5021
5098
  }, selectorMemoizationOptions);
5022
5099
  /**
5023
5100
  * Returns the display map pin boolean for the current map
@@ -6415,7 +6492,7 @@ mapListener.startListening({
6415
6492
  actionCreator: mapActions.setMapPreset,
6416
6493
  effect: function () {
6417
6494
  var _effect2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(_ref6, listenerApi) {
6418
- var payload, mapId, initialProps, mapPreset, layers, activeLayerId, autoTimeStepLayerId, autoUpdateLayerId, proj, shouldAutoUpdate, shouldAnimate, animationPayload, toggleTimestepAuto, showTimeSlider, displayMapPin, shouldShowZoomControls, shouldShowLegend, dockedLayerManagerSize, _filterLayers, mapLayers, baseLayers, overLayers, _newLayerIds$layers$, _newLayerIds$autoTime, _newLayerIds$autoUpda, autoTimeStepLayerIdNew, autoUpdateLayerIdNew, onlyActiveLayerIdIsSet, newLayerIds, firstLayerId, customLayers, customBaseLayer, customOverLayer, baseLayersWithDefaultLayer, overLayersWithDefaultLayer, allBaseLayers, checkIsprojectionSupported, animationLength, animationEndTime, shouldEndtimeOverride, interval, endTime, startTime, centerTimeInSeconds, animationEnd, _startTime, duration, _animationEnd, animationStart, shouldOpenLegend, legendId, fiveMinuteDelayForAnimation, _animationEnd2, _animationStart;
6495
+ var payload, mapId, initialProps, mapPreset, layers, activeLayerId, autoTimeStepLayerId, autoUpdateLayerId, proj, shouldAutoUpdate, shouldAnimate, animationPayload, toggleTimestepAuto, showTimeSlider, displayMapPin, shouldShowZoomControls, shouldShowLegend, dockedLayerManagerSize, _filterLayers, mapLayers, baseLayers, overLayers, _newLayerIds$layers$f, _newLayerIds$layers$, _newLayerIds$layers$f2, _newLayerIds$layers$2, autoTimeStepLayerIdNew, autoUpdateLayerIdNew, onlyActiveLayerIdIsSet, newLayerIds, newAutoUpdateLayerId, newAutoTimeStepLayerId, customLayers, customBaseLayer, customOverLayer, baseLayersWithDefaultLayer, overLayersWithDefaultLayer, allBaseLayers, checkIsprojectionSupported, animationLength, animationEndTime, shouldEndtimeOverride, interval, endTime, startTime, centerTimeInSeconds, animationEnd, _startTime, duration, _animationEnd, animationStart, shouldOpenLegend, legendId, fiveMinuteDelayForAnimation, _animationEnd2, _animationStart;
6419
6496
  return _regeneratorRuntime().wrap(function _callee2$(_context2) {
6420
6497
  while (1) switch (_context2.prev = _context2.next) {
6421
6498
  case 0:
@@ -6447,12 +6524,17 @@ mapListener.startListening({
6447
6524
  mapId: mapId,
6448
6525
  layers: newLayerIds.layers
6449
6526
  }));
6450
- // set active layer if given otherwise to first layer
6451
- firstLayerId = (_newLayerIds$layers$ = newLayerIds.layers[0]) == null ? void 0 : _newLayerIds$layers$.id;
6527
+ // make sure layer with new id exist and if not, default to first layer
6528
+ newAutoUpdateLayerId = ((_newLayerIds$layers$f = newLayerIds.layers.find(function (layer) {
6529
+ return layer.id === newLayerIds.autoUpdateLayerId;
6530
+ })) == null ? void 0 : _newLayerIds$layers$f.id) || ((_newLayerIds$layers$ = newLayerIds.layers[0]) == null ? void 0 : _newLayerIds$layers$.id);
6531
+ newAutoTimeStepLayerId = ((_newLayerIds$layers$f2 = newLayerIds.layers.find(function (layer) {
6532
+ return layer.id === newLayerIds.autoTimeStepLayerId;
6533
+ })) == null ? void 0 : _newLayerIds$layers$f2.id) || ((_newLayerIds$layers$2 = newLayerIds.layers[0]) == null ? void 0 : _newLayerIds$layers$2.id);
6452
6534
  listenerApi.dispatch(mapActions.setAutoLayerId({
6453
6535
  mapId: mapId,
6454
- autoTimeStepLayerId: (_newLayerIds$autoTime = newLayerIds.autoTimeStepLayerId) != null ? _newLayerIds$autoTime : firstLayerId,
6455
- autoUpdateLayerId: (_newLayerIds$autoUpda = newLayerIds.autoUpdateLayerId) != null ? _newLayerIds$autoUpda : firstLayerId
6536
+ autoUpdateLayerId: newAutoUpdateLayerId,
6537
+ autoTimeStepLayerId: newAutoTimeStepLayerId
6456
6538
  }));
6457
6539
  }
6458
6540
  customLayers = getdefaultMapSettingsLayers(listenerApi.getState());
@@ -6823,15 +6905,17 @@ serviceListener.startListening({
6823
6905
  }()
6824
6906
  });
6825
6907
 
6908
+ // use `required` type because all props are provided
6826
6909
  var mapStoreReducers = {
6827
6910
  webmap: reducer$4,
6828
6911
  services: reducer$2,
6829
6912
  layers: reducer$6
6830
6913
  };
6914
+ var mapStoreMiddlewares = [metronomeListener.middleware, layersListener.middleware, mapUiListener.middleware, mapListener.middleware, serviceListener.middleware];
6831
6915
  var mapStoreModuleConfig = {
6832
6916
  id: 'webmap-module',
6833
6917
  reducersMap: mapStoreReducers,
6834
- middlewares: [metronomeListener.middleware, layersListener.middleware, mapUiListener.middleware, mapListener.middleware, serviceListener.middleware]
6918
+ middlewares: mapStoreMiddlewares
6835
6919
  };
6836
6920
 
6837
6921
  /* *
@@ -7375,7 +7459,6 @@ var routerActions = slice$1.actions;
7375
7459
  * */
7376
7460
  // stores navigate hook method to object, so it can be used outside components
7377
7461
  var historyDict = {
7378
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
7379
7462
  navigate: null
7380
7463
  };
7381
7464
 
@@ -7395,7 +7478,7 @@ routerListener.startListening({
7395
7478
  case 0:
7396
7479
  payload = _ref.payload;
7397
7480
  listenerApi.cancelActiveListeners();
7398
- historyDict.navigate(payload.url);
7481
+ historyDict.navigate && historyDict.navigate(payload.url);
7399
7482
  case 3:
7400
7483
  case "end":
7401
7484
  return _context.stop();
@@ -7426,12 +7509,14 @@ routerListener.startListening({
7426
7509
  * Copyright 2023 - Finnish Meteorological Institute (FMI)
7427
7510
  * Copyright 2024 - The Norwegian Meteorological Institute (MET Norway)
7428
7511
  * */
7512
+ var routerReducersMap = {
7513
+ router: reducer$1
7514
+ };
7515
+ var routerMiddlewares = [routerListener.middleware];
7429
7516
  var routerModuleConfig = {
7430
7517
  id: 'router',
7431
- reducersMap: {
7432
- router: reducer$1
7433
- },
7434
- middlewares: [routerListener.middleware]
7518
+ reducersMap: routerReducersMap,
7519
+ middlewares: routerMiddlewares
7435
7520
  };
7436
7521
 
7437
7522
  /* *
@@ -7948,12 +8033,14 @@ drawingToolListener.startListening({
7948
8033
  * Copyright 2023 - Finnish Meteorological Institute (FMI)
7949
8034
  * Copyright 2024 - The Norwegian Meteorological Institute (MET Norway)
7950
8035
  * */
8036
+ var drawtoolReducersMap = {
8037
+ drawingtools: reducer
8038
+ };
8039
+ var drawtoolMiddlewares = [drawingToolListener.middleware];
7951
8040
  var drawtoolModuleConfig = {
7952
8041
  id: 'drawtool-module',
7953
- reducersMap: {
7954
- drawingtools: reducer
7955
- },
7956
- middlewares: [drawingToolListener.middleware]
8042
+ reducersMap: drawtoolReducersMap,
8043
+ middlewares: drawtoolMiddlewares
7957
8044
  };
7958
8045
 
7959
8046
  /* *
@@ -8114,6 +8201,87 @@ var mockStateMapWithLayer = function mockStateMapWithLayer(layer, mapId) {
8114
8201
  })
8115
8202
  };
8116
8203
  };
8204
+ var mockLinkedState = function mockLinkedState() {
8205
+ return {
8206
+ syncronizationGroupStore: Object.assign({}, initialState$3, {
8207
+ viewState: {
8208
+ timeslider: {
8209
+ groups: [{
8210
+ id: 'dummyId1',
8211
+ selected: ['mapId1', 'mapId2']
8212
+ }],
8213
+ sourcesById: []
8214
+ },
8215
+ zoompane: {
8216
+ groups: [],
8217
+ sourcesById: []
8218
+ },
8219
+ level: {
8220
+ groups: [],
8221
+ sourcesById: []
8222
+ }
8223
+ },
8224
+ linkedState: {
8225
+ links: {
8226
+ mapId: ['mapId1', 'mapId2']
8227
+ },
8228
+ sharedData: {
8229
+ mapId1: {
8230
+ features: [{
8231
+ id: 'feature1',
8232
+ geoJSON: {
8233
+ type: 'FeatureCollection',
8234
+ features: [{
8235
+ type: 'Feature',
8236
+ properties: {
8237
+ name: 'Feature 1'
8238
+ },
8239
+ geometry: {
8240
+ type: 'Point',
8241
+ coordinates: [0, 0]
8242
+ }
8243
+ }, {
8244
+ type: 'Feature',
8245
+ properties: {
8246
+ name: 'Feature 2'
8247
+ },
8248
+ geometry: {
8249
+ type: 'Point',
8250
+ coordinates: [1, 1]
8251
+ }
8252
+ }]
8253
+ }
8254
+ }, {
8255
+ id: 'feature2',
8256
+ geoJSON: {
8257
+ type: 'FeatureCollection',
8258
+ features: [{
8259
+ type: 'Feature',
8260
+ properties: {
8261
+ name: 'Feature 3'
8262
+ },
8263
+ geometry: {
8264
+ type: 'Point',
8265
+ coordinates: [2, 2]
8266
+ }
8267
+ }, {
8268
+ type: 'Feature',
8269
+ properties: {
8270
+ name: 'Feature 4'
8271
+ },
8272
+ geometry: {
8273
+ type: 'Point',
8274
+ coordinates: [3, 3]
8275
+ }
8276
+ }]
8277
+ }
8278
+ }]
8279
+ }
8280
+ }
8281
+ }
8282
+ })
8283
+ };
8284
+ };
8117
8285
  var webmapStateWithMultipleLayers = function webmapStateWithMultipleLayers(layers, mapId) {
8118
8286
  var webmap = createWebmapState(mapId);
8119
8287
  // Add the layers to the map state
@@ -8243,6 +8411,7 @@ var storeTestUtils = /*#__PURE__*/Object.freeze({
8243
8411
  createMapDimensionsState: createMapDimensionsState,
8244
8412
  createMultipleLayersState: createMultipleLayersState,
8245
8413
  createWebmapState: createWebmapState,
8414
+ mockLinkedState: mockLinkedState,
8246
8415
  mockStateMapWithAnimationDelayWithoutLayers: mockStateMapWithAnimationDelayWithoutLayers,
8247
8416
  mockStateMapWithDimensions: mockStateMapWithDimensions,
8248
8417
  mockStateMapWithLayer: mockStateMapWithLayer,
@@ -8253,13 +8422,15 @@ var storeTestUtils = /*#__PURE__*/Object.freeze({
8253
8422
  webmapStateWithAddedLayer: webmapStateWithAddedLayer
8254
8423
  });
8255
8424
 
8425
+ var synchronizationGroupReducersMap = {
8426
+ syncronizationGroupStore: reducer$3,
8427
+ loadingIndicatorStore: loadingIndicatorReducer
8428
+ };
8429
+ var synchronizationGroupMiddlewares = [genericListener.middleware, syncGroupsListener.middleware];
8256
8430
  var synchronizationGroupConfig = {
8257
8431
  id: 'syncronizationGroupStore-module',
8258
- reducersMap: {
8259
- syncronizationGroupStore: reducer$3,
8260
- loadingIndicatorStore: loadingIndicatorReducer
8261
- },
8262
- middlewares: [genericListener.middleware, syncGroupsListener.middleware]
8432
+ reducersMap: synchronizationGroupReducersMap,
8433
+ middlewares: synchronizationGroupMiddlewares
8263
8434
  };
8264
8435
 
8265
8436
  /* *
@@ -8279,11 +8450,12 @@ var synchronizationGroupConfig = {
8279
8450
  * Copyright 2022 - Finnish Meteorological Institute (FMI)
8280
8451
  * Copyright 2024 - The Norwegian Meteorological Institute (MET Norway)
8281
8452
  * */
8453
+ var uiReducersMap = {
8454
+ ui: reducer$5
8455
+ };
8282
8456
  var uiModuleConfig = {
8283
8457
  id: 'ui-module',
8284
- reducersMap: {
8285
- ui: reducer$5
8286
- }
8458
+ reducersMap: uiReducersMap
8287
8459
  };
8288
8460
 
8289
8461
  /* *
@@ -8304,6 +8476,8 @@ var uiModuleConfig = {
8304
8476
  * Copyright 2024 - The Norwegian Meteorological Institute (MET Norway)
8305
8477
  * */
8306
8478
  var coreModuleConfig = [mapStoreModuleConfig, synchronizationGroupConfig, uiModuleConfig, drawtoolModuleConfig];
8479
+ var coreModuleReducersMap = Object.assign({}, mapStoreReducers, synchronizationGroupReducersMap, uiReducersMap, drawtoolReducersMap);
8480
+ var coreModuleMiddlewares = [].concat(mapStoreMiddlewares, synchronizationGroupMiddlewares, drawtoolMiddlewares);
8307
8481
 
8308
8482
  /* *
8309
8483
  * Licensed under the Apache License, Version 2.0 (the "License");
@@ -8359,4 +8533,4 @@ var StoreProvider = function StoreProvider(_ref2) {
8359
8533
  });
8360
8534
  };
8361
8535
 
8362
- export { IS_LEGEND_OPEN_BY_DEFAULT, StoreProvider, coreModuleConfig, createCustomStore, drawtoolActions, drawtoolModuleConfig, reducer as drawtoolReducer, selectors as drawtoolSelectors, filterLayers$1 as filterLayers, genericActions, genericListener, selectors$4 as genericSelectors, types$1 as genericTypes, getSingularDrawtoolDrawLayerId, getUserAddedServices, initialState$3 as initialState, layerActions, reducer$6 as layerReducer, selectors$7 as layerSelectors, types$5 as layerTypes, utils$2 as layerUtils, constants as linkComponentTypesConstants, loadingIndicatorActions, constants$1 as loadingIndicatorConstants, loadingIndicatorReducer, selectors$3 as loadingIndicatorSelectors, mapActions, enums as mapEnums, mapListener, selectors$2 as mapSelectors, mapStoreActions, mapStoreModuleConfig, mapStoreReducers, types$4 as mapTypes, mapUtils, routerActions, routerModuleConfig, utils as routerUtils, selectorMemoizationOptions, serviceActions, selectors$1 as serviceSelectors, types as serviceTypes, setUserAddedServices, storeTestSettings, storeTestUtils, utils$1 as storeUtils, constants$2 as syncConstants, actions as syncGroupsActions, syncGroupsListener, reducer$3 as syncGroupsReducer, selector as syncGroupsSelector, selectors$5 as syncGroupsSelectors, types$2 as syncGroupsTypes, types$2 as types, uiActions, uiModuleConfig, reducer$5 as uiReducer, selectors$6 as uiSelectors, types$3 as uiTypes, useSetupDialog, useUpdateSharedData, reducer$4 as webmapReducer };
8536
+ export { IS_LEGEND_OPEN_BY_DEFAULT, StoreProvider, coreModuleConfig, coreModuleMiddlewares, coreModuleReducersMap, createCustomStore, drawtoolActions, drawtoolMiddlewares, drawtoolModuleConfig, reducer as drawtoolReducer, drawtoolReducersMap, selectors as drawtoolSelectors, filterLayers$1 as filterLayers, genericActions, genericListener, selectors$4 as genericSelectors, types$1 as genericTypes, getSingularDrawtoolDrawLayerId, getUserAddedServices, initialState$3 as initialState, layerActions, reducer$6 as layerReducer, selectors$7 as layerSelectors, types$5 as layerTypes, utils$2 as layerUtils, constants as linkComponentTypesConstants, loadingIndicatorActions, constants$1 as loadingIndicatorConstants, loadingIndicatorReducer, selectors$3 as loadingIndicatorSelectors, mapActions, enums as mapEnums, mapListener, selectors$2 as mapSelectors, mapStoreActions, mapStoreMiddlewares, mapStoreModuleConfig, mapStoreReducers, types$4 as mapTypes, mapUtils, routerActions, routerMiddlewares, routerModuleConfig, routerReducersMap, utils as routerUtils, selectorMemoizationOptions, serviceActions, selectors$1 as serviceSelectors, types as serviceTypes, setUserAddedServices, storeTestSettings, storeTestUtils, utils$1 as storeUtils, constants$2 as syncConstants, actions as syncGroupsActions, syncGroupsListener, reducer$3 as syncGroupsReducer, selector as syncGroupsSelector, selectors$5 as syncGroupsSelectors, types$2 as syncGroupsTypes, types$2 as types, uiActions, uiModuleConfig, reducer$5 as uiReducer, selectors$6 as uiSelectors, types$3 as uiTypes, useSetupDialog, useUpdateSharedData, reducer$4 as webmapReducer };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@opengeoweb/store",
3
- "version": "9.35.0",
3
+ "version": "9.36.0",
4
4
  "description": "GeoWeb Store library for the opengeoweb project",
5
5
  "license": "Apache-2.0",
6
6
  "repository": {
@@ -18,7 +18,8 @@
18
18
  "@redux-eggs/redux-toolkit": "^2.2.0",
19
19
  "lodash": "^4.17.21",
20
20
  "@opengeoweb/metronome": "*",
21
- "@opengeoweb/timeslider": "*"
21
+ "@opengeoweb/timeslider": "*",
22
+ "react-router-dom": "^6.23.1"
22
23
  },
23
24
  "peerDependencies": {
24
25
  "react": "18"
@@ -1 +1,5 @@
1
+ import { ListenerMiddleware, ReducersMapObject } from '@reduxjs/toolkit';
2
+ import { CoreAppStore } from './types';
1
3
  export declare const coreModuleConfig: (import("@redux-eggs/core").Egg<import("redux").Store<import("./mapStore").WebMapStateModuleState, import("redux").AnyAction>> | import("@redux-eggs/core").Egg<import("redux").Store<import("./generic/synchronizationGroups/types").SynchronizationGroupModuleState, import("redux").AnyAction>> | import("@redux-eggs/core").Egg<import("redux").Store<import("./ui/types").UIModuleState, import("redux").AnyAction>> | import("@redux-eggs/core").Egg<import("redux").Store<import("./drawingtool").DrawtoolModuleStore, import("redux").AnyAction>>)[];
4
+ export declare const coreModuleReducersMap: ReducersMapObject<CoreAppStore>;
5
+ export declare const coreModuleMiddlewares: ListenerMiddleware[];
@@ -1,4 +1,6 @@
1
- import { Store } from '@reduxjs/toolkit';
1
+ import { ListenerMiddleware, ReducersMapObject, Store } from '@reduxjs/toolkit';
2
2
  import { Egg } from '@redux-eggs/core';
3
3
  import type { DrawtoolModuleStore } from './reducer';
4
+ export declare const drawtoolReducersMap: ReducersMapObject<DrawtoolModuleStore>;
5
+ export declare const drawtoolMiddlewares: ListenerMiddleware[];
4
6
  export declare const drawtoolModuleConfig: Egg<Store<DrawtoolModuleStore>>;
@@ -1,5 +1,7 @@
1
1
  import { Egg } from '@redux-eggs/core';
2
- import { Store } from '@reduxjs/toolkit';
2
+ import { ListenerMiddleware, ReducersMapObject, Store } from '@reduxjs/toolkit';
3
3
  import { SynchronizationGroupModuleState } from './synchronizationGroups/types';
4
+ export declare const synchronizationGroupReducersMap: ReducersMapObject<SynchronizationGroupModuleState>;
5
+ export declare const synchronizationGroupMiddlewares: ListenerMiddleware[];
4
6
  declare const synchronizationGroupConfig: Egg<Store<SynchronizationGroupModuleState>>;
5
7
  export default synchronizationGroupConfig;
@@ -1,2 +1,2 @@
1
1
  import { PotentialData } from './synchronizationGroups/types';
2
- export declare const useUpdateSharedData: (data: PotentialData, panelId?: string) => void;
2
+ export declare const useUpdateSharedData: (data: PotentialData, panelId?: string) => PotentialData;
@@ -2,7 +2,8 @@ export declare const genericActions: {
2
2
  initialSyncState: import("./synchronizationGroups/types").SynchronizationGroupState;
3
3
  setTime: import("@reduxjs/toolkit").ActionCreatorWithPayload<import("./types").SetTimePayload, string>;
4
4
  setBbox: import("@reduxjs/toolkit").ActionCreatorWithPayload<import("./types").SetBboxPayload, string>;
5
- changeLinkedMap: import("@reduxjs/toolkit").ActionCreatorWithPayload<import("./synchronizationGroups/types").ChangeLinkedMap, "synchronizationGroupsReducer/changeLinkedMap">;
5
+ setLinkedMap: import("@reduxjs/toolkit").ActionCreatorWithPayload<import("./synchronizationGroups/types").SetLinkedMap, "synchronizationGroupsReducer/setLinkedMap">;
6
+ updateLinkedMap: import("@reduxjs/toolkit").ActionCreatorWithPayload<import("./synchronizationGroups/types").UpdateLinkedMap, "synchronizationGroupsReducer/updateLinkedMap">;
6
7
  addSharedData: import("@reduxjs/toolkit").ActionCreatorWithPayload<import("./synchronizationGroups/types").AddSharedData, "synchronizationGroupsReducer/addSharedData">;
7
8
  deleteSharedData: import("@reduxjs/toolkit").ActionCreatorWithPayload<import("./synchronizationGroups/types").DeleteSharedData, "synchronizationGroupsReducer/deleteSharedData">;
8
9
  syncGroupAddSource: import("@reduxjs/toolkit").ActionCreatorWithPayload<import("./synchronizationGroups/types").SyncGroupsAddSourcePayload, "synchronizationGroupsReducer/syncGroupAddSource">;
@@ -16,18 +16,56 @@ export declare const getLinkedMaps: ((state: any, panelId: string) => string[])
16
16
  clearCache: () => void;
17
17
  };
18
18
  export declare const getLinkedFeatureProviders: (linkedState: LinkedState, mapId: string) => string[];
19
- export declare const selectSharedData: ((state: any, panelId: string) => Pick<Record<string, import("./synchronizationGroups/types").PotentialData>, string>) & import("reselect").OutputSelectorFields<(args_0: LinkedState, args_1: string) => Pick<Record<string, import("./synchronizationGroups/types").PotentialData>, string>, {
19
+ export declare const selectSharedData: ((state: any, panelId: string) => import("./synchronizationGroups/types").PotentialData) & import("reselect").OutputSelectorFields<(args_0: LinkedState, args_1: string) => import("./synchronizationGroups/types").PotentialData, {
20
20
  clearCache: () => void;
21
21
  }> & {
22
22
  clearCache: () => void;
23
23
  };
24
- export declare const selectLinkedFeatures: ((state: any, mapId: string) => ({
24
+ export declare const selectLinkedPanelId: ((state: any, mapViewId: string) => string | undefined) & import("reselect").OutputSelectorFields<(args_0: LinkedState, args_1: string) => string | undefined, {
25
+ clearCache: () => void;
26
+ }> & {
27
+ clearCache: () => void;
28
+ };
29
+ export declare const selectMapViewsForPanelId: ((state: LinkedState, panelId: string) => string[] | undefined) & import("reselect").OutputSelectorFields<(args_0: string[]) => string[] | undefined, {
30
+ clearCache: () => void;
31
+ }> & {
32
+ clearCache: () => void;
33
+ };
34
+ export declare const selectLinkedFeatures: ((state: any, mapId: string) => {
25
35
  id: string;
36
+ originalId?: string | undefined;
26
37
  geoJSON: import("geojson").FeatureCollection<import("geojson").Geometry, import("geojson").GeoJsonProperties>;
27
- } | undefined)[]) & import("reselect").OutputSelectorFields<(args_0: LinkedState, args_1: string[]) => ({
38
+ }[]) & import("reselect").OutputSelectorFields<(args_0: LinkedState, args_1: string[]) => {
28
39
  id: string;
40
+ originalId?: string | undefined;
29
41
  geoJSON: import("geojson").FeatureCollection<import("geojson").Geometry, import("geojson").GeoJsonProperties>;
30
- } | undefined)[], {
42
+ }[], {
43
+ clearCache: () => void;
44
+ }> & {
45
+ clearCache: () => void;
46
+ };
47
+ export declare const getSelectedFeature: ((state: SynchronizationGroupState, mapId: string) => {
48
+ lat: number;
49
+ lon: number;
50
+ id: string;
51
+ serviceId: any;
52
+ collectionId: any;
53
+ name: any;
54
+ } | null) & import("reselect").OutputSelectorFields<(args_0: {
55
+ features: {
56
+ id: string;
57
+ originalId?: string | undefined;
58
+ geoJSON: import("geojson").FeatureCollection<import("geojson").Geometry, import("geojson").GeoJsonProperties>;
59
+ }[];
60
+ selectedFeatureId: string | undefined;
61
+ }) => {
62
+ lat: number;
63
+ lon: number;
64
+ id: string;
65
+ serviceId: any;
66
+ collectionId: any;
67
+ name: any;
68
+ } | null, {
31
69
  clearCache: () => void;
32
70
  }> & {
33
71
  clearCache: () => void;
@@ -1,8 +1,20 @@
1
1
  import { PayloadAction, Draft } from '@reduxjs/toolkit';
2
- import { SynchronizationGroupState, SyncGroupAddTargetPayload, SyncGroupAddGroupPayload, SyncGroupRemoveTargetPayload, SyncGroupRemoveGroupPayload, SyncGroupSetViewStatePayload, SyncGroupLinkTargetPayload, SyncGroupRemoveSourcePayload, SyncGroupsAddSourcePayload, SyncGroupToggleIsTimeScrollingEnabled, ChangeLinkedMap, AddSharedData, DeleteSharedData } from './types';
2
+ import { SynchronizationGroupState, SyncGroupAddTargetPayload, SyncGroupAddGroupPayload, SyncGroupRemoveTargetPayload, SyncGroupRemoveGroupPayload, SyncGroupSetViewStatePayload, SyncGroupLinkTargetPayload, SyncGroupRemoveSourcePayload, SyncGroupsAddSourcePayload, SyncGroupToggleIsTimeScrollingEnabled, UpdateLinkedMap, AddSharedData, DeleteSharedData, SetLinkedMap } from './types';
3
3
  export declare const initialState: SynchronizationGroupState;
4
4
  export declare const slice: import("@reduxjs/toolkit").Slice<SynchronizationGroupState, {
5
- changeLinkedMap: (draft: Draft<SynchronizationGroupState>, action: PayloadAction<ChangeLinkedMap>) => void;
5
+ /** Sets the links map.
6
+ * This is used to override the links when changing workspaces.
7
+ * @param draft sync state
8
+ * @param {Record<string, string[]>} action.newLinks the new links object
9
+ */
10
+ setLinkedMap: (draft: Draft<SynchronizationGroupState>, action: PayloadAction<SetLinkedMap>) => void;
11
+ /** Updates the links map.
12
+ * This is used to update the links when operating the link menu.
13
+ * @param draft sync state
14
+ * @param {string} action.panelId id of the panel updating it's links
15
+ * @param {string[]} action.mapIds the new linked maps
16
+ */
17
+ updateLinkedMap: (draft: Draft<SynchronizationGroupState>, action: PayloadAction<UpdateLinkedMap>) => void;
6
18
  addSharedData: (draft: Draft<SynchronizationGroupState>, action: PayloadAction<AddSharedData>) => void;
7
19
  deleteSharedData: (draft: Draft<SynchronizationGroupState>, action: PayloadAction<DeleteSharedData>) => void;
8
20
  syncGroupAddSource: (draft: Draft<SynchronizationGroupState>, action: PayloadAction<SyncGroupsAddSourcePayload>) => void;
@@ -18,7 +30,19 @@ export declare const slice: import("@reduxjs/toolkit").Slice<SynchronizationGrou
18
30
  }, "synchronizationGroupsReducer">;
19
31
  export declare const syncGroupAddGroup: import("@reduxjs/toolkit").ActionCreatorWithPayload<SyncGroupAddGroupPayload, "synchronizationGroupsReducer/syncGroupAddGroup">, syncGroupAddSource: import("@reduxjs/toolkit").ActionCreatorWithPayload<SyncGroupsAddSourcePayload, "synchronizationGroupsReducer/syncGroupAddSource">, syncGroupAddTarget: import("@reduxjs/toolkit").ActionCreatorWithPayload<SyncGroupAddTargetPayload, "synchronizationGroupsReducer/syncGroupAddTarget">, syncGroupClear: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<"synchronizationGroupsReducer/syncGroupClear">, syncGroupLinkTarget: import("@reduxjs/toolkit").ActionCreatorWithPayload<SyncGroupLinkTargetPayload, "synchronizationGroupsReducer/syncGroupLinkTarget">, syncGroupRemoveGroup: import("@reduxjs/toolkit").ActionCreatorWithPayload<SyncGroupRemoveGroupPayload, "synchronizationGroupsReducer/syncGroupRemoveGroup">, syncGroupRemoveSource: import("@reduxjs/toolkit").ActionCreatorWithPayload<SyncGroupRemoveSourcePayload, "synchronizationGroupsReducer/syncGroupRemoveSource">, syncGroupRemoveTarget: import("@reduxjs/toolkit").ActionCreatorWithPayload<SyncGroupRemoveTargetPayload, "synchronizationGroupsReducer/syncGroupRemoveTarget">, syncGroupSetViewState: import("@reduxjs/toolkit").ActionCreatorWithPayload<SyncGroupSetViewStatePayload, "synchronizationGroupsReducer/syncGroupSetViewState">;
20
32
  export declare const actions: import("@reduxjs/toolkit").CaseReducerActions<{
21
- changeLinkedMap: (draft: Draft<SynchronizationGroupState>, action: PayloadAction<ChangeLinkedMap>) => void;
33
+ /** Sets the links map.
34
+ * This is used to override the links when changing workspaces.
35
+ * @param draft sync state
36
+ * @param {Record<string, string[]>} action.newLinks the new links object
37
+ */
38
+ setLinkedMap: (draft: Draft<SynchronizationGroupState>, action: PayloadAction<SetLinkedMap>) => void;
39
+ /** Updates the links map.
40
+ * This is used to update the links when operating the link menu.
41
+ * @param draft sync state
42
+ * @param {string} action.panelId id of the panel updating it's links
43
+ * @param {string[]} action.mapIds the new linked maps
44
+ */
45
+ updateLinkedMap: (draft: Draft<SynchronizationGroupState>, action: PayloadAction<UpdateLinkedMap>) => void;
22
46
  addSharedData: (draft: Draft<SynchronizationGroupState>, action: PayloadAction<AddSharedData>) => void;
23
47
  deleteSharedData: (draft: Draft<SynchronizationGroupState>, action: PayloadAction<DeleteSharedData>) => void;
24
48
  syncGroupAddSource: (draft: Draft<SynchronizationGroupState>, action: PayloadAction<SyncGroupsAddSourcePayload>) => void;
@@ -1,3 +1,4 @@
1
+ import { LoadingIndicatorModuleState } from '../loadingIndicator/types';
1
2
  import type { GenericActionPayload } from '../types';
2
3
  import { SYNCGROUPS_TYPE_SETBBOX, SYNCGROUPS_TYPE_SETTIME, SYNCGROUPS_TYPE_SETLAYERACTIONS } from './constants';
3
4
  export interface Group {
@@ -32,8 +33,11 @@ export interface SynchronizationGroup {
32
33
  export interface PotentialData {
33
34
  features?: {
34
35
  id: string;
36
+ originalId?: string;
35
37
  geoJSON: GeoJSON.FeatureCollection;
36
38
  }[];
39
+ selectedFeatureId?: string;
40
+ hoverId?: string;
37
41
  }
38
42
  export interface LinkedState {
39
43
  links: Record<string, string[]>;
@@ -57,11 +61,12 @@ export interface SynchronizationGroupState {
57
61
  sources: SynchronizationSources;
58
62
  groups: SynchronizationGroups;
59
63
  viewState: SyncGroupViewState;
60
- isTimeScrollingEnabled: boolean;
61
64
  linkedState: LinkedState;
65
+ isTimeScrollingEnabled: boolean;
62
66
  }
63
67
  export interface SynchronizationGroupModuleState {
64
68
  syncronizationGroupStore?: SynchronizationGroupState;
69
+ loadingIndicatorStore?: LoadingIndicatorModuleState['loadingIndicatorStore'];
65
70
  }
66
71
  export type SyncType = typeof SYNCGROUPS_TYPE_SETBBOX | typeof SYNCGROUPS_TYPE_SETTIME | typeof SYNCGROUPS_TYPE_SETLAYERACTIONS;
67
72
  export interface SyncGroupsAddSourcePayload {
@@ -103,6 +108,7 @@ export interface SyncGroupSetViewStatePayload {
103
108
  }
104
109
  export interface SyncGroupToggleIsTimeScrollingEnabled {
105
110
  isTimeScrollingEnabled: boolean;
111
+ origin?: Origin;
106
112
  }
107
113
  export declare const SyncGroupTypeList: string[];
108
114
  export declare enum SyncGroupActionOrigin {
@@ -112,7 +118,10 @@ export declare enum SyncGroupActionOrigin {
112
118
  add = "ORIGIN_GENERIC_SYNCHRONIZATIONGROUP_UTILS_ADDACTION",
113
119
  autoLayerId = "ORIGIN_GENERIC_SYNCHRONIZATIONGROUP_UTILS_AUTOLAYERIDACTION"
114
120
  }
115
- export interface ChangeLinkedMap {
121
+ export interface SetLinkedMap {
122
+ newLinks: Record<string, string[]>;
123
+ }
124
+ export interface UpdateLinkedMap {
116
125
  panelId: string;
117
126
  mapIds: string[];
118
127
  }
@@ -1,9 +1,6 @@
1
1
  import { Egg } from '@redux-eggs/core';
2
- import { Store } from '@reduxjs/toolkit';
2
+ import { ListenerMiddleware, ReducersMapObject, Store } from '@reduxjs/toolkit';
3
3
  import { WebMapStateModuleState } from './types';
4
- export declare const mapStoreReducers: {
5
- webmap: import("redux").Reducer<import("./types").WebMapState>;
6
- services: import("redux").Reducer<import("./types").ServiceState>;
7
- layers: import("redux").Reducer<import("./types").LayerState>;
8
- };
4
+ export declare const mapStoreReducers: ReducersMapObject<Required<WebMapStateModuleState>>;
5
+ export declare const mapStoreMiddlewares: ListenerMiddleware[];
9
6
  export declare const mapStoreModuleConfig: Egg<Store<WebMapStateModuleState>>;
@@ -9,6 +9,7 @@ export declare const createWebmapState: (...mapIds: string[]) => mapTypes.WebMap
9
9
  export declare const createMapDimensionsState: (dimensions?: mapTypes.Dimension[], ...mapIds: string[]) => mapTypes.WebMapState;
10
10
  export declare const webmapStateWithAddedLayer: (layerType: LayerType, layerId: string, mapId: string, dimensions?: mapTypes.Dimension[]) => mapTypes.WebMapState;
11
11
  export declare const mockStateMapWithLayer: (layer: layerTypes.Layer, mapId: string) => CoreAppStore;
12
+ export declare const mockLinkedState: () => CoreAppStore;
12
13
  export declare const mockStateMapWithMultipleLayers: (layers: layerTypes.Layer[], mapId: string) => CoreAppStore;
13
14
  export declare const testGeoJSON: GeoJSON.FeatureCollection;
14
15
  export declare const mockStateMapWithAnimationDelayWithoutLayers: (mapId: string) => WebMapStateModuleState;
@@ -1,4 +1,6 @@
1
- import { Store } from '@reduxjs/toolkit';
1
+ import { ListenerMiddleware, ReducersMapObject, Store } from '@reduxjs/toolkit';
2
2
  import { Egg } from '@redux-eggs/core';
3
3
  import { RouterModuleStore } from './types';
4
+ export declare const routerReducersMap: ReducersMapObject<RouterModuleStore>;
5
+ export declare const routerMiddlewares: ListenerMiddleware[];
4
6
  export declare const routerModuleConfig: Egg<Store<RouterModuleStore>>;
@@ -1,3 +1,4 @@
1
+ import { NavigateFunction } from 'react-router-dom';
1
2
  export declare const historyDict: {
2
- navigate: any;
3
+ navigate: NavigateFunction | null;
3
4
  };
@@ -1,4 +1,5 @@
1
1
  import { Egg } from '@redux-eggs/core';
2
- import { Store } from '@reduxjs/toolkit';
2
+ import { ReducersMapObject, Store } from '@reduxjs/toolkit';
3
3
  import { UIModuleState } from './types';
4
+ export declare const uiReducersMap: ReducersMapObject<UIModuleState>;
4
5
  export declare const uiModuleConfig: Egg<Store<UIModuleState>>;