@opengeoweb/sigmet-airmet 10.0.0 → 10.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
@@ -5,13 +5,13 @@ import { FormControlLabel, Radio, Grid2, Typography, Box, Button, Checkbox, Menu
5
5
  import { useFormContext } from 'react-hook-form';
6
6
  import { FORM_FIELDS_NAMESPACE, formFieldsTranslations, useDraftFormHelpers, ReactHookFormRadioGroup, hasValidGeometry, ReactHookFormSelect, ReactHookFormNumberField, isInteger, isValidMax, isValidMin, isEmpty, ReactHookFormDateTime, countIntersectionPoints, hasMulitpleIntersections, ReactHookFormHiddenInput, isMaximumOneDrawing, isValidGeoJsonCoordinates, hasIntersectionWithFIR, isXHoursBefore, isXHoursAfter, ReactHookFormTextField, isLatitude, isNonOrBothCoordinates, isLongitude, ReactHookFormFormControl, isGeometryDirty, ReactHookFormProvider, defaultFormOptions } from '@opengeoweb/form-fields';
7
7
  import { useApiContext, useApi, createApiInstance, createFakeApiInstance, ApiProvider } from '@opengeoweb/api';
8
- import { defaultGeoJSONStyleProperties, defaultIntersectionStyleProperties, addSelectionTypeToGeoJSON, defaultPoint, addGeoJSONProperties, defaultBox, defaultPolygon, DRAWMODE, defaultDelete, getIcon, MapControls, MapViewLayer, useMapDrawTool, addFeatureProperties, rewindGeometry } from '@opengeoweb/webmap-react';
8
+ import { defaultGeoJSONStyleProperties, defaultIntersectionStyleProperties, addSelectionTypeToGeoJSON, defaultPoint, addGeoJSONProperties, defaultBox, defaultPolygon, DRAWMODE, defaultDelete, getIcon, MapViewLayer, useMapDrawTool, addFeatureProperties, rewindGeometry } from '@opengeoweb/webmap-react';
9
9
  import i18n from 'i18next';
10
10
  import { initReactI18next, useTranslation } from 'react-i18next';
11
11
  import { SHARED_NAMESPACE, sharedTranslations, PROJECTION, ToggleMenu, useIsMounted, dateUtils, CustomTooltip, ConfirmationServiceProvider, usePreventBrowserClose, useConfirmationDialog, AlertBanner, isAxiosError, getAxiosErrorMessage, StatusTag, usePoller, ErrorBoundary } from '@opengeoweb/shared';
12
- import { CORE_NAMESPACE, coreTranslations, LayerManagerMapButtonConnect, LegendMapButtonConnect, MultiDimensionSelectMapButtonsConnect, MapViewConnect, TimeSliderConnect, LegendConnect, LayerManagerConnect } from '@opengeoweb/core';
12
+ import { CORE_NAMESPACE, coreTranslations, LegendConnect, MapViewConnect, TimeSliderConnect } from '@opengeoweb/core';
13
13
  import { useSelector, useDispatch, shallowEqual } from 'react-redux';
14
- import { uiSelectors, useUpdateSharedData, mapSelectors, syncGroupsActions, mapStoreActions, defaultLayers, syncConstants } from '@opengeoweb/store';
14
+ import { uiSelectors, useUpdateSharedData, mapSelectors, syncGroupsActions, layerActions, mapActions, defaultLayers, syncConstants } from '@opengeoweb/store';
15
15
  import { DrawFIRLand, ChevronLeft, Edit, Success, Clock } from '@opengeoweb/theme';
16
16
  import { LayerType, webmapUtils } from '@opengeoweb/webmap';
17
17
  import { debounce } from 'lodash';
@@ -1738,7 +1738,8 @@ var prepareFormValues = function prepareFormValues(product) {
1738
1738
  if (typeof value === 'object' && value !== null && value !== undefined) {
1739
1739
  var _ref2;
1740
1740
  var hasNaNValue = Object.keys(value).reduce(function (total, valKey) {
1741
- return !hasValue(String(value[valKey])) || total;
1741
+ var keyValue = value[valKey];
1742
+ return !hasValue(String(keyValue)) || total;
1742
1743
  }, false);
1743
1744
  return Object.assign({}, list, !hasNaNValue && (_ref2 = {}, _ref2[key] = value, _ref2));
1744
1745
  }
@@ -3143,9 +3144,9 @@ var SelectFIR = function SelectFIR(_ref) {
3143
3144
  locationIndicatorMWO = _getFirLocationDefaul.locationIndicatorMWO,
3144
3145
  firName = _getFirLocationDefaul.firName,
3145
3146
  firGeometry = _getFirLocationDefaul.firGeometry;
3146
- var onChangeLocationATSR = function onChangeLocationATSR(changeEvent) {
3147
- var value = changeEvent.target.value;
3148
- var valuesFromConfig = getFirLocationDefaultValues(productConfig, value);
3147
+ var onChangeLocationATSR = function onChangeLocationATSR(event) {
3148
+ var value = event.target.value; // MUI Select component's target has a `value` property
3149
+ var valuesFromConfig = getFirLocationDefaultValues(productConfig, value); // Ensure value is treated as a string
3149
3150
  // Updates values from config
3150
3151
  setValue('locationIndicatorATSU', valuesFromConfig.locationIndicatorATSU);
3151
3152
  setValue('firName', valuesFromConfig.firName);
@@ -3166,7 +3167,7 @@ var SelectFIR = function SelectFIR(_ref) {
3166
3167
  // Trigger validation for fields dependent on FIR config
3167
3168
  var fieldnames = ['phenomenon', 'validDateStart', 'validDateEnd', 'movementSpeed', 'level.value', 'lowerLevel.value'];
3168
3169
  triggerValidations(fieldnames, getValues, trigger);
3169
- onChange(changeEvent, valuesFromConfig.phenomena);
3170
+ onChange(event, valuesFromConfig.phenomena); // Pass the event and updated phenomena as arguments
3170
3171
  };
3171
3172
  return jsxs(ProductFormFieldLayout, {
3172
3173
  title: t('select-fir-title'),
@@ -4459,7 +4460,6 @@ var Tac = function Tac(_ref) {
4459
4460
  });
4460
4461
  };
4461
4462
 
4462
- var source = 'app';
4463
4463
  var MapViewGeoJson = function MapViewGeoJson(_ref) {
4464
4464
  var initialBaseLayers = _ref.baseLayers,
4465
4465
  initialProjection = _ref.projection,
@@ -4470,7 +4470,7 @@ var MapViewGeoJson = function MapViewGeoJson(_ref) {
4470
4470
  var firstMap = useSelector(function (store) {
4471
4471
  return mapSelectors.getFirstMap(store);
4472
4472
  }, shallowEqual);
4473
- var firstMapId = firstMap && firstMap.id ? firstMap.id : null;
4473
+ var firstMapId = firstMap && firstMap.id ? firstMap.id : '';
4474
4474
  var mapLayers = useSelector(function (store) {
4475
4475
  return mapSelectors.getMapLayers(store, firstMapId);
4476
4476
  }, shallowEqual);
@@ -4494,13 +4494,13 @@ var MapViewGeoJson = function MapViewGeoJson(_ref) {
4494
4494
  mapId: mapId
4495
4495
  });
4496
4496
  });
4497
- dispatch(mapStoreActions.setLayers({
4497
+ dispatch(layerActions.setLayers({
4498
4498
  mapId: mapId,
4499
4499
  layers: layers
4500
4500
  }));
4501
4501
  }
4502
4502
  if (mapDimensions && mapDimensions.length) {
4503
- dispatch(mapStoreActions.mapChangeDimension({
4503
+ dispatch(mapActions.mapChangeDimension({
4504
4504
  mapId: mapId,
4505
4505
  dimension: mapDimensions[0],
4506
4506
  origin: 'MapViewGeoJson'
@@ -4509,12 +4509,12 @@ var MapViewGeoJson = function MapViewGeoJson(_ref) {
4509
4509
  var baseLayers = initialBaseLayers || [Object.assign({}, defaultLayers.overLayer, {
4510
4510
  id: "countryborders-" + mapId
4511
4511
  })];
4512
- dispatch(mapStoreActions.setBaseLayers({
4512
+ dispatch(layerActions.setBaseLayers({
4513
4513
  mapId: mapId,
4514
4514
  layers: baseLayers
4515
4515
  }));
4516
4516
  var projection = initialProjection || srsAndBboxDefault;
4517
- dispatch(mapStoreActions.setBbox({
4517
+ dispatch(mapActions.setBbox({
4518
4518
  mapId: mapId,
4519
4519
  bbox: projection.bbox,
4520
4520
  srs: projection.srs
@@ -4541,19 +4541,17 @@ var MapViewGeoJson = function MapViewGeoJson(_ref) {
4541
4541
  },
4542
4542
  "data-testid": "MapView",
4543
4543
  ref: mapWindowRef,
4544
- children: [jsxs(MapControls, {
4545
- children: [jsx(LayerManagerMapButtonConnect, {
4546
- source: source,
4547
- mapId: mapId
4548
- }), jsx(LegendMapButtonConnect, {
4549
- source: source,
4550
- mapId: mapId
4551
- }), jsx(MultiDimensionSelectMapButtonsConnect, {
4552
- source: source,
4553
- mapId: mapId
4554
- })]
4544
+ children: [jsx(LegendConnect, {
4545
+ showMapId: true,
4546
+ mapId: mapId
4555
4547
  }), jsx(MapViewConnect, {
4556
4548
  mapId: mapId,
4549
+ controls: {
4550
+ mapControlsPositionTop: 0,
4551
+ layerManagerAndLegend: true,
4552
+ zoomControls: true,
4553
+ dimensionSelect: true
4554
+ },
4557
4555
  children: geoJSONLayers.map(function (layer) {
4558
4556
  return jsx(MapViewLayer, Object.assign({}, layer), layer.id);
4559
4557
  })
@@ -4570,15 +4568,6 @@ var MapViewGeoJson = function MapViewGeoJson(_ref) {
4570
4568
  mapId: mapId,
4571
4569
  mapWindowRef: mapWindowRef
4572
4570
  })
4573
- }), jsx(LegendConnect, {
4574
- showMapId: true,
4575
- mapId: mapId,
4576
- source: source
4577
- }), jsx(LayerManagerConnect, {
4578
- mapId: mapId,
4579
- bounds: "parent",
4580
- source: source,
4581
- isDocked: true
4582
4571
  })]
4583
4572
  });
4584
4573
  };
@@ -8166,7 +8155,7 @@ var SigmetForm = function SigmetForm(_ref) {
8166
8155
  omitChange = _useConditionalFields.omitChange;
8167
8156
  var _useShortTestHelpers = useShortTestHelpers(),
8168
8157
  isShortTest = _useShortTestHelpers.isShortTest;
8169
- var onChangeFir = function onChangeFir(event, newPhenomenaList) {
8158
+ var onChangeFir = function onChangeFir(newPhenomenaList, event) {
8170
8159
  var newFIRValue = event == null ? void 0 : event.target.value;
8171
8160
  var newFirGeoJSON = addFeatureProperties(getFir(productConfig, newFIRValue), featurePropsFIR);
8172
8161
  // delete shape
@@ -8229,7 +8218,9 @@ var SigmetForm = function SigmetForm(_ref) {
8229
8218
  productConfig: productConfig,
8230
8219
  isDisabled: isDisabled,
8231
8220
  isReadOnly: isReadOnly,
8232
- onChange: onChangeFir
8221
+ onChange: function onChange(event, newPhenomenaList) {
8222
+ onChangeFir(newPhenomenaList || [], event);
8223
+ }
8233
8224
  }), jsx(StartGeometry, {
8234
8225
  isReadOnly: isReadOnly,
8235
8226
  geoJSON: startGeoJSON,
@@ -8452,7 +8443,7 @@ var AirmetForm = function AirmetForm(_ref) {
8452
8443
  hasSurfaceWind = _useConditionalFields.hasSurfaceWind,
8453
8444
  hasLevels = _useConditionalFields.hasLevels,
8454
8445
  hasCloudLevels = _useConditionalFields.hasCloudLevels;
8455
- var onChangeFir = function onChangeFir(event, newPhenomenaList) {
8446
+ var onChangeFir = function onChangeFir(newPhenomenaList, event) {
8456
8447
  var newFIRValue = event == null ? void 0 : event.target.value;
8457
8448
  var newFirGeoJSON = addFeatureProperties(getFir(productConfig, newFIRValue), featurePropsFIR);
8458
8449
  // delete shape
@@ -8519,7 +8510,9 @@ var AirmetForm = function AirmetForm(_ref) {
8519
8510
  isReadOnly: isReadOnly,
8520
8511
  isDisabled: isDisabled,
8521
8512
  productConfig: productConfig,
8522
- onChange: onChangeFir
8513
+ onChange: function onChange(event, newPhenomenaList) {
8514
+ onChangeFir(newPhenomenaList || [], event);
8515
+ }
8523
8516
  }), jsx(StartGeometry, {
8524
8517
  isReadOnly: isReadOnly,
8525
8518
  geoJSON: startGeoJSON,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@opengeoweb/sigmet-airmet",
3
- "version": "10.0.0",
3
+ "version": "10.1.0",
4
4
  "description": "GeoWeb Sigmet/Airmet library for the opengeoweb project",
5
5
  "license": "Apache-2.0",
6
6
  "repository": {
@@ -4,6 +4,5 @@ export interface RadioButtonAndLabelProps {
4
4
  label: string;
5
5
  disabled?: boolean;
6
6
  checked?: boolean;
7
- onChange?: (event: React.ChangeEvent, checked: boolean) => void;
8
7
  }
9
8
  export declare const RadioButtonAndLabel: React.FC<RadioButtonAndLabelProps>;