@opengeoweb/cap 19.0.0 → 19.1.1

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 (44) hide show
  1. package/dist/README.md +14 -0
  2. package/dist/index.d.ts +1 -0
  3. package/dist/index.esm.js +1120 -0
  4. package/dist/src/index.d.ts +4 -0
  5. package/dist/src/lib/components/ComponentsLookUp/componentsLookUp.d.ts +32 -0
  6. package/dist/src/lib/components/ComponentsLookUp/index.d.ts +1 -0
  7. package/dist/src/lib/components/GanttChart/Gantt.d.ts +40 -0
  8. package/dist/src/lib/components/GanttChart/GanttModule.d.ts +7 -0
  9. package/dist/src/lib/components/GanttChart/GanttReactWrapper.d.ts +37 -0
  10. package/dist/src/lib/components/GanttChart/GanttWrapper.d.ts +9 -0
  11. package/dist/src/lib/components/GanttChart/Task.d.ts +29 -0
  12. package/dist/src/lib/components/GanttChart/ViewMode.d.ts +9 -0
  13. package/dist/src/lib/components/GanttChart/mockTasks.d.ts +2 -0
  14. package/dist/src/lib/components/GanttChart/utils.d.ts +5 -0
  15. package/dist/src/lib/components/MapViewCap/MapViewCapConnect.d.ts +18 -0
  16. package/dist/src/lib/components/MapViewCap/MapViewCapConnectWrapper.d.ts +17 -0
  17. package/dist/src/lib/components/MapViewCap/index.d.ts +1 -0
  18. package/dist/src/lib/components/Providers/Providers.d.ts +32 -0
  19. package/dist/src/lib/components/Providers/index.d.ts +1 -0
  20. package/dist/src/lib/components/WarningListCap/WarningListCap.d.ts +10 -0
  21. package/dist/src/lib/components/WarningListCap/WarningListCapConnect.d.ts +7 -0
  22. package/dist/src/lib/components/WarningListCap/WarningListCapConnectWrapper.d.ts +6 -0
  23. package/dist/src/lib/components/WarningListCap/WarningListRowCap/WarningListRowCap.d.ts +7 -0
  24. package/dist/src/lib/components/WarningListCap/WarningListRowCap/WarningListRowCapConnect.d.ts +9 -0
  25. package/dist/src/lib/components/WarningListCap/index.d.ts +1 -0
  26. package/dist/src/lib/components/WarningListCap/types.d.ts +47 -0
  27. package/dist/src/lib/components/types.d.ts +69 -0
  28. package/dist/src/lib/index.d.ts +2 -0
  29. package/dist/src/lib/store/index.d.ts +1 -0
  30. package/dist/src/lib/store/store.d.ts +3 -0
  31. package/dist/src/lib/store/types.d.ts +15 -0
  32. package/dist/src/lib/utils/addColors.d.ts +2 -0
  33. package/dist/src/lib/utils/addFeedAddressToCustomGeoJsonFeature.d.ts +2 -0
  34. package/dist/src/lib/utils/cap-api/api.d.ts +12 -0
  35. package/dist/src/lib/utils/cap-api/fakeApi.d.ts +2 -0
  36. package/dist/src/lib/utils/cap-api/hooks.d.ts +10 -0
  37. package/dist/src/lib/utils/findEventIndexInLanguage.d.ts +10 -0
  38. package/dist/src/lib/utils/highlightGeoJson.d.ts +3 -0
  39. package/dist/src/lib/utils/i18n.d.ts +6 -0
  40. package/dist/src/lib/utils/mockAlert.d.ts +2 -0
  41. package/dist/src/lib/utils/mockCapData.d.ts +3 -0
  42. package/dist/src/lib/utils/mockGeoJson.d.ts +2 -0
  43. package/dist/src/lib/utils/mockGeoJsonMultipleFeatures.d.ts +3 -0
  44. package/package.json +2 -1
@@ -0,0 +1,4 @@
1
+ import capTranslations from '../locales/cap.json';
2
+ export * from './lib';
3
+ export { CAP_NAMESPACE } from './lib/utils/i18n';
4
+ export { capTranslations };
@@ -0,0 +1,32 @@
1
+ import React from 'react';
2
+ import type { InitialMapProps } from '@opengeoweb/core';
3
+ import type { CapFeatures } from '../types';
4
+ export type SupportedComponentTypes = 'CapWarningList' | 'CapWarningMap';
5
+ interface InitialProps {
6
+ mapPreset: {
7
+ layers?: InitialMapProps['mapPreset']['layers'];
8
+ proj: {
9
+ bbox: {
10
+ left: number;
11
+ bottom: number;
12
+ right: number;
13
+ top: number;
14
+ };
15
+ srs: string;
16
+ };
17
+ };
18
+ geoJson: CapFeatures;
19
+ }
20
+ export interface ComponentsLookUpPayload {
21
+ productConfigKey: string;
22
+ componentType: SupportedComponentTypes;
23
+ id: string;
24
+ initialProps: InitialProps;
25
+ }
26
+ /**
27
+ * The lookup table is for registering your own components with the workspace.
28
+ * @param payload
29
+ * @returns
30
+ */
31
+ export declare const ComponentsLookUp: ({ componentType, initialProps, productConfigKey, id, }: ComponentsLookUpPayload) => React.ReactElement;
32
+ export {};
@@ -0,0 +1 @@
1
+ export * from './componentsLookUp';
@@ -0,0 +1,40 @@
1
+ import Gantt from 'frappe-gantt';
2
+ import type { Task } from './Task';
3
+ import { ViewMode } from './ViewMode';
4
+ interface Options {
5
+ view_mode?: ViewMode;
6
+ header_height?: number;
7
+ column_width?: number;
8
+ bar_height?: number;
9
+ language?: string;
10
+ step?: number;
11
+ date_format?: string;
12
+ bar_corner_radius?: number;
13
+ arrow_curve?: number;
14
+ padding?: number;
15
+ popup_trigger?: string;
16
+ custom_popup_html?: (task: Task) => string;
17
+ on_click?: (task: Task) => void;
18
+ on_view_change?: (mode: ViewMode) => void;
19
+ on_progress_change?: (task: Task, progress: number) => void;
20
+ on_date_change?: (task: Task, start: Date, end: Date) => void;
21
+ view_modes?: string[];
22
+ }
23
+ export default class CustomGantt extends Gantt {
24
+ private options;
25
+ private gantt_start;
26
+ private gantt_end;
27
+ private tasks;
28
+ constructor(wrapper: SVGSVGElement, tasks: Task[], options: Options);
29
+ update_view_scale(view_mode: ViewMode): void;
30
+ setup_gantt_dates(): void;
31
+ get_date_info(date: Date, newLastDate: Date, i: number): {
32
+ upper_text: string;
33
+ lower_text: string;
34
+ upper_x: number;
35
+ upper_y: number;
36
+ lower_x: number;
37
+ lower_y: number;
38
+ };
39
+ }
40
+ export {};
@@ -0,0 +1,7 @@
1
+ import React from 'react';
2
+ import type { CapPresets } from '../types';
3
+ interface GanttModuleProps {
4
+ capWarningPresets: CapPresets;
5
+ }
6
+ declare const GanttModule: React.FC<GanttModuleProps>;
7
+ export default GanttModule;
@@ -0,0 +1,37 @@
1
+ import React from 'react';
2
+ import { Task } from './Task';
3
+ import { ViewMode } from './ViewMode';
4
+ export declare const renderDate: (date: Date) => string;
5
+ export declare const renderTime: (date: Date) => string;
6
+ interface GanttReactWrapperProps {
7
+ tasks: Task[];
8
+ viewMode?: ViewMode;
9
+ onTasksChange?: (tasks: Task[]) => void;
10
+ onClick?: (task: Task) => void;
11
+ onDateChange?: (task: Task, start: Date, end: Date) => void;
12
+ onProgressChange?: (task: Task, progress: number) => void;
13
+ onViewChange?: (mode: ViewMode) => void;
14
+ }
15
+ interface FrappeGanttState {
16
+ viewMode: ViewMode;
17
+ tasks: Task[];
18
+ }
19
+ export declare class GanttReactWrapper extends React.Component<GanttReactWrapperProps, FrappeGanttState> {
20
+ private _target;
21
+ private _svg;
22
+ private _gantt;
23
+ static defaultProps: {
24
+ viewMode: ViewMode;
25
+ onTasksChange: () => void;
26
+ onClick: () => void;
27
+ onDateChange: () => void;
28
+ onProgressChange: () => void;
29
+ onViewChange: () => void;
30
+ };
31
+ constructor(props: GanttReactWrapperProps);
32
+ static getDerivedStateFromProps(nextProps: GanttReactWrapperProps): FrappeGanttState;
33
+ componentDidMount(): void;
34
+ componentDidUpdate(): void;
35
+ render(): React.ReactElement;
36
+ }
37
+ export {};
@@ -0,0 +1,9 @@
1
+ import React from 'react';
2
+ import type { Task } from './Task';
3
+ import { ViewMode } from './ViewMode';
4
+ interface GantWrapperProps {
5
+ tasks: Task[];
6
+ defaultViewMode?: ViewMode;
7
+ }
8
+ declare const GantWrapper: React.FC<GantWrapperProps>;
9
+ export default GantWrapper;
@@ -0,0 +1,29 @@
1
+ export declare class Task {
2
+ private _dependencies;
3
+ id: string;
4
+ name: string;
5
+ start: string;
6
+ end: string;
7
+ _end: Date;
8
+ _start: Date;
9
+ severity: 'Minor' | 'Moderate' | 'Severe' | 'Extreme';
10
+ title: string;
11
+ description: string;
12
+ author: string;
13
+ area: string;
14
+ phenomenon: string;
15
+ constructor(options?: Partial<Task>);
16
+ /**
17
+ * Progress in percentage
18
+ */
19
+ private _progress;
20
+ get progress(): number;
21
+ set progress(value: number);
22
+ /**
23
+ * A css custom class for the task chart bar
24
+ */
25
+ custom_class?: string;
26
+ setDependencies(value: string | string[]): void;
27
+ set dependencies(value: string[] | string);
28
+ get dependencies(): string[] | string;
29
+ }
@@ -0,0 +1,9 @@
1
+ export declare enum ViewMode {
2
+ Hour = "Hour",
3
+ QuarterDay = "Quarter Day",
4
+ HalfDay = "Half Day",
5
+ Day = "Day",
6
+ Week = "Week",
7
+ Month = "Month",
8
+ Year = "Year"
9
+ }
@@ -0,0 +1,2 @@
1
+ import type { Task } from './Task';
2
+ export declare const tasks: Task[];
@@ -0,0 +1,5 @@
1
+ import type { CustomFeature } from '../types';
2
+ import type { Task } from './Task';
3
+ export declare const convertSeverityToColorClass: (severity: Task["severity"]) => string;
4
+ export declare const getEndDateFromHeadline: (headline: string) => Date;
5
+ export declare const convertFeaturesToTasks: (features: CustomFeature[]) => Task[];
@@ -0,0 +1,18 @@
1
+ import React from 'react';
2
+ import type { InitialMapProps } from '@opengeoweb/core';
3
+ import type { CapPresets } from '../types';
4
+ export interface MapViewCapConnectProps {
5
+ id?: string;
6
+ title?: string;
7
+ bbox?: {
8
+ left: number;
9
+ bottom: number;
10
+ right: number;
11
+ top: number;
12
+ };
13
+ srs?: string;
14
+ capWarningPresets: CapPresets;
15
+ layers?: InitialMapProps['mapPreset']['layers'];
16
+ children?: React.ReactNode;
17
+ }
18
+ export declare const MapViewCapConnect: React.FC<MapViewCapConnectProps>;
@@ -0,0 +1,17 @@
1
+ import React from 'react';
2
+ import type { InitialMapProps } from '@opengeoweb/core';
3
+ interface MapViewCapConnectWrapperProps {
4
+ id?: string;
5
+ title?: string;
6
+ bbox?: {
7
+ left: number;
8
+ bottom: number;
9
+ right: number;
10
+ top: number;
11
+ };
12
+ srs?: string;
13
+ productConfigKey: string;
14
+ layers?: InitialMapProps['mapPreset']['layers'];
15
+ }
16
+ export declare const MapViewCapConnectWrapper: React.FC<MapViewCapConnectWrapperProps>;
17
+ export {};
@@ -0,0 +1 @@
1
+ export * from './MapViewCapConnect';
@@ -0,0 +1,32 @@
1
+ import type { Theme } from '@mui/material';
2
+ import type { Store } from '@reduxjs/toolkit';
3
+ import { QueryClient } from '@tanstack/react-query';
4
+ import type i18n from 'i18next';
5
+ import React from 'react';
6
+ import type { ThemeProviderProps } from '@opengeoweb/theme';
7
+ export declare const CapThemeWrapper: React.FC<ThemeProviderProps>;
8
+ interface CapQueryClientProviderProps {
9
+ children: React.ReactNode;
10
+ customClient?: QueryClient;
11
+ }
12
+ interface CapThemeStoreProviderProps extends CapQueryClientProviderProps {
13
+ theme?: Theme;
14
+ store: Store;
15
+ i18nInstance?: typeof i18n;
16
+ }
17
+ interface CapTranslationsWrapperProps {
18
+ children?: React.ReactNode;
19
+ i18nInstance?: typeof i18n;
20
+ }
21
+ /**
22
+ * A Provider component which returns the QueryClientProvider for the Cap library
23
+ * @param children
24
+ * @returns
25
+ */
26
+ export declare const CapQueryClientProvider: React.FC<CapQueryClientProviderProps>;
27
+ export interface CapStoreProviderProps extends ThemeProviderProps {
28
+ store: Store;
29
+ }
30
+ export declare const CapThemeStoreProvider: React.FC<CapThemeStoreProviderProps>;
31
+ export declare const CapI18nProvider: React.FC<CapTranslationsWrapperProps>;
32
+ export {};
@@ -0,0 +1 @@
1
+ export * from './Providers';
@@ -0,0 +1,10 @@
1
+ import React from 'react';
2
+ import type { CapPresets } from '../types';
3
+ import type { CapAlert } from '../../store/types';
4
+ interface WarningListCapProps {
5
+ capWarningPresets: CapPresets;
6
+ alerts: CapAlert[];
7
+ isPending?: boolean;
8
+ }
9
+ export declare const WarningListCap: React.FC<WarningListCapProps>;
10
+ export {};
@@ -0,0 +1,7 @@
1
+ import React from 'react';
2
+ import type { CapPresets } from '../types';
3
+ interface WarningListCapConnectProps {
4
+ capWarningPresets: CapPresets;
5
+ }
6
+ export declare const WarningListCapConnect: React.FC<WarningListCapConnectProps>;
7
+ export {};
@@ -0,0 +1,6 @@
1
+ import React from 'react';
2
+ interface WarningListCapConnectWrapperProps {
3
+ productConfigKey: string;
4
+ }
5
+ export declare const WarningListCapConnectWrapper: React.FC<WarningListCapConnectWrapperProps>;
6
+ export {};
@@ -0,0 +1,7 @@
1
+ import React from 'react';
2
+ export interface WarningListRowCapProps {
3
+ event: string;
4
+ severity: string;
5
+ expires: string;
6
+ }
7
+ export declare const WarningListRowCap: React.FC<WarningListRowCapProps>;
@@ -0,0 +1,9 @@
1
+ import React from 'react';
2
+ import type { CapAlert } from '../../../store/types';
3
+ import type { CapPresets } from '../../types';
4
+ interface WarningListRowCapConnectProps {
5
+ alert: CapAlert;
6
+ capWarningPresets: CapPresets;
7
+ }
8
+ export declare const WarningListRowCapConnect: React.FC<WarningListRowCapConnectProps>;
9
+ export {};
@@ -0,0 +1 @@
1
+ export * from './WarningListCap';
@@ -0,0 +1,47 @@
1
+ export interface CapData {
2
+ alert: {
3
+ identifier: string;
4
+ feedAddress: string;
5
+ sent: string;
6
+ status: string;
7
+ msgType: string;
8
+ scope: string;
9
+ code: string[];
10
+ references: string;
11
+ info: Info[];
12
+ };
13
+ }
14
+ interface Info {
15
+ language: string;
16
+ category: string;
17
+ event: string;
18
+ urgency: string;
19
+ severity: string;
20
+ certainty: string;
21
+ eventCode: {
22
+ valueName: string;
23
+ value: string;
24
+ };
25
+ onset: string;
26
+ expires: string;
27
+ senderName: string;
28
+ headline: string;
29
+ description: string;
30
+ web: string;
31
+ contact: string;
32
+ parameter: Parameter[];
33
+ area: Area | Area[];
34
+ }
35
+ interface Parameter {
36
+ valueName: string;
37
+ value: number | string;
38
+ }
39
+ interface Area {
40
+ areaDesc: string;
41
+ polygon: string | string[];
42
+ geocode: {
43
+ valueName: string;
44
+ value: string | number;
45
+ };
46
+ }
47
+ export {};
@@ -0,0 +1,69 @@
1
+ export interface CapPresets {
2
+ pollInterval: number;
3
+ feeds: Feed[];
4
+ }
5
+ interface Feed {
6
+ feedAddress: string;
7
+ feedType: string;
8
+ }
9
+ export interface CapWarnings {
10
+ alert: CapAlert;
11
+ features: CapFeatures;
12
+ }
13
+ export interface CapAlert {
14
+ feedAddress: string;
15
+ identifier: string;
16
+ severity: string;
17
+ certainty: string;
18
+ onset: string;
19
+ expires: string;
20
+ languages: Language[];
21
+ }
22
+ export interface CapFeatures extends GeoJSON.FeatureCollection {
23
+ type: 'FeatureCollection';
24
+ features: CustomFeature[];
25
+ }
26
+ export interface CustomFeature {
27
+ type: 'Feature';
28
+ geometry: GeoJSON.Geometry;
29
+ id?: string | number;
30
+ properties: CustomProperties;
31
+ }
32
+ interface CustomProperties {
33
+ fill?: string;
34
+ stroke?: string;
35
+ 'stroke-width'?: number;
36
+ 'stroke-opacity'?: number;
37
+ details: CustomDetails;
38
+ }
39
+ export interface CustomDetails {
40
+ feedAddress: string;
41
+ identifier: string;
42
+ senderName?: string;
43
+ severity: string;
44
+ certainty: string;
45
+ onset: string;
46
+ expires: string;
47
+ languages: Language[];
48
+ }
49
+ export interface Language {
50
+ areaDesc: string;
51
+ language: string;
52
+ event: string;
53
+ senderName: string;
54
+ headline: string;
55
+ description: string;
56
+ }
57
+ interface SeverityStyle {
58
+ border?: string;
59
+ background?: string;
60
+ fill?: string;
61
+ stroke?: string;
62
+ }
63
+ export interface SeverityStyles {
64
+ Extreme: SeverityStyle;
65
+ Severe: SeverityStyle;
66
+ Moderate: SeverityStyle;
67
+ Minor: SeverityStyle;
68
+ }
69
+ export {};
@@ -0,0 +1,2 @@
1
+ export * from './components/ComponentsLookUp';
2
+ export * from './store';
@@ -0,0 +1 @@
1
+ export * from './store';
@@ -0,0 +1,3 @@
1
+ import type { Store } from '@reduxjs/toolkit';
2
+ import type { CoreAppStore } from '@opengeoweb/store';
3
+ export declare const createMockStore: (mockState?: CoreAppStore) => Store;
@@ -0,0 +1,15 @@
1
+ import type { Language } from '../components/types';
2
+ export interface CapAlert {
3
+ feedAddress: string;
4
+ identifier: string;
5
+ severity: string;
6
+ certainty: string;
7
+ onset: string;
8
+ expires: string;
9
+ languages: Language[];
10
+ }
11
+ export interface CapFeed {
12
+ id: string;
13
+ lastUpdated: number;
14
+ alertIds: string[];
15
+ }
@@ -0,0 +1,2 @@
1
+ import type { CustomFeature } from '../components/types';
2
+ export declare const addColors: (features: CustomFeature[]) => CustomFeature[];
@@ -0,0 +1,2 @@
1
+ import type { CustomFeature } from '../components/types';
2
+ export declare const addFeedAddressToCustomGeoJSonFeature: (feedAddress: string, features: CustomFeature[]) => CustomFeature[];
@@ -0,0 +1,12 @@
1
+ import type { CapAlert, CapPresets, CustomFeature } from '../../components/types';
2
+ export interface FeedAddressLink {
3
+ feedAddress: string;
4
+ link: string;
5
+ }
6
+ export interface CapAlertAndFeatures {
7
+ alert: CapAlert;
8
+ features: CustomFeature[];
9
+ }
10
+ export declare const getConfig: (productConfigKey: string) => Promise<CapPresets>;
11
+ export declare const getFeedLinks: (feedAddress: string) => Promise<FeedAddressLink[]>;
12
+ export declare const getSingleAlert: (alertUrl: FeedAddressLink) => Promise<CapAlertAndFeatures>;
@@ -0,0 +1,2 @@
1
+ export declare const generateAlertId: () => string;
2
+ export declare const capApiEndpoints: import("msw").HttpHandler[];
@@ -0,0 +1,10 @@
1
+ import type { UseQueryResult } from '@tanstack/react-query';
2
+ import type { CapAlertAndFeatures } from './api';
3
+ import type { CapPresets } from '../../components/types';
4
+ interface CombinePendingResult<T> {
5
+ results: T;
6
+ pending: boolean;
7
+ }
8
+ export declare const useGetConfig: (productConfigKey: string) => UseQueryResult<CapPresets>;
9
+ export declare const useAllFeedAlerts: (capPresets: CapPresets) => CombinePendingResult<CapAlertAndFeatures[]>;
10
+ export {};
@@ -0,0 +1,10 @@
1
+ import type { CapPresets } from '../components/types';
2
+ interface Language {
3
+ language: string;
4
+ event: string;
5
+ senderName: string;
6
+ headline: string;
7
+ description: string;
8
+ }
9
+ export declare const findEventIndexInLanguage: (language: string, languages: Language[], capWarningPresets: CapPresets, feedAddressFromProps: string) => number;
10
+ export {};
@@ -0,0 +1,3 @@
1
+ import type { FeatureEvent } from '@opengeoweb/webmap-react';
2
+ import type { CustomFeature } from '../components/types';
3
+ export declare const highlightGeoJson: (currentFeatures: Record<string, CustomFeature[]>, featureResults?: FeatureEvent) => Record<string, CustomFeature[]>;
@@ -0,0 +1,6 @@
1
+ import i18n from 'i18next';
2
+ import type { UseTranslationResponse } from 'react-i18next';
3
+ export declare const CAP_NAMESPACE = "cap";
4
+ export declare const initCapI18n: () => typeof i18n;
5
+ export declare const useCapTranslation: () => UseTranslationResponse<typeof CAP_NAMESPACE, typeof i18n>;
6
+ export { i18n };
@@ -0,0 +1,2 @@
1
+ import type { CapAlert } from '../components/types';
2
+ export declare const mockAlert: CapAlert;
@@ -0,0 +1,3 @@
1
+ import type { CapPresets, CapWarnings } from '../components/types';
2
+ export declare const mockCapWarningPresets: CapPresets;
3
+ export declare const mockCapWarnings: CapWarnings;
@@ -0,0 +1,2 @@
1
+ import type { CapFeatures } from '../components/types';
2
+ export declare const mockGeoJson: CapFeatures;
@@ -0,0 +1,3 @@
1
+ import type { CapFeatures, CustomFeature } from '../components/types';
2
+ export declare const mockGeoJsonMultipleFeatures: CapFeatures;
3
+ export declare const mockGeoJsonMultipleFeaturesById: Record<string, CustomFeature[]>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@opengeoweb/cap",
3
- "version": "19.0.0",
3
+ "version": "19.1.1",
4
4
  "description": "GeoWeb Common Alerting Protocol (CAP) library for the opengeoweb project",
5
5
  "license": "Apache-2.0",
6
6
  "repository": {
@@ -48,6 +48,7 @@
48
48
  },
49
49
  "files": [
50
50
  "dist",
51
+ "!dist/package.json",
51
52
  "README.md",
52
53
  "package.json"
53
54
  ]