@opengeoweb/warnings 9.3.0 → 9.4.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.
Files changed (22) hide show
  1. package/index.esm.js +1902 -23072
  2. package/package.json +1 -1
  3. package/src/lib/components/PublicWarningList/ConfirmDeleteWarningDialog.d.ts +11 -0
  4. package/src/lib/components/PublicWarningList/ConfirmDeleteWarningDialog.spec.d.ts +1 -0
  5. package/src/lib/components/PublicWarningList/PublicWarningList.d.ts +2 -0
  6. package/src/lib/components/PublicWarningList/PublicWarningListConnect.d.ts +1 -0
  7. package/src/lib/components/PublicWarningList/PublicWarningListConnect.stories.d.ts +1 -0
  8. package/src/lib/components/PublicWarningsForm/DescriptionField/DescriptionField.d.ts +1 -0
  9. package/src/lib/components/PublicWarningsForm/LevelField/LevelField.d.ts +1 -0
  10. package/src/lib/components/PublicWarningsForm/PhenomenonField/PhenomenonField.d.ts +1 -0
  11. package/src/lib/components/PublicWarningsForm/PublicWarningsForm.d.ts +1 -0
  12. package/src/lib/components/PublicWarningsForm/PublicWarningsForm.stories.d.ts +2 -0
  13. package/src/lib/components/PublicWarningsForm/ValidFromField/ValidFromField.d.ts +1 -0
  14. package/src/lib/components/PublicWarningsForm/ValidUntilField/ValidUntilField.d.ts +1 -0
  15. package/src/lib/components/PublicWarningsFormDialog/PublicWarningsFormDialogConnect.d.ts +7 -0
  16. package/src/lib/store/publicWarningForm/reducer.d.ts +8 -6
  17. package/src/lib/store/publicWarningForm/selectors.d.ts +6 -1
  18. package/src/lib/store/publicWarningForm/types.d.ts +1 -0
  19. package/src/lib/utils/api.d.ts +2 -0
  20. package/src/lib/utils/fakeApi.d.ts +1 -0
  21. package/src/lib/utils/useFormDirty.d.ts +7 -0
  22. package/src/lib/utils/useFormDirty.spec.d.ts +1 -0
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@opengeoweb/warnings",
3
- "version": "9.3.0",
3
+ "version": "9.4.0",
4
4
  "description": "GeoWeb warinings library for the opengeoweb project",
5
5
  "license": "Apache-2.0",
6
6
  "repository": {
@@ -0,0 +1,11 @@
1
+ import React from 'react';
2
+ export declare const DELETE_TITLE = "Delete warning";
3
+ export declare const DELETE_CONFIRM = "Delete";
4
+ export declare const CANCEL = "Go back";
5
+ export declare const getDeleteDescription: () => string;
6
+ export declare const ConfirmDeleteWarningDialog: React.FC<{
7
+ warningId: string;
8
+ onDeleteSucces: (warningId: string) => void;
9
+ onClose: () => void;
10
+ }>;
11
+ export default ConfirmDeleteWarningDialog;
@@ -3,6 +3,7 @@ import React from 'react';
3
3
  import { PublicWarning, PublicWarningStatus } from '../../store/publicWarningForm/types';
4
4
  export declare const CREATE_WARNING = "Create a warning";
5
5
  export declare const BUTTON_EDIT = "Edit";
6
+ export declare const BUTTON_DELETE = "Delete";
6
7
  export declare const BUTTON_OPTIONS = "Options";
7
8
  export declare const WarningListColumnContent: React.FC<GridProps & {
8
9
  title?: string;
@@ -17,6 +18,7 @@ export declare const PublicWarningList: React.FC<{
17
18
  onSelectWarning?: (warning: PublicWarning) => void;
18
19
  onEditWarning?: (warning: PublicWarning) => void;
19
20
  onCreateWarning?: () => void;
21
+ onDeleteWarning?: (warningId: string) => void;
20
22
  selectedPublicWarningId?: string;
21
23
  }>;
22
24
  export default PublicWarningList;
@@ -1,3 +1,4 @@
1
1
  import React from 'react';
2
+ export declare const DELETE_WARNING_SUCCESS_MESSAGE = "Warning has been deleted";
2
3
  export declare const PublicWarningListConnect: React.FC;
3
4
  export default PublicWarningListConnect;
@@ -6,3 +6,4 @@ export default _default;
6
6
  export declare const PublicWarningListLight: () => React.ReactElement;
7
7
  export declare const PublicWarningListDark: () => React.ReactElement;
8
8
  export declare const PublicWarningListError: () => React.ReactElement;
9
+ export declare const PublicWarningListErrorDeleteWarning: () => React.ReactElement;
@@ -1,4 +1,5 @@
1
1
  import React from 'react';
2
2
  export declare const DescriptionField: React.FC<{
3
3
  isDisabled?: boolean;
4
+ isReadOnly?: boolean;
4
5
  }>;
@@ -8,4 +8,5 @@ export declare const levelOptions: {
8
8
  }[];
9
9
  export declare const LevelField: React.FC<{
10
10
  isDisabled?: boolean;
11
+ isReadOnly?: boolean;
11
12
  }>;
@@ -7,4 +7,5 @@ export declare const warningPhenomena: {
7
7
  }[];
8
8
  export declare const Phenomenon: React.FC<{
9
9
  isDisabled?: boolean;
10
+ isReadOnly?: boolean;
10
11
  }>;
@@ -23,6 +23,7 @@ interface FormProps {
23
23
  object?: DrawingListItem;
24
24
  publicWarningDetails?: PublicWarningDetail;
25
25
  error?: string;
26
+ onFormDirty?: (isFormDirty: boolean) => void;
26
27
  }
27
28
  export declare const PublicWarningsForm: React.FC<FormProps>;
28
29
  export {};
@@ -25,3 +25,5 @@ export declare const PublicWarningsErrorFormDemo: () => React.ReactElement;
25
25
  export declare const PublicWarningsErrorFormDemoDark: () => React.ReactElement;
26
26
  export declare const PublicWarningsReadOnlyFormDemo: () => React.ReactElement;
27
27
  export declare const PublicWarningsReadOnlyFormDemoDark: () => React.ReactElement;
28
+ export declare const PublicWarningsDisabledFormDemo: () => React.ReactElement;
29
+ export declare const PublicWarningsDisabledFormDemoDark: () => React.ReactElement;
@@ -6,4 +6,5 @@ export declare const isValueBeforeCurrentTime: (value: string) => boolean | stri
6
6
  export declare const isMaxHoursAfterCurrentTime: (value: string) => boolean | string;
7
7
  export declare const ValidFrom: React.FC<{
8
8
  isDisabled?: boolean;
9
+ isReadOnly?: boolean;
9
10
  }>;
@@ -8,4 +8,5 @@ export declare const isMaxHoursAfterCurrentTime: (value: string) => boolean | st
8
8
  export declare const isMinHoursAfterValidFrom: (value: string, validFromValue: string) => boolean | string;
9
9
  export declare const ValidUntil: React.FC<{
10
10
  isDisabled?: boolean;
11
+ isReadOnly?: boolean;
11
12
  }>;
@@ -1,6 +1,13 @@
1
1
  import React from 'react';
2
2
  import { uiTypes } from '@opengeoweb/store';
3
3
  import { Position } from '@opengeoweb/shared';
4
+ export declare const warningFormConfirmationOptions: {
5
+ cancelLabel: string;
6
+ title: string;
7
+ description: string;
8
+ confirmLabel: string;
9
+ catchOnCancel: boolean;
10
+ };
4
11
  export declare const PublicWarningsFormDialogConnect: React.FC<{
5
12
  bounds?: string;
6
13
  source?: uiTypes.Source;
@@ -1,28 +1,27 @@
1
1
  import { PayloadAction, Draft } from '@reduxjs/toolkit';
2
2
  import { DrawingListItem } from '../drawings/types';
3
- import { PublicWarning, PublicWarningDetail, PublicWarningStatus } from './types';
3
+ import { PublicWarning } from './types';
4
4
  export type FormAction = '' | 'saving' | 'publishing' | 'readonly';
5
5
  export interface PublicWarningFormState {
6
6
  object?: DrawingListItem;
7
- publicWarningDetail?: PublicWarningDetail;
8
- status?: PublicWarningStatus;
7
+ publicWarning?: PublicWarning;
9
8
  formState?: FormAction;
10
9
  error?: string;
11
10
  selectedPublicWarningId?: string;
11
+ isFormDirty?: boolean;
12
12
  }
13
13
  export declare const initialState: PublicWarningFormState;
14
14
  export declare const reducer: import("redux").Reducer<PublicWarningFormState, import("redux").AnyAction>;
15
15
  export declare const publicWarningFormActions: import("@reduxjs/toolkit").CaseReducerActions<{
16
16
  setFormValues: (draft: Draft<PublicWarningFormState>, action: PayloadAction<{
17
17
  object?: DrawingListItem;
18
- publicWarningDetail?: PublicWarningDetail;
18
+ publicWarning?: PublicWarning;
19
19
  formState?: FormAction;
20
20
  }>) => void;
21
21
  openPublicWarningFormDialog: (draft: Draft<PublicWarningFormState>, action: PayloadAction<{
22
22
  object?: DrawingListItem;
23
- publicWarningDetail?: PublicWarningDetail;
24
23
  formState?: FormAction;
25
- status?: PublicWarningStatus;
24
+ publicWarning?: PublicWarning;
26
25
  }>) => void;
27
26
  publishWarning: (draft: Draft<PublicWarningFormState>, action: PayloadAction<{
28
27
  publicWarning: PublicWarning;
@@ -41,4 +40,7 @@ export declare const publicWarningFormActions: import("@reduxjs/toolkit").CaseRe
41
40
  setFormError: (draft: Draft<PublicWarningFormState>, action: PayloadAction<{
42
41
  error: string;
43
42
  }>) => void;
43
+ setFormDirty: (draft: Draft<PublicWarningFormState>, action: PayloadAction<{
44
+ isFormDirty: boolean;
45
+ }>) => void;
44
46
  }, "publicWarningForm">;
@@ -6,7 +6,7 @@ export declare const getPublicWarningObject: ((state: WarningModuleStore) => imp
6
6
  }> & {
7
7
  clearCache: () => void;
8
8
  };
9
- export declare const getPublicWarning: ((state: WarningModuleStore) => import("./types").PublicWarningDetail | undefined) & import("reselect").OutputSelectorFields<(args_0: PublicWarningFormState) => import("./types").PublicWarningDetail | undefined, {
9
+ export declare const getPublicWarning: ((state: WarningModuleStore) => import("./types").PublicWarning | undefined) & import("reselect").OutputSelectorFields<(args_0: PublicWarningFormState) => import("./types").PublicWarning | undefined, {
10
10
  clearCache: () => void;
11
11
  }> & {
12
12
  clearCache: () => void;
@@ -31,3 +31,8 @@ export declare const getSelectedPublicWarningId: ((state: WarningModuleStore) =>
31
31
  }> & {
32
32
  clearCache: () => void;
33
33
  };
34
+ export declare const getSelectedPublicIsFormDirty: ((state: WarningModuleStore) => boolean) & import("reselect").OutputSelectorFields<(args_0: PublicWarningFormState) => boolean, {
35
+ clearCache: () => void;
36
+ }> & {
37
+ clearCache: () => void;
38
+ };
@@ -16,6 +16,7 @@ export type PublicWarningDetail = {
16
16
  export type PublicWarningStatus = 'DRAFT' | 'PUBLISHED' | 'TODO' | 'EXPIRED';
17
17
  export type PublicWarning = {
18
18
  status: PublicWarningStatus;
19
+ editor?: string;
19
20
  warningDetail: PublicWarningDetail;
20
21
  id?: string;
21
22
  lastUpdatedTime?: string;
@@ -19,6 +19,8 @@ export type WarningsApi = {
19
19
  }>;
20
20
  saveWarningAs: (data: PublicWarning) => Promise<string>;
21
21
  updateWarning: (warningId: string, data: PublicWarning) => Promise<void>;
22
+ deleteWarning: (warningId: string) => Promise<void>;
23
+ toggleEditorWarning: (warningId: string, isEditor: boolean) => Promise<void>;
22
24
  };
23
25
  export declare const getApiRoutes: (axiosInstance: AxiosInstance) => WarningsApi;
24
26
  export declare const getWarningsApi: () => WarningsApi;
@@ -1,5 +1,6 @@
1
1
  import { WarningsApi } from './api';
2
2
  import { DrawingFromBE } from '../store/drawings/types';
3
3
  export declare const ERROR_NOT_FOUND = "Request failed with status code 400";
4
+ export declare const MOCK_USERNAME = "user.name";
4
5
  export declare const extractDrawingDetailsFromJSON: (drawingId: string) => DrawingFromBE;
5
6
  export declare const createApi: () => WarningsApi;
@@ -0,0 +1,7 @@
1
+ export declare const useFormDirty: ({ isDirty, isLoading, error, onFormDirty, onSuccess, }: {
2
+ isDirty: boolean;
3
+ isLoading: boolean;
4
+ error: string | undefined;
5
+ onFormDirty: (isFormDirty: boolean) => void;
6
+ onSuccess: () => void;
7
+ }) => void;
@@ -0,0 +1 @@
1
+ export {};