@opengeoweb/warnings 9.21.0 → 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 +31 -16
- package/package.json +2 -2
- package/src/index.d.ts +1 -0
- package/src/lib/utils/i18n.d.ts +1 -0
package/index.esm.js
CHANGED
|
@@ -8,6 +8,7 @@ import { createEntityAdapter, createSlice, createSelector, createListenerMiddlew
|
|
|
8
8
|
import i18n from 'i18next';
|
|
9
9
|
import { useTranslation } from 'react-i18next';
|
|
10
10
|
import { defaultBbox } from '@opengeoweb/core';
|
|
11
|
+
import { FORM_FIELDS_NAMESPACE, ReactHookFormHiddenInput, isValidGeoJsonCoordinates, ReactHookFormSelect, ReactHookFormTextField, ReactHookFormProvider, defaultFormOptions, useDraftFormHelpers, errorMessages, ReactHookFormDateTime, isXHoursBefore, isXHoursAfter, isEmpty } from '@opengeoweb/form-fields';
|
|
11
12
|
import { snackbarActions } from '@opengeoweb/snackbar';
|
|
12
13
|
import * as React from 'react';
|
|
13
14
|
import React__default, { useState, useEffect, useRef } from 'react';
|
|
@@ -15,12 +16,11 @@ import { styled, Box, Typography, ListItem, Grid, Paper, ListItemButton, Stack,
|
|
|
15
16
|
import { VariableSizeList } from 'react-window';
|
|
16
17
|
import AutoSizer from 'react-virtualized-auto-sizer';
|
|
17
18
|
import { getApi, createApiInstance, createNonAuthApiInstance, createFakeApiInstance, ApiProvider } from '@opengeoweb/api';
|
|
18
|
-
import { ReactHookFormHiddenInput, isValidGeoJsonCoordinates, ReactHookFormSelect, ReactHookFormTextField, ReactHookFormProvider, defaultFormOptions, useDraftFormHelpers, errorMessages, ReactHookFormDateTime, isXHoursBefore, isXHoursAfter, isEmpty } from '@opengeoweb/form-fields';
|
|
19
19
|
import { useFormContext } from 'react-hook-form';
|
|
20
20
|
import { isEqual, cloneDeep, clamp } from 'lodash';
|
|
21
21
|
import { useAuthenticationContext } from '@opengeoweb/authentication';
|
|
22
22
|
import { produce } from 'immer';
|
|
23
|
-
import { generateMapId, LayerType, getWMJSMapById, WMBBOX } from '@opengeoweb/webmap';
|
|
23
|
+
import { generateMapId, LayerType, getWMJSMapById, getGeoCoordFromLatLong, WMBBOX } from '@opengeoweb/webmap';
|
|
24
24
|
import { isAxiosError } from 'axios';
|
|
25
25
|
|
|
26
26
|
var en = {
|
|
@@ -1712,10 +1712,11 @@ const {
|
|
|
1712
1712
|
const getWarningFormDirty = createSelector(selectDrawByInstanceId, drawing => (drawing === null || drawing === void 0 ? void 0 : drawing.isFormDirty) || false);
|
|
1713
1713
|
|
|
1714
1714
|
const WARN_NAMESPACE = 'warn';
|
|
1715
|
+
const ns = [WARN_NAMESPACE, FORM_FIELDS_NAMESPACE];
|
|
1715
1716
|
const translateKeyOutsideComponents = (key, params = undefined) => i18n.t(key, Object.assign({
|
|
1716
|
-
ns
|
|
1717
|
+
ns
|
|
1717
1718
|
}, params));
|
|
1718
|
-
const useWarningsTranslation = () => useTranslation(
|
|
1719
|
+
const useWarningsTranslation = () => useTranslation(ns);
|
|
1719
1720
|
|
|
1720
1721
|
/* *
|
|
1721
1722
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
@@ -8049,11 +8050,11 @@ const zoomToFeature = (mapId, geojsonFeature) => {
|
|
|
8049
8050
|
return;
|
|
8050
8051
|
}
|
|
8051
8052
|
const bboxGeoJSON = getFeatureExtent(geojsonFeature);
|
|
8052
|
-
const projectedCoordinateBoxBottomLeft =
|
|
8053
|
+
const projectedCoordinateBoxBottomLeft = getGeoCoordFromLatLong(webmapjs, {
|
|
8053
8054
|
x: bboxGeoJSON.left,
|
|
8054
8055
|
y: bboxGeoJSON.bottom
|
|
8055
8056
|
});
|
|
8056
|
-
const projectedCoordinateBoxTopRight =
|
|
8057
|
+
const projectedCoordinateBoxTopRight = getGeoCoordFromLatLong(webmapjs, {
|
|
8057
8058
|
x: bboxGeoJSON.right,
|
|
8058
8059
|
y: bboxGeoJSON.top
|
|
8059
8060
|
});
|
|
@@ -8095,6 +8096,9 @@ const WarningsMapView = ({
|
|
|
8095
8096
|
showScaleBar: false,
|
|
8096
8097
|
onWMJSMount: mapId => {
|
|
8097
8098
|
const webmapjs = getWMJSMapById(mapId);
|
|
8099
|
+
if (!webmapjs) {
|
|
8100
|
+
return;
|
|
8101
|
+
}
|
|
8098
8102
|
webmapjs.hideMouseCursorProperties();
|
|
8099
8103
|
if (!geojsonFeature) {
|
|
8100
8104
|
return;
|
|
@@ -9555,12 +9559,12 @@ const PublicWarningListConnect = () => {
|
|
|
9555
9559
|
auth
|
|
9556
9560
|
} = useAuthenticationContext();
|
|
9557
9561
|
const [confirmDialogOptions, setConfirmDialogOptions] = React__default.useState(undefined);
|
|
9558
|
-
const warnings = useSelector(
|
|
9559
|
-
const selectedPublicWarningId = useSelector(
|
|
9560
|
-
const isLoading = useSelector(
|
|
9561
|
-
const error = useSelector(
|
|
9562
|
-
const isFormDirty = useSelector(
|
|
9563
|
-
const lastUpdatedTime = useSelector(
|
|
9562
|
+
const warnings = useSelector(selectAllPublicWarnings);
|
|
9563
|
+
const selectedPublicWarningId = useSelector(getSelectedPublicWarningId);
|
|
9564
|
+
const isLoading = useSelector(isPublicWarningsLoading);
|
|
9565
|
+
const error = useSelector(getPublicWarningsError);
|
|
9566
|
+
const isFormDirty = useSelector(getSelectedPublicIsFormDirty);
|
|
9567
|
+
const lastUpdatedTime = useSelector(getPublicWarningsLastUpdatedTime);
|
|
9564
9568
|
const openPublicWarningDialog = (formAction, publicWarning) => __awaiter(void 0, void 0, void 0, function* () {
|
|
9565
9569
|
if (isFormDirty) {
|
|
9566
9570
|
const mayProceed = yield confirmDialog(warningFormConfirmationOptions(t)).then(() => true).catch(() => false);
|
|
@@ -9580,9 +9584,20 @@ const PublicWarningListConnect = () => {
|
|
|
9580
9584
|
const createWarning = () => {
|
|
9581
9585
|
openPublicWarningDialog('');
|
|
9582
9586
|
};
|
|
9583
|
-
const editWarning = publicWarning => {
|
|
9584
|
-
|
|
9585
|
-
|
|
9587
|
+
const editWarning = publicWarning => __awaiter(void 0, void 0, void 0, function* () {
|
|
9588
|
+
if (publicWarning.id && (auth === null || auth === void 0 ? void 0 : auth.username) && !publicWarning.editor) {
|
|
9589
|
+
yield dispatch(publicWarningFormActions.toggleEditorWarning({
|
|
9590
|
+
warningId: publicWarning.id,
|
|
9591
|
+
isEditor: true,
|
|
9592
|
+
username: auth === null || auth === void 0 ? void 0 : auth.username
|
|
9593
|
+
}));
|
|
9594
|
+
yield openPublicWarningDialog('', Object.assign(Object.assign({}, publicWarning), {
|
|
9595
|
+
editor: auth === null || auth === void 0 ? void 0 : auth.username
|
|
9596
|
+
}));
|
|
9597
|
+
} else {
|
|
9598
|
+
openPublicWarningDialog('', publicWarning);
|
|
9599
|
+
}
|
|
9600
|
+
});
|
|
9586
9601
|
const openSnackbar = message => {
|
|
9587
9602
|
dispatch(snackbarActions.openSnackbar({
|
|
9588
9603
|
message
|
|
@@ -10009,4 +10024,4 @@ const drawingModuleConfig = {
|
|
|
10009
10024
|
middlewares: [drawingsListener.middleware, publicWarningsListener.middleware, publicWarningFormListener.middleware]
|
|
10010
10025
|
};
|
|
10011
10026
|
|
|
10012
|
-
export { DrawingToolConnect, Wrapper as DrawingToolForm, DrawingToolFormConnect, DrawingToolMapButtonConnect, ObjectManagerConnect, ObjectManagerMapButtonConnect, PublicWarningApiWrapper, PublicWarningsFormDialog, PublicWarningsFormDialogConnect, WarningsModuleProvider, componentsLookUp, drawingModuleConfig, isAlreadyEdited, useObjectDrawDialogAction, warningFormConfirmationOptions, warningsTranslations };
|
|
10027
|
+
export { DrawingToolConnect, Wrapper as DrawingToolForm, DrawingToolFormConnect, DrawingToolMapButtonConnect, ObjectManagerConnect, ObjectManagerMapButtonConnect, PublicWarningApiWrapper, PublicWarningsFormDialog, PublicWarningsFormDialogConnect, WARN_NAMESPACE, WarningsModuleProvider, componentsLookUp, drawingModuleConfig, isAlreadyEdited, useObjectDrawDialogAction, warningFormConfirmationOptions, warningsTranslations };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@opengeoweb/warnings",
|
|
3
|
-
"version": "9.
|
|
3
|
+
"version": "9.22.0",
|
|
4
4
|
"description": "GeoWeb warinings library for the opengeoweb project",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"repository": {
|
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
"@opengeoweb/store": "*",
|
|
14
14
|
"@opengeoweb/webmap-react": "*",
|
|
15
15
|
"react-redux": "^8.1.3",
|
|
16
|
-
"@mui/material": "
|
|
16
|
+
"@mui/material": "^5.16.0",
|
|
17
17
|
"@opengeoweb/theme": "*",
|
|
18
18
|
"@opengeoweb/form-fields": "*",
|
|
19
19
|
"react-hook-form": "^7.50.1",
|
package/src/index.d.ts
CHANGED
|
@@ -6,4 +6,5 @@ export * from './lib/components/DrawingToolForm';
|
|
|
6
6
|
export * from './lib/components/PublicWarningsFormDialog';
|
|
7
7
|
export * from './lib/components/ComponentsLookUp';
|
|
8
8
|
export * from './lib/store/config';
|
|
9
|
+
export { WARN_NAMESPACE } from './lib/utils/i18n';
|
|
9
10
|
export { warningsTranslations };
|
package/src/lib/utils/i18n.d.ts
CHANGED
|
@@ -4,3 +4,4 @@ export declare const WARN_NAMESPACE = "warn";
|
|
|
4
4
|
export declare const initWarnI18n: () => void;
|
|
5
5
|
export declare const translateKeyOutsideComponents: (key: string, params?: Record<string, string | number> | undefined) => string;
|
|
6
6
|
export declare const useWarningsTranslation: () => UseTranslationResponse<typeof WARN_NAMESPACE, typeof i18n>;
|
|
7
|
+
export { i18n };
|