@opengeoweb/sigmet-airmet 9.25.2 → 9.26.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
@@ -8,7 +8,7 @@ import { useApiContext, useApi, createApiInstance, createNonAuthApiInstance, cre
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 i18n from 'i18next';
10
10
  import { useTranslation } from 'react-i18next';
11
- import { dateUtils, ToggleMenu, CustomTooltip, useIsMounted, StatusTag, AlertBanner, ConfirmationServiceProvider, usePreventBrowserClose, useConfirmationDialog, isAxiosError, getAxiosErrorMessage, usePoller, ErrorBoundary } from '@opengeoweb/shared';
11
+ import { PROJECTION, dateUtils, ToggleMenu, CustomTooltip, useIsMounted, StatusTag, AlertBanner, ConfirmationServiceProvider, usePreventBrowserClose, useConfirmationDialog, isAxiosError, getAxiosErrorMessage, usePoller, ErrorBoundary } from '@opengeoweb/shared';
12
12
  import { LayerManagerMapButtonConnect, LegendMapButtonConnect, MultiDimensionSelectMapButtonsConnect, MapViewConnect, TimeSliderConnect, LegendConnect, LayerManagerConnect } from '@opengeoweb/core';
13
13
  import { DrawFIRLand, ChevronLeft, Edit, Success, Clock } from '@opengeoweb/theme';
14
14
  import { LayerType, webmapUtils } from '@opengeoweb/webmap';
@@ -2315,6 +2315,7 @@ var StartOrEndDrawing;
2315
2315
  *
2316
2316
  * Copyright 2021 - Koninklijk Nederlands Meteorologisch Instituut (KNMI)
2317
2317
  * Copyright 2021 - Finnish Meteorological Institute (FMI)
2318
+ * Copyright 2024 - The Norwegian Meteorological Institute (MET Norway)
2318
2319
  * */
2319
2320
  const styles$2 = {
2320
2321
  label: {
@@ -2521,6 +2522,7 @@ const ProductFormFieldLayout = _a => {
2521
2522
  *
2522
2523
  * Copyright 2023 - Koninklijk Nederlands Meteorologisch Instituut (KNMI)
2523
2524
  * Copyright 2023 - Finnish Meteorological Institute (FMI)
2525
+ * Copyright 2024 - The Norwegian Meteorological Institute (MET Norway)
2524
2526
  * */
2525
2527
  const useShortTestHelpers = () => {
2526
2528
  const {
@@ -2888,7 +2890,7 @@ const srsAndBboxDefault = {
2888
2890
  top: 11688874,
2889
2891
  bottom: 5930186
2890
2892
  },
2891
- srs: 'EPSG:3857'
2893
+ srs: PROJECTION.EPSG_3857.value
2892
2894
  };
2893
2895
  const featurePropsStart = defaultGeoJSONStyleProperties;
2894
2896
  const featurePropsEnd = {
@@ -4327,7 +4329,7 @@ const Progress = ({
4327
4329
  const intersectingPolygonPointsTotal = interceptionGeometry && interceptionGeometry.coordinates[0] ? interceptionGeometry.coordinates[0].length : 0;
4328
4330
  const showMaxFeaturePointsWarning = intersectionPointCount > 7 && hasMaxFeaturePoints(geoJSONIntersection, maxPoints) && !activeTool && !errors.startGeometry && !isFir(geoJSON);
4329
4331
  const showMoreThan6PointsWarning = totalDrawnPoints > 7 && intersectionPointCount < 1 && !activeTool && !errors.startGeometry && !isFir(geoJSON);
4330
- const showIntersectionAbove6PointsWarning = intersectingPolygonPointsTotal > 7 && intersectionPointCount > 6 && maxPoints > 7 && !activeTool && !errors.startGeometry && !isFir(geoJSON);
4332
+ const showIntersectionAbove6PointsWarning = intersectingPolygonPointsTotal > 7 && intersectionPointCount > 1 && maxPoints > 7 && !activeTool && !errors.startGeometry && !isFir(geoJSON);
4331
4333
  return jsx(ProductFormFieldLayout, Object.assign({
4332
4334
  title: t('progress'),
4333
4335
  sx: styles$2.containerItem
@@ -4684,7 +4686,7 @@ const StartGeometry = ({
4684
4686
  const intersectingPolygonPointsTotal = interceptionGeometry && interceptionGeometry.coordinates[0] ? interceptionGeometry.coordinates[0].length : 0;
4685
4687
  const showMaxFeaturePointsWarning = intersectionPointCount > 7 && hasMaxFeaturePoints(geoJSONIntersection, maxPoints) && !activeTool && !errors.startGeometry && !isFir(geoJSON);
4686
4688
  const showMoreThan6PointsWarning = totalDrawnPoints > 7 && intersectionPointCount < 1 && !activeTool && !errors.startGeometry && !isFir(geoJSON);
4687
- const showIntersectionAbove6PointsWarning = intersectingPolygonPointsTotal > 7 && intersectionPointCount > 6 && maxPoints > 7 && !activeTool && !errors.startGeometry && !isFir(geoJSON);
4689
+ const showIntersectionAbove6PointsWarning = intersectingPolygonPointsTotal > 7 && intersectionPointCount > 1 && maxPoints > 7 && !activeTool && !errors.startGeometry && !isFir(geoJSON);
4688
4690
  return !_isReadOnly ? jsxs(ProductFormFieldLayout, Object.assign({
4689
4691
  title: t('start-position'),
4690
4692
  sx: styles$2.drawSection,
@@ -5700,11 +5702,28 @@ const useTAC = (initialProduct, getTAC, hasErrors = () => false, omitChange) =>
5700
5702
  };
5701
5703
  return [TAC, delayedQuery];
5702
5704
  };
5705
+ const getSequenceStyling = (product, hasTac = false) => {
5706
+ if (hasTac && !product || product && product.status === 'DRAFT') {
5707
+ return {
5708
+ fontWeight: 'lighter',
5709
+ color: 'geowebColors.typographyAndIcons.inactiveText'
5710
+ };
5711
+ }
5712
+ return {};
5713
+ };
5703
5714
  const ProductFormTAC = ({
5704
- tac
5715
+ tac,
5716
+ product
5705
5717
  }) => {
5718
+ var _a;
5719
+ const {
5720
+ t
5721
+ } = useSigmetAirmetTranslation();
5722
+ const noTAC = t('tac-missing-data');
5706
5723
  const tacLines = tac.split('\n');
5707
- const hasTac = tacLines.length && tacLines.toString() !== noTAC;
5724
+ const hasTac = tacLines.length > 0 && tac !== noTAC;
5725
+ const sequenceNumberInTac = hasTac ? (_a = tacLines[0].split(' ')[2]) !== null && _a !== void 0 ? _a : null : null;
5726
+ const sequenceStyle = getSequenceStyling(product, hasTac);
5708
5727
  return jsx(Typography, Object.assign({
5709
5728
  variant: "body2",
5710
5729
  component: "div",
@@ -5714,21 +5733,24 @@ const ProductFormTAC = ({
5714
5733
  },
5715
5734
  "data-testid": "productform-tac-message"
5716
5735
  }, {
5717
- children: tacLines.map(line => jsx(Box, Object.assign({
5736
+ children: jsx(Box, Object.assign({
5718
5737
  component: "p",
5719
5738
  sx: {
5720
5739
  margin: 0,
5721
- fontSize: hasTac ? '1.125rem' : '1rem',
5740
+ fontSize: '1.125rem',
5722
5741
  fontWeight: 'normal',
5723
- fontStretch: 'normal',
5724
- fontStyle: 'normal',
5725
5742
  lineHeight: 1.56,
5726
5743
  letterSpacing: '0.5px'
5727
5744
  },
5728
5745
  "data-testid": "productform-tac-message-line"
5729
5746
  }, {
5730
- children: line
5731
- }), line))
5747
+ children: tac.split(' ').map((word, index) => jsx(Box, Object.assign({
5748
+ component: "span",
5749
+ sx: hasTac && word === sequenceNumberInTac ? sequenceStyle : {}
5750
+ }, {
5751
+ children: word + (index < tac.split(' ').length - 1 ? ' ' : '')
5752
+ }), index))
5753
+ }))
5732
5754
  }));
5733
5755
  };
5734
5756
 
@@ -5767,7 +5789,8 @@ const IssuedAt = ({
5767
5789
 
5768
5790
  const Tac = ({
5769
5791
  tac,
5770
- children
5792
+ children,
5793
+ product
5771
5794
  }) => {
5772
5795
  return jsx(ProductFormFieldLayout, Object.assign({
5773
5796
  title: "TAC",
@@ -5780,7 +5803,8 @@ const Tac = ({
5780
5803
  xs: 12
5781
5804
  }, {
5782
5805
  children: [jsx(ProductFormTAC, {
5783
- tac: tac
5806
+ tac: tac,
5807
+ product: product
5784
5808
  }), children]
5785
5809
  }))
5786
5810
  }));
@@ -9966,6 +9990,7 @@ const validateAirmet = airmetConfig => {
9966
9990
  *
9967
9991
  * Copyright 2023 - Koninklijk Nederlands Meteorologisch Instituut (KNMI)
9968
9992
  * Copyright 2023 - Finnish Meteorological Institute (FMI)
9993
+ * Copyright 2024 - The Norwegian Meteorological Institute (MET Norway)
9969
9994
  * */
9970
9995
  const sigmetConfig = sigmetDefaultConfig;
9971
9996
  const airmetConfig = airmetDefaultConfig;
@@ -9999,7 +10024,8 @@ const SigmetForm = ({
9999
10024
  initialCancelSigmet: _initialCancelSigmet = null,
10000
10025
  showMap: _showMap = true,
10001
10026
  productConfig: _productConfig = sigmetConfig,
10002
- setDialogActionsDisabled
10027
+ setDialogActionsDisabled,
10028
+ product
10003
10029
  }) => {
10004
10030
  const {
10005
10031
  t
@@ -10248,7 +10274,8 @@ const SigmetForm = ({
10248
10274
  date: getProductIssueDate(_initialSigmet, _initialCancelSigmet),
10249
10275
  isReadOnly: isReadOnly
10250
10276
  }), jsxs(Tac, Object.assign({
10251
- tac: tac
10277
+ tac: tac,
10278
+ product: product
10252
10279
  }, {
10253
10280
  children: [jsx(ReactHookFormHiddenInput, {
10254
10281
  name: "sequence",
@@ -10331,7 +10358,8 @@ const AirmetForm = ({
10331
10358
  initialAirmet: _initialAirmet = null,
10332
10359
  initialCancelAirmet: _initialCancelAirmet = null,
10333
10360
  showMap: _showMap = true,
10334
- productConfig: _productConfig = airmetConfig
10361
+ productConfig: _productConfig = airmetConfig,
10362
+ product
10335
10363
  }) => {
10336
10364
  const {
10337
10365
  api
@@ -10521,7 +10549,8 @@ const AirmetForm = ({
10521
10549
  isReadOnly: isReadOnly,
10522
10550
  date: getProductIssueDate(_initialAirmet, _initialCancelAirmet)
10523
10551
  }), jsxs(Tac, Object.assign({
10524
- tac: tac
10552
+ tac: tac,
10553
+ product: product
10525
10554
  }, {
10526
10555
  children: [jsx(ReactHookFormHiddenInput, {
10527
10556
  name: "sequence",
@@ -11303,13 +11332,15 @@ const ProductFormDialogContent = ({
11303
11332
  initialSigmet: product !== null && !isInstanceOfCancelSigmet(product) ? product : null,
11304
11333
  initialCancelSigmet: product !== null && isInstanceOfCancelSigmet(product) ? product : null,
11305
11334
  productConfig: productConfig,
11306
- setDialogActionsDisabled: setDialogActionsDisabled
11335
+ setDialogActionsDisabled: setDialogActionsDisabled,
11336
+ product: product
11307
11337
  }) : jsx(AirmetForm, {
11308
11338
  mode: mode,
11309
11339
  isCancelAirmet: product !== null && isInstanceOfCancelAirmet(product),
11310
11340
  initialAirmet: product !== null && !isInstanceOfCancelAirmet(product) ? product : null,
11311
11341
  initialCancelAirmet: product !== null && isInstanceOfCancelAirmet(product) ? product : null,
11312
- productConfig: productConfig
11342
+ productConfig: productConfig,
11343
+ product: product
11313
11344
  }), jsx(DraftFieldHelper, {}), jsx(Backdrop, Object.assign({
11314
11345
  "data-testid": "loader",
11315
11346
  open: showLoader,
@@ -12698,6 +12729,7 @@ $({ target: 'Promise', stat: true, forced: FORCED_PROMISE_CONSTRUCTOR }, {
12698
12729
  *
12699
12730
  * Copyright 2021 - Koninklijk Nederlands Meteorologisch Instituut (KNMI)
12700
12731
  * Copyright 2021 - Finnish Meteorological Institute (FMI)
12732
+ * Copyright 2024 - The Norwegian Meteorological Institute (MET Norway)
12701
12733
  * */
12702
12734
  const fakeAirmetList = [{
12703
12735
  creationDate: '2020-09-17T12:00:00Z',
@@ -13699,6 +13731,7 @@ const fakeAirmetList = [{
13699
13731
  *
13700
13732
  * Copyright 2021 - Koninklijk Nederlands Meteorologisch Instituut (KNMI)
13701
13733
  * Copyright 2021 - Finnish Meteorological Institute (FMI)
13734
+ * Copyright 2024 - The Norwegian Meteorological Institute (MET Norway)
13702
13735
  * */
13703
13736
  // TODO: [Loes Cornelis] Replace with correct strucutre and in JSON format - not js object
13704
13737
  const fakeSigmetList = [{
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@opengeoweb/sigmet-airmet",
3
- "version": "9.25.2",
3
+ "version": "9.26.0",
4
4
  "description": "GeoWeb Sigmet/Airmet library for the opengeoweb project",
5
5
  "license": "Apache-2.0",
6
6
  "repository": {
@@ -5,7 +5,7 @@ export declare const srsAndBboxDefault: {
5
5
  top: number;
6
6
  bottom: number;
7
7
  };
8
- srs: string;
8
+ srs: "EPSG:3857";
9
9
  };
10
10
  export declare const simplePolygonGeoJSON: GeoJSON.FeatureCollection;
11
11
  export declare const simplePolygonGeoJSONHalfOfNL: GeoJSON.FeatureCollection;
@@ -1,5 +1,5 @@
1
1
  import React from 'react';
2
- import { FormMode, Airmet, CancelAirmet, ProductConfig } from '../../../types';
2
+ import { FormMode, Airmet, CancelAirmet, ProductConfig, AviationProduct } from '../../../types';
3
3
  export interface AirmetFormProps {
4
4
  mode: FormMode;
5
5
  isCancelAirmet?: boolean;
@@ -7,6 +7,7 @@ export interface AirmetFormProps {
7
7
  initialCancelAirmet?: CancelAirmet;
8
8
  showMap?: boolean;
9
9
  productConfig?: ProductConfig;
10
+ product?: AviationProduct;
10
11
  }
11
12
  declare const AirmetForm: React.FC<AirmetFormProps>;
12
13
  export default AirmetForm;
@@ -1,7 +1,9 @@
1
1
  import React from 'react';
2
+ import { AviationProduct } from '../../../types';
2
3
  interface TacProps {
3
4
  tac: string;
4
5
  children: React.ReactNode;
6
+ product?: AviationProduct;
5
7
  }
6
8
  declare const Tac: React.FC<TacProps>;
7
9
  export default Tac;
@@ -11,6 +11,14 @@ export declare const useTAC: (initialProduct: AviationProduct, getTAC: (product:
11
11
  }>, hasErrors?: () => boolean, omitChange?: boolean) => [string, any];
12
12
  interface ProductFormTACProps {
13
13
  tac: string;
14
+ product?: AviationProduct;
14
15
  }
16
+ export declare const getSequenceStyling: (product?: ProductFormTACProps['product'], hasTac?: boolean) => {
17
+ fontWeight: string;
18
+ color: string;
19
+ } | {
20
+ fontWeight?: undefined;
21
+ color?: undefined;
22
+ };
15
23
  declare const ProductFormTAC: React.FC<ProductFormTACProps>;
16
24
  export default ProductFormTAC;
@@ -1,5 +1,5 @@
1
1
  import React from 'react';
2
- import { CancelSigmet, Sigmet, FormMode, ProductConfig } from '../../../types';
2
+ import { CancelSigmet, Sigmet, FormMode, ProductConfig, AviationProduct } from '../../../types';
3
3
  export interface SigmetFormProps {
4
4
  mode: FormMode;
5
5
  isCancelSigmet?: boolean;
@@ -8,6 +8,7 @@ export interface SigmetFormProps {
8
8
  showMap?: boolean;
9
9
  productConfig?: ProductConfig;
10
10
  setDialogActionsDisabled?: (disabled: boolean) => void;
11
+ product?: AviationProduct;
11
12
  }
12
13
  declare const SigmetForm: React.FC<SigmetFormProps>;
13
14
  export default SigmetForm;