@opengeoweb/store 12.6.0 → 12.8.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/index.esm.js CHANGED
@@ -1,10 +1,10 @@
1
1
  import { createSlice, createSelector, createAction, createListenerMiddleware, isAnyOf, createEntityAdapter, combineReducers, configureStore } from '@reduxjs/toolkit';
2
2
  import { isEqual, isEmpty, compact } from 'lodash';
3
3
  import { dateUtils, PROJECTION, defaultDelay } from '@opengeoweb/shared';
4
- import { webmapUtils, parseISO8601IntervalToDateInterval, LayerType, getWMJSMapById, webmapTestSettings, WMLayer, getWMSRequests, getWMLayerById, WMInvalidDateValues, handleDateUtilsISOString, isProjectionSupported, queryWMSLayers } from '@opengeoweb/webmap';
4
+ import { webmapUtils, parseISO8601IntervalToDateInterval, LayerType, webmapTestSettings, WMLayer, getWMLayerById, WMInvalidDateValues, handleDateUtilsISOString, isProjectionSupported, queryWMSLayers } from '@opengeoweb/webmap';
5
5
  import { defaultSecondsPerPx, defaultAnimationDelayAtStart, defaultTimeStep, defaultTimeSpan, roundWithTimeStep, getSpeedDelay } from '@opengeoweb/timeslider';
6
6
  import { produce } from 'immer';
7
- import { getLastEmptyFeatureIndex, getGeoJson, moveFeature, createInterSections, isOpenLayersEnabled, defaultLayers, emptyGeoJSON, defaultIntersectionStyleProperties, addSelectionTypeToGeoJSON, getFeatureCollection } from '@opengeoweb/webmap-react';
7
+ import { getLastEmptyFeatureIndex, getGeoJson, moveFeature, createInterSections, defaultLayers, emptyGeoJSON, defaultIntersectionStyleProperties, addSelectionTypeToGeoJSON, getFeatureCollection } from '@opengeoweb/webmap-react';
8
8
  export { defaultLayers } from '@opengeoweb/webmap-react';
9
9
  import { useSelector, useDispatch } from 'react-redux';
10
10
  import { useCallback, useEffect } from 'react';
@@ -2461,10 +2461,6 @@ var slice$4 = createSlice({
2461
2461
  return;
2462
2462
  }
2463
2463
  draft.byId[mapId].isAnimating = true;
2464
- var wmMap = getWMJSMapById(mapId);
2465
- if (wmMap) {
2466
- wmMap.shouldPrefetch = false;
2467
- }
2468
2464
  // Animation is defined by one of the following:
2469
2465
  // - start, end and interval for a continuous animation loop with constant interval
2470
2466
  // - timeList, for a custom timeList
@@ -2489,10 +2485,6 @@ var slice$4 = createSlice({
2489
2485
  return;
2490
2486
  }
2491
2487
  draft.byId[mapId].isAnimating = false;
2492
- var wmMap = getWMJSMapById(mapId);
2493
- if (wmMap) {
2494
- wmMap.shouldPrefetch = true;
2495
- }
2496
2488
  },
2497
2489
  setTimeSliderSpan: function setTimeSliderSpan(draft, action) {
2498
2490
  var _action$payload4 = action.payload,
@@ -2803,32 +2795,6 @@ var slice$4 = createSlice({
2803
2795
  draft.byId[mapId].mapLayers = layerIds;
2804
2796
  draft.byId[mapId].autoUpdateLayerId = activeLayerId;
2805
2797
  draft.byId[mapId].autoTimeStepLayerId = activeLayerId;
2806
- var webmapInstance = webmapUtils.getWMJSMapById(mapId);
2807
- if (webmapInstance) {
2808
- var mapDims = webmapInstance.getDimensionList();
2809
- if (!draft.byId[mapId].dimensions) {
2810
- draft.byId[mapId].dimensions = [];
2811
- }
2812
- var draftDims = draft.byId[mapId].dimensions;
2813
- if (mapDims && draftDims) {
2814
- mapDims.forEach(function (dim) {
2815
- var draftMapDimIndex = draftDims.findIndex(function (draftDim) {
2816
- return draftDim.name === dim.name;
2817
- });
2818
- if (draftMapDimIndex !== -1) {
2819
- draftDims[draftMapDimIndex].name = dim.name;
2820
- draftDims[draftMapDimIndex].units = dim.units;
2821
- draftDims[draftMapDimIndex].currentValue = dim.currentValue;
2822
- } else {
2823
- draftDims.push({
2824
- name: dim.name,
2825
- units: dim.units,
2826
- currentValue: dim.currentValue
2827
- });
2828
- }
2829
- });
2830
- }
2831
- }
2832
2798
  }
2833
2799
  }).addCase(layerActions.setBaseLayers, function (draft, action) {
2834
2800
  var _action$payload31 = action.payload,
@@ -3562,7 +3528,7 @@ var getDialogMapId = createSelector(getDialogDetailsByType, function (details) {
3562
3528
  * @param {DialogType} dialogType type of the dialog
3563
3529
  * @returns {number} the higher the order number the higher the zIndex
3564
3530
  */
3565
- var getDialogOrder = createSelector(function (store, dialogType) {
3531
+ var getDialogOrder = function getDialogOrder(store, dialogType) {
3566
3532
  if (store && store.ui && store.ui.order) {
3567
3533
  var order = store.ui.order;
3568
3534
  var visibleOrder = order.filter(function (orderedDialogType) {
@@ -3575,9 +3541,7 @@ var getDialogOrder = createSelector(function (store, dialogType) {
3575
3541
  return visibleOrder.length - visibleOrder.indexOf(dialogType);
3576
3542
  }
3577
3543
  return 0;
3578
- }, function (order) {
3579
- return order;
3580
- }, selectorMemoizationOptions);
3544
+ };
3581
3545
  /**
3582
3546
  *For a given ui component: returns if ordered on top
3583
3547
  *
@@ -3585,15 +3549,13 @@ var getDialogOrder = createSelector(function (store, dialogType) {
3585
3549
  * @param {DialogType} dialogType type of the dialog
3586
3550
  * @returns {boolean}
3587
3551
  */
3588
- var getDialogIsOrderedOnTop = createSelector(function (store, dialogType) {
3552
+ var getDialogIsOrderedOnTop = function getDialogIsOrderedOnTop(store, dialogType) {
3589
3553
  if (store && store.ui && store.ui.order) {
3590
3554
  var order = store.ui.order;
3591
3555
  return order.includes(dialogType) && order.indexOf(dialogType) === 0;
3592
3556
  }
3593
3557
  return false;
3594
- }, function (isOrderedOnTop) {
3595
- return isOrderedOnTop;
3596
- }, selectorMemoizationOptions);
3558
+ };
3597
3559
  var getDialogSource = createSelector(getDialogDetailsByType, function (details) {
3598
3560
  if (details && details.source) {
3599
3561
  return details.source;
@@ -3714,6 +3676,8 @@ var DialogTypes;
3714
3676
  DialogTypes["PublicWarnings"] = "publicWarnings";
3715
3677
  DialogTypes["Search"] = "search";
3716
3678
  DialogTypes["AreaObjectLoader"] = "areaObjectLoader";
3679
+ DialogTypes["DataExplorer"] = "dataExplorer";
3680
+ DialogTypes["DataExplorerInfo"] = "dataExplorerInfo";
3717
3681
  DialogTypes["SoundingsSources"] = "soundingsSources";
3718
3682
  DialogTypes["SoundingsLocations"] = "soundingsLocations";
3719
3683
  })(DialogTypes || (DialogTypes = {}));
@@ -3930,6 +3894,31 @@ var slice$3 = createSlice({
3930
3894
  mapIds = _action$payload.mapIds;
3931
3895
  draft.linkedState.links[panelId] = mapIds;
3932
3896
  },
3897
+ removeLinkedMap: function removeLinkedMap(draft, action) {
3898
+ var panelId = action.payload;
3899
+ // Remove panelId from sources
3900
+ delete draft.sources.byId[panelId];
3901
+ removeInPlace(draft.sources.allIds, function (_id) {
3902
+ return _id === panelId;
3903
+ });
3904
+ // Remove panelId from any arrays in linkedState
3905
+ delete draft.linkedState.links[panelId];
3906
+ delete draft.linkedState.sharedData[panelId];
3907
+ Object.keys(draft.linkedState.links).forEach(function (key) {
3908
+ var arr = draft.linkedState.links[key];
3909
+ removeInPlace(arr, function (_id) {
3910
+ return _id === panelId;
3911
+ });
3912
+ });
3913
+ // Remove panelId from groups
3914
+ Object.keys(draft.groups.byId).forEach(function (groupId) {
3915
+ var group = draft.groups.byId[groupId];
3916
+ delete group.targets.byId[panelId];
3917
+ removeInPlace(group.targets.allIds, function (_id) {
3918
+ return _id === panelId;
3919
+ });
3920
+ });
3921
+ },
3933
3922
  addSharedData: function addSharedData(draft, action) {
3934
3923
  var _action$payload2 = action.payload,
3935
3924
  panelId = _action$payload2.panelId,
@@ -4148,9 +4137,10 @@ var syncGroupStore = function syncGroupStore(store) {
4148
4137
  * @param {object} store store: object - Store object
4149
4138
  * @returns {object} returnType: SynchronizationGroupState
4150
4139
  */
4151
- var getSynchronizationGroupState = createSelector(syncGroupStore, function (store) {
4152
- return store || null;
4153
- }, selectorMemoizationOptions);
4140
+ var getSynchronizationGroupState = function getSynchronizationGroupState(store) {
4141
+ var state = syncGroupStore(store);
4142
+ return state || null;
4143
+ };
4154
4144
  var getSynchronizationGroup = createSelector([syncGroupStore, function (syncGroupStore, id) {
4155
4145
  return id;
4156
4146
  }], function (syncGroupState, id) {
@@ -4250,9 +4240,10 @@ var getAllTargetGroupsForSource = createSelector([syncGroupStore, getSourceId],
4250
4240
  var syncGroupGetViewState = createSelector(syncGroupStore, function (store) {
4251
4241
  return store && store.viewState;
4252
4242
  }, selectorMemoizationOptions);
4253
- var isTimeScrollingEnabled = createSelector(syncGroupStore, function (store) {
4254
- return store && store.isTimeScrollingEnabled;
4255
- }, selectorMemoizationOptions);
4243
+ var isTimeScrollingEnabled = function isTimeScrollingEnabled(store) {
4244
+ var state = syncGroupStore(store);
4245
+ return state ? state.isTimeScrollingEnabled : false;
4246
+ };
4256
4247
  var getSyncedMapIdsForTimeslider = createSelector(syncGroupStore, function (store) {
4257
4248
  var _store$viewState$time, _store$viewState$time2;
4258
4249
  return (_store$viewState$time = (_store$viewState$time2 = store.viewState.timeslider.groups[0]) === null || _store$viewState$time2 === void 0 ? void 0 : _store$viewState$time2.selected) !== null && _store$viewState$time !== void 0 ? _store$viewState$time : [];
@@ -4526,9 +4517,9 @@ var types$1 = /*#__PURE__*/Object.freeze({
4526
4517
  var synchronizationGroupStore = function synchronizationGroupStore(store) {
4527
4518
  return store && store.syncGroups ? store.syncGroups : null;
4528
4519
  };
4529
- var getSynchronizationGroupStore = createSelector(synchronizationGroupStore, function (store) {
4530
- return store;
4531
- }, selectorMemoizationOptions);
4520
+ var getSynchronizationGroupStore = function getSynchronizationGroupStore(store) {
4521
+ return store && store.syncGroups ? store.syncGroups : null;
4522
+ };
4532
4523
  /**
4533
4524
  * Returns the synchronization source by id
4534
4525
  * @param store The app store
@@ -4557,13 +4548,15 @@ var getLinkedMaps = createSelector([selectLinkedState, function (store, panelId)
4557
4548
  }], function (linkedState, panelId) {
4558
4549
  return panelId && linkedState.links[panelId] || [];
4559
4550
  }, selectorMemoizationOptions);
4560
- var getLinkedFeatureProviders = function getLinkedFeatureProviders(linkedState, mapId) {
4551
+ var getLinkedFeatureProviders = createSelector(function (linkedState) {
4552
+ return linkedState;
4553
+ }, function (linkedState, props) {
4554
+ return props.mapId;
4555
+ }, function (linkedState, mapId) {
4561
4556
  return linkedState ? Object.keys(linkedState.links).filter(function (panelId) {
4562
- return linkedState.links[panelId].find(function (id) {
4563
- return id === mapId;
4564
- });
4557
+ return linkedState.links[panelId].includes(mapId);
4565
4558
  }) : [];
4566
- };
4559
+ });
4567
4560
  var selectSharedData = createSelector([selectLinkedState, function (store, panelId) {
4568
4561
  return panelId;
4569
4562
  }], function (linkedState, panelId) {
@@ -4595,23 +4588,23 @@ var selectLinkedFeatures = createSelector([function (linkedState) {
4595
4588
  return linkedState;
4596
4589
  }, getLinkedFeatureProviders], function (linkedState, featureProviders) {
4597
4590
  var features = featureProviders.flatMap(function (providerId) {
4598
- var _linkedState$sharedDa;
4599
- return ((_linkedState$sharedDa = linkedState.sharedData[providerId]) === null || _linkedState$sharedDa === void 0 ? void 0 : _linkedState$sharedDa.features) || [];
4600
- }).filter(function (f) {
4601
- return f !== undefined;
4591
+ var _linkedState$sharedDa, _linkedState$sharedDa2;
4592
+ return (_linkedState$sharedDa = linkedState === null || linkedState === void 0 || (_linkedState$sharedDa2 = linkedState.sharedData) === null || _linkedState$sharedDa2 === void 0 || (_linkedState$sharedDa2 = _linkedState$sharedDa2[providerId]) === null || _linkedState$sharedDa2 === void 0 ? void 0 : _linkedState$sharedDa2.features) !== null && _linkedState$sharedDa !== void 0 ? _linkedState$sharedDa : [];
4593
+ });
4594
+ return features.filter(function (feature) {
4595
+ return feature !== undefined;
4602
4596
  });
4603
- return features;
4604
4597
  });
4605
4598
  var selectLinkedFormFeatures = createSelector([function (linkedState) {
4606
4599
  return linkedState;
4607
4600
  }, getLinkedFeatureProviders], function (linkedState, featureProviders) {
4608
4601
  var features = featureProviders.flatMap(function (providerId) {
4609
- var _linkedState$sharedDa2;
4610
- return ((_linkedState$sharedDa2 = linkedState.sharedData[providerId]) === null || _linkedState$sharedDa2 === void 0 ? void 0 : _linkedState$sharedDa2.formFeatures) || [];
4611
- }).filter(function (f) {
4612
- return f !== undefined;
4602
+ var _linkedState$sharedDa3, _linkedState$sharedDa4;
4603
+ return (_linkedState$sharedDa3 = linkedState === null || linkedState === void 0 || (_linkedState$sharedDa4 = linkedState.sharedData) === null || _linkedState$sharedDa4 === void 0 || (_linkedState$sharedDa4 = _linkedState$sharedDa4[providerId]) === null || _linkedState$sharedDa4 === void 0 ? void 0 : _linkedState$sharedDa4.formFeatures) !== null && _linkedState$sharedDa3 !== void 0 ? _linkedState$sharedDa3 : [];
4604
+ });
4605
+ return features.filter(function (feature) {
4606
+ return feature !== undefined;
4613
4607
  });
4614
- return features;
4615
4608
  });
4616
4609
  var getSelectedFeature = createSelector([
4617
4610
  // eslint-disable-next-line @typescript-eslint/explicit-function-return-type
@@ -4683,7 +4676,6 @@ var getSelectedFeatureAsGeoJSON = createSelector([function (state, mapId) {
4683
4676
 
4684
4677
  var selectors$3 = /*#__PURE__*/Object.freeze({
4685
4678
  __proto__: null,
4686
- getLinkedFeatureProviders: getLinkedFeatureProviders,
4687
4679
  getLinkedMaps: getLinkedMaps,
4688
4680
  getSelectedFeature: getSelectedFeature,
4689
4681
  getSelectedFeatureAsGeoJSON: getSelectedFeatureAsGeoJSON,
@@ -4906,11 +4898,10 @@ var getMapStore = function getMapStore(store) {
4906
4898
  * @param {string} mapId Id of the map
4907
4899
  * @returns {object} object containing map state (isAnimating, bbox, baseLayers, layers etc.)
4908
4900
  */
4909
- var getMapById = createSelector([getMapStore, function (getMapStore, mapId) {
4910
- return mapId;
4911
- }], function (mapState, mapId) {
4912
- return mapState && mapState.byId[mapId] ? mapState && mapState.byId[mapId] : undefined;
4913
- }, selectorMemoizationOptions);
4901
+ var getMapById = function getMapById(store, mapId) {
4902
+ var _getMapStore;
4903
+ return (_getMapStore = getMapStore(store)) === null || _getMapStore === void 0 ? void 0 : _getMapStore.byId[mapId];
4904
+ };
4914
4905
  var getAllMapsByIds = createSelector(getMapStore, function (mapState) {
4915
4906
  return mapState && mapState.byId ? mapState && mapState.byId : {};
4916
4907
  }, selectorMemoizationOptions);
@@ -5166,9 +5157,10 @@ var getBbox = createSelector(getMapById, function (store) {
5166
5157
  * @param {string} mapId mapId: string - Id of the map
5167
5158
  * @returns {boolean} returnType: boolean
5168
5159
  */
5169
- var isAnimating = createSelector(getMapById, function (store) {
5170
- return store ? store.isAnimating : false;
5171
- });
5160
+ var isAnimating = function isAnimating(store, mapId) {
5161
+ var map = getMapById(store, mapId);
5162
+ return map ? map.isAnimating : false;
5163
+ };
5172
5164
  /**
5173
5165
  * Gets if any linked map is animating
5174
5166
  *
@@ -5177,7 +5169,7 @@ var isAnimating = createSelector(getMapById, function (store) {
5177
5169
  * @param {string} mapId mapId: string - Id of the map
5178
5170
  * @returns {object} returnType: object - object containing isAnimating boolean and id string
5179
5171
  */
5180
- var linkedMapAnimationInfo = createSelector(function (store, mapId) {
5172
+ var linkedMapAnimationInfo = function linkedMapAnimationInfo(store, mapId) {
5181
5173
  var _genericSelectors$get;
5182
5174
  var animationInfo = {
5183
5175
  isAnimating: isAnimating(store, mapId),
@@ -5194,9 +5186,7 @@ var linkedMapAnimationInfo = createSelector(function (store, mapId) {
5194
5186
  }
5195
5187
  });
5196
5188
  return animationInfo;
5197
- }, function (animationInfo) {
5198
- return animationInfo;
5199
- }, selectorMemoizationOptions);
5189
+ };
5200
5190
  /**
5201
5191
  * Gets start time of animation
5202
5192
  *
@@ -5334,9 +5324,10 @@ var getMapTimeSliderWidth = createSelector(getMapById, function (store) {
5334
5324
  * @param {string} mapId mapId: string - Id of the map
5335
5325
  * @returns {number} returnType: number - center time as a unix timestamp
5336
5326
  */
5337
- var getMapTimeSliderCenterTime = createSelector(getMapById, function (store) {
5338
- return store ? store.timeSliderCenterTime : dateUtils.unix(dateUtils.utc());
5339
- }, selectorMemoizationOptions);
5327
+ var getMapTimeSliderCenterTime = function getMapTimeSliderCenterTime(store, mapId) {
5328
+ var map = getMapById(store, mapId);
5329
+ return map && typeof map.timeSliderCenterTime === 'number' ? map.timeSliderCenterTime : dateUtils.unix(dateUtils.utc());
5330
+ };
5340
5331
  var getMapTimeSliderStartCenterEndAndStep = createSelector(getMapById, function (store) {
5341
5332
  var _store$timeStep2;
5342
5333
  var timeSliderWidth = ((store === null || store === void 0 ? void 0 : store.timeSliderWidth) || 0) * 60;
@@ -6568,134 +6559,6 @@ genericListener.startListening({
6568
6559
  }()
6569
6560
  });
6570
6561
 
6571
- /* A map with all the timerIds and their current step */
6572
- var stepMap$1 = new Map();
6573
- /* A map with a list of timers and their dwell */
6574
- var timerDwellMap$1 = new Map();
6575
- /**
6576
- * Returns the next step for given timerId.
6577
- * @param timerId The timer id
6578
- * @param numberOfStepsInAnimation Animation length in steps
6579
- * @param numStepsToGoForward Amount of steps to go forwards, defaults to 1. Can be positive and negative
6580
- * @returns
6581
- */
6582
- var getNextStep$1 = function getNextStep(timerId, numberOfStepsInAnimation) {
6583
- var numStepsToGoForward = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 1;
6584
- var currentStep = getCurrentStep$1(timerId);
6585
- var nextStep = currentStep + numStepsToGoForward;
6586
- var nextStepClipped = (nextStep % numberOfStepsInAnimation + numberOfStepsInAnimation) % numberOfStepsInAnimation;
6587
- return nextStepClipped;
6588
- };
6589
- /**
6590
- * Handles dwell at the end of the animation loop sequence. The number of steps to wait till proceed can be set by the dwell parameter.
6591
- * @param timerId The timer id
6592
- * @param numberOfStepsInAnimation Number of steps in the animation
6593
- * @param dwell The number of steps to wait at the end of the animation sequence before to continue
6594
- * @returns
6595
- */
6596
- var handleTimerDwell$1 = function handleTimerDwell(timerId, numberOfStepsInAnimation) {
6597
- var dwell = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 8;
6598
- if (dwell > 0) {
6599
- var currentStep = getCurrentStep$1(timerId);
6600
- // Reset the dwell if we are not at the last animation step
6601
- if (currentStep < numberOfStepsInAnimation - 1) {
6602
- timerDwellMap$1.set(timerId, dwell);
6603
- return false;
6604
- }
6605
- // We are at the last animation step, check the dwell
6606
- var timerDwell = timerDwellMap$1.has(timerId) && timerDwellMap$1.get(timerId) || 0;
6607
- if (currentStep === numberOfStepsInAnimation - 1 && timerDwell > 0) {
6608
- timerDwellMap$1.set(timerId, timerDwell - 1);
6609
- return true;
6610
- }
6611
- }
6612
- return false;
6613
- };
6614
- /**
6615
- * Set step for the timerId
6616
- * @param timerId
6617
- * @param timerStep
6618
- */
6619
- var setStep$1 = function setStep(timerId, timerStep) {
6620
- stepMap$1.set(timerId, timerStep);
6621
- };
6622
- /**
6623
- * Gets the current step for the timer
6624
- * @param timerId
6625
- * @returns
6626
- */
6627
- var getCurrentStep$1 = function getCurrentStep(timerId) {
6628
- return stepMap$1.get(timerId) || 0;
6629
- };
6630
- var MAX_NUMBER_STEPS_FORWARD_TO_PREFETCH = 2;
6631
- var MAX_NUMBER_OF_PARALLEL_LOADING_IMAGES = 8;
6632
- /**
6633
- * This prefetches all images connected to the same sync group as provided timerId
6634
- * @param timerId The timerId
6635
- * @param animationListValues List of animation steps in isostring to animate
6636
- * @param targets List of targets to check
6637
- * @returns True if all maps are ready to go forward, false if the map has no data to display yet.
6638
- */
6639
- var prefetchAnimationTargetsForMetronome = function prefetchAnimationTargetsForMetronome(timerId, animationListValues, targets) {
6640
- var timerShouldStepForward = true;
6641
- // The following code prefetches/buffers for all maps in the group
6642
- for (var numPrefetch = 0; numPrefetch < MAX_NUMBER_STEPS_FORWARD_TO_PREFETCH; numPrefetch += 1) {
6643
- var nextStep = getNextStep$1(timerId, animationListValues.length, numPrefetch + 1);
6644
- var nextTimeValueStepToCheck = animationListValues[nextStep];
6645
- var _iterator = _createForOfIteratorHelper(targets),
6646
- _step;
6647
- try {
6648
- for (_iterator.s(); !(_step = _iterator.n()).done;) {
6649
- var target = _step.value;
6650
- var targetMapId = target.targetId;
6651
- var wmMap = getWMJSMapById(targetMapId);
6652
- if (!wmMap) {
6653
- return true; // Map was not registered so there is nothing to prefetch, do not block going forward
6654
- }
6655
- var layersImageUrls = getWMSRequests(wmMap, [{
6656
- name: 'time',
6657
- currentValue: nextTimeValueStepToCheck
6658
- }]);
6659
- var _iterator2 = _createForOfIteratorHelper(layersImageUrls),
6660
- _step2;
6661
- try {
6662
- for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {
6663
- var layersImageUrl = _step2.value;
6664
- var image = wmMap.getMapImageStore.getImage(layersImageUrl.url);
6665
- if (!image.isLoaded()) {
6666
- if (wmMap.getMapImageStore.getNumImagesLoading() < MAX_NUMBER_OF_PARALLEL_LOADING_IMAGES) {
6667
- image.load();
6668
- }
6669
- if (numPrefetch === 0) {
6670
- var altImage = wmMap.getAlternativeImage(layersImageUrl.url, wmMap.getBBOX(), true);
6671
- // No alternative image available yet, so skipping animation.
6672
- if (altImage.length === 0) {
6673
- // This is useful to indicate that the map is loading and has nothing yet to display.
6674
- // console.warn('No data available: Not stepping forward');
6675
- timerShouldStepForward = false;
6676
- }
6677
- }
6678
- } else if (image.isStale()) {
6679
- if (wmMap.getMapImageStore.getNumImagesLoading() < MAX_NUMBER_OF_PARALLEL_LOADING_IMAGES) {
6680
- image.forceReload(true);
6681
- }
6682
- }
6683
- }
6684
- } catch (err) {
6685
- _iterator2.e(err);
6686
- } finally {
6687
- _iterator2.f();
6688
- }
6689
- }
6690
- } catch (err) {
6691
- _iterator.e(err);
6692
- } finally {
6693
- _iterator.f();
6694
- }
6695
- }
6696
- return timerShouldStepForward;
6697
- };
6698
-
6699
6562
  /* A map with all the timerIds and their current step */
6700
6563
  var stepMap = new Map();
6701
6564
  /* A map with a list of timers and their dwell */
@@ -7087,11 +6950,7 @@ mapListener.startListening({
7087
6950
  return timeNameValue.value === initialTime;
7088
6951
  });
7089
6952
  if (initalTimerStep !== -1) {
7090
- if (isOpenLayersEnabled()) {
7091
- setStep(useMapId, initalTimerStep);
7092
- } else {
7093
- setStep$1(useMapId, initalTimerStep);
7094
- }
6953
+ setStep(useMapId, initalTimerStep);
7095
6954
  }
7096
6955
  }
7097
6956
  }
@@ -8387,67 +8246,6 @@ layersListener.startListening({
8387
8246
  }()
8388
8247
  });
8389
8248
 
8390
- /**
8391
- * This handler is triggered by the metronome. An array of timerIds is given as argument.
8392
- * It will update the animation loop of multiple maps and sliders
8393
- * It will prefetch images for maps
8394
- * @param timerIds string[] array of timerIds
8395
- * @param listenerApi ListenerEffectAPI<CoreAppStore, Dispatch, unknown> listenerApi as received from listener
8396
- */
8397
- var metronomeHandler = function metronomeHandler(timerIds, listenerApi) {
8398
- if (isOpenLayersEnabled()) {
8399
- olMetronomeHandler(timerIds, listenerApi);
8400
- return;
8401
- }
8402
- var targetsWithUpdateValue = [];
8403
- var _iterator = _createForOfIteratorHelper(timerIds),
8404
- _step;
8405
- try {
8406
- var _loop = function _loop() {
8407
- var timerId = _step.value;
8408
- var animationListValuesNameAndValue = getAnimationList(listenerApi.getState(), timerId);
8409
- var animationListValues = animationListValuesNameAndValue.map(function (nameAndValue) {
8410
- return nameAndValue.value;
8411
- });
8412
- var targets = getTargets(listenerApi.getState(), {
8413
- sourceId: timerId,
8414
- origin: timerId
8415
- }, SYNCGROUPS_TYPE_SETTIME);
8416
- if (targets.length === 0) {
8417
- // When there are no targets, default to one
8418
- targets.push({
8419
- targetId: timerId,
8420
- value: ''
8421
- });
8422
- }
8423
- var timerIsInDwell = handleTimerDwell$1(timerId, animationListValues.length);
8424
- var timerShouldStepForward = prefetchAnimationTargetsForMetronome(timerId, animationListValues, targets) && !timerIsInDwell;
8425
- // Determine the next step
8426
- var timerStep = timerShouldStepForward ? getNextStep$1(timerId, animationListValues.length) : getCurrentStep$1(timerId);
8427
- setStep$1(timerId, timerStep);
8428
- var updatedValue = animationListValues[timerStep];
8429
- targetsWithUpdateValue.push.apply(targetsWithUpdateValue, _toConsumableArray(targets.map(function (target) {
8430
- return _objectSpread2(_objectSpread2({}, target), {}, {
8431
- value: updatedValue
8432
- });
8433
- })));
8434
- var speedDelay = getMapAnimationDelay(listenerApi.getState(), timerId);
8435
- var speed = 1000 / (speedDelay || 1);
8436
- metronome.setSpeed(timerId, speed);
8437
- };
8438
- for (_iterator.s(); !(_step = _iterator.n()).done;) {
8439
- _loop();
8440
- }
8441
- // Update all targets of all sync groups in one action.
8442
- } catch (err) {
8443
- _iterator.e(err);
8444
- } finally {
8445
- _iterator.f();
8446
- }
8447
- if (targetsWithUpdateValue.length > 0) {
8448
- listenerApi.dispatch(setTimeSync(null, targetsWithUpdateValue, ['metronomelistener']));
8449
- }
8450
- };
8451
8249
  var metronomeListener = createListenerMiddleware();
8452
8250
  metronomeListener.startListening({
8453
8251
  actionCreator: mapActions.mapStartAnimation,
@@ -8458,7 +8256,7 @@ metronomeListener.startListening({
8458
8256
  case 0:
8459
8257
  // register handler with access to listenerApi
8460
8258
  metronome.handleTimerTicks = function (timerIds) {
8461
- metronomeHandler(timerIds, listenerApi);
8259
+ olMetronomeHandler(timerIds, listenerApi);
8462
8260
  };
8463
8261
  case 1:
8464
8262
  case "end":
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@opengeoweb/store",
3
- "version": "12.6.0",
3
+ "version": "12.8.0",
4
4
  "description": "GeoWeb Store library for the opengeoweb project",
5
5
  "license": "Apache-2.0",
6
6
  "repository": {
@@ -8,18 +8,19 @@
8
8
  "url": "git@gitlab.com:opengeoweb/opengeoweb.git"
9
9
  },
10
10
  "dependencies": {
11
- "@opengeoweb/shared": "12.6.0",
11
+ "@opengeoweb/shared": "12.8.0",
12
12
  "react-redux": "^9.2.0",
13
13
  "@reduxjs/toolkit": "^2.6.1",
14
- "@opengeoweb/webmap-react": "12.6.0",
15
- "@opengeoweb/webmap": "12.6.0",
14
+ "@opengeoweb/webmap-react": "12.8.0",
15
+ "@opengeoweb/webmap": "12.8.0",
16
16
  "immer": "^10.0.3",
17
17
  "lodash": "^4.17.21",
18
- "@opengeoweb/metronome": "12.6.0",
19
- "@opengeoweb/timeslider": "12.6.0",
18
+ "@opengeoweb/metronome": "12.8.0",
19
+ "@opengeoweb/timeslider": "12.8.0",
20
20
  "react-router-dom": "^6.23.1",
21
21
  "ol": "^10.4.0",
22
- "@turf/turf": "^7.2.0"
22
+ "@turf/turf": "^7.2.0",
23
+ "@types/geojson": "^7946.0.14"
23
24
  },
24
25
  "peerDependencies": {
25
26
  "react": "18"
@@ -27,5 +28,5 @@
27
28
  "module": "./index.esm.js",
28
29
  "type": "module",
29
30
  "main": "./index.esm.js",
30
- "types": "./index.esm.d.ts"
31
+ "types": "./index.d.ts"
31
32
  }