@opengeoweb/webmap-react 14.5.1 → 15.0.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
@@ -1,4 +1,4 @@
1
- import { WMInvalidDateValues, getCorrectWMSDimName, WMImageStore, WMImageStoreLoadType, WMJSDimension, webmapUtils, WMLayer, LayerType, legendImageStore, WMImageEventType, getLegendGraphicURLForLayer, WEBMAP_NAMESPACE, WMProj4Defs, privateWebMapUtils, tilesettings } from '@opengeoweb/webmap';
1
+ import { WMInvalidDateValues, getCorrectWMSDimName, WMImageStore, WMImageStoreLoadType, WMJSDimension, webmapUtils, WMLayer, LayerType, legendImageStore, WMImageEventType, getLegendGraphicURLForLayer, WEBMAP_NAMESPACE, WMProj4Defs, privateWebMapUtils, wmDetermineDimensionMode, tilesettings } from '@opengeoweb/webmap';
2
2
  export { WEBMAP_NAMESPACE, webmapTranslations } from '@opengeoweb/webmap';
3
3
  import React, { createContext, useMemo, useRef, useState, useEffect, useContext, useCallback, useLayoutEffect } from 'react';
4
4
  import { memoize, range, without, isEqual, throttle, debounce, cloneDeep } from 'lodash';
@@ -10,12 +10,12 @@ import ImageSource, { getRequestExtent } from 'ol/source/Image';
10
10
  import ImageWrapper, { load } from 'ol/Image';
11
11
  import { getImageSrc, getRequestParams, createLoader } from 'ol/source/wms';
12
12
  import { jsxs, jsx, Fragment } from 'react/jsx-runtime';
13
- import { CustomTooltip, CanvasComponent, useWheelStopPropagation, ToolContainerDraggable, CustomIconButton, dateUtils } from '@opengeoweb/shared';
14
- import { Paper, Box, Typography, useTheme, Grid, styled, Slider, TextField, FormControl, InputLabel, Select, MenuItem, Icon as Icon$2, FormLabel, Switch } from '@mui/material';
13
+ import { CustomTooltip, CanvasComponent, useWheelStopPropagation, ToolContainerDraggable, CustomIconButton, dateUtils, useMakeSureContainerStaysInsideWindow, Draggable, Resizable } from '@opengeoweb/shared';
14
+ import { Paper, Box, Typography, useTheme, Grid, styled, Slider, TextField, FormControl, InputLabel, Select, MenuItem, Icon as Icon$2, FormLabel, Switch, ThemeProvider } from '@mui/material';
15
15
  import { queryOptions, useQuery } from '@tanstack/react-query';
16
16
  import { Point, MultiPoint, Polygon, LineString } from 'ol/geom';
17
17
  import { Style, Icon as Icon$1, Circle, Stroke, Fill, Text } from 'ol/style';
18
- import { arrowUpPath, Home, Add, Minus, List, Equalizer, DimensionsElevation, Link, LinkOff, Info, DimensionsOther, DimensionsRefTime, DimensionsTime, locationPath, Location, DrawToolSmoothLine, DrawToolFreehand, DrawToolOval, DrawToolCircle, DrawToolSquare, Delete, DrawToolLineString, DrawToolRectangle, DrawToolPolygon, DrawToolPoint, DrawFIRLand, ArrowUp } from '@opengeoweb/theme';
18
+ import { arrowUpPath, Home, Add, Minus, List, Equalizer, DimensionsElevation, Link, LinkOff, Info, DimensionsOther, DimensionsRefTime, DimensionsTime, locationPath, Location, DrawToolSmoothLine, DrawToolFreehand, DrawToolOval, DrawToolCircle, DrawToolSquare, Delete, DrawToolLineString, DrawToolRectangle, DrawToolPolygon, DrawToolPoint, DrawFIRLand, ArrowUp, darkTheme, ChevronRight, Clock as Clock$1, Resize } from '@opengeoweb/theme';
19
19
  import { http, HttpResponse } from 'msw';
20
20
  import 'i18next';
21
21
  import { useTranslation } from 'react-i18next';
@@ -60,6 +60,7 @@ var en = {
60
60
  "webmap-react-title": "Title",
61
61
  "webmap-react-name": "Name",
62
62
  "webmap-react-service": "Service",
63
+ "webmap-react-service-url": "Service URL",
63
64
  "webmap-react-abstract": "Abstract",
64
65
  "webmap-react-dimensions": "Dimensions",
65
66
  "webmap-react-styles": "Styles",
@@ -99,7 +100,9 @@ var en = {
99
100
  "webmap-react-location": "Location",
100
101
  "webmap-react-delete": "Delete",
101
102
  "webmap-react-legend-no-image": "No legend graphic available",
102
- "webmap-react-map-measure-help-tooltip": "Click to measure"
103
+ "webmap-react-map-measure-help-tooltip": "Click to measure",
104
+ "clock-show": "Show clock",
105
+ "clock-hide": "Hide clock"
103
106
  };
104
107
  var fi = {
105
108
  "webmap-react-event": "tapahtuma:",
@@ -113,6 +116,7 @@ var fi = {
113
116
  "webmap-react-title": "Otsikko",
114
117
  "webmap-react-name": "Nimi",
115
118
  "webmap-react-service": "Palvelu",
119
+ "webmap-react-service-url": "Palvelun URL",
116
120
  "webmap-react-abstract": "Tiivistelmä",
117
121
  "webmap-react-dimensions": "Ulottuvuudet",
118
122
  "webmap-react-styles": "Tyylit",
@@ -144,7 +148,9 @@ var fi = {
144
148
  "webmap-react-polygon": "Monikulmio",
145
149
  "webmap-react-box": "Laatikko",
146
150
  "webmap-react-linestring": "Viivajono",
147
- "webmap-react-delete": "Poista"
151
+ "webmap-react-delete": "Poista",
152
+ "clock-show": "Näytä kello",
153
+ "clock-hide": "Piilota kello"
148
154
  };
149
155
  var no = {
150
156
  "webmap-react-event": "hendelse:",
@@ -158,6 +164,7 @@ var no = {
158
164
  "webmap-react-title": "Tittel",
159
165
  "webmap-react-name": "Navn",
160
166
  "webmap-react-service": "Service",
167
+ "webmap-react-service-url": "Service URL",
161
168
  "webmap-react-abstract": "Abstrakt",
162
169
  "webmap-react-dimensions": "Dimensjoner",
163
170
  "webmap-react-styles": "Stiler",
@@ -189,7 +196,9 @@ var no = {
189
196
  "webmap-react-polygon": "Polygon",
190
197
  "webmap-react-box": "Boks",
191
198
  "webmap-react-linestring": "Linje",
192
- "webmap-react-delete": "Fjerne"
199
+ "webmap-react-delete": "Fjerne",
200
+ "clock-show": "Vis klokke",
201
+ "clock-hide": "Skjul klokke"
193
202
  };
194
203
  var nl = {
195
204
  "webmap-react-event": "event:",
@@ -203,6 +212,7 @@ var nl = {
203
212
  "webmap-react-title": "Titel",
204
213
  "webmap-react-name": "Naam",
205
214
  "webmap-react-service": "Service",
215
+ "webmap-react-service-url": "Service-URL",
206
216
  "webmap-react-abstract": "Abstract",
207
217
  "webmap-react-dimensions": "Dimensies",
208
218
  "webmap-react-styles": "Stijlen",
@@ -242,7 +252,9 @@ var nl = {
242
252
  "webmap-react-location": "Locatie",
243
253
  "webmap-react-delete": "Verwijder",
244
254
  "webmap-react-legend-no-image": "Geen legenda beschikbaar",
245
- "webmap-react-map-measure-help-tooltip": "Klik om te meten"
255
+ "webmap-react-map-measure-help-tooltip": "Klik om te meten",
256
+ "clock-show": "Klok tonen",
257
+ "clock-hide": "Klok verbergen"
246
258
  };
247
259
  var webmapReactTranslations = {
248
260
  en: en,
@@ -11225,7 +11237,8 @@ var LayerInfoButton = function LayerInfoButton(_ref) {
11225
11237
 
11226
11238
  var textStyle = {
11227
11239
  lineHeight: '20px',
11228
- letterSpacing: '0.25px'
11240
+ letterSpacing: '0.25px',
11241
+ overflowWrap: 'break-word'
11229
11242
  };
11230
11243
  var textStyleWithMargin = _objectSpread2(_objectSpread2({}, textStyle), {}, {
11231
11244
  marginBottom: 1
@@ -11410,6 +11423,7 @@ var LayerInfoDialog = function LayerInfoDialog(_ref) {
11410
11423
  var onClose = _ref.onClose,
11411
11424
  layer = _ref.layer,
11412
11425
  serviceName = _ref.serviceName,
11426
+ serviceUrl = _ref.serviceUrl,
11413
11427
  isOpen = _ref.isOpen,
11414
11428
  _ref$onMouseDown = _ref.onMouseDown,
11415
11429
  onMouseDown = _ref$onMouseDown === void 0 ? function () {} : _ref$onMouseDown,
@@ -11453,6 +11467,9 @@ var LayerInfoDialog = function LayerInfoDialog(_ref) {
11453
11467
  }), jsx(LayerInfoText, {
11454
11468
  label: t('webmap-react-service'),
11455
11469
  value: serviceName
11470
+ }), jsx(LayerInfoText, {
11471
+ label: t('webmap-react-service-url'),
11472
+ value: serviceUrl || '-'
11456
11473
  }), jsx(LayerInfoText, {
11457
11474
  label: t('webmap-react-abstract'),
11458
11475
  value: layer["abstract"] || '-'
@@ -12546,7 +12563,12 @@ var useQueryGetWMSLayers = function useQueryGetWMSLayers(serviceUrl) {
12546
12563
  if (!getCapabilitiesJSON) {
12547
12564
  setLayers([]);
12548
12565
  } else {
12549
- setLayers(privateWmsFlattenLayerTree(privateWmsGetLayerTree(getCapabilitiesJSON)));
12566
+ var tree = privateWmsGetLayerTree(getCapabilitiesJSON);
12567
+ if (!tree) {
12568
+ setLayers([]);
12569
+ } else {
12570
+ setLayers(privateWmsFlattenLayerTree(tree));
12571
+ }
12550
12572
  }
12551
12573
  }, [serviceUrl, getCapabilitiesJSON]);
12552
12574
  return layers;
@@ -12603,17 +12625,26 @@ var useGetWMLayerInstance = function useGetWMLayerInstance(layerFoundation) {
12603
12625
  setErrorMessage = _React$useState10[1];
12604
12626
  var refId = useRef(id || webmapUtils.generateLayerId());
12605
12627
  var layerId = refId.current;
12628
+ var _useContext = useContext(TimeContext),
12629
+ refTimeDimensionModes = _useContext.refTimeDimensionModes;
12606
12630
  // Check if the layer is already registered
12607
12631
  var tmpWMLayer = webmapUtils.getWMLayerById(layerId);
12608
12632
  var layerIdChanged = id && id !== (tmpWMLayer === null || tmpWMLayer === void 0 ? void 0 : tmpWMLayer.id);
12609
12633
  var layerServiceChanged = (tmpWMLayer === null || tmpWMLayer === void 0 ? void 0 : tmpWMLayer.service) !== serviceUrl;
12610
12634
  if (layerServiceChanged || layerIdChanged) {
12611
12635
  // Make a new layer if the serviceUrl changes. (But not when the name changes)
12636
+ var refTimeDimensionMode = wmDetermineDimensionMode({
12637
+ name: name,
12638
+ service: serviceUrl,
12639
+ id: layerId,
12640
+ layerType: layerType
12641
+ }, refTimeDimensionModes);
12612
12642
  var wmLayer = new WMLayer({
12613
12643
  name: name,
12614
12644
  service: serviceUrl,
12615
12645
  layerType: layerType,
12616
- id: layerId
12646
+ id: layerId,
12647
+ refTimeDimensionMode: refTimeDimensionMode
12617
12648
  });
12618
12649
  webmapUtils.registerWMLayer(wmLayer, layerId);
12619
12650
  }
@@ -13417,6 +13448,7 @@ var USEANIMATIONFORLAYER_DEFAULT_MSINHOUR = 3600000;
13417
13448
  var useAnimationForLayer = function useAnimationForLayer(layerProps, intervalInMs) {
13418
13449
  var numStepsTillLatest = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : USEANIMATIONFORLAYER_DEFAULT_NUMSTEPS;
13419
13450
  var checkForUpdatesMs = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : USEANIMATIONFORLAYER_DEFAULT_UPDATEINTERVALMS;
13451
+ var refTimeDimensionModes = arguments.length > 4 ? arguments[4] : undefined;
13420
13452
  var now = dateUtils.getNowUtc().getTime();
13421
13453
  var animationStep = useRef(0);
13422
13454
  var _React$useState = React.useState(''),
@@ -13504,7 +13536,9 @@ var useAnimationForLayer = function useAnimationForLayer(layerProps, intervalInM
13504
13536
  name: 'time',
13505
13537
  currentValue: timeValue
13506
13538
  }],
13507
- timeContext: timeSpan
13539
+ timeContext: _objectSpread2(_objectSpread2({}, timeSpan), {}, {
13540
+ refTimeDimensionModes: refTimeDimensionModes
13541
+ })
13508
13542
  };
13509
13543
  };
13510
13544
 
@@ -13840,12 +13874,14 @@ var TimeAwareEDRLocationLayer = function TimeAwareEDRLocationLayer(_ref) {
13840
13874
  features: [],
13841
13875
  type: 'FeatureCollection'
13842
13876
  };
13877
+ // Don't show anything if no parameter is selected
13878
+ var isVisible = visible && parameter.length > 0;
13843
13879
  return jsx(OpenLayersFeatureLayer, {
13844
13880
  declutter: true,
13845
13881
  featureCollection: featureCollection,
13846
13882
  opacity: opacity,
13847
13883
  style: isFetching ? loadingStyle : style,
13848
- visible: visible,
13884
+ visible: isVisible,
13849
13885
  zIndex: zIndex
13850
13886
  });
13851
13887
  };
@@ -18279,6 +18315,265 @@ var MapMeasure = function MapMeasure(_ref) {
18279
18315
  return null;
18280
18316
  };
18281
18317
 
18318
+ /* *
18319
+ * Licensed under the Apache License, Version 2.0 (the "License");
18320
+ * you may not use this file except in compliance with the License.
18321
+ * You may obtain a copy of the License at
18322
+ *
18323
+ * http://www.apache.org/licenses/LICENSE-2.0
18324
+ *
18325
+ * Unless required by applicable law or agreed to in writing, software
18326
+ * distributed under the License is distributed on an "AS IS" BASIS,
18327
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
18328
+ * See the License for the specific language governing permissions and
18329
+ * limitations under the License.
18330
+ *
18331
+ * Copyright 2024 - Koninklijk Nederlands Meteorologisch Instituut (KNMI)
18332
+ * Copyright 2024 - Finnish Meteorological Institute (FMI)
18333
+ * Copyright 2024 - The Norwegian Meteorological Institute (MET Norway)
18334
+ * */
18335
+ // To be used with translations of days in formatted date
18336
+ // enum DaysOfWeeki18n {
18337
+ // SUNDAY = 'timeslider-sunday',
18338
+ // MONDAY = 'timeslider-monday',
18339
+ // TUESDAY = 'timeslider-tuesday',
18340
+ // WEDNESDAY = 'timeslider-wednesday',
18341
+ // THURSDAY = 'timeslider-thursday',
18342
+ // FRIDAY = 'timeslider-friday',
18343
+ // SATURDAY = 'timeslider-saturday',
18344
+ // }
18345
+ // To be used with translations of months in formatted date
18346
+ // enum MonthsOfTheYeari18n {
18347
+ // JANUARY = 'timeslider-january',
18348
+ // FEBRUARY = 'timeslider-february',
18349
+ // MARCH = 'timeslider-march',
18350
+ // APRIL = 'timeslider-april',
18351
+ // MAY = 'timeslider-may',
18352
+ // JUNE = 'timeslider-june',
18353
+ // JULY = 'timeslider-july',
18354
+ // AUGUST = 'timeslider-august',
18355
+ // SEPTEMBER = 'timeslider-september',
18356
+ // OCTOBER = 'timeslider-october',
18357
+ // NOVEMBER = 'timeslider-november',
18358
+ // DECEMBER = 'timeslider-december',
18359
+ // }
18360
+ var DaysOfWeek;
18361
+ (function (DaysOfWeek) {
18362
+ DaysOfWeek["SUNDAY"] = "Sun";
18363
+ DaysOfWeek["MONDAY"] = "Mon";
18364
+ DaysOfWeek["TUESDAY"] = "Tue";
18365
+ DaysOfWeek["WEDNESDAY"] = "Wed";
18366
+ DaysOfWeek["THURSDAY"] = "Thu";
18367
+ DaysOfWeek["FRIDAY"] = "Fri";
18368
+ DaysOfWeek["SATURDAY"] = "Sat";
18369
+ })(DaysOfWeek || (DaysOfWeek = {}));
18370
+ var MonthsOfTheYear;
18371
+ (function (MonthsOfTheYear) {
18372
+ MonthsOfTheYear["JANUARY"] = "Jan";
18373
+ MonthsOfTheYear["FEBRUARY"] = "Feb";
18374
+ MonthsOfTheYear["MARCH"] = "Mar";
18375
+ MonthsOfTheYear["APRIL"] = "Apr";
18376
+ MonthsOfTheYear["MAY"] = "May";
18377
+ MonthsOfTheYear["JUNE"] = "Jun";
18378
+ MonthsOfTheYear["JULY"] = "Jul";
18379
+ MonthsOfTheYear["AUGUST"] = "Aug";
18380
+ MonthsOfTheYear["SEPTEMBER"] = "Sep";
18381
+ MonthsOfTheYear["OCTOBER"] = "Oct";
18382
+ MonthsOfTheYear["NOVEMBER"] = "Nov";
18383
+ MonthsOfTheYear["DECEMBER"] = "Dec";
18384
+ })(MonthsOfTheYear || (MonthsOfTheYear = {}));
18385
+ var dateToManualFormatString = function dateToManualFormatString(inDate) {
18386
+ if (!inDate) {
18387
+ return 'Date not available';
18388
+ }
18389
+ var EEE = inDate && Object.values(DaysOfWeek)[inDate.getUTCDay()];
18390
+ var dd = "0".concat(inDate === null || inDate === void 0 ? void 0 : inDate.getUTCDate()).slice(-2);
18391
+ var MMM = inDate && Object.values(MonthsOfTheYear)[inDate.getUTCMonth()];
18392
+ var HH = "0".concat(inDate === null || inDate === void 0 ? void 0 : inDate.getUTCHours()).slice(-2);
18393
+ var mm = "0".concat(inDate === null || inDate === void 0 ? void 0 : inDate.getUTCMinutes()).slice(-2);
18394
+ return "".concat(EEE, " ").concat(dd, " ").concat(MMM, " ").concat(HH, ":").concat(mm, " UTC");
18395
+ };
18396
+
18397
+ /**
18398
+ * Format a date to a string
18399
+ *
18400
+ * Expects the following props:
18401
+ * @param {Date} inDate - date to be formatted
18402
+ *
18403
+ */
18404
+ var ClockContainer = function ClockContainer(_ref) {
18405
+ var fontSize = _ref.fontSize,
18406
+ onButtonClick = _ref.onButtonClick,
18407
+ time = _ref.time;
18408
+ var _useWebmapReactTransl = useWebmapReactTranslation(),
18409
+ t = _useWebmapReactTransl.t;
18410
+ var title = t('clock-hide');
18411
+ var currentDateString = dateToManualFormatString(dateUtils.fromUnix(time));
18412
+ return jsxs(Grid, {
18413
+ container: true,
18414
+ sx: {
18415
+ justifyContent: 'space-evenly',
18416
+ alignItems: 'center',
18417
+ cursor: 'move',
18418
+ height: '100%',
18419
+ width: '100%',
18420
+ backgroundColor: 'geowebColors.timeSlider.playerTimeMarkers.fill',
18421
+ borderRadius: '5px'
18422
+ },
18423
+ wrap: "nowrap",
18424
+ children: [jsx(Grid, {
18425
+ sx: {
18426
+ width: '4px'
18427
+ }
18428
+ }), jsx(CustomTooltip, {
18429
+ title: title,
18430
+ children: jsx(Grid, {
18431
+ sx: {
18432
+ zIndex: 2
18433
+ },
18434
+ children: jsx(ThemeProvider, {
18435
+ theme: darkTheme,
18436
+ children: jsx(CustomIconButton, {
18437
+ "aria-label": title,
18438
+ onClick: onButtonClick,
18439
+ variant: "boxed",
18440
+ children: jsx(ChevronRight, {})
18441
+ })
18442
+ })
18443
+ })
18444
+ }), jsx(Grid, {
18445
+ children: jsx(Typography, {
18446
+ sx: {
18447
+ whiteSpace: 'nowrap',
18448
+ fontSize: fontSize,
18449
+ color: '#fff'
18450
+ },
18451
+ variant: "subtitle2",
18452
+ children: currentDateString
18453
+ })
18454
+ })]
18455
+ });
18456
+ };
18457
+
18458
+ var MIN_WIDTH = 170;
18459
+ var MIN_HEIGHT = 32;
18460
+ var MIN_FONT_SIZE = 14; // bigger font size will cause render delay in LCP
18461
+ var FONT_SIZE_WIDTH_RATIO = MIN_FONT_SIZE / MIN_WIDTH;
18462
+ var BUTTON_WIDTH = 40;
18463
+ var resizeHandlePlacement = {
18464
+ top: false,
18465
+ right: false,
18466
+ bottom: false,
18467
+ left: false,
18468
+ topRight: false,
18469
+ bottomRight: false,
18470
+ bottomLeft: true,
18471
+ topLeft: false
18472
+ };
18473
+ var Clock = function Clock(_ref2) {
18474
+ var time = _ref2.time,
18475
+ _ref2$isVisible = _ref2.isVisible,
18476
+ isClockVisible = _ref2$isVisible === void 0 ? true : _ref2$isVisible,
18477
+ onToggleClock = _ref2.onToggleClock;
18478
+ var _useWebmapReactTransl = useWebmapReactTranslation(),
18479
+ t = _useWebmapReactTransl.t;
18480
+ var clockElement = useRef(null);
18481
+ var _useState = useState({
18482
+ x: 0,
18483
+ y: 0
18484
+ }),
18485
+ _useState2 = _slicedToArray(_useState, 2),
18486
+ position = _useState2[0],
18487
+ setPosition = _useState2[1];
18488
+ useMakeSureContainerStaysInsideWindow(clockElement, position, setPosition);
18489
+ var _useState3 = useState({
18490
+ width: MIN_WIDTH,
18491
+ height: MIN_HEIGHT
18492
+ }),
18493
+ _useState4 = _slicedToArray(_useState3, 2),
18494
+ size = _useState4[0],
18495
+ setSize = _useState4[1];
18496
+ var _useState5 = useState(MIN_FONT_SIZE),
18497
+ _useState6 = _slicedToArray(_useState5, 2),
18498
+ fontSize = _useState6[0],
18499
+ setFontSize = _useState6[1];
18500
+ var toggleClock = function toggleClock(isClockVisible) {
18501
+ onToggleClock === null || onToggleClock === void 0 || onToggleClock(isClockVisible);
18502
+ };
18503
+ return jsx(Fragment, {
18504
+ children: !isClockVisible ? jsx(CustomIconButton, {
18505
+ "aria-label": t('clock-show'),
18506
+ onClick: function onClick() {
18507
+ toggleClock(true);
18508
+ },
18509
+ sx: {
18510
+ position: 'absolute',
18511
+ top: 16,
18512
+ right: 8,
18513
+ zIndex: 1
18514
+ },
18515
+ tooltipTitle: t('clock-show'),
18516
+ variant: "boxed",
18517
+ children: jsx(Clock$1, {})
18518
+ }) : jsx(Draggable, {
18519
+ bounds: "parent",
18520
+ cancel: ".MuiButtonBase-root",
18521
+ nodeRef: clockElement,
18522
+ onStop: function onStop(_event, position) {
18523
+ setPosition(position);
18524
+ },
18525
+ position: position,
18526
+ children: jsx("div", {
18527
+ ref: function ref(_ref3) {
18528
+ clockElement.current = _ref3;
18529
+ },
18530
+ style: {
18531
+ position: 'absolute',
18532
+ zIndex: 1001,
18533
+ top: '10px',
18534
+ right: '10px'
18535
+ },
18536
+ children: jsx(Resizable, {
18537
+ enable: resizeHandlePlacement,
18538
+ handleComponent: {
18539
+ bottomLeft: jsx(Resize, {
18540
+ isRightAligned: true,
18541
+ style: {
18542
+ fill: '#FFFFFF'
18543
+ }
18544
+ })
18545
+ },
18546
+ lockAspectRatio: true,
18547
+ minHeight: MIN_HEIGHT,
18548
+ minWidth: MIN_WIDTH + BUTTON_WIDTH,
18549
+ onResize: function onResize(_event, _direction, _ref, delta) {
18550
+ var width = size.width + delta.width;
18551
+ var adjustedWidth = width - BUTTON_WIDTH;
18552
+ var fontSize = FONT_SIZE_WIDTH_RATIO * adjustedWidth;
18553
+ setFontSize(fontSize);
18554
+ },
18555
+ onResizeStop: function onResizeStop(_event, _direction, _ref, delta) {
18556
+ var width = size.width + delta.width;
18557
+ var height = size.height + delta.height;
18558
+ setSize({
18559
+ width: width,
18560
+ height: height
18561
+ });
18562
+ },
18563
+ size: size,
18564
+ children: jsx(ClockContainer, {
18565
+ fontSize: fontSize,
18566
+ onButtonClick: function onButtonClick() {
18567
+ toggleClock(false);
18568
+ },
18569
+ time: time
18570
+ })
18571
+ })
18572
+ })
18573
+ })
18574
+ });
18575
+ };
18576
+
18282
18577
  /* *
18283
18578
  * Licensed under the Apache License, Version 2.0 (the "License");
18284
18579
  * you may not use this file except in compliance with the License.
@@ -18304,7 +18599,7 @@ function getIsInsideAcceptanceTime(acceptanceTimeInMinutes, mapDimensions, layer
18304
18599
  var layerCurrentTime = layerDimensions === null || layerDimensions === void 0 || (_layerDimensions$find = layerDimensions.find(function (dimension) {
18305
18600
  return dimension.name === 'time';
18306
18601
  })) === null || _layerDimensions$find === void 0 ? void 0 : _layerDimensions$find.currentValue;
18307
- if (acceptanceTimeInMinutes === undefined || !mapCurrentTime || !layerCurrentTime) {
18602
+ if (acceptanceTimeInMinutes === undefined || acceptanceTimeInMinutes === null || !mapCurrentTime || !layerCurrentTime) {
18308
18603
  return true;
18309
18604
  }
18310
18605
  var minutesBetween = dateUtils.differenceInMinutes(new Date(mapCurrentTime), new Date(layerCurrentTime));
@@ -18355,4 +18650,4 @@ var getLayerUpdateInfo = function getLayerUpdateInfo(wmLayer, mapId) {
18355
18650
  return updateObject;
18356
18651
  };
18357
18652
 
18358
- export { BaseLayerType, CLASSNAME_MAP_MEASURE_TOOLTIP, ClickOnMapTool, DEFAULT_GEOJSON_STYLE_FILL_OPACITY, DRAWMODE, DefaultBaseLayers, DimensionSelectButton, DimensionSelectDialog, DimensionSelectSlider, EditModeButton as EditModeButtonField, FEATURE_DRAW_FILL_COLOR, FEATURE_DRAW_FILL_COLOR_TRANSPARENT, FEATURE_DRAW_SECONDARY_FILL_COLOR, FEATURE_DRAW_SECONDARY_STROKE_COLOR, FEATURE_DRAW_STROKE_COLOR, FEATURE_FILL, FEATURE_FILL_SELECTED, FEATURE_STROKE, FEATURE_STROKE_EDIT, FEATURE_STROKE_SELECTED, FEATURE_VERTICES_EDIT_HANDLES, FEATURE_VERTICE_HANDLE_IMAGE, FEATURE_VERTICE_IMAGE, FeatureLayer, FeatureLayers, GeoJSONTextField, IntersectionSelect, LayerInfoButton, LayerInfoDialog, LayerInfoLegend, LayerInfoList, LayerInfoText, Legend, LegendButton, LegendDialog, LegendLayout, MapContext, MapControlButton, MapControls, MapDimensionSelect, MapFeatureClass, MapMeasure, MapTime, MapWarningProperties, NEW_FEATURE_CREATED, NEW_LINESTRING_CREATED, NEW_POINT_CREATED, OpenLayersFeatureLayer, OpenLayersGetFeatureInfo, OpenLayersLayer, OpenLayersMapDraw, OpenLayersMapView, OpenLayersZoomControl, SelectField, StoryLayoutGrid, TimeAwareEDRLocationLayer, TimeAwareGeoTIFFLayer, TimeAwareWMTSLayer, TimeContext, TimeawareImageSource, TimeawareImageSourceWMSLayer, WEBMAP_REACT_NAMESPACE, WMSLayer, WMTSLayer, XYZLayer, ZoomControls, addFeatureProperties, addGeoJSONProperties, addSelectionTypeToGeoJSON, basicExampleDrawOptions, basicExampleMultipleShapeDrawOptions, basicExampleMultipleShapeWithValuesDrawOptions, catmullRomSpline, clearImageCacheForAllMaps, colorMaps, createBoxBasedOnModifiedVertex, createIconStyle, createInterSections, createOval, currentlySupportedDrawModes, defaultBox, defaultCircle, defaultDelete, defaultEdrStyles, defaultFreehandLine, defaultGeoJSONStyleProperties, defaultIntersectionStyleProperties, defaultLayers, defaultLineString, defaultLocation, defaultModes, defaultOval, defaultPoint, defaultPolygon, defaultSmoothLine, defaultSquare, defaultTimeFormat, dimensionConfig, drawPolyStoryStyles, drawStyles, emptyGeoJSON, endToolExampleConfig, exampleIntersectionOptions, exampleIntersectionWithShapeOptions, exampleIntersections, exampleIntersectionsMultiDrawTool, fakeEdrLayerApiHandlers, featureMultiPoint, featurePoint, featurePolygon, fillOptions, firSelectionType, formatTime, generateImageFromLegend, genericOpenLayersFeatureStyle, geowebColorToOpenLayersColor, getDimensionIcon, getDimensionLabel, getDimensionValue, getDimensionsList, getDoubleControlToolIcon, getDrawModeIdFromSelectionType, getFeatureCollection, getFeatureExtent, getFeaturePointStyle, getFirTitle, getGeoJSONPropertyValue, getGeoJson, getIcon, getIntersectionToolIcon, getIsInsideAcceptanceTime, getLastEmptyFeatureIndex, getLayerBbox, getLayerStyles, getLayerUpdateInfo, getLegendClass, getProj4, getTimeDimension, getToolIcon, initializeOpenLayersProjections, inlineFeatureStyle, intersectPointGeoJSONS, intersectPolygonGeoJSONS, intersectionFeatureBE, intersectionFeatureNL, isGeoJSONFeatureCreatedByTool, isGeoJSONGeometryEmpty, isPointFeatureCollection, labelOptions, lineString, lineStringCollection, makeFeatureStyleDisc, makeFeatureStyleLoading, makeFeatureStyleMultiParam, makeFeatureStyleMultiParamLoading, makeFeatureStyleWind, makeLegendFromColorMap, makeLegendFromStyleName, makeTimeList, makeView, marksByDimension, measureResultStyle, measureToolStyle, modifyStyles, moveFeature, multiLineStringLabelStyle, multiPolygonLabelStyle, opacityOptions, openLayersGetMapImageStore, precipitationMMLegendColorsWoW, projectorCache, publicLayers, publicServices, rewindGeometry, roundCoordinates, selectPreferredWMSProjection, setMapCenter, setViewFromExtent, setViewFromFeature, simpleBoxGeoJSON, simpleBoxGeoJSONWrongOrder, simpleFlightRouteLineStringGeoJSON, simpleFlightRoutePointsGeoJSON, simpleGeometryCollectionGeoJSON, simpleLineStringGeoJSON, simpleMultiPolygon, simplePointsGeojson, simplePolygonGeoJSON, simpleSmallLineStringGeoJSON, startToolExampleConfig, strokeWidthOptions, styleNameToStyleLike, temperatureLegendColorsCWK, temperatureLegendColorsWoW, textLabelStyle, textStyle, textStyleWithMargin, updateEditModeButtonsWithFir, useAnimationForLayer, useEDRGetCollectionDetails, useEDRGetParameterData, useEDRWMLayer, useGeoJSON, useGetWMLayerInstance, useGetWMSLayerStyleList, useIconStyle, useMapDrawTool, useProjection, useQueryGetWMSGetCapabilities, useQueryGetWMSLayer, useQueryGetWMSLayers, useQueryGetWMSLayersTree, useQueryGetWMSServiceInfo, useQueryWMTSGetCapabilities, useSetIntervalWhenVisible, useViewFromLayer, viewUtils, webmapEDRQueryOptions, webmapReactTranslations };
18653
+ export { BaseLayerType, CLASSNAME_MAP_MEASURE_TOOLTIP, ClickOnMapTool, Clock, DEFAULT_GEOJSON_STYLE_FILL_OPACITY, DRAWMODE, DefaultBaseLayers, DimensionSelectButton, DimensionSelectDialog, DimensionSelectSlider, EditModeButton as EditModeButtonField, FEATURE_DRAW_FILL_COLOR, FEATURE_DRAW_FILL_COLOR_TRANSPARENT, FEATURE_DRAW_SECONDARY_FILL_COLOR, FEATURE_DRAW_SECONDARY_STROKE_COLOR, FEATURE_DRAW_STROKE_COLOR, FEATURE_FILL, FEATURE_FILL_SELECTED, FEATURE_STROKE, FEATURE_STROKE_EDIT, FEATURE_STROKE_SELECTED, FEATURE_VERTICES_EDIT_HANDLES, FEATURE_VERTICE_HANDLE_IMAGE, FEATURE_VERTICE_IMAGE, FeatureLayer, FeatureLayers, GeoJSONTextField, IntersectionSelect, LayerInfoButton, LayerInfoDialog, LayerInfoLegend, LayerInfoList, LayerInfoText, Legend, LegendButton, LegendDialog, LegendLayout, MapContext, MapControlButton, MapControls, MapDimensionSelect, MapFeatureClass, MapMeasure, MapTime, MapWarningProperties, NEW_FEATURE_CREATED, NEW_LINESTRING_CREATED, NEW_POINT_CREATED, OpenLayersFeatureLayer, OpenLayersGetFeatureInfo, OpenLayersLayer, OpenLayersMapDraw, OpenLayersMapView, OpenLayersZoomControl, SelectField, StoryLayoutGrid, TimeAwareEDRLocationLayer, TimeAwareGeoTIFFLayer, TimeAwareWMTSLayer, TimeContext, TimeawareImageSource, TimeawareImageSourceWMSLayer, WEBMAP_REACT_NAMESPACE, WMSLayer, WMTSLayer, XYZLayer, ZoomControls, addFeatureProperties, addGeoJSONProperties, addSelectionTypeToGeoJSON, basicExampleDrawOptions, basicExampleMultipleShapeDrawOptions, basicExampleMultipleShapeWithValuesDrawOptions, catmullRomSpline, clearImageCacheForAllMaps, colorMaps, createBoxBasedOnModifiedVertex, createIconStyle, createInterSections, createOval, currentlySupportedDrawModes, defaultBox, defaultCircle, defaultDelete, defaultEdrStyles, defaultFreehandLine, defaultGeoJSONStyleProperties, defaultIntersectionStyleProperties, defaultLayers, defaultLineString, defaultLocation, defaultModes, defaultOval, defaultPoint, defaultPolygon, defaultSmoothLine, defaultSquare, defaultTimeFormat, dimensionConfig, drawPolyStoryStyles, drawStyles, emptyGeoJSON, endToolExampleConfig, exampleIntersectionOptions, exampleIntersectionWithShapeOptions, exampleIntersections, exampleIntersectionsMultiDrawTool, fakeEdrLayerApiHandlers, featureMultiPoint, featurePoint, featurePolygon, fillOptions, firSelectionType, formatTime, generateImageFromLegend, genericOpenLayersFeatureStyle, geowebColorToOpenLayersColor, getDimensionIcon, getDimensionLabel, getDimensionValue, getDimensionsList, getDoubleControlToolIcon, getDrawModeIdFromSelectionType, getFeatureCollection, getFeatureExtent, getFeaturePointStyle, getFirTitle, getGeoJSONPropertyValue, getGeoJson, getIcon, getIntersectionToolIcon, getIsInsideAcceptanceTime, getLastEmptyFeatureIndex, getLayerBbox, getLayerStyles, getLayerUpdateInfo, getLegendClass, getProj4, getTimeDimension, getToolIcon, initializeOpenLayersProjections, inlineFeatureStyle, intersectPointGeoJSONS, intersectPolygonGeoJSONS, intersectionFeatureBE, intersectionFeatureNL, isGeoJSONFeatureCreatedByTool, isGeoJSONGeometryEmpty, isPointFeatureCollection, labelOptions, lineString, lineStringCollection, makeFeatureStyleDisc, makeFeatureStyleLoading, makeFeatureStyleMultiParam, makeFeatureStyleMultiParamLoading, makeFeatureStyleWind, makeLegendFromColorMap, makeLegendFromStyleName, makeTimeList, makeView, marksByDimension, measureResultStyle, measureToolStyle, modifyStyles, moveFeature, multiLineStringLabelStyle, multiPolygonLabelStyle, opacityOptions, openLayersGetMapImageStore, precipitationMMLegendColorsWoW, projectorCache, publicLayers, publicServices, rewindGeometry, roundCoordinates, selectPreferredWMSProjection, setMapCenter, setViewFromExtent, setViewFromFeature, simpleBoxGeoJSON, simpleBoxGeoJSONWrongOrder, simpleFlightRouteLineStringGeoJSON, simpleFlightRoutePointsGeoJSON, simpleGeometryCollectionGeoJSON, simpleLineStringGeoJSON, simpleMultiPolygon, simplePointsGeojson, simplePolygonGeoJSON, simpleSmallLineStringGeoJSON, startToolExampleConfig, strokeWidthOptions, styleNameToStyleLike, temperatureLegendColorsCWK, temperatureLegendColorsWoW, textLabelStyle, textStyle, textStyleWithMargin, updateEditModeButtonsWithFir, useAnimationForLayer, useEDRGetCollectionDetails, useEDRGetParameterData, useEDRWMLayer, useGeoJSON, useGetWMLayerInstance, useGetWMSLayerStyleList, useIconStyle, useMapDrawTool, useProjection, useQueryGetWMSGetCapabilities, useQueryGetWMSLayer, useQueryGetWMSLayers, useQueryGetWMSLayersTree, useQueryGetWMSServiceInfo, useQueryWMTSGetCapabilities, useSetIntervalWhenVisible, useViewFromLayer, viewUtils, webmapEDRQueryOptions, webmapReactTranslations };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@opengeoweb/webmap-react",
3
- "version": "14.5.1",
3
+ "version": "15.0.0",
4
4
  "description": "GeoWeb react wrapper for webmap",
5
5
  "license": "Apache-2.0",
6
6
  "repository": {
@@ -8,9 +8,9 @@
8
8
  "url": "git@gitlab.com:opengeoweb/opengeoweb.git"
9
9
  },
10
10
  "dependencies": {
11
- "@opengeoweb/webmap": "14.5.1",
12
- "@opengeoweb/theme": "14.5.1",
13
- "@opengeoweb/shared": "14.5.1",
11
+ "@opengeoweb/webmap": "15.0.0",
12
+ "@opengeoweb/theme": "15.0.0",
13
+ "@opengeoweb/shared": "15.0.0",
14
14
  "lodash": "^4.17.21",
15
15
  "ol": "^10.4.0",
16
16
  "proj4": "^2.9.2",
@@ -0,0 +1,6 @@
1
+ import type { FC } from 'react';
2
+ export declare const Clock: FC<{
3
+ time: number;
4
+ isVisible?: boolean;
5
+ onToggleClock?: (isVisible: boolean) => void;
6
+ }>;
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,9 @@
1
+ import type { Meta, StoryObj } from '@storybook/react-webpack5';
2
+ import { Clock } from './Clock';
3
+ declare const meta: Meta<typeof Clock>;
4
+ export default meta;
5
+ type Story = StoryObj<typeof Clock>;
6
+ export declare const Component: Story;
7
+ export declare const ComponentDark: Story;
8
+ export declare const ComponentClosed: Story;
9
+ export declare const ComponentClosedDark: Story;
@@ -0,0 +1,13 @@
1
+ import type { FC } from 'react';
2
+ /**
3
+ * Format a date to a string
4
+ *
5
+ * Expects the following props:
6
+ * @param {Date} inDate - date to be formatted
7
+ *
8
+ */
9
+ export declare const ClockContainer: FC<{
10
+ onButtonClick: () => void;
11
+ fontSize: number;
12
+ time: number;
13
+ }>;
@@ -0,0 +1 @@
1
+ export declare const dateToManualFormatString: (inDate: Date | undefined) => string;
@@ -0,0 +1 @@
1
+ export * from './Clock';
@@ -3,6 +3,7 @@ import type { LayerProps } from '@opengeoweb/webmap';
3
3
  export interface LayerInfoDialogProps {
4
4
  layer: LayerProps;
5
5
  serviceName: string;
6
+ serviceUrl?: string;
6
7
  onClose: () => void;
7
8
  isOpen: boolean;
8
9
  onMouseDown?: () => void;
@@ -5,10 +5,12 @@ export interface LayerInfoTextProps {
5
5
  export declare const textStyle: {
6
6
  lineHeight: string;
7
7
  letterSpacing: string;
8
+ overflowWrap: string;
8
9
  };
9
10
  export declare const textStyleWithMargin: {
10
11
  marginBottom: number;
11
12
  lineHeight: string;
12
13
  letterSpacing: string;
14
+ overflowWrap: string;
13
15
  };
14
16
  export declare const LayerInfoText: React.FC<LayerInfoTextProps>;
@@ -0,0 +1,6 @@
1
+ import type { Meta, StoryObj } from '@storybook/react-webpack5';
2
+ import { OpenLayersMapView } from '.';
3
+ declare const meta: Meta<typeof OpenLayersMapView>;
4
+ export default meta;
5
+ type Story = StoryObj<typeof OpenLayersMapView>;
6
+ export declare const ReferenceTimeModes: Story;
@@ -1,3 +1,4 @@
1
+ import type { RefTimeDimensionModes } from '@opengeoweb/webmap';
1
2
  export interface Timespan {
2
3
  start: number;
3
4
  end: number;
@@ -6,4 +7,5 @@ export interface Timespan {
6
7
  export interface TimeContextType {
7
8
  isAnimating: boolean;
8
9
  prefetchList: number[];
10
+ refTimeDimensionModes?: RefTimeDimensionModes;
9
11
  }
@@ -6,3 +6,4 @@ export * from './MapDimensionSelect';
6
6
  export * from './LayerInfo';
7
7
  export * from './OpenLayers';
8
8
  export * from './MapMeasure';
9
+ export * from './Clock';
@@ -1,9 +1,9 @@
1
- import type { Dimension } from '@opengeoweb/webmap';
1
+ import type { Dimension, RefTimeDimensionModes } from '@opengeoweb/webmap';
2
2
  import type { OpenLayersLayerProps } from '../components/OpenLayers/layers';
3
3
  import type { TimeContextType } from '../components/OpenLayers/types/Timespan';
4
4
  interface UseAnimationForLayerProps {
5
5
  dimensions: Dimension[];
6
6
  timeContext: TimeContextType;
7
7
  }
8
- export declare const useAnimationForLayer: (layerProps: OpenLayersLayerProps, intervalInMs: number, numStepsTillLatest?: number, checkForUpdatesMs?: number) => UseAnimationForLayerProps;
8
+ export declare const useAnimationForLayer: (layerProps: OpenLayersLayerProps, intervalInMs: number, numStepsTillLatest?: number, checkForUpdatesMs?: number, refTimeDimensionModes?: RefTimeDimensionModes) => UseAnimationForLayerProps;
9
9
  export {};
@@ -47,6 +47,12 @@ export interface SetLayerStylePayload {
47
47
  mapId?: string;
48
48
  origin?: string;
49
49
  }
50
+ export interface SetLayerAcceptanceTimePayload {
51
+ layerId: string;
52
+ acceptanceTime: number | null;
53
+ mapId?: string;
54
+ origin?: string;
55
+ }
50
56
  export interface UpdateLayerInfoPayload {
51
57
  origin: string;
52
58
  mapDimensions?: UpdateAllMapDimensionsPayload;
@@ -1,4 +1,4 @@
1
1
  import type { Dimension, WMLayer } from '@opengeoweb/webmap';
2
2
  import type { UpdateLayerInfoPayload } from '../types/types';
3
- export declare function getIsInsideAcceptanceTime(acceptanceTimeInMinutes: number | undefined, mapDimensions: Dimension[] | undefined, layerDimensions: Dimension[] | undefined): boolean;
3
+ export declare function getIsInsideAcceptanceTime(acceptanceTimeInMinutes: number | null | undefined, mapDimensions: Dimension[] | undefined, layerDimensions: Dimension[] | undefined): boolean;
4
4
  export declare const getLayerUpdateInfo: (wmLayer: WMLayer, mapId: string) => UpdateLayerInfoPayload;