@opengeoweb/shared 9.25.3 → 9.27.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 CHANGED
@@ -10,7 +10,7 @@ import Draggable from 'react-draggable';
10
10
  import { Resizable } from 're-resizable';
11
11
  import * as Sentry from '@sentry/react';
12
12
  import { useStore } from 'react-redux';
13
- import { parseISO, parse, format, isEqual, add as add$1, sub as sub$1, differenceInYears as differenceInYears$1, differenceInMonths as differenceInMonths$1, differenceInDays as differenceInDays$1, differenceInMinutes as differenceInMinutes$1, differenceInHours as differenceInHours$1, differenceInSeconds as differenceInSeconds$1, isBefore as isBefore$1, isAfter as isAfter$1, isValid as isValid$1, getUnixTime, fromUnixTime, set as set$3, getHours as getHours$1, startOfDay, addMinutes, addHours, getDay, getDayOfYear, getMonth, getWeek, getYear, isWithinInterval } from 'date-fns';
13
+ import { parseISO, parse, format, isEqual, add as add$1, sub as sub$1, differenceInYears as differenceInYears$1, differenceInMonths as differenceInMonths$1, differenceInDays as differenceInDays$1, differenceInMinutes as differenceInMinutes$1, differenceInHours as differenceInHours$1, differenceInSeconds as differenceInSeconds$1, roundToNearestMinutes as roundToNearestMinutes$1, isBefore as isBefore$1, isAfter as isAfter$1, isValid as isValid$1, getUnixTime, fromUnixTime, set as set$3, getHours as getHours$1, startOfDay, addMinutes, addHours, getDay, getDayOfYear, getMonth, getWeek, getYear, isWithinInterval } from 'date-fns';
14
14
  import configureStore from 'redux-mock-store';
15
15
  import { configureStore as configureStore$1 } from '@reduxjs/toolkit';
16
16
 
@@ -8492,10 +8492,24 @@ const Filter = /*#__PURE__*/React.forwardRef((_a, ref) => {
8492
8492
  }));
8493
8493
  });
8494
8494
 
8495
+ const FilterLabel = ({
8496
+ name
8497
+ }) => jsx(Typography, Object.assign({
8498
+ variant: "body2",
8499
+ sx: {
8500
+ fontSize: '16px',
8501
+ textOverflow: 'ellipsis',
8502
+ whiteSpace: 'nowrap',
8503
+ overflow: 'hidden'
8504
+ }
8505
+ }, {
8506
+ children: name
8507
+ }));
8495
8508
  const FilterListItem = ({
8496
8509
  filter,
8497
8510
  toggleFilter: _toggleFilter = () => {},
8498
- enableOnlyOneFilter: _enableOnlyOneFilter = () => {}
8511
+ enableOnlyOneFilter: _enableOnlyOneFilter = () => {},
8512
+ children
8499
8513
  }) => {
8500
8514
  const {
8501
8515
  t
@@ -8572,17 +8586,9 @@ const FilterListItem = ({
8572
8586
  }
8573
8587
  }
8574
8588
  })
8575
- })), jsx(Typography, Object.assign({
8576
- variant: "body2",
8577
- sx: {
8578
- fontSize: '16px',
8579
- textOverflow: 'ellipsis',
8580
- whiteSpace: 'nowrap',
8581
- overflow: 'hidden'
8582
- }
8583
- }, {
8584
- children: name
8585
- })), isHovering ? jsx(ListItemSecondaryAction, {
8589
+ })), children || jsx(FilterLabel, {
8590
+ name: name
8591
+ }), isHovering ? jsx(ListItemSecondaryAction, {
8586
8592
  children: jsx(CustomIconButton, Object.assign({
8587
8593
  "aria-label": `Only ${filter.name}`,
8588
8594
  style: {
@@ -9023,6 +9029,15 @@ const differenceInHours = (dateLeft, dateRight, roundingMethod) => {
9023
9029
  const differenceInSeconds = (dateLeft, dateRight) => {
9024
9030
  return differenceInSeconds$1(dateLeft, dateRight);
9025
9031
  };
9032
+ /**
9033
+ *
9034
+ * @param date - the date to be rounded
9035
+ * @param options - the options for rounding
9036
+ * @returns the new date
9037
+ */
9038
+ const roundToNearestMinutes = (date, options) => {
9039
+ return roundToNearestMinutes$1(date, options);
9040
+ };
9026
9041
  /**
9027
9042
  *
9028
9043
  * @param date - the date that should be before the other one to return true
@@ -9073,13 +9088,13 @@ const getUtcFromString = dateStr => {
9073
9088
  }
9074
9089
  return isoStringToDate(dateStr);
9075
9090
  };
9076
- const hasOffset = input => {
9077
- return !!getOffsetStr(input);
9091
+ const hasOffset = dateStr => {
9092
+ return !!getOffsetStr(dateStr);
9078
9093
  };
9079
- const getOffsetStr = input => {
9080
- const isoDatePattern = /(\d{4}-\d{2}-\d{2})T(\d{2}:\d{2}:\d{2})(\.\d+)?([+-]\d{2}:?\d{2}|Z)$/;
9081
- const groups = input.match(isoDatePattern);
9082
- return groups ? groups[4] : null;
9094
+ const getOffsetStr = dateStr => {
9095
+ const offsetMatcher = /T.*([+-]\d{2}(:?\d{2})?|Z)$/;
9096
+ const groups = dateStr.match(offsetMatcher);
9097
+ return groups ? groups[1] : null;
9083
9098
  };
9084
9099
  /**
9085
9100
  * Check if a date object is valid
@@ -9368,6 +9383,7 @@ var index = /*#__PURE__*/Object.freeze({
9368
9383
  isoStringToDate: isoStringToDate,
9369
9384
  parseCustomDateString: parseCustomDateString,
9370
9385
  parseISO: parseISO,
9386
+ roundToNearestMinutes: roundToNearestMinutes,
9371
9387
  set: set,
9372
9388
  setUTCDate: setUTCDate,
9373
9389
  startOfDay: startOfDay,
@@ -9426,6 +9442,98 @@ const createToolkitMockStoreWithEggs = storeConfig => {
9426
9442
  return store;
9427
9443
  };
9428
9444
 
9445
+ /* *
9446
+ * Licensed under the Apache License, Version 2.0 (the "License");
9447
+ * you may not use this file except in compliance with the License.
9448
+ * You may obtain a copy of the License at
9449
+ *
9450
+ * http://www.apache.org/licenses/LICENSE-2.0
9451
+ *
9452
+ * Unless required by applicable law or agreed to in writing, software
9453
+ * distributed under the License is distributed on an "AS IS" BASIS,
9454
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
9455
+ * See the License for the specific language governing permissions and
9456
+ * limitations under the License.
9457
+ *
9458
+ * Copyright 2024 - Koninklijk Nederlands Meteorologisch Instituut (KNMI)
9459
+ * Copyright 2024 - Finnish Meteorological Institute (FMI)
9460
+ * Copyright 2024 - The Norwegian Meteorological Institute (MET Norway)
9461
+ * */
9462
+ const PROJECTION = {
9463
+ EPSG_3035: {
9464
+ name: 'ETRS89-extended / LAEA Europe',
9465
+ value: 'EPSG:3035'
9466
+ },
9467
+ EPSG_3067: {
9468
+ name: 'ETRS89 / TM35FIN(E,N) -- Finland',
9469
+ value: 'EPSG:3067'
9470
+ },
9471
+ EPSG_3411: {
9472
+ name: 'Sea Ice Polar Stereographic North',
9473
+ value: 'EPSG:3411'
9474
+ },
9475
+ EPSG_3412: {
9476
+ name: 'Sea Ice Polar Stereographic South',
9477
+ value: 'EPSG:3412'
9478
+ },
9479
+ EPSG_3575: {
9480
+ name: 'Northern Hemisphere North Pole',
9481
+ value: 'EPSG:3575'
9482
+ },
9483
+ EPSG_3785: {
9484
+ name: 'Pseudo-Mercator',
9485
+ value: 'EPSG:3785'
9486
+ },
9487
+ EPSG_3857: {
9488
+ name: 'Europe Mercator',
9489
+ value: 'EPSG:3857'
9490
+ },
9491
+ EPSG_4258: {
9492
+ name: 'ETRS89',
9493
+ value: 'EPSG:4258'
9494
+ },
9495
+ EPSG_4269: {
9496
+ name: 'NAD83 (long/lat)',
9497
+ value: 'EPSG:4269'
9498
+ },
9499
+ EPSG_4325: {
9500
+ name: 'Guam Map Grid',
9501
+ value: 'EPSG:4325'
9502
+ },
9503
+ EPSG_4326: {
9504
+ name: 'WGS 84 - WGS84 - World Geodetic System',
9505
+ value: 'EPSG:4326'
9506
+ },
9507
+ EPSG_7399: {
9508
+ name: 'WISCRS Vilas County (ftUS)',
9509
+ value: 'EPSG:7399'
9510
+ },
9511
+ EPSG_25832: {
9512
+ name: 'ETRS89 / UTM zone 32N',
9513
+ value: 'EPSG:25832'
9514
+ },
9515
+ EPSG_28992: {
9516
+ name: 'The Netherlands (28992)',
9517
+ value: 'EPSG:28992'
9518
+ },
9519
+ EPSG_32661: {
9520
+ name: 'Europe Polar Stereographic',
9521
+ value: 'EPSG:32661'
9522
+ },
9523
+ EPSG_54030: {
9524
+ name: 'Europe Robinson',
9525
+ value: 'EPSG:54030'
9526
+ },
9527
+ EPSG_900913: {
9528
+ name: 'Google Maps Global Mercator',
9529
+ value: 'EPSG:900913'
9530
+ },
9531
+ EPSG_102100: {
9532
+ name: 'WGS 84 / Pseudo-Mercator',
9533
+ value: 'EPSG:102100'
9534
+ }
9535
+ };
9536
+
9429
9537
  /* *
9430
9538
  * Licensed under the Apache License, Version 2.0 (the "License");
9431
9539
  * you may not use this file except in compliance with the License.
@@ -9475,4 +9583,4 @@ class RenderCounter {
9475
9583
  }
9476
9584
  const renderCounter = new RenderCounter();
9477
9585
 
9478
- export { AlertBanner, AlertIcon, AppHeader, AppLayout, Avatar, CanvasComponent, ConfirmationDialog, ConfirmationServiceProvider, CustomAccordion, CustomDialog, CustomIconButton, CustomSlider, CustomToggleButton, CustomTooltip, DEBOUNCE_TIMEOUT, DEFAULT_ERROR_MESSAGE, DEFAULT_FILTER_HEIGHT, DraggableComponent$1 as Draggable, ErrorBoundary, Filter, FilterChip, FilterListItem, LastUpdateTime, ResizeComponent as Resizable, SHARED_NAMESPACE, SearchField$1 as SearchField, SearchFieldButton, SearchHighlight, StatusTag, SwitchButton, ToggleMenu, ToolContainer, DraggableComponent as ToolContainerDraggable, ToolFooter, ToolHeader, TooltipSelect, UserMenu, UserMenuItemCheatSheet, UserMenuItemSentryRecording, MenuItemTheme as UserMenuItemTheme, adjustPosition, calculateDialogSizeAndPosition, calculateStartSize, createMockStoreWithEggs, createMockStoreWithEggsAndMiddleware, createToolkitMockStoreWithEggs, index as dateUtils, defaultDelay, getAxiosErrorMessage, getAxiosWarningMessage, getErrorMessage, getInitials, getLastUpdateTitle, getPosition, getWarningMessage, isAxiosAuthError, isAxiosError, pollingIntervalTimeout, renderCounter, sharedTranslations, showPrompt, sliderHeaderStyle, tooltipContainerStyles, useConfirmationDialog, useControlledTooltip, useDebounce, useDialogActions, useIsMounted, useMakeSureContainerStaysInsideWindow, usePoller, usePreventBrowserClose, usePrevious, useUserMenu, withEggs };
9586
+ export { AlertBanner, AlertIcon, AppHeader, AppLayout, Avatar, CanvasComponent, ConfirmationDialog, ConfirmationServiceProvider, CustomAccordion, CustomDialog, CustomIconButton, CustomSlider, CustomToggleButton, CustomTooltip, DEBOUNCE_TIMEOUT, DEFAULT_ERROR_MESSAGE, DEFAULT_FILTER_HEIGHT, DraggableComponent$1 as Draggable, ErrorBoundary, Filter, FilterChip, FilterLabel, FilterListItem, LastUpdateTime, PROJECTION, ResizeComponent as Resizable, SHARED_NAMESPACE, SearchField$1 as SearchField, SearchFieldButton, SearchHighlight, StatusTag, SwitchButton, ToggleMenu, ToolContainer, DraggableComponent as ToolContainerDraggable, ToolFooter, ToolHeader, TooltipSelect, UserMenu, UserMenuItemCheatSheet, UserMenuItemSentryRecording, MenuItemTheme as UserMenuItemTheme, adjustPosition, calculateDialogSizeAndPosition, calculateStartSize, createMockStoreWithEggs, createMockStoreWithEggsAndMiddleware, createToolkitMockStoreWithEggs, index as dateUtils, defaultDelay, getAxiosErrorMessage, getAxiosWarningMessage, getErrorMessage, getInitials, getLastUpdateTitle, getPosition, getWarningMessage, isAxiosAuthError, isAxiosError, pollingIntervalTimeout, renderCounter, sharedTranslations, showPrompt, sliderHeaderStyle, tooltipContainerStyles, useConfirmationDialog, useControlledTooltip, useDebounce, useDialogActions, useIsMounted, useMakeSureContainerStaysInsideWindow, usePoller, usePreventBrowserClose, usePrevious, useUserMenu, withEggs };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@opengeoweb/shared",
3
- "version": "9.25.3",
3
+ "version": "9.27.0",
4
4
  "description": "GeoWeb shared library with shared components and utils for the opengeoweb project",
5
5
  "license": "Apache-2.0",
6
6
  "repository": {
@@ -24,7 +24,9 @@
24
24
  "@sentry/react": "^7.109.0"
25
25
  },
26
26
  "peerDependencies": {
27
- "react": "18"
27
+ "react": "18",
28
+ "@emotion/react": "*",
29
+ "@emotion/styled": "*"
28
30
  },
29
31
  "module": "./index.esm.js",
30
32
  "type": "module",
@@ -9,5 +9,9 @@ export interface FilterListItemProps {
9
9
  filter: Filter;
10
10
  toggleFilter?: (filterIds: string[]) => void;
11
11
  enableOnlyOneFilter?: (filterId: string) => void;
12
+ children?: React.ReactNode;
12
13
  }
14
+ export declare const FilterLabel: React.FC<{
15
+ name: string;
16
+ }>;
13
17
  export declare const FilterListItem: React.FC<FilterListItemProps>;
@@ -1,7 +1,7 @@
1
1
  export { default as Filter } from './Filter';
2
2
  export { DEFAULT_FILTER_HEIGHT } from './Filter';
3
3
  export type { ListFilter } from './FilterList';
4
- export { FilterListItem } from './FilterListItem';
4
+ export { FilterListItem, FilterLabel } from './FilterListItem';
5
5
  export type { Filter as FilterListItemFilter, FilterListItemProps, } from './FilterListItem';
6
6
  export { default as FilterChip } from './FilterChip';
7
7
  export type { FilterChipProps } from './FilterChip';
@@ -44,3 +44,63 @@ export interface TimeSeriesService {
44
44
  }
45
45
  export type ServiceInterface = 'EDR' | 'OGC';
46
46
  export type TimeseriesServiceScope = 'user' | 'system';
47
+ export interface PlotPreset {
48
+ connectedMap?: string;
49
+ mapId: string;
50
+ plots: Plot[];
51
+ parameters: PlotParameter[];
52
+ }
53
+ export interface Plot {
54
+ title: string;
55
+ plotId: string;
56
+ enabled?: boolean;
57
+ parameters?: PlotParameter[];
58
+ }
59
+ export interface PlotParameter {
60
+ id?: string;
61
+ plotId: string;
62
+ unit?: string;
63
+ propertyName: string;
64
+ plotType: PlotType | 'area';
65
+ enabled?: boolean;
66
+ color?: string;
67
+ opacity?: number;
68
+ serviceId: string;
69
+ collectionId: string;
70
+ instanceId?: string;
71
+ instances?: EDRInstance[];
72
+ }
73
+ export type PlotType = 'bar' | 'line' | 'scatter';
74
+ export interface EDRInstance {
75
+ id: string;
76
+ data_queries?: {
77
+ position?: {
78
+ link: {
79
+ variables: {
80
+ output_formats: string[];
81
+ };
82
+ };
83
+ };
84
+ locations?: {
85
+ link: {
86
+ variables: {
87
+ output_formats: string[];
88
+ };
89
+ };
90
+ };
91
+ instances?: {
92
+ link: string;
93
+ };
94
+ };
95
+ extent?: {
96
+ temporal?: {
97
+ interval: string[][];
98
+ crs: string;
99
+ values: string[];
100
+ };
101
+ spatial: {
102
+ crs: string;
103
+ bbox: [number, number, number, number];
104
+ };
105
+ };
106
+ }
@@ -1,4 +1,4 @@
1
- import { parseISO, isEqual, Duration, startOfDay, isWithinInterval, getDayOfYear, getDay, getMonth, getYear, getWeek } from 'date-fns';
1
+ import { parseISO, isEqual, Duration, startOfDay, isWithinInterval, getDayOfYear, getDay, getMonth, getYear, getWeek, NearestMinutes } from 'date-fns';
2
2
  export interface DateValues {
3
3
  year?: number;
4
4
  month?: number;
@@ -206,6 +206,15 @@ export declare const differenceInHours: (dateLeft: Date | number, dateRight: Dat
206
206
  * @returns {number} the number of minutes
207
207
  */
208
208
  export declare const differenceInSeconds: (dateLeft: Date | number, dateRight: Date | number) => number;
209
+ /**
210
+ *
211
+ * @param date - the date to be rounded
212
+ * @param options - the options for rounding
213
+ * @returns the new date
214
+ */
215
+ export declare const roundToNearestMinutes: (date: Date | number, options: {
216
+ nearestTo: NearestMinutes;
217
+ }) => Date;
209
218
  /**
210
219
  *
211
220
  * @param date - the date that should be before the other one to return true
@@ -1,4 +1,5 @@
1
1
  export * from './axiosErrorUtils';
2
2
  export * as dateUtils from './dateUtils';
3
3
  export * from './reduxTestUtils';
4
+ export * from './mapProjections';
4
5
  export { renderCounter } from './renderCounter';
@@ -0,0 +1,75 @@
1
+ export declare const PROJECTION: {
2
+ readonly EPSG_3035: {
3
+ readonly name: "ETRS89-extended / LAEA Europe";
4
+ readonly value: "EPSG:3035";
5
+ };
6
+ readonly EPSG_3067: {
7
+ readonly name: "ETRS89 / TM35FIN(E,N) -- Finland";
8
+ readonly value: "EPSG:3067";
9
+ };
10
+ readonly EPSG_3411: {
11
+ readonly name: "Sea Ice Polar Stereographic North";
12
+ readonly value: "EPSG:3411";
13
+ };
14
+ readonly EPSG_3412: {
15
+ readonly name: "Sea Ice Polar Stereographic South";
16
+ readonly value: "EPSG:3412";
17
+ };
18
+ readonly EPSG_3575: {
19
+ readonly name: "Northern Hemisphere North Pole";
20
+ readonly value: "EPSG:3575";
21
+ };
22
+ readonly EPSG_3785: {
23
+ readonly name: "Pseudo-Mercator";
24
+ readonly value: "EPSG:3785";
25
+ };
26
+ readonly EPSG_3857: {
27
+ readonly name: "Europe Mercator";
28
+ readonly value: "EPSG:3857";
29
+ };
30
+ readonly EPSG_4258: {
31
+ readonly name: "ETRS89";
32
+ readonly value: "EPSG:4258";
33
+ };
34
+ readonly EPSG_4269: {
35
+ readonly name: "NAD83 (long/lat)";
36
+ readonly value: "EPSG:4269";
37
+ };
38
+ readonly EPSG_4325: {
39
+ readonly name: "Guam Map Grid";
40
+ readonly value: "EPSG:4325";
41
+ };
42
+ readonly EPSG_4326: {
43
+ readonly name: "WGS 84 - WGS84 - World Geodetic System";
44
+ readonly value: "EPSG:4326";
45
+ };
46
+ readonly EPSG_7399: {
47
+ readonly name: "WISCRS Vilas County (ftUS)";
48
+ readonly value: "EPSG:7399";
49
+ };
50
+ readonly EPSG_25832: {
51
+ readonly name: "ETRS89 / UTM zone 32N";
52
+ readonly value: "EPSG:25832";
53
+ };
54
+ readonly EPSG_28992: {
55
+ readonly name: "The Netherlands (28992)";
56
+ readonly value: "EPSG:28992";
57
+ };
58
+ readonly EPSG_32661: {
59
+ readonly name: "Europe Polar Stereographic";
60
+ readonly value: "EPSG:32661";
61
+ };
62
+ readonly EPSG_54030: {
63
+ readonly name: "Europe Robinson";
64
+ readonly value: "EPSG:54030";
65
+ };
66
+ readonly EPSG_900913: {
67
+ readonly name: "Google Maps Global Mercator";
68
+ readonly value: "EPSG:900913";
69
+ };
70
+ readonly EPSG_102100: {
71
+ readonly name: "WGS 84 / Pseudo-Mercator";
72
+ readonly value: "EPSG:102100";
73
+ };
74
+ };
75
+ export type EPSGCode = (typeof PROJECTION)[keyof typeof PROJECTION]['value'];