@opengeoweb/sigmet-airmet 6.0.3 → 6.1.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
|
@@ -4,15 +4,16 @@ import { FormControlLabel, Radio, Grid, Typography, Box as Box$2, Button, Checkb
|
|
|
4
4
|
import { useFormContext } from 'react-hook-form';
|
|
5
5
|
import { useDraftFormHelpers, ReactHookFormRadioGroup, ReactHookFormSelect, ReactHookFormNumberField, isInteger, isValidMax, isValidMin, isEmpty, ReactHookFormDateTime, isValidDate, isBefore, isBetween, hasMaxFeaturePoints, hasMulitpleIntersections, ReactHookFormHiddenInput, isMaximumOneDrawing, hasIntersectionWithFIR, isValidGeoJsonCoordinates, isXHoursBefore, isAfter, isXHoursAfter, ReactHookFormTextField, isLatitude, isNonOrBothCoordinates, isLongitude, ReactHookFormFormControl, isGeometryDirty, ReactHookFormProvider, defaultFormOptions } from '@opengeoweb/form-fields';
|
|
6
6
|
import { useApiContext, useApi, createApiInstance, createNonAuthApiInstance, createFakeApiInstance, ApiProvider } from '@opengeoweb/api';
|
|
7
|
-
import {
|
|
7
|
+
import { defaultIntersectionStyleProperties, defaultPoint, defaultBox, defaultPolygon, defaultDelete, MapControls, LayerManagerMapButtonConnect, LegendMapButtonConnect, MultiDimensionSelectMapButtonsConnect, MapViewConnect, MapViewLayer, TimeSliderConnect, LegendConnect, LayerManagerConnect, useMapDrawTool } from '@opengeoweb/core';
|
|
8
|
+
import { defaultStyleProperties, DRAWMODE, addFeatureProperties } from '@opengeoweb/webmap-react';
|
|
8
9
|
import { CustomTooltip, ToggleMenu, useIsMounted, StatusTag, AlertBanner, ConfirmationServiceProvider, usePreventBrowserClose, useConfirmationDialog, isAxiosError, getAxiosErrorMessage, usePoller, ErrorBoundary } from '@opengeoweb/shared';
|
|
9
10
|
import moment from 'moment';
|
|
10
11
|
import { polygonToLineString, booleanClockwise, rewind } from '@turf/turf';
|
|
11
|
-
import { layerTypes, mapSelectors, syncGroupsActions, mapStoreActions, defaultLayers, syncConstants } from '@opengeoweb/store';
|
|
12
12
|
import { DrawFIRLand, ChevronLeft, Edit, Success, Clock } from '@opengeoweb/theme';
|
|
13
|
+
import { LayerType, webmapUtils } from '@opengeoweb/webmap';
|
|
13
14
|
import { debounce } from 'lodash';
|
|
14
15
|
import 'react-dom';
|
|
15
|
-
import {
|
|
16
|
+
import { mapSelectors, syncGroupsActions, mapStoreActions, defaultLayers, syncConstants } from '@opengeoweb/store';
|
|
16
17
|
import { jsx } from 'react/jsx-runtime';
|
|
17
18
|
|
|
18
19
|
function _iterableToArrayLimit(arr, i) {
|
|
@@ -1291,7 +1292,7 @@ var getFieldLabel = function getFieldLabel(title, isDisabled) {
|
|
|
1291
1292
|
var getBaseLayers = function getBaseLayers(productConfig) {
|
|
1292
1293
|
var _a, _b;
|
|
1293
1294
|
return ((_b = (_a = productConfig.mapPreset) === null || _a === void 0 ? void 0 : _a.layers) === null || _b === void 0 ? void 0 : _b.filter(function (layer) {
|
|
1294
|
-
return layer.layerType ===
|
|
1295
|
+
return layer.layerType === LayerType.baseLayer || layer.layerType === LayerType.overLayer;
|
|
1295
1296
|
})) || [];
|
|
1296
1297
|
};
|
|
1297
1298
|
var getMaxMovementSpeedValue = function getMaxMovementSpeedValue(unit, selectedFIR, productConfig) {
|
|
@@ -3333,6 +3334,9 @@ var shouldRetrieveTAC = function shouldRetrieveTAC(product) {
|
|
|
3333
3334
|
return false;
|
|
3334
3335
|
};
|
|
3335
3336
|
var useTAC = function useTAC(initialProduct, getTAC) {
|
|
3337
|
+
var hasErrors = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : function () {
|
|
3338
|
+
return false;
|
|
3339
|
+
};
|
|
3336
3340
|
var _React$useState = React__default.useState(noTAC),
|
|
3337
3341
|
_React$useState2 = _slicedToArray(_React$useState, 2),
|
|
3338
3342
|
TAC = _React$useState2[0],
|
|
@@ -3369,25 +3373,35 @@ var useTAC = function useTAC(initialProduct, getTAC) {
|
|
|
3369
3373
|
}));
|
|
3370
3374
|
};
|
|
3371
3375
|
React__default.useEffect(function () {
|
|
3372
|
-
if (shouldRetrieveTAC(initialProduct)) {
|
|
3376
|
+
if (shouldRetrieveTAC(initialProduct) && !hasErrors()) {
|
|
3373
3377
|
retrieveTAC(initialProduct);
|
|
3374
3378
|
}
|
|
3375
3379
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
3376
3380
|
}, []);
|
|
3377
|
-
var update = function update(formValues) {
|
|
3378
|
-
if (shouldRetrieveTAC(formValues)) {
|
|
3381
|
+
var update = function update(formValues, hasFormErrors) {
|
|
3382
|
+
if (shouldRetrieveTAC(formValues) && !hasFormErrors) {
|
|
3379
3383
|
retrieveTAC(formValues);
|
|
3380
3384
|
} else if (isMounted.current) {
|
|
3381
3385
|
setTAC(noTAC);
|
|
3382
3386
|
}
|
|
3383
3387
|
};
|
|
3384
|
-
var
|
|
3385
|
-
return
|
|
3386
|
-
return
|
|
3387
|
-
|
|
3388
|
-
|
|
3389
|
-
|
|
3390
|
-
|
|
3388
|
+
var debouncedSearch = React__default.useRef(debounce(function (formFn, hasFormErrors) {
|
|
3389
|
+
return __awaiter(void 0, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee2() {
|
|
3390
|
+
return _regeneratorRuntime().wrap(function _callee2$(_context2) {
|
|
3391
|
+
while (1) switch (_context2.prev = _context2.next) {
|
|
3392
|
+
case 0:
|
|
3393
|
+
update(formFn(), hasFormErrors());
|
|
3394
|
+
case 1:
|
|
3395
|
+
case "end":
|
|
3396
|
+
return _context2.stop();
|
|
3397
|
+
}
|
|
3398
|
+
}, _callee2);
|
|
3399
|
+
}));
|
|
3400
|
+
}, 1000)).current;
|
|
3401
|
+
var delayedQuery = function delayedQuery(formFn) {
|
|
3402
|
+
debouncedSearch.cancel();
|
|
3403
|
+
debouncedSearch(formFn, hasErrors);
|
|
3404
|
+
};
|
|
3391
3405
|
return [TAC, delayedQuery];
|
|
3392
3406
|
};
|
|
3393
3407
|
var ProductFormTAC = function ProductFormTAC(_ref) {
|
|
@@ -8043,8 +8057,8 @@ var SigmetForm = function SigmetForm(_ref) {
|
|
|
8043
8057
|
api = _useApiContext.api;
|
|
8044
8058
|
var _useMapDrawTool = useMapDrawTool({
|
|
8045
8059
|
defaultEditModes: getDrawTools(StartOrEndDrawing.start, getFir(productConfig)),
|
|
8046
|
-
defaultGeoJSON: !isCancelSigmet && initialSigmet ? addFeatureProperties(initialSigmet.startGeometry, featurePropsStart) : undefined,
|
|
8047
|
-
defaultGeoJSONIntersection: !isCancelSigmet && initialSigmet ? addFeatureProperties(initialSigmet.startGeometryIntersect, featurePropsIntersectionStart) : undefined,
|
|
8060
|
+
defaultGeoJSON: !isCancelSigmet && initialSigmet && initialSigmet.startGeometry ? addFeatureProperties(initialSigmet.startGeometry, featurePropsStart) : undefined,
|
|
8061
|
+
defaultGeoJSONIntersection: !isCancelSigmet && initialSigmet && initialSigmet.startGeometryIntersect ? addFeatureProperties(initialSigmet.startGeometryIntersect, featurePropsIntersectionStart) : undefined,
|
|
8048
8062
|
defaultGeoJSONIntersectionBounds: addFeatureProperties(getFir(productConfig), featurePropsFIR)
|
|
8049
8063
|
}),
|
|
8050
8064
|
startGeoJSON = _useMapDrawTool.geoJSON,
|
|
@@ -8058,8 +8072,8 @@ var SigmetForm = function SigmetForm(_ref) {
|
|
|
8058
8072
|
setStartEditModes = _useMapDrawTool.setEditModes;
|
|
8059
8073
|
var _useMapDrawTool2 = useMapDrawTool({
|
|
8060
8074
|
defaultEditModes: getDrawTools(StartOrEndDrawing.end, getFir(productConfig)),
|
|
8061
|
-
defaultGeoJSON: !isCancelSigmet && initialSigmet ? addFeatureProperties(initialSigmet.endGeometry, featurePropsEnd) : undefined,
|
|
8062
|
-
defaultGeoJSONIntersection: !isCancelSigmet && initialSigmet ? addFeatureProperties(initialSigmet.endGeometryIntersect, featurePropsIntersectionEnd) : undefined,
|
|
8075
|
+
defaultGeoJSON: !isCancelSigmet && initialSigmet && initialSigmet.endGeometry ? addFeatureProperties(initialSigmet.endGeometry, featurePropsEnd) : undefined,
|
|
8076
|
+
defaultGeoJSONIntersection: !isCancelSigmet && initialSigmet && initialSigmet.endGeometryIntersect ? addFeatureProperties(initialSigmet.endGeometryIntersect, featurePropsIntersectionEnd) : undefined,
|
|
8063
8077
|
defaultGeoJSONIntersectionBounds: addFeatureProperties(getFir(productConfig), featurePropsFIR),
|
|
8064
8078
|
defaultGeoJSONIntersectionProperties: featurePropsIntersectionEnd
|
|
8065
8079
|
}),
|
|
@@ -8130,14 +8144,18 @@ var SigmetForm = function SigmetForm(_ref) {
|
|
|
8130
8144
|
var _useFormContext2 = useFormContext(),
|
|
8131
8145
|
watch = _useFormContext2.watch,
|
|
8132
8146
|
setValue = _useFormContext2.setValue,
|
|
8133
|
-
handleSubmit = _useFormContext2.handleSubmit
|
|
8147
|
+
handleSubmit = _useFormContext2.handleSubmit,
|
|
8148
|
+
errors = _useFormContext2.formState.errors;
|
|
8149
|
+
var getHasFormErrors = function getHasFormErrors() {
|
|
8150
|
+
return Object.keys(errors).length > 0;
|
|
8151
|
+
};
|
|
8134
8152
|
var _React$useState = React__default.useState(mode === 'view'),
|
|
8135
8153
|
_React$useState2 = _slicedToArray(_React$useState, 2),
|
|
8136
8154
|
isDisabled = _React$useState2[0],
|
|
8137
8155
|
setIsDisabled = _React$useState2[1];
|
|
8138
8156
|
var isReadOnly = mode === 'view';
|
|
8139
8157
|
var helperText = isDisabled ? '' : 'Optional';
|
|
8140
|
-
var _useTAC = useTAC(initialSigmet !== null ? initialSigmet : initialCancelSigmet, api.getSigmetTAC),
|
|
8158
|
+
var _useTAC = useTAC(initialSigmet !== null ? initialSigmet : initialCancelSigmet, api.getSigmetTAC, getHasFormErrors),
|
|
8141
8159
|
_useTAC2 = _slicedToArray(_useTAC, 2),
|
|
8142
8160
|
tac = _useTAC2[0],
|
|
8143
8161
|
updateTac = _useTAC2[1];
|
|
@@ -8333,8 +8351,8 @@ var AirmetForm = function AirmetForm(_ref) {
|
|
|
8333
8351
|
api = _useApiContext.api;
|
|
8334
8352
|
var _useMapDrawTool = useMapDrawTool({
|
|
8335
8353
|
defaultEditModes: getDrawTools(StartOrEndDrawing.start, getFir(productConfig)),
|
|
8336
|
-
defaultGeoJSON: !isCancelAirmet && initialAirmet ? addFeatureProperties(initialAirmet.startGeometry, featurePropsStart) : undefined,
|
|
8337
|
-
defaultGeoJSONIntersection: !isCancelAirmet && initialAirmet ? addFeatureProperties(initialAirmet.startGeometryIntersect, featurePropsIntersectionStart) : undefined,
|
|
8354
|
+
defaultGeoJSON: !isCancelAirmet && initialAirmet && initialAirmet.startGeometry ? addFeatureProperties(initialAirmet.startGeometry, featurePropsStart) : undefined,
|
|
8355
|
+
defaultGeoJSONIntersection: !isCancelAirmet && initialAirmet && initialAirmet.startGeometryIntersect ? addFeatureProperties(initialAirmet.startGeometryIntersect, featurePropsIntersectionStart) : undefined,
|
|
8338
8356
|
defaultGeoJSONIntersectionBounds: addFeatureProperties(getFir(productConfig), featurePropsFIR)
|
|
8339
8357
|
}),
|
|
8340
8358
|
startGeoJSON = _useMapDrawTool.geoJSON,
|
|
@@ -8378,14 +8396,18 @@ var AirmetForm = function AirmetForm(_ref) {
|
|
|
8378
8396
|
setValue = _useFormContext2.setValue,
|
|
8379
8397
|
handleSubmit = _useFormContext2.handleSubmit,
|
|
8380
8398
|
getValues = _useFormContext2.getValues,
|
|
8381
|
-
trigger = _useFormContext2.trigger
|
|
8399
|
+
trigger = _useFormContext2.trigger,
|
|
8400
|
+
errors = _useFormContext2.formState.errors;
|
|
8401
|
+
var getHasFormErrors = function getHasFormErrors() {
|
|
8402
|
+
return Object.keys(errors).length > 0;
|
|
8403
|
+
};
|
|
8382
8404
|
var _React$useState = React__default.useState(mode === 'view'),
|
|
8383
8405
|
_React$useState2 = _slicedToArray(_React$useState, 2),
|
|
8384
8406
|
isDisabled = _React$useState2[0],
|
|
8385
8407
|
setIsDisabled = _React$useState2[1];
|
|
8386
8408
|
var isReadOnly = mode === 'view';
|
|
8387
8409
|
var helperText = isDisabled ? '' : 'Optional';
|
|
8388
|
-
var _useTAC = useTAC(initialAirmet !== null ? initialAirmet : initialCancelAirmet, api.getAirmetTAC),
|
|
8410
|
+
var _useTAC = useTAC(initialAirmet !== null ? initialAirmet : initialCancelAirmet, api.getAirmetTAC, getHasFormErrors),
|
|
8389
8411
|
_useTAC2 = _slicedToArray(_useTAC, 2),
|
|
8390
8412
|
tac = _useTAC2[0],
|
|
8391
8413
|
updateTac = _useTAC2[1];
|
|
@@ -13748,7 +13770,7 @@ var CancelSigmetVolcanicMovements = function CancelSigmetVolcanicMovements(_ref)
|
|
|
13748
13770
|
key: "UNKNOWN",
|
|
13749
13771
|
value: "UNKNOWN",
|
|
13750
13772
|
control: /*#__PURE__*/React__default.createElement(Radio, null),
|
|
13751
|
-
label: "
|
|
13773
|
+
label: "Cancel VA SIGMET without VA MOV TO information"
|
|
13752
13774
|
})));
|
|
13753
13775
|
};
|
|
13754
13776
|
|
|
@@ -16429,7 +16451,7 @@ var getApiRoutes = function getApiRoutes(axiosInstance) {
|
|
|
16429
16451
|
case 0:
|
|
16430
16452
|
_context.next = 2;
|
|
16431
16453
|
return new Promise(function (resolve) {
|
|
16432
|
-
|
|
16454
|
+
setTimeout(resolve, 2000);
|
|
16433
16455
|
});
|
|
16434
16456
|
case 2:
|
|
16435
16457
|
return _context.abrupt("return", axiosInstance.get('/sigmetConfiguration').then(function () {
|
|
@@ -16451,7 +16473,7 @@ var getApiRoutes = function getApiRoutes(axiosInstance) {
|
|
|
16451
16473
|
case 0:
|
|
16452
16474
|
_context2.next = 2;
|
|
16453
16475
|
return new Promise(function (resolve) {
|
|
16454
|
-
|
|
16476
|
+
setTimeout(resolve, 2000);
|
|
16455
16477
|
});
|
|
16456
16478
|
case 2:
|
|
16457
16479
|
return _context2.abrupt("return", axiosInstance.get('/airmetConfiguration').then(function () {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@opengeoweb/sigmet-airmet",
|
|
3
|
-
"version": "6.0
|
|
3
|
+
"version": "6.1.0",
|
|
4
4
|
"description": "GeoWeb Sigmet/Airmet library for the opengeoweb project",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"repository": {
|
|
@@ -13,14 +13,15 @@
|
|
|
13
13
|
"dependencies": {
|
|
14
14
|
"@mui/material": "5.12.0",
|
|
15
15
|
"@mui/system": "5.14.5",
|
|
16
|
-
"@opengeoweb/api": "6.0
|
|
17
|
-
"@opengeoweb/authentication": "6.0
|
|
18
|
-
"@opengeoweb/core": "6.0
|
|
19
|
-
"@opengeoweb/form-fields": "6.0
|
|
20
|
-
"@opengeoweb/shared": "6.0
|
|
21
|
-
"@opengeoweb/store": "6.0
|
|
22
|
-
"@opengeoweb/theme": "6.0
|
|
23
|
-
"@opengeoweb/webmap": "6.0
|
|
16
|
+
"@opengeoweb/api": "6.1.0",
|
|
17
|
+
"@opengeoweb/authentication": "6.1.0",
|
|
18
|
+
"@opengeoweb/core": "6.1.0",
|
|
19
|
+
"@opengeoweb/form-fields": "6.1.0",
|
|
20
|
+
"@opengeoweb/shared": "6.1.0",
|
|
21
|
+
"@opengeoweb/store": "6.1.0",
|
|
22
|
+
"@opengeoweb/theme": "6.1.0",
|
|
23
|
+
"@opengeoweb/webmap": "6.1.0",
|
|
24
|
+
"@opengeoweb/webmap-react": "6.0.4",
|
|
24
25
|
"@redux-eggs/redux-toolkit": "2.2.0",
|
|
25
26
|
"@redux-eggs/saga-extension": "2.2.0",
|
|
26
27
|
"@reduxjs/toolkit": "1.9.5",
|
|
@@ -5,7 +5,7 @@ export declare const noTAC = "Missing data: no TAC can be generated";
|
|
|
5
5
|
export declare const shouldRetrieveTAC: (product: AviationProduct) => boolean;
|
|
6
6
|
export declare const useTAC: (initialProduct: AviationProduct, getTAC: (product: AviationProduct) => Promise<{
|
|
7
7
|
data: string;
|
|
8
|
-
}
|
|
8
|
+
}>, hasErrors?: () => boolean) => [string, any];
|
|
9
9
|
interface ProductFormTACProps {
|
|
10
10
|
tac: string;
|
|
11
11
|
}
|