@opengeoweb/core 8.3.1 → 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
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
-
import React__default, { forwardRef, useContext, useCallback, useEffect, createElement, PureComponent,
|
|
2
|
+
import React__default, { useState, forwardRef, useContext, useCallback, useEffect, createElement, PureComponent, useRef, useLayoutEffect } from 'react';
|
|
3
3
|
import { Grid, Box as Box$2, MenuItem, Typography, useTheme as useTheme$2, Button, Popper, ListItemText, ListItemIcon, FormControl, InputLabel, Paper, List, ListItemButton, CircularProgress, ListSubheader, Dialog, DialogTitle, DialogContent, DialogContentText, TextField, InputAdornment, DialogActions, LinearProgress, Backdrop, ListItem, ListItemSecondaryAction, Checkbox, Switch, styled as styled$1, Slider, Menu, Card, IconButton, Select, CardContent, RadioGroup, FormControlLabel, Radio, ToggleButtonGroup, ToggleButton, Divider, Tooltip, ButtonGroup, Snackbar } from '@mui/material';
|
|
4
4
|
import { CustomIconButton, TooltipSelect, AlertIcon, useControlledTooltip, CustomTooltip, tooltipContainerStyles, sliderHeaderStyle, CustomSlider, ToggleMenu, AlertBanner, CustomAccordion, ToolContainerDraggable, calculateStartSize, CustomToggleButton, SearchHighlight, dateUtils, useMakeSureContainerStaysInsideWindow, withEggs } from '@opengeoweb/shared';
|
|
5
5
|
import { CollapseSmall, CollapseMedium, CollapseLarge, CollapseWindow, ExpandWindow, LayersAdd, Copy, None, FastForward, AutoUpdateActive, Both, Info, Visibility, VisibilityOff, Delete, DimensionsOther, DimensionsElevation, DimensionsRefTime, DimensionsTime, DragHandle as DragHandle$1, Cached, Add, MapAdd, Filter, Search, Clear, Edit, Close, Layers, Equalizer, Link, LinkOff, AutoUpdateInActive, Speed, Clock, Now, Animation, Options, Pause, Play, StepForward, StepBackward, dragHandlePath, ChevronDown, ChevronUp, List as List$1, ChevronRight, ChevronLeft, Resize, ExitDomain, ThemeWrapper, lightTheme } from '@opengeoweb/theme';
|
|
6
6
|
import { useDispatch, useSelector, connect, Provider } from 'react-redux';
|
|
7
7
|
import { uiTypes, uiSelectors, uiActions, layerTypes, layerUtils, layerActions, layerSelectors, serviceSelectors, serviceActions, mapSelectors, mapActions, mapEnums, mapConstants, layerSelectSelectors, layerSelectActions, filterLayers, getUserAddedServices, storeUtils, snackbarActions, layerSelectTypes, mapUtils, genericActions, syncConstants, defaultLayers, mapStoreActions, getSingularDrawtoolDrawLayerId, syncGroupsSelectors, syncGroupsSelector, snackbarModuleConfig, snackbarSelectors, coreModuleConfig, routerUtils, routerModuleConfig, appModuleConfig, appActions } from '@opengeoweb/store';
|
|
8
8
|
import { ReactSortable } from 'react-sortablejs';
|
|
9
|
-
import {
|
|
9
|
+
import { WMGetServiceFromStore, getCapabilities, webmapUtils, LayerType, clearImageCache, WMLayer } from '@opengeoweb/webmap';
|
|
10
10
|
import { jsx } from 'react/jsx-runtime';
|
|
11
11
|
import Box$3 from '@mui/material/Box';
|
|
12
12
|
import Typography$1 from '@mui/material/Typography';
|
|
@@ -3914,93 +3914,40 @@ Sortable.mount(new AutoScrollPlugin());
|
|
|
3914
3914
|
Sortable.mount(Remove, Revert);
|
|
3915
3915
|
|
|
3916
3916
|
var DimensionSelect = function DimensionSelect(_ref) {
|
|
3917
|
-
var
|
|
3918
|
-
onLayerChangeDimension = _ref.onLayerChangeDimension,
|
|
3917
|
+
var onLayerChangeDimension = _ref.onLayerChangeDimension,
|
|
3919
3918
|
_ref$layerDimensions = _ref.layerDimensions,
|
|
3920
3919
|
layerDimensions = _ref$layerDimensions === void 0 ? [] : _ref$layerDimensions,
|
|
3921
|
-
isEnabled = _ref.isEnabled,
|
|
3920
|
+
_ref$isEnabled = _ref.isEnabled,
|
|
3921
|
+
isEnabled = _ref$isEnabled === void 0 ? false : _ref$isEnabled,
|
|
3922
3922
|
icon = _ref.icon,
|
|
3923
3923
|
nameMappings = _ref.nameMappings,
|
|
3924
3924
|
valueMappings = _ref.valueMappings,
|
|
3925
3925
|
_ref$tooltipPrefix = _ref.tooltipPrefix,
|
|
3926
|
-
tooltipPrefix = _ref$tooltipPrefix === void 0 ? 'Dimensions: ' : _ref$tooltipPrefix
|
|
3927
|
-
|
|
3928
|
-
|
|
3929
|
-
|
|
3930
|
-
|
|
3931
|
-
|
|
3932
|
-
|
|
3933
|
-
|
|
3934
|
-
|
|
3935
|
-
if (!activeDim) {
|
|
3936
|
-
setActiveDimName(layerDimensions.length ? layerDimensions[0].name : '');
|
|
3937
|
-
}
|
|
3938
|
-
}, [layerDimensions, activeDimName]);
|
|
3939
|
-
React.useEffect(function () {
|
|
3940
|
-
var activeDim = layerDimensions.find(function (d) {
|
|
3941
|
-
return d.name === activeDimName;
|
|
3942
|
-
});
|
|
3943
|
-
if (activeDim) {
|
|
3944
|
-
onLayerChangeDimension(activeDim.name, activeDim.currentValue);
|
|
3945
|
-
}
|
|
3946
|
-
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
3947
|
-
}, []);
|
|
3948
|
-
if (!layerDimensions.length || !layerId) {
|
|
3949
|
-
return null;
|
|
3950
|
-
}
|
|
3951
|
-
var getValuesToDisplay = function getValuesToDisplay() {
|
|
3952
|
-
var activeWMJSDim = webmapUtils.getWMJSDimensionForLayerAndDimension(layerId, activeDimName) || webmapUtils.getWMJSDimensionForLayerAndDimension(layerId, layerDimensions[0].name);
|
|
3953
|
-
if (!activeWMJSDim) {
|
|
3954
|
-
return null;
|
|
3955
|
-
}
|
|
3956
|
-
var availableDimValues = [];
|
|
3957
|
-
for (var j = 0; j < activeWMJSDim.size(); j += 1) {
|
|
3958
|
-
availableDimValues.push(activeWMJSDim.getValueForIndex(j));
|
|
3959
|
-
}
|
|
3960
|
-
availableDimValues.reverse();
|
|
3961
|
-
// Only display last 100 values, to avoid performance issues
|
|
3962
|
-
// TODO: (2020-06-29 Tineke van Rijn) replace this with lazy loading
|
|
3963
|
-
return availableDimValues.slice(0, 100);
|
|
3964
|
-
};
|
|
3965
|
-
var valuesToDisplay = getValuesToDisplay();
|
|
3966
|
-
if (valuesToDisplay === null) {
|
|
3967
|
-
return null;
|
|
3968
|
-
}
|
|
3969
|
-
var activeDim = layerDimensions.find(function (dim) {
|
|
3970
|
-
return dim.name === activeDimName;
|
|
3971
|
-
});
|
|
3972
|
-
if (!activeDim) {
|
|
3973
|
-
return null;
|
|
3974
|
-
}
|
|
3975
|
-
var selectDimensionValue = function selectDimensionValue(event) {
|
|
3976
|
-
event.stopPropagation();
|
|
3977
|
-
if (activeDim) {
|
|
3978
|
-
onLayerChangeDimension(activeDim.name, event.target.value, layerTypes.LayerActionOrigin.layerManager);
|
|
3979
|
-
}
|
|
3980
|
-
};
|
|
3981
|
-
var onChangeActiveDimensionName = function onChangeActiveDimensionName(event) {
|
|
3982
|
-
event.stopPropagation();
|
|
3983
|
-
setActiveDimName(event.target.value);
|
|
3984
|
-
};
|
|
3985
|
-
var dimNameList = layerDimensions.map(function (dimension) {
|
|
3986
|
-
return {
|
|
3987
|
-
value: dimension.name
|
|
3988
|
-
};
|
|
3989
|
-
});
|
|
3990
|
-
var dimNameCurrentIndex = layerDimensions.findIndex(function (value) {
|
|
3991
|
-
return value.name === activeDim.name;
|
|
3992
|
-
});
|
|
3993
|
-
var dimValueList = valuesToDisplay.map(function (value) {
|
|
3994
|
-
return {
|
|
3995
|
-
value: value
|
|
3996
|
-
};
|
|
3926
|
+
tooltipPrefix = _ref$tooltipPrefix === void 0 ? 'Dimensions: ' : _ref$tooltipPrefix,
|
|
3927
|
+
SingleValueComponent = _ref.SingleValueComponent;
|
|
3928
|
+
var _a, _b;
|
|
3929
|
+
var _useState = useState((_a = layerDimensions === null || layerDimensions === void 0 ? void 0 : layerDimensions[0]) === null || _a === void 0 ? void 0 : _a.name),
|
|
3930
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
3931
|
+
selectedDimensionName = _useState2[0],
|
|
3932
|
+
setSelectedDimensionName = _useState2[1];
|
|
3933
|
+
var selectedDimension = layerDimensions.find(function (dimension) {
|
|
3934
|
+
return dimension.name === selectedDimensionName;
|
|
3997
3935
|
});
|
|
3998
|
-
var
|
|
3999
|
-
return
|
|
3936
|
+
var dimensionNames = layerDimensions.map(function (dimension) {
|
|
3937
|
+
return dimension.name;
|
|
4000
3938
|
});
|
|
4001
|
-
|
|
3939
|
+
var selectedDimensionDoesntExist = !dimensionNames.includes(selectedDimensionName);
|
|
3940
|
+
React.useEffect(function () {
|
|
3941
|
+
var _a, _b;
|
|
3942
|
+
if (selectedDimensionDoesntExist) {
|
|
3943
|
+
setSelectedDimensionName((_b = (_a = layerDimensions === null || layerDimensions === void 0 ? void 0 : layerDimensions[0]) === null || _a === void 0 ? void 0 : _a.name) !== null && _b !== void 0 ? _b : '');
|
|
3944
|
+
}
|
|
3945
|
+
}, [layerDimensions, selectedDimensionDoesntExist]);
|
|
3946
|
+
if (selectedDimensionDoesntExist) {
|
|
4002
3947
|
return null;
|
|
4003
3948
|
}
|
|
3949
|
+
var collapseDimensionDropdown = SingleValueComponent && layerDimensions.length === 1;
|
|
3950
|
+
var collapseValueDropdown = SingleValueComponent && ((_b = selectedDimension === null || selectedDimension === void 0 ? void 0 : selectedDimension.values) === null || _b === void 0 ? void 0 : _b.length) === 1;
|
|
4004
3951
|
return /*#__PURE__*/React.createElement(Grid, {
|
|
4005
3952
|
container: true,
|
|
4006
3953
|
direction: "row",
|
|
@@ -4009,21 +3956,63 @@ var DimensionSelect = function DimensionSelect(_ref) {
|
|
|
4009
3956
|
}, /*#__PURE__*/React.createElement(Grid, {
|
|
4010
3957
|
item: true,
|
|
4011
3958
|
xs: 12
|
|
4012
|
-
}, /*#__PURE__*/React.createElement(
|
|
3959
|
+
}, collapseDimensionDropdown ? /*#__PURE__*/React.createElement(SingleValueComponent, Object.assign({}, layerDimensions[0], {
|
|
3960
|
+
nameMappings: nameMappings,
|
|
3961
|
+
valueMappings: valueMappings,
|
|
3962
|
+
position: "dimension"
|
|
3963
|
+
})) : /*#__PURE__*/React.createElement(SelectDimension, {
|
|
3964
|
+
selectedDimensionName: selectedDimensionName,
|
|
3965
|
+
setSelectedDimensionName: setSelectedDimensionName,
|
|
3966
|
+
dimensionNames: dimensionNames,
|
|
3967
|
+
tooltipPrefix: tooltipPrefix,
|
|
3968
|
+
isEnabled: isEnabled,
|
|
3969
|
+
icon: icon,
|
|
3970
|
+
nameMappings: nameMappings
|
|
3971
|
+
}), collapseValueDropdown ? /*#__PURE__*/React.createElement(SingleValueComponent, Object.assign({}, layerDimensions[0], {
|
|
3972
|
+
nameMappings: nameMappings,
|
|
3973
|
+
valueMappings: valueMappings,
|
|
3974
|
+
position: "value"
|
|
3975
|
+
})) : /*#__PURE__*/React.createElement(SelectDimensionValue, {
|
|
3976
|
+
selectedDimension: selectedDimension,
|
|
3977
|
+
onLayerChangeDimension: onLayerChangeDimension,
|
|
3978
|
+
tooltipPrefix: tooltipPrefix,
|
|
3979
|
+
isEnabled: isEnabled,
|
|
3980
|
+
icon: icon,
|
|
3981
|
+
valueMappings: valueMappings
|
|
3982
|
+
})));
|
|
3983
|
+
};
|
|
3984
|
+
var SelectDimension = function SelectDimension(_ref2) {
|
|
3985
|
+
var selectedDimensionName = _ref2.selectedDimensionName,
|
|
3986
|
+
setSelectedDimensionName = _ref2.setSelectedDimensionName,
|
|
3987
|
+
icon = _ref2.icon,
|
|
3988
|
+
nameMappings = _ref2.nameMappings,
|
|
3989
|
+
tooltipPrefix = _ref2.tooltipPrefix,
|
|
3990
|
+
isEnabled = _ref2.isEnabled,
|
|
3991
|
+
dimensionNames = _ref2.dimensionNames;
|
|
3992
|
+
return /*#__PURE__*/React.createElement(TooltipSelect, {
|
|
4013
3993
|
disableUnderline: true,
|
|
4014
|
-
tooltip: "".concat(tooltipPrefix).concat(
|
|
3994
|
+
tooltip: "".concat(tooltipPrefix).concat(selectedDimensionName),
|
|
4015
3995
|
inputProps: {
|
|
4016
3996
|
SelectDisplayProps: {
|
|
4017
3997
|
'data-testid': 'selectDimension'
|
|
4018
3998
|
}
|
|
4019
3999
|
},
|
|
4020
4000
|
isEnabled: isEnabled,
|
|
4021
|
-
value:
|
|
4022
|
-
list:
|
|
4023
|
-
|
|
4024
|
-
|
|
4025
|
-
|
|
4026
|
-
|
|
4001
|
+
value: selectedDimensionName,
|
|
4002
|
+
list: dimensionNames.map(function (name) {
|
|
4003
|
+
return {
|
|
4004
|
+
value: name
|
|
4005
|
+
};
|
|
4006
|
+
}),
|
|
4007
|
+
currentIndex: dimensionNames.findIndex(function (name) {
|
|
4008
|
+
return name === selectedDimensionName;
|
|
4009
|
+
}),
|
|
4010
|
+
onChange: function onChange(event) {
|
|
4011
|
+
event.stopPropagation();
|
|
4012
|
+
setSelectedDimensionName(event.target.value);
|
|
4013
|
+
},
|
|
4014
|
+
onChangeMouseWheel: function onChangeMouseWheel(event) {
|
|
4015
|
+
setSelectedDimensionName(event.value);
|
|
4027
4016
|
},
|
|
4028
4017
|
style: {
|
|
4029
4018
|
maxWidth: '50%'
|
|
@@ -4031,14 +4020,31 @@ var DimensionSelect = function DimensionSelect(_ref) {
|
|
|
4031
4020
|
IconComponent: icon
|
|
4032
4021
|
}, /*#__PURE__*/React.createElement(MenuItem, {
|
|
4033
4022
|
disabled: true
|
|
4034
|
-
}, "Dimension"),
|
|
4023
|
+
}, "Dimension"), dimensionNames.map(function (name) {
|
|
4035
4024
|
return /*#__PURE__*/React.createElement(MenuItem, {
|
|
4036
|
-
key:
|
|
4037
|
-
value:
|
|
4038
|
-
}, nameMappings
|
|
4039
|
-
}))
|
|
4025
|
+
key: name,
|
|
4026
|
+
value: name
|
|
4027
|
+
}, (nameMappings === null || nameMappings === void 0 ? void 0 : nameMappings[name]) || name);
|
|
4028
|
+
}));
|
|
4029
|
+
};
|
|
4030
|
+
var SelectDimensionValue = function SelectDimensionValue(_ref3) {
|
|
4031
|
+
var isEnabled = _ref3.isEnabled,
|
|
4032
|
+
tooltipPrefix = _ref3.tooltipPrefix,
|
|
4033
|
+
selectedDimension = _ref3.selectedDimension,
|
|
4034
|
+
icon = _ref3.icon,
|
|
4035
|
+
onLayerChangeDimension = _ref3.onLayerChangeDimension,
|
|
4036
|
+
valueMappings = _ref3.valueMappings;
|
|
4037
|
+
var _a;
|
|
4038
|
+
var dimensionValues = (_a = selectedDimension === null || selectedDimension === void 0 ? void 0 : selectedDimension.values) === null || _a === void 0 ? void 0 : _a.split(',').slice(0, 100).reverse();
|
|
4039
|
+
if (!(selectedDimension === null || selectedDimension === void 0 ? void 0 : selectedDimension.name) || !(dimensionValues === null || dimensionValues === void 0 ? void 0 : dimensionValues.length)) {
|
|
4040
|
+
return null;
|
|
4041
|
+
}
|
|
4042
|
+
var setDimensionValue = function setDimensionValue(dimensionValue) {
|
|
4043
|
+
onLayerChangeDimension(selectedDimension.name, dimensionValue, layerTypes.LayerActionOrigin.layerManager);
|
|
4044
|
+
};
|
|
4045
|
+
return /*#__PURE__*/React.createElement(TooltipSelect, {
|
|
4040
4046
|
disableUnderline: true,
|
|
4041
|
-
tooltip: "".concat(tooltipPrefix).concat(
|
|
4047
|
+
tooltip: "".concat(tooltipPrefix).concat(selectedDimension.name, " ").concat(selectedDimension.currentValue, " ").concat(selectedDimension.units),
|
|
4042
4048
|
inputProps: {
|
|
4043
4049
|
SelectDisplayProps: {
|
|
4044
4050
|
'data-testid': 'selectDimensionValue'
|
|
@@ -4046,12 +4052,21 @@ var DimensionSelect = function DimensionSelect(_ref) {
|
|
|
4046
4052
|
'data-testid': 'selectDimensionValue-input'
|
|
4047
4053
|
},
|
|
4048
4054
|
isEnabled: isEnabled,
|
|
4049
|
-
value:
|
|
4050
|
-
list:
|
|
4051
|
-
|
|
4052
|
-
|
|
4053
|
-
|
|
4054
|
-
|
|
4055
|
+
value: selectedDimension.currentValue,
|
|
4056
|
+
list: dimensionValues.map(function (dimensionValue) {
|
|
4057
|
+
return {
|
|
4058
|
+
value: dimensionValue
|
|
4059
|
+
};
|
|
4060
|
+
}),
|
|
4061
|
+
currentIndex: dimensionValues.findIndex(function (dimensionValue) {
|
|
4062
|
+
return dimensionValue === selectedDimension.currentValue;
|
|
4063
|
+
}),
|
|
4064
|
+
onChange: function onChange(event) {
|
|
4065
|
+
event.stopPropagation();
|
|
4066
|
+
setDimensionValue(event.target.value);
|
|
4067
|
+
},
|
|
4068
|
+
onChangeMouseWheel: function onChangeMouseWheel(event) {
|
|
4069
|
+
setDimensionValue(event.value);
|
|
4055
4070
|
},
|
|
4056
4071
|
style: {
|
|
4057
4072
|
maxWidth: '50%'
|
|
@@ -4059,12 +4074,13 @@ var DimensionSelect = function DimensionSelect(_ref) {
|
|
|
4059
4074
|
IconComponent: icon
|
|
4060
4075
|
}, /*#__PURE__*/React.createElement(MenuItem, {
|
|
4061
4076
|
disabled: true
|
|
4062
|
-
}, "Dimension value (",
|
|
4077
|
+
}, "Dimension value (", dimensionValues.length, " options)"), dimensionValues.map(function (dimensionValue) {
|
|
4078
|
+
var _a;
|
|
4063
4079
|
return /*#__PURE__*/React.createElement(MenuItem, {
|
|
4064
|
-
key:
|
|
4065
|
-
value:
|
|
4066
|
-
}, valueMappings
|
|
4067
|
-
}))
|
|
4080
|
+
key: dimensionValue,
|
|
4081
|
+
value: dimensionValue
|
|
4082
|
+
}, ((_a = valueMappings === null || valueMappings === void 0 ? void 0 : valueMappings[selectedDimension.name]) === null || _a === void 0 ? void 0 : _a.call(valueMappings, dimensionValue)) || /*#__PURE__*/React.createElement(React.Fragment, null, "".concat(dimensionValue), "\xA0", /*#__PURE__*/React.createElement("i", null, "".concat(selectedDimension.units))));
|
|
4083
|
+
}));
|
|
4068
4084
|
};
|
|
4069
4085
|
|
|
4070
4086
|
var getRenderLayersValues = function getRenderLayersValues(layerName, layers) {
|
|
@@ -4402,7 +4418,11 @@ var RenderStyles = function RenderStyles(_ref) {
|
|
|
4402
4418
|
if (layerStyles && layerStyles.length > 0) {
|
|
4403
4419
|
styles.push.apply(styles, _toConsumableArray(layerStyles));
|
|
4404
4420
|
}
|
|
4405
|
-
var
|
|
4421
|
+
var layerStyleNames = layerStyles.map(function (style) {
|
|
4422
|
+
return style.name;
|
|
4423
|
+
});
|
|
4424
|
+
var layerStyleExists = layerStyleNames.includes(currentLayerStyle);
|
|
4425
|
+
var currentStyle = layerStyleExists ? currentLayerStyle : styles[0].name;
|
|
4406
4426
|
var selectStyle = function selectStyle(event) {
|
|
4407
4427
|
event.stopPropagation();
|
|
4408
4428
|
onChangeLayerStyle(event.target.value);
|
|
@@ -5026,7 +5046,6 @@ var LayerRow = function LayerRow(_ref7) {
|
|
|
5026
5046
|
item: true,
|
|
5027
5047
|
className: columnClasses.column5
|
|
5028
5048
|
}, layerDimensionLayout || /*#__PURE__*/React__default.createElement(DimensionSelect, {
|
|
5029
|
-
layerId: layerId,
|
|
5030
5049
|
layerDimensions: layerUtils.filterNonTimeDimensions(layer.dimensions),
|
|
5031
5050
|
onLayerChangeDimension: function onLayerChangeDimension(dimensionName, dimensionValue) {
|
|
5032
5051
|
var dimension = {
|
|
@@ -5346,8 +5365,10 @@ var DimensionSelectConnect = function DimensionSelectConnect(_ref2) {
|
|
|
5346
5365
|
layerDimensions = _useLayerDimensions.layerDimensions,
|
|
5347
5366
|
isLayerEnabled = _useLayerDimensions.isLayerEnabled,
|
|
5348
5367
|
layerChangeDimension = _useLayerDimensions.layerChangeDimension;
|
|
5368
|
+
if (!layerDimensions.length || !layerId) {
|
|
5369
|
+
return null;
|
|
5370
|
+
}
|
|
5349
5371
|
return /*#__PURE__*/React.createElement(DimensionSelect, {
|
|
5350
|
-
layerId: layerId,
|
|
5351
5372
|
layerDimensions: layerDimensions,
|
|
5352
5373
|
onLayerChangeDimension: function onLayerChangeDimension(dimensionName, dimensionValue, origin) {
|
|
5353
5374
|
var dimension = {
|
|
@@ -10592,25 +10613,14 @@ var CustomDimensionSelectConnect = function CustomDimensionSelectConnect(_a) {
|
|
|
10592
10613
|
layerDimensions = _useLayerDimensions.layerDimensions,
|
|
10593
10614
|
isLayerEnabled = _useLayerDimensions.isLayerEnabled,
|
|
10594
10615
|
layerChangeDimension = _useLayerDimensions.layerChangeDimension;
|
|
10595
|
-
var filteredDimensions = dimensionsToShow ?
|
|
10596
|
-
|
|
10597
|
-
|
|
10598
|
-
}) : layerDimensions;
|
|
10599
|
-
if (dimensionsToShow) {
|
|
10600
|
-
// also sort according to the filter array
|
|
10601
|
-
filteredDimensions.sort(function (a, b) {
|
|
10602
|
-
return dimensionsToShow.indexOf(a.name) - dimensionsToShow.indexOf(b.name);
|
|
10616
|
+
var filteredDimensions = dimensionsToShow ? dimensionsToShow.map(function (dimensionName) {
|
|
10617
|
+
return layerDimensions.find(function (dimension) {
|
|
10618
|
+
return dimension.name === dimensionName;
|
|
10603
10619
|
});
|
|
10604
|
-
}
|
|
10605
|
-
var singleValue = filteredDimensions.length === 1 && SingleValueComponent;
|
|
10606
|
-
if (singleValue) {
|
|
10607
|
-
return /*#__PURE__*/React.createElement(SingleValueComponent, Object.assign({
|
|
10608
|
-
value: filteredDimensions[0].currentValue
|
|
10609
|
-
}, props));
|
|
10610
|
-
}
|
|
10620
|
+
}).filter(Boolean) : layerDimensions;
|
|
10611
10621
|
return /*#__PURE__*/React.createElement(DimensionSelect, Object.assign({
|
|
10612
|
-
layerId: layerId,
|
|
10613
10622
|
layerDimensions: filteredDimensions,
|
|
10623
|
+
SingleValueComponent: SingleValueComponent,
|
|
10614
10624
|
onLayerChangeDimension: function onLayerChangeDimension(dimensionName, dimensionValue, origin) {
|
|
10615
10625
|
var dimension = {
|
|
10616
10626
|
name: dimensionName,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@opengeoweb/core",
|
|
3
|
-
"version": "8.
|
|
3
|
+
"version": "8.4.0",
|
|
4
4
|
"description": "GeoWeb Core library for the opengeoweb project",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"repository": {
|
|
@@ -14,13 +14,13 @@
|
|
|
14
14
|
"peerDependencies": {
|
|
15
15
|
"@mui/material": "5.12.0",
|
|
16
16
|
"@mui/system": "5.14.14",
|
|
17
|
-
"@opengeoweb/api": "8.
|
|
18
|
-
"@opengeoweb/form-fields": "8.
|
|
19
|
-
"@opengeoweb/shared": "8.
|
|
20
|
-
"@opengeoweb/store": "8.
|
|
21
|
-
"@opengeoweb/theme": "8.
|
|
22
|
-
"@opengeoweb/webmap": "8.
|
|
23
|
-
"@opengeoweb/webmap-react": "8.
|
|
17
|
+
"@opengeoweb/api": "8.4.0",
|
|
18
|
+
"@opengeoweb/form-fields": "8.4.0",
|
|
19
|
+
"@opengeoweb/shared": "8.4.0",
|
|
20
|
+
"@opengeoweb/store": "8.4.0",
|
|
21
|
+
"@opengeoweb/theme": "8.4.0",
|
|
22
|
+
"@opengeoweb/webmap": "8.4.0",
|
|
23
|
+
"@opengeoweb/webmap-react": "8.4.0",
|
|
24
24
|
"@redux-eggs/redux-toolkit": "2.2.0",
|
|
25
25
|
"@redux-eggs/saga-extension": "2.2.0",
|
|
26
26
|
"@reduxjs/toolkit": "1.9.7",
|
|
@@ -1,11 +1,20 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import { mapTypes, layerTypes } from '@opengeoweb/store';
|
|
3
|
-
|
|
4
|
-
|
|
3
|
+
import { ElementType, FC } from 'react';
|
|
4
|
+
export interface SingleValueComponentProps extends mapTypes.Dimension {
|
|
5
|
+
position: 'dimension' | 'value';
|
|
6
|
+
nameMappings?: {
|
|
7
|
+
[dimensionName: string]: string;
|
|
8
|
+
};
|
|
9
|
+
valueMappings?: {
|
|
10
|
+
[dimensionName: string]: (value: string) => string;
|
|
11
|
+
};
|
|
12
|
+
}
|
|
13
|
+
export interface DimensionSelectProps {
|
|
5
14
|
layerDimensions?: mapTypes.Dimension[];
|
|
6
15
|
onLayerChangeDimension: (dimensionName: string, dimensionValue: string, origin?: layerTypes.LayerActionOrigin.layerManager) => void;
|
|
7
16
|
isEnabled?: boolean;
|
|
8
|
-
icon?:
|
|
17
|
+
icon?: ElementType;
|
|
9
18
|
nameMappings?: {
|
|
10
19
|
[dimensionName: string]: string;
|
|
11
20
|
};
|
|
@@ -13,6 +22,7 @@ interface DimensionSelectProps {
|
|
|
13
22
|
[dimensionName: string]: (value: string) => string;
|
|
14
23
|
};
|
|
15
24
|
tooltipPrefix?: string;
|
|
25
|
+
SingleValueComponent?: React.FC<SingleValueComponentProps>;
|
|
16
26
|
}
|
|
17
|
-
declare const DimensionSelect:
|
|
27
|
+
declare const DimensionSelect: FC<DimensionSelectProps>;
|
|
18
28
|
export default DimensionSelect;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
import { mapTypes } from '@opengeoweb/store';
|
|
3
|
+
import { SingleValueComponentProps } from './LayerContainerRow/LayerRow/DimensionSelect/DimensionSelect';
|
|
3
4
|
import { Size, ToolbarButtonSettings } from './LayerManagerHeaderOptions';
|
|
4
5
|
export declare const columnClasses: {
|
|
5
6
|
column1: string;
|
|
@@ -223,9 +224,7 @@ export interface LayerManagerCustomSettings {
|
|
|
223
224
|
};
|
|
224
225
|
dimensions?: {
|
|
225
226
|
dimensionsToShow?: string[];
|
|
226
|
-
SingleValueComponent?: React.FC<
|
|
227
|
-
value: string;
|
|
228
|
-
}>;
|
|
227
|
+
SingleValueComponent?: React.FC<SingleValueComponentProps>;
|
|
229
228
|
icon?: React.ElementType;
|
|
230
229
|
tooltipPrefix?: string;
|
|
231
230
|
nameMappings?: {
|