@opengeoweb/warnings 9.8.0 → 9.10.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 +19 -17
- package/package.json +3 -3
- package/src/lib/components/PublicWarningsForm/PublicWarningsForm.d.ts +2 -2
- package/src/lib/store/drawings/types.d.ts +2 -2
- package/src/lib/store/publicWarningForm/reducer.d.ts +2 -2
- package/src/lib/store/publicWarningForm/types.d.ts +4 -4
- package/src/lib/store/publicWarnings/types.d.ts +4 -4
- package/src/lib/utils/api.d.ts +2 -2
package/index.esm.js
CHANGED
|
@@ -4225,17 +4225,16 @@ var DrawingToolForm = function DrawingToolForm(_ref) {
|
|
|
4225
4225
|
_useFormContext$formS = _useFormContext.formState,
|
|
4226
4226
|
errors = _useFormContext$formS.errors,
|
|
4227
4227
|
isDirty = _useFormContext$formS.isDirty,
|
|
4228
|
-
reset = _useFormContext.reset
|
|
4228
|
+
reset = _useFormContext.reset,
|
|
4229
|
+
getValues = _useFormContext.getValues;
|
|
4229
4230
|
useFormDirty({
|
|
4230
4231
|
isDirty: isDirty,
|
|
4231
4232
|
isLoading: isLoading,
|
|
4232
4233
|
error: error,
|
|
4233
4234
|
onFormDirty: onFormDirty,
|
|
4234
4235
|
onSuccess: function onSuccess() {
|
|
4235
|
-
// reset form dirty after successfull saving
|
|
4236
|
-
reset(
|
|
4237
|
-
keepValues: true
|
|
4238
|
-
});
|
|
4236
|
+
// reset form dirty and update defaultvalues and formvalues after successfull saving
|
|
4237
|
+
reset(getValues());
|
|
4239
4238
|
}
|
|
4240
4239
|
});
|
|
4241
4240
|
React.useEffect(function () {
|
|
@@ -4335,7 +4334,7 @@ var DrawingToolForm = function DrawingToolForm(_ref) {
|
|
|
4335
4334
|
onKeyDown: onKeyDown,
|
|
4336
4335
|
disabled: isLoading,
|
|
4337
4336
|
size: "medium"
|
|
4338
|
-
}, getIcon(mode.
|
|
4337
|
+
}, getIcon(mode.selectionType));
|
|
4339
4338
|
}), isInEditMode && ( /*#__PURE__*/React.createElement(Typography, {
|
|
4340
4339
|
component: "span",
|
|
4341
4340
|
sx: {
|
|
@@ -4429,7 +4428,8 @@ var Wrapper = function Wrapper(props) {
|
|
|
4429
4428
|
defaultValues: {
|
|
4430
4429
|
id: id,
|
|
4431
4430
|
objectName: getObjectName$1(objectName),
|
|
4432
|
-
geoJSON: geoJSON
|
|
4431
|
+
geoJSON: geoJSON,
|
|
4432
|
+
opacity: 20
|
|
4433
4433
|
}
|
|
4434
4434
|
})
|
|
4435
4435
|
}, /*#__PURE__*/React.createElement(DrawingToolForm, Object.assign({}, props)));
|
|
@@ -5238,10 +5238,10 @@ var MAX_HOURS_AFTER_CURRENT$1 = 168;
|
|
|
5238
5238
|
var VALID_FROM_ERROR_BEFORE_CURRENT = 'Valid from time cannot be before current time';
|
|
5239
5239
|
var VALID_FROM_ERROR_AFTER_CURRENT = "Valid from time can be no more than ".concat(MAX_HOURS_AFTER_CURRENT$1, " hours after current time");
|
|
5240
5240
|
var isValueBeforeCurrentTime$1 = function isValueBeforeCurrentTime(value) {
|
|
5241
|
-
return isXHoursBefore(value, dateUtils.
|
|
5241
|
+
return isXHoursBefore(value, dateUtils.getCurrentTimeAsString(), 0) || VALID_FROM_ERROR_BEFORE_CURRENT;
|
|
5242
5242
|
};
|
|
5243
5243
|
var isMaxHoursAfterCurrentTime$1 = function isMaxHoursAfterCurrentTime(value) {
|
|
5244
|
-
return isXHoursAfter(value, dateUtils.
|
|
5244
|
+
return isXHoursAfter(value, dateUtils.getCurrentTimeAsString(), MAX_HOURS_AFTER_CURRENT$1) || VALID_FROM_ERROR_AFTER_CURRENT;
|
|
5245
5245
|
};
|
|
5246
5246
|
var ValidFrom = function ValidFrom(_ref) {
|
|
5247
5247
|
var isDisabled = _ref.isDisabled,
|
|
@@ -5297,10 +5297,10 @@ var VALID_UNTIL_ERROR_BEFORE_CURRENT = 'Valid until time cannot be before curren
|
|
|
5297
5297
|
var VALID_UNTIL_ERROR_AFTER_CURRENT = "Valid until time can be no more than ".concat(MAX_HOURS_AFTER_CURRENT, " hours after current time");
|
|
5298
5298
|
var VALID_UNTIL_ERROR_AFTER_VALID_FROM = "Valid until time has to be at least ".concat(MIN_HOURS_AFTER_VALID_FROM, " hour after Valid from time");
|
|
5299
5299
|
var isValueBeforeCurrentTime = function isValueBeforeCurrentTime(value) {
|
|
5300
|
-
return isXHoursBefore(value, dateUtils.
|
|
5300
|
+
return isXHoursBefore(value, dateUtils.getCurrentTimeAsString(), 0) || VALID_UNTIL_ERROR_BEFORE_CURRENT;
|
|
5301
5301
|
};
|
|
5302
5302
|
var isMaxHoursAfterCurrentTime = function isMaxHoursAfterCurrentTime(value) {
|
|
5303
|
-
return isXHoursAfter(value, dateUtils.
|
|
5303
|
+
return isXHoursAfter(value, dateUtils.getCurrentTimeAsString(), MAX_HOURS_AFTER_CURRENT) || VALID_UNTIL_ERROR_AFTER_CURRENT;
|
|
5304
5304
|
};
|
|
5305
5305
|
var _isMinHoursAfterValidFrom = function isMinHoursAfterValidFrom(value, validFromValue) {
|
|
5306
5306
|
if (isEmpty(value) || isEmpty(validFromValue) || !isValidDate(validFromValue)) {
|
|
@@ -5362,7 +5362,10 @@ var getEmptyPublicWarning = function getEmptyPublicWarning() {
|
|
|
5362
5362
|
};
|
|
5363
5363
|
};
|
|
5364
5364
|
var getFormData = function getFormData(publicWarningsDetails, object) {
|
|
5365
|
-
var data = Object.assign(Object.assign({
|
|
5365
|
+
var data = Object.assign(Object.assign({
|
|
5366
|
+
IS_DRAFT: '',
|
|
5367
|
+
'translation-select': ''
|
|
5368
|
+
}, publicWarningsDetails ? Object.assign(Object.assign({}, getEmptyPublicWarning()), publicWarningsDetails) : getEmptyPublicWarning()), {
|
|
5366
5369
|
object: object
|
|
5367
5370
|
});
|
|
5368
5371
|
return data;
|
|
@@ -5482,7 +5485,8 @@ var Form = function Form(_ref5) {
|
|
|
5482
5485
|
var _useFormContext = useFormContext(),
|
|
5483
5486
|
handleSubmit = _useFormContext.handleSubmit,
|
|
5484
5487
|
reset = _useFormContext.reset,
|
|
5485
|
-
isDirty = _useFormContext.formState.isDirty
|
|
5488
|
+
isDirty = _useFormContext.formState.isDirty,
|
|
5489
|
+
getValues = _useFormContext.getValues;
|
|
5486
5490
|
var _useDraftFormHelpers = useDraftFormHelpers(),
|
|
5487
5491
|
toggleIsDraft = _useDraftFormHelpers.toggleIsDraft,
|
|
5488
5492
|
DraftFieldHelper = _useDraftFormHelpers.DraftFieldHelper;
|
|
@@ -5495,10 +5499,8 @@ var Form = function Form(_ref5) {
|
|
|
5495
5499
|
error: error === null || error === void 0 ? void 0 : error.message,
|
|
5496
5500
|
onFormDirty: onFormDirty,
|
|
5497
5501
|
onSuccess: function onSuccess() {
|
|
5498
|
-
// reset form dirty after successfull saving
|
|
5499
|
-
reset(
|
|
5500
|
-
keepValues: true
|
|
5501
|
-
});
|
|
5502
|
+
// reset form dirty and update defaultvalues and formvalues after successfull saving
|
|
5503
|
+
reset(getValues());
|
|
5502
5504
|
}
|
|
5503
5505
|
});
|
|
5504
5506
|
var onPressPublish = function onPressPublish() {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@opengeoweb/warnings",
|
|
3
|
-
"version": "9.
|
|
3
|
+
"version": "9.10.0",
|
|
4
4
|
"description": "GeoWeb warinings library for the opengeoweb project",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"repository": {
|
|
@@ -14,10 +14,10 @@
|
|
|
14
14
|
"@opengeoweb/store": "*",
|
|
15
15
|
"@opengeoweb/webmap-react": "*",
|
|
16
16
|
"react-redux": "^8.1.3",
|
|
17
|
-
"@mui/material": "5.
|
|
17
|
+
"@mui/material": "~5.15.11",
|
|
18
18
|
"@opengeoweb/theme": "*",
|
|
19
19
|
"@opengeoweb/form-fields": "*",
|
|
20
|
-
"react-hook-form": "7.
|
|
20
|
+
"react-hook-form": "^7.50.1",
|
|
21
21
|
"lodash": "^4.17.21",
|
|
22
22
|
"redux-saga": "^1.2.3",
|
|
23
23
|
"@reduxjs/toolkit": "^1.9.7",
|
|
@@ -3,7 +3,7 @@ import { PublicWarningDetail } from '../../store/publicWarningForm/types';
|
|
|
3
3
|
import { BaseDrawingListItem, DrawingListItem } from '../../store/drawings/types';
|
|
4
4
|
import { FormAction, FormError } from '../../store/publicWarningForm/reducer';
|
|
5
5
|
export declare const getEmptyPublicWarning: () => PublicWarningDetail;
|
|
6
|
-
export declare const getFormData: (publicWarningsDetails: PublicWarningDetail | undefined, object?: DrawingListItem) =>
|
|
6
|
+
export declare const getFormData: (publicWarningsDetails: PublicWarningDetail | undefined, object?: DrawingListItem) => FormData;
|
|
7
7
|
export declare const LABEL_PROBABILITY = "Probability";
|
|
8
8
|
export declare const BUTTON_CLEAR = "Clear";
|
|
9
9
|
export declare const BUTTON_SAVE = "Save";
|
|
@@ -11,7 +11,7 @@ export declare const BUTTON_SAVING = "Saving";
|
|
|
11
11
|
export declare const BUTTON_PUBLISH = "Publish";
|
|
12
12
|
export declare const BUTTON_PUBLISHING = "Publishing";
|
|
13
13
|
interface FormData extends PublicWarningDetail {
|
|
14
|
-
IS_DRAFT?: boolean;
|
|
14
|
+
IS_DRAFT?: boolean | string;
|
|
15
15
|
object?: BaseDrawingListItem;
|
|
16
16
|
'translation-select'?: string;
|
|
17
17
|
}
|
|
@@ -24,10 +24,10 @@ export interface DrawingDetails extends Omit<DrawingFromBE, 'id' | 'lastUpdatedT
|
|
|
24
24
|
lastUpdatedTime?: string;
|
|
25
25
|
}
|
|
26
26
|
export type SetDrawValuesPayload = DrawItem;
|
|
27
|
-
export
|
|
27
|
+
export interface SubmitDrawValuesPayload {
|
|
28
28
|
id?: string;
|
|
29
29
|
geoJSON: GeoJSON.FeatureCollection;
|
|
30
30
|
objectName: string;
|
|
31
31
|
lastUpdatedTime?: string;
|
|
32
32
|
scope: DrawingScope;
|
|
33
|
-
}
|
|
33
|
+
}
|
|
@@ -3,10 +3,10 @@ import { AlertColor } from '@mui/material';
|
|
|
3
3
|
import { DrawingListItem } from '../drawings/types';
|
|
4
4
|
import { PublicWarning } from './types';
|
|
5
5
|
export type FormAction = '' | 'saving' | 'publishing' | 'readonly';
|
|
6
|
-
export
|
|
6
|
+
export interface FormError {
|
|
7
7
|
severity?: AlertColor;
|
|
8
8
|
message: string;
|
|
9
|
-
}
|
|
9
|
+
}
|
|
10
10
|
export interface PublicWarningFormState {
|
|
11
11
|
object?: DrawingListItem;
|
|
12
12
|
publicWarning?: PublicWarning;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export
|
|
1
|
+
export interface PublicWarningDetail {
|
|
2
2
|
id: string;
|
|
3
3
|
phenomenon: string;
|
|
4
4
|
geoJSON: GeoJSON.FeatureCollection;
|
|
@@ -12,12 +12,12 @@ export type PublicWarningDetail = {
|
|
|
12
12
|
warningProposalSource?: string;
|
|
13
13
|
authority?: string;
|
|
14
14
|
type?: number;
|
|
15
|
-
}
|
|
15
|
+
}
|
|
16
16
|
export type PublicWarningStatus = 'DRAFT' | 'PUBLISHED' | 'TODO' | 'EXPIRED';
|
|
17
|
-
export
|
|
17
|
+
export interface PublicWarning {
|
|
18
18
|
status?: PublicWarningStatus;
|
|
19
19
|
editor?: string;
|
|
20
20
|
warningDetail: PublicWarningDetail;
|
|
21
21
|
id?: string;
|
|
22
22
|
lastUpdatedTime?: string;
|
|
23
|
-
}
|
|
23
|
+
}
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import { EntityState } from '@reduxjs/toolkit';
|
|
2
2
|
import { PublicWarning } from '../publicWarningForm/types';
|
|
3
|
-
export
|
|
3
|
+
export interface PublicWarningError {
|
|
4
4
|
name: string;
|
|
5
5
|
message: string;
|
|
6
|
-
}
|
|
7
|
-
export
|
|
6
|
+
}
|
|
7
|
+
export interface PublicWarningsState {
|
|
8
8
|
warnings: EntityState<PublicWarning>;
|
|
9
9
|
isLoading: boolean;
|
|
10
10
|
lastUpdatedTime: string;
|
|
11
11
|
error?: PublicWarningError;
|
|
12
|
-
}
|
|
12
|
+
}
|
package/src/lib/utils/api.d.ts
CHANGED
|
@@ -4,7 +4,7 @@ import { DrawingDetails, DrawingFromBE, DrawingListItem } from '../store/drawing
|
|
|
4
4
|
import { PublicWarning } from '../store/publicWarningForm/types';
|
|
5
5
|
export declare const API_NAME = "warnings";
|
|
6
6
|
export declare const getIdFromUrl: (url: string) => string;
|
|
7
|
-
export
|
|
7
|
+
export interface WarningsApi {
|
|
8
8
|
getDrawings: () => Promise<{
|
|
9
9
|
data: DrawingListItem[];
|
|
10
10
|
}>;
|
|
@@ -21,7 +21,7 @@ export type WarningsApi = {
|
|
|
21
21
|
updateWarning: (warningId: string, data: PublicWarning) => Promise<void>;
|
|
22
22
|
deleteWarning: (warningId: string) => Promise<void>;
|
|
23
23
|
toggleEditorWarning: (warningId: string, isEditor: boolean) => Promise<void>;
|
|
24
|
-
}
|
|
24
|
+
}
|
|
25
25
|
export declare const getApiRoutes: (axiosInstance: AxiosInstance) => WarningsApi;
|
|
26
26
|
export declare const getWarningsApi: () => WarningsApi;
|
|
27
27
|
export declare const createApi: (props: CreateApiProps) => WarningsApi;
|