@opengeoweb/store 8.3.0 → 8.4.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 +121 -89
- package/package.json +5 -5
package/index.esm.js
CHANGED
|
@@ -1577,6 +1577,65 @@ function isPlainObject(value) {
|
|
|
1577
1577
|
}
|
|
1578
1578
|
return proto === baseProto;
|
|
1579
1579
|
}
|
|
1580
|
+
// src/tsHelpers.ts
|
|
1581
|
+
var hasMatchFunction = function (v) {
|
|
1582
|
+
return v && typeof v.match === "function";
|
|
1583
|
+
};
|
|
1584
|
+
// src/createAction.ts
|
|
1585
|
+
function createAction(type, prepareAction) {
|
|
1586
|
+
function actionCreator() {
|
|
1587
|
+
var args = [];
|
|
1588
|
+
for (var _i = 0; _i < arguments.length; _i++) {
|
|
1589
|
+
args[_i] = arguments[_i];
|
|
1590
|
+
}
|
|
1591
|
+
if (prepareAction) {
|
|
1592
|
+
var prepared = prepareAction.apply(void 0, args);
|
|
1593
|
+
if (!prepared) {
|
|
1594
|
+
throw new Error("prepareAction did not return an object");
|
|
1595
|
+
}
|
|
1596
|
+
return __spreadValues(__spreadValues({
|
|
1597
|
+
type: type,
|
|
1598
|
+
payload: prepared.payload
|
|
1599
|
+
}, "meta" in prepared && { meta: prepared.meta }), "error" in prepared && { error: prepared.error });
|
|
1600
|
+
}
|
|
1601
|
+
return { type: type, payload: args[0] };
|
|
1602
|
+
}
|
|
1603
|
+
actionCreator.toString = function () { return "" + type; };
|
|
1604
|
+
actionCreator.type = type;
|
|
1605
|
+
actionCreator.match = function (action) { return action.type === type; };
|
|
1606
|
+
return actionCreator;
|
|
1607
|
+
}
|
|
1608
|
+
function isAction(action) {
|
|
1609
|
+
return isPlainObject(action) && "type" in action;
|
|
1610
|
+
}
|
|
1611
|
+
function isActionCreator(action) {
|
|
1612
|
+
return typeof action === "function" && "type" in action && hasMatchFunction(action);
|
|
1613
|
+
}
|
|
1614
|
+
function isFSA(action) {
|
|
1615
|
+
return isAction(action) && typeof action.type === "string" && Object.keys(action).every(isValidKey);
|
|
1616
|
+
}
|
|
1617
|
+
function isValidKey(key) {
|
|
1618
|
+
return ["type", "payload", "error", "meta"].indexOf(key) > -1;
|
|
1619
|
+
}
|
|
1620
|
+
// src/actionCreatorInvariantMiddleware.ts
|
|
1621
|
+
function getMessage(type) {
|
|
1622
|
+
var splitType = type ? ("" + type).split("/") : [];
|
|
1623
|
+
var actionName = splitType[splitType.length - 1] || "actionCreator";
|
|
1624
|
+
return "Detected an action creator with type \"" + (type || "unknown") + "\" being dispatched. \nMake sure you're calling the action creator before dispatching, i.e. `dispatch(" + actionName + "())` instead of `dispatch(" + actionName + ")`. This is necessary even if the action has no payload.";
|
|
1625
|
+
}
|
|
1626
|
+
function createActionCreatorInvariantMiddleware(options) {
|
|
1627
|
+
if (options === void 0) { options = {}; }
|
|
1628
|
+
if (process.env.NODE_ENV === "production") {
|
|
1629
|
+
return function () { return function (next) { return function (action) { return next(action); }; }; };
|
|
1630
|
+
}
|
|
1631
|
+
var _c = options.isActionCreator, isActionCreator2 = _c === void 0 ? isActionCreator : _c;
|
|
1632
|
+
return function () { return function (next) { return function (action) {
|
|
1633
|
+
if (isActionCreator2(action)) {
|
|
1634
|
+
console.warn(getMessage(action.type));
|
|
1635
|
+
}
|
|
1636
|
+
return next(action);
|
|
1637
|
+
}; }; };
|
|
1638
|
+
}
|
|
1580
1639
|
function getTimeMeasureUtils(maxDelay, fnName) {
|
|
1581
1640
|
var elapsed = 0;
|
|
1582
1641
|
return {
|
|
@@ -1722,11 +1781,13 @@ function trackForMutations(isImmutable, ignorePaths, obj) {
|
|
|
1722
1781
|
}
|
|
1723
1782
|
};
|
|
1724
1783
|
}
|
|
1725
|
-
function trackProperties(isImmutable, ignorePaths, obj, path) {
|
|
1784
|
+
function trackProperties(isImmutable, ignorePaths, obj, path, checkedObjects) {
|
|
1726
1785
|
if (ignorePaths === void 0) { ignorePaths = []; }
|
|
1727
1786
|
if (path === void 0) { path = ""; }
|
|
1787
|
+
if (checkedObjects === void 0) { checkedObjects = new Set(); }
|
|
1728
1788
|
var tracked = { value: obj };
|
|
1729
|
-
if (!isImmutable(obj)) {
|
|
1789
|
+
if (!isImmutable(obj) && !checkedObjects.has(obj)) {
|
|
1790
|
+
checkedObjects.add(obj);
|
|
1730
1791
|
tracked.children = {};
|
|
1731
1792
|
for (var key in obj) {
|
|
1732
1793
|
var childPath = path ? path + "." + key : key;
|
|
@@ -1931,7 +1992,7 @@ function curryGetDefaultMiddleware() {
|
|
|
1931
1992
|
}
|
|
1932
1993
|
function getDefaultMiddleware(options) {
|
|
1933
1994
|
if (options === void 0) { options = {}; }
|
|
1934
|
-
var _c = options.thunk, thunk = _c === void 0 ? true : _c, _d = options.immutableCheck, immutableCheck = _d === void 0 ? true : _d, _e = options.serializableCheck, serializableCheck = _e === void 0 ? true : _e;
|
|
1995
|
+
var _c = options.thunk, thunk = _c === void 0 ? true : _c, _d = options.immutableCheck, immutableCheck = _d === void 0 ? true : _d, _e = options.serializableCheck, serializableCheck = _e === void 0 ? true : _e, _f = options.actionCreatorCheck, actionCreatorCheck = _f === void 0 ? true : _f;
|
|
1935
1996
|
var middlewareArray = new MiddlewareArray();
|
|
1936
1997
|
if (thunk) {
|
|
1937
1998
|
if (isBoolean(thunk)) {
|
|
@@ -1956,6 +2017,13 @@ function getDefaultMiddleware(options) {
|
|
|
1956
2017
|
}
|
|
1957
2018
|
middlewareArray.push(createSerializableStateInvariantMiddleware(serializableOptions));
|
|
1958
2019
|
}
|
|
2020
|
+
if (actionCreatorCheck) {
|
|
2021
|
+
var actionCreatorOptions = {};
|
|
2022
|
+
if (!isBoolean(actionCreatorCheck)) {
|
|
2023
|
+
actionCreatorOptions = actionCreatorCheck;
|
|
2024
|
+
}
|
|
2025
|
+
middlewareArray.unshift(createActionCreatorInvariantMiddleware(actionCreatorOptions));
|
|
2026
|
+
}
|
|
1959
2027
|
}
|
|
1960
2028
|
return middlewareArray;
|
|
1961
2029
|
}
|
|
@@ -2002,39 +2070,6 @@ function configureStore(options) {
|
|
|
2002
2070
|
var composedEnhancer = finalCompose.apply(void 0, storeEnhancers);
|
|
2003
2071
|
return createStore(rootReducer, preloadedState, composedEnhancer);
|
|
2004
2072
|
}
|
|
2005
|
-
// src/createAction.ts
|
|
2006
|
-
function createAction(type, prepareAction) {
|
|
2007
|
-
function actionCreator() {
|
|
2008
|
-
var args = [];
|
|
2009
|
-
for (var _i = 0; _i < arguments.length; _i++) {
|
|
2010
|
-
args[_i] = arguments[_i];
|
|
2011
|
-
}
|
|
2012
|
-
if (prepareAction) {
|
|
2013
|
-
var prepared = prepareAction.apply(void 0, args);
|
|
2014
|
-
if (!prepared) {
|
|
2015
|
-
throw new Error("prepareAction did not return an object");
|
|
2016
|
-
}
|
|
2017
|
-
return __spreadValues(__spreadValues({
|
|
2018
|
-
type: type,
|
|
2019
|
-
payload: prepared.payload
|
|
2020
|
-
}, "meta" in prepared && { meta: prepared.meta }), "error" in prepared && { error: prepared.error });
|
|
2021
|
-
}
|
|
2022
|
-
return { type: type, payload: args[0] };
|
|
2023
|
-
}
|
|
2024
|
-
actionCreator.toString = function () { return "" + type; };
|
|
2025
|
-
actionCreator.type = type;
|
|
2026
|
-
actionCreator.match = function (action) { return action.type === type; };
|
|
2027
|
-
return actionCreator;
|
|
2028
|
-
}
|
|
2029
|
-
function isAction(action) {
|
|
2030
|
-
return isPlainObject(action) && "type" in action;
|
|
2031
|
-
}
|
|
2032
|
-
function isFSA(action) {
|
|
2033
|
-
return isAction(action) && typeof action.type === "string" && Object.keys(action).every(isValidKey);
|
|
2034
|
-
}
|
|
2035
|
-
function isValidKey(key) {
|
|
2036
|
-
return ["type", "payload", "error", "meta"].indexOf(key) > -1;
|
|
2037
|
-
}
|
|
2038
2073
|
// src/mapBuilders.ts
|
|
2039
2074
|
function executeReducerBuilderCallback(builderCallback) {
|
|
2040
2075
|
var actionsMap = {};
|
|
@@ -2051,8 +2086,11 @@ function executeReducerBuilderCallback(builderCallback) {
|
|
|
2051
2086
|
}
|
|
2052
2087
|
}
|
|
2053
2088
|
var type = typeof typeOrActionCreator === "string" ? typeOrActionCreator : typeOrActionCreator.type;
|
|
2089
|
+
if (!type) {
|
|
2090
|
+
throw new Error("`builder.addCase` cannot be called with an empty action type");
|
|
2091
|
+
}
|
|
2054
2092
|
if (type in actionsMap) {
|
|
2055
|
-
throw new Error("addCase cannot be called with two reducers for the same action type");
|
|
2093
|
+
throw new Error("`builder.addCase` cannot be called with two reducers for the same action type");
|
|
2056
2094
|
}
|
|
2057
2095
|
actionsMap[type] = reducer;
|
|
2058
2096
|
return builder;
|
|
@@ -9560,9 +9598,10 @@ var produceDraftStateForAllLayersForDimensionWithinMap = function produceDraftSt
|
|
|
9560
9598
|
* @param dimensions Dimension[]
|
|
9561
9599
|
*/
|
|
9562
9600
|
var filterNonTimeDimensions = function filterNonTimeDimensions(dimensions) {
|
|
9563
|
-
|
|
9601
|
+
var _a;
|
|
9602
|
+
return (_a = dimensions === null || dimensions === void 0 ? void 0 : dimensions.filter(function (dim) {
|
|
9564
9603
|
return dim.name !== 'time';
|
|
9565
|
-
}) : [];
|
|
9604
|
+
})) !== null && _a !== void 0 ? _a : [];
|
|
9566
9605
|
};
|
|
9567
9606
|
|
|
9568
9607
|
var utils$2 = /*#__PURE__*/Object.freeze({
|
|
@@ -9995,62 +10034,55 @@ var slice$9 = createSlice({
|
|
|
9995
10034
|
var _action$payload14 = action.payload,
|
|
9996
10035
|
layerStyle = _action$payload14.layerStyle,
|
|
9997
10036
|
layerDimensions = _action$payload14.layerDimensions;
|
|
9998
|
-
/* Set style */
|
|
9999
10037
|
if (layerStyle && draft.byId[layerStyle.layerId]) {
|
|
10000
10038
|
draft.byId[layerStyle.layerId].style = layerStyle === null || layerStyle === void 0 ? void 0 : layerStyle.style;
|
|
10001
10039
|
}
|
|
10002
|
-
|
|
10003
|
-
|
|
10004
|
-
|
|
10005
|
-
|
|
10006
|
-
|
|
10007
|
-
|
|
10008
|
-
|
|
10009
|
-
|
|
10010
|
-
|
|
10011
|
-
|
|
10012
|
-
|
|
10013
|
-
|
|
10040
|
+
if (!layerDimensions) {
|
|
10041
|
+
return;
|
|
10042
|
+
}
|
|
10043
|
+
var layer = draft.byId[layerDimensions.layerId];
|
|
10044
|
+
var incomingDimensionNames = layerDimensions.dimensions.map(function (dimension) {
|
|
10045
|
+
return dimension.name;
|
|
10046
|
+
});
|
|
10047
|
+
/* Find all other layers with the same name and service, and update these at once (atomic update) */
|
|
10048
|
+
var layersToUpdate = Object.values(draft.byId).filter(function (otherLayer) {
|
|
10049
|
+
return otherLayer.name === layer.name && otherLayer.service === layer.service && otherLayer.id;
|
|
10050
|
+
});
|
|
10051
|
+
layersToUpdate.forEach(function (layerToUpdate) {
|
|
10052
|
+
var _a;
|
|
10053
|
+
var layerId = layerToUpdate.id;
|
|
10054
|
+
var reduxLayer = draft.byId[layerId];
|
|
10055
|
+
(_a = reduxLayer.dimensions) !== null && _a !== void 0 ? _a : reduxLayer.dimensions = [];
|
|
10056
|
+
// remove dimensions not in incoming list of dimensions
|
|
10057
|
+
reduxLayer.dimensions = reduxLayer.dimensions.filter(function (dimension) {
|
|
10058
|
+
return incomingDimensionNames.includes(dimension.name);
|
|
10059
|
+
});
|
|
10060
|
+
var reduxDimensions = reduxLayer.dimensions;
|
|
10061
|
+
/* Now update or insert the dimension for each layer */
|
|
10062
|
+
layerDimensions.dimensions.forEach(function (newLayerDimension) {
|
|
10063
|
+
/* Find the wmLayer */
|
|
10064
|
+
var wmLayer = webmapUtils.getWMLayerById(layerId);
|
|
10065
|
+
/* Find the wmDimension */
|
|
10066
|
+
var wmDimension = wmLayer === null || wmLayer === void 0 ? void 0 : wmLayer.getDimension(newLayerDimension.name);
|
|
10067
|
+
/* This will set the new range of start/stop values for this dimension, making getClosestValue work properly */
|
|
10068
|
+
wmDimension === null || wmDimension === void 0 ? void 0 : wmDimension.reInitializeValues(newLayerDimension.values);
|
|
10069
|
+
var existingDimension = reduxDimensions.find(function (d) {
|
|
10070
|
+
return d.name === newLayerDimension.name;
|
|
10071
|
+
});
|
|
10072
|
+
if (existingDimension) {
|
|
10073
|
+
/* If found update only minValue, maxValue and values */
|
|
10074
|
+
existingDimension.maxValue = newLayerDimension.maxValue;
|
|
10075
|
+
existingDimension.minValue = newLayerDimension.minValue;
|
|
10076
|
+
existingDimension.values = newLayerDimension.values;
|
|
10077
|
+
if (!existingDimension.units) {
|
|
10078
|
+
existingDimension.units = newLayerDimension.units;
|
|
10014
10079
|
}
|
|
10015
|
-
|
|
10016
|
-
/*
|
|
10017
|
-
|
|
10018
|
-
/* Find the wmLayer */
|
|
10019
|
-
var wmLayer = webmapUtils.getWMLayerById(layerId);
|
|
10020
|
-
/* Find the wmDimension */
|
|
10021
|
-
var wmDimension = wmLayer && wmLayer.getDimension(newLayerDimension.name);
|
|
10022
|
-
/* This will set the new range of start/stop values for this dimension, making getClosestValue work properly */
|
|
10023
|
-
wmDimension && wmDimension.reInitializeValues(newLayerDimension.values);
|
|
10024
|
-
/* Find corresponding draftLayerDimensions */
|
|
10025
|
-
var draftLayerDimension = draftLayerDimensions === null || draftLayerDimensions === void 0 ? void 0 : draftLayerDimensions.find(function (d) {
|
|
10026
|
-
return d.name === newLayerDimension.name;
|
|
10027
|
-
});
|
|
10028
|
-
if (draftLayerDimension) {
|
|
10029
|
-
/* If found update only minValue, maxValue and values */
|
|
10030
|
-
draftLayerDimension.maxValue = newLayerDimension.maxValue;
|
|
10031
|
-
draftLayerDimension.minValue = newLayerDimension.minValue;
|
|
10032
|
-
draftLayerDimension.values = newLayerDimension.values;
|
|
10033
|
-
if (!draftLayerDimension.units) {
|
|
10034
|
-
draftLayerDimension.units = newLayerDimension.units;
|
|
10035
|
-
}
|
|
10036
|
-
} else if (layerId === layerDimensions.layerId) {
|
|
10037
|
-
/* Otherwise add a new one, but only for this layer. */
|
|
10038
|
-
draftLayerDimensions.push({
|
|
10039
|
-
name: newLayerDimension.name,
|
|
10040
|
-
units: newLayerDimension.units,
|
|
10041
|
-
currentValue: newLayerDimension.currentValue,
|
|
10042
|
-
minValue: newLayerDimension.minValue,
|
|
10043
|
-
maxValue: newLayerDimension.maxValue,
|
|
10044
|
-
validSyncSelection: newLayerDimension.validSyncSelection,
|
|
10045
|
-
values: newLayerDimension.values,
|
|
10046
|
-
timeInterval: newLayerDimension.timeInterval,
|
|
10047
|
-
synced: newLayerDimension.synced
|
|
10048
|
-
});
|
|
10049
|
-
}
|
|
10050
|
-
});
|
|
10080
|
+
} else if (layerId === layerDimensions.layerId) {
|
|
10081
|
+
/* Otherwise add a new one, but only for this layer. */
|
|
10082
|
+
reduxDimensions.push(Object.assign({}, newLayerDimension));
|
|
10051
10083
|
}
|
|
10052
10084
|
});
|
|
10053
|
-
}
|
|
10085
|
+
});
|
|
10054
10086
|
},
|
|
10055
10087
|
// feature layer actions
|
|
10056
10088
|
setSelectedFeature: function setSelectedFeature(draft, action) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@opengeoweb/store",
|
|
3
|
-
"version": "8.
|
|
3
|
+
"version": "8.4.0",
|
|
4
4
|
"description": "GeoWeb Store library for the opengeoweb project",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"repository": {
|
|
@@ -12,13 +12,13 @@
|
|
|
12
12
|
"main": "./index.esm.js",
|
|
13
13
|
"dependencies": {},
|
|
14
14
|
"peerDependencies": {
|
|
15
|
-
"@opengeoweb/shared": "8.
|
|
16
|
-
"@opengeoweb/webmap": "8.
|
|
17
|
-
"@opengeoweb/webmap-react": "8.
|
|
15
|
+
"@opengeoweb/shared": "8.4.0",
|
|
16
|
+
"@opengeoweb/webmap": "8.4.0",
|
|
17
|
+
"@opengeoweb/webmap-react": "8.4.0",
|
|
18
18
|
"@redux-eggs/core": "2.2.0",
|
|
19
19
|
"@redux-eggs/redux-toolkit": "2.2.0",
|
|
20
20
|
"@redux-eggs/saga-extension": "2.2.0",
|
|
21
|
-
"@reduxjs/toolkit": "1.9.
|
|
21
|
+
"@reduxjs/toolkit": "1.9.7",
|
|
22
22
|
"@turf/turf": "6.5.0",
|
|
23
23
|
"date-fns": "2.30.0",
|
|
24
24
|
"immer": "9.0.21",
|