@opengeoweb/warnings 11.1.0 → 12.0.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,14 +2,14 @@ import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
2
2
  import { useDispatch, useSelector } from 'react-redux';
3
3
  import { Polygons, Share, ExitDomain, Edit, Delete, DrawPolygon, Visibility, Add, CoastalEvent, TemperatureLow, TemperatureHigh, Rain, Snow, Lightning, Fog, Wind, Thunderstorm, VulcanicEruption, Haze, FreezingPrecipitation, ModerateAircraftIcing, SevereAircraftIcing, ModerateTurbulence, SevereTurbulence, SandStorm, RadioactiveMaterials, breakpoints, Options, Close, ChevronDown, ChevronUp, Copy, Update, Success, Expire, Remove, ArrowUpCompact, ArrowDownCompact } from '@opengeoweb/theme';
4
4
  import { uiTypes, uiActions, getSingularDrawtoolDrawLayerId, drawingToolSelectors, layerSelectors, uiSelectors, drawingToolActions, layerActions, useSetupDialog, selectorMemoizationOptions, useUpdateSharedData, layersListener, drawingToolListener, layerReducer, uiReducer, drawingToolReducer } from '@opengeoweb/store';
5
- import { defaultPolygon, emptyGeoJSON, MapControlButton, getIcon, rewindGeometry, getGeoJSONPropertyValue, currentlySupportedDrawModes, defaultLayers, MapView, MapViewLayer, getFeatureExtent } from '@opengeoweb/webmap-react';
5
+ import { defaultPolygon, emptyGeoJSON, MapControlButton, getIcon, rewindGeometry, getGeoJSONPropertyValue, currentlySupportedDrawModes, defaultLayers, viewUtils, OpenLayersMapView, MapControls, OpenLayersZoomControl, OpenLayersLayer, OpenLayersFeatureLayer, genericOpenLayersFeatureStyle } from '@opengeoweb/webmap-react';
6
6
  import { SHARED_NAMESPACE, useConfirmationDialog, ToggleMenu, dateUtils, calculateStartSize, ToolContainerDraggable, AlertBanner, ConfirmationDialog, getAxiosErrorMessage, usePrevious, CustomIconButton, CustomTooltip, Avatar, getInitials, SwitchButton, CustomToggleButton, Filter, FilterChip, FilterOption, StatusTag, LastUpdateTime, ErrorBoundary, isAxiosError } from '@opengeoweb/shared';
7
7
  import { createEntityAdapter, createSlice, createSelector, current, createListenerMiddleware, combineReducers, configureStore } from '@reduxjs/toolkit';
8
8
  import 'i18next';
9
9
  import { useTranslation } from 'react-i18next';
10
10
  import '@opengeoweb/core';
11
11
  import { FORM_FIELDS_NAMESPACE, ReactHookFormHiddenInput, isValidGeoJsonCoordinates, ReactHookFormSelect, ReactHookFormTextField, ReactHookFormProvider, defaultFormOptions, useDraftFormHelpers, errorMessages, ReactHookFormDateTime, isXHoursBefore, isXHoursAfter, isEmpty } from '@opengeoweb/form-fields';
12
- import { LayerType, generateMapId, getWMJSMapById, getGeoCoordFromLatLong, WMBBOX } from '@opengeoweb/webmap';
12
+ import { LayerType, generateMapId } from '@opengeoweb/webmap';
13
13
  import { airmetConfig, sigmetConfig, SigmetForm, isInstanceOfCancelSigmet, AirmetForm, isInstanceOfCancelAirmet, getDefaultValidUntilValue, getProductFormMode, ProductAction } from '@opengeoweb/sigmet-airmet';
14
14
  import { snackbarActions, snackbarTypes, snackbarListener, snackbarReducer } from '@opengeoweb/snackbar';
15
15
  import * as React from 'react';
@@ -9286,34 +9286,8 @@ var ValidUntil = function ValidUntil(_ref) {
9286
9286
  });
9287
9287
  };
9288
9288
 
9289
- var zoomToFeature = function zoomToFeature(mapId, geojsonFeature) {
9290
- var webmapjs = getWMJSMapById(mapId);
9291
- if (!webmapjs || !geojsonFeature) {
9292
- return;
9293
- }
9294
- var bboxGeoJSON = getFeatureExtent(geojsonFeature);
9295
- var projectedCoordinateBoxBottomLeft = getGeoCoordFromLatLong(webmapjs, {
9296
- x: bboxGeoJSON.left,
9297
- y: bboxGeoJSON.bottom
9298
- });
9299
- var projectedCoordinateBoxTopRight = getGeoCoordFromLatLong(webmapjs, {
9300
- x: bboxGeoJSON.right,
9301
- y: bboxGeoJSON.top
9302
- });
9303
- if (projectedCoordinateBoxBottomLeft && projectedCoordinateBoxTopRight) {
9304
- var transformedExtent = new WMBBOX({
9305
- left: projectedCoordinateBoxBottomLeft.x,
9306
- bottom: projectedCoordinateBoxBottomLeft.y,
9307
- right: projectedCoordinateBoxTopRight.x,
9308
- top: projectedCoordinateBoxTopRight.y
9309
- });
9310
- webmapjs.zoomTo(transformedExtent);
9311
- webmapjs.zoomOut(2);
9312
- webmapjs.draw();
9313
- }
9314
- };
9315
9289
  var WarningsMapView = function WarningsMapView(_ref) {
9316
- var _defaultMapPreset$lay, _defaultMapPreset$lay2;
9290
+ var _defaultMapPreset$lay, _defaultMapPreset$lay2, _viewRef$current;
9317
9291
  var geojsonFeature = _ref.geojsonFeature,
9318
9292
  defaultMapPreset = _ref.defaultMapPreset,
9319
9293
  _ref$isSnapshot = _ref.isSnapshot,
@@ -9331,35 +9305,35 @@ var WarningsMapView = function WarningsMapView(_ref) {
9331
9305
  geojson: geojsonFeature,
9332
9306
  layerType: LayerType.featureLayer
9333
9307
  };
9334
- if (!defaultBbox) {
9335
- // Zoom to the geojson when the geojsonFeature is updated in an already mounted map component
9336
- zoomToFeature(mapId, geojsonFeature);
9337
- }
9308
+ var viewRef = useRef(viewUtils.makeView());
9309
+ React.useEffect(function () {
9310
+ if (viewRef.current.getProjection().getCode() !== (defaultBbox == null ? void 0 : defaultBbox.srs)) {
9311
+ viewRef.current = viewUtils.makeView(defaultBbox == null ? void 0 : defaultBbox.srs);
9312
+ }
9313
+ defaultBbox && defaultBbox.bbox ? viewUtils.setViewFromExtent(viewRef.current, defaultBbox == null ? void 0 : defaultBbox.bbox) : viewUtils.setViewFromFeature(viewRef.current, geojsonFeature);
9314
+ }, [defaultBbox, geojsonFeature]);
9338
9315
  return jsx("div", {
9339
9316
  style: {
9340
9317
  height: '200px',
9341
9318
  width: '100%'
9342
9319
  },
9343
- children: jsxs(MapView, {
9344
- bbox: defaultBbox == null ? void 0 : defaultBbox.bbox,
9345
- srs: defaultBbox == null ? void 0 : defaultBbox.srs,
9346
- mapId: mapId,
9347
- showScaleBar: false,
9348
- onWMJSMount: function onWMJSMount(mapId) {
9349
- var webmapjs = getWMJSMapById(mapId);
9350
- if (!webmapjs) {
9351
- return;
9352
- }
9353
- webmapjs.hideMouseCursorProperties();
9354
- if (!defaultBbox) {
9355
- // Zoom to the geojson when the map is ready
9356
- zoomToFeature(mapId, geojsonFeature);
9357
- }
9358
- },
9320
+ children: jsxs(OpenLayersMapView, {
9321
+ view: viewRef.current,
9359
9322
  holdShiftToScroll: true,
9360
- children: [!isSnapshot && jsx(MapViewLayer, Object.assign({}, defaultBaseLayer, {
9323
+ children: [jsx(MapControls, {
9324
+ style: {
9325
+ top: 0
9326
+ },
9327
+ children: jsx(OpenLayersZoomControl, {
9328
+ homeExtent: (_viewRef$current = viewRef.current) == null ? void 0 : _viewRef$current.calculateExtent()
9329
+ })
9330
+ }), !isSnapshot && jsx(OpenLayersLayer, Object.assign({}, defaultBaseLayer, {
9361
9331
  id: mapId + "_baseLayer"
9362
- })), warningLayer.geojson && jsx(MapViewLayer, Object.assign({}, warningLayer)), !isSnapshot && jsx(MapViewLayer, Object.assign({}, defaultOverLayer, {
9332
+ })), warningLayer.geojson && jsx(OpenLayersFeatureLayer, {
9333
+ featureCollection: warningLayer.geojson,
9334
+ style: genericOpenLayersFeatureStyle,
9335
+ zIndex: 1000
9336
+ }), !isSnapshot && jsx(OpenLayersLayer, Object.assign({}, defaultOverLayer, {
9363
9337
  id: mapId + "_overlayer"
9364
9338
  }))]
9365
9339
  })
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@opengeoweb/warnings",
3
- "version": "11.1.0",
3
+ "version": "12.0.0",
4
4
  "description": "GeoWeb warinings library for the opengeoweb project",
5
5
  "license": "Apache-2.0",
6
6
  "repository": {
@@ -8,34 +8,45 @@
8
8
  "url": "git@gitlab.com:opengeoweb/opengeoweb.git"
9
9
  },
10
10
  "dependencies": {
11
- "@opengeoweb/api": "*",
12
- "@opengeoweb/shared": "*",
13
- "@opengeoweb/store": "*",
14
- "@opengeoweb/webmap-react": "*",
15
- "@tanstack/react-query": "^5.52.1",
16
- "react-redux": "^8.1.3",
17
- "@opengeoweb/theme": "*",
18
- "@opengeoweb/form-fields": "*",
19
- "react-hook-form": "^7.50.1",
20
- "lodash": "^4.17.21",
11
+ "@emotion/react": "11.14.0",
12
+ "@emotion/styled": "11.14.0",
13
+ "@mui/material": "^6.1.1",
14
+ "@mui/system": "6.4.6",
15
+ "@mui/x-date-pickers": "7.27.1",
21
16
  "@reduxjs/toolkit": "^1.9.7",
22
- "@opengeoweb/snackbar": "*",
23
- "react-window": "^1.8.10",
24
- "react-virtualized-auto-sizer": "^1.0.20",
17
+ "@sentry/react": "8.54.0",
18
+ "@storybook/core-events": "8.4.2",
19
+ "@storybook/preview-api": "8.4.2",
20
+ "@storybook/react": "8.4.2",
21
+ "@tanstack/query-core": "5.67.1",
22
+ "@tanstack/react-query": "^5.52.1",
23
+ "@testing-library/react": "16.0.1",
24
+ "@testing-library/user-event": "14.5.2",
25
+ "@turf/turf": "7.2.0",
25
26
  "axios": "^1.7.7",
26
- "@opengeoweb/core": "*",
27
- "@opengeoweb/webmap": "*",
28
- "@opengeoweb/authentication": "*",
29
- "@opengeoweb/sigmet-airmet": "*",
30
- "react-i18next": "^15.1.1",
27
+ "date-fns": "4.1.0",
28
+ "dompurify": "3.2.4",
31
29
  "i18next": "^23.11.5",
32
- "@mui/material": "^6.1.1",
33
- "msw": "^2.7.3"
34
- },
35
- "peerDependencies": {
36
- "react": "18",
37
- "@emotion/react": "*",
38
- "@emotion/styled": "*"
30
+ "immer": "10.1.1",
31
+ "jest-canvas-mock": "2.5.2",
32
+ "jest-date-mock": "1.0.10",
33
+ "lodash": "^4.17.21",
34
+ "msw": "^2.7.3",
35
+ "msw-storybook-addon": "2.0.4",
36
+ "ol": "^10.4.0",
37
+ "proj4": "2.15.0",
38
+ "re-resizable": "6.11.2",
39
+ "react": "18.3.1",
40
+ "react-draggable": "4.4.6",
41
+ "react-hook-form": "^7.50.1",
42
+ "react-i18next": "^15.1.1",
43
+ "react-redux": "^8.1.3",
44
+ "react-resize-detector": "9.1.1",
45
+ "react-router-dom": "6.23.1",
46
+ "react-sortablejs": "6.1.4",
47
+ "react-virtualized-auto-sizer": "^1.0.20",
48
+ "react-window": "^1.8.10",
49
+ "sortablejs": "1.15.2"
39
50
  },
40
51
  "module": "./index.esm.js",
41
52
  "type": "module",
@@ -1,7 +1,6 @@
1
1
  import * as React from 'react';
2
2
  import { FeatureCollection } from 'geojson';
3
3
  import { MapPreset } from '@opengeoweb/store';
4
- export declare const zoomToFeature: (mapId: string, geojsonFeature: FeatureCollection | undefined) => void;
5
4
  interface WarningsMapViewProps {
6
5
  geojsonFeature: FeatureCollection | undefined;
7
6
  defaultMapPreset?: MapPreset;