@opengeoweb/core 4.9.1 → 4.10.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
@@ -6,9 +6,9 @@ import React__default, { Component, useRef, useState, useEffect, useCallback } f
6
6
  import _, { debounce, isEqual, escapeRegExp, groupBy, throttle, range } from 'lodash';
7
7
  import { takeLatest, put, select, call, takeEvery, all, delay } from 'redux-saga/effects';
8
8
  import { connect, useDispatch, useSelector, Provider } from 'react-redux';
9
- import { CustomTooltip, ToolButton, ToolContainerDraggable, IS_JEST, TooltipSelect, AlertIcon, useControlledTooltip, tooltipContainerStyles, sliderHeaderStyle, CustomSlider, ToggleMenu, ManagerButton, CustomAccordion, EnableButton, ManagerDeleteButton, AlertBanner, calculateDialogSizeAndPosition, useIsMounted, CustomToggleButton, useMakeSureContainerStaysInsideWindow, withEggs } from '@opengeoweb/shared';
10
- import { Pause, Play, CollapseSmall, CollapseMedium, CollapseLarge, CollapseWindow, ExpandWindow, Add, Copy, Both, None, DragHandle as DragHandle$1, Cached, Filter, Search, Clear, Info, DimensionsOther, DimensionsElevation, DimensionsRefTime, DimensionsTime, Edit, Visibility, Delete, Close, Home, Minus, Layers, Equalizer, Link, LinkOff, AutoUpdateActive, AutoUpdateInActive, TextIcon, Speed, FastForward, Clock, Now, Animation, Options, StepForward, StepBackward, dragHandlePath, ChevronDown, ChevronUp, List as List$1, ChevronRight, ChevronLeft, Resize, ExitDomain, ThemeWrapper, lightTheme } from '@opengeoweb/theme';
11
- import { Paper, Box, Typography, IconButton, Grid, MenuItem, Button, Popper, FormControl, InputLabel, List, ListItem, ListItemText, CircularProgress, ListSubheader, Dialog, DialogTitle, DialogContent, DialogContentText, TextField, DialogActions, LinearProgress, InputAdornment, Backdrop, ListItemSecondaryAction, ListItemIcon, Checkbox, Switch, styled, Slider, Menu, useTheme, Snackbar } from '@mui/material';
9
+ import { CustomTooltip, ToolButton, ToolContainerDraggable, IS_JEST, TooltipSelect, AlertIcon, useControlledTooltip, tooltipContainerStyles, sliderHeaderStyle, CustomSlider, ToggleMenu, CustomAccordion, EnableButton, ManagerDeleteButton, AlertBanner, ManagerButton, calculateDialogSizeAndPosition, useIsMounted, CustomToggleButton, useMakeSureContainerStaysInsideWindow, withEggs } from '@opengeoweb/shared';
10
+ import { Pause, Play, CollapseSmall, CollapseMedium, CollapseLarge, CollapseWindow, ExpandWindow, Add, Copy, None, Both, DragHandle as DragHandle$1, Cached, Filter, Search, Clear, Info, DimensionsOther, DimensionsElevation, DimensionsRefTime, DimensionsTime, Edit, Visibility, Delete, Close, Home, Minus, Layers, Equalizer, Link, LinkOff, AutoUpdateActive, AutoUpdateInActive, Speed, FastForward, Clock, Now, Animation, Options, StepForward, StepBackward, dragHandlePath, ChevronDown, ChevronUp, List as List$1, ChevronRight, ChevronLeft, Resize, ExitDomain, ThemeWrapper, lightTheme } from '@opengeoweb/theme';
11
+ import { Paper, Box, Typography, IconButton, Grid, MenuItem, Button, Popper, ListItemText, ListItemIcon, FormControl, InputLabel, List, ListItem, CircularProgress, ListSubheader, Dialog, DialogTitle, DialogContent, DialogContentText, TextField, DialogActions, LinearProgress, InputAdornment, Backdrop, ListItemSecondaryAction, Checkbox, Switch, styled, Slider, Menu, useTheme, Snackbar } from '@mui/material';
12
12
  import { legendImageStore, WMImageEventType, getLegendGraphicURLForLayer, WMGetServiceFromStore, LayerType as LayerType$1, clearImageCache, getMapImageStore, WMBBOX, debug, DebugType, WMJSMap, WMLayer } from '@opengeoweb/webmap';
13
13
  import { ReactSortable } from 'react-sortablejs';
14
14
  import Sortable from 'sortablejs';
@@ -991,46 +991,66 @@ var TimeInMinutes;
991
991
  TimeInMinutes[TimeInMinutes["MONTH"] = 43800] = "MONTH";
992
992
  TimeInMinutes[TimeInMinutes["DAY"] = 1440] = "DAY";
993
993
  TimeInMinutes[TimeInMinutes["HOUR"] = 60] = "HOUR";
994
+ TimeInMinutes[TimeInMinutes["MINUTE"] = 1] = "MINUTE";
994
995
  })(TimeInMinutes || (TimeInMinutes = {}));
996
+ /**
997
+ *
998
+ * @param minutes
999
+ * @returns the two highest values in the format yr(s) mo(s) d h m
1000
+ */
995
1001
 
996
- var minutesToDescribedDuration = function minutesToDescribedDuration(minutes) {
997
- var dateStr = '';
998
- var time = minutes; // subtracting whole years/months/days from time duration and adding the amount to the string to be printed.
999
-
1000
- if (time >= TimeInMinutes.YEAR) {
1001
- var yearsInMintues = Math.floor(time / TimeInMinutes.YEAR);
1002
- dateStr += "".concat(yearsInMintues, "y");
1003
- time -= yearsInMintues * TimeInMinutes.YEAR;
1004
- }
1005
-
1006
- if (time >= TimeInMinutes.MONTH) {
1007
- var monthsInMinutes = Math.floor(time / TimeInMinutes.MONTH);
1008
- dateStr += "".concat(monthsInMinutes, "m");
1009
- time -= monthsInMinutes * TimeInMinutes.MONTH;
1010
- }
1011
1002
 
1012
- if (time >= TimeInMinutes.DAY) {
1013
- var daysInMinutes = Math.floor(time / TimeInMinutes.DAY);
1014
- dateStr += "".concat(daysInMinutes, "d");
1015
- time -= daysInMinutes * TimeInMinutes.DAY;
1016
- } // we will always print hour/minutes if there are any of them in the XX:XX format
1017
-
1018
-
1019
- if (time > 0) {
1020
- if (dateStr !== '') dateStr += ' ';
1021
- dateStr += "".concat(Math.floor(time / TimeInMinutes.HOUR).toLocaleString(undefined, {
1022
- minimumIntegerDigits: 2,
1023
- useGrouping: false
1024
- }), "h").concat((time % TimeInMinutes.HOUR).toLocaleString(undefined, {
1025
- minimumIntegerDigits: 2,
1026
- useGrouping: false
1027
- }), "min");
1028
- }
1003
+ var minutesToDescribedDuration = function minutesToDescribedDuration(minutes) {
1004
+ var units = [{
1005
+ label: 'yr',
1006
+ value: TimeInMinutes.YEAR,
1007
+ plural: 's'
1008
+ }, {
1009
+ label: 'mo',
1010
+ value: TimeInMinutes.MONTH,
1011
+ plural: 's'
1012
+ }, {
1013
+ label: 'd',
1014
+ value: TimeInMinutes.DAY
1015
+ }, {
1016
+ label: 'h',
1017
+ value: TimeInMinutes.HOUR
1018
+ }, {
1019
+ label: 'm',
1020
+ value: TimeInMinutes.MINUTE
1021
+ }];
1022
+ var durations = units.reduce(function (units, duration) {
1023
+ var min = units.min,
1024
+ time = units.time,
1025
+ count = units.count;
1026
+ var label = duration.label,
1027
+ value = duration.value,
1028
+ _duration$plural = duration.plural,
1029
+ plural = _duration$plural === void 0 ? '' : _duration$plural;
1030
+ var unit = Math.floor(min / value);
1031
+
1032
+ if (unit > 0 && count < 2) {
1033
+ return {
1034
+ time: "".concat(time).concat(unit).concat(label).concat(unit > 1 ? plural : '', " "),
1035
+ min: min - unit * value,
1036
+ count: count + 1
1037
+ };
1038
+ }
1029
1039
 
1030
- return dateStr;
1040
+ return {
1041
+ min: min,
1042
+ time: time,
1043
+ count: count
1044
+ };
1045
+ }, {
1046
+ min: minutes,
1047
+ time: '',
1048
+ count: 0
1049
+ });
1050
+ return durations.time.trim();
1031
1051
  };
1032
1052
 
1033
- var TimeSliderUtils = /*#__PURE__*/Object.freeze({
1053
+ var timeSliderUtils = /*#__PURE__*/Object.freeze({
1034
1054
  __proto__: null,
1035
1055
  millisecondsInSecond: millisecondsInSecond,
1036
1056
  defaultAnimationDelayAtStart: defaultAnimationDelayAtStart,
@@ -10183,7 +10203,6 @@ var RenderStyles = function RenderStyles(_ref) {
10183
10203
  return currentStyle === style.name;
10184
10204
  });
10185
10205
  return /*#__PURE__*/React.createElement(TooltipSelect, {
10186
- disableUnderline: true,
10187
10206
  tooltip: "Style: ".concat((_a = styles[currentIndex]) === null || _a === void 0 ? void 0 : _a.title),
10188
10207
  inputProps: {
10189
10208
  SelectDisplayProps: {
@@ -10226,51 +10245,108 @@ var RenderStyles = function RenderStyles(_ref) {
10226
10245
  * Copyright 2021 - Finnish Meteorological Institute (FMI)
10227
10246
  * */
10228
10247
 
10229
- var makeIconStyle = function makeIconStyle(isActive, isEnabled) {
10230
- return {
10231
- color: function color() {
10232
- if (isActive) {
10233
- return 'common.white';
10234
- }
10248
+ var getIconColor = function getIconColor(isActive, isEnabled) {
10249
+ if (isActive) {
10250
+ return 'common.white';
10251
+ }
10235
10252
 
10236
- if (isEnabled) {
10237
- return 'geowebColors.buttons.flat.default.color';
10238
- }
10253
+ if (isEnabled) {
10254
+ return 'geowebColors.buttons.flat.default.color';
10255
+ }
10239
10256
 
10240
- return 'geowebColors.buttons.flat.disabled.color';
10241
- }
10242
- };
10257
+ return 'geowebColors.buttons.flat.disabled.color';
10243
10258
  };
10244
10259
 
10245
10260
  var ActivateLayer = function ActivateLayer(_ref) {
10246
- var _ref$tooltipTitle = _ref.tooltipTitle,
10247
- tooltipTitle = _ref$tooltipTitle === void 0 ? 'Leading layer' : _ref$tooltipTitle,
10248
- onClickActivate = _ref.onClickActivate,
10249
- _ref$isActive = _ref.isActive,
10250
- isActive = _ref$isActive === void 0 ? false : _ref$isActive,
10251
- _ref$isEnabled = _ref.isEnabled,
10252
- isEnabled = _ref$isEnabled === void 0 ? true : _ref$isEnabled,
10253
- _ref$id = _ref.id,
10254
- id = _ref$id === void 0 ? 'activateLayer-btn' : _ref$id;
10255
- var iconStyle = makeIconStyle(isActive, isEnabled);
10261
+ var _onChange = _ref.onChange,
10262
+ isActive = _ref.isActive,
10263
+ isEnabled = _ref.isEnabled;
10264
+ return /*#__PURE__*/React.createElement(TooltipSelect, {
10265
+ variant: "standard",
10266
+ tooltip: "Auto update",
10267
+ // Don't show arrow https://stackoverflow.com/questions/69085735/how-to-remove-arrow-from-react-textfield-select
10268
+ inputProps: {
10269
+ IconComponent: function IconComponent() {
10270
+ return null;
10271
+ }
10272
+ },
10273
+ value: isActive ? 'Both' : 'None',
10274
+ sx: {
10275
+ '&& .MuiOutlinedInput-input': {
10276
+ padding: '0'
10277
+ },
10278
+ '&&& .MuiInput-input': {
10279
+ paddingRight: 0
10280
+ }
10281
+ },
10282
+ renderValue: function renderValue(optionSelected) {
10283
+ return /*#__PURE__*/React.createElement(AutoUpdateButton$1, {
10284
+ optionSelected: optionSelected,
10285
+ isActive: isActive,
10286
+ isEnabled: isEnabled
10287
+ });
10288
+ },
10289
+ onChange: function onChange(event) {
10290
+ event.stopPropagation();
10256
10291
 
10257
- var onClick = function onClick(event) {
10258
- event.stopPropagation();
10259
- onClickActivate();
10260
- };
10292
+ _onChange(event.target.value === 'Both');
10293
+ },
10294
+ onClose: function onClose(event) {
10295
+ event.stopPropagation();
10296
+ }
10297
+ }, /*#__PURE__*/React.createElement(MenuItem, {
10298
+ disabled: true
10299
+ }, "Auto-update"), /*#__PURE__*/React.createElement(MenuItem, {
10300
+ value: "None"
10301
+ }, /*#__PURE__*/React.createElement(AutoOption, {
10302
+ icon: /*#__PURE__*/React.createElement(None, null),
10303
+ text: "None"
10304
+ })), /*#__PURE__*/React.createElement(MenuItem, {
10305
+ value: "Both"
10306
+ }, /*#__PURE__*/React.createElement(AutoOption, {
10307
+ icon: /*#__PURE__*/React.createElement(Both, null),
10308
+ text: "Both"
10309
+ })));
10310
+ };
10261
10311
 
10262
- return /*#__PURE__*/React.createElement(ManagerButton, {
10263
- tooltipTitle: tooltipTitle,
10264
- onClick: onClick,
10265
- icon: isActive ? /*#__PURE__*/React.createElement(Both, {
10266
- sx: iconStyle
10267
- }) : /*#__PURE__*/React.createElement(None, {
10268
- sx: iconStyle
10269
- }),
10270
- testId: id,
10271
- isActive: isActive,
10272
- className: "activateLayer-btn"
10312
+ var AutoUpdateButton$1 = function AutoUpdateButton(_ref2) {
10313
+ var optionSelected = _ref2.optionSelected,
10314
+ isActive = _ref2.isActive,
10315
+ isEnabled = _ref2.isEnabled;
10316
+ var style = {
10317
+ backgroundColor: isActive ? 'geowebColors.buttons.primary.active.fill' : 'transparent!important',
10318
+ borderRadius: '5px',
10319
+ color: getIconColor(isActive, isEnabled)
10320
+ };
10321
+ var Icon = isActive ? /*#__PURE__*/React.createElement(Both, {
10322
+ sx: style
10323
+ }) : /*#__PURE__*/React.createElement(None, {
10324
+ sx: style
10273
10325
  });
10326
+ return /*#__PURE__*/React.createElement(ToolButton, {
10327
+ "data-testid": "activateLayer-btn",
10328
+ "aria-label": "Auto update ".concat(optionSelected),
10329
+ sx: {
10330
+ '&.MuiButtonBase-root': {
10331
+ backgroundColor: 'transparent'
10332
+ }
10333
+ }
10334
+ }, Icon);
10335
+ };
10336
+
10337
+ var AutoOption = function AutoOption(_ref3) {
10338
+ var icon = _ref3.icon,
10339
+ text = _ref3.text;
10340
+ return /*#__PURE__*/React.createElement(Box, {
10341
+ sx: {
10342
+ display: 'flex',
10343
+ alignItems: 'center'
10344
+ }
10345
+ }, /*#__PURE__*/React.createElement(ListItemText, {
10346
+ sx: {
10347
+ width: '112px'
10348
+ }
10349
+ }, text), /*#__PURE__*/React.createElement(ListItemIcon, null, icon));
10274
10350
  };
10275
10351
 
10276
10352
  /* *
@@ -10335,8 +10411,8 @@ var LayerRow = function LayerRow(_ref) {
10335
10411
  borderRadius: 1,
10336
10412
  marginBottom: 0.5,
10337
10413
  minHeight: '34px',
10338
- '&.sortable-drag': {
10339
- boxShadow: 4
10414
+ '&.sortable-chosen': {
10415
+ boxShadow: 1
10340
10416
  },
10341
10417
  '&.sortable-ghost': {
10342
10418
  opacity: 0.5
@@ -10368,8 +10444,9 @@ var LayerRow = function LayerRow(_ref) {
10368
10444
  },
10369
10445
  id: "enableButton-medium"
10370
10446
  }), layerActiveLayout || /*#__PURE__*/React__default.createElement(ActivateLayer, {
10371
- onClickActivate: onClickRow,
10372
- id: "activateLayer-btn-medium"
10447
+ onChange: onClickRow,
10448
+ isActive: false,
10449
+ isEnabled: true
10373
10450
  }), /*#__PURE__*/React__default.createElement(Typography, {
10374
10451
  sx: {
10375
10452
  fontWeight: '500',
@@ -10448,7 +10525,9 @@ var LayerRow = function LayerRow(_ref) {
10448
10525
  });
10449
10526
  }
10450
10527
  }), layerActiveLayout || /*#__PURE__*/React__default.createElement(ActivateLayer, {
10451
- onClickActivate: onClickRow
10528
+ onChange: onClickRow,
10529
+ isActive: false,
10530
+ isEnabled: true
10452
10531
  })), /*#__PURE__*/React__default.createElement(Grid, {
10453
10532
  item: true,
10454
10533
  className: columnClasses.column2
@@ -11062,11 +11141,10 @@ var ActivateLayerConnect = function ActivateLayerConnect(_ref) {
11062
11141
  }, [dispatch]);
11063
11142
  var isActive = activeLayerId === layerId;
11064
11143
  return /*#__PURE__*/React.createElement(ActivateLayer, {
11065
- tooltipTitle: "Leading layer",
11066
- onClickActivate: function onClickActivate() {
11144
+ onChange: function onChange(isActive) {
11067
11145
  setActiveLayerId({
11068
11146
  mapId: mapId,
11069
- layerId: layerId
11147
+ layerId: isActive ? layerId : undefined
11070
11148
  });
11071
11149
 
11072
11150
  if (isAutoUpdating$1) {
@@ -11191,7 +11269,9 @@ var DragHandle = function DragHandle(_ref) {
11191
11269
  _ref$index = _ref.index,
11192
11270
  index = _ref$index === void 0 ? undefined : _ref$index,
11193
11271
  _ref$hideTooltip = _ref.hideTooltip,
11194
- hideTooltip = _ref$hideTooltip === void 0 ? false : _ref$hideTooltip;
11272
+ hideTooltip = _ref$hideTooltip === void 0 ? false : _ref$hideTooltip,
11273
+ _ref$isSorting = _ref.isSorting,
11274
+ isSorting = _ref$isSorting === void 0 ? false : _ref$isSorting;
11195
11275
  var tooltipTitle = hideTooltip ? '' : TOOLTIP_TITLE;
11196
11276
  return /*#__PURE__*/React__default.createElement(ManagerButton, {
11197
11277
  tooltipTitle: tooltipTitle,
@@ -11205,7 +11285,7 @@ var DragHandle = function DragHandle(_ref) {
11205
11285
  disabled: isDisabled,
11206
11286
  isAccessible: true,
11207
11287
  sx: {
11208
- cursor: 'grab',
11288
+ cursor: isSorting ? 'grabbing' : 'grab',
11209
11289
  '&:hover': {
11210
11290
  backgroundColor: 'inherit!important'
11211
11291
  },
@@ -11252,7 +11332,7 @@ var LayerContainerRow = function LayerContainerRow(_ref) {
11252
11332
  var onStart = React.useCallback(function (_ref3) {
11253
11333
  var oldIndex = _ref3.oldIndex;
11254
11334
  setActiveDragIndex(oldIndex);
11255
- Sortable.ghost.style.opacity = '1';
11335
+ if (Sortable.ghost) Sortable.ghost.style.opacity = '1';
11256
11336
  }, []);
11257
11337
  var onEnd = React.useCallback(function () {
11258
11338
  if (activeDragIndex !== null) {
@@ -11332,12 +11412,11 @@ var LayerContainerRow = function LayerContainerRow(_ref) {
11332
11412
  handle: ".handle",
11333
11413
  direction: "vertical",
11334
11414
  // hover props
11335
- forceFallback: true,
11415
+ forceFallback: false,
11336
11416
  onStart: onStart,
11337
11417
  onEnd: onEnd,
11338
11418
  style: {
11339
- width: '100%',
11340
- cursor: isSorting ? 'grabbing' : 'inherit'
11419
+ width: '100%'
11341
11420
  }
11342
11421
  }, layerIds.map(function (layerId, index) {
11343
11422
  return /*#__PURE__*/React.createElement(LayerRowConnect, {
@@ -11348,7 +11427,8 @@ var LayerContainerRow = function LayerContainerRow(_ref) {
11348
11427
  dragHandle: /*#__PURE__*/React.createElement(DragHandle, {
11349
11428
  isDisabled: isDragDisabled,
11350
11429
  index: index,
11351
- hideTooltip: isSorting || isDragDisabled
11430
+ hideTooltip: isSorting || isDragDisabled,
11431
+ isSorting: isSorting
11352
11432
  })
11353
11433
  });
11354
11434
  })));
@@ -16514,7 +16594,8 @@ var TimeSliderMenu = function TimeSliderMenu(_ref) {
16514
16594
  icon = _ref.icon,
16515
16595
  _ref$onChangeMouseWhe = _ref.onChangeMouseWheel,
16516
16596
  onChangeMouseWheel = _ref$onChangeMouseWhe === void 0 ? function () {} : _ref$onChangeMouseWhe,
16517
- animationLength = _ref.animationLength;
16597
+ displayVariableDuration = _ref.displayVariableDuration,
16598
+ layerHasTimeStep = _ref.layerHasTimeStep;
16518
16599
  var currentMarkIndex = marks.findIndex(function (mark) {
16519
16600
  return mark.value === value;
16520
16601
  });
@@ -16556,11 +16637,12 @@ var TimeSliderMenu = function TimeSliderMenu(_ref) {
16556
16637
  },
16557
16638
  ref: setAnchorRef,
16558
16639
  active: true,
16559
- width: "58px",
16640
+ width: "100%",
16560
16641
  onWheel: onWheel
16561
- }, icon, /*#__PURE__*/React.createElement(TextIcon, {
16562
- text: currentMark === null || currentMark === void 0 ? void 0 : currentMark.text
16563
- }))), /*#__PURE__*/React.createElement(Menu, {
16642
+ }, icon, /*#__PURE__*/React.createElement(Typography, {
16643
+ fontSize: 12,
16644
+ fontWeight: 400
16645
+ }, displayVariableDuration ? minutesToDescribedDuration(value) : currentMark === null || currentMark === void 0 ? void 0 : currentMark.text))), /*#__PURE__*/React.createElement(Menu, {
16564
16646
  anchorEl: anchorRef,
16565
16647
  open: open,
16566
16648
  onClose: function onClose() {
@@ -16596,7 +16678,7 @@ var TimeSliderMenu = function TimeSliderMenu(_ref) {
16596
16678
  setOpen(false);
16597
16679
  },
16598
16680
  key: mark.value,
16599
- selected: (currentMark === null || currentMark === void 0 ? void 0 : currentMark.value) === mark.value,
16681
+ selected: (currentMark === null || currentMark === void 0 ? void 0 : currentMark.value) === mark.value && !isAutoSelected,
16600
16682
  disabled: isDisabled
16601
16683
  }, mark.label || mark.text);
16602
16684
  }), handleAutoClick && /*#__PURE__*/React.createElement(MenuItem, {
@@ -16605,8 +16687,8 @@ var TimeSliderMenu = function TimeSliderMenu(_ref) {
16605
16687
  setOpen(false);
16606
16688
  },
16607
16689
  selected: isAutoSelected,
16608
- disabled: isDisabled
16609
- }, "Auto"), animationLength && /*#__PURE__*/React.createElement(MenuItem, {
16690
+ disabled: isDisabled || !layerHasTimeStep
16691
+ }, "Auto"), displayVariableDuration && /*#__PURE__*/React.createElement(MenuItem, {
16610
16692
  disabled: true,
16611
16693
  sx: {
16612
16694
  fontSize: '12px',
@@ -16616,12 +16698,12 @@ var TimeSliderMenu = function TimeSliderMenu(_ref) {
16616
16698
  minHeight: '30px!important'
16617
16699
  }
16618
16700
  }
16619
- }, "length"), animationLength && /*#__PURE__*/React.createElement(ToolButton, {
16701
+ }, "length"), displayVariableDuration && /*#__PURE__*/React.createElement(ToolButton, {
16620
16702
  "data-testid": "menu-animation-length-button",
16621
16703
  active: false,
16622
16704
  disableRipple: true,
16623
16705
  width: "100%"
16624
- }, minutesToDescribedDuration(animationLength))));
16706
+ }, minutesToDescribedDuration(value))));
16625
16707
  };
16626
16708
 
16627
16709
  var speedTooltipTitle = 'Speed';
@@ -16737,16 +16819,16 @@ var marks$2 = [{
16737
16819
  text: '2w'
16738
16820
  }, {
16739
16821
  label: '1 month',
16740
- value: 40320,
16741
- text: '4w'
16822
+ value: 43800,
16823
+ text: '1mo'
16742
16824
  }, {
16743
16825
  label: '2 months',
16744
- value: 80640,
16745
- text: '8w'
16826
+ value: 87600,
16827
+ text: '2mos'
16746
16828
  }, {
16747
16829
  label: '6 months',
16748
- value: 241920,
16749
- text: '24w'
16830
+ value: 262800,
16831
+ text: '6mos'
16750
16832
  }, {
16751
16833
  label: '1 year',
16752
16834
  value: 525600,
@@ -16761,7 +16843,8 @@ var marks$2 = [{
16761
16843
  var timeStepTitle = 'Time step';
16762
16844
 
16763
16845
  var TimeStepButton = function TimeStepButton(_ref) {
16764
- var timeStep = _ref.timeStep,
16846
+ var _ref$timeStep = _ref.timeStep,
16847
+ timeStep = _ref$timeStep === void 0 ? marks$2[0].value : _ref$timeStep,
16765
16848
  _ref$disabled = _ref.disabled,
16766
16849
  disabled = _ref$disabled === void 0 ? false : _ref$disabled,
16767
16850
  isTimestepAuto = _ref.isTimestepAuto,
@@ -16769,7 +16852,8 @@ var TimeStepButton = function TimeStepButton(_ref) {
16769
16852
  _ref$onToggleTimestep = _ref.onToggleTimestepAuto,
16770
16853
  onToggleTimestepAuto = _ref$onToggleTimestep === void 0 ? function () {} : _ref$onToggleTimestep,
16771
16854
  _ref$isOpenByDefault = _ref.isOpenByDefault,
16772
- isOpenByDefault = _ref$isOpenByDefault === void 0 ? false : _ref$isOpenByDefault;
16855
+ isOpenByDefault = _ref$isOpenByDefault === void 0 ? false : _ref$isOpenByDefault,
16856
+ timeStepFromLayer = _ref.timeStepFromLayer;
16773
16857
 
16774
16858
  var handleMenuItemClick = function handleMenuItemClick(mark) {
16775
16859
  if (isTimestepAuto) {
@@ -16779,6 +16863,12 @@ var TimeStepButton = function TimeStepButton(_ref) {
16779
16863
  onChangeTimeStep(mark.value, MapActionOrigin.map);
16780
16864
  };
16781
16865
 
16866
+ var handleToggleTimeStep = function handleToggleTimeStep() {
16867
+ if (isTimestepAuto) return;
16868
+ onToggleTimestepAuto();
16869
+ timeStepFromLayer && onChangeTimeStep(timeStepFromLayer, MapActionOrigin.map);
16870
+ };
16871
+
16782
16872
  return /*#__PURE__*/React.createElement(TimeSliderMenu, {
16783
16873
  title: timeStepTitle,
16784
16874
  isOpenByDefault: isOpenByDefault,
@@ -16787,9 +16877,11 @@ var TimeStepButton = function TimeStepButton(_ref) {
16787
16877
  handleMenuItemClick: handleMenuItemClick,
16788
16878
  isDisabled: disabled,
16789
16879
  isAutoSelected: isTimestepAuto,
16790
- handleAutoClick: onToggleTimestepAuto,
16880
+ handleAutoClick: handleToggleTimeStep,
16791
16881
  icon: /*#__PURE__*/React.createElement(FastForward, null),
16792
- onChangeMouseWheel: handleMenuItemClick
16882
+ onChangeMouseWheel: handleMenuItemClick,
16883
+ displayVariableDuration: true,
16884
+ layerHasTimeStep: Boolean(timeStepFromLayer)
16793
16885
  });
16794
16886
  };
16795
16887
 
@@ -16973,7 +17065,6 @@ var AnimationLengthButton = function AnimationLengthButton(_ref) {
16973
17065
  disabled = _ref$disabled === void 0 ? false : _ref$disabled,
16974
17066
  _ref$animationLength = _ref.animationLength,
16975
17067
  animationLength = _ref$animationLength === void 0 ? AnimationLength.Hours1 : _ref$animationLength,
16976
- animationLengthInMinutes = _ref.animationLengthInMinutes,
16977
17068
  onChangeAnimationLength = _ref.onChangeAnimationLength;
16978
17069
 
16979
17070
  var onChangeSliderValue = function onChangeSliderValue(mark) {
@@ -16993,7 +17084,7 @@ var AnimationLengthButton = function AnimationLengthButton(_ref) {
16993
17084
  isDisabled: disabled,
16994
17085
  value: animationLength,
16995
17086
  onChangeMouseWheel: onChangeSliderValue,
16996
- animationLength: animationLengthInMinutes
17087
+ displayVariableDuration: true
16997
17088
  });
16998
17089
  };
16999
17090
 
@@ -17041,7 +17132,6 @@ var OptionsMenu = function OptionsMenu(_ref) {
17041
17132
  item: true,
17042
17133
  xs: "auto"
17043
17134
  }, timeStepBtn || /*#__PURE__*/React__default.createElement(TimeStepButton, {
17044
- timeStep: 0,
17045
17135
  onChangeTimeStep: function onChangeTimeStep() {},
17046
17136
  isTimestepAuto: false
17047
17137
  })), /*#__PURE__*/React__default.createElement(Grid, {
@@ -18563,6 +18653,26 @@ var drawRoundedRectangle = function drawRoundedRectangle(ctx, x, y, width, heigh
18563
18653
  ctx.restore();
18564
18654
  };
18565
18655
 
18656
+ var drawAutoUpdateIcon = function drawAutoUpdateIcon(ctx, x, y, theme, isAutoUpdating) {
18657
+ ctx.save();
18658
+ ctx.translate(x, y);
18659
+ var playerTimeText = theme.palette.geowebColors.timeSlider.playerTimeText;
18660
+ ctx.fillStyle = isAutoUpdating ? '#7BACFF' : '#B4B4B4';
18661
+ var path = new Path2D('M12.385 3.295l5 3-5 3V7.723l-.085.014c-3.08.548-5.418 3.24-5.418 6.479 0 3.634 2.945 6.58 6.577 6.58 2.914 0 5.385-1.896 6.248-4.523l2.815-1.626c-.225 4.814-4.197 8.648-9.063 8.648-5.012 0-9.074-4.065-9.074-9.08 0-4.65 3.495-8.484 8-9.015V3.295z');
18662
+ ctx.translate(7, -8);
18663
+ ctx.rotate(13.295);
18664
+ ctx.fill(path);
18665
+ ctx.restore();
18666
+ var text = 'Auto';
18667
+ ctx.save();
18668
+ ctx.translate(x, y);
18669
+ ctx.fillStyle = isAutoUpdating ? '#7BACFF' : '#B4B4B4'; // ON
18670
+
18671
+ ctx.font = "7px ".concat(playerTimeText.fontFamily);
18672
+ ctx.fillText(text, 5, 14);
18673
+ ctx.restore();
18674
+ };
18675
+
18566
18676
  var drawTextAnnotation = function drawTextAnnotation(ctx, x, y, text, theme) {
18567
18677
  var playerTimeText = theme.palette.geowebColors.timeSlider.playerTimeText;
18568
18678
  ctx.save();
@@ -18576,20 +18686,22 @@ var drawTextAnnotation = function drawTextAnnotation(ctx, x, y, text, theme) {
18576
18686
  ctx.restore();
18577
18687
  };
18578
18688
 
18579
- var drawNewCurrentTimeBox = function drawNewCurrentTimeBox(ctx, selectedTime, selectedPx, scale, theme) {
18689
+ var drawNewCurrentTimeBox = function drawNewCurrentTimeBox(ctx, selectedTime, selectedPx, scale, theme, isAutoUpdating) {
18690
+ var iconWidth = 25;
18580
18691
  var smallWidth = needleGeom.smallWidth,
18581
18692
  largeWidth = needleGeom.largeWidth,
18582
18693
  height = needleGeom.height;
18583
- var needleWidth = scale === Scale.Year ? largeWidth : smallWidth;
18584
- var needleX = selectedPx - needleWidth / 2;
18694
+ var boxWidth = scale === Scale.Year ? largeWidth : smallWidth;
18695
+ var needleX = selectedPx - boxWidth / 2;
18585
18696
  var needleY = needleGeom.lineWidth;
18586
- drawRoundedRectangle(ctx, needleX, needleY, needleWidth, height, needleGeom.cornerRadius, theme);
18697
+ drawRoundedRectangle(ctx, needleX - iconWidth, needleY, boxWidth + iconWidth, height, needleGeom.cornerRadius, theme);
18587
18698
  var timeFormat = scale === Scale.Year ? 'Y ddd DD MMM HH:mm' : 'ddd DD MMM HH:mm';
18588
18699
  var timeText = moment.utc(selectedTime * 1000).format(timeFormat).toString();
18589
- drawTextAnnotation(ctx, needleX + needleWidth / 2, needleY + height / 2, timeText, theme);
18700
+ drawTextAnnotation(ctx, needleX + boxWidth / 2 - iconWidth, needleY + height / 2, timeText, theme);
18701
+ drawAutoUpdateIcon(ctx, needleX + boxWidth - iconWidth, needleY, theme, isAutoUpdating);
18590
18702
  };
18591
18703
 
18592
- var renderTimeSliderCurrentTimeBox = function renderTimeSliderCurrentTimeBox(ctx, theme, width, height, centerTime, selected, secondsPerPx, scale) {
18704
+ var renderTimeSliderCurrentTimeBox = function renderTimeSliderCurrentTimeBox(ctx, theme, width, height, centerTime, selected, secondsPerPx, scale, isAutoUpdating) {
18593
18705
  // map unix timestamps to pixel values
18594
18706
  var _map = [selected].map(function (t) {
18595
18707
  return timestampToPixel(t, centerTime, width, secondsPerPx);
@@ -18598,7 +18710,7 @@ var renderTimeSliderCurrentTimeBox = function renderTimeSliderCurrentTimeBox(ctx
18598
18710
  selectedPx = _map2[0];
18599
18711
 
18600
18712
  ctx.clearRect(0, 0, width, height);
18601
- drawNewCurrentTimeBox(ctx, selected, selectedPx, scale, theme);
18713
+ drawNewCurrentTimeBox(ctx, selected, selectedPx, scale, theme, isAutoUpdating);
18602
18714
  };
18603
18715
 
18604
18716
  var TimeSliderCurrentTimeBox = function TimeSliderCurrentTimeBox(_ref) {
@@ -18613,6 +18725,7 @@ var TimeSliderCurrentTimeBox = function TimeSliderCurrentTimeBox(_ref) {
18613
18725
  dataStartTime = _ref.dataStartTime,
18614
18726
  dataEndTime = _ref.dataEndTime,
18615
18727
  unfilteredSelectedTime = _ref.unfilteredSelectedTime,
18728
+ isAutoUpdating = _ref.isAutoUpdating,
18616
18729
  onSetNewDate = _ref.onSetNewDate,
18617
18730
  setUnfilteredSelectedTime = _ref.setUnfilteredSelectedTime;
18618
18731
  var TIME_BOX_WIDTH = 140;
@@ -18697,7 +18810,7 @@ var TimeSliderCurrentTimeBox = function TimeSliderCurrentTimeBox(_ref) {
18697
18810
  },
18698
18811
  onRenderCanvas: function onRenderCanvas(ctx, width, height) {
18699
18812
  setCanvasWidth(width);
18700
- renderTimeSliderCurrentTimeBox(ctx, theme, width, height, centerTime, selectedTime, secondsPerPx, scale);
18813
+ renderTimeSliderCurrentTimeBox(ctx, theme, width, height, centerTime, selectedTime, secondsPerPx, scale, isAutoUpdating);
18701
18814
  }
18702
18815
  }));
18703
18816
  };
@@ -18955,26 +19068,15 @@ var TimeStepButtonComponent = function TimeStepButtonComponent(_ref) {
18955
19068
  var activeLayerTimeDimension = useSelector(function (store) {
18956
19069
  return getLayerTimeDimension(store, activeLayerId);
18957
19070
  });
18958
-
18959
- var onToggleTimestepAuto = function onToggleTimestepAuto() {
18960
- var newTimestepAuto = !isTimestepAuto$1;
18961
-
18962
- if (newTimestepAuto) {
18963
- var timeStepFromLayer = getActiveLayerTimeStep(activeLayerTimeDimension);
18964
-
18965
- if (timeStepFromLayer) {
18966
- dispatch(mapActions$1.setTimeStep({
18967
- mapId: mapId,
18968
- timeStep: timeStepFromLayer
18969
- }));
18970
- }
18971
- }
18972
-
19071
+ var timeStepFromLayer = getActiveLayerTimeStep(activeLayerTimeDimension);
19072
+ var onToggleTimestepAuto = React.useCallback(function () {
18973
19073
  dispatch(mapActions$1.toggleTimestepAuto({
18974
19074
  mapId: mapId,
18975
- timestepAuto: newTimestepAuto
19075
+ timestepAuto: !isTimestepAuto$1,
19076
+ origin: MapActionOrigin.map
18976
19077
  }));
18977
- };
19078
+ }, [dispatch, isTimestepAuto$1, mapId]);
19079
+ var activeTimeStep = isTimestepAuto$1 && timeStepFromLayer ? timeStepFromLayer : timeStep;
18978
19080
 
18979
19081
  var onSetTimeStep = function onSetTimeStep(timeStep) {
18980
19082
  dispatch(mapActions$1.setTimeStep({
@@ -18984,11 +19086,12 @@ var TimeStepButtonComponent = function TimeStepButtonComponent(_ref) {
18984
19086
  };
18985
19087
 
18986
19088
  return /*#__PURE__*/React.createElement(TimeStepButton, {
18987
- timeStep: timeStep,
19089
+ timeStep: activeTimeStep,
18988
19090
  onChangeTimeStep: onSetTimeStep,
18989
19091
  disabled: isAnimating$1,
18990
19092
  onToggleTimestepAuto: onToggleTimestepAuto,
18991
- isTimestepAuto: Boolean(isTimestepAuto$1)
19093
+ isTimestepAuto: Boolean(isTimestepAuto$1) && Boolean(timeStepFromLayer),
19094
+ timeStepFromLayer: timeStepFromLayer
18992
19095
  });
18993
19096
  };
18994
19097
 
@@ -19138,11 +19241,6 @@ var AnimationLengthButtonConnect = function AnimationLengthButtonConnect(_ref) {
19138
19241
  return getAnimationEndTime$1(store, mapId);
19139
19242
  });
19140
19243
  var currentDiffInMinutes = moment(animationEndTime).diff(moment(animationStartTime), 'minutes');
19141
- var currentLength = Object.values(AnimationLength).map(function (val) {
19142
- return Number(val);
19143
- }).find(function (val) {
19144
- return val >= currentDiffInMinutes;
19145
- });
19146
19244
 
19147
19245
  var handlechangeAnimationLength = function handlechangeAnimationLength(length) {
19148
19246
  var animationEndTime = moment(animationStartTime).add(length, 'minutes').toISOString();
@@ -19154,9 +19252,8 @@ var AnimationLengthButtonConnect = function AnimationLengthButtonConnect(_ref) {
19154
19252
 
19155
19253
  return /*#__PURE__*/React.createElement(AnimationLengthButton, {
19156
19254
  disabled: isAnimating$1,
19157
- animationLength: currentLength || Number(AnimationLength.Hours24),
19158
- onChangeAnimationLength: handlechangeAnimationLength,
19159
- animationLengthInMinutes: currentDiffInMinutes
19255
+ animationLength: currentDiffInMinutes || Number(AnimationLength.Hours24),
19256
+ onChangeAnimationLength: handlechangeAnimationLength
19160
19257
  });
19161
19258
  };
19162
19259
 
@@ -19440,6 +19537,7 @@ var connectRedux = connect(function (store, props) {
19440
19537
  scale: getMapTimeSliderScale(store, props.mapId),
19441
19538
  timeStep: getMapTimeStep(store, props.mapId),
19442
19539
  isAnimating: isAnimating(store, props.mapId),
19540
+ isAutoUpdating: isAutoUpdating(store, props.mapId),
19443
19541
  unfilteredSelectedTime: getTimeSliderUnfilteredSelectedTime(store, props.mapId)
19444
19542
  };
19445
19543
  }, {
@@ -19458,6 +19556,7 @@ var TimeSliderCurrentTimeBoxConnectComponent = function TimeSliderCurrentTimeBox
19458
19556
  layers = _ref.layers,
19459
19557
  timeStep = _ref.timeStep,
19460
19558
  isAnimating = _ref.isAnimating,
19559
+ isAutoUpdating = _ref.isAutoUpdating,
19461
19560
  stopMapAnimation = _ref.stopMapAnimation,
19462
19561
  unfilteredSelectedTime = _ref.unfilteredSelectedTime,
19463
19562
  setTimeSliderUnfilteredSelectedTime = _ref.setTimeSliderUnfilteredSelectedTime,
@@ -19479,6 +19578,7 @@ var TimeSliderCurrentTimeBoxConnectComponent = function TimeSliderCurrentTimeBox
19479
19578
  dataStartTime: dataStartTime,
19480
19579
  dataEndTime: dataEndTime,
19481
19580
  timeStep: timeStep,
19581
+ isAutoUpdating: isAutoUpdating,
19482
19582
  unfilteredSelectedTime: unfilteredSelectedTime || selectedTime,
19483
19583
  setUnfilteredSelectedTime: function setUnfilteredSelectedTime(timeSliderUnfilteredSelectedTime) {
19484
19584
  if (setTimeSliderUnfilteredSelectedTime) setTimeSliderUnfilteredSelectedTime({
@@ -26348,4 +26448,4 @@ var MapWarningProperties = function MapWarningProperties(_ref) {
26348
26448
  * */
26349
26449
  var mapActions = Object.assign(Object.assign(Object.assign({}, layerActions), mapActions$1), serviceActions);
26350
26450
 
26351
- export { AppWrapperConnect, ConfigurableMapConnect, CoreThemeProvider, CoreThemeStoreProvider, DockedLayerManagerConnect, HarmonieTempAndPrecipPreset, LayerManager, LayerManagerConnect, LayerManagerMapButtonConnect, LayerSelectConnect, Legend, LegendConnect, LegendMapButtonConnect, MapControls, MapView, MapViewConnect, MapViewLayer, MapWarningProperties, MultiDimensionSelectMapButtonsConnect, MultiMapMultiDimensionSelectConnect as MultiMapDimensionSelectConnect, MultiMapViewConnect, ReactMapView, ReactMapViewLayer, SnackbarWrapperConnect, SyncGroupViewerConnect, index as SyncGroups, TimeSliderConnect, ZoomControlConnect, ZoomControls, appActions, componentsLookUp, coreModuleConfig, dateFormat, defaultBbox, defaultConfigurations, filterLayers, filterMapPresets, filterNonTimeDimensions, filterServices, generateLayerId, generateMapId, generateTimesliderId, getDrawFunctionFromStore, getFirstTimeStepForLayerId, getInitialAppPresets, getLastTimeStepForLayerId, getNextTimeStepForLayerId, getPreviousTimeStepForLayerId, getWMJSDimensionForLayerAndDimension, getWMJSMapById, getWMJSTimeDimensionForLayerId, getWMLayerById, layerActions, reducer$7 as layerReducer, selectors$2 as layerSelectors, types$3 as layerTypes, mapActions, moduleConfig as mapModuleConfig, selectors as mapSelectors, types$2 as mapTypes, utils as mapUtils, parseBoolean, parseLayer, publicLayers, publicServices, registerDrawFunction, registerWMJSMap, registerWMLayer, snackbarActions, store, genericActions as syncGroupActions, synchronizationGroupConfig as synchronizationGroupModuleConfig, synchronizationGroupConfig as synchronizationGroupsConfig, testLayers, TimeSliderUtils as timeSliderUtils, uiActions, uiModuleConfig, selectors$1 as uiSelectors, types as uiTypes, unRegisterWMJSLayer, unRegisterWMJSMap, useSetupDialog };
26451
+ export { AppWrapperConnect, ConfigurableMapConnect, CoreThemeProvider, CoreThemeStoreProvider, DockedLayerManagerConnect, HarmonieTempAndPrecipPreset, LayerManager, LayerManagerConnect, LayerManagerMapButtonConnect, LayerSelectConnect, Legend, LegendConnect, LegendMapButtonConnect, MapControls, MapView, MapViewConnect, MapViewLayer, MapWarningProperties, MultiDimensionSelectMapButtonsConnect, MultiMapMultiDimensionSelectConnect as MultiMapDimensionSelectConnect, MultiMapViewConnect, ReactMapView, ReactMapViewLayer, SnackbarWrapperConnect, SyncGroupViewerConnect, index as SyncGroups, TimeSliderConnect, ZoomControlConnect, ZoomControls, appActions, componentsLookUp, coreModuleConfig, dateFormat, defaultBbox, defaultConfigurations, filterLayers, filterMapPresets, filterNonTimeDimensions, filterServices, generateLayerId, generateMapId, generateTimesliderId, getDrawFunctionFromStore, getFirstTimeStepForLayerId, getInitialAppPresets, getLastTimeStepForLayerId, getNextTimeStepForLayerId, getPreviousTimeStepForLayerId, getWMJSDimensionForLayerAndDimension, getWMJSMapById, getWMJSTimeDimensionForLayerId, getWMLayerById, layerActions, reducer$7 as layerReducer, selectors$2 as layerSelectors, types$3 as layerTypes, mapActions, moduleConfig as mapModuleConfig, selectors as mapSelectors, types$2 as mapTypes, utils as mapUtils, parseBoolean, parseLayer, publicLayers, publicServices, registerDrawFunction, registerWMJSMap, registerWMLayer, snackbarActions, store, genericActions as syncGroupActions, synchronizationGroupConfig as synchronizationGroupModuleConfig, synchronizationGroupConfig as synchronizationGroupsConfig, testLayers, timeSliderUtils, uiActions, uiModuleConfig, selectors$1 as uiSelectors, types as uiTypes, unRegisterWMJSLayer, unRegisterWMJSMap, useSetupDialog };