@opengeoweb/store 10.1.0 → 10.2.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
@@ -2867,6 +2867,16 @@ var getLayerById = createSelector([layerStore, function (layerStore, layerId) {
2867
2867
  }], function (layerState, layerId) {
2868
2868
  return layerState && layerState.byId && layerState.byId[layerId];
2869
2869
  }, selectorMemoizationOptions);
2870
+ /**
2871
+ * Determines if layer is present
2872
+ *
2873
+ * @param {object} store store: object - store object
2874
+ * @param {string} layerId layerId: string - Id of the layer
2875
+ * @returns {boolean} returnType:boolean - true if layer is present
2876
+ */
2877
+ var getIsLayerPresent = createSelector(getLayerById, function (layer) {
2878
+ return !!layer;
2879
+ }, selectorMemoizationOptions);
2870
2880
  /**
2871
2881
  * Gets a layer from the layers part of the store by its Id, but without the time dimension. (All other dimensions are still included)
2872
2882
  *
@@ -3269,6 +3279,7 @@ var selectors$6 = /*#__PURE__*/Object.freeze({
3269
3279
  getFeatureLayers: getFeatureLayers,
3270
3280
  getHasFeatureLayerGeoJSON: getHasFeatureLayerGeoJSON,
3271
3281
  getIsLayerInEditMode: getIsLayerInEditMode,
3282
+ getIsLayerPresent: getIsLayerPresent,
3272
3283
  getLayerById: getLayerById,
3273
3284
  getLayerByIdWithoutTimeDimension: getLayerByIdWithoutTimeDimension,
3274
3285
  getLayerCurrentTime: getLayerCurrentTime,
@@ -5397,7 +5408,7 @@ var getLegendId = createSelector(getMapById, function (store) {
5397
5408
  * @param {string} mapId mapId: string - Id of the map
5398
5409
  * @returns {MapPreset} returnType: MapPreset
5399
5410
  */
5400
- var getMapPreset = createSelector(getMapLayers, getMapBaseLayers, getMapOverLayers, getBbox, getSrs, getActiveLayerId, getAutoTimeStepLayerId, getAutoUpdateLayerId, isAnimating, isAutoUpdating, isTimeSliderVisible, getDisplayMapPin, isZoomControlsVisible, getMapTimeStep, getMapAnimationDelay, getAnimationStartTime, getAnimationEndTime, isTimestepAuto, getLegendId, getUiStore, function (mapLayers, baseLayers, overLayers, bbox, srs, activeLayerId, autoUpdateLayerId, autoTimeStepLayerId, isAnimating, isAutoUpdating, isTimeSliderVisible, displayMapPin, isZoomControlsVisible, mapTimeStep, mapAnimationDelay, animationStartTime, animationEndTime, isTimestepAuto, legendId, uiStore) {
5411
+ var getMapPreset = createSelector(getMapLayers, getMapBaseLayers, getMapOverLayers, getBbox, getSrs, getActiveLayerId, getAutoTimeStepLayerId, getAutoUpdateLayerId, isAnimating, isAutoUpdating, isTimeSliderVisible, getDisplayMapPin, isZoomControlsVisible, getMapTimeStep, getMapAnimationDelay, getAnimationStartTime, getAnimationEndTime, getMapTimeSliderSpan, isTimestepAuto, isTimeSpanAuto, getLegendId, getUiStore, function (mapLayers, baseLayers, overLayers, bbox, srs, activeLayerId, autoUpdateLayerId, autoTimeStepLayerId, isAnimating, isAutoUpdating, isTimeSliderVisible, displayMapPin, isZoomControlsVisible, mapTimeStep, mapAnimationDelay, animationStartTime, animationEndTime, timeSliderSpan, isTimestepAuto, isTimeSpanAuto, legendId, uiStore) {
5401
5412
  var _uiStore$dialogs$lege;
5402
5413
  var allLayers = [].concat(baseLayers, overLayers, mapLayers).map(function (_ref2) {
5403
5414
  _ref2.mapId;
@@ -5439,7 +5450,9 @@ var getMapPreset = createSelector(getMapLayers, getMapBaseLayers, getMapOverLaye
5439
5450
  shouldShowZoomControls: isZoomControlsVisible,
5440
5451
  animationPayload: animationPayload,
5441
5452
  toggleTimestepAuto: isTimestepAuto,
5442
- shouldShowLegend: shouldShowLegend
5453
+ toggleTimeSpanAuto: isTimeSpanAuto,
5454
+ shouldShowLegend: shouldShowLegend,
5455
+ timeSliderSpan: timeSliderSpan
5443
5456
  });
5444
5457
  }, selectorMemoizationOptions);
5445
5458
  /**
@@ -6452,7 +6465,7 @@ mapListener.startListening({
6452
6465
  actionCreator: mapActions.setMapPreset,
6453
6466
  effect: function () {
6454
6467
  var _effect2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(_ref6, listenerApi) {
6455
- 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;
6468
+ var payload, mapId, initialProps, mapPreset, layers, activeLayerId, autoTimeStepLayerId, autoUpdateLayerId, proj, shouldAutoUpdate, shouldAnimate, animationPayload, toggleTimestepAuto, showTimeSlider, displayMapPin, shouldShowZoomControls, shouldShowLegend, dockedLayerManagerSize, timeSliderSpan, toggleTimeSpanAuto, _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;
6456
6469
  return _regeneratorRuntime().wrap(function _callee2$(_context2) {
6457
6470
  while (1) switch (_context2.prev = _context2.next) {
6458
6471
  case 0:
@@ -6461,10 +6474,10 @@ mapListener.startListening({
6461
6474
  mapId = payload.mapId, initialProps = payload.initialProps;
6462
6475
  mapPreset = initialProps.mapPreset;
6463
6476
  if (!mapPreset) {
6464
- _context2.next = 48;
6477
+ _context2.next = 50;
6465
6478
  break;
6466
6479
  }
6467
- 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;
6480
+ 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, timeSliderSpan = mapPreset.timeSliderSpan, toggleTimeSpanAuto = mapPreset.toggleTimeSpanAuto;
6468
6481
  _filterLayers = filterLayers(layers), mapLayers = _filterLayers.mapLayers, baseLayers = _filterLayers.baseLayers, overLayers = _filterLayers.overLayers;
6469
6482
  if (layers) {
6470
6483
  // make sure all layers have a unique id before going forward
@@ -6554,6 +6567,20 @@ mapListener.startListening({
6554
6567
  isTimeSliderVisible: showTimeSlider
6555
6568
  }));
6556
6569
  }
6570
+ if (timeSliderSpan !== undefined) {
6571
+ // set timeslider span
6572
+ listenerApi.dispatch(mapActions.setTimeSliderSpan({
6573
+ mapId: mapId,
6574
+ timeSliderSpan: timeSliderSpan
6575
+ }));
6576
+ }
6577
+ if (toggleTimeSpanAuto !== undefined) {
6578
+ // toggle timeslider span auto
6579
+ listenerApi.dispatch(mapActions.toggleTimeSpanAuto({
6580
+ mapId: mapId,
6581
+ timeSpanAuto: toggleTimeSpanAuto
6582
+ }));
6583
+ }
6557
6584
  if (shouldShowZoomControls !== undefined) {
6558
6585
  // toggle zoom controls
6559
6586
  listenerApi.dispatch(mapActions.toggleZoomControls({
@@ -6666,15 +6693,15 @@ mapListener.startListening({
6666
6693
  dockedLayerManagerSize: dockedLayerManagerSize
6667
6694
  }));
6668
6695
  }
6669
- case 38:
6696
+ case 40:
6670
6697
  if (!(animationEndTime && (shouldEndtimeOverride || !(shouldAutoUpdate || shouldAnimate)))) {
6671
- _context2.next = 48;
6698
+ _context2.next = 50;
6672
6699
  break;
6673
6700
  }
6674
6701
  fiveMinuteDelayForAnimation = 1000 * 60 * 5; // eslint-disable-next-line no-await-in-loop
6675
- _context2.next = 42;
6702
+ _context2.next = 44;
6676
6703
  return listenerApi.delay(fiveMinuteDelayForAnimation);
6677
- case 42:
6704
+ case 44:
6678
6705
  _animationEnd2 = getAnimationEndTime(listenerApi.getState(), mapId);
6679
6706
  listenerApi.dispatch(mapActions.setAnimationEndTime({
6680
6707
  mapId: mapId,
@@ -6689,13 +6716,13 @@ mapListener.startListening({
6689
6716
  minutes: 5
6690
6717
  }).toISOString()
6691
6718
  }));
6692
- _context2.next = 38;
6693
- break;
6694
- case 48:
6695
- _context2.next = 53;
6719
+ _context2.next = 40;
6696
6720
  break;
6697
6721
  case 50:
6698
- _context2.prev = 50;
6722
+ _context2.next = 55;
6723
+ break;
6724
+ case 52:
6725
+ _context2.prev = 52;
6699
6726
  _context2.t0 = _context2["catch"](1);
6700
6727
  if (_context2.t0 instanceof Error) {
6701
6728
  listenerApi.dispatch(mapActions.setMapPresetError({
@@ -6703,11 +6730,11 @@ mapListener.startListening({
6703
6730
  error: _context2.t0.message
6704
6731
  }));
6705
6732
  }
6706
- case 53:
6733
+ case 55:
6707
6734
  case "end":
6708
6735
  return _context2.stop();
6709
6736
  }
6710
- }, _callee2, null, [[1, 50]]);
6737
+ }, _callee2, null, [[1, 52]]);
6711
6738
  }));
6712
6739
  function effect(_x3, _x4) {
6713
6740
  return _effect2.apply(this, arguments);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@opengeoweb/store",
3
- "version": "10.1.0",
3
+ "version": "10.2.0",
4
4
  "description": "GeoWeb Store library for the opengeoweb project",
5
5
  "license": "Apache-2.0",
6
6
  "repository": {
@@ -14,6 +14,18 @@ export declare const getLayerById: ((state: any, layerId: any) => ReduxLayer | u
14
14
  }> & {
15
15
  clearCache: () => void;
16
16
  };
17
+ /**
18
+ * Determines if layer is present
19
+ *
20
+ * @param {object} store store: object - store object
21
+ * @param {string} layerId layerId: string - Id of the layer
22
+ * @returns {boolean} returnType:boolean - true if layer is present
23
+ */
24
+ export declare const getIsLayerPresent: ((state: any, layerId: any) => boolean) & import("reselect").OutputSelectorFields<(args_0: ReduxLayer | undefined) => boolean, {
25
+ clearCache: () => void;
26
+ }> & {
27
+ clearCache: () => void;
28
+ };
17
29
  /**
18
30
  * Gets a layer from the layers part of the store by its Id, but without the time dimension. (All other dimensions are still included)
19
31
  *
@@ -659,7 +659,7 @@ export declare const getLegendId: ((state: CoreAppStore, mapId: string) => strin
659
659
  * @param {string} mapId mapId: string - Id of the map
660
660
  * @returns {MapPreset} returnType: MapPreset
661
661
  */
662
- export declare const getMapPreset: ((state: CoreAppStore & uiTypes.UIModuleState, mapId: string) => MapPreset) & import("reselect").OutputSelectorFields<(args_0: ReduxLayer[], args_1: ReduxLayer[], args_2: ReduxLayer[], args_3: Bbox, args_4: string, args_5: string | undefined, args_6: string | undefined, args_7: string | undefined, args_8: boolean, args_9: boolean, args_10: boolean | undefined, args_11: boolean | undefined, args_12: boolean | undefined, args_13: number, args_14: number | undefined, args_15: string | undefined, args_16: string | undefined, args_17: boolean | undefined, args_18: string | undefined, args_19: uiTypes.UIStoreType) => MapPreset, {
662
+ export declare const getMapPreset: ((state: CoreAppStore & uiTypes.UIModuleState, mapId: string) => MapPreset) & import("reselect").OutputSelectorFields<(args_0: ReduxLayer[], args_1: ReduxLayer[], args_2: ReduxLayer[], args_3: Bbox, args_4: string, args_5: string | undefined, args_6: string | undefined, args_7: string | undefined, args_8: boolean, args_9: boolean, args_10: boolean | undefined, args_11: boolean | undefined, args_12: boolean | undefined, args_13: number, args_14: number | undefined, args_15: string | undefined, args_16: string | undefined, args_17: number | undefined, args_18: boolean | undefined, args_19: boolean | undefined, args_20: string | undefined, args_21: uiTypes.UIStoreType) => MapPreset, {
663
663
  clearCache: () => void;
664
664
  }> & {
665
665
  clearCache: () => void;
@@ -106,6 +106,8 @@ export interface MapPreset {
106
106
  shouldShowDockedLayerManager?: boolean;
107
107
  dockedLayerManagerSize?: DockedLayerManagerSize;
108
108
  selectedMapIds?: string[];
109
+ timeSliderSpan?: number;
110
+ toggleTimeSpanAuto?: boolean;
109
111
  }
110
112
  export interface MapPresetInitialProps {
111
113
  mapPreset: MapPreset;
@@ -153,6 +155,7 @@ export interface SetEndTimeOverriding {
153
155
  export interface SetTimeSliderSpanPayload {
154
156
  mapId: string;
155
157
  timeSliderSpan: number;
158
+ origin?: MapActionOrigin;
156
159
  }
157
160
  export interface SetTimeStepPayload {
158
161
  mapId: string;