@opengeoweb/store 9.7.0 → 9.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
@@ -2721,7 +2721,12 @@ var slice$5 = createSlice({
2721
2721
  return;
2722
2722
  }
2723
2723
  draft.byId[mapId].dockedLayerManagerSize = dockedLayerManagerSize;
2724
- }
2724
+ },
2725
+ setMapPresetError: function setMapPresetError(
2726
+ // eslint-disable-next-line no-unused-vars
2727
+ draft,
2728
+ // eslint-disable-next-line no-unused-vars
2729
+ action) {}
2725
2730
  },
2726
2731
  extraReducers: function extraReducers(builder) {
2727
2732
  builder.addCase(layerActions.addLayer, function (draft, action) {
@@ -4065,7 +4070,7 @@ var getSelectedTime = createSelector(function (store, mapId) {
4065
4070
  return getMapDimension(store, mapId, 'time');
4066
4071
  }, function (timeDimension) {
4067
4072
  var now = dateUtils.unix(new Date());
4068
- if (!timeDimension) {
4073
+ if (!timeDimension || !timeDimension.currentValue) {
4069
4074
  return now;
4070
4075
  }
4071
4076
  var timeSliderTime = dateUtils.parseISO(timeDimension.currentValue);
@@ -5569,7 +5574,7 @@ function handleBaseLayersSaga(mapId, baseLayers) {
5569
5574
  function setMapPresetSaga(_ref6) {
5570
5575
  var payload = _ref6.payload;
5571
5576
  return /*#__PURE__*/_regeneratorRuntime().mark(function _callee6() {
5572
- var _a, _b, _c, mapId, initialProps, mapPreset, layers, activeLayerId, autoTimeStepLayerId, autoUpdateLayerId, proj, shouldAutoUpdate, shouldAnimate, animationPayload, toggleTimestepAuto, showTimeSlider, displayMapPin, shouldShowZoomControls, shouldShowLegend, dockedLayerManagerSize, _filterLayers, mapLayers, baseLayers, overLayers, autoTimeStepLayerIdNew, autoUpdateLayerIdNew, onlyActiveLayerIdIsSet, newLayerIds, firstLayerId, baseLayersWithDefaultLayer, overLayersWithDefaultLayer, allBaseLayers, animationLength, animationEndTime, shouldEndtimeOverride, interval, animationEnd, _animationEnd, duration, _animationEnd2, animationStart, shouldOpenLegend, legendId, fiveMinuteDelayForAnimation, _animationEnd3, _animationStart;
5577
+ var _a, _b, _c, mapId, initialProps, mapPreset, layers, activeLayerId, autoTimeStepLayerId, autoUpdateLayerId, proj, shouldAutoUpdate, shouldAnimate, animationPayload, toggleTimestepAuto, showTimeSlider, displayMapPin, shouldShowZoomControls, shouldShowLegend, dockedLayerManagerSize, _filterLayers, mapLayers, baseLayers, overLayers, autoTimeStepLayerIdNew, autoUpdateLayerIdNew, onlyActiveLayerIdIsSet, newLayerIds, firstLayerId, baseLayersWithDefaultLayer, overLayersWithDefaultLayer, allBaseLayers, isProjectionSupported, animationLength, animationEndTime, shouldEndtimeOverride, interval, animationEnd, _animationEnd, duration, _animationEnd2, animationStart, shouldOpenLegend, legendId, fiveMinuteDelayForAnimation, _animationEnd3, _animationStart;
5573
5578
  return _regeneratorRuntime().wrap(function _callee6$(_context8) {
5574
5579
  while (1) switch (_context8.prev = _context8.next) {
5575
5580
  case 0:
@@ -5577,7 +5582,7 @@ function setMapPresetSaga(_ref6) {
5577
5582
  mapId = payload.mapId, initialProps = payload.initialProps;
5578
5583
  mapPreset = initialProps.mapPreset;
5579
5584
  if (!mapPreset) {
5580
- _context8.next = 121;
5585
+ _context8.next = 124;
5581
5586
  break;
5582
5587
  }
5583
5588
  layers = mapPreset.layers, activeLayerId = mapPreset.activeLayerId, autoTimeStepLayerId = mapPreset.autoTimeStepLayerId, autoUpdateLayerId = mapPreset.autoUpdateLayerId, proj = mapPreset.proj, shouldAutoUpdate = mapPreset.shouldAutoUpdate, shouldAnimate = mapPreset.shouldAnimate, animationPayload = mapPreset.animationPayload, toggleTimestepAuto = mapPreset.toggleTimestepAuto, showTimeSlider = mapPreset.showTimeSlider, displayMapPin = mapPreset.displayMapPin, shouldShowZoomControls = mapPreset.shouldShowZoomControls, shouldShowLegend = mapPreset.shouldShowLegend, dockedLayerManagerSize = mapPreset.dockedLayerManagerSize;
@@ -5629,271 +5634,282 @@ function setMapPresetSaga(_ref6) {
5629
5634
  return call(handleBaseLayersSaga, mapId, allBaseLayers);
5630
5635
  case 24:
5631
5636
  if (!proj) {
5632
- _context8.next = 27;
5637
+ _context8.next = 30;
5633
5638
  break;
5634
5639
  }
5635
- _context8.next = 27;
5640
+ isProjectionSupported = webmapUtils.getWMJSMapById(mapId).isProjectionSupported(proj.srs);
5641
+ if (isProjectionSupported) {
5642
+ _context8.next = 28;
5643
+ break;
5644
+ }
5645
+ throw new Error("Projection ".concat(proj.srs, " is not supported"));
5646
+ case 28:
5647
+ _context8.next = 30;
5636
5648
  return put(mapActions.setBbox({
5637
5649
  mapId: mapId,
5638
- bbox: proj === null || proj === void 0 ? void 0 : proj.bbox,
5639
- srs: proj === null || proj === void 0 ? void 0 : proj.srs
5650
+ bbox: proj.bbox,
5651
+ srs: proj.srs
5640
5652
  }));
5641
- case 27:
5653
+ case 30:
5642
5654
  animationLength = animationPayload && animationPayload.duration;
5643
5655
  animationEndTime = animationPayload && animationPayload.endTime && isAnimationEndTimeValid(animationPayload.endTime) && animationPayload.endTime;
5644
5656
  shouldEndtimeOverride = animationPayload ? animationPayload.shouldEndtimeOverride : false;
5645
5657
  if (!shouldEndtimeOverride) {
5646
- _context8.next = 33;
5658
+ _context8.next = 36;
5647
5659
  break;
5648
5660
  }
5649
- _context8.next = 33;
5661
+ _context8.next = 36;
5650
5662
  return put(mapActions.setEndTimeOverriding({
5651
5663
  mapId: mapId,
5652
5664
  shouldEndtimeOverride: shouldEndtimeOverride
5653
5665
  }));
5654
- case 33:
5666
+ case 36:
5655
5667
  if (!(shouldAutoUpdate !== undefined && !animationEndTime)) {
5656
- _context8.next = 36;
5668
+ _context8.next = 39;
5657
5669
  break;
5658
5670
  }
5659
- _context8.next = 36;
5671
+ _context8.next = 39;
5660
5672
  return put(mapActions.toggleAutoUpdate({
5661
5673
  mapId: mapId,
5662
5674
  shouldAutoUpdate: shouldAutoUpdate
5663
5675
  }));
5664
- case 36:
5676
+ case 39:
5665
5677
  if (!(showTimeSlider !== undefined)) {
5666
- _context8.next = 39;
5678
+ _context8.next = 42;
5667
5679
  break;
5668
5680
  }
5669
- _context8.next = 39;
5681
+ _context8.next = 42;
5670
5682
  return put(mapActions.toggleTimeSliderIsVisible({
5671
5683
  mapId: mapId,
5672
5684
  isTimeSliderVisible: showTimeSlider
5673
5685
  }));
5674
- case 39:
5686
+ case 42:
5675
5687
  if (!(shouldShowZoomControls !== undefined)) {
5676
- _context8.next = 42;
5688
+ _context8.next = 45;
5677
5689
  break;
5678
5690
  }
5679
- _context8.next = 42;
5691
+ _context8.next = 45;
5680
5692
  return put(mapActions.toggleZoomControls({
5681
5693
  mapId: mapId,
5682
5694
  shouldShowZoomControls: shouldShowZoomControls
5683
5695
  }));
5684
- case 42:
5696
+ case 45:
5685
5697
  if (!(displayMapPin !== undefined)) {
5686
- _context8.next = 45;
5698
+ _context8.next = 48;
5687
5699
  break;
5688
5700
  }
5689
- _context8.next = 45;
5701
+ _context8.next = 48;
5690
5702
  return put(mapActions.toggleMapPinIsVisible({
5691
5703
  mapId: mapId,
5692
5704
  displayMapPin: displayMapPin
5693
5705
  }));
5694
- case 45:
5706
+ case 48:
5695
5707
  // sets timestep by interval of animationPayload
5696
5708
  interval = animationPayload && animationPayload.interval;
5697
5709
  if (!interval) {
5698
- _context8.next = 49;
5710
+ _context8.next = 52;
5699
5711
  break;
5700
5712
  }
5701
- _context8.next = 49;
5713
+ _context8.next = 52;
5702
5714
  return put(mapActions.setTimeStep({
5703
5715
  mapId: mapId,
5704
5716
  timeStep: interval
5705
5717
  }));
5706
- case 49:
5718
+ case 52:
5707
5719
  if (!animationEndTime) {
5708
- _context8.next = 58;
5720
+ _context8.next = 61;
5709
5721
  break;
5710
5722
  }
5711
- _context8.next = 52;
5723
+ _context8.next = 55;
5712
5724
  return put(mapActions.setAnimationEndTime({
5713
5725
  mapId: mapId,
5714
5726
  animationEndTime: getAnimationEndTime(animationEndTime)
5715
5727
  }));
5716
- case 52:
5728
+ case 55:
5717
5729
  if (animationLength) {
5718
- _context8.next = 58;
5730
+ _context8.next = 61;
5719
5731
  break;
5720
5732
  }
5721
- _context8.next = 55;
5733
+ _context8.next = 58;
5722
5734
  return select(getAnimationEndTime$1, mapId);
5723
- case 55:
5735
+ case 58:
5724
5736
  animationEnd = _context8.sent;
5725
- _context8.next = 58;
5737
+ _context8.next = 61;
5726
5738
  return put(mapActions.setAnimationStartTime({
5727
5739
  mapId: mapId,
5728
5740
  animationStartTime: dateUtils.sub(dateUtils.utc(animationEnd), {
5729
5741
  minutes: 5 * 60 // set to default of 5 hours
5730
5742
  }).toISOString()
5731
5743
  }));
5732
- case 58:
5744
+ case 61:
5733
5745
  if (!animationLength) {
5734
- _context8.next = 64;
5746
+ _context8.next = 67;
5735
5747
  break;
5736
5748
  }
5737
- _context8.next = 61;
5749
+ _context8.next = 64;
5738
5750
  return select(getAnimationEndTime$1, mapId);
5739
- case 61:
5751
+ case 64:
5740
5752
  _animationEnd = _context8.sent;
5741
- _context8.next = 64;
5753
+ _context8.next = 67;
5742
5754
  return put(mapActions.setAnimationStartTime({
5743
5755
  mapId: mapId,
5744
5756
  animationStartTime: dateUtils.sub(dateUtils.utc(_animationEnd), {
5745
5757
  minutes: animationLength
5746
5758
  }).toISOString()
5747
5759
  }));
5748
- case 64:
5760
+ case 67:
5749
5761
  if (!(animationPayload && animationPayload.speed)) {
5750
- _context8.next = 67;
5762
+ _context8.next = 70;
5751
5763
  break;
5752
5764
  }
5753
- _context8.next = 67;
5765
+ _context8.next = 70;
5754
5766
  return put(mapActions.setAnimationDelay({
5755
5767
  mapId: mapId,
5756
5768
  animationDelay: getSpeedDelay(animationPayload.speed)
5757
5769
  }));
5758
- case 67:
5770
+ case 70:
5759
5771
  if (!(shouldAnimate === true)) {
5760
- _context8.next = 92;
5772
+ _context8.next = 95;
5761
5773
  break;
5762
5774
  }
5763
5775
  duration = animationPayload && animationPayload.duration ? animationPayload.duration : 5 * 60; // set to default of 5 hours
5764
5776
  if (!(shouldEndtimeOverride && animationEndTime)) {
5765
- _context8.next = 75;
5777
+ _context8.next = 78;
5766
5778
  break;
5767
5779
  }
5768
- _context8.next = 72;
5780
+ _context8.next = 75;
5769
5781
  return select(getAnimationEndTime$1, mapId);
5770
- case 72:
5782
+ case 75:
5771
5783
  _context8.t0 = _context8.sent;
5772
- _context8.next = 76;
5784
+ _context8.next = 79;
5773
5785
  break;
5774
- case 75:
5786
+ case 78:
5775
5787
  _context8.t0 = dateUtils.dateToString(dateUtils.utc(), dateFormat);
5776
- case 76:
5788
+ case 79:
5777
5789
  _animationEnd2 = _context8.t0;
5778
5790
  if (!(shouldEndtimeOverride && animationLength)) {
5779
- _context8.next = 83;
5791
+ _context8.next = 86;
5780
5792
  break;
5781
5793
  }
5782
- _context8.next = 80;
5794
+ _context8.next = 83;
5783
5795
  return select(getAnimationStartTime, mapId);
5784
- case 80:
5796
+ case 83:
5785
5797
  _context8.t1 = _context8.sent;
5786
- _context8.next = 84;
5798
+ _context8.next = 87;
5787
5799
  break;
5788
- case 83:
5800
+ case 86:
5789
5801
  _context8.t1 = dateUtils.dateToString(dateUtils.sub(dateUtils.utc(_animationEnd2), {
5790
5802
  minutes: duration
5791
5803
  }), dateFormat);
5792
- case 84:
5804
+ case 87:
5793
5805
  animationStart = _context8.t1;
5794
- _context8.next = 87;
5806
+ _context8.next = 90;
5795
5807
  return put(mapActions.mapStartAnimation({
5796
5808
  mapId: mapId,
5797
5809
  start: animationStart,
5798
5810
  end: _animationEnd2,
5799
5811
  interval: interval || defaultTimeStep
5800
5812
  }));
5801
- case 87:
5813
+ case 90:
5802
5814
  if (!interval) {
5803
- _context8.next = 90;
5815
+ _context8.next = 93;
5804
5816
  break;
5805
5817
  }
5806
- _context8.next = 90;
5818
+ _context8.next = 93;
5807
5819
  return put(mapActions.toggleTimestepAuto({
5808
5820
  mapId: mapId,
5809
5821
  timestepAuto: false
5810
5822
  }));
5811
- case 90:
5812
- _context8.next = 95;
5823
+ case 93:
5824
+ _context8.next = 98;
5813
5825
  break;
5814
- case 92:
5826
+ case 95:
5815
5827
  if (!(toggleTimestepAuto !== undefined)) {
5816
- _context8.next = 95;
5828
+ _context8.next = 98;
5817
5829
  break;
5818
5830
  }
5819
- _context8.next = 95;
5831
+ _context8.next = 98;
5820
5832
  return put(mapActions.toggleTimestepAuto({
5821
5833
  mapId: mapId,
5822
5834
  timestepAuto: toggleTimestepAuto
5823
5835
  }));
5824
- case 95:
5836
+ case 98:
5825
5837
  // show legend
5826
5838
  shouldOpenLegend = shouldShowLegend !== undefined ? shouldShowLegend : IS_LEGEND_OPEN_BY_DEFAULT;
5827
- _context8.next = 98;
5839
+ _context8.next = 101;
5828
5840
  return select(getLegendId, mapId);
5829
- case 98:
5841
+ case 101:
5830
5842
  legendId = _context8.sent;
5831
5843
  if (!legendId) {
5832
- _context8.next = 102;
5844
+ _context8.next = 105;
5833
5845
  break;
5834
5846
  }
5835
- _context8.next = 102;
5847
+ _context8.next = 105;
5836
5848
  return put(uiActions.setToggleOpenDialog({
5837
5849
  type: legendId,
5838
5850
  setOpen: shouldOpenLegend
5839
5851
  }));
5840
- case 102:
5852
+ case 105:
5841
5853
  if (!dockedLayerManagerSize) {
5842
- _context8.next = 105;
5854
+ _context8.next = 108;
5843
5855
  break;
5844
5856
  }
5845
- _context8.next = 105;
5857
+ _context8.next = 108;
5846
5858
  return put(mapActions.setDockedLayerManagerSize({
5847
5859
  mapId: mapId,
5848
5860
  dockedLayerManagerSize: dockedLayerManagerSize
5849
5861
  }));
5850
- case 105:
5862
+ case 108:
5851
5863
  if (!(animationEndTime && (shouldEndtimeOverride || !(shouldAutoUpdate || shouldAnimate)))) {
5852
- _context8.next = 121;
5864
+ _context8.next = 124;
5853
5865
  break;
5854
5866
  }
5855
5867
  fiveMinuteDelayForAnimation = 1000 * 60 * 5;
5856
- _context8.next = 109;
5868
+ _context8.next = 112;
5857
5869
  return delay(fiveMinuteDelayForAnimation);
5858
- case 109:
5859
- _context8.next = 111;
5870
+ case 112:
5871
+ _context8.next = 114;
5860
5872
  return select(getAnimationEndTime$1, mapId);
5861
- case 111:
5873
+ case 114:
5862
5874
  _animationEnd3 = _context8.sent;
5863
- _context8.next = 114;
5875
+ _context8.next = 117;
5864
5876
  return put(mapActions.setAnimationEndTime({
5865
5877
  mapId: mapId,
5866
5878
  animationEndTime: dateUtils.add(dateUtils.utc(_animationEnd3), {
5867
5879
  minutes: 5
5868
5880
  }).toISOString()
5869
5881
  }));
5870
- case 114:
5871
- _context8.next = 116;
5882
+ case 117:
5883
+ _context8.next = 119;
5872
5884
  return select(getAnimationStartTime, mapId);
5873
- case 116:
5885
+ case 119:
5874
5886
  _animationStart = _context8.sent;
5875
- _context8.next = 119;
5887
+ _context8.next = 122;
5876
5888
  return put(mapActions.setAnimationStartTime({
5877
5889
  mapId: mapId,
5878
5890
  animationStartTime: dateUtils.add(dateUtils.utc(_animationStart), {
5879
5891
  minutes: 5
5880
5892
  }).toISOString()
5881
5893
  }));
5882
- case 119:
5883
- _context8.next = 105;
5894
+ case 122:
5895
+ _context8.next = 108;
5884
5896
  break;
5885
- case 121:
5886
- _context8.next = 126;
5897
+ case 124:
5898
+ _context8.next = 130;
5887
5899
  break;
5888
- case 123:
5889
- _context8.prev = 123;
5890
- _context8.t2 = _context8["catch"](0);
5891
- console.error(_context8.t2);
5892
5900
  case 126:
5901
+ _context8.prev = 126;
5902
+ _context8.t2 = _context8["catch"](0);
5903
+ _context8.next = 130;
5904
+ return put(mapActions.setMapPresetError({
5905
+ mapId: payload.mapId,
5906
+ error: _context8.t2.message
5907
+ }));
5908
+ case 130:
5893
5909
  case "end":
5894
5910
  return _context8.stop();
5895
5911
  }
5896
- }, _callee6, null, [[0, 123]]);
5912
+ }, _callee6, null, [[0, 126]]);
5897
5913
  })();
5898
5914
  }
5899
5915
  function unregisterMapSaga(_ref7) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@opengeoweb/store",
3
- "version": "9.7.0",
3
+ "version": "9.8.0",
4
4
  "description": "GeoWeb Store library for the opengeoweb project",
5
5
  "license": "Apache-2.0",
6
6
  "repository": {
@@ -45,6 +45,10 @@ export declare const mapStoreActions: {
45
45
  setDisableMapPin: import("@reduxjs/toolkit").ActionCreatorWithPayload<import("./types").DisableMapPinPayload, "mapReducer/setDisableMapPin">;
46
46
  toggleMapPinIsVisible: import("@reduxjs/toolkit").ActionCreatorWithPayload<import("./types").ToggleMapPinIsVisiblePayload, "mapReducer/toggleMapPinIsVisible">;
47
47
  setDockedLayerManagerSize: import("@reduxjs/toolkit").ActionCreatorWithPayload<import("./types").SetDockedLayerManagerSize, "mapReducer/setDockedLayerManagerSize">;
48
+ setMapPresetError: import("@reduxjs/toolkit").ActionCreatorWithPayload<{
49
+ mapId: string;
50
+ error: string;
51
+ }, "mapReducer/setMapPresetError">;
48
52
  addLayer: import("@reduxjs/toolkit").ActionCreatorWithPayload<import("./types").AddLayerPayload, "layerReducer/addLayer">;
49
53
  duplicateMapLayer: import("@reduxjs/toolkit").ActionCreatorWithPayload<import("./types").DuplicateMapLayerPayload, "layerReducer/duplicateMapLayer">;
50
54
  layerChangeDimension: import("@reduxjs/toolkit").ActionCreatorWithPayload<import("./types").SetLayerDimensionPayload, "layerReducer/layerChangeDimension">;
@@ -52,6 +52,10 @@ export declare const slice: import("@reduxjs/toolkit").Slice<WebMapState, {
52
52
  setDisableMapPin: (draft: Draft<WebMapState>, action: PayloadAction<DisableMapPinPayload>) => void;
53
53
  toggleMapPinIsVisible: (draft: Draft<WebMapState>, action: PayloadAction<ToggleMapPinIsVisiblePayload>) => void;
54
54
  setDockedLayerManagerSize: (draft: Draft<WebMapState>, action: PayloadAction<SetDockedLayerManagerSize>) => void;
55
+ setMapPresetError: (draft: Draft<WebMapState>, action: PayloadAction<{
56
+ mapId: string;
57
+ error: string;
58
+ }>) => void;
55
59
  }, "mapReducer">;
56
60
  export declare const mapActions: {
57
61
  setMapPreset: import("@reduxjs/toolkit").ActionCreatorWithPayload<import("./types").SetMapPresetPayload, string>;
@@ -97,5 +101,9 @@ export declare const mapActions: {
97
101
  setDisableMapPin: import("@reduxjs/toolkit").ActionCreatorWithPayload<DisableMapPinPayload, "mapReducer/setDisableMapPin">;
98
102
  toggleMapPinIsVisible: import("@reduxjs/toolkit").ActionCreatorWithPayload<ToggleMapPinIsVisiblePayload, "mapReducer/toggleMapPinIsVisible">;
99
103
  setDockedLayerManagerSize: import("@reduxjs/toolkit").ActionCreatorWithPayload<SetDockedLayerManagerSize, "mapReducer/setDockedLayerManagerSize">;
104
+ setMapPresetError: import("@reduxjs/toolkit").ActionCreatorWithPayload<{
105
+ mapId: string;
106
+ error: string;
107
+ }, "mapReducer/setMapPresetError">;
100
108
  };
101
109
  export declare const reducer: import("redux").Reducer<WebMapState, import("redux").AnyAction>;