@opengeoweb/webmap-react 9.34.0 → 9.35.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,9 +1,9 @@
1
- import { legendImageStore, WMImageEventType, webmapUtils, getLegendGraphicURLForLayer, getPixelCoordFromLatLong, WMJSMAP_LONLAT_EPSGCODE, getLatLongFromPixelCoord, LayerType, getWMJSMapById, debugLogger, DebugType, WMLayer, registerWMLayer, WMBBOX, getWMLayerById, WMJSMap, tilesettings } from '@opengeoweb/webmap';
1
+ import { legendImageStore, WMImageEventType, webmapUtils, getLegendGraphicURLForLayer, getPixelCoordFromLatLong, WMJSMAP_LONLAT_EPSGCODE, getLatLongFromPixelCoord, LayerType, getWMJSMapById, debugLogger, DebugType, WMLayer, registerWMLayer, tilesettings, WMBBOX, getWMLayerById, WMJSMap } from '@opengeoweb/webmap';
2
2
  export { WEBMAP_NAMESPACE, webmapTranslations } from '@opengeoweb/webmap';
3
3
  import { jsxs, jsx, Fragment } from 'react/jsx-runtime';
4
4
  import * as React from 'react';
5
5
  import React__default, { useRef, useState, useEffect } from 'react';
6
- import { CustomTooltip, CanvasComponent, ToolContainerDraggable, CustomIconButton, dateUtils, PROJECTION } from '@opengeoweb/shared';
6
+ import { CustomTooltip, CanvasComponent, useWheelStopPropagation, ToolContainerDraggable, CustomIconButton, dateUtils, PROJECTION } from '@opengeoweb/shared';
7
7
  import 'i18next';
8
8
  import { useTranslation } from 'react-i18next';
9
9
  import { Paper, Box, Typography, Grid2, TextField, FormControl, InputLabel, Select, MenuItem, Icon as Icon$1, FormLabel, Switch, styled, Slider } from '@mui/material';
@@ -981,6 +981,7 @@ var LegendDialog = function LegendDialog(_ref) {
981
981
  source = _ref$source === void 0 ? 'app' : _ref$source;
982
982
  var _useWebmapReactTransl = useWebmapReactTranslation(),
983
983
  t = _useWebmapReactTransl.t;
984
+ var stopWheelEventPropagationRef = useWheelStopPropagation();
984
985
  return jsx(ToolContainerDraggable, {
985
986
  startPosition: {
986
987
  right: 20,
@@ -1001,6 +1002,7 @@ var LegendDialog = function LegendDialog(_ref) {
1001
1002
  padding: 0.5
1002
1003
  },
1003
1004
  children: layers && layers.length > 0 ? jsx(Box, {
1005
+ ref: stopWheelEventPropagationRef,
1004
1006
  "data-testid": "LegendList",
1005
1007
  sx: {
1006
1008
  display: 'flex',
@@ -6939,6 +6941,7 @@ var ReactMapView = /*#__PURE__*/function (_React$Component) {
6939
6941
  _this.state = {
6940
6942
  adagucInitialised: false
6941
6943
  };
6944
+ _this.tileServerSettings = props.tileServerSettings || ReactMapView.defaultProps.tileServerSettings;
6942
6945
  _this.resize = _this.resize.bind(_this);
6943
6946
  _this.handleWindowResize = _this.handleWindowResize.bind(_this);
6944
6947
  _this.drawDebounced = debounce(_this.drawDebounced, 600);
@@ -7072,7 +7075,15 @@ var ReactMapView = /*#__PURE__*/function (_React$Component) {
7072
7075
  return;
7073
7076
  }
7074
7077
  var mapId = props.mapId,
7075
- children = props.children;
7078
+ children = props.children,
7079
+ isTimeScrollingEnabled = props.isTimeScrollingEnabled;
7080
+ if (isTimeScrollingEnabled) {
7081
+ var _wmjsMap = webmapUtils.getWMJSMapById(mapId);
7082
+ _wmjsMap === null || _wmjsMap === void 0 || _wmjsMap.detachWheelEvent();
7083
+ } else {
7084
+ var _wmjsMap2 = webmapUtils.getWMJSMapById(mapId);
7085
+ _wmjsMap2 === null || _wmjsMap2 === void 0 || _wmjsMap2.attachWheelEvent();
7086
+ }
7076
7087
  if (prevProps && prevProps.mapId !== props.mapId) {
7077
7088
  console.warn('MapId has changed on an already mounted map!');
7078
7089
  var prevWMJSMap = webmapUtils.getWMJSMapById(prevProps.mapId);
@@ -7319,7 +7330,7 @@ var ReactMapView = /*#__PURE__*/function (_React$Component) {
7319
7330
  if (srs) {
7320
7331
  wmjsMap.setProjection(srs, new WMBBOX(bbox));
7321
7332
  }
7322
- wmjsMap.setWMTileRendererTileSettings(tilesettings);
7333
+ wmjsMap.setWMTileRendererTileSettings(this.tileServerSettings || tilesettings);
7323
7334
  if (listeners) {
7324
7335
  listeners.forEach(function (listener) {
7325
7336
  wmjsMap.addListener(listener.name, function (data) {
@@ -7490,6 +7501,7 @@ ReactMapView.defaultProps = {
7490
7501
  shouldAutoFetch: true,
7491
7502
  displayMapPin: false,
7492
7503
  disableMapPin: false,
7504
+ tileServerSettings: tilesettings,
7493
7505
  onWMJSMount: function onWMJSMount() {},
7494
7506
  onWMJSUnMount: function onWMJSUnMount() {},
7495
7507
  onMapChangeDimension: function onMapChangeDimension() {
@@ -7760,7 +7772,7 @@ var drawLayerName = function drawLayerName(ctx, bbox, offsetX, offsetY, width, h
7760
7772
  // Re-enable the previousely disabled eslint rule
7761
7773
  /* eslint-enable no-param-reassign */
7762
7774
 
7763
- var _excluded$1 = ["children", "controls", "displayTimeInMap", "onWMJSMount"];
7775
+ var _excluded$1 = ["children", "controls", "displayTimeInMap", "onWMJSMount", "isTimeScrollingEnabled"];
7764
7776
  var MapView = function MapView(_ref) {
7765
7777
  var children = _ref.children,
7766
7778
  _ref$controls = _ref.controls,
@@ -7770,6 +7782,7 @@ var MapView = function MapView(_ref) {
7770
7782
  _ref$displayTimeInMap = _ref.displayTimeInMap,
7771
7783
  displayTimeInMap = _ref$displayTimeInMap === void 0 ? true : _ref$displayTimeInMap,
7772
7784
  _onWMJSMount = _ref.onWMJSMount,
7785
+ isTimeScrollingEnabled = _ref.isTimeScrollingEnabled,
7773
7786
  props = _objectWithoutProperties(_ref, _excluded$1);
7774
7787
  var dimensions = props.dimensions,
7775
7788
  mapIdProp = props.mapId;
@@ -7795,7 +7808,8 @@ var MapView = function MapView(_ref) {
7795
7808
  }
7796
7809
  }, [width, height]);
7797
7810
  var reactMapViewProps = _objectSpread2(_objectSpread2({}, props), {}, {
7798
- mapId: mapId
7811
+ mapId: mapId,
7812
+ isTimeScrollingEnabled: isTimeScrollingEnabled
7799
7813
  });
7800
7814
  return jsxs(Box, {
7801
7815
  ref: ref,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@opengeoweb/webmap-react",
3
- "version": "9.34.0",
3
+ "version": "9.35.0",
4
4
  "description": "GeoWeb react wrapper for webmap",
5
5
  "license": "Apache-2.0",
6
6
  "repository": {
@@ -4,5 +4,6 @@ export interface MapViewProps extends ReactMapViewProps {
4
4
  controls?: {
5
5
  zoomControls?: boolean;
6
6
  };
7
+ isTimeScrollingEnabled?: boolean;
7
8
  }
8
9
  export declare const MapView: React.FC<MapViewProps>;
@@ -1,6 +1,6 @@
1
1
  /// <reference types="node" />
2
2
  import * as React from 'react';
3
- import { IWMJSMap, WMLayer, WMBBOX } from '@opengeoweb/webmap';
3
+ import { IWMJSMap, WMLayer, WMBBOX, TileServerSettings } from '@opengeoweb/webmap';
4
4
  import { ReactMapViewProps } from './types';
5
5
  import type { MapViewLayerProps } from '../MapView';
6
6
  export declare const ORIGIN_REACTMAPVIEW_ONMAPCHANGEDIMENSION = "ORIGIN_REACTMAPVIEW_ONMAPCHANGEDIMENSION";
@@ -21,6 +21,7 @@ export declare class ReactMapView extends React.Component<ReactMapViewProps, Rea
21
21
  adaguc: AdagucObjectProp;
22
22
  adagucContainerRef: React.RefObject<HTMLDivElement>;
23
23
  adagucWebMapJSRef: React.RefObject<HTMLDivElement>;
24
+ tileServerSettings: TileServerSettings;
24
25
  refetchTimer: NodeJS.Timeout | number | null;
25
26
  lastRefetched: number | null;
26
27
  static defaultProps: {
@@ -34,6 +35,7 @@ export declare class ReactMapView extends React.Component<ReactMapViewProps, Rea
34
35
  shouldAutoFetch: boolean;
35
36
  displayMapPin: boolean;
36
37
  disableMapPin: boolean;
38
+ tileServerSettings: TileServerSettings;
37
39
  onWMJSMount: () => void;
38
40
  onWMJSUnMount: () => void;
39
41
  onMapChangeDimension: () => void;
@@ -1,5 +1,5 @@
1
1
  /// <reference types="react" />
2
- import { Bbox, Dimension, IWMJSMap } from '@opengeoweb/webmap';
2
+ import { Bbox, Dimension, IWMJSMap, TileServerSettings } from '@opengeoweb/webmap';
3
3
  import { TFunction } from 'i18next';
4
4
  export interface ReactMapViewProps {
5
5
  listeners?: {
@@ -8,6 +8,7 @@ export interface ReactMapViewProps {
8
8
  keep: boolean;
9
9
  callbackfunction: (webMap: IWMJSMap, value: string) => void;
10
10
  }[];
11
+ isTimeScrollingEnabled?: boolean;
11
12
  srs?: string;
12
13
  bbox?: Bbox;
13
14
  children?: React.ReactNode;
@@ -15,6 +16,7 @@ export interface ReactMapViewProps {
15
16
  activeLayerId?: string;
16
17
  showScaleBar?: boolean;
17
18
  showLegend?: boolean;
19
+ tileServerSettings?: TileServerSettings;
18
20
  passiveMap?: boolean;
19
21
  displayTimeInMap?: boolean;
20
22
  animationDelay?: number;