@mapcomponents/react-maplibre 1.0.8 → 1.0.9
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/CHANGELOG.md +11 -0
- package/dist/index.cjs.js +687 -51
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.esm.js +681 -50
- package/dist/index.esm.js.map +1 -1
- package/dist/src/components/MlOgcApiFeatures/MlOgcApiFeatures.d.ts +45 -0
- package/dist/{components → src/components}/MlVectorTileLayer/MlVectorTileLayer.d.ts +4 -1
- package/dist/src/decorators/MapContextReduxStoreDecorator.d.ts +7 -0
- package/dist/{index.d.ts → src/index.d.ts} +38 -0
- package/dist/src/stores/map.store.d.ts +105 -0
- package/dist/{ui_components → src/ui_components}/ColorPicker/ColorPicker.d.ts +0 -2
- package/dist/{ui_components → src/ui_components}/LayerList/util/LayerListItemVectorLayer.d.ts +2 -4
- package/dist/src/ui_components/LayerTree/LayerOnMap.d.ts +7 -0
- package/dist/src/ui_components/LayerTree/LayerTree.d.ts +6 -0
- package/dist/src/ui_components/LayerTree/LayerTreeListItem.d.ts +18 -0
- package/dist/src/ui_components/LayerTree/util/LayerPropertyForm.d.ts +9 -0
- package/dist/src/ui_components/LayerTree/util/input/ColorPicker.d.ts +7 -0
- package/package.json +10 -6
- /package/dist/{components → src/components}/MapLibreMap/MapLibreMap.d.ts +0 -0
- /package/dist/{components → src/components}/MapLibreMap/lib/MapLibreGlWrapper.d.ts +0 -0
- /package/dist/{components → src/components}/MlCenterPosition/MlCenterPosition.d.ts +0 -0
- /package/dist/{components → src/components}/MlClientSearch/MlClientSearch.d.ts +0 -0
- /package/dist/{components → src/components}/MlClientSearch/lib/SearchContext.d.ts +0 -0
- /package/dist/{components → src/components}/MlClientSearch/lib/SearchForm.d.ts +0 -0
- /package/dist/{components → src/components}/MlClientSearch/lib/createGeojsonFeature.d.ts +0 -0
- /package/dist/{components → src/components}/MlComponentTemplate/MlComponentTemplate.d.ts +0 -0
- /package/dist/{components → src/components}/MlCreatePdfButton/MlCreatePdfButton.d.ts +0 -0
- /package/dist/{components → src/components}/MlCreatePdfForm/MlCreatePdfForm.d.ts +0 -0
- /package/dist/{components → src/components}/MlCreatePdfForm/lib/PdfContext.d.ts +0 -0
- /package/dist/{components → src/components}/MlCreatePdfForm/lib/PdfForm.d.ts +0 -0
- /package/dist/{components → src/components}/MlCreatePdfForm/lib/PdfPreview.d.ts +0 -0
- /package/dist/{components → src/components}/MlCreatePdfForm/lib/pdf.templates.d.ts +0 -0
- /package/dist/{components → src/components}/MlCreatePngButton/MlCreatePngButton.d.ts +0 -0
- /package/dist/{components → src/components}/MlFeatureEditor/MlFeatureEditor.d.ts +0 -0
- /package/dist/{components → src/components}/MlFillExtrusionLayer/MlFillExtrusionLayer.d.ts +0 -0
- /package/dist/{components → src/components}/MlFollowGps/MlFollowGps.d.ts +0 -0
- /package/dist/{components → src/components}/MlGeoJsonLayer/MlGeoJsonLayer.d.ts +0 -0
- /package/dist/{components → src/components}/MlGeoJsonLayer/story_utils/MlGeoJsonLayer.lineStyler.d.ts +0 -0
- /package/dist/{components → src/components}/MlGeoJsonLayer/story_utils/MlGeoJsonLayer.polygonStyler.d.ts +0 -0
- /package/dist/{components → src/components}/MlGeoJsonLayer/util/getDefaultLayerTypeByGeometry.d.ts +0 -0
- /package/dist/{components → src/components}/MlGeoJsonLayer/util/getDefaultPaintPropsByType.d.ts +0 -0
- /package/dist/{components → src/components}/MlGeojsonLayerWithSource/MlGeojsonLayerWithSource.d.ts +0 -0
- /package/dist/{components → src/components}/MlGpxViewer/MlGpxViewer.d.ts +0 -0
- /package/dist/{components → src/components}/MlGpxViewer/util/GeoJsonContext.d.ts +0 -0
- /package/dist/{components → src/components}/MlGpxViewer/util/GeoJsonProvider.d.ts +0 -0
- /package/dist/{components → src/components}/MlGpxViewer/util/Metadata.d.ts +0 -0
- /package/dist/{components → src/components}/MlGpxViewer/util/MlGpxDemoLoader.d.ts +0 -0
- /package/dist/{components → src/components}/MlGpxViewer/util/MlGpxViewerInstructions.d.ts +0 -0
- /package/dist/{components → src/components}/MlImageMarkerLayer/MlImageMarkerLayer.d.ts +0 -0
- /package/dist/{components → src/components}/MlLayer/MlLayer.d.ts +0 -0
- /package/dist/{components → src/components}/MlLayerMagnify/MlLayerMagnify.d.ts +0 -0
- /package/dist/{components → src/components}/MlLayerSwipe/MlLayerSwipe.d.ts +0 -0
- /package/dist/{components → src/components}/MlLayerSwitcher/MlLayerSwitcher.d.ts +0 -0
- /package/dist/{components → src/components}/MlLayerSwitcher/components/LayerBox.d.ts +0 -0
- /package/dist/{components → src/components}/MlMarker/MlMarker.d.ts +0 -0
- /package/dist/{components → src/components}/MlMeasureTool/MlMeasureTool.d.ts +0 -0
- /package/dist/{components → src/components}/MlMultiMeasureTool/MlMultiMeasureTool.d.ts +0 -0
- /package/dist/{components → src/components}/MlNavigationCompass/MlNavigationCompass.d.ts +0 -0
- /package/dist/{components → src/components}/MlNavigationTools/MlNavigationTools.d.ts +0 -0
- /package/dist/{components → src/components}/MlOrderLayers/MlOrderLayers.d.ts +0 -0
- /package/dist/{components → src/components}/MlScaleReference/MlScaleReference.d.ts +0 -0
- /package/dist/{components → src/components}/MlShareMapState/MlShareMapState.d.ts +0 -0
- /package/dist/{components → src/components}/MlSketchTool/MlSketchTool.d.ts +0 -0
- /package/dist/{components → src/components}/MlSpatialElevationProfile/MlSpatialElevationProfile.d.ts +0 -0
- /package/dist/{components → src/components}/MlSpatialElevationProfile/util/getElevationData.d.ts +0 -0
- /package/dist/{components → src/components}/MlTemporalController/MlTemporalController.d.ts +0 -0
- /package/dist/{components → src/components}/MlTemporalController/utils/MlTemporalControllerLabels.d.ts +0 -0
- /package/dist/{components → src/components}/MlTemporalController/utils/TemporalControllerPlayer.d.ts +0 -0
- /package/dist/{components → src/components}/MlTemporalController/utils/paintPicker.d.ts +0 -0
- /package/dist/{components → src/components}/MlTemporalController/utils/useFilterData.d.ts +0 -0
- /package/dist/{components → src/components}/MlTerrainLayer/MlTerrainLayer.d.ts +0 -0
- /package/dist/{components → src/components}/MlThreeJsLayer/MlThreeJsLayer.d.ts +0 -0
- /package/dist/{components → src/components}/MlTransitionGeoJsonLayer/MlTransitionGeoJsonLayer.d.ts +0 -0
- /package/dist/{components → src/components}/MlUseMapDebugger/MlUseMapDebugger.d.ts +0 -0
- /package/dist/{components → src/components}/MlWmsFeatureInfoPopup/MlWmsFeatureInfoPopup.d.ts +0 -0
- /package/dist/{components → src/components}/MlWmsLayer/MlWmsLayer.d.ts +0 -0
- /package/dist/{components → src/components}/MlWmsLoader/MlWmsLoader.d.ts +0 -0
- /package/dist/{components → src/components}/MlWmsLoader/utils/MlWmsLoaderInstructions.d.ts +0 -0
- /package/dist/{components → src/components}/MlWmsLoader/utils/WMSLinks.d.ts +0 -0
- /package/dist/{contexts → src/contexts}/LayerContext.d.ts +0 -0
- /package/dist/{contexts → src/contexts}/MapContext.d.ts +0 -0
- /package/dist/{contexts → src/contexts}/SimpleDataContext.d.ts +0 -0
- /package/dist/{contexts → src/contexts}/SimpleDataProvider.d.ts +0 -0
- /package/dist/{decorators → src/decorators}/EmptyMapDecorator.d.ts +0 -0
- /package/dist/{decorators → src/decorators}/GeoJsonMapDecorator.d.ts +0 -0
- /package/dist/{decorators → src/decorators}/LowZoomDecorator.d.ts +0 -0
- /package/dist/{decorators → src/decorators}/MapContextDecorator.d.ts +0 -0
- /package/dist/{decorators → src/decorators}/MapContextDecoratorHooks.d.ts +0 -0
- /package/dist/{decorators → src/decorators}/MultiMapContextDecorator.d.ts +0 -0
- /package/dist/{decorators → src/decorators}/NoNavToolsDecorator.d.ts +0 -0
- /package/dist/{decorators → src/decorators}/ThemeDecorator.d.ts +0 -0
- /package/dist/{hooks → src/hooks}/useAddImage/useAddImage.d.ts +0 -0
- /package/dist/{hooks → src/hooks}/useAddProtocol/useAddProtocol.d.ts +0 -0
- /package/dist/{hooks → src/hooks}/useCameraFollowPath/useCameraFollowPath.d.ts +0 -0
- /package/dist/{hooks → src/hooks}/useExportMap/index.d.ts +0 -0
- /package/dist/{hooks → src/hooks}/useExportMap/lib.d.ts +0 -0
- /package/dist/{hooks → src/hooks}/useFeatureEditor/useFeatureEditor.d.ts +0 -0
- /package/dist/{hooks → src/hooks}/useFeatureEditor/utils/FeatureEditorStyle.d.ts +0 -0
- /package/dist/{hooks → src/hooks}/useFitLayerBounds.d.ts +0 -0
- /package/dist/{hooks → src/hooks}/useGpx/useGpx.d.ts +0 -0
- /package/dist/{hooks → src/hooks}/useLayer.d.ts +0 -0
- /package/dist/{hooks → src/hooks}/useLayerContext.d.ts +0 -0
- /package/dist/{hooks → src/hooks}/useLayerFilter/useLayerFilter.d.ts +0 -0
- /package/dist/{hooks → src/hooks}/useLayerHoverPopup/LayerHoverPopup.d.ts +0 -0
- /package/dist/{hooks → src/hooks}/useMap.d.ts +0 -0
- /package/dist/{hooks → src/hooks}/useMapState.d.ts +0 -0
- /package/dist/{hooks → src/hooks}/useSource.d.ts +0 -0
- /package/dist/{hooks → src/hooks}/useWms.d.ts +0 -0
- /package/dist/{omt_styles → src/omt_styles}/bright.d.ts +0 -0
- /package/dist/{omt_styles → src/omt_styles}/config.d.ts +0 -0
- /package/dist/{omt_styles → src/omt_styles}/gruvbox.d.ts +0 -0
- /package/dist/{omt_styles → src/omt_styles}/medieval_kingdom.d.ts +0 -0
- /package/dist/{omt_styles → src/omt_styles}/monokai.d.ts +0 -0
- /package/dist/{omt_styles → src/omt_styles}/oceanic_next.d.ts +0 -0
- /package/dist/{omt_styles → src/omt_styles}/solarized.d.ts +0 -0
- /package/dist/{protocol_handlers → src/protocol_handlers}/csv.d.ts +0 -0
- /package/dist/{protocol_handlers → src/protocol_handlers}/mbtiles.d.ts +0 -0
- /package/dist/{protocol_handlers → src/protocol_handlers}/osm.d.ts +0 -0
- /package/dist/{protocol_handlers → src/protocol_handlers}/topojson.d.ts +0 -0
- /package/dist/{protocol_handlers → src/protocol_handlers}/utils/getProtocolData.d.ts +0 -0
- /package/dist/{protocol_handlers → src/protocol_handlers}/utils/protocolPathParser.d.ts +0 -0
- /package/dist/{protocol_handlers → src/protocol_handlers}/xml.d.ts +0 -0
- /package/dist/{ui_components → src/ui_components}/AddLayerButton/AddLayerButton.d.ts +0 -0
- /package/dist/{ui_components → src/ui_components}/AddLayerButton/AddLayerPopup.d.ts +0 -0
- /package/dist/{ui_components → src/ui_components}/AddLayerButton/LayerConfigForms/GeoJsonLayerForm.d.ts +0 -0
- /package/dist/{ui_components → src/ui_components}/AddLayerButton/LayerConfigForms/LayerTypeForm.d.ts +0 -0
- /package/dist/{ui_components → src/ui_components}/AddLayerButton/LayerConfigForms/MbtilesLayerForm.d.ts +0 -0
- /package/dist/{ui_components → src/ui_components}/AddLayerButton/LayerConfigForms/ProtocolHandlerLayerForm.d.ts +0 -0
- /package/dist/{ui_components → src/ui_components}/AddLayerButton/LayerConfigForms/WmsLayerForm.d.ts +0 -0
- /package/dist/{ui_components → src/ui_components}/AddLayerButton/LayerConfigForms/utils/CSVOptionsFomular.d.ts +0 -0
- /package/dist/{ui_components → src/ui_components}/AddLayerButton/LayerConfigForms/utils/MbtilesLayerPropFormular.d.ts +0 -0
- /package/dist/{ui_components → src/ui_components}/AddLayerButton/LayerConfigForms/utils/OsmOptionsFomular.d.ts +0 -0
- /package/dist/{ui_components → src/ui_components}/ColorPicker/transformers.d.ts +0 -0
- /package/dist/{ui_components → src/ui_components}/ConfirmDialog.d.ts +0 -0
- /package/dist/{ui_components → src/ui_components}/DemoDescriptions.d.ts +0 -0
- /package/dist/{ui_components → src/ui_components}/Dropzone.d.ts +0 -0
- /package/dist/{ui_components → src/ui_components}/ImageLoader.d.ts +0 -0
- /package/dist/{ui_components → src/ui_components}/LayerList/LayerList.d.ts +0 -0
- /package/dist/{ui_components → src/ui_components}/LayerList/LayerListFolder.d.ts +0 -0
- /package/dist/{ui_components → src/ui_components}/LayerList/LayerListItem.d.ts +0 -0
- /package/dist/{ui_components → src/ui_components}/LayerList/LayerListItemFactory.d.ts +0 -0
- /package/dist/{ui_components → src/ui_components}/LayerList/util/LayerPropertyForm.d.ts +0 -0
- /package/dist/{ui_components → src/ui_components}/LayerList/util/SortableContainer.d.ts +0 -0
- /package/dist/{ui_components → src/ui_components}/LayerList/util/input/ColorPicker.d.ts +0 -0
- /package/dist/{ui_components → src/ui_components}/LoadingOverlayContext.d.ts +0 -0
- /package/dist/{ui_components → src/ui_components}/MapcomponentsTheme.d.ts +0 -0
- /package/dist/{ui_components → src/ui_components}/SelectStyleButton/SelectStyleButton.d.ts +0 -0
- /package/dist/{ui_components → src/ui_components}/SelectStyleButton/SelectStylePopup.d.ts +0 -0
- /package/dist/{ui_components → src/ui_components}/Sidebar.d.ts +0 -0
- /package/dist/{ui_components → src/ui_components}/SpeedDial/SpeedDial.d.ts +0 -0
- /package/dist/{ui_components → src/ui_components}/TopToolbar.d.ts +0 -0
- /package/dist/{ui_components → src/ui_components}/UploadButton.d.ts +0 -0
- /package/dist/{util → src/util}/BubbleForInstructions.d.ts +0 -0
- /package/dist/{util → src/util}/Instructions.d.ts +0 -0
package/dist/index.esm.js
CHANGED
|
@@ -84,6 +84,8 @@ import SpeedDialAction from '@mui/material/SpeedDialAction';
|
|
|
84
84
|
import LayersIcon from '@mui/icons-material/Layers';
|
|
85
85
|
import DesignServicesIcon from '@mui/icons-material/DesignServices';
|
|
86
86
|
import PictureAsPdfIcon from '@mui/icons-material/PictureAsPdf';
|
|
87
|
+
import { useSelector, useDispatch } from 'react-redux';
|
|
88
|
+
import { createSlice, configureStore } from '@reduxjs/toolkit';
|
|
87
89
|
|
|
88
90
|
/******************************************************************************
|
|
89
91
|
Copyright (c) Microsoft Corporation.
|
|
@@ -3044,23 +3046,23 @@ MlMeasureTool.defaultProps = {
|
|
|
3044
3046
|
unit: 'kilometers',
|
|
3045
3047
|
};
|
|
3046
3048
|
|
|
3047
|
-
var ListStyled$
|
|
3049
|
+
var ListStyled$3 = styled(List)({
|
|
3048
3050
|
marginTop: '15px',
|
|
3049
3051
|
});
|
|
3050
3052
|
function LayerList(props) {
|
|
3051
|
-
return React__default.createElement(ListStyled$
|
|
3053
|
+
return React__default.createElement(ListStyled$3, null, props === null || props === void 0 ? void 0 : props.children);
|
|
3052
3054
|
}
|
|
3053
3055
|
|
|
3054
|
-
var ListItemStyled$
|
|
3056
|
+
var ListItemStyled$2 = styled$1(ListItem)({
|
|
3055
3057
|
paddingRight: 0,
|
|
3056
3058
|
paddingLeft: 0,
|
|
3057
3059
|
paddingTop: 0,
|
|
3058
3060
|
paddingBottom: '4px',
|
|
3059
3061
|
});
|
|
3060
|
-
var ListItemIconStyled = styled$1(ListItemIcon)({
|
|
3062
|
+
var ListItemIconStyled$1 = styled$1(ListItemIcon)({
|
|
3061
3063
|
minWidth: '30px',
|
|
3062
3064
|
});
|
|
3063
|
-
var IconButtonStyled$
|
|
3065
|
+
var IconButtonStyled$2 = styled$1(IconButton)({
|
|
3064
3066
|
marginRight: '0px',
|
|
3065
3067
|
padding: '0px',
|
|
3066
3068
|
});
|
|
@@ -3068,13 +3070,13 @@ var CheckboxStyled$1 = styled$1(Checkbox)({
|
|
|
3068
3070
|
padding: 0,
|
|
3069
3071
|
marginRight: '5px',
|
|
3070
3072
|
});
|
|
3071
|
-
var BoxStyled$
|
|
3073
|
+
var BoxStyled$4 = styled$1(Box)(function (_a) {
|
|
3072
3074
|
var open = _a.open;
|
|
3073
3075
|
return ({
|
|
3074
3076
|
display: open ? 'block' : 'none',
|
|
3075
3077
|
});
|
|
3076
3078
|
});
|
|
3077
|
-
var ListStyled = styled$1(List)({
|
|
3079
|
+
var ListStyled$2 = styled$1(List)({
|
|
3078
3080
|
marginLeft: '50px',
|
|
3079
3081
|
});
|
|
3080
3082
|
function LayerListFolder(_a) {
|
|
@@ -3103,9 +3105,9 @@ function LayerListFolder(_a) {
|
|
|
3103
3105
|
return React__default.createElement(React__default.Fragment, null);
|
|
3104
3106
|
}, [_visible]);
|
|
3105
3107
|
return (React__default.createElement(React__default.Fragment, null,
|
|
3106
|
-
React__default.createElement(ListItemStyled$
|
|
3107
|
-
React__default.createElement(ListItemIconStyled, null,
|
|
3108
|
-
React__default.createElement(IconButtonStyled$
|
|
3108
|
+
React__default.createElement(ListItemStyled$2, null,
|
|
3109
|
+
React__default.createElement(ListItemIconStyled$1, null,
|
|
3110
|
+
React__default.createElement(IconButtonStyled$2, { edge: "end", "aria-label": "open", onClick: function () { return setOpen(!open); } }, open ? React__default.createElement(ExpandMore, null) : React__default.createElement(KeyboardArrowRight, null)),
|
|
3109
3111
|
React__default.createElement(CheckboxStyled$1, { disabled: setVisible ? false : !visible, checked: setVisible ? visible : localVisible, onClick: function () {
|
|
3110
3112
|
if (setVisible) {
|
|
3111
3113
|
setVisible(function (val) { return !val; });
|
|
@@ -3115,8 +3117,8 @@ function LayerListFolder(_a) {
|
|
|
3115
3117
|
}
|
|
3116
3118
|
} })),
|
|
3117
3119
|
React__default.createElement(ListItemText, { primary: name, variant: "layerlist" })),
|
|
3118
|
-
React__default.createElement(BoxStyled$
|
|
3119
|
-
React__default.createElement(ListStyled, { disablePadding: true }, _children))));
|
|
3120
|
+
React__default.createElement(BoxStyled$4, { open: open },
|
|
3121
|
+
React__default.createElement(ListStyled$2, { disablePadding: true }, _children))));
|
|
3120
3122
|
}
|
|
3121
3123
|
|
|
3122
3124
|
var converters = {
|
|
@@ -3130,7 +3132,7 @@ var converters = {
|
|
|
3130
3132
|
var ColorPicker = function (_a) {
|
|
3131
3133
|
var convert = _a.convert, props = __rest(_a, ["convert"]);
|
|
3132
3134
|
var _b = useState(false), showPicker = _b[0], setShowPicker = _b[1];
|
|
3133
|
-
var
|
|
3135
|
+
var value = (props === null || props === void 0 ? void 0 : props.value) || '';
|
|
3134
3136
|
return (React__default.createElement(React__default.Fragment, null,
|
|
3135
3137
|
React__default.createElement(Grid, { container: true, sx: { flexWrap: 'nowrap' } },
|
|
3136
3138
|
React__default.createElement(Grid, { xs: 12, item: true },
|
|
@@ -3157,7 +3159,6 @@ var ColorPicker = function (_a) {
|
|
|
3157
3159
|
React__default.createElement(ChromePicker, { color: value, onChange: function (c) {
|
|
3158
3160
|
var _a;
|
|
3159
3161
|
var newValue = converters[convert](c);
|
|
3160
|
-
setValue(newValue);
|
|
3161
3162
|
(_a = props === null || props === void 0 ? void 0 : props.onChange) === null || _a === void 0 ? void 0 : _a.call(props, newValue);
|
|
3162
3163
|
} }))))));
|
|
3163
3164
|
};
|
|
@@ -3167,7 +3168,7 @@ ColorPicker.defaultProps = {
|
|
|
3167
3168
|
name: 'color',
|
|
3168
3169
|
};
|
|
3169
3170
|
|
|
3170
|
-
function PaintPropsColorPicker(_a) {
|
|
3171
|
+
function PaintPropsColorPicker$1(_a) {
|
|
3171
3172
|
var propKey = _a.propKey, value = _a.value, setPaintProps = _a.setPaintProps;
|
|
3172
3173
|
return (React__default.createElement(ColorPicker, { value: value, label: "Color", onChange: function (value) {
|
|
3173
3174
|
setPaintProps(function (current) {
|
|
@@ -3178,7 +3179,7 @@ function PaintPropsColorPicker(_a) {
|
|
|
3178
3179
|
} }));
|
|
3179
3180
|
}
|
|
3180
3181
|
|
|
3181
|
-
var PaperStyled = styled(Paper)({
|
|
3182
|
+
var PaperStyled$1 = styled(Paper)({
|
|
3182
3183
|
marginLeft: '-100px',
|
|
3183
3184
|
marginRight: '-21px',
|
|
3184
3185
|
paddingLeft: '53px',
|
|
@@ -3186,10 +3187,10 @@ var PaperStyled = styled(Paper)({
|
|
|
3186
3187
|
boxShadow: 'none',
|
|
3187
3188
|
backgroundColor: 'rgb(0, 0, 0, 0)',
|
|
3188
3189
|
});
|
|
3189
|
-
var BoxStyled$
|
|
3190
|
+
var BoxStyled$3 = styled(Box$1)({
|
|
3190
3191
|
marginLeft: '61px',
|
|
3191
3192
|
});
|
|
3192
|
-
var mapPropKeyToFormInputType = {
|
|
3193
|
+
var mapPropKeyToFormInputType$1 = {
|
|
3193
3194
|
'circle-color': 'colorpicker',
|
|
3194
3195
|
'circle-radius': 'slider',
|
|
3195
3196
|
'circle-stroke-color': 'colorpicker',
|
|
@@ -3200,8 +3201,8 @@ var mapPropKeyToFormInputType = {
|
|
|
3200
3201
|
'line-width': 'slider',
|
|
3201
3202
|
'line-blur': 'slider',
|
|
3202
3203
|
};
|
|
3203
|
-
var mapPropKeyToFormInputTypeKeys = Object.keys(mapPropKeyToFormInputType);
|
|
3204
|
-
var inputPropsByPropKey = {
|
|
3204
|
+
var mapPropKeyToFormInputTypeKeys$1 = Object.keys(mapPropKeyToFormInputType$1);
|
|
3205
|
+
var inputPropsByPropKey$1 = {
|
|
3205
3206
|
'circle-stroke-width': {
|
|
3206
3207
|
step: 1,
|
|
3207
3208
|
min: 1,
|
|
@@ -3223,18 +3224,18 @@ var inputPropsByPropKey = {
|
|
|
3223
3224
|
max: 100,
|
|
3224
3225
|
},
|
|
3225
3226
|
};
|
|
3226
|
-
function LayerPropertyForm(_a) {
|
|
3227
|
+
function LayerPropertyForm$1(_a) {
|
|
3227
3228
|
var _b = _a.paintProps, paintProps = _b === void 0 ? {} : _b, setPaintProps = _a.setPaintProps;
|
|
3228
3229
|
var key = useRef(Math.round(Math.random() * 10000000000));
|
|
3229
3230
|
var getFormInputByType = useCallback(function (key) {
|
|
3230
|
-
if (mapPropKeyToFormInputTypeKeys.indexOf(key) !== -1 &&
|
|
3231
|
+
if (mapPropKeyToFormInputTypeKeys$1.indexOf(key) !== -1 &&
|
|
3231
3232
|
(typeof paintProps[key] === 'number' || typeof paintProps[key] === 'string')) {
|
|
3232
3233
|
var label = (React__default.createElement(Typography, { id: key + '_label', gutterBottom: true }, key));
|
|
3233
|
-
switch (mapPropKeyToFormInputType[key]) {
|
|
3234
|
+
switch (mapPropKeyToFormInputType$1[key]) {
|
|
3234
3235
|
case 'slider':
|
|
3235
3236
|
return (React__default.createElement(React__default.Fragment, { key: key },
|
|
3236
3237
|
label,
|
|
3237
|
-
React__default.createElement(Slider, __assign({}, inputPropsByPropKey[key], { inputProps: { inputMode: 'decimal', pattern: '[0-9]*' }, value: paintProps[key], valueLabelDisplay: "auto", onChange: function (_ev, value) {
|
|
3238
|
+
React__default.createElement(Slider, __assign({}, inputPropsByPropKey$1[key], { inputProps: { inputMode: 'decimal', pattern: '[0-9]*' }, value: paintProps[key], valueLabelDisplay: "auto", onChange: function (_ev, value) {
|
|
3238
3239
|
if (value) {
|
|
3239
3240
|
setPaintProps(function (current) {
|
|
3240
3241
|
var _a;
|
|
@@ -3258,24 +3259,24 @@ function LayerPropertyForm(_a) {
|
|
|
3258
3259
|
return (React__default.createElement(React__default.Fragment, { key: key },
|
|
3259
3260
|
label,
|
|
3260
3261
|
React__default.createElement(Box$1, { sx: { '& > div': { width: 'initial !important' } } },
|
|
3261
|
-
React__default.createElement(PaintPropsColorPicker, { key: key, value: paintProps[key], propKey: key, setPaintProps: setPaintProps }))));
|
|
3262
|
+
React__default.createElement(PaintPropsColorPicker$1, { key: key, value: paintProps[key], propKey: key, setPaintProps: setPaintProps }))));
|
|
3262
3263
|
}
|
|
3263
3264
|
}
|
|
3264
3265
|
return null;
|
|
3265
3266
|
}, [paintProps]);
|
|
3266
3267
|
return (React__default.createElement(React__default.Fragment, null,
|
|
3267
|
-
React__default.createElement(PaperStyled, null,
|
|
3268
|
+
React__default.createElement(PaperStyled$1, null,
|
|
3268
3269
|
React__default.createElement(ListItem, { key: key + '_paintPropForm' },
|
|
3269
|
-
React__default.createElement(BoxStyled$
|
|
3270
|
+
React__default.createElement(BoxStyled$3, null, Object.keys(paintProps).map(function (el) { return getFormInputByType(el); }))))));
|
|
3270
3271
|
}
|
|
3271
3272
|
|
|
3272
|
-
var ListItemStyled = styled(ListItem)(function (configurable) { return ({
|
|
3273
|
+
var ListItemStyled$1 = styled(ListItem)(function (configurable) { return ({
|
|
3273
3274
|
paddingRight: configurable ? '56px' : 0,
|
|
3274
3275
|
paddingLeft: 0,
|
|
3275
3276
|
paddingTop: 0,
|
|
3276
3277
|
paddingBottom: '4px',
|
|
3277
3278
|
}); });
|
|
3278
|
-
var TuneIconButton$
|
|
3279
|
+
var TuneIconButton$2 = styled(IconButton)({
|
|
3279
3280
|
padding: '4px',
|
|
3280
3281
|
marginTop: '-3px',
|
|
3281
3282
|
});
|
|
@@ -3320,7 +3321,7 @@ function LayerListItemVectorLayer(_a) {
|
|
|
3320
3321
|
}
|
|
3321
3322
|
}, [paintProps, id, setVtProps, vtProps]);
|
|
3322
3323
|
return (React__default.createElement(React__default.Fragment, null,
|
|
3323
|
-
React__default.createElement(ListItemStyled, { key: id, secondaryAction: configurable ? (React__default.createElement(TuneIconButton$
|
|
3324
|
+
React__default.createElement(ListItemStyled$1, { key: id, secondaryAction: configurable ? (React__default.createElement(TuneIconButton$2, { edge: "end", "aria-label": "comments", onClick: function () {
|
|
3324
3325
|
setPaintPropsFormVisible(function (current) {
|
|
3325
3326
|
return !current;
|
|
3326
3327
|
});
|
|
@@ -3331,7 +3332,7 @@ function LayerListItemVectorLayer(_a) {
|
|
|
3331
3332
|
setVisible(function (val) { return !val; });
|
|
3332
3333
|
} })),
|
|
3333
3334
|
React__default.createElement(ListItemText, { primary: vtProps.layers[id].id, variant: "layerlist" })),
|
|
3334
|
-
configurable && paintPropsFormVisible && (React__default.createElement(LayerPropertyForm, { paintProps: paintProps, setPaintProps: setPaintProps, layerType: vtProps.layers[id].type }))));
|
|
3335
|
+
configurable && paintPropsFormVisible && (React__default.createElement(LayerPropertyForm$1, { paintProps: paintProps, setPaintProps: setPaintProps, layerType: vtProps.layers[id].type }))));
|
|
3335
3336
|
}
|
|
3336
3337
|
LayerListItemVectorLayer.defaultProps = {
|
|
3337
3338
|
configurable: true,
|
|
@@ -3363,11 +3364,11 @@ function SortableContainer(_a) {
|
|
|
3363
3364
|
return (React__default.createElement("li", __assign({ ref: setNodeRef, style: style }, attributes, listeners), children));
|
|
3364
3365
|
}
|
|
3365
3366
|
|
|
3366
|
-
var TuneIconButton = styled(IconButton)({
|
|
3367
|
+
var TuneIconButton$1 = styled(IconButton)({
|
|
3367
3368
|
padding: '4px',
|
|
3368
3369
|
marginTop: '-3px',
|
|
3369
3370
|
});
|
|
3370
|
-
var DeleteIconButton = styled(IconButton)({
|
|
3371
|
+
var DeleteIconButton$1 = styled(IconButton)({
|
|
3371
3372
|
marginLeft: '20px',
|
|
3372
3373
|
});
|
|
3373
3374
|
function LayerListItem(_a) {
|
|
@@ -3452,9 +3453,9 @@ function LayerListItem(_a) {
|
|
|
3452
3453
|
}
|
|
3453
3454
|
return undefined;
|
|
3454
3455
|
}, [layerComponent]);
|
|
3455
|
-
var listContent = (React__default.createElement(ListItemStyled, { sx: __assign({}, props.listItemSx), secondaryAction: configurable && ((_h = Object.keys(paintProps)) === null || _h === void 0 ? void 0 : _h.length) > 0 ? (React__default.createElement(React__default.Fragment, null, props === null || props === void 0 ? void 0 :
|
|
3456
|
+
var listContent = (React__default.createElement(ListItemStyled$1, { sx: __assign({}, props.listItemSx), secondaryAction: configurable && ((_h = Object.keys(paintProps)) === null || _h === void 0 ? void 0 : _h.length) > 0 ? (React__default.createElement(React__default.Fragment, null, props === null || props === void 0 ? void 0 :
|
|
3456
3457
|
props.buttons,
|
|
3457
|
-
React__default.createElement(TuneIconButton, { edge: 'end', "aria-label": "settings", onClick: function () {
|
|
3458
|
+
React__default.createElement(TuneIconButton$1, { edge: 'end', "aria-label": "settings", onClick: function () {
|
|
3458
3459
|
setPaintPropsFormVisible(function (current) {
|
|
3459
3460
|
return !current;
|
|
3460
3461
|
});
|
|
@@ -3474,7 +3475,7 @@ function LayerListItem(_a) {
|
|
|
3474
3475
|
configurable &&
|
|
3475
3476
|
paintPropsFormVisible && (React__default.createElement(React__default.Fragment, null,
|
|
3476
3477
|
props.showDeleteButton && (React__default.createElement(React__default.Fragment, null,
|
|
3477
|
-
React__default.createElement(DeleteIconButton, { edge: "end", "aria-label": "delete", onClick: function () {
|
|
3478
|
+
React__default.createElement(DeleteIconButton$1, { edge: "end", "aria-label": "delete", onClick: function () {
|
|
3478
3479
|
if (typeof setLayerState === 'function') {
|
|
3479
3480
|
setShowDeletionConfirmationDialog(true);
|
|
3480
3481
|
}
|
|
@@ -3489,7 +3490,7 @@ function LayerListItem(_a) {
|
|
|
3489
3490
|
}, onCancel: function () {
|
|
3490
3491
|
setShowDeletionConfirmationDialog(false);
|
|
3491
3492
|
}, title: "Delete layer", text: "Are you sure you want to delete this layer?" })))),
|
|
3492
|
-
React__default.createElement(LayerPropertyForm, { paintProps: paintProps, setPaintProps: setPaintProps, layerType: layerType }))),
|
|
3493
|
+
React__default.createElement(LayerPropertyForm$1, { paintProps: paintProps, setPaintProps: setPaintProps, layerType: layerType }))),
|
|
3493
3494
|
((_m = layerComponent === null || layerComponent === void 0 ? void 0 : layerComponent.props) === null || _m === void 0 ? void 0 : _m.layers) && (React__default.createElement(LayerListFolder, { visible: localVisible, setVisible: setLocalVisible, name: name }, (_q = (_p = (_o = layerComponent === null || layerComponent === void 0 ? void 0 : layerComponent.props) === null || _o === void 0 ? void 0 : _o.layers) === null || _p === void 0 ? void 0 : _p.map) === null || _q === void 0 ? void 0 : _q.call(_p, function (_el, idx) { return (React__default.createElement(LayerListItemVectorLayer, { vtProps: layerComponent === null || layerComponent === void 0 ? void 0 : layerComponent.props, setVtProps: setLayerState, id: '' + idx, key: '' + idx, visibleMaster: _visible })); })))));
|
|
3494
3495
|
}
|
|
3495
3496
|
LayerListItem.defaultProps = {
|
|
@@ -3797,7 +3798,7 @@ var SvgCompassBackground = function SvgCompassBackground(props) {
|
|
|
3797
3798
|
})));
|
|
3798
3799
|
};
|
|
3799
3800
|
|
|
3800
|
-
var BoxStyled = styled(Box$1)(function (_a) {
|
|
3801
|
+
var BoxStyled$2 = styled(Box$1)(function (_a) {
|
|
3801
3802
|
var _b;
|
|
3802
3803
|
var theme = _a.theme;
|
|
3803
3804
|
return (_b = {
|
|
@@ -3898,7 +3899,7 @@ var MlNavigationCompass = function (props) {
|
|
|
3898
3899
|
}
|
|
3899
3900
|
};
|
|
3900
3901
|
return (React__default.createElement(React__default.Fragment, null,
|
|
3901
|
-
React__default.createElement(BoxStyled, { sx: __assign({}, props.style) },
|
|
3902
|
+
React__default.createElement(BoxStyled$2, { sx: __assign({}, props.style) },
|
|
3902
3903
|
React__default.createElement(CompassBox, { onClick: rotate, sx: __assign({}, props.backgroundStyle) },
|
|
3903
3904
|
React__default.createElement(SvgCompassBackground, { style: { position: 'absolute', top: 0, left: 0 } }),
|
|
3904
3905
|
React__default.createElement(NeedleBox, { onClick: rotate, sx: __assign({}, props.needleStyle) },
|
|
@@ -5751,6 +5752,75 @@ var MlVectorTileLayer = function (props) {
|
|
|
5751
5752
|
return React__default.createElement(React__default.Fragment, null);
|
|
5752
5753
|
};
|
|
5753
5754
|
|
|
5755
|
+
var MlOgcApiFeatures = function (props) {
|
|
5756
|
+
var _a;
|
|
5757
|
+
var _b = useState(), geojson = _b[0], setGeojson = _b[1];
|
|
5758
|
+
var mapHook = useMap({ mapId: props.mapId });
|
|
5759
|
+
var layerId = useRef(((_a = props.mlGeoJsonLayerProps) === null || _a === void 0 ? void 0 : _a.layerId) || 'MlOgcApiFeature-' + mapHook.componentId);
|
|
5760
|
+
var buildOgcApiUrl = function () {
|
|
5761
|
+
var _a, _b;
|
|
5762
|
+
var url = new URL(props.ogcApiUrl);
|
|
5763
|
+
if (props.ogcApiFeatureParams) {
|
|
5764
|
+
Object.entries(props.ogcApiFeatureParams).forEach(function (_a) {
|
|
5765
|
+
var key = _a[0], value = _a[1];
|
|
5766
|
+
if (value !== undefined && value !== null) {
|
|
5767
|
+
url.searchParams.append(key, value.toString());
|
|
5768
|
+
}
|
|
5769
|
+
});
|
|
5770
|
+
}
|
|
5771
|
+
if (props.reloadFeaturesOnMapMove) {
|
|
5772
|
+
var southWest = (_a = mapHook === null || mapHook === void 0 ? void 0 : mapHook.map) === null || _a === void 0 ? void 0 : _a.getBounds().getSouthWest();
|
|
5773
|
+
var northEast = (_b = mapHook === null || mapHook === void 0 ? void 0 : mapHook.map) === null || _b === void 0 ? void 0 : _b.getBounds().getNorthEast();
|
|
5774
|
+
var bbox = "".concat(southWest === null || southWest === void 0 ? void 0 : southWest.lng, ",").concat(southWest === null || southWest === void 0 ? void 0 : southWest.lat, ",").concat(northEast === null || northEast === void 0 ? void 0 : northEast.lng, ",").concat(northEast === null || northEast === void 0 ? void 0 : northEast.lat);
|
|
5775
|
+
url.searchParams.append('bbox', bbox);
|
|
5776
|
+
}
|
|
5777
|
+
return url.toString();
|
|
5778
|
+
};
|
|
5779
|
+
useEffect(function () {
|
|
5780
|
+
if (!mapHook.map)
|
|
5781
|
+
return;
|
|
5782
|
+
var getDataHandler = function () {
|
|
5783
|
+
var generatedOgcApiUrl = buildOgcApiUrl();
|
|
5784
|
+
fetch(generatedOgcApiUrl)
|
|
5785
|
+
.then(function (res) {
|
|
5786
|
+
if (!res.ok)
|
|
5787
|
+
throw new Error('Error fetching OGC features');
|
|
5788
|
+
return res.json();
|
|
5789
|
+
})
|
|
5790
|
+
.then(function (data) {
|
|
5791
|
+
setGeojson(data);
|
|
5792
|
+
})
|
|
5793
|
+
.catch(function (error) {
|
|
5794
|
+
console.log(error);
|
|
5795
|
+
setGeojson(undefined);
|
|
5796
|
+
});
|
|
5797
|
+
};
|
|
5798
|
+
getDataHandler();
|
|
5799
|
+
if (props.reloadFeaturesOnMapMove) {
|
|
5800
|
+
mapHook.map.on('moveend', getDataHandler);
|
|
5801
|
+
}
|
|
5802
|
+
return function () {
|
|
5803
|
+
var _a;
|
|
5804
|
+
if ((_a = mapHook === null || mapHook === void 0 ? void 0 : mapHook.map) === null || _a === void 0 ? void 0 : _a.off) {
|
|
5805
|
+
mapHook.map.off('moveend', getDataHandler);
|
|
5806
|
+
}
|
|
5807
|
+
};
|
|
5808
|
+
}, [mapHook.map, props.ogcApiFeatureParams, props.ogcApiUrl]);
|
|
5809
|
+
useEffect(function () {
|
|
5810
|
+
// if layer is not yet on map return
|
|
5811
|
+
if (!mapHook.map || !mapHook.map.map.style.getLayer(layerId.current))
|
|
5812
|
+
return;
|
|
5813
|
+
// if layer is already on map: toggle layer visibility by changing the layout object's visibility property
|
|
5814
|
+
if (props.visible) {
|
|
5815
|
+
mapHook.map.map.setLayoutProperty(layerId.current, 'visibility', 'visible');
|
|
5816
|
+
}
|
|
5817
|
+
else {
|
|
5818
|
+
mapHook.map.map.setLayoutProperty(layerId.current, 'visibility', 'none');
|
|
5819
|
+
}
|
|
5820
|
+
}, [props.visible, mapHook.map]);
|
|
5821
|
+
return (React__default.createElement(React__default.Fragment, null, geojson && (React__default.createElement(MlGeoJsonLayer, __assign({ geojson: geojson, layerId: layerId.current }, props.mlGeoJsonLayerProps)))));
|
|
5822
|
+
};
|
|
5823
|
+
|
|
5754
5824
|
/**
|
|
5755
5825
|
* TODO: Add short & useful description
|
|
5756
5826
|
*
|
|
@@ -7639,7 +7709,7 @@ SimpleDataProvider.propTypes = {
|
|
|
7639
7709
|
children: PropTypes.node.isRequired,
|
|
7640
7710
|
};
|
|
7641
7711
|
|
|
7642
|
-
var IconButtonStyled = styled(IconButton)({
|
|
7712
|
+
var IconButtonStyled$1 = styled(IconButton)({
|
|
7643
7713
|
padding: '4px',
|
|
7644
7714
|
marginTop: '-3px',
|
|
7645
7715
|
background: 'none',
|
|
@@ -7742,15 +7812,15 @@ function LayerListItemFactory(props) {
|
|
|
7742
7812
|
switch (layer.type) {
|
|
7743
7813
|
case 'geojson':
|
|
7744
7814
|
return (React__default.createElement(LayerListItem, { key: layer.id, layerId: layer.id, sortable: props.sortable, name: (layer === null || layer === void 0 ? void 0 : layer.name) || ((_a = layer === null || layer === void 0 ? void 0 : layer.config) === null || _a === void 0 ? void 0 : _a.type) + ' layer' || 'unnamed layer', layerComponent: React__default.createElement(MlGeoJsonLayer, __assign({}, layer.config, { mapId: props === null || props === void 0 ? void 0 : props.mapId, layerId: layer.id, insertBeforeLayer: 'content_order_' + (layers.length - 1 - idx) })), buttons: React__default.createElement(React__default.Fragment, null,
|
|
7745
|
-
React__default.createElement(IconButtonStyled, { disabled: idx === layers.length - 1, onClick: function () {
|
|
7815
|
+
React__default.createElement(IconButtonStyled$1, { disabled: idx === layers.length - 1, onClick: function () {
|
|
7746
7816
|
layerContext.moveDown(layer.id || '');
|
|
7747
7817
|
} },
|
|
7748
7818
|
React__default.createElement(ArrowCircleDown, null)),
|
|
7749
|
-
React__default.createElement(IconButtonStyled, { disabled: idx === 0, onClick: function () {
|
|
7819
|
+
React__default.createElement(IconButtonStyled$1, { disabled: idx === 0, onClick: function () {
|
|
7750
7820
|
layerContext.moveUp(layer.id || '');
|
|
7751
7821
|
} },
|
|
7752
7822
|
React__default.createElement(ArrowCircleUp, null)),
|
|
7753
|
-
React__default.createElement(IconButtonStyled, { onClick: function () { return fitLayer(layer); } },
|
|
7823
|
+
React__default.createElement(IconButtonStyled$1, { onClick: function () { return fitLayer(layer); } },
|
|
7754
7824
|
React__default.createElement(CenterFocusWeak, null))), setLayerState: function (layerConfig) {
|
|
7755
7825
|
return setLayers === null || setLayers === void 0 ? void 0 : setLayers(function (current) {
|
|
7756
7826
|
var _layers = __spreadArray([], current, true);
|
|
@@ -7788,28 +7858,28 @@ function LayerListItemFactory(props) {
|
|
|
7788
7858
|
return _layers;
|
|
7789
7859
|
});
|
|
7790
7860
|
}, showDeleteButton: true, buttons: React__default.createElement(React__default.Fragment, null,
|
|
7791
|
-
React__default.createElement(IconButtonStyled, { disabled: idx === layers.length - 1, onClick: function () {
|
|
7861
|
+
React__default.createElement(IconButtonStyled$1, { disabled: idx === layers.length - 1, onClick: function () {
|
|
7792
7862
|
layerContext.moveDown(layer.id || '');
|
|
7793
7863
|
} },
|
|
7794
7864
|
React__default.createElement(ArrowCircleDown, null)),
|
|
7795
|
-
React__default.createElement(IconButtonStyled, { disabled: idx === 0, onClick: function () {
|
|
7865
|
+
React__default.createElement(IconButtonStyled$1, { disabled: idx === 0, onClick: function () {
|
|
7796
7866
|
layerContext.moveUp(layer.id || '');
|
|
7797
7867
|
} },
|
|
7798
7868
|
React__default.createElement(ArrowCircleUp, null)),
|
|
7799
|
-
React__default.createElement(IconButtonStyled, { onClick: function () { return fitLayer(layer); } },
|
|
7869
|
+
React__default.createElement(IconButtonStyled$1, { onClick: function () { return fitLayer(layer); } },
|
|
7800
7870
|
React__default.createElement(CenterFocusWeak, null))) }))));
|
|
7801
7871
|
case 'vt':
|
|
7802
7872
|
return (React__default.createElement(React__default.Fragment, { key: (layer === null || layer === void 0 ? void 0 : layer.id) + '_listItem' },
|
|
7803
7873
|
React__default.createElement(LayerListItem, { key: layer.id, name: (layer === null || layer === void 0 ? void 0 : layer.name) || (layer === null || layer === void 0 ? void 0 : layer.type) + ' layer' || 'unnamed layer', layerComponent: React__default.createElement(MlVectorTileLayer, { layers: ((_c = layer === null || layer === void 0 ? void 0 : layer.config) === null || _c === void 0 ? void 0 : _c.layers) || [], key: layer.id, mapId: layer === null || layer === void 0 ? void 0 : layer.config.mapId, sourceOptions: (_d = layer === null || layer === void 0 ? void 0 : layer.config) === null || _d === void 0 ? void 0 : _d.sourceOptions, layerId: layer.id, url: (_e = layer === null || layer === void 0 ? void 0 : layer.config) === null || _e === void 0 ? void 0 : _e.url }), buttons: React__default.createElement(React__default.Fragment, null,
|
|
7804
|
-
React__default.createElement(IconButtonStyled, { key: layer.id + '_button1', disabled: idx === layers.length - 1, onClick: function () {
|
|
7874
|
+
React__default.createElement(IconButtonStyled$1, { key: layer.id + '_button1', disabled: idx === layers.length - 1, onClick: function () {
|
|
7805
7875
|
layerContext.moveDown(layer.id || '');
|
|
7806
7876
|
} },
|
|
7807
7877
|
React__default.createElement(ArrowCircleDown, null)),
|
|
7808
|
-
React__default.createElement(IconButtonStyled, { key: layer.id + '_button2', disabled: idx === 0, onClick: function () {
|
|
7878
|
+
React__default.createElement(IconButtonStyled$1, { key: layer.id + '_button2', disabled: idx === 0, onClick: function () {
|
|
7809
7879
|
layerContext.moveUp(layer.id || '');
|
|
7810
7880
|
} },
|
|
7811
7881
|
React__default.createElement(ArrowCircleUp, null)),
|
|
7812
|
-
React__default.createElement(IconButtonStyled, { onClick: function () { return fitLayer(layer); } },
|
|
7882
|
+
React__default.createElement(IconButtonStyled$1, { onClick: function () { return fitLayer(layer); } },
|
|
7813
7883
|
React__default.createElement(CenterFocusWeak, null))), setLayerState: function (layerConfig) {
|
|
7814
7884
|
return setLayers === null || setLayers === void 0 ? void 0 : setLayers(function (current) {
|
|
7815
7885
|
var _layers = __spreadArray([], current, true);
|
|
@@ -21160,5 +21230,566 @@ SpeedDial.defaultProps = {
|
|
|
21160
21230
|
mapId: undefined,
|
|
21161
21231
|
};
|
|
21162
21232
|
|
|
21163
|
-
|
|
21233
|
+
var _a;
|
|
21234
|
+
function processLayerOrderItems(action, items, parent) {
|
|
21235
|
+
items.forEach(function (item) {
|
|
21236
|
+
action(item, parent);
|
|
21237
|
+
if (item.layers && item.layers.length > 0) {
|
|
21238
|
+
processLayerOrderItems(action, item.layers, item);
|
|
21239
|
+
}
|
|
21240
|
+
});
|
|
21241
|
+
}
|
|
21242
|
+
var initialState = {
|
|
21243
|
+
mapConfigs: {},
|
|
21244
|
+
};
|
|
21245
|
+
//@ts-ignore
|
|
21246
|
+
var mapConfigSlice = createSlice({
|
|
21247
|
+
name: 'mapConfig',
|
|
21248
|
+
initialState: initialState,
|
|
21249
|
+
reducers: {
|
|
21250
|
+
// Add or update a MapConfig
|
|
21251
|
+
setMapConfig: function (state, action) {
|
|
21252
|
+
var mapConfig = action.payload.mapConfig;
|
|
21253
|
+
var key = action.payload.key;
|
|
21254
|
+
//@ts-ignore
|
|
21255
|
+
state.mapConfigs[key] = mapConfig;
|
|
21256
|
+
},
|
|
21257
|
+
// Remove a MapConfig by its uuid
|
|
21258
|
+
removeMapConfig: function (state, action) {
|
|
21259
|
+
delete state.mapConfigs[action.payload.key];
|
|
21260
|
+
},
|
|
21261
|
+
// Add or update a layer within a MapConfig
|
|
21262
|
+
setLayerInMapConfig: function (state, action) {
|
|
21263
|
+
var _a = action.payload, mapConfigKey = _a.mapConfigKey, updatedLayer = _a.layer;
|
|
21264
|
+
var mapConfig = state.mapConfigs[mapConfigKey];
|
|
21265
|
+
if (mapConfig) {
|
|
21266
|
+
for (var i = 0; i < mapConfig.layers.length; i++) {
|
|
21267
|
+
if (mapConfig.layers[i].uuid === updatedLayer.uuid) {
|
|
21268
|
+
mapConfig.layers[i] = updatedLayer;
|
|
21269
|
+
break;
|
|
21270
|
+
}
|
|
21271
|
+
}
|
|
21272
|
+
}
|
|
21273
|
+
},
|
|
21274
|
+
// Remove a layer from a MapConfig
|
|
21275
|
+
removeLayerFromMapConfig: function (state, action) {
|
|
21276
|
+
var _a = action.payload, mapConfigKey = _a.mapConfigKey, layerUuid = _a.layerUuid;
|
|
21277
|
+
var mapConfig = state.mapConfigs[mapConfigKey];
|
|
21278
|
+
if (mapConfig) {
|
|
21279
|
+
var targetLayerIndex = mapConfig.layers.findIndex(function (el) { return el.uuid === layerUuid; });
|
|
21280
|
+
if (targetLayerIndex !== -1) {
|
|
21281
|
+
delete mapConfig.layers[targetLayerIndex];
|
|
21282
|
+
processLayerOrderItems(function (_, parent) {
|
|
21283
|
+
if (parent && parent.layers) {
|
|
21284
|
+
parent.layers = parent.layers.filter(function (child) { return child.uuid !== layerUuid; });
|
|
21285
|
+
}
|
|
21286
|
+
}, mapConfig.layerOrder);
|
|
21287
|
+
}
|
|
21288
|
+
}
|
|
21289
|
+
},
|
|
21290
|
+
updateLayerOrder: function (state, action) {
|
|
21291
|
+
var _a = action.payload, mapConfigKey = _a.mapConfigKey, newOrder = _a.newOrder;
|
|
21292
|
+
var mapConfig = state.mapConfigs[mapConfigKey];
|
|
21293
|
+
if (mapConfig) {
|
|
21294
|
+
mapConfig.layerOrder = newOrder;
|
|
21295
|
+
}
|
|
21296
|
+
},
|
|
21297
|
+
// masterVisible property will be applied to all children of a folder that is set to be not visible
|
|
21298
|
+
// masterVisible will over rule the actual layer config if set to false
|
|
21299
|
+
// if masterVisible is true the actual layerConfig visibility setting is respected
|
|
21300
|
+
setMasterVisible: function (state, action) {
|
|
21301
|
+
var _a;
|
|
21302
|
+
var _b = action.payload, mapConfigKey = _b.mapConfigKey, layerId = _b.layerId, masterVisible = _b.masterVisible;
|
|
21303
|
+
var mapConfig = state.mapConfigs[mapConfigKey];
|
|
21304
|
+
if (mapConfig) {
|
|
21305
|
+
var targetLayerIndex = mapConfig.layers.findIndex(function (el) { return el.uuid === layerId; });
|
|
21306
|
+
if (targetLayerIndex !== -1) {
|
|
21307
|
+
var layerConfig = mapConfig.layers[targetLayerIndex];
|
|
21308
|
+
if (layerConfig) {
|
|
21309
|
+
var updatedLayers_1 = __spreadArray([], mapConfig.layers, true);
|
|
21310
|
+
if (layerConfig.type === 'folder') {
|
|
21311
|
+
mapConfig.layerOrder.forEach(function (folder) {
|
|
21312
|
+
var _a;
|
|
21313
|
+
if (folder.uuid === layerId) {
|
|
21314
|
+
(_a = folder.layers) === null || _a === void 0 ? void 0 : _a.forEach(function (childUuid) {
|
|
21315
|
+
var _a;
|
|
21316
|
+
var childLayerIndex = mapConfig.layers.findIndex(function (el) { return el.uuid === childUuid.uuid; });
|
|
21317
|
+
var childLayer = updatedLayers_1[childLayerIndex];
|
|
21318
|
+
updatedLayers_1[childLayerIndex] = __assign(__assign({}, childLayer), { masterVisible: masterVisible });
|
|
21319
|
+
if ((childLayer === null || childLayer === void 0 ? void 0 : childLayer.type) === 'vt' && ((_a = childLayer === null || childLayer === void 0 ? void 0 : childLayer.config) === null || _a === void 0 ? void 0 : _a.layers)) {
|
|
21320
|
+
childLayer.config.layers = childLayer.config.layers.map(function (layer) { return (__assign(__assign({}, layer), { masterVisible: masterVisible })); });
|
|
21321
|
+
}
|
|
21322
|
+
});
|
|
21323
|
+
}
|
|
21324
|
+
});
|
|
21325
|
+
}
|
|
21326
|
+
if (layerConfig.type === 'vt' && ((_a = layerConfig === null || layerConfig === void 0 ? void 0 : layerConfig.config) === null || _a === void 0 ? void 0 : _a.layers)) {
|
|
21327
|
+
layerConfig.config.layers = layerConfig.config.layers.map(function (layer) { return (__assign(__assign({}, layer), { masterVisible: masterVisible })); });
|
|
21328
|
+
}
|
|
21329
|
+
state.mapConfigs[mapConfigKey].layers = updatedLayers_1;
|
|
21330
|
+
}
|
|
21331
|
+
}
|
|
21332
|
+
}
|
|
21333
|
+
},
|
|
21334
|
+
},
|
|
21335
|
+
});
|
|
21336
|
+
var getLayerByUuid = function (state, uuid) {
|
|
21337
|
+
var mapConfigs = state.mapConfigs;
|
|
21338
|
+
for (var key in mapConfigs) {
|
|
21339
|
+
var mapConfig = mapConfigs[key];
|
|
21340
|
+
var targetLayerIndex = mapConfig.layers.findIndex(function (el) { return el.uuid === uuid; });
|
|
21341
|
+
var foundLayer = mapConfig.layers[targetLayerIndex];
|
|
21342
|
+
if (foundLayer)
|
|
21343
|
+
return foundLayer;
|
|
21344
|
+
}
|
|
21345
|
+
return null;
|
|
21346
|
+
};
|
|
21347
|
+
var extractUuidsFromLayerOrder = function (state, mapConfigKey) {
|
|
21348
|
+
var mapConfig = state.mapConfig.mapConfigs[mapConfigKey];
|
|
21349
|
+
if (!mapConfig) {
|
|
21350
|
+
return [];
|
|
21351
|
+
}
|
|
21352
|
+
var layerOrder = mapConfig.layerOrder;
|
|
21353
|
+
var uuids = [];
|
|
21354
|
+
function extractUuids(items) {
|
|
21355
|
+
items.forEach(function (item) {
|
|
21356
|
+
uuids.push(item.uuid);
|
|
21357
|
+
if (item.layers && item.layers.length > 0) {
|
|
21358
|
+
extractUuids(item.layers);
|
|
21359
|
+
}
|
|
21360
|
+
});
|
|
21361
|
+
}
|
|
21362
|
+
extractUuids(layerOrder);
|
|
21363
|
+
return uuids;
|
|
21364
|
+
};
|
|
21365
|
+
var store = configureStore({
|
|
21366
|
+
reducer: {
|
|
21367
|
+
mapConfig: mapConfigSlice.reducer,
|
|
21368
|
+
},
|
|
21369
|
+
});
|
|
21370
|
+
var setMapConfig = (_a = mapConfigSlice.actions, _a.setMapConfig), removeMapConfig = _a.removeMapConfig, setLayerInMapConfig = _a.setLayerInMapConfig, removeLayerFromMapConfig = _a.removeLayerFromMapConfig, updateLayerOrder = _a.updateLayerOrder, setMasterVisible = _a.setMasterVisible;
|
|
21371
|
+
|
|
21372
|
+
function PaintPropsColorPicker(props) {
|
|
21373
|
+
return (React__default.createElement(ColorPicker, { value: props.value, label: "Color", onChange: function (value) {
|
|
21374
|
+
if (typeof props.onChange === 'function') {
|
|
21375
|
+
props.onChange(value);
|
|
21376
|
+
}
|
|
21377
|
+
} }));
|
|
21378
|
+
}
|
|
21379
|
+
|
|
21380
|
+
var PaperStyled = styled(Paper)({
|
|
21381
|
+
marginLeft: '-100px',
|
|
21382
|
+
marginRight: '-21px',
|
|
21383
|
+
paddingLeft: '53px',
|
|
21384
|
+
borderRadius: '0px',
|
|
21385
|
+
boxShadow: 'none',
|
|
21386
|
+
backgroundColor: 'rgb(0, 0, 0, 0)',
|
|
21387
|
+
});
|
|
21388
|
+
var BoxStyled$1 = styled(Box$1)({
|
|
21389
|
+
marginLeft: '61px',
|
|
21390
|
+
});
|
|
21391
|
+
var mapPropKeyToFormInputType = {
|
|
21392
|
+
'circle-color': 'colorpicker',
|
|
21393
|
+
'circle-radius': 'slider',
|
|
21394
|
+
'circle-stroke-color': 'colorpicker',
|
|
21395
|
+
'circle-stroke-width': 'slider',
|
|
21396
|
+
'fill-color': 'colorpicker',
|
|
21397
|
+
'fill-outline-color': 'colorpicker',
|
|
21398
|
+
'line-color': 'colorpicker',
|
|
21399
|
+
'line-width': 'slider',
|
|
21400
|
+
'line-blur': 'slider',
|
|
21401
|
+
};
|
|
21402
|
+
var mapPropKeyToFormInputTypeKeys = Object.keys(mapPropKeyToFormInputType);
|
|
21403
|
+
var inputPropsByPropKey = {
|
|
21404
|
+
'circle-stroke-width': {
|
|
21405
|
+
step: 1,
|
|
21406
|
+
min: 1,
|
|
21407
|
+
max: 20,
|
|
21408
|
+
},
|
|
21409
|
+
'circle-radius': {
|
|
21410
|
+
step: 1,
|
|
21411
|
+
min: 1,
|
|
21412
|
+
max: 100,
|
|
21413
|
+
},
|
|
21414
|
+
'line-blur': {
|
|
21415
|
+
step: 1,
|
|
21416
|
+
min: 1,
|
|
21417
|
+
max: 100,
|
|
21418
|
+
},
|
|
21419
|
+
'line-width': {
|
|
21420
|
+
step: 1,
|
|
21421
|
+
min: 1,
|
|
21422
|
+
max: 100,
|
|
21423
|
+
},
|
|
21424
|
+
};
|
|
21425
|
+
function LayerPropertyForm(props) {
|
|
21426
|
+
var _a, _b;
|
|
21427
|
+
var key = useRef(Math.round(Math.random() * 10000000000));
|
|
21428
|
+
var layer = getLayerByUuid(useSelector(function (state) { return state.mapConfig; }), props.layerUuid);
|
|
21429
|
+
var dispatch = useDispatch();
|
|
21430
|
+
var paintProps = useMemo(function () {
|
|
21431
|
+
var _a, _b, _c, _d;
|
|
21432
|
+
if ((_b = (_a = layer === null || layer === void 0 ? void 0 : layer.config) === null || _a === void 0 ? void 0 : _a.options) === null || _b === void 0 ? void 0 : _b.paint) {
|
|
21433
|
+
return (_d = (_c = layer === null || layer === void 0 ? void 0 : layer.config) === null || _c === void 0 ? void 0 : _c.options) === null || _d === void 0 ? void 0 : _d.paint;
|
|
21434
|
+
}
|
|
21435
|
+
return {};
|
|
21436
|
+
}, [(_b = (_a = layer === null || layer === void 0 ? void 0 : layer.config) === null || _a === void 0 ? void 0 : _a.options) === null || _b === void 0 ? void 0 : _b.paint]);
|
|
21437
|
+
var updatePaintProp = function (key, value) {
|
|
21438
|
+
var _a;
|
|
21439
|
+
var _b, _c, _d;
|
|
21440
|
+
var updatedLayer = __assign(__assign({}, layer), { config: __assign(__assign({}, layer === null || layer === void 0 ? void 0 : layer.config), { options: __assign(__assign({}, (_b = layer === null || layer === void 0 ? void 0 : layer.config) === null || _b === void 0 ? void 0 : _b.options), { paint: __assign(__assign({}, (_d = (_c = layer === null || layer === void 0 ? void 0 : layer.config) === null || _c === void 0 ? void 0 : _c.options) === null || _d === void 0 ? void 0 : _d.paint), (_a = {}, _a[key] = value, _a)) }) }) });
|
|
21441
|
+
dispatch(setLayerInMapConfig({
|
|
21442
|
+
mapConfigKey: props.mapConfigKey,
|
|
21443
|
+
layer: updatedLayer,
|
|
21444
|
+
}));
|
|
21445
|
+
};
|
|
21446
|
+
var getFormInputByType = useCallback(function (key) {
|
|
21447
|
+
if ((paintProps === null || paintProps === void 0 ? void 0 : paintProps[key]) &&
|
|
21448
|
+
mapPropKeyToFormInputTypeKeys.indexOf(key) !== -1 &&
|
|
21449
|
+
(typeof paintProps[key] === 'number' || typeof paintProps[key] === 'string')) {
|
|
21450
|
+
var label = (React__default.createElement(Typography, { id: key + '_label', gutterBottom: true }, key));
|
|
21451
|
+
switch (mapPropKeyToFormInputType[key]) {
|
|
21452
|
+
case 'slider':
|
|
21453
|
+
return (React__default.createElement(React__default.Fragment, { key: key },
|
|
21454
|
+
label,
|
|
21455
|
+
React__default.createElement(Slider, __assign({}, inputPropsByPropKey[key], { value: paintProps[key], valueLabelDisplay: "auto", onChange: function (_ev, value) {
|
|
21456
|
+
if (value) {
|
|
21457
|
+
updatePaintProp(key, value);
|
|
21458
|
+
}
|
|
21459
|
+
} }))));
|
|
21460
|
+
case 'numberfield':
|
|
21461
|
+
return (React__default.createElement(React__default.Fragment, { key: key },
|
|
21462
|
+
label,
|
|
21463
|
+
React__default.createElement(TextField, { inputProps: { inputMode: 'decimal', pattern: '[0-9]*' }, value: paintProps[key], onChange: function (ev) {
|
|
21464
|
+
var _a;
|
|
21465
|
+
if ((_a = ev === null || ev === void 0 ? void 0 : ev.target) === null || _a === void 0 ? void 0 : _a.value) {
|
|
21466
|
+
updatePaintProp(key, parseInt(ev.target.value));
|
|
21467
|
+
}
|
|
21468
|
+
} })));
|
|
21469
|
+
case 'colorpicker':
|
|
21470
|
+
return (React__default.createElement(React__default.Fragment, { key: key },
|
|
21471
|
+
label,
|
|
21472
|
+
React__default.createElement(Box$1, { sx: { '& > div': { width: 'initial !important' } } },
|
|
21473
|
+
React__default.createElement(PaintPropsColorPicker, { key: key, value: paintProps[key], onChange: function (value) {
|
|
21474
|
+
updatePaintProp(key, value);
|
|
21475
|
+
} }))));
|
|
21476
|
+
}
|
|
21477
|
+
}
|
|
21478
|
+
return null;
|
|
21479
|
+
}, [paintProps]);
|
|
21480
|
+
return (React__default.createElement(React__default.Fragment, null,
|
|
21481
|
+
React__default.createElement(PaperStyled, null,
|
|
21482
|
+
React__default.createElement(ListItem, { key: key.current + '_paintPropForm' },
|
|
21483
|
+
React__default.createElement(BoxStyled$1, null, paintProps &&
|
|
21484
|
+
Object.keys(paintProps).map(function (el) { return getFormInputByType(el); }))))));
|
|
21485
|
+
}
|
|
21486
|
+
|
|
21487
|
+
var TuneIconButton = styled(IconButton)({
|
|
21488
|
+
padding: '4px',
|
|
21489
|
+
marginTop: '-3px',
|
|
21490
|
+
});
|
|
21491
|
+
var DeleteIconButton = styled(IconButton)({
|
|
21492
|
+
marginLeft: '20px',
|
|
21493
|
+
});
|
|
21494
|
+
var ListItemStyled = styled(ListItem)({
|
|
21495
|
+
paddingRight: 0,
|
|
21496
|
+
paddingLeft: 0,
|
|
21497
|
+
paddingTop: 0,
|
|
21498
|
+
paddingBottom: '4px',
|
|
21499
|
+
});
|
|
21500
|
+
var ListItemIconStyled = styled(ListItemIcon)({
|
|
21501
|
+
minWidth: '30px',
|
|
21502
|
+
});
|
|
21503
|
+
var IconButtonStyled = styled(IconButton)({
|
|
21504
|
+
marginRight: '0px',
|
|
21505
|
+
padding: '0px',
|
|
21506
|
+
});
|
|
21507
|
+
var BoxStyled = styled(Box$1)(function (_a) {
|
|
21508
|
+
var open = _a.open;
|
|
21509
|
+
return ({
|
|
21510
|
+
display: open ? 'block' : 'none',
|
|
21511
|
+
});
|
|
21512
|
+
});
|
|
21513
|
+
var ListStyled$1 = styled(List)({
|
|
21514
|
+
marginLeft: '50px',
|
|
21515
|
+
});
|
|
21516
|
+
function LayerTreeListItem(props) {
|
|
21517
|
+
var _a = useState(false), paintPropsFormVisible = _a[0], setPaintPropsFormVisible = _a[1];
|
|
21518
|
+
var _b = useState(false), showDeletionConfirmationDialog = _b[0], setShowDeletionConfirmationDialog = _b[1];
|
|
21519
|
+
var layer = getLayerByUuid(useSelector(function (state) { return state.mapConfig; }), props.layerOrderConfig.uuid);
|
|
21520
|
+
var _c = useState(false), open = _c[0], setOpen = _c[1];
|
|
21521
|
+
var dispatch = useDispatch();
|
|
21522
|
+
var mapConfig = useSelector(function (state) { return state.mapConfig.mapConfigs[props.mapConfigKey]; });
|
|
21523
|
+
function moveLayer(uuid, getNewPos) {
|
|
21524
|
+
var newLayerOrder = JSON.parse(JSON.stringify(mapConfig.layerOrder));
|
|
21525
|
+
var findAndMove = function (layers) {
|
|
21526
|
+
var found = false;
|
|
21527
|
+
layers.forEach(function (layer, index) {
|
|
21528
|
+
if (found)
|
|
21529
|
+
return;
|
|
21530
|
+
if (layer.uuid === uuid) {
|
|
21531
|
+
var newPos = getNewPos(index);
|
|
21532
|
+
if (newPos < 0 || newPos >= layers.length) {
|
|
21533
|
+
throw new Error('New position is out of bounds');
|
|
21534
|
+
}
|
|
21535
|
+
var item = layers.splice(index, 1)[0];
|
|
21536
|
+
layers.splice(newPos, 0, item);
|
|
21537
|
+
found = true;
|
|
21538
|
+
}
|
|
21539
|
+
else if (layer.layers) {
|
|
21540
|
+
if (findAndMove(layer.layers)) {
|
|
21541
|
+
found = true;
|
|
21542
|
+
}
|
|
21543
|
+
}
|
|
21544
|
+
});
|
|
21545
|
+
return found;
|
|
21546
|
+
};
|
|
21547
|
+
findAndMove(newLayerOrder);
|
|
21548
|
+
dispatch(updateLayerOrder({ mapConfigKey: props.mapConfigKey, newOrder: newLayerOrder }));
|
|
21549
|
+
}
|
|
21550
|
+
var moveDown = function (uuid) {
|
|
21551
|
+
moveLayer(uuid, function (idx) { return idx + 1; });
|
|
21552
|
+
};
|
|
21553
|
+
var moveUp = function (uuid) {
|
|
21554
|
+
moveLayer(uuid, function (idx) { return idx - 1; });
|
|
21555
|
+
};
|
|
21556
|
+
function handleToggleVisibility(visible, specificLayerId) {
|
|
21557
|
+
if (specificLayerId === void 0) { specificLayerId = ''; }
|
|
21558
|
+
var nextVisible = !visible;
|
|
21559
|
+
if (layer) {
|
|
21560
|
+
toggleVisible(layer, nextVisible, specificLayerId);
|
|
21561
|
+
if (layer.type === 'folder' || (layer.type === 'vt' && specificLayerId === '')) {
|
|
21562
|
+
dispatch(setMasterVisible({
|
|
21563
|
+
mapConfigKey: props.mapConfigKey,
|
|
21564
|
+
layerId: layer.uuid,
|
|
21565
|
+
masterVisible: nextVisible,
|
|
21566
|
+
}));
|
|
21567
|
+
}
|
|
21568
|
+
}
|
|
21569
|
+
}
|
|
21570
|
+
function toggleVisible(layer, nextVisible, specificLayerId) {
|
|
21571
|
+
var _a, _b, _c;
|
|
21572
|
+
//TODO: update layout for all layer types
|
|
21573
|
+
var updatedLayer = __assign({}, layer);
|
|
21574
|
+
if ((layer === null || layer === void 0 ? void 0 : layer.type) === 'folder') {
|
|
21575
|
+
updatedLayer = __assign(__assign({}, layer), { visible: !layer.visible });
|
|
21576
|
+
}
|
|
21577
|
+
else {
|
|
21578
|
+
switch (layer === null || layer === void 0 ? void 0 : layer.type) {
|
|
21579
|
+
case 'geojson': {
|
|
21580
|
+
updatedLayer = __assign(__assign({}, layer), { config: __assign(__assign({}, layer.config), { options: __assign(__assign({}, (_a = layer === null || layer === void 0 ? void 0 : layer.config) === null || _a === void 0 ? void 0 : _a.options), { layout: __assign(__assign({}, (_c = (_b = layer === null || layer === void 0 ? void 0 : layer.config) === null || _b === void 0 ? void 0 : _b.options) === null || _c === void 0 ? void 0 : _c.layout), { visibility: nextVisible ? 'visible' : 'none' }) }) }) });
|
|
21581
|
+
break;
|
|
21582
|
+
}
|
|
21583
|
+
case 'vt': {
|
|
21584
|
+
var updateSublayerOnly_1 = false;
|
|
21585
|
+
var updatedSubLayers = layer.config.layers.map(function (layer) {
|
|
21586
|
+
if (layer.id === specificLayerId) {
|
|
21587
|
+
updateSublayerOnly_1 = true;
|
|
21588
|
+
return __assign(__assign({}, layer), { layout: __assign(__assign({}, layer.layout), { visibility: nextVisible ? 'visible' : 'none' }) });
|
|
21589
|
+
}
|
|
21590
|
+
return layer;
|
|
21591
|
+
});
|
|
21592
|
+
if (updateSublayerOnly_1) {
|
|
21593
|
+
updatedLayer = __assign(__assign({}, layer), { config: __assign(__assign({}, layer.config), { layers: updatedSubLayers }) });
|
|
21594
|
+
}
|
|
21595
|
+
else {
|
|
21596
|
+
updatedLayer = __assign(__assign({}, layer), { visible: nextVisible, config: __assign(__assign({}, layer.config), { layers: updatedSubLayers }) });
|
|
21597
|
+
}
|
|
21598
|
+
break;
|
|
21599
|
+
}
|
|
21600
|
+
case 'wms': {
|
|
21601
|
+
updatedLayer = __assign(__assign({}, layer), { visible: nextVisible, config: __assign(__assign({}, layer.config), { visible: nextVisible }) });
|
|
21602
|
+
break;
|
|
21603
|
+
}
|
|
21604
|
+
}
|
|
21605
|
+
}
|
|
21606
|
+
dispatch(setLayerInMapConfig({
|
|
21607
|
+
mapConfigKey: props.mapConfigKey,
|
|
21608
|
+
layer: updatedLayer,
|
|
21609
|
+
}));
|
|
21610
|
+
return updatedLayer;
|
|
21611
|
+
}
|
|
21612
|
+
function renderLayerItem(layer) {
|
|
21613
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
|
21614
|
+
var visible = true;
|
|
21615
|
+
if ((layer === null || layer === void 0 ? void 0 : layer.type) === 'geojson') {
|
|
21616
|
+
visible = ((_c = (_b = (_a = layer === null || layer === void 0 ? void 0 : layer.config) === null || _a === void 0 ? void 0 : _a.options) === null || _b === void 0 ? void 0 : _b.layout) === null || _c === void 0 ? void 0 : _c.visibility) !== 'none';
|
|
21617
|
+
return (React__default.createElement(React__default.Fragment, null,
|
|
21618
|
+
React__default.createElement(ListItemStyled, { key: layer.uuid, sx: __assign({}, props.listItemSx), secondaryAction: React__default.createElement(React__default.Fragment, null, props === null || props === void 0 ? void 0 :
|
|
21619
|
+
props.buttons,
|
|
21620
|
+
React__default.createElement(IconButtonStyled, { disabled: false, onClick: function () {
|
|
21621
|
+
moveDown(layer.uuid);
|
|
21622
|
+
} },
|
|
21623
|
+
React__default.createElement(ArrowCircleDown, null)),
|
|
21624
|
+
React__default.createElement(IconButtonStyled, { disabled: false, onClick: function () {
|
|
21625
|
+
moveUp(layer.uuid);
|
|
21626
|
+
} },
|
|
21627
|
+
React__default.createElement(ArrowCircleUp, null)),
|
|
21628
|
+
layer.configurable && (React__default.createElement(React__default.Fragment, null,
|
|
21629
|
+
React__default.createElement(TuneIconButton, { edge: 'end', "aria-label": "settings", onClick: function () {
|
|
21630
|
+
setPaintPropsFormVisible(function (current) {
|
|
21631
|
+
return !current;
|
|
21632
|
+
});
|
|
21633
|
+
} },
|
|
21634
|
+
React__default.createElement(Tune, null))))) },
|
|
21635
|
+
React__default.createElement(CheckboxListItemIcon, null,
|
|
21636
|
+
React__default.createElement(CheckboxStyled, { checked: visible, disabled: layer.masterVisible === false, onClick: function () { return handleToggleVisibility(visible); } })),
|
|
21637
|
+
React__default.createElement(ListItemText, { variant: "layerlist", primary: layer.name || '', secondary: props.description, primaryTypographyProps: { overflow: 'hidden' } }),
|
|
21638
|
+
props.buttons),
|
|
21639
|
+
layer.configurable && paintPropsFormVisible && (React__default.createElement(React__default.Fragment, null,
|
|
21640
|
+
props.showDeleteButton && (React__default.createElement(React__default.Fragment, null,
|
|
21641
|
+
React__default.createElement(DeleteIconButton, { edge: "end", "aria-label": "delete", onClick: function () { } },
|
|
21642
|
+
React__default.createElement(Delete, null)),
|
|
21643
|
+
showDeletionConfirmationDialog && (React__default.createElement(ConfirmDialog, { open: showDeletionConfirmationDialog, onConfirm: function () {
|
|
21644
|
+
setShowDeletionConfirmationDialog(false);
|
|
21645
|
+
}, onCancel: function () {
|
|
21646
|
+
setShowDeletionConfirmationDialog(false);
|
|
21647
|
+
}, title: "Delete layer", text: "Are you sure you want to delete this layer?" })))),
|
|
21648
|
+
React__default.createElement(LayerPropertyForm, { layerUuid: layer.uuid, mapConfigKey: props.mapConfigKey })))));
|
|
21649
|
+
}
|
|
21650
|
+
if ((layer === null || layer === void 0 ? void 0 : layer.type) === 'vt') {
|
|
21651
|
+
return (React__default.createElement(React__default.Fragment, null,
|
|
21652
|
+
React__default.createElement(ListItemStyled, { key: layer.uuid, sx: __assign({}, props.listItemSx), secondaryAction: undefined },
|
|
21653
|
+
React__default.createElement(ListItemIconStyled, null,
|
|
21654
|
+
React__default.createElement(IconButtonStyled, { edge: "end", "aria-label": "open", onClick: function () { return setOpen(!open); } }, open ? React__default.createElement(ExpandMore, null) : React__default.createElement(KeyboardArrowRight, null)),
|
|
21655
|
+
React__default.createElement(CheckboxListItemIcon, null,
|
|
21656
|
+
React__default.createElement(CheckboxStyled, { checked: layer.visible, disabled: layer.masterVisible === false, onClick: function () { var _a; return handleToggleVisibility((_a = layer.visible) !== null && _a !== void 0 ? _a : false); } }))),
|
|
21657
|
+
React__default.createElement(ListItemText, { primary: layer.name, secondary: props.description, primaryTypographyProps: { overflow: 'hidden' } })),
|
|
21658
|
+
React__default.createElement(BoxStyled, { key: layer.uuid + '_list', open: open },
|
|
21659
|
+
React__default.createElement(ListStyled$1, { disablePadding: true }, (_e = (_d = layer.config) === null || _d === void 0 ? void 0 : _d.layers) === null || _e === void 0 ? void 0 : _e.map(function (subLayer) {
|
|
21660
|
+
var _a, _b;
|
|
21661
|
+
return (React__default.createElement(ListItemStyled, { key: subLayer.id, sx: __assign({}, props.listItemSx), secondaryAction: undefined },
|
|
21662
|
+
' ',
|
|
21663
|
+
React__default.createElement(ListItemIconStyled, null,
|
|
21664
|
+
React__default.createElement(CheckboxListItemIcon, null,
|
|
21665
|
+
React__default.createElement(CheckboxStyled, { checked: ((_b = (_a = subLayer === null || subLayer === void 0 ? void 0 : subLayer.layout) === null || _a === void 0 ? void 0 : _a.visibility) !== null && _b !== void 0 ? _b : 'visible') === 'visible', disabled: (subLayer === null || subLayer === void 0 ? void 0 : subLayer.masterVisible) === false, onClick: function () {
|
|
21666
|
+
var _a;
|
|
21667
|
+
return handleToggleVisibility(((_a = subLayer === null || subLayer === void 0 ? void 0 : subLayer.layout) === null || _a === void 0 ? void 0 : _a.visibility) === 'visible', subLayer.id);
|
|
21668
|
+
} }))),
|
|
21669
|
+
React__default.createElement(ListItemText, { key: subLayer.id, variant: "layerlist", primary: subLayer['source-layer'], primaryTypographyProps: { overflow: 'hidden' } })));
|
|
21670
|
+
})))));
|
|
21671
|
+
}
|
|
21672
|
+
if ((layer === null || layer === void 0 ? void 0 : layer.type) === 'wms') {
|
|
21673
|
+
var visible_1 = (_g = (_f = layer.config) === null || _f === void 0 ? void 0 : _f.visible) !== null && _g !== void 0 ? _g : true;
|
|
21674
|
+
return (React__default.createElement(React__default.Fragment, null,
|
|
21675
|
+
React__default.createElement(ListItemStyled, { key: layer.uuid, sx: __assign({}, props.listItemSx), secondaryAction: undefined },
|
|
21676
|
+
React__default.createElement(CheckboxListItemIcon, null,
|
|
21677
|
+
React__default.createElement(CheckboxStyled, { checked: visible_1, disabled: layer.masterVisible === false, onClick: function () { return handleToggleVisibility(visible_1); } })),
|
|
21678
|
+
React__default.createElement(ListItemText, { primary: layer.name, secondary: props.description, primaryTypographyProps: { overflow: 'hidden' } }))));
|
|
21679
|
+
}
|
|
21680
|
+
if (layer.type === 'folder') {
|
|
21681
|
+
return (React__default.createElement(React__default.Fragment, null,
|
|
21682
|
+
React__default.createElement(ListItemStyled, { key: layer.uuid, sx: __assign({}, props.listItemSx) },
|
|
21683
|
+
React__default.createElement(ListItemIconStyled, null,
|
|
21684
|
+
React__default.createElement(IconButtonStyled, { edge: "end", "aria-label": "open", onClick: function () { return setOpen(!open); } }, open ? React__default.createElement(ExpandMore, null) : React__default.createElement(KeyboardArrowRight, null)),
|
|
21685
|
+
React__default.createElement(CheckboxListItemIcon, null,
|
|
21686
|
+
React__default.createElement(CheckboxStyled, { checked: layer.visible, disabled: layer.masterVisible, onClick: function () { return handleToggleVisibility(layer.visible ? layer.visible : false); } }))),
|
|
21687
|
+
React__default.createElement(ListItemText, { primary: layer.name, secondary: props.description, primaryTypographyProps: { overflow: 'hidden' } })),
|
|
21688
|
+
React__default.createElement(BoxStyled, { key: layer.uuid + '_list', open: open },
|
|
21689
|
+
React__default.createElement(ListStyled$1, { disablePadding: true }, (_j = (_h = props === null || props === void 0 ? void 0 : props.layerOrderConfig) === null || _h === void 0 ? void 0 : _h.layers) === null || _j === void 0 ? void 0 : _j.map(function (subLayer) { return (React__default.createElement(LayerTreeListItem, { layerOrderConfig: subLayer, key: subLayer.uuid, mapConfigKey: props.mapConfigKey })); })))));
|
|
21690
|
+
}
|
|
21691
|
+
else {
|
|
21692
|
+
return React__default.createElement(React__default.Fragment, null);
|
|
21693
|
+
}
|
|
21694
|
+
}
|
|
21695
|
+
return React__default.createElement(React__default.Fragment, null, layer && renderLayerItem(layer));
|
|
21696
|
+
}
|
|
21697
|
+
|
|
21698
|
+
var ListStyled = styled(List)({
|
|
21699
|
+
marginTop: '15px',
|
|
21700
|
+
});
|
|
21701
|
+
function LayerTree(props) {
|
|
21702
|
+
var _a;
|
|
21703
|
+
var layerOrder = useSelector(function (state) { var _a, _b; return (_b = (_a = state.mapConfig.mapConfigs) === null || _a === void 0 ? void 0 : _a[props.mapConfigKey]) === null || _b === void 0 ? void 0 : _b.layerOrder; });
|
|
21704
|
+
return (React__default.createElement(ListStyled, null, (_a = layerOrder === null || layerOrder === void 0 ? void 0 : layerOrder.map) === null || _a === void 0 ? void 0 : _a.call(layerOrder, function (el) { return (React__default.createElement(LayerTreeListItem, { key: el.uuid, layerOrderConfig: el, mapConfigKey: props.mapConfigKey })); })));
|
|
21705
|
+
}
|
|
21706
|
+
|
|
21707
|
+
function LayerOnMap(props) {
|
|
21708
|
+
var _a;
|
|
21709
|
+
var layers = useSelector(function (state) { var _a, _b; return (_b = (_a = state.mapConfig.mapConfigs) === null || _a === void 0 ? void 0 : _a[props.mapConfigKey]) === null || _b === void 0 ? void 0 : _b.layers; });
|
|
21710
|
+
var layerStoreOrder = useSelector(function (state) { var _a, _b; return (_b = (_a = state.mapConfig.mapConfigs) === null || _a === void 0 ? void 0 : _a[props.mapConfigKey]) === null || _b === void 0 ? void 0 : _b.layerOrder; });
|
|
21711
|
+
var mapHook = useMap({ mapId: props === null || props === void 0 ? void 0 : props.mapId });
|
|
21712
|
+
var layerStoreOrderIds = useSelector(function (state) {
|
|
21713
|
+
return extractUuidsFromLayerOrder(state, props.mapConfigKey);
|
|
21714
|
+
});
|
|
21715
|
+
var previousLayerStoreOrderRef = useRef([]);
|
|
21716
|
+
useEffect(function () {
|
|
21717
|
+
if (!mapHook.map || !layerStoreOrder)
|
|
21718
|
+
return;
|
|
21719
|
+
var adjustLayerOrderAtLevel = function (layers, previousLayers, map) {
|
|
21720
|
+
for (var i = 0; i < layers.length; i++) {
|
|
21721
|
+
var currentLayer = layers[i];
|
|
21722
|
+
var previousLayer = previousLayers ? previousLayers[i] : null;
|
|
21723
|
+
if (currentLayer.uuid !== (previousLayer === null || previousLayer === void 0 ? void 0 : previousLayer.uuid)) {
|
|
21724
|
+
if (map.getLayer(currentLayer.uuid)) {
|
|
21725
|
+
var beforeLayer = i > 0 ? layers[i - 1].uuid : undefined;
|
|
21726
|
+
map.moveLayer(currentLayer.uuid, beforeLayer);
|
|
21727
|
+
}
|
|
21728
|
+
}
|
|
21729
|
+
if (currentLayer.layers && currentLayer.layers.length > 0) {
|
|
21730
|
+
var previousSubLayers = (previousLayer === null || previousLayer === void 0 ? void 0 : previousLayer.layers) || [];
|
|
21731
|
+
adjustLayerOrderAtLevel(currentLayer.layers, previousSubLayers, map);
|
|
21732
|
+
}
|
|
21733
|
+
}
|
|
21734
|
+
};
|
|
21735
|
+
var previousLayerStoreOrder = previousLayerStoreOrderRef.current;
|
|
21736
|
+
adjustLayerOrderAtLevel(layerStoreOrder, previousLayerStoreOrder, mapHook.map);
|
|
21737
|
+
previousLayerStoreOrderRef.current = layerStoreOrder;
|
|
21738
|
+
}, [layerStoreOrder, mapHook.map]);
|
|
21739
|
+
var orderLayers = useMemo(function () {
|
|
21740
|
+
var layerIds = __spreadArray(__spreadArray([
|
|
21741
|
+
'order-background'
|
|
21742
|
+
], layerStoreOrderIds.map(function (el) { return 'layer_id_' + el; }), true), [
|
|
21743
|
+
'order-labels',
|
|
21744
|
+
], false);
|
|
21745
|
+
return layerIds;
|
|
21746
|
+
}, [layerStoreOrderIds]);
|
|
21747
|
+
function renderLayer(layer) {
|
|
21748
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l;
|
|
21749
|
+
var targetLayerIndex = layers.findIndex(function (el) { return el.uuid === layer.uuid; });
|
|
21750
|
+
var layerConfig = layers[targetLayerIndex];
|
|
21751
|
+
switch (layerConfig === null || layerConfig === void 0 ? void 0 : layerConfig.type) {
|
|
21752
|
+
case 'geojson':
|
|
21753
|
+
return (React__default.createElement(MlGeoJsonLayer, __assign({ key: layerConfig.uuid, layerId: layerConfig.uuid, insertBeforeLayer: 'layer_id_' + layerConfig.uuid }, layerConfig.config, { options: __assign(__assign({}, layerConfig.config.options), { layout: __assign(__assign({}, (_b = (_a = layerConfig === null || layerConfig === void 0 ? void 0 : layerConfig.config) === null || _a === void 0 ? void 0 : _a.options) === null || _b === void 0 ? void 0 : _b.layout), { visibility: layerConfig.masterVisible === false
|
|
21754
|
+
? 'none'
|
|
21755
|
+
: ((_e = (_d = (_c = layerConfig === null || layerConfig === void 0 ? void 0 : layerConfig.config) === null || _c === void 0 ? void 0 : _c.options) === null || _d === void 0 ? void 0 : _d.layout) === null || _e === void 0 ? void 0 : _e.visibility)
|
|
21756
|
+
? (_h = (_g = (_f = layerConfig === null || layerConfig === void 0 ? void 0 : layerConfig.config) === null || _f === void 0 ? void 0 : _f.options) === null || _g === void 0 ? void 0 : _g.layout) === null || _h === void 0 ? void 0 : _h.visibility
|
|
21757
|
+
: 'visible' }) }) })));
|
|
21758
|
+
case 'vt': {
|
|
21759
|
+
var l = layerConfig.config.layers.map(function (layer) {
|
|
21760
|
+
var _a;
|
|
21761
|
+
var newLayer = __assign({}, layer);
|
|
21762
|
+
if (newLayer.layout) {
|
|
21763
|
+
newLayer.layout = __assign(__assign({}, newLayer.layout), { visibility: newLayer.masterVisible === false ? 'none' : (_a = newLayer.layout.visibility) !== null && _a !== void 0 ? _a : 'visible' });
|
|
21764
|
+
}
|
|
21765
|
+
return newLayer;
|
|
21766
|
+
});
|
|
21767
|
+
return (React__default.createElement(MlVectorTileLayer, { key: layerConfig.uuid, layerId: layerConfig.uuid, insertBeforeLayer: 'layer_id_' + layerConfig.uuid, url: layerConfig.config.url, layers: l }));
|
|
21768
|
+
}
|
|
21769
|
+
case 'wms': {
|
|
21770
|
+
var visible = layerConfig.masterVisible === false ? false : (_j = layerConfig.config) === null || _j === void 0 ? void 0 : _j.visible;
|
|
21771
|
+
return (React__default.createElement(MlWmsLayer, { key: layerConfig.uuid, layerId: layerConfig.uuid, insertBeforeLayer: 'layer_id_' + layerConfig.uuid, url: ((_k = layerConfig.config) === null || _k === void 0 ? void 0 : _k.url) || '', urlParameters: (_l = layerConfig.config) === null || _l === void 0 ? void 0 : _l.urlParameters, visible: visible }));
|
|
21772
|
+
}
|
|
21773
|
+
case 'folder':
|
|
21774
|
+
return (layer === null || layer === void 0 ? void 0 : layer.layers) ? (layer.layers.map(function (subLayer) { return renderLayer(subLayer); })) : (React__default.createElement(React__default.Fragment, null));
|
|
21775
|
+
default:
|
|
21776
|
+
return null;
|
|
21777
|
+
}
|
|
21778
|
+
}
|
|
21779
|
+
return (React__default.createElement(React__default.Fragment, null,
|
|
21780
|
+
React__default.createElement(MlOrderLayers, { layerIds: orderLayers }), (_a = layerStoreOrder === null || layerStoreOrder === void 0 ? void 0 : layerStoreOrder.map) === null || _a === void 0 ? void 0 :
|
|
21781
|
+
_a.call(layerStoreOrder, function (layerOrderItem) { return renderLayer(layerOrderItem); })));
|
|
21782
|
+
}
|
|
21783
|
+
|
|
21784
|
+
var MapStore = {
|
|
21785
|
+
store: store,
|
|
21786
|
+
setMapConfig: setMapConfig,
|
|
21787
|
+
removeMapConfig: removeMapConfig,
|
|
21788
|
+
setLayerInMapConfig: setLayerInMapConfig,
|
|
21789
|
+
removeLayerFromMapConfig: removeLayerFromMapConfig,
|
|
21790
|
+
updateLayerOrder: updateLayerOrder,
|
|
21791
|
+
setMasterVisible: setMasterVisible,
|
|
21792
|
+
};
|
|
21793
|
+
|
|
21794
|
+
export { AddLayerButton, AddLayerPopup, CSVProtocolHandler, PaintPropsColorPicker$1 as ColorPicker, ConfirmDialog, GeoJsonContext, GeoJsonLayerForm, GeoJsonProvider, GruvboxStyle, LayerContext, LayerContextProvider, LayerList, LayerListFolder, LayerListItem, LayerListItemFactory, LayerListItemVectorLayer, LayerOnMap, LayerPropertyForm$1 as LayerPropertyForm, LayerTree, LayerTreeListItem, LayerTypeForm, MapComponentsProvider, MapContext, MapLibreGlWrapper, MapLibreMap, MapStore, MedievalKingdomStyle, MlCenterPosition, MlComponentTemplate, MlCreatePdfButton, MlCreatePdfForm, MlFeatureEditor, MlFillExtrusionLayer, MlFollowGps, MlGeoJsonLayer, MlGpxViewer, MlImageMarkerLayer, MlLayer, MlLayerMagnify, MlLayerSwipe, MlMarker, MlMeasureTool, MlMultiMeasureTool, MlNavigationCompass, MlNavigationTools, MlOgcApiFeatures, MlOrderLayers, PdfPreview as MlPdfPreview, MlScaleReference, MlShareMapState, MlSketchTool, MlSpatialElevationProfile, MlTemporalController, MlTerrainLayer, MlTransitionGeoJsonLayer, MlVectorTileLayer, MlWmsFeatureInfoPopup, MlWmsLayer, MlWmsLoader, MonokaiStyle, OSMProtocolHandler, OceanicNextStyle, PdfContext, PdfForm, SelectStyleButton, SelectStylePopup, Sidebar, SimpleDataContext, SimpleDataProvider, SolarizedStyle, SpeedDial, TopToolbar, TopojsonProtocolHandler, UploadButton, WmsLayerForm, XMLProtocolHandler, convertCsv, convertOSM, convertTopojson, convertXML, getTheme, useAddImage, useAddProtocol, useCameraFollowPath, useExportMap, useFeatureEditor, useFilterData, useGpx, useLayer, useLayerContext, useLayerEvent, useLayerFilter, LayerHoverPopup as useLayerHoverPopup, useMap, useMapState, useSource, useWms };
|
|
21164
21795
|
//# sourceMappingURL=index.esm.js.map
|