@opengeoweb/core 9.20.2 → 9.21.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
@@ -2015,8 +2015,7 @@ const HeaderOptions = ({
2015
2015
  shortcutsEnabled,
2016
2016
  onClickDockButton,
2017
2017
  onChangeSize,
2018
- buttonSettings,
2019
- mapWidth
2018
+ buttonSettings
2020
2019
  }) => {
2021
2020
  var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l;
2022
2021
  const {
@@ -2044,11 +2043,7 @@ const HeaderOptions = ({
2044
2043
  tooltipTitle: t('layermanager-header-button-small'),
2045
2044
  "data-testid": "collapseSmall-btn",
2046
2045
  onClick: () => {
2047
- if (!isDockedLayerManager) {
2048
- onChangeSize(sizeSmall);
2049
- } else if (mapWidth && mapWidth > sizeSmall.width) {
2050
- onChangeSize(sizeSmall);
2051
- }
2046
+ onChangeSize(sizeSmall);
2052
2047
  },
2053
2048
  className: "collapseSmall-btn"
2054
2049
  }, {
@@ -2057,11 +2052,7 @@ const HeaderOptions = ({
2057
2052
  tooltipTitle: t('layermanager-header-button-medium'),
2058
2053
  "data-testid": "collapseMedium-btn",
2059
2054
  onClick: () => {
2060
- if (!isDockedLayerManager) {
2061
- onChangeSize(sizeMedium);
2062
- } else if (mapWidth && mapWidth > sizeMedium.width) {
2063
- onChangeSize(sizeMedium);
2064
- }
2055
+ onChangeSize(sizeMedium);
2065
2056
  },
2066
2057
  className: "collapseMedium-btn"
2067
2058
  }, {
@@ -2070,11 +2061,7 @@ const HeaderOptions = ({
2070
2061
  tooltipTitle: t('layermanager-header-button-large'),
2071
2062
  "data-testid": "collapseLarge-btn",
2072
2063
  onClick: () => {
2073
- if (!isDockedLayerManager) {
2074
- onChangeSize(sizeLarge);
2075
- } else if (mapWidth && mapWidth > sizeLarge.width) {
2076
- onChangeSize(sizeLarge);
2077
- }
2064
+ onChangeSize(sizeLarge);
2078
2065
  },
2079
2066
  className: "collapseLarge-btn"
2080
2067
  }, {
@@ -6488,8 +6475,7 @@ const HeaderOptionsConnect = ({
6488
6475
  mapId,
6489
6476
  onClickDockButton,
6490
6477
  onChangeSize,
6491
- buttonSettings,
6492
- mapWidth
6478
+ buttonSettings
6493
6479
  }) => {
6494
6480
  const activeMapId = useSelector(store => uiSelectors.getActiveWindowId(store));
6495
6481
  const floatingLmOpen = useSelector(store => uiSelectors.getisDialogOpen(store, uiTypes.DialogTypes.LayerManager));
@@ -6499,8 +6485,7 @@ const HeaderOptionsConnect = ({
6499
6485
  shortcutsEnabled: shortcutsEnabled,
6500
6486
  onClickDockButton: onClickDockButton,
6501
6487
  onChangeSize: onChangeSize,
6502
- buttonSettings: buttonSettings,
6503
- mapWidth: mapWidth
6488
+ buttonSettings: buttonSettings
6504
6489
  });
6505
6490
  };
6506
6491
 
@@ -6693,6 +6678,18 @@ const styles$1 = {
6693
6678
  boxSizing: 'border-box'
6694
6679
  }
6695
6680
  };
6681
+ const getLayerManagerSizeValue = size => {
6682
+ if (!size.width || typeof size.width !== 'number') {
6683
+ return 'sizeLarge';
6684
+ }
6685
+ if (size.width < sizeMedium.width) {
6686
+ return 'sizeSmall';
6687
+ }
6688
+ if (size.width < sizeLarge.width) {
6689
+ return 'sizeMedium';
6690
+ }
6691
+ return 'sizeLarge';
6692
+ };
6696
6693
  const LayerManager = ({
6697
6694
  mapId,
6698
6695
  preloadedAvailableBaseLayers,
@@ -6716,7 +6713,6 @@ const LayerManager = ({
6716
6713
  },
6717
6714
  settings,
6718
6715
  headerSize: _headerSize = 'medium',
6719
- mapWidthRef,
6720
6716
  addLayerComponent
6721
6717
  }) => {
6722
6718
  var _a, _b, _c, _d, _e, _f, _g;
@@ -6731,34 +6727,7 @@ const LayerManager = ({
6731
6727
  renderCounter.count(LayerManager.name);
6732
6728
  const startSizeCalc = calculateStartSize(minSize, _size, _startPosition);
6733
6729
  const [sizeInState, setSizeInState] = React.useState(startSizeCalc);
6734
- const [mapWidth, setMapWidth] = React.useState();
6735
- React.useEffect(() => {
6736
- var _a;
6737
- setMapWidth((_a = mapWidthRef === null || mapWidthRef === void 0 ? void 0 : mapWidthRef.current) === null || _a === void 0 ? void 0 : _a.clientWidth);
6738
- }, [mapWidthRef, setMapWidth]);
6739
- React.useEffect(() => {
6740
- var _a;
6741
- const resizeThreshold = 65;
6742
- if (((_a = mapWidthRef === null || mapWidthRef === void 0 ? void 0 : mapWidthRef.current) === null || _a === void 0 ? void 0 : _a.clientWidth) === mapWidth) {
6743
- return;
6744
- }
6745
- if (mapWidth) {
6746
- if (mapWidth < sizeMedium.width + resizeThreshold) {
6747
- setSizeInState(sizeSmall);
6748
- } else if (mapWidth >= sizeMedium.width + resizeThreshold && mapWidth < sizeLarge.width + resizeThreshold && sizeInState.width !== sizeSmall.width) {
6749
- setSizeInState(sizeMedium);
6750
- }
6751
- }
6752
- }, [mapWidth, sizeInState, mapWidthRef]);
6753
- const returnSizeValue = sizeInState => {
6754
- if (sizeInState === sizeSmall) {
6755
- return 'sizeSmall';
6756
- }
6757
- if (sizeInState === sizeMedium) {
6758
- return 'sizeMedium';
6759
- }
6760
- return 'sizeLarge';
6761
- };
6730
+ const dataSize = getLayerManagerSizeValue(sizeInState);
6762
6731
  return jsx(ToolContainerDraggable, Object.assign({
6763
6732
  title: _title,
6764
6733
  startSize: sizeInState,
@@ -6770,7 +6739,7 @@ const LayerManager = ({
6770
6739
  headerSize: _headerSize,
6771
6740
  bounds: bounds,
6772
6741
  "data-testid": "layerManagerWindow",
6773
- "data-size": returnSizeValue(sizeInState),
6742
+ "data-size": dataSize,
6774
6743
  onMouseDown: _onMouseDown,
6775
6744
  order: _order,
6776
6745
  source: _source,
@@ -6779,7 +6748,6 @@ const LayerManager = ({
6779
6748
  isDockedLayerManager: _isDockedLayerManager,
6780
6749
  mapId: mapId,
6781
6750
  onClickDockButton: _onToggleDock,
6782
- mapWidth: mapWidth,
6783
6751
  onChangeSize: ({
6784
6752
  width
6785
6753
  }) => {
@@ -6924,8 +6892,7 @@ const LayerManagerConnect = ({
6924
6892
  mapId: initialMapId = null,
6925
6893
  isMultiMap: _isMultiMap = false,
6926
6894
  isDocked: _isDocked = false,
6927
- source: _source = 'app',
6928
- mapWidthRef
6895
+ source: _source = 'app'
6929
6896
  }) => {
6930
6897
  const dispatch = useDispatch();
6931
6898
  const dialogType = getDialogType(initialMapId, _isMultiMap, _isDocked);
@@ -6991,7 +6958,6 @@ const LayerManagerConnect = ({
6991
6958
  top: 85,
6992
6959
  left: 50
6993
6960
  },
6994
- mapWidthRef: mapWidthRef,
6995
6961
  addLayerComponent: jsx(LayerSelectButtonConnect, {
6996
6962
  mapId: mapId,
6997
6963
  source: _source,
@@ -6999,7 +6965,7 @@ const LayerManagerConnect = ({
6999
6965
  })
7000
6966
  }), !_isDocked && jsx(LayerInfoDialogConnect, {}), !_isDocked && jsx(LayerSelectConnect, {})]
7001
6967
  });
7002
- }, [bounds, dialogOrder, dockedLayerManagerSize, initialMapId, isDialogOpen, _isDocked, _isMultiMap, _leftHeaderComponent, mapId, onCloseDialog, onToggleDock, preloadedAvailableBaseLayers, preloadedBaseServices, setDialogOrder, _showMapIdInTitle, _title, uiError, uiIsLoading, uiSource, mapWidthRef, _source]);
6968
+ }, [bounds, dialogOrder, dockedLayerManagerSize, initialMapId, isDialogOpen, _isDocked, _isMultiMap, _leftHeaderComponent, mapId, onCloseDialog, onToggleDock, preloadedAvailableBaseLayers, preloadedBaseServices, setDialogOrder, _showMapIdInTitle, _title, uiError, uiIsLoading, uiSource, _source]);
7003
6969
  };
7004
6970
 
7005
6971
  const LayerManagerMapButtonConnect = ({
@@ -8369,7 +8335,7 @@ const GetFeatureInfoDialog = ({
8369
8335
  right: 10,
8370
8336
  top: 80
8371
8337
  },
8372
- minWidth: 300,
8338
+ minWidth: 100,
8373
8339
  onClose: onClose,
8374
8340
  title: _showMapId ? `${t('feature_info_marker_info')} ${mapId}` : t('feature_info_marker_info'),
8375
8341
  initialMaxHeight: 440,
@@ -8896,11 +8862,15 @@ const AnimationLengthButtonConnect = ({
8896
8862
  }) => {
8897
8863
  const dispatch = useDispatch();
8898
8864
  const isAnimating = useSelector(store => mapSelectors.isAnimating(store, mapId));
8899
- const animationStartTime = useSelector(store => mapSelectors.getAnimationStartTime(store, mapId));
8900
- const animationEndTime = useSelector(store => mapSelectors.getAnimationEndTime(store, mapId));
8865
+ const isAnimationLengthAuto = useSelector(store => mapSelectors.isAnimationLengthAuto(store, mapId));
8866
+ const selectedAnimationStartTime = useSelector(store => mapSelectors.getAnimationStartTime(store, mapId));
8867
+ const {
8868
+ animationStartTime,
8869
+ animationEndTime
8870
+ } = useSelector(store => mapSelectors.getAnimationRange(store, mapId));
8901
8871
  const currentDiffInMinutes = dateUtils.differenceInMinutes(dateUtils.utc(animationEndTime), dateUtils.utc(animationStartTime));
8902
8872
  const handlechangeAnimationLength = length => {
8903
- const animationEndTime = dateUtils.dateToIsoString(dateUtils.add(dateUtils.utc(animationStartTime), {
8873
+ const animationEndTime = dateUtils.dateToIsoString(dateUtils.add(dateUtils.utc(selectedAnimationStartTime), {
8904
8874
  minutes: length
8905
8875
  }));
8906
8876
  dispatch(mapActions.setAnimationEndTime({
@@ -8909,10 +8879,22 @@ const AnimationLengthButtonConnect = ({
8909
8879
  origin: mapEnums.MapActionOrigin.map
8910
8880
  }));
8911
8881
  };
8882
+ const toggleAnimationLengthAuto = React.useCallback(() => {
8883
+ dispatch(mapActions.toggleAnimationLengthAuto({
8884
+ mapId,
8885
+ autoAnimationLength: true,
8886
+ origin: mapEnums.MapActionOrigin.map
8887
+ }));
8888
+ }, [dispatch, mapId]);
8889
+ const autoTimestepLayerId = useSelector(store => mapSelectors.getAutoTimeStepLayerId(store, mapId));
8890
+ const timeStepFromLayer = useSelector(store => layerSelectors.getTimeStepForLayerId(store, autoTimestepLayerId));
8912
8891
  return jsx(AnimationLengthButton, {
8913
8892
  disabled: isAnimating,
8914
8893
  animationLength: currentDiffInMinutes || Number(AnimationLength.Hours24),
8915
- onChangeAnimationLength: handlechangeAnimationLength
8894
+ isAuto: isAnimationLengthAuto,
8895
+ onChangeAnimationLength: handlechangeAnimationLength,
8896
+ toggleAnimationLengthAuto: toggleAnimationLengthAuto,
8897
+ layerHasTimeStep: Boolean(timeStepFromLayer)
8916
8898
  });
8917
8899
  };
8918
8900
 
@@ -9008,8 +8990,6 @@ const OptionsMenuButtonConnect = ({
9008
8990
  };
9009
8991
 
9010
8992
  const connectRedux$2 = connect((store, props) => ({
9011
- animationStartTime: mapSelectors.getAnimationStartTime(store, props.mapId),
9012
- animationEndTime: mapSelectors.getAnimationEndTime(store, props.mapId),
9013
8993
  timeStep: mapSelectors.getMapTimeStep(store, props.mapId),
9014
8994
  linkedMapAnimationInfo: mapSelectors.linkedMapAnimationInfo(store, props.mapId)
9015
8995
  }), {
@@ -9018,14 +8998,16 @@ const connectRedux$2 = connect((store, props) => ({
9018
8998
  });
9019
8999
  const PlayButtonConnect = connectRedux$2(({
9020
9000
  mapId,
9021
- animationStartTime,
9022
- animationEndTime,
9023
9001
  isDisabled,
9024
9002
  timeStep,
9025
9003
  linkedMapAnimationInfo,
9026
9004
  mapStartAnimation,
9027
9005
  mapStopAnimation
9028
9006
  }) => {
9007
+ const {
9008
+ animationStartTime,
9009
+ animationEndTime
9010
+ } = useSelector(store => mapSelectors.getAnimationRange(store, mapId));
9029
9011
  const animationInterval = timeStep || defaultTimeStep;
9030
9012
  const onTogglePlay = () => {
9031
9013
  if (linkedMapAnimationInfo.isAnimating) {
@@ -9223,8 +9205,10 @@ const TimeSliderLegendConnect = ({
9223
9205
  const secondsPerPx = useSelector(store => mapSelectors.getMapTimeSliderSecondsPerPx(store, mapId));
9224
9206
  const timeStep = useSelector(store => mapSelectors.getMapTimeStep(store, mapId));
9225
9207
  const isTimeSliderHoverOn = useSelector(store => mapSelectors.isTimeSliderHoverOn(store, mapId));
9226
- const animationStartTime = useSelector(store => mapSelectors.getAnimationStartTime(store, mapId));
9227
- const animationEndTime = useSelector(store => mapSelectors.getAnimationEndTime(store, mapId));
9208
+ const {
9209
+ animationStartTime,
9210
+ animationEndTime
9211
+ } = useSelector(store => mapSelectors.getAnimationRange(store, mapId));
9228
9212
  const timeSliderSpan = useSelector(store => mapSelectors.getMapTimeSliderSpan(store, mapId));
9229
9213
  const currentTime = dateUtils.unix(Date.now());
9230
9214
  const [dataStartTime, dataEndTime] = useSelector(store => mapSelectors.getDataLimitsFromLayers(store, mapId));
@@ -9678,7 +9662,6 @@ const ConfigurableMapConnect = _a => {
9678
9662
  // eslint-disable-next-line react-hooks/exhaustive-deps
9679
9663
  }, []);
9680
9664
  const mapControlsPositionTop = title ? 24 : 8;
9681
- const mapWidthRef = /*#__PURE__*/React__default.createRef();
9682
9665
  return React__default.useMemo(() => {
9683
9666
  renderCounter.count(`${ConfigurableMapConnect.name}_${mapId}`);
9684
9667
  return jsxs(Box, Object.assign({
@@ -9688,8 +9671,7 @@ const ConfigurableMapConnect = _a => {
9688
9671
  position: 'relative',
9689
9672
  overflow: 'hidden'
9690
9673
  },
9691
- "data-testid": "ConfigurableMap",
9692
- ref: mapWidthRef
9674
+ "data-testid": "ConfigurableMap"
9693
9675
  }, {
9694
9676
  children: [title && jsx(Typography, Object.assign({
9695
9677
  "data-testid": "mapTitle",
@@ -9751,11 +9733,10 @@ const ConfigurableMapConnect = _a => {
9751
9733
  }), jsx(LayerManagerConnect, {
9752
9734
  mapId: mapId,
9753
9735
  bounds: "parent",
9754
- isDocked: true,
9755
- mapWidthRef: mapWidthRef
9736
+ isDocked: true
9756
9737
  })]
9757
9738
  }));
9758
- }, [children, disableTimeSlider, displayDimensionSelectButtonInMap, displayGetFeatureInfoButtonInMap, displayLayerManagerAndLegendButtonInMap, displaySearchButtonInMap, displayTimeInMap, id, mapControls, mapControlsPositionTop, mapId, multiLegend, showClock, shouldAutoFetch, title, mapWidthRef]);
9739
+ }, [children, disableTimeSlider, displayDimensionSelectButtonInMap, displayGetFeatureInfoButtonInMap, displayLayerManagerAndLegendButtonInMap, displaySearchButtonInMap, displayTimeInMap, id, mapControls, mapControlsPositionTop, mapId, multiLegend, showClock, shouldAutoFetch, title]);
9759
9740
  };
9760
9741
 
9761
9742
  var uncurryThis$1 = functionUncurryThis;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@opengeoweb/core",
3
- "version": "9.20.2",
3
+ "version": "9.21.0",
4
4
  "description": "GeoWeb Core library for the opengeoweb project",
5
5
  "license": "Apache-2.0",
6
6
  "repository": {
@@ -26,8 +26,8 @@
26
26
  "@opengeoweb/snackbar": "*",
27
27
  "react-router-dom": "^6.21.0",
28
28
  "react-draggable": "^4.4.6",
29
- "i18next": "^23.7.11",
30
- "react-i18next": "^13.5.0",
29
+ "i18next": "^23.11.5",
30
+ "react-i18next": "^14.1.2",
31
31
  "dompurify": "^3.0.6",
32
32
  "@sentry/react": "^7.109.0"
33
33
  },
@@ -23,7 +23,6 @@ interface LayerManagerProps {
23
23
  startPosition?: Position;
24
24
  settings?: LayerManagerCustomSettings;
25
25
  headerSize?: HeaderSize;
26
- mapWidthRef?: React.RefObject<HTMLDivElement>;
27
26
  addLayerComponent?: React.ReactElement;
28
27
  }
29
28
  declare const LayerManager: React.FC<LayerManagerProps>;
@@ -13,7 +13,6 @@ interface LayerManagerConnectProps {
13
13
  isMultiMap?: boolean;
14
14
  isDocked?: boolean;
15
15
  source?: uiTypes.Source;
16
- mapWidthRef?: React.RefObject<HTMLDivElement>;
17
16
  }
18
17
  /**
19
18
  * Layer Managerconnected to the store displaying the layers forthe active map Id
@@ -29,7 +29,6 @@ interface HeaderOptionsProps {
29
29
  onClickDockButton: () => void;
30
30
  onChangeSize: (size: Size) => void;
31
31
  buttonSettings?: ToolbarButtonSettings;
32
- mapWidth?: number;
33
32
  }
34
33
  export declare const sizeSmall: {
35
34
  width: number;
@@ -6,7 +6,6 @@ interface HeaderOptionsProps {
6
6
  onClickDockButton: () => void;
7
7
  onChangeSize: (size: Size) => void;
8
8
  buttonSettings?: ToolbarButtonSettings;
9
- mapWidth?: number;
10
9
  }
11
10
  export declare const areShortcutsEnabled: (activeMapId: string, mapId: string, floatingLmOpen: boolean, isDockedLayerManager: boolean) => boolean;
12
11
  declare const HeaderOptionsConnect: React.FC<HeaderOptionsProps>;
@@ -16,8 +16,6 @@ export interface PlayButtonConnectProps {
16
16
  };
17
17
  }
18
18
  declare const connectRedux: import("react-redux").InferableComponentEnhancerWithProps<{
19
- animationStartTime: string | undefined;
20
- animationEndTime: string | undefined;
21
19
  timeStep: number;
22
20
  linkedMapAnimationInfo: {
23
21
  isAnimating: boolean;
@@ -28,7 +26,7 @@ declare const connectRedux: import("react-redux").InferableComponentEnhancerWith
28
26
  mapStopAnimation: import("@reduxjs/toolkit").ActionCreatorWithPayload<import("dist/libs/store/src/store/mapStore/types").SetMapAnimationStopPayload, "mapReducer/mapStopAnimation">;
29
27
  }, PlayButtonConnectProps>;
30
28
  type Props = PlayButtonConnectProps & ConnectedProps<typeof connectRedux>;
31
- export declare const PlayButtonConnect: import("react-redux").ConnectedComponent<({ mapId, animationStartTime, animationEndTime, isDisabled, timeStep, linkedMapAnimationInfo, mapStartAnimation, mapStopAnimation, }: Props) => import("react/jsx-runtime").JSX.Element, {
29
+ export declare const PlayButtonConnect: import("react-redux").ConnectedComponent<({ mapId, isDisabled, timeStep, linkedMapAnimationInfo, mapStartAnimation, mapStopAnimation, }: Props) => import("react/jsx-runtime").JSX.Element, {
32
30
  mapId: string;
33
31
  isDisabled?: boolean | undefined;
34
32
  isAnimating?: boolean | undefined;