@opengeoweb/store 9.12.0 → 9.13.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
|
@@ -8,7 +8,7 @@ import { produce } from 'immer';
|
|
|
8
8
|
import { isEqual, compact } from 'lodash';
|
|
9
9
|
import { createStore as createStore$1 } from '@redux-eggs/redux-toolkit';
|
|
10
10
|
import { getSagaExtension } from '@redux-eggs/saga-extension';
|
|
11
|
-
import { takeLatest, takeEvery, select, put, call as call$b,
|
|
11
|
+
import { takeLatest, takeEvery, select, put, all, call as call$b, delay } from 'redux-saga/effects';
|
|
12
12
|
import { metronome } from '@opengeoweb/metronome';
|
|
13
13
|
import React, { useCallback, useEffect } from 'react';
|
|
14
14
|
import { Provider, useDispatch, useSelector } from 'react-redux';
|
|
@@ -2258,13 +2258,26 @@ const filterNonTimeDimensions = dimensions => {
|
|
|
2258
2258
|
var _a;
|
|
2259
2259
|
return (_a = dimensions === null || dimensions === void 0 ? void 0 : dimensions.filter(dim => dim.name !== 'time')) !== null && _a !== void 0 ? _a : [];
|
|
2260
2260
|
};
|
|
2261
|
+
/**
|
|
2262
|
+
* Returns the list of dimensions without the time dimension
|
|
2263
|
+
* @param dimensions Dimension[]
|
|
2264
|
+
*/
|
|
2265
|
+
const filterCurrentValueFromDimensions = dimensions => {
|
|
2266
|
+
var _a;
|
|
2267
|
+
return (_a = dimensions === null || dimensions === void 0 ? void 0 : dimensions.map(dim => {
|
|
2268
|
+
// eslint-disable-next-line no-param-reassign
|
|
2269
|
+
dim.currentValue = '';
|
|
2270
|
+
return dim;
|
|
2271
|
+
})) !== null && _a !== void 0 ? _a : [];
|
|
2272
|
+
};
|
|
2261
2273
|
|
|
2262
2274
|
var utils$2 = /*#__PURE__*/Object.freeze({
|
|
2263
2275
|
__proto__: null,
|
|
2264
2276
|
isActionLayerSynced: isActionLayerSynced,
|
|
2265
2277
|
produceDimensionActionForMapLayer: produceDimensionActionForMapLayer,
|
|
2266
2278
|
produceDraftStateForAllLayersForDimensionWithinMap: produceDraftStateForAllLayersForDimensionWithinMap,
|
|
2267
|
-
filterNonTimeDimensions: filterNonTimeDimensions
|
|
2279
|
+
filterNonTimeDimensions: filterNonTimeDimensions,
|
|
2280
|
+
filterCurrentValueFromDimensions: filterCurrentValueFromDimensions
|
|
2268
2281
|
});
|
|
2269
2282
|
|
|
2270
2283
|
/* *
|
|
@@ -3231,6 +3244,7 @@ const getSelectedFeatureIndex = createSelector(getLayerById, layer => layer ===
|
|
|
3231
3244
|
*/
|
|
3232
3245
|
const getIsLayerInEditMode = createSelector(getLayerById, layer => (layer === null || layer === void 0 ? void 0 : layer.isInEditMode) || false, selectorMemoizationOptions);
|
|
3233
3246
|
const getFeatureLayerGeoJSON = createSelector(getLayerById, layer => (layer === null || layer === void 0 ? void 0 : layer.geojson) || undefined, selectorMemoizationOptions);
|
|
3247
|
+
const getHasFeatureLayerGeoJSON = createSelector(getFeatureLayerGeoJSON, geojson => !!geojson, selectorMemoizationOptions);
|
|
3234
3248
|
const getFeatureLayerGeoJSONProperties = createSelector(getLayerById, getSelectedFeatureIndex, (layer, selecteFeatureIndex = 0) => {
|
|
3235
3249
|
var _a, _b;
|
|
3236
3250
|
return ((_b = (_a = layer === null || layer === void 0 ? void 0 : layer.geojson) === null || _a === void 0 ? void 0 : _a.features[selecteFeatureIndex]) === null || _b === void 0 ? void 0 : _b.properties) || {};
|
|
@@ -3313,6 +3327,7 @@ var selectors$7 = /*#__PURE__*/Object.freeze({
|
|
|
3313
3327
|
getSelectedFeatureIndex: getSelectedFeatureIndex,
|
|
3314
3328
|
getIsLayerInEditMode: getIsLayerInEditMode,
|
|
3315
3329
|
getFeatureLayerGeoJSON: getFeatureLayerGeoJSON,
|
|
3330
|
+
getHasFeatureLayerGeoJSON: getHasFeatureLayerGeoJSON,
|
|
3316
3331
|
getFeatureLayerGeoJSONProperties: getFeatureLayerGeoJSONProperties,
|
|
3317
3332
|
getDimensionLayerIds: getDimensionLayerIds,
|
|
3318
3333
|
getAcceptanceTimeInMinutes: getAcceptanceTimeInMinutes,
|
|
@@ -5251,6 +5266,25 @@ const getMapLayers = createSelector(getLayerIds, getLayersById, (layerIdsInMap,
|
|
|
5251
5266
|
const layersWithoutUndefined = compact(layersWithUndefined);
|
|
5252
5267
|
return layersWithoutUndefined;
|
|
5253
5268
|
}, selectorMemoizationOptions);
|
|
5269
|
+
/**
|
|
5270
|
+
* Gets all layer states for a map, but where Dimensions have no currentValue set
|
|
5271
|
+
*
|
|
5272
|
+
* Use this instead of getMapLayers to prevent unnecessary re-renders
|
|
5273
|
+
*
|
|
5274
|
+
* Example: layers = getMapLayers(store, 'mapid_1')
|
|
5275
|
+
* @param {object} store store: object - store object
|
|
5276
|
+
* @param {string} mapId mapId: string - Id of the map
|
|
5277
|
+
* @returns {array} returnType: array - array containing all layer states for the map
|
|
5278
|
+
*/
|
|
5279
|
+
const getMapLayersWithoutDimensionCurrentValue = createSelector(getLayerIds, getLayersById, (layerIdsInMap, allLayers) => {
|
|
5280
|
+
const layersWithUndefined = layerIdsInMap.map(layerId => allLayers === null || allLayers === void 0 ? void 0 : allLayers[layerId]);
|
|
5281
|
+
const layersWithoutUndefined = compact(layersWithUndefined);
|
|
5282
|
+
const layersWithoutTimeDim = layersWithoutUndefined.map(layer => produce(layer, draftLayer => {
|
|
5283
|
+
draftLayer.dimensions = filterCurrentValueFromDimensions(draftLayer.dimensions || []);
|
|
5284
|
+
return draftLayer;
|
|
5285
|
+
}));
|
|
5286
|
+
return layersWithoutTimeDim;
|
|
5287
|
+
}, selectorMemoizationOptions);
|
|
5254
5288
|
/**
|
|
5255
5289
|
* Gets an array of baselayers ids for a map
|
|
5256
5290
|
*
|
|
@@ -5813,6 +5847,7 @@ var selectors$2 = /*#__PURE__*/Object.freeze({
|
|
|
5813
5847
|
getIsMapPresent: getIsMapPresent,
|
|
5814
5848
|
getLayerIds: getLayerIds,
|
|
5815
5849
|
getMapLayers: getMapLayers,
|
|
5850
|
+
getMapLayersWithoutDimensionCurrentValue: getMapLayersWithoutDimensionCurrentValue,
|
|
5816
5851
|
getMapBaseLayersIds: getMapBaseLayersIds,
|
|
5817
5852
|
getMapBaseLayers: getMapBaseLayers,
|
|
5818
5853
|
getMapOverLayersIds: getMapOverLayersIds,
|
|
@@ -7041,7 +7076,7 @@ function* deleteLayerSaga({
|
|
|
7041
7076
|
const {
|
|
7042
7077
|
mapId
|
|
7043
7078
|
} = payload;
|
|
7044
|
-
const layers = yield select(
|
|
7079
|
+
const layers = yield select(getMapLayersWithoutDimensionCurrentValue, mapId);
|
|
7045
7080
|
if (!layers.length) {
|
|
7046
7081
|
yield put(mapActions.mapStopAnimation({
|
|
7047
7082
|
mapId
|
|
@@ -7074,7 +7109,7 @@ function* updateAnimation(mapId, maxValue) {
|
|
|
7074
7109
|
animationStartTime: newAnimationStartTime
|
|
7075
7110
|
}));
|
|
7076
7111
|
}
|
|
7077
|
-
function*
|
|
7112
|
+
function* setLayerDimensionsSaga({
|
|
7078
7113
|
payload
|
|
7079
7114
|
}) {
|
|
7080
7115
|
try {
|
|
@@ -7105,6 +7140,27 @@ function* updateAnimationWithLatestUpdate({
|
|
|
7105
7140
|
if (isAutoUpdateLayer &&
|
|
7106
7141
|
// only update the active layer
|
|
7107
7142
|
shouldAutoUpdate && isIncomingMaxTimeLaterThanCurrentLayerTime) {
|
|
7143
|
+
const isMapAnimating = yield select(isAnimating, mapId);
|
|
7144
|
+
if (!isMapAnimating) {
|
|
7145
|
+
yield put(layerActions.layerChangeDimension({
|
|
7146
|
+
layerId,
|
|
7147
|
+
origin: LayerActionOrigin.setLayerDimensionSaga,
|
|
7148
|
+
dimension: {
|
|
7149
|
+
name: 'time',
|
|
7150
|
+
currentValue: incomingMaxTime
|
|
7151
|
+
}
|
|
7152
|
+
}));
|
|
7153
|
+
// Each time a layer updates, set the new time for all synced timesliders
|
|
7154
|
+
const syncedMapIds = yield select(getSyncedMapIdsForTimeslider);
|
|
7155
|
+
if (syncedMapIds) {
|
|
7156
|
+
// Change time value for all other timesliders
|
|
7157
|
+
yield all(syncedMapIds.map(syncedMapId => put(setTime({
|
|
7158
|
+
origin: 'mapStore saga',
|
|
7159
|
+
sourceId: syncedMapId,
|
|
7160
|
+
value: incomingMaxTime
|
|
7161
|
+
}))));
|
|
7162
|
+
}
|
|
7163
|
+
}
|
|
7108
7164
|
yield call$b(updateAnimation, mapId, incomingMaxTime);
|
|
7109
7165
|
}
|
|
7110
7166
|
} catch (error) {
|
|
@@ -7481,7 +7537,7 @@ function* rootSaga$4() {
|
|
|
7481
7537
|
yield takeLatest(mapActions.mapStopAnimation.type, stopAnimationSaga);
|
|
7482
7538
|
yield takeLatest(mapActions.mapStartAnimation.type, startAnimationSaga);
|
|
7483
7539
|
yield takeLatest(layerActions.layerDelete.type, deleteLayerSaga);
|
|
7484
|
-
yield takeLatest(layerActions.onUpdateLayerInformation.type,
|
|
7540
|
+
yield takeLatest(layerActions.onUpdateLayerInformation.type, setLayerDimensionsSaga);
|
|
7485
7541
|
yield takeLatest(mapActions.toggleAutoUpdate.type, toggleAutoUpdateSaga);
|
|
7486
7542
|
yield takeEvery(mapActions.setMapPreset.type, setMapPresetSaga);
|
|
7487
7543
|
yield takeEvery(mapActions.unregisterMap.type, unregisterMapSaga);
|
package/package.json
CHANGED
|
@@ -317,6 +317,11 @@ export declare const getFeatureLayerGeoJSON: ((state: any, layerId: any) => impo
|
|
|
317
317
|
}> & {
|
|
318
318
|
clearCache: () => void;
|
|
319
319
|
};
|
|
320
|
+
export declare const getHasFeatureLayerGeoJSON: ((state: any, layerId: any) => boolean) & import("reselect").OutputSelectorFields<(args_0: import("geojson").FeatureCollection<import("geojson").Geometry, import("geojson").GeoJsonProperties> | undefined) => boolean, {
|
|
321
|
+
clearCache: () => void;
|
|
322
|
+
}> & {
|
|
323
|
+
clearCache: () => void;
|
|
324
|
+
};
|
|
320
325
|
export declare const getFeatureLayerGeoJSONProperties: ((state: any, layerId: any) => {
|
|
321
326
|
[name: string]: any;
|
|
322
327
|
}) & import("reselect").OutputSelectorFields<(args_0: ReduxLayer | undefined, args_1: number | undefined) => {
|
|
@@ -16,3 +16,8 @@ export declare const produceDraftStateForAllLayersForDimensionWithinMap: (draft:
|
|
|
16
16
|
* @param dimensions Dimension[]
|
|
17
17
|
*/
|
|
18
18
|
export declare const filterNonTimeDimensions: (dimensions: Dimension[]) => Dimension[];
|
|
19
|
+
/**
|
|
20
|
+
* Returns the list of dimensions without the time dimension
|
|
21
|
+
* @param dimensions Dimension[]
|
|
22
|
+
*/
|
|
23
|
+
export declare const filterCurrentValueFromDimensions: (dimensions: Dimension[]) => Dimension[];
|
|
@@ -8,7 +8,7 @@ export declare function startAnimationSaga({ payload, }: ReturnType<typeof mapAc
|
|
|
8
8
|
export declare function stopAnimationSaga({ payload, }: ReturnType<typeof mapActions.mapStopAnimation>): Generator;
|
|
9
9
|
export declare function deleteLayerSaga({ payload, }: ReturnType<typeof layerActions.layerDelete>): SagaIterator;
|
|
10
10
|
export declare function updateAnimation(mapId: string, maxValue: string): SagaIterator;
|
|
11
|
-
export declare function
|
|
11
|
+
export declare function setLayerDimensionsSaga({ payload, }: ReturnType<typeof layerActions.onUpdateLayerInformation>): SagaIterator;
|
|
12
12
|
export declare function toggleAutoUpdateSaga({ payload, }: ReturnType<typeof mapActions.toggleAutoUpdate>): SagaIterator;
|
|
13
13
|
export declare function handleBaseLayersSaga(mapId: string, baseLayers: Layer[]): SagaIterator;
|
|
14
14
|
export declare function setMapPresetSaga({ payload, }: ReturnType<typeof mapActions.setMapPreset>): SagaIterator;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { Bbox, MapPreset, WebMap, WebMapState } from './types';
|
|
2
2
|
import type { CoreAppStore } from '../../types';
|
|
3
|
-
import type { Dimension, Layer, WebMapAnimationList } from '../types';
|
|
3
|
+
import type { Dimension, Layer, ReduxLayer, WebMapAnimationList } from '../types';
|
|
4
4
|
import type { uiTypes } from '../../ui';
|
|
5
5
|
/**
|
|
6
6
|
* Gets the map state by mapId
|
|
@@ -89,7 +89,22 @@ export declare const getLayerIds: ((state: any, mapId: any) => string[]) & impor
|
|
|
89
89
|
* @param {string} mapId mapId: string - Id of the map
|
|
90
90
|
* @returns {array} returnType: array - array containing all layer states for the map
|
|
91
91
|
*/
|
|
92
|
-
export declare const getMapLayers: ((state: any, mapId: any) =>
|
|
92
|
+
export declare const getMapLayers: ((state: any, mapId: any) => ReduxLayer[]) & import("reselect").OutputSelectorFields<(args_0: string[], args_1: Record<string, ReduxLayer> | null) => ReduxLayer[], {
|
|
93
|
+
clearCache: () => void;
|
|
94
|
+
}> & {
|
|
95
|
+
clearCache: () => void;
|
|
96
|
+
};
|
|
97
|
+
/**
|
|
98
|
+
* Gets all layer states for a map, but where Dimensions have no currentValue set
|
|
99
|
+
*
|
|
100
|
+
* Use this instead of getMapLayers to prevent unnecessary re-renders
|
|
101
|
+
*
|
|
102
|
+
* Example: layers = getMapLayers(store, 'mapid_1')
|
|
103
|
+
* @param {object} store store: object - store object
|
|
104
|
+
* @param {string} mapId mapId: string - Id of the map
|
|
105
|
+
* @returns {array} returnType: array - array containing all layer states for the map
|
|
106
|
+
*/
|
|
107
|
+
export declare const getMapLayersWithoutDimensionCurrentValue: ((state: any, mapId: any) => ReduxLayer[]) & import("reselect").OutputSelectorFields<(args_0: string[], args_1: Record<string, ReduxLayer> | null) => ReduxLayer[], {
|
|
93
108
|
clearCache: () => void;
|
|
94
109
|
}> & {
|
|
95
110
|
clearCache: () => void;
|
|
@@ -115,7 +130,7 @@ export declare const getMapBaseLayersIds: ((state: any, mapId: any) => string[])
|
|
|
115
130
|
* @param {string} mapId mapId: string - Id of the map
|
|
116
131
|
* @returns {array} returnType: array - array containing all baselayers for the map
|
|
117
132
|
*/
|
|
118
|
-
export declare const getMapBaseLayers: ((state: any, mapId: any) =>
|
|
133
|
+
export declare const getMapBaseLayers: ((state: any, mapId: any) => ReduxLayer[]) & import("reselect").OutputSelectorFields<(args_0: string[], args_1: Record<string, ReduxLayer> | null) => ReduxLayer[], {
|
|
119
134
|
clearCache: () => void;
|
|
120
135
|
}> & {
|
|
121
136
|
clearCache: () => void;
|
|
@@ -133,7 +148,7 @@ export declare const getMapOverLayersIds: ((state: any, mapId: any) => string[])
|
|
|
133
148
|
}> & {
|
|
134
149
|
clearCache: () => void;
|
|
135
150
|
};
|
|
136
|
-
export declare const getMapFeatureLayers: ((state: any, mapId: any) =>
|
|
151
|
+
export declare const getMapFeatureLayers: ((state: any, mapId: any) => ReduxLayer[]) & import("reselect").OutputSelectorFields<(args_0: WebMap | undefined, args_1: ReduxLayer[]) => ReduxLayer[], {
|
|
137
152
|
clearCache: () => void;
|
|
138
153
|
}> & {
|
|
139
154
|
clearCache: () => void;
|
|
@@ -146,7 +161,7 @@ export declare const getMapFeatureLayers: ((state: any, mapId: any) => import(".
|
|
|
146
161
|
* @param {string} mapId mapId: string - Id of the map
|
|
147
162
|
* @returns {array} returnType: array - array containing all overLayers for the map
|
|
148
163
|
*/
|
|
149
|
-
export declare const getMapOverLayers: ((state: any, mapId: any) =>
|
|
164
|
+
export declare const getMapOverLayers: ((state: any, mapId: any) => ReduxLayer[]) & import("reselect").OutputSelectorFields<(args_0: string[], args_1: Record<string, ReduxLayer> | null) => ReduxLayer[], {
|
|
150
165
|
clearCache: () => void;
|
|
151
166
|
}> & {
|
|
152
167
|
clearCache: () => void;
|
|
@@ -190,7 +205,7 @@ export declare const getSelectedTime: ((state: CoreAppStore, mapId: string) => n
|
|
|
190
205
|
}> & {
|
|
191
206
|
clearCache: () => void;
|
|
192
207
|
};
|
|
193
|
-
export declare const getDataLimitsFromLayers: ((state: any, mapId: any) => number[]) & import("reselect").OutputSelectorFields<(args_0:
|
|
208
|
+
export declare const getDataLimitsFromLayers: ((state: any, mapId: any) => number[]) & import("reselect").OutputSelectorFields<(args_0: ReduxLayer[]) => number[], {
|
|
194
209
|
clearCache: () => void;
|
|
195
210
|
}> & {
|
|
196
211
|
clearCache: () => void;
|
|
@@ -528,7 +543,7 @@ export declare const getMapIdFromLayerId: ((state: CoreAppStore, layerId?: strin
|
|
|
528
543
|
* @param {string} layerId layerId: string - Id of the layer
|
|
529
544
|
* @returns {string} returnType: string - the layerId, or null if not found
|
|
530
545
|
*/
|
|
531
|
-
export declare const getLayerIdByLayerName: ((state: any, _mapId: any, layerName: string) => string) & import("reselect").OutputSelectorFields<(args_0:
|
|
546
|
+
export declare const getLayerIdByLayerName: ((state: any, _mapId: any, layerName: string) => string) & import("reselect").OutputSelectorFields<(args_0: ReduxLayer[], args_1: string) => string, {
|
|
532
547
|
clearCache: () => void;
|
|
533
548
|
}> & {
|
|
534
549
|
clearCache: () => void;
|
|
@@ -542,7 +557,7 @@ export declare const getLayerIdByLayerName: ((state: any, _mapId: any, layerName
|
|
|
542
557
|
* @param {string} layerId layerId: string - Id of the layer
|
|
543
558
|
* @returns {number} returnType: index number or -1 if not found
|
|
544
559
|
*/
|
|
545
|
-
export declare const getLayerIndexByLayerId: ((state: any, _mapId: any, layerId?: string | undefined) => number) & import("reselect").OutputSelectorFields<(args_0:
|
|
560
|
+
export declare const getLayerIndexByLayerId: ((state: any, _mapId: any, layerId?: string | undefined) => number) & import("reselect").OutputSelectorFields<(args_0: ReduxLayer[], args_1: string | undefined) => number, {
|
|
546
561
|
clearCache: () => void;
|
|
547
562
|
}> & {
|
|
548
563
|
clearCache: () => void;
|
|
@@ -556,7 +571,7 @@ export declare const getLayerIndexByLayerId: ((state: any, _mapId: any, layerId?
|
|
|
556
571
|
* @param {number} layerIndex layerId: number - Index of the layer in the map
|
|
557
572
|
* @returns {object} returnType: layer, or null if not found
|
|
558
573
|
*/
|
|
559
|
-
export declare const getLayerByLayerIndex: ((state: any, _mapId: any, layerIndex: number) => Layer) & import("reselect").OutputSelectorFields<(args_0:
|
|
574
|
+
export declare const getLayerByLayerIndex: ((state: any, _mapId: any, layerIndex: number) => Layer) & import("reselect").OutputSelectorFields<(args_0: ReduxLayer[], args_1: number) => Layer, {
|
|
560
575
|
clearCache: () => void;
|
|
561
576
|
}> & {
|
|
562
577
|
clearCache: () => void;
|
|
@@ -633,7 +648,7 @@ export declare const getLegendId: ((state: any, mapId: any) => string | undefine
|
|
|
633
648
|
* @param {string} mapId mapId: string - Id of the map
|
|
634
649
|
* @returns {MapPreset} returnType: MapPreset
|
|
635
650
|
*/
|
|
636
|
-
export declare const getMapPreset: ((state: any, mapId: any) => MapPreset) & import("reselect").OutputSelectorFields<(args_0:
|
|
651
|
+
export declare const getMapPreset: ((state: any, mapId: any) => 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, {
|
|
637
652
|
clearCache: () => void;
|
|
638
653
|
}> & {
|
|
639
654
|
clearCache: () => void;
|
|
@@ -646,7 +661,7 @@ export declare const getMapPreset: ((state: any, mapId: any) => MapPreset) & imp
|
|
|
646
661
|
* @param {string} mapId mapId: string - Id of the map
|
|
647
662
|
* @returns {string[]} returnType: string[] - array of enabled layerIds
|
|
648
663
|
*/
|
|
649
|
-
export declare const getMapLayerIdsEnabled: ((state: any, mapId: any) => string[]) & import("reselect").OutputSelectorFields<(args_0: string[], args_1: Record<string,
|
|
664
|
+
export declare const getMapLayerIdsEnabled: ((state: any, mapId: any) => string[]) & import("reselect").OutputSelectorFields<(args_0: string[], args_1: Record<string, ReduxLayer> | null) => string[], {
|
|
650
665
|
clearCache: () => void;
|
|
651
666
|
}> & {
|
|
652
667
|
clearCache: () => void;
|