@opengeoweb/sigmet-airmet 9.15.0 → 9.17.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 * as React from 'react';
2
2
  import React__default from 'react';
3
3
  import { FormControlLabel, Radio, Grid, Typography, Box, Button, Checkbox, MenuItem, FormHelperText, useTheme, Dialog, DialogTitle, DialogContent, Card, LinearProgress, List, ListItemButton, Backdrop, CircularProgress } from '@mui/material';
4
4
  import { useFormContext } from 'react-hook-form';
5
- import { useDraftFormHelpers, ReactHookFormRadioGroup, DATE_FORMAT_FNS, 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';
5
+ import { useDraftFormHelpers, ReactHookFormRadioGroup, ReactHookFormSelect, ReactHookFormNumberField, isInteger, isValidMax, isValidMin, isEmpty, ReactHookFormDateTime, hasMaxFeaturePoints, hasMulitpleIntersections, ReactHookFormHiddenInput, isMaximumOneDrawing, hasIntersectionWithFIR, isValidGeoJsonCoordinates, isXHoursBefore, 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
7
  import { defaultGeoJSONStyleProperties, defaultIntersectionStyleProperties, defaultPoint, addGeoJSONProperties, defaultBox, defaultPolygon, DRAWMODE, addSelectionTypeToGeoJSON, defaultDelete, getIcon, MapControls, MapViewLayer, useMapDrawTool, addFeatureProperties, rewindGeometry } from '@opengeoweb/webmap-react';
8
8
  import { dateUtils, ToggleMenu, CustomTooltip, useIsMounted, StatusTag, AlertBanner, ConfirmationServiceProvider, usePreventBrowserClose, useConfirmationDialog, isAxiosError, getAxiosErrorMessage, usePoller, ErrorBoundary } from '@opengeoweb/shared';
@@ -15,6 +15,25 @@ import { LayerManagerMapButtonConnect, LegendMapButtonConnect, MultiDimensionSel
15
15
  import { useAuthenticationContext } from '@opengeoweb/authentication';
16
16
  import { Box as Box$1 } from '@mui/system';
17
17
 
18
+ var en = {
19
+ "sigmet-airmet": "sigmet"
20
+ };
21
+ var fi = {
22
+ "sigmet-airmet": "sigmet"
23
+ };
24
+ var no = {
25
+ "sigmet-airmet": "sigmet"
26
+ };
27
+ var nl = {
28
+ "sigmet-airmet": "sigmet"
29
+ };
30
+ var sigmetAirmet = {
31
+ en: en,
32
+ fi: fi,
33
+ no: no,
34
+ nl: nl
35
+ };
36
+
18
37
  var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
19
38
 
20
39
  var fails$o = function (exec) {
@@ -2764,10 +2783,10 @@ const getConfirmationDialogCancelLabel = action => {
2764
2783
  };
2765
2784
  const getProductIssueDate = (initialProduct, initialCancelProduct) => {
2766
2785
  if (initialProduct !== null && (initialProduct.status === 'PUBLISHED' || initialProduct.status === 'EXPIRED') && initialProduct.issueDate) {
2767
- return `${dateUtils.dateToString(dateUtils.utc(initialProduct.issueDate), DATE_FORMAT_FNS)} UTC`;
2786
+ return `${dateUtils.dateToString(dateUtils.utc(initialProduct.issueDate), dateUtils.DATE_FORMAT_DATEPICKER)} UTC`;
2768
2787
  }
2769
2788
  if (initialCancelProduct !== null && initialCancelProduct.issueDate) {
2770
- return `${dateUtils.dateToString(dateUtils.utc(initialCancelProduct.issueDate), DATE_FORMAT_FNS)} UTC`;
2789
+ return `${dateUtils.dateToString(dateUtils.utc(initialCancelProduct.issueDate), dateUtils.DATE_FORMAT_DATEPICKER)} UTC`;
2771
2790
  }
2772
2791
  return '(Not published)';
2773
2792
  };
@@ -3540,9 +3559,9 @@ const ObservationForecastTime = ({
3540
3559
  label: label,
3541
3560
  rules: {
3542
3561
  validate: {
3543
- isValidDate,
3544
- isBefore: val => watch('isObservationOrForecast') === 'OBS' && val ? isBefore(val, dateUtils.getCurrentTimeAsString()) || 'Observation time cannot be in the future' : true,
3545
- isBetween: val => watch('isObservationOrForecast') === 'FCST' && val ? isBetween(goZeroSeconds(val), goZeroSeconds(watch('validDateStart')), goZeroSeconds(watch('validDateEnd'))) || ForecastTimeValidation : true
3562
+ isValidDate: dateUtils.isValidIsoDateString,
3563
+ isBefore: val => watch('isObservationOrForecast') === 'OBS' && val ? dateUtils.isBefore(val, dateUtils.getNowUtc()) || 'Observation time cannot be in the future' : true,
3564
+ isBetween: val => watch('isObservationOrForecast') === 'FCST' && val ? dateUtils.isBetween(dateUtils.isoStringToDate(val), dateUtils.isoStringToDate(goZeroSeconds(watch('validDateStart'))), dateUtils.isoStringToDate(goZeroSeconds(watch('validDateEnd'))), '[]') || ForecastTimeValidation : true
3546
3565
  }
3547
3566
  },
3548
3567
  disabled: fieldsDisabled,
@@ -4140,7 +4159,7 @@ const ValidFrom = ({
4140
4159
  rules: {
4141
4160
  validate: {
4142
4161
  isRequired,
4143
- isValidDate,
4162
+ isValidDate: dateUtils.isValidIsoDateString,
4144
4163
  // The validity start can not be before the current time
4145
4164
  isValueBeforeCurrentTime: value => isXHoursBefore(value, dateUtils.getCurrentTimeAsString(), 0) || VALID_FROM_ERROR_BEFORE_CURRENT,
4146
4165
  // The current time can be no more than 4 hours before the validity start (12 for VA/TC SIGMET)
@@ -4205,9 +4224,9 @@ const ValidUntil = ({
4205
4224
  rules: {
4206
4225
  validate: {
4207
4226
  isRequired,
4208
- isValidDate,
4227
+ isValidDate: dateUtils.isValidIsoDateString,
4209
4228
  // Validity end has to be after validity start
4210
- isAfter: value => isAfter(value, getValues('validDateStart')) || 'Valid until time has to be after Valid from time',
4229
+ isAfter: value => value ? dateUtils.isAfter(value, getValues('validDateStart')) || 'Valid until time has to be after Valid from time' : true,
4211
4230
  // Validity end can be no more than 4 hours after validity start (6 for VA/TC SIGMET)
4212
4231
  isXHoursAfter: value => isXHoursAfter(value, getValues('validDateStart'), getMaxHoursOfValidity(getValues('phenomenon'), getValues('locationIndicatorATSR'), productConfig)) || `Valid until time can be no more than ${getMaxHoursOfValidity(getValues('phenomenon'), getValues('locationIndicatorATSR'), productConfig)} hours after Valid from time`
4213
4232
  }
@@ -9909,7 +9928,7 @@ const formatValidTime = (startDate, endDate, format) => {
9909
9928
  if (!startDate || !endDate) {
9910
9929
  return '-';
9911
9930
  }
9912
- return `${dateUtils.dateToString(dateUtils.utc(startDate), 'dd MMM yyyy, HH:mm')} - ${dateUtils.dateToString(dateUtils.utc(endDate), format)} UTC`;
9931
+ return `${dateUtils.dateToString(dateUtils.utc(startDate), dateUtils.DATE_FORMAT_NAME_OF_MONTH)} - ${dateUtils.dateToString(dateUtils.utc(endDate), format)} UTC`;
9913
9932
  };
9914
9933
  const ProductListRowHeader = ({
9915
9934
  title
@@ -10014,7 +10033,7 @@ const ProductListRow = ({
10014
10033
  }, [product, apiCall]);
10015
10034
  const cancelsSeqId = isInstanceOfCancelSigmetOrAirmet(product) ? getCancelSeqId(product) : null;
10016
10035
  const phenomenon = isInstanceOfSigmetOrAirmet(product) && product.phenomenon ? product.phenomenon : null;
10017
- const validTimeFormat = dateUtils.dateToString(dateUtils.utc(product.validDateStart), 'dd MMM yyyy') === dateUtils.dateToString(dateUtils.utc(product.validDateEnd), 'dd MMM yyyy') ? 'HH:mm' : 'dd MMM yyyy, HH:mm';
10036
+ const validTimeFormat = dateUtils.dateToString(dateUtils.utc(product.validDateStart), dateUtils.DATE_FORMAT_YEAR) === dateUtils.dateToString(dateUtils.utc(product.validDateEnd), dateUtils.DATE_FORMAT_YEAR) ? dateUtils.DATE_FORMAT_HOURS : dateUtils.DATE_FORMAT_NAME_OF_MONTH;
10018
10037
  const validTime = formatValidTime(product.validDateStart, product.validDateEnd, validTimeFormat);
10019
10038
  const getLabel = product => {
10020
10039
  const isSigmetOrAirmet = product => {
@@ -10103,7 +10122,7 @@ const ProductListRow = ({
10103
10122
  variant: "subtitle2",
10104
10123
  sx: styles.font,
10105
10124
  "data-testid": "issueTime"
10106
- }, product.issueDate ? `${dateUtils.dateToString(dateUtils.utc(product.issueDate), 'dd MMM yyyy, HH:mm')} UTC` : '(Not published)'))), /*#__PURE__*/React__default.createElement(Grid, {
10125
+ }, product.issueDate ? `${dateUtils.dateToString(dateUtils.utc(product.issueDate), dateUtils.DATE_FORMAT_NAME_OF_MONTH)} UTC` : '(Not published)'))), /*#__PURE__*/React__default.createElement(Grid, {
10107
10126
  className: "col-3",
10108
10127
  item: true
10109
10128
  }, /*#__PURE__*/React__default.createElement(ProductListRowHeader, {
@@ -14398,4 +14417,4 @@ ConnectedModuleWrapper = null) => {
14398
14417
  }
14399
14418
  };
14400
14419
 
14401
- 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, sigmetConfig };
14420
+ 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 };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@opengeoweb/sigmet-airmet",
3
- "version": "9.15.0",
3
+ "version": "9.17.0",
4
4
  "description": "GeoWeb Sigmet/Airmet library for the opengeoweb project",
5
5
  "license": "Apache-2.0",
6
6
  "repository": {
package/src/index.d.ts CHANGED
@@ -1,3 +1,4 @@
1
+ import saTranslations from '../locales/sigmet-airmet.json';
1
2
  export * from './lib/components/ProductForms';
2
3
  export * from './lib/components/ContentDialog';
3
4
  export * from './lib/components/MapViewGeoJson';
@@ -8,3 +9,4 @@ export { createApi as createFakeApi } from './lib/utils/fakeApi';
8
9
  export { sigmetConfig, airmetConfig } from './lib/utils/config';
9
10
  export * from './lib/types';
10
11
  export * from './lib/components/ComponentsLookUp';
12
+ export { saTranslations };
@@ -2,6 +2,5 @@ import React from 'react';
2
2
  interface SATranslationWrapperProps {
3
3
  children?: React.ReactNode;
4
4
  }
5
- export declare const SigmetAirmetTranslationsWrapper: React.FC<SATranslationWrapperProps>;
6
5
  export declare const SigmetAirmetI18nProvider: React.FC<SATranslationWrapperProps>;
7
6
  export {};