@opengeoweb/warnings 9.37.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/README.md +4 -0
- package/index.esm.js +318 -189
- package/package.json +1 -1
- package/src/index.d.ts +4 -0
- package/src/lib/components/ComponentsLookUp/ComponentsLookUp.d.ts +3 -3
- package/src/lib/components/DrawingToolForm/DrawingToolFormContents.d.ts +1 -1
- package/src/lib/components/FilterList/filter-hooks.d.ts +3 -2
- package/src/lib/components/FilterList/filter-utils.d.ts +11 -3
- package/src/lib/components/PublicWarningList/PublicWarningListConnect.d.ts +5 -3
- package/src/lib/components/PublicWarningsForm/PublicWarningsForm.d.ts +1 -0
- package/src/lib/store/config.d.ts +0 -1
- package/src/lib/store/drawings/index.d.ts +2 -0
- package/src/lib/store/index.d.ts +3 -0
- package/src/lib/store/publicWarningForm/index.d.ts +2 -0
- package/src/lib/store/publicWarningForm/reducer.d.ts +3 -0
- package/src/lib/store/publicWarningForm/types.d.ts +2 -0
- package/src/lib/store/publicWarnings/index.d.ts +2 -0
- package/src/lib/store/publicWarnings/reducer.d.ts +6 -0
- package/src/lib/store/publicWarnings/selectors.d.ts +18 -0
- package/src/lib/store/publicWarnings/types.d.ts +2 -0
package/package.json
CHANGED
package/src/index.d.ts
CHANGED
|
@@ -6,5 +6,9 @@ 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 * from './lib/store';
|
|
9
10
|
export { WARN_NAMESPACE } from './lib/utils/i18n';
|
|
10
11
|
export { warningsTranslations };
|
|
12
|
+
export * as publicWarningsSelectors from './lib/store/publicWarnings/selectors';
|
|
13
|
+
export * from './lib/store/types';
|
|
14
|
+
export * from './lib/store/publicWarnings/reducer';
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import { ApiModule, ApiUrls } from '@opengeoweb/api';
|
|
3
|
-
|
|
3
|
+
import { PublicWarningListConnectProps } from '../PublicWarningList';
|
|
4
|
+
export type WarningListComponentType = 'WarningList';
|
|
4
5
|
export interface ComponentsLookUpPayload {
|
|
5
6
|
componentType: WarningListComponentType;
|
|
6
7
|
id: string;
|
|
@@ -10,8 +11,7 @@ export interface ComponentsLookUpPayload {
|
|
|
10
11
|
export interface ApiModuleProps extends ApiModule {
|
|
11
12
|
config: ApiUrls;
|
|
12
13
|
}
|
|
13
|
-
interface Props extends ApiModuleProps {
|
|
14
|
-
panelId: string;
|
|
14
|
+
interface Props extends ApiModuleProps, PublicWarningListConnectProps {
|
|
15
15
|
}
|
|
16
16
|
export declare const PublicWarningApiWrapper: React.FC<Props>;
|
|
17
17
|
export declare const componentsLookUp: (payload: ComponentsLookUpPayload, apiProps?: ApiModuleProps) => React.ReactElement;
|
|
@@ -19,7 +19,7 @@ export interface DrawingToolFormContentsProps {
|
|
|
19
19
|
isDirty: boolean;
|
|
20
20
|
errors: FieldErrors<FieldValues>;
|
|
21
21
|
onChangeDrawMode: (newMode: DrawMode) => void;
|
|
22
|
-
onChangeOpacity: (event: SelectChangeEvent) => void;
|
|
22
|
+
onChangeOpacity: (event: SelectChangeEvent<unknown>) => void;
|
|
23
23
|
onBlurName: (event: React.FocusEvent<HTMLInputElement>) => void;
|
|
24
24
|
onSubmit: () => void;
|
|
25
25
|
}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { PublicWarning } from '../../store/publicWarningForm/types';
|
|
2
2
|
import { defaultDomainFilter, defaultEmptyFilter, defaultLevelFilter, defaultPhenomenonFilter } from './filter-utils';
|
|
3
|
+
export type UpdateFiltersOrigin = 'user' | 'system';
|
|
3
4
|
export interface PickedFilterState {
|
|
4
5
|
incident: Partial<typeof defaultEmptyFilter>;
|
|
5
6
|
source: Partial<typeof defaultEmptyFilter>;
|
|
@@ -18,10 +19,10 @@ export type FilterKeyType = keyof FilterState;
|
|
|
18
19
|
export type OptionKey<T extends FilterKeyType> = keyof FilterState[T];
|
|
19
20
|
export type UpdateFilter = <T extends FilterKeyType>(filterKey: T | 'ALL', optionKey: OptionKey<T> | 'ALL', value: boolean, only?: boolean) => void;
|
|
20
21
|
export interface FilterHookState {
|
|
21
|
-
filterState: PickedFilterState;
|
|
22
22
|
allSelected: boolean;
|
|
23
23
|
updateFilter: UpdateFilter;
|
|
24
24
|
byFilterState: (warning: PublicWarning) => boolean;
|
|
25
|
+
filterState: PickedFilterState;
|
|
25
26
|
}
|
|
26
|
-
export declare const useWarningFilters: (warnings: PublicWarning[]) => FilterHookState;
|
|
27
|
+
export declare const useWarningFilters: (warnings: PublicWarning[], onUpdateFilters: (filterState: PickedFilterState, origin: UpdateFiltersOrigin) => void, savedFilterState: PickedFilterState, presetFilterState?: PickedFilterState) => FilterHookState;
|
|
27
28
|
export {};
|
|
@@ -26,7 +26,15 @@ export declare const defaultDomainFilter: Record<Domain, boolean>;
|
|
|
26
26
|
export declare const domainLevels: Record<Domain, Level[]>;
|
|
27
27
|
export declare const defaultLevelFilter: Record<Level | 'unspecified', boolean>;
|
|
28
28
|
export declare const defaultEmptyFilter: Record<string, boolean>;
|
|
29
|
-
export declare const
|
|
29
|
+
export declare const makeFilterFromList: <T extends string>(options: T[]) => Record<T | 'unspecified', boolean>;
|
|
30
|
+
export declare const defaultPhenomenonFilter: Record<"unspecified" | Phenomenon, boolean>;
|
|
31
|
+
export declare const initialFilters: {
|
|
32
|
+
incident: Record<string, boolean>;
|
|
33
|
+
source: Record<string, boolean>;
|
|
34
|
+
domain: Record<Domain, boolean>;
|
|
35
|
+
phenomenon: Record<"unspecified" | Phenomenon, boolean>;
|
|
36
|
+
level: Record<"unspecified" | Level, boolean>;
|
|
37
|
+
};
|
|
30
38
|
type OptionsType = Partial<Record<Domain | Level | Phenomenon, boolean>>;
|
|
31
39
|
interface OptionsMetadata {
|
|
32
40
|
/** The number of selected options */
|
|
@@ -34,8 +42,8 @@ interface OptionsMetadata {
|
|
|
34
42
|
/** Whether or not all options are selected */
|
|
35
43
|
allSelected: boolean;
|
|
36
44
|
}
|
|
37
|
-
export declare const
|
|
38
|
-
export declare const updateState: <T extends string>(state: Record<T, boolean
|
|
45
|
+
export declare const getSelectedOptions: (options: OptionsType) => OptionsMetadata;
|
|
46
|
+
export declare const updateState: <T extends string>(state: Partial<Record<T, boolean>>, optionKey: T | 'ALL', value: boolean, only?: boolean) => Record<T, boolean>;
|
|
39
47
|
/** Make sure our value is in the filter */
|
|
40
48
|
export declare const getValue: <T>(values: Record<string, T>, value: string) => T | 'unspecified';
|
|
41
49
|
export declare const getFiltersFromWarnings: (warnings: PublicWarning[], filterKey: string) => string[];
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
|
|
3
|
-
|
|
2
|
+
import { PickedFilterState } from '../FilterList/filter-hooks';
|
|
3
|
+
export interface PublicWarningListConnectProps {
|
|
4
|
+
panelId: string;
|
|
5
|
+
presetFilterState?: PickedFilterState;
|
|
4
6
|
}
|
|
5
|
-
export declare const PublicWarningListConnect: React.FC<
|
|
7
|
+
export declare const PublicWarningListConnect: React.FC<PublicWarningListConnectProps>;
|
|
6
8
|
export default PublicWarningListConnect;
|
|
@@ -20,6 +20,7 @@ export interface FormProps {
|
|
|
20
20
|
defaultMapPreset?: MapPreset;
|
|
21
21
|
onSaveForm?: (formValues: PublicWarningDetail) => void;
|
|
22
22
|
onPublishForm?: (formValues: PublicWarningDetail) => void;
|
|
23
|
+
onClearForm?: () => void;
|
|
23
24
|
object?: DrawingListItem;
|
|
24
25
|
publicWarningDetails?: PublicWarningDetail;
|
|
25
26
|
error?: FormError;
|
|
@@ -16,6 +16,7 @@ export interface PublicWarningFormState {
|
|
|
16
16
|
selectedPublicWarningId?: string;
|
|
17
17
|
isFormDirty?: boolean;
|
|
18
18
|
warningType?: WarningType;
|
|
19
|
+
panelId?: string;
|
|
19
20
|
}
|
|
20
21
|
export declare const TAKEOVER_MESSAGE = "You are no longer the editor of this warning";
|
|
21
22
|
export declare const initialState: PublicWarningFormState;
|
|
@@ -32,11 +33,13 @@ export declare const publicWarningFormActions: import("@reduxjs/toolkit").CaseRe
|
|
|
32
33
|
removeArea: (draft: Draft<PublicWarningFormState>, action: PayloadAction<{
|
|
33
34
|
area: Area;
|
|
34
35
|
}>) => void;
|
|
36
|
+
removeAllAreas: (draft: Draft<PublicWarningFormState>) => void;
|
|
35
37
|
openPublicWarningFormDialog: (draft: Draft<PublicWarningFormState>, action: PayloadAction<{
|
|
36
38
|
object?: DrawingListItem;
|
|
37
39
|
formState?: FormAction;
|
|
38
40
|
publicWarning?: PublicWarning;
|
|
39
41
|
warningType?: WarningType;
|
|
42
|
+
panelId?: string;
|
|
40
43
|
}>) => void;
|
|
41
44
|
toggleEditorWarning: (draft: Draft<PublicWarningFormState>, action: PayloadAction<{
|
|
42
45
|
warningId: string;
|
|
@@ -3,6 +3,7 @@ export interface Area {
|
|
|
3
3
|
objectName: string;
|
|
4
4
|
geoJSON: GeoJSON.FeatureCollection;
|
|
5
5
|
areaId?: string;
|
|
6
|
+
published_warning_uuid?: string;
|
|
6
7
|
}
|
|
7
8
|
export interface PublicWarningDetail {
|
|
8
9
|
id?: string;
|
|
@@ -23,6 +24,7 @@ export interface PublicWarningDetail {
|
|
|
23
24
|
linked_to_id?: string;
|
|
24
25
|
incident?: string;
|
|
25
26
|
firName?: string;
|
|
27
|
+
cancelId?: string;
|
|
26
28
|
}
|
|
27
29
|
export declare enum PublicWarningStatus {
|
|
28
30
|
DRAFT = "DRAFT",
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { PayloadAction, Draft } from '@reduxjs/toolkit';
|
|
2
2
|
import { PublicWarningsState } from './types';
|
|
3
3
|
import { PublicWarning } from '../publicWarningForm/types';
|
|
4
|
+
import { PickedFilterState, UpdateFiltersOrigin } from '../../components/FilterList/filter-hooks';
|
|
4
5
|
export declare const publicWarningsAdapter: import("@reduxjs/toolkit").EntityAdapter<PublicWarning>;
|
|
5
6
|
export declare const initialState: PublicWarningsState;
|
|
6
7
|
export declare const reducer: import("redux").Reducer<PublicWarningsState>;
|
|
@@ -16,4 +17,9 @@ export declare const publicWarningActions: import("@reduxjs/toolkit").CaseReduce
|
|
|
16
17
|
message: string;
|
|
17
18
|
};
|
|
18
19
|
}>) => void;
|
|
20
|
+
setWarningFilters: (draft: Draft<PublicWarningsState>, action: PayloadAction<{
|
|
21
|
+
filterState: PickedFilterState;
|
|
22
|
+
panelId?: string;
|
|
23
|
+
origin: UpdateFiltersOrigin;
|
|
24
|
+
}>) => void;
|
|
19
25
|
}, "publicWarnings">;
|
|
@@ -17,3 +17,21 @@ export declare const getPublicWarningsLastUpdatedTime: ((state: WarningModuleSto
|
|
|
17
17
|
}> & {
|
|
18
18
|
clearCache: () => void;
|
|
19
19
|
};
|
|
20
|
+
export declare const getWarningsFilterById: ((state: WarningModuleStore, panelId?: string | undefined) => import("../../components/FilterList/filter-hooks").PickedFilterState) & import("reselect").OutputSelectorFields<(args_0: Record<string, import("../../components/FilterList/filter-hooks").PickedFilterState>, args_1: string | undefined) => import("../../components/FilterList/filter-hooks").PickedFilterState, {
|
|
21
|
+
clearCache: () => void;
|
|
22
|
+
}> & {
|
|
23
|
+
clearCache: () => void;
|
|
24
|
+
};
|
|
25
|
+
export declare const getWarningsPresetById: ((state: WarningModuleStore, panelId?: string | undefined) => {
|
|
26
|
+
filterState: null;
|
|
27
|
+
} | {
|
|
28
|
+
filterState: import("../../components/FilterList/filter-hooks").PickedFilterState;
|
|
29
|
+
}) & import("reselect").OutputSelectorFields<(args_0: Record<string, import("../../components/FilterList/filter-hooks").PickedFilterState>, args_1: string | undefined) => {
|
|
30
|
+
filterState: null;
|
|
31
|
+
} | {
|
|
32
|
+
filterState: import("../../components/FilterList/filter-hooks").PickedFilterState;
|
|
33
|
+
}, {
|
|
34
|
+
clearCache: () => void;
|
|
35
|
+
}> & {
|
|
36
|
+
clearCache: () => void;
|
|
37
|
+
};
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { EntityState } from '@reduxjs/toolkit';
|
|
2
2
|
import { PublicWarning } from '../publicWarningForm/types';
|
|
3
|
+
import { PickedFilterState } from '../../components/FilterList/filter-hooks';
|
|
3
4
|
export interface FilterTranslation {
|
|
4
5
|
translationKey: string;
|
|
5
6
|
key: string;
|
|
@@ -14,4 +15,5 @@ export interface PublicWarningsState {
|
|
|
14
15
|
isLoading: boolean;
|
|
15
16
|
lastUpdatedTime: string;
|
|
16
17
|
error?: PublicWarningError;
|
|
18
|
+
filterState: Record<string, PickedFilterState>;
|
|
17
19
|
}
|