@opengeoweb/sigmet-airmet 9.20.2 → 9.22.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
@@ -3,7 +3,7 @@ import * as React from 'react';
3
3
  import React__default from 'react';
4
4
  import { FormControlLabel, Radio, Grid, Typography, Box, Button, Checkbox, MenuItem, FormHelperText, useTheme, Dialog, DialogTitle, DialogContent, Card, LinearProgress, List, ListItemButton, Backdrop, CircularProgress } from '@mui/material';
5
5
  import { useFormContext } from 'react-hook-form';
6
- import { useDraftFormHelpers, ReactHookFormRadioGroup, hasValidGeometry, ReactHookFormSelect, ReactHookFormNumberField, isInteger, isValidMax, isValidMin, isEmpty, ReactHookFormDateTime, hasMulitpleIntersections, ReactHookFormHiddenInput, isMaximumOneDrawing, hasIntersectionWithFIR, isValidGeoJsonCoordinates, isXHoursBefore, isXHoursAfter, ReactHookFormTextField, isLatitude, isNonOrBothCoordinates, isLongitude, ReactHookFormFormControl, isGeometryDirty, ReactHookFormProvider, defaultFormOptions } from '@opengeoweb/form-fields';
6
+ import { useDraftFormHelpers, ReactHookFormRadioGroup, hasValidGeometry, ReactHookFormSelect, ReactHookFormNumberField, isInteger, isValidMax, isValidMin, isEmpty, ReactHookFormDateTime, countIntersectionPoints, hasMulitpleIntersections, ReactHookFormHiddenInput, isMaximumOneDrawing, hasIntersectionWithFIR, isValidGeoJsonCoordinates, isXHoursBefore, isXHoursAfter, ReactHookFormTextField, isLatitude, isNonOrBothCoordinates, isLongitude, ReactHookFormFormControl, isGeometryDirty, ReactHookFormProvider, defaultFormOptions } from '@opengeoweb/form-fields';
7
7
  import { useApiContext, useApi, createApiInstance, createNonAuthApiInstance, createFakeApiInstance, ApiProvider } from '@opengeoweb/api';
8
8
  import { defaultGeoJSONStyleProperties, defaultIntersectionStyleProperties, defaultPoint, addGeoJSONProperties, defaultBox, defaultPolygon, DRAWMODE, addSelectionTypeToGeoJSON, defaultDelete, getIcon, MapControls, MapViewLayer, useMapDrawTool, addFeatureProperties, rewindGeometry } from '@opengeoweb/webmap-react';
9
9
  import { dateUtils, ToggleMenu, CustomTooltip, useIsMounted, StatusTag, AlertBanner, ConfirmationServiceProvider, usePreventBrowserClose, useConfirmationDialog, isAxiosError, getAxiosErrorMessage, usePoller, ErrorBoundary } from '@opengeoweb/shared';
@@ -15,6 +15,8 @@ import { mapSelectors, syncGroupsActions, mapStoreActions, defaultLayers, syncCo
15
15
  import { LayerManagerMapButtonConnect, LegendMapButtonConnect, MultiDimensionSelectMapButtonsConnect, MapViewConnect, TimeSliderConnect, LegendConnect, LayerManagerConnect } from '@opengeoweb/core';
16
16
  import { useAuthenticationContext } from '@opengeoweb/authentication';
17
17
  import { Box as Box$1 } from '@mui/system';
18
+ import 'i18next';
19
+ import 'react-i18next';
18
20
 
19
21
  var en = {
20
22
  "sigmet-airmet": "sigmet"
@@ -28,7 +30,7 @@ var no = {
28
30
  var nl = {
29
31
  "sigmet-airmet": "sigmet"
30
32
  };
31
- var sigmetAirmet = {
33
+ var sigmetAirmetTranslations = {
32
34
  en: en,
33
35
  fi: fi,
34
36
  no: no,
@@ -3696,6 +3698,7 @@ const StartGeometry = ({
3696
3698
  geoJSONIntersection,
3697
3699
  productConfig
3698
3700
  }) => {
3701
+ var _a, _b;
3699
3702
  const {
3700
3703
  formState: {
3701
3704
  errors
@@ -3710,9 +3713,25 @@ const StartGeometry = ({
3710
3713
  isShortTest
3711
3714
  } = useShortTestHelpers();
3712
3715
  const getFIRValue = () => getValues('locationIndicatorATSR');
3716
+ // Max points the FIR allows for a polygon
3713
3717
  const maxPoints = getMaxPolygonPoints(getFIRValue(), productConfig);
3718
+ // Intersections with FIR
3719
+ const intersectionPointCount = countIntersectionPoints(geoJSON, geoJSONIntersection);
3720
+ const drawnGeometry = (_a = geoJSON === null || geoJSON === void 0 ? void 0 : geoJSON.features[0]) === null || _a === void 0 ? void 0 : _a.geometry;
3721
+ const interceptionGeometry = (_b = geoJSONIntersection === null || geoJSONIntersection === void 0 ? void 0 : geoJSONIntersection.features[0]) === null || _b === void 0 ? void 0 : _b.geometry;
3722
+ // Total points in the user drawn polygon
3723
+ const totalDrawnPoints = drawnGeometry && drawnGeometry.coordinates[0] ? drawnGeometry.coordinates[0].length : 0;
3724
+ // Total points in the intersection polygon
3725
+ const intersectingPolygonPointsTotal = interceptionGeometry && interceptionGeometry.coordinates[0] ? interceptionGeometry.coordinates[0].length : 0;
3714
3726
  const maximumPointsMessage = `The start position drawing allows a maximum of ${maxPoints - 1} individual points`;
3715
- const showMaxFeaturePointsWarning = hasMaxFeaturePoints(geoJSONIntersection, 7) && !activeTool && !errors.startGeometry && !isFir(geoJSON);
3727
+ const moreThan6PointsMessage = `The start/end position drawing has exceeded 6 individual points. The TAC has a total of ${totalDrawnPoints} points. If possible, reduce the number of points.`;
3728
+ const intersectionAbove6PointsMessage = `The start/end position of the intersected polygon has
3729
+ ${intersectingPolygonPointsTotal} points,
3730
+ and the intersection of the drawn polygon with the FIR-boundary has exceeded 6 individual points.
3731
+ Check if the TAC in the preview corresponds to the intended area.`;
3732
+ const showMaxFeaturePointsWarning = intersectionPointCount > 7 && hasMaxFeaturePoints(geoJSONIntersection, maxPoints) && !activeTool && !errors.startGeometry && !isFir(geoJSON);
3733
+ const showMoreThan6PointsWarning = totalDrawnPoints > 7 && intersectionPointCount < 1 && !activeTool && !errors.startGeometry && !isFir(geoJSON);
3734
+ const showIntersectionAbove6PointsWarning = intersectingPolygonPointsTotal > 7 && intersectionPointCount > 6 && maxPoints > 7 && !activeTool && !errors.startGeometry && !isFir(geoJSON);
3716
3735
  return !_isReadOnly ? jsxs(ProductFormFieldLayout, Object.assign({
3717
3736
  title: "Start position",
3718
3737
  sx: styles$2.drawSection,
@@ -3738,6 +3757,16 @@ const StartGeometry = ({
3738
3757
  variant: "filled"
3739
3758
  }, {
3740
3759
  children: maxFeaturePointsMessage
3760
+ })), /* non-blocking warnings */
3761
+ showMoreThan6PointsWarning && jsx(FormHelperText, Object.assign({
3762
+ variant: "filled"
3763
+ }, {
3764
+ children: moreThan6PointsMessage
3765
+ })), /* non-blocking warnings */
3766
+ showIntersectionAbove6PointsWarning && jsx(FormHelperText, Object.assign({
3767
+ variant: "filled"
3768
+ }, {
3769
+ children: intersectionAbove6PointsMessage
3741
3770
  })), hasMulitpleIntersections(geoJSONIntersection) && !activeTool && !errors.startGeometry && !isFir(geoJSON) && jsx(FormHelperText, Object.assign({
3742
3771
  variant: "filled"
3743
3772
  }, {
@@ -3796,6 +3825,7 @@ const Progress = ({
3796
3825
  geoJSON,
3797
3826
  geoJSONIntersection
3798
3827
  }) => {
3828
+ var _a, _b;
3799
3829
  const {
3800
3830
  watch,
3801
3831
  getValues,
@@ -3833,8 +3863,25 @@ const Progress = ({
3833
3863
  const isVolcanicCloud = watch('phenomenon') === 'VA_CLD';
3834
3864
  const isShortTestOrRdoact = isShortTest() || isRadioactiveCloud;
3835
3865
  const fieldsDisabled = _isDisabled || isShortTestOrRdoact;
3866
+ // Max points the FIR allows for a polygon
3836
3867
  const maxPoints = getMaxPolygonPoints(getFIRValue(), productConfig);
3868
+ // Intersections with FIR
3869
+ const intersectionPointCount = countIntersectionPoints(geoJSON, geoJSONIntersection);
3870
+ const drawnGeometry = (_a = geoJSON === null || geoJSON === void 0 ? void 0 : geoJSON.features[0]) === null || _a === void 0 ? void 0 : _a.geometry;
3871
+ const interceptionGeometry = (_b = geoJSONIntersection === null || geoJSONIntersection === void 0 ? void 0 : geoJSONIntersection.features[0]) === null || _b === void 0 ? void 0 : _b.geometry;
3872
+ // Total points in the user drawn polygon
3873
+ const totalDrawnPoints = drawnGeometry && drawnGeometry.coordinates[0] ? drawnGeometry.coordinates[0].length : 0;
3874
+ // Total points in the intersection polygon
3875
+ const intersectingPolygonPointsTotal = interceptionGeometry && interceptionGeometry.coordinates[0] ? interceptionGeometry.coordinates[0].length : 0;
3837
3876
  const maximumPointsMessage = `The end position drawing allows a maximum of ${maxPoints - 1} individual points`;
3877
+ const moreThan6PointsMessage = `The start/end position drawing has exceeded 6 individual points. The TAC has a total of ${totalDrawnPoints} points. If possible, reduce the number of points.`;
3878
+ const intersectionAbove6PointsMessage = `The start/end position of the intersected polygon has
3879
+ ${intersectingPolygonPointsTotal} points,
3880
+ and the intersection of the drawn polygon with the FIR-boundary has exceeded 6 individual points.
3881
+ Check if the TAC in the preview corresponds to the intended area.`;
3882
+ const showMaxFeaturePointsWarning = intersectionPointCount > 7 && hasMaxFeaturePoints(geoJSONIntersection, maxPoints) && !activeTool && !errors.startGeometry && !isFir(geoJSON);
3883
+ const showMoreThan6PointsWarning = totalDrawnPoints > 7 && intersectionPointCount < 1 && !activeTool && !errors.startGeometry && !isFir(geoJSON);
3884
+ const showIntersectionAbove6PointsWarning = intersectingPolygonPointsTotal > 7 && intersectionPointCount > 6 && maxPoints > 7 && !activeTool && !errors.startGeometry && !isFir(geoJSON);
3838
3885
  return jsx(ProductFormFieldLayout, Object.assign({
3839
3886
  title: "Progress",
3840
3887
  sx: styles$2.containerItem
@@ -4005,10 +4052,20 @@ const Progress = ({
4005
4052
  }, {
4006
4053
  children: errors.endGeometry.message
4007
4054
  })), /* non-blocking warnings */
4008
- hasMaxFeaturePoints(geoJSONIntersection, 7) && !activeTool && !errors.endGeometry && !isFir(geoJSON) && jsx(FormHelperText, Object.assign({
4055
+ showMaxFeaturePointsWarning && jsx(FormHelperText, Object.assign({
4009
4056
  variant: "filled"
4010
4057
  }, {
4011
4058
  children: maxFeaturePointsMessage
4059
+ })), /* non-blocking warnings */
4060
+ showMoreThan6PointsWarning && jsx(FormHelperText, Object.assign({
4061
+ variant: "filled"
4062
+ }, {
4063
+ children: moreThan6PointsMessage
4064
+ })), /* non-blocking warnings */
4065
+ showIntersectionAbove6PointsWarning && jsx(FormHelperText, Object.assign({
4066
+ variant: "filled"
4067
+ }, {
4068
+ children: intersectionAbove6PointsMessage
4012
4069
  })), hasMulitpleIntersections(geoJSONIntersection) && !activeTool && !errors.endGeometry && !isFir(geoJSON) && jsx(FormHelperText, Object.assign({
4013
4070
  variant: "filled"
4014
4071
  }, {
@@ -14539,4 +14596,6 @@ ConnectedModuleWrapper = null) => {
14539
14596
  }
14540
14597
  };
14541
14598
 
14542
- export { AirmetComponentsLookUp, AirmetForm, AirmetPhenomena, AirmetType, CloudLevelUnits, ContentDialog, Direction, DownloadSigmetAirmetConfigWrapper, LevelUnits, MapViewGeoJson, MetInfoWrapper, MovementUnit, ProductList, ProductListRow, ProductStatusDescription, SigmetComponentsLookUp, SigmetForm, SigmetPhenomena, SigmetType, StartOrEndDrawing, VisibilityCause, WindUnit, airmetConfig, createApi$1 as createApi, createApi as createFakeApi, isInstanceOfAirmet, isInstanceOfCancelAirmet, isInstanceOfCancelSigmet, isInstanceOfCancelSigmetOrAirmet, isInstanceOfSigmet, isInstanceOfSigmetOrAirmet, sigmetAirmet as saTranslations, sigmetConfig };
14599
+ const SA_NAMESPACE = 'sigmetairmet';
14600
+
14601
+ export { AirmetComponentsLookUp, AirmetForm, AirmetPhenomena, AirmetType, CloudLevelUnits, ContentDialog, Direction, DownloadSigmetAirmetConfigWrapper, LevelUnits, MapViewGeoJson, MetInfoWrapper, MovementUnit, ProductList, ProductListRow, ProductStatusDescription, SA_NAMESPACE, SigmetComponentsLookUp, SigmetForm, SigmetPhenomena, SigmetType, StartOrEndDrawing, VisibilityCause, WindUnit, airmetConfig, createApi$1 as createApi, createApi as createFakeApi, isInstanceOfAirmet, isInstanceOfCancelAirmet, isInstanceOfCancelSigmet, isInstanceOfCancelSigmetOrAirmet, isInstanceOfSigmet, isInstanceOfSigmetOrAirmet, sigmetAirmetTranslations as saTranslations, sigmetConfig };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@opengeoweb/sigmet-airmet",
3
- "version": "9.20.2",
3
+ "version": "9.22.0",
4
4
  "description": "GeoWeb Sigmet/Airmet library for the opengeoweb project",
5
5
  "license": "Apache-2.0",
6
6
  "repository": {
@@ -10,7 +10,7 @@
10
10
  "dependencies": {
11
11
  "@opengeoweb/api": "*",
12
12
  "@opengeoweb/shared": "*",
13
- "@mui/material": "~5.15.11",
13
+ "@mui/material": "^5.16.0",
14
14
  "@opengeoweb/theme": "*",
15
15
  "@opengeoweb/store": "*",
16
16
  "@opengeoweb/webmap": "*",
@@ -26,8 +26,8 @@
26
26
  "@redux-eggs/redux-toolkit": "^2.2.0",
27
27
  "@redux-eggs/saga-extension": "^2.2.0",
28
28
  "@reduxjs/toolkit": "^1.9.7",
29
- "i18next": "^23.7.11",
30
- "react-i18next": "^13.5.0"
29
+ "i18next": "^23.11.5",
30
+ "react-i18next": "^14.1.2"
31
31
  },
32
32
  "peerDependencies": {
33
33
  "react": "18"
package/src/index.d.ts CHANGED
@@ -9,4 +9,5 @@ export { createApi as createFakeApi } from './lib/utils/fakeApi';
9
9
  export { sigmetConfig, airmetConfig } from './lib/utils/config';
10
10
  export * from './lib/types';
11
11
  export * from './lib/components/ComponentsLookUp';
12
+ export { SA_NAMESPACE } from './lib/utils/i18n';
12
13
  export { saTranslations };
@@ -1,2 +1,3 @@
1
1
  export declare const SA_NAMESPACE = "sigmetairmet";
2
2
  export declare const initSigmetAirmetI18n: () => void;
3
+ export declare const translateKeyOutsideComponents: (key: string, params?: Record<string, string | number> | undefined) => string;