@opengeoweb/warnings 14.2.2 → 14.3.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
|
@@ -2,7 +2,7 @@ import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
|
|
|
2
2
|
import { useDispatch, useSelector } from 'react-redux';
|
|
3
3
|
import { Polygons, ExitDomain, Share, Edit, Delete, CoastalEvent, TemperatureLow, TemperatureHigh, Rain, Snow, Lightning, Fog, Wind, Thunderstorm, SevereMountainWaves, VulcanicEruption, Haze, FreezingPrecipitation, ModerateAircraftIcing, SevereAircraftIcing, ModerateTurbulence, SevereTurbulence, SandStorm, RadioactiveMaterials, DrawPolygon, Visibility, Add, ArrowUpCompact, ArrowDownCompact, breakpoints, DragHandle, Info, Copy, Update, Cancel, Success, Expire, Remove, Options, ChevronDown, ChevronUp, Close, Clock } from '@opengeoweb/theme';
|
|
4
4
|
import { uiTypes, uiActions, getSingularDrawtoolDrawLayerId, drawingToolSelectors, layerSelectors, uiSelectors, drawingToolActions, layerActions, mapListener, layersListener, drawingToolListener, syncGroupsListener, openlayersListener, syncGroupsReducer, drawingToolReducer, uiReducer, layerReducer, mapReducer, useSetupDialog, genericSelectors, useUpdateSharedData, genericActions, selectorMemoizationOptions } from '@opengeoweb/store';
|
|
5
|
-
import { defaultPolygon, emptyGeoJSON, MapControlButton, getIcon, rewindGeometry, getGeoJSONPropertyValue,
|
|
5
|
+
import { defaultPolygon, getDrawModeIdFromSelectionType, currentlySupportedDrawModes, emptyGeoJSON, MapControlButton, defaultSmoothLine, defaultOval, defaultBox, defaultLocation, getIcon, defaultCircle, defaultSquare, defaultLineString, defaultPoint, rewindGeometry, getGeoJSONPropertyValue, defaultLayers, viewUtils, OpenLayersMapView, MapControls, OpenLayersZoomControl, OpenLayersLayer, OpenLayersFeatureLayer, genericOpenLayersFeatureStyle, FEATURE_DRAW_FILL_COLOR, FEATURE_DRAW_SECONDARY_FILL_COLOR } from '@opengeoweb/webmap-react';
|
|
6
6
|
import { SHARED_NAMESPACE, useConfirmationDialog, dateUtils, ToggleMenu, calculateStartSize, ToolContainerDraggable, AlertBanner, sessionStorageProvider, ConfirmationDialog, usePrevious, CustomIconButton, usePreventBrowserClose, CustomTooltip, Avatar, getInitials, SwitchButton, FilterChip, TooltipSelect, LastUpdateTime, CustomToggleButton, Filter, StatusTag, FilterOption, getAxiosErrorMessage, CustomDialog, ConfirmationButtons, ErrorBoundary } from '@opengeoweb/shared';
|
|
7
7
|
import { createEntityAdapter, createSlice, createSelector, createListenerMiddleware, current, combineReducers, configureStore } from '@reduxjs/toolkit';
|
|
8
8
|
import { defaultBbox } from '@opengeoweb/core';
|
|
@@ -1565,7 +1565,7 @@ var useObjectDrawDialogAction = function useObjectDrawDialogAction(_ref5) {
|
|
|
1565
1565
|
geoJSONLayerId: currentDrawLayerId
|
|
1566
1566
|
}));
|
|
1567
1567
|
// activate default draw mode
|
|
1568
|
-
if (!drawDialogActiveDrawModeId && !isDrawDialogOpen) {
|
|
1568
|
+
if (!drawDialogActiveDrawModeId && !isDrawDialogOpen && !newGeoJSON) {
|
|
1569
1569
|
dispatch(drawingToolActions.changeDrawToolMode({
|
|
1570
1570
|
drawToolId: drawingDialogType,
|
|
1571
1571
|
drawModeId: defaultPolygon.drawModeId
|
|
@@ -1596,10 +1596,18 @@ var useObjectDrawDialogAction = function useObjectDrawDialogAction(_ref5) {
|
|
|
1596
1596
|
}));
|
|
1597
1597
|
}
|
|
1598
1598
|
if (newGeoJSON) {
|
|
1599
|
+
var _newGeoJSON$features$;
|
|
1599
1600
|
dispatch(layerActions.layerChangeGeojson({
|
|
1600
1601
|
layerId: currentDrawLayerId,
|
|
1601
1602
|
geojson: newGeoJSON
|
|
1602
1603
|
}));
|
|
1604
|
+
// select correct drawTool for selected object
|
|
1605
|
+
var type = (_newGeoJSON$features$ = newGeoJSON.features[0].properties) == null ? void 0 : _newGeoJSON$features$.selectionType;
|
|
1606
|
+
var drawModeId = getDrawModeIdFromSelectionType(type, currentlySupportedDrawModes);
|
|
1607
|
+
dispatch(drawingToolActions.changeDrawToolMode({
|
|
1608
|
+
drawToolId: drawingDialogType,
|
|
1609
|
+
drawModeId: drawModeId
|
|
1610
|
+
}));
|
|
1603
1611
|
}
|
|
1604
1612
|
};
|
|
1605
1613
|
var _useCloseDrawDialog = useCloseDrawDialog({
|
|
@@ -3839,7 +3847,7 @@ var DEFAULT_DRAW_TOOL_POSITION = {
|
|
|
3839
3847
|
left: 50
|
|
3840
3848
|
};
|
|
3841
3849
|
var DEFAULT_DRAW_TOOL_MIN_SIZE = {
|
|
3842
|
-
width:
|
|
3850
|
+
width: 312,
|
|
3843
3851
|
height: 300
|
|
3844
3852
|
};
|
|
3845
3853
|
var DrawingTool = function DrawingTool(_ref) {
|
|
@@ -3960,7 +3968,39 @@ var useFormDirty = function useFormDirty(_ref) {
|
|
|
3960
3968
|
};
|
|
3961
3969
|
|
|
3962
3970
|
var opacityOptions = [100, 90, 80, 70, 60, 50, 40, 30, 20, 10, 0];
|
|
3971
|
+
var secondaryDrawToolKeys = [defaultSmoothLine.drawModeId, defaultOval.drawModeId, defaultBox.drawModeId, defaultLocation.drawModeId];
|
|
3972
|
+
// Utility to determine if the secondary draw mode button should be shown
|
|
3973
|
+
var getButtonStyle = function getButtonStyle(mode, activeDrawModeId, geoJSONDrawMode) {
|
|
3974
|
+
if (mode.drawModeId === defaultOval.drawModeId && (activeDrawModeId === defaultCircle.drawModeId || activeDrawModeId === defaultOval.drawModeId || geoJSONDrawMode === defaultOval.drawModeId)) {
|
|
3975
|
+
return {
|
|
3976
|
+
display: 'inline-flex',
|
|
3977
|
+
marginLeft: 15
|
|
3978
|
+
};
|
|
3979
|
+
}
|
|
3980
|
+
if (mode.drawModeId === defaultBox.drawModeId && (activeDrawModeId === defaultSquare.drawModeId || activeDrawModeId === defaultBox.drawModeId || geoJSONDrawMode === defaultBox.drawModeId)) {
|
|
3981
|
+
return {
|
|
3982
|
+
display: 'inline-flex',
|
|
3983
|
+
marginLeft: 20
|
|
3984
|
+
};
|
|
3985
|
+
}
|
|
3986
|
+
if (mode.drawModeId === defaultSmoothLine.drawModeId && (activeDrawModeId === defaultLineString.drawModeId || activeDrawModeId === defaultSmoothLine.drawModeId || geoJSONDrawMode === defaultSmoothLine.drawModeId)) {
|
|
3987
|
+
return {
|
|
3988
|
+
display: 'inline-flex',
|
|
3989
|
+
marginLeft: 5
|
|
3990
|
+
};
|
|
3991
|
+
}
|
|
3992
|
+
if (mode.drawModeId === defaultLocation.drawModeId && (activeDrawModeId === defaultPoint.drawModeId || activeDrawModeId === defaultLocation.drawModeId || geoJSONDrawMode === defaultLocation.drawModeId)) {
|
|
3993
|
+
return {
|
|
3994
|
+
display: 'inline-flex',
|
|
3995
|
+
marginLeft: 25
|
|
3996
|
+
};
|
|
3997
|
+
}
|
|
3998
|
+
return {
|
|
3999
|
+
display: 'none'
|
|
4000
|
+
};
|
|
4001
|
+
};
|
|
3963
4002
|
var DrawingToolFormContentsNoMemo = function DrawingToolFormContentsNoMemo(_ref) {
|
|
4003
|
+
var _geoJSON$features;
|
|
3964
4004
|
var isLoading = _ref.isLoading,
|
|
3965
4005
|
dialogError = _ref.dialogError,
|
|
3966
4006
|
id = _ref.id,
|
|
@@ -3973,10 +4013,18 @@ var DrawingToolFormContentsNoMemo = function DrawingToolFormContentsNoMemo(_ref)
|
|
|
3973
4013
|
onChangeOpacity = _ref.onChangeOpacity,
|
|
3974
4014
|
onBlurName = _ref.onBlurName,
|
|
3975
4015
|
opacity = _ref.opacity,
|
|
3976
|
-
onSubmit = _ref.onSubmit
|
|
4016
|
+
onSubmit = _ref.onSubmit,
|
|
4017
|
+
geoJSON = _ref.geoJSON;
|
|
3977
4018
|
var _useWarningsTranslati = useWarningsTranslation(),
|
|
3978
4019
|
t = _useWarningsTranslati.t;
|
|
3979
4020
|
var hasErrors = Object.keys(errors).length > 0;
|
|
4021
|
+
var drawModesPrimary = drawModes.filter(function (mode) {
|
|
4022
|
+
return !secondaryDrawToolKeys.includes(mode.drawModeId);
|
|
4023
|
+
});
|
|
4024
|
+
var drawModesSecondary = drawModes.filter(function (mode) {
|
|
4025
|
+
return secondaryDrawToolKeys.includes(mode.drawModeId);
|
|
4026
|
+
});
|
|
4027
|
+
var geoJSONDrawMode = getDrawModeIdFromSelectionType(geoJSON == null || (_geoJSON$features = geoJSON.features) == null || (_geoJSON$features = _geoJSON$features[0]) == null || (_geoJSON$features = _geoJSON$features.properties) == null ? void 0 : _geoJSON$features.selectionType, drawModes);
|
|
3980
4028
|
return jsxs(Fragment, {
|
|
3981
4029
|
children: [jsxs(Box, {
|
|
3982
4030
|
sx: {
|
|
@@ -4005,7 +4053,7 @@ var DrawingToolFormContentsNoMemo = function DrawingToolFormContentsNoMemo(_ref)
|
|
|
4005
4053
|
}), jsx(Grid, {
|
|
4006
4054
|
container: true,
|
|
4007
4055
|
children: jsxs(Grid, {
|
|
4008
|
-
children: [
|
|
4056
|
+
children: [drawModesPrimary.map(function (mode) {
|
|
4009
4057
|
return jsx(CustomIconButton, {
|
|
4010
4058
|
variant: "tool",
|
|
4011
4059
|
tooltipTitle: mode.title,
|
|
@@ -4022,6 +4070,25 @@ var DrawingToolFormContentsNoMemo = function DrawingToolFormContentsNoMemo(_ref)
|
|
|
4022
4070
|
size: "medium",
|
|
4023
4071
|
children: getIcon(mode.selectionType)
|
|
4024
4072
|
}, mode.drawModeId);
|
|
4073
|
+
}), drawModesSecondary.length > 0 && jsx(Box, {
|
|
4074
|
+
children: drawModesSecondary.map(function (mode) {
|
|
4075
|
+
return jsx(CustomIconButton, {
|
|
4076
|
+
variant: "tool",
|
|
4077
|
+
tooltipTitle: mode.title,
|
|
4078
|
+
isSelected: mode.isSelectable && activeDrawModeId === mode.drawModeId,
|
|
4079
|
+
onClick: function onClick() {
|
|
4080
|
+
return onChangeDrawMode(mode);
|
|
4081
|
+
},
|
|
4082
|
+
sx: Object.assign({
|
|
4083
|
+
marginRight: 1,
|
|
4084
|
+
marginBottom: 1
|
|
4085
|
+
}, getButtonStyle(mode, activeDrawModeId, geoJSONDrawMode)),
|
|
4086
|
+
"data-testid": mode.drawModeId,
|
|
4087
|
+
disabled: isLoading,
|
|
4088
|
+
size: "medium",
|
|
4089
|
+
children: getIcon(mode.selectionType)
|
|
4090
|
+
}, mode.drawModeId);
|
|
4091
|
+
})
|
|
4025
4092
|
}), isInEditMode && jsx(Typography, {
|
|
4026
4093
|
component: "span",
|
|
4027
4094
|
sx: {
|
|
@@ -4230,7 +4297,8 @@ var DrawingToolForm = function DrawingToolForm(_ref) {
|
|
|
4230
4297
|
onChangeOpacity: onChangeOpacity,
|
|
4231
4298
|
onBlurName: onBlurName,
|
|
4232
4299
|
opacity: opacity,
|
|
4233
|
-
onSubmit: handleSubmit(onSubmit)
|
|
4300
|
+
onSubmit: handleSubmit(onSubmit),
|
|
4301
|
+
geoJSON: geoJSON
|
|
4234
4302
|
});
|
|
4235
4303
|
};
|
|
4236
4304
|
var Wrapper = function Wrapper(props) {
|
|
@@ -8259,9 +8327,9 @@ isAviationWarning) {
|
|
|
8259
8327
|
var _feature$properties$i, _feature$properties;
|
|
8260
8328
|
var isStartGeometry = (_feature$properties$i = (_feature$properties = feature.properties) == null ? void 0 : _feature$properties.isStartGeometry) != null ? _feature$properties$i : false;
|
|
8261
8329
|
colors = {
|
|
8262
|
-
color: isStartGeometry ?
|
|
8330
|
+
color: isStartGeometry ? FEATURE_DRAW_FILL_COLOR : FEATURE_DRAW_SECONDARY_FILL_COLOR,
|
|
8263
8331
|
// Orange for start, purple for end
|
|
8264
|
-
borderColor: isStartGeometry ?
|
|
8332
|
+
borderColor: isStartGeometry ? FEATURE_DRAW_FILL_COLOR : FEATURE_DRAW_SECONDARY_FILL_COLOR
|
|
8265
8333
|
};
|
|
8266
8334
|
} else if (level) {
|
|
8267
8335
|
// Public warning: use LevelColors if level is defined
|
|
@@ -9788,14 +9856,14 @@ var getFilterParams = function getFilterParams(areas, searchQuery) {
|
|
|
9788
9856
|
search: searchQuery
|
|
9789
9857
|
});
|
|
9790
9858
|
};
|
|
9791
|
-
var useAreaRequest = function useAreaRequest() {
|
|
9859
|
+
var useAreaRequest = function useAreaRequest(isDialogOpen) {
|
|
9792
9860
|
var _useState = useState([]),
|
|
9793
9861
|
areas = _useState[0],
|
|
9794
9862
|
setAreas = _useState[1];
|
|
9795
9863
|
var _useState2 = useState(undefined),
|
|
9796
9864
|
fetchAreaError = _useState2[0],
|
|
9797
9865
|
setFetchAreaError = _useState2[1];
|
|
9798
|
-
var _useAreaKeywords = useAreaKeywords(),
|
|
9866
|
+
var _useAreaKeywords = useAreaKeywords(isDialogOpen),
|
|
9799
9867
|
areaKeywords = _useAreaKeywords.data,
|
|
9800
9868
|
isAreasLoading = _useAreaKeywords.isLoading,
|
|
9801
9869
|
error = _useAreaKeywords.error,
|
|
@@ -9854,7 +9922,7 @@ var AreaObjectLoaderConnect = function AreaObjectLoaderConnect(_ref) {
|
|
|
9854
9922
|
var _useState5 = useState(''),
|
|
9855
9923
|
searchQuery = _useState5[0],
|
|
9856
9924
|
setSearchQuery = _useState5[1];
|
|
9857
|
-
var _useAreaRequest = useAreaRequest(),
|
|
9925
|
+
var _useAreaRequest = useAreaRequest(isDialogOpen),
|
|
9858
9926
|
areas = _useAreaRequest.areas,
|
|
9859
9927
|
fetchAreaKeywords = _useAreaRequest.fetchAreaKeywords,
|
|
9860
9928
|
fetchAreaError = _useAreaRequest.fetchAreaError,
|
|
@@ -9875,7 +9943,7 @@ var AreaObjectLoaderConnect = function AreaObjectLoaderConnect(_ref) {
|
|
|
9875
9943
|
var isAviationWarning = (selectedWarning == null ? void 0 : selectedWarning.warningDetail.level) === 'SIG' || (selectedWarning == null ? void 0 : selectedWarning.warningDetail.level) === 'AIR';
|
|
9876
9944
|
var styledGeoJSON = warningLevelFeatureColors(selectedWarning == null || (_selectedWarning$warn = selectedWarning.warningDetail) == null ? void 0 : _selectedWarning$warn.level, selectedWarning == null || (_selectedWarning$warn2 = selectedWarning.warningDetail) == null || (_selectedWarning$warn2 = _selectedWarning$warn2.areas) == null || (_selectedWarning$warn2 = _selectedWarning$warn2[0]) == null ? void 0 : _selectedWarning$warn2.geoJSON, isAviationWarning);
|
|
9877
9945
|
// Inject warning level into feature properties to be read in OlMapViewConnect
|
|
9878
|
-
if (styledGeoJSON && (_styledGeoJSON$featur = styledGeoJSON.features) != null && _styledGeoJSON$featur.length) {
|
|
9946
|
+
if (styledGeoJSON != null && (_styledGeoJSON$featur = styledGeoJSON.features) != null && _styledGeoJSON$featur.length) {
|
|
9879
9947
|
styledGeoJSON.features.forEach(function (feature) {
|
|
9880
9948
|
// eslint-disable-next-line no-param-reassign
|
|
9881
9949
|
feature.properties = Object.assign({}, feature.properties, {
|
|
@@ -9885,10 +9953,10 @@ var AreaObjectLoaderConnect = function AreaObjectLoaderConnect(_ref) {
|
|
|
9885
9953
|
});
|
|
9886
9954
|
}
|
|
9887
9955
|
var sharedData = React__default.useMemo(function () {
|
|
9888
|
-
var _selectedWarning$warn3;
|
|
9956
|
+
var _selectedWarning$warn3, _selectedWarning$warn4;
|
|
9889
9957
|
return {
|
|
9890
9958
|
features: [{
|
|
9891
|
-
id: (selectedWarning == null || (_selectedWarning$
|
|
9959
|
+
id: (_selectedWarning$warn3 = selectedWarning == null || (_selectedWarning$warn4 = selectedWarning.warningDetail.areas) == null || (_selectedWarning$warn4 = _selectedWarning$warn4[0]) == null ? void 0 : _selectedWarning$warn4.areaId) != null ? _selectedWarning$warn3 : '',
|
|
9892
9960
|
geoJSON: styledGeoJSON
|
|
9893
9961
|
}]
|
|
9894
9962
|
};
|
|
@@ -9995,8 +10063,8 @@ var AreaObjectLoaderConnect = function AreaObjectLoaderConnect(_ref) {
|
|
|
9995
10063
|
left: 50
|
|
9996
10064
|
},
|
|
9997
10065
|
drawingListItems: items,
|
|
9998
|
-
error: drawingError
|
|
9999
|
-
isLoading: loading
|
|
10066
|
+
error: drawingError != null ? drawingError : fetchAreaError,
|
|
10067
|
+
isLoading: loading != null ? loading : isAreasLoading,
|
|
10000
10068
|
onClickFilterChip: onClickFilterChip,
|
|
10001
10069
|
searchQuery: searchQuery,
|
|
10002
10070
|
onSearch: onSearch,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@opengeoweb/warnings",
|
|
3
|
-
"version": "14.
|
|
3
|
+
"version": "14.3.0",
|
|
4
4
|
"description": "GeoWeb warinings library for the opengeoweb project",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"repository": {
|
|
@@ -8,25 +8,25 @@
|
|
|
8
8
|
"url": "git@gitlab.com:opengeoweb/opengeoweb.git"
|
|
9
9
|
},
|
|
10
10
|
"dependencies": {
|
|
11
|
-
"@opengeoweb/api": "14.
|
|
12
|
-
"@opengeoweb/shared": "14.
|
|
13
|
-
"@opengeoweb/store": "14.
|
|
14
|
-
"@opengeoweb/webmap-react": "14.
|
|
11
|
+
"@opengeoweb/api": "14.3.0",
|
|
12
|
+
"@opengeoweb/shared": "14.3.0",
|
|
13
|
+
"@opengeoweb/store": "14.3.0",
|
|
14
|
+
"@opengeoweb/webmap-react": "14.3.0",
|
|
15
15
|
"@tanstack/react-query": "^5.85.5",
|
|
16
16
|
"react-redux": "^9.2.0",
|
|
17
|
-
"@opengeoweb/theme": "14.
|
|
18
|
-
"@opengeoweb/form-fields": "14.
|
|
17
|
+
"@opengeoweb/theme": "14.3.0",
|
|
18
|
+
"@opengeoweb/form-fields": "14.3.0",
|
|
19
19
|
"react-hook-form": "^7.50.1",
|
|
20
20
|
"lodash": "^4.17.21",
|
|
21
21
|
"@reduxjs/toolkit": "^2.6.1",
|
|
22
|
-
"@opengeoweb/snackbar": "14.
|
|
22
|
+
"@opengeoweb/snackbar": "14.3.0",
|
|
23
23
|
"react-window": "^1.8.10",
|
|
24
24
|
"react-virtualized-auto-sizer": "^1.0.20",
|
|
25
25
|
"axios": "^1.7.7",
|
|
26
|
-
"@opengeoweb/core": "14.
|
|
27
|
-
"@opengeoweb/webmap": "14.
|
|
28
|
-
"@opengeoweb/authentication": "14.
|
|
29
|
-
"@opengeoweb/sigmet-airmet": "14.
|
|
26
|
+
"@opengeoweb/core": "14.3.0",
|
|
27
|
+
"@opengeoweb/webmap": "14.3.0",
|
|
28
|
+
"@opengeoweb/authentication": "14.3.0",
|
|
29
|
+
"@opengeoweb/sigmet-airmet": "14.3.0",
|
|
30
30
|
"react-i18next": "^15.1.1",
|
|
31
31
|
"i18next": "^25.0.1",
|
|
32
32
|
"@mui/material": "^7.0.1",
|
|
@@ -22,6 +22,7 @@ export interface DrawingToolFormContentsProps {
|
|
|
22
22
|
onChangeOpacity: (event: SelectChangeEvent<unknown>) => void;
|
|
23
23
|
onBlurName: (event: React.FocusEvent<HTMLInputElement>) => void;
|
|
24
24
|
onSubmit: () => void;
|
|
25
|
+
geoJSON?: GeoJSON.FeatureCollection;
|
|
25
26
|
}
|
|
26
27
|
export declare const DrawingToolFormContentsNoMemo: React.FC<DrawingToolFormContentsProps>;
|
|
27
28
|
export declare const DrawingToolFormContents: React.NamedExoticComponent<DrawingToolFormContentsProps>;
|