@opengeoweb/webmap-react 9.16.0 → 9.18.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,15 +1,15 @@
1
1
  import * as React from 'react';
2
2
  import React__default, { useRef, useState, useEffect } from 'react';
3
3
  import { legendImageStore, WMImageEventType, webmapUtils, getLegendGraphicURLForLayer, LayerType, getWMJSMapById, debugLogger, DebugType, WMLayer, registerWMLayer, WMBBOX, getWMLayerById, WMJSMap, tilesettings } from '@opengeoweb/webmap';
4
- import { CustomTooltip, CanvasComponent, ToolContainerDraggable, dateUtils, CustomIconButton } from '@opengeoweb/shared';
5
- import { useTranslation } from 'react-i18next';
6
- import 'i18next';
4
+ import { CustomTooltip, CanvasComponent, ToolContainerDraggable, CustomIconButton, dateUtils } from '@opengeoweb/shared';
5
+ import i18n from 'i18next';
6
+ import { initReactI18next, useTranslation } from 'react-i18next';
7
7
  import { Paper, Box, Typography, Grid, TextField, FormControl, InputLabel, Select, MenuItem, Icon as Icon$1, FormLabel, Switch, styled, Slider } from '@mui/material';
8
+ import { Home, Add, Minus, List, Delete, Edit, DrawRegion, DrawPolygon, Location, DrawFIRLand, ArrowUp, Equalizer, DimensionsElevation, Link, LinkOff, Info, DimensionsOther, DimensionsRefTime, DimensionsTime } from '@opengeoweb/theme';
8
9
  import _, { cloneDeep } from 'lodash';
9
10
  import proj4 from 'proj4';
10
11
  import * as turf from '@turf/turf';
11
12
  import { polygonToLineString, booleanClockwise, rewind } from '@turf/turf';
12
- import { Delete, Edit, DrawRegion, DrawPolygon, Location, DrawFIRLand, ArrowUp, Home, Add, Minus, Equalizer, DimensionsElevation, Link, LinkOff, Info, DimensionsOther, DimensionsRefTime, DimensionsTime } from '@opengeoweb/theme';
13
13
  import { produce } from 'immer';
14
14
  import { debounce } from 'throttle-debounce';
15
15
  import { useResizeDetector } from 'react-resize-detector';
@@ -24,19 +24,6 @@ var en = {
24
24
  "webmap-react-expires": "Expires:",
25
25
  "webmap-react-sender": "Sender:",
26
26
  "webmap-react-identifier": "Identifier:",
27
- "webmap-react-h5": "Query features along buffered line using WFS and CQL",
28
- "webmap-react-wfs": "WFS JSON URL:",
29
- "webmap-react-cql": "CQL expression:",
30
- "webmap-react-delete": "Delete",
31
- "webmap-react-feature-type": "Feature type",
32
- "webmap-react-feature-number": "Feature number",
33
- "webmap-react-intersection-shapes": "Intersection shapes",
34
- "webmap-react-features": "Features",
35
- "webmap-react-url": "URL:",
36
- "webmap-react-get-feature-info-result": "GetFeatureInfo result:",
37
- "webmap-react-view": "View",
38
- "webmap-react-edit": "Edit",
39
- "webmap-react-esc": "press ESC to exit draw mode",
40
27
  "webmap-react-no-layers": "No layers",
41
28
  "webmap-react-legend": "Legend",
42
29
  "webmap-react-title": "Title",
@@ -52,7 +39,7 @@ var en = {
52
39
  "webmap-react-zoom-in": "Zoom in",
53
40
  "webmap-react-zoom-out": "Zoom out",
54
41
  "webmap-react-show": "Show",
55
- "webmap-react-click-diconnect": "Click to disconnect layer",
42
+ "webmap-react-click-disconnect": "Click to disconnect layer",
56
43
  "webmap-react-click-connect": "Click to connect layer",
57
44
  "webmap-react-layer-info": "Layer Info"
58
45
  };
@@ -63,17 +50,6 @@ var fi = {
63
50
  "webmap-react-expires": "ei käännetty",
64
51
  "webmap-react-sender": "ei käännetty",
65
52
  "webmap-react-identifier": "ei käännetty",
66
- "webmap-react-h5": "ei käännetty",
67
- "webmap-react-wfs": "ei käännetty",
68
- "webmap-react-cql": "ei käännetty",
69
- "webmap-react-delete": "ei käännetty",
70
- "webmap-react-feature-type": "ei käännetty",
71
- "webmap-react-feature-number": "ei käännetty",
72
- "webmap-react-intersection-shapes": "ei käännetty",
73
- "webmap-react-get-feature-info-result": "ei käännetty",
74
- "webmap-react-view": "ei käännetty",
75
- "webmap-react-edit": "ei käännetty",
76
- "webmap-react-esc": "ei käännetty",
77
53
  "webmap-react-no-layers": "ei käännetty",
78
54
  "webmap-react-legend": "ei käännetty",
79
55
  "webmap-react-title": "ei käännetty",
@@ -89,83 +65,61 @@ var fi = {
89
65
  "webmap-react-zoom-in": "ei käännetty",
90
66
  "webmap-react-zoom-out": "ei käännetty",
91
67
  "webmap-react-show": "ei käännetty",
92
- "webmap-react-click-diconnect": "ei käännetty",
68
+ "webmap-react-click-disconnect": "ei käännetty",
93
69
  "webmap-react-click-connect": "ei käännetty",
94
70
  "webmap-react-layer-info": "ei käännetty"
95
71
  };
96
72
  var no = {
97
- "webmap-react-event": "event:",
73
+ "webmap-react-event": "hendelse:",
98
74
  "webmap-react-sent": "Sendt:",
99
75
  "webmap-react-utc": "UTC",
100
76
  "webmap-react-expires": "Utgår:",
101
77
  "webmap-react-sender": "Avsender:",
102
- "webmap-react-identifier": "ikke oversatt",
103
- "webmap-react-h5": "ikke oversatt",
104
- "webmap-react-wfs": "ikke oversatt",
105
- "webmap-react-cql": "ikke oversatt",
106
- "webmap-react-delete": "Slett",
107
- "webmap-react-feature-type": "Feature type",
108
- "webmap-react-feature-number": "Feature nummer",
109
- "webmap-react-intersection-shapes": "ikke oversatt",
110
- "webmap-react-get-feature-info-result": "GetFeatureInfo resultat:",
111
- "webmap-react-view": "View",
112
- "webmap-react-edit": "Endre",
113
- "webmap-react-esc": "trykk ESC for å avslutte tegnemodus",
78
+ "webmap-react-identifier": "Identifikator:",
114
79
  "webmap-react-no-layers": "Ingen lag",
115
80
  "webmap-react-legend": "Legende",
116
81
  "webmap-react-title": "Tittel",
117
82
  "webmap-react-name": "Navn",
118
83
  "webmap-react-service": "Service",
119
- "webmap-react-abstract": "Abstract",
84
+ "webmap-react-abstract": "Abstrakt",
120
85
  "webmap-react-dimensions": "Dimensjoner",
121
- "webmap-react-styles": "Styles",
122
- "webmap-react-bounding-box": "Bounding Box",
86
+ "webmap-react-styles": "Stiler",
87
+ "webmap-react-bounding-box": "Avgrensningsboks",
123
88
  "webmap-react-groups": "Grupper",
124
89
  "webmap-react-keywords": "Stikkord",
125
- "webmap-react-zoom-reset": "Reset zoom",
90
+ "webmap-react-zoom-reset": "Tilbakestill zoom",
126
91
  "webmap-react-zoom-in": "Zoom inn",
127
92
  "webmap-react-zoom-out": "Zoom ut",
128
93
  "webmap-react-show": "Vis",
129
- "webmap-react-click-diconnect": "Trykk for å avkoble lag",
94
+ "webmap-react-click-disconnect": "Trykk for å avkoble lag",
130
95
  "webmap-react-click-connect": "Trykk for å koble lag",
131
96
  "webmap-react-layer-info": "Laginformasjon"
132
97
  };
133
98
  var nl = {
134
- "webmap-react-event": "niet vertaald",
135
- "webmap-react-sent": "niet vertaald",
136
- "webmap-react-utc": "niet vertaald",
137
- "webmap-react-expires": "niet vertaald",
138
- "webmap-react-sender": "niet vertaald",
139
- "workspce-search": "niet vertaald",
140
- "webmap-react-h5": "niet vertaald",
141
- "webmap-react-wfs": "niet vertaald",
142
- "webmap-react-cql": "niet vertaald",
143
- "webmap-react-delete": "niet vertaald",
144
- "webmap-react-feature-type": "niet vertaald",
145
- "webmap-react-feature-number": "niet vertaald",
146
- "webmap-react-intersection-shapes": "niet vertaald",
147
- "webmap-react-get-feature-info-result": "niet vertaald",
148
- "webmap-react-view": "niet vertaald",
149
- "webmap-react-edit": "niet vertaald",
150
- "webmap-react-esc": "niet vertaald",
151
- "webmap-react-no-layers": "niet vertaald",
152
- "webmap-react-legend": "niet vertaald",
153
- "webmap-react-title": "niet vertaald",
154
- "webmap-react-name": "niet vertaald",
155
- "webmap-react-service": "niet vertaald",
156
- "webmap-react-abstract": "niet vertaald",
157
- "webmap-react-dimensions": "niet vertaald",
158
- "webmap-react-styles": "niet vertaald",
159
- "webmap-react-bounding-box": "niet vertaald",
160
- "webmap-react-groups": "niet vertaald",
161
- "webmap-react-keywords": "niet vertaald",
162
- "webmap-react-zoom-reset": "niet vertaald",
163
- "webmap-react-zoom-in": "niet vertaald",
164
- "webmap-react-zoom-out": "niet vertaald",
165
- "webmap-react-show": "niet vertaald",
166
- "webmap-react-click-diconnect": "niet vertaald",
167
- "webmap-react-click-connect": "niet vertaald",
168
- "webmap-react-layer-info": "niet vertaald"
99
+ "webmap-react-event": "event:",
100
+ "webmap-react-sent": "Verzonden:",
101
+ "webmap-react-utc": "UTC",
102
+ "webmap-react-expires": "Verloopt:",
103
+ "webmap-react-sender": "Afzender:",
104
+ "webmap-react-identifier": "Id:",
105
+ "webmap-react-no-layers": "Geen lagen",
106
+ "webmap-react-legend": "Legenda",
107
+ "webmap-react-title": "Titel",
108
+ "webmap-react-name": "Naam",
109
+ "webmap-react-service": "Service",
110
+ "webmap-react-abstract": "Abstract",
111
+ "webmap-react-dimensions": "Dimensies",
112
+ "webmap-react-styles": "Stijlen",
113
+ "webmap-react-bounding-box": "Begrenzend kader",
114
+ "webmap-react-groups": "Groepen",
115
+ "webmap-react-keywords": "Trefwoorden",
116
+ "webmap-react-zoom-reset": "Reset zoom",
117
+ "webmap-react-zoom-in": "Zoom in",
118
+ "webmap-react-zoom-out": "Zoom uit",
119
+ "webmap-react-show": "Open",
120
+ "webmap-react-click-disconnect": "Klik om laag los te koppelen",
121
+ "webmap-react-click-connect": "Klik om laag te koppelen",
122
+ "webmap-react-layer-info": "Laag Informatie"
169
123
  };
170
124
  var webmapReactTranslations = {
171
125
  en: en,
@@ -1721,24 +1675,6 @@ for (var COLLECTION_NAME in DOMIterables) {
1721
1675
 
1722
1676
  handlePrototype(DOMTokenListPrototype, 'DOMTokenList');
1723
1677
 
1724
- /* *
1725
- * Licensed under the Apache License, Version 2.0 (the "License");
1726
- * you may not use this file except in compliance with the License.
1727
- * You may obtain a copy of the License at
1728
- *
1729
- * http://www.apache.org/licenses/LICENSE-2.0
1730
- *
1731
- * Unless required by applicable law or agreed to in writing, software
1732
- * distributed under the License is distributed on an "AS IS" BASIS,
1733
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1734
- * See the License for the specific language governing permissions and
1735
- * limitations under the License.
1736
- *
1737
- * Copyright 2023 - Koninklijk Nederlands Meteorologisch Instituut (KNMI)
1738
- * Copyright 2023 - Finnish Meteorological Institute (FMI)
1739
- * */
1740
- const WEBMAP_REACT_NAMESPACE = 'webmapreact';
1741
-
1742
1678
  var DESCRIPTORS$4 = descriptors;
1743
1679
  var uncurryThis$f = functionUncurryThis;
1744
1680
  var call$d = functionCall;
@@ -1806,6 +1742,30 @@ $$h({ target: 'Object', stat: true, arity: 2, forced: Object.assign !== assign }
1806
1742
  assign: assign
1807
1743
  });
1808
1744
 
1745
+ const WEBMAP_REACT_NAMESPACE = 'webmapreact';
1746
+ i18n.use(initReactI18next).init({
1747
+ lng: 'en',
1748
+ ns: WEBMAP_REACT_NAMESPACE,
1749
+ interpolation: {
1750
+ escapeValue: false
1751
+ },
1752
+ resources: {
1753
+ en: {
1754
+ [WEBMAP_REACT_NAMESPACE]: webmapReactTranslations.en
1755
+ },
1756
+ fi: {
1757
+ [WEBMAP_REACT_NAMESPACE]: webmapReactTranslations.fi
1758
+ },
1759
+ no: {
1760
+ [WEBMAP_REACT_NAMESPACE]: webmapReactTranslations.no
1761
+ },
1762
+ nl: {
1763
+ [WEBMAP_REACT_NAMESPACE]: webmapReactTranslations.nl
1764
+ }
1765
+ }
1766
+ });
1767
+ const useWebmapReactTranslation = () => useTranslation(WEBMAP_REACT_NAMESPACE);
1768
+
1809
1769
  const LegendLayout = ({
1810
1770
  title,
1811
1771
  name,
@@ -1911,7 +1871,7 @@ const Legend = ({
1911
1871
  let imageHeight;
1912
1872
  const {
1913
1873
  t
1914
- } = useTranslation(WEBMAP_REACT_NAMESPACE);
1874
+ } = useWebmapReactTranslation();
1915
1875
  const legendPrefix = t('webmap-react-legend');
1916
1876
  /* Register callback to legendImagestore to trigger rerender when image is loaded. */
1917
1877
  useEffect(() => {
@@ -2020,7 +1980,7 @@ const LegendDialog = ({
2020
1980
  }) => {
2021
1981
  const {
2022
1982
  t
2023
- } = useTranslation(WEBMAP_REACT_NAMESPACE);
1983
+ } = useWebmapReactTranslation();
2024
1984
  return /*#__PURE__*/React.createElement(ToolContainerDraggable, {
2025
1985
  startPosition: {
2026
1986
  right: 20,
@@ -2062,6 +2022,166 @@ const LegendDialog = ({
2062
2022
  }, t('webmap-react-no-layers')))));
2063
2023
  };
2064
2024
 
2025
+ /******************************************************************************
2026
+ Copyright (c) Microsoft Corporation.
2027
+
2028
+ Permission to use, copy, modify, and/or distribute this software for any
2029
+ purpose with or without fee is hereby granted.
2030
+
2031
+ THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
2032
+ REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
2033
+ AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
2034
+ INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
2035
+ LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
2036
+ OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
2037
+ PERFORMANCE OF THIS SOFTWARE.
2038
+ ***************************************************************************** */
2039
+
2040
+ function __rest(s, e) {
2041
+ var t = {};
2042
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
2043
+ t[p] = s[p];
2044
+ if (s != null && typeof Object.getOwnPropertySymbols === "function")
2045
+ for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
2046
+ if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
2047
+ t[p[i]] = s[p[i]];
2048
+ }
2049
+ return t;
2050
+ }
2051
+
2052
+ function __awaiter(thisArg, _arguments, P, generator) {
2053
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
2054
+ return new (P || (P = Promise))(function (resolve, reject) {
2055
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
2056
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
2057
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
2058
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
2059
+ });
2060
+ }
2061
+
2062
+ typeof SuppressedError === "function" ? SuppressedError : function (error, suppressed, message) {
2063
+ var e = new Error(message);
2064
+ return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
2065
+ };
2066
+
2067
+ const MapControlButton = _a => {
2068
+ var {
2069
+ onClick,
2070
+ children,
2071
+ title,
2072
+ placement = 'right',
2073
+ isActive = false
2074
+ } = _a,
2075
+ props = __rest(_a, ["onClick", "children", "title", "placement", "isActive"]);
2076
+ return /*#__PURE__*/React.createElement(CustomIconButton, Object.assign({
2077
+ variant: "tool",
2078
+ tooltipProps: {
2079
+ placement,
2080
+ title
2081
+ },
2082
+ onClick: onClick,
2083
+ isSelected: isActive
2084
+ }, props), children);
2085
+ };
2086
+
2087
+ /* *
2088
+ * Licensed under the Apache License, Version 2.0 (the "License");
2089
+ * you may not use this file except in compliance with the License.
2090
+ * You may obtain a copy of the License at
2091
+ *
2092
+ * http://www.apache.org/licenses/LICENSE-2.0
2093
+ *
2094
+ * Unless required by applicable law or agreed to in writing, software
2095
+ * distributed under the License is distributed on an "AS IS" BASIS,
2096
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2097
+ * See the License for the specific language governing permissions and
2098
+ * limitations under the License.
2099
+ *
2100
+ * Copyright 2020 - Koninklijk Nederlands Meteorologisch Instituut (KNMI)
2101
+ * Copyright 2020 - Finnish Meteorological Institute (FMI)
2102
+ * */
2103
+ const ZoomControls = ({
2104
+ onZoomIn,
2105
+ onZoomOut,
2106
+ onZoomReset
2107
+ }) => {
2108
+ const {
2109
+ t
2110
+ } = useWebmapReactTranslation();
2111
+ return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(MapControlButton, {
2112
+ title: t('webmap-react-zoom-reset'),
2113
+ "data-testid": "zoom-reset",
2114
+ onClick: onZoomReset
2115
+ }, /*#__PURE__*/React.createElement(Home, null)), /*#__PURE__*/React.createElement(MapControlButton, {
2116
+ title: t('webmap-react-zoom-in'),
2117
+ "data-testid": "zoom-in",
2118
+ onClick: onZoomIn
2119
+ }, /*#__PURE__*/React.createElement(Add, null)), /*#__PURE__*/React.createElement(MapControlButton, {
2120
+ title: t('webmap-react-zoom-out'),
2121
+ "data-testid": "zoom-out",
2122
+ onClick: onZoomOut
2123
+ }, /*#__PURE__*/React.createElement(Minus, null)));
2124
+ };
2125
+
2126
+ const MapControls = _a => {
2127
+ var {
2128
+ children
2129
+ } = _a,
2130
+ props = __rest(_a, ["children"]);
2131
+ return /*#__PURE__*/React.createElement(Box, Object.assign({
2132
+ sx: {
2133
+ position: 'absolute',
2134
+ overflow: 'visible',
2135
+ display: 'block',
2136
+ left: 0,
2137
+ margin: 1,
2138
+ zIndex: 50,
2139
+ top: '96px',
2140
+ userSelect: 'none'
2141
+ }
2142
+ }, props), /*#__PURE__*/React.createElement(Grid, {
2143
+ sx: {
2144
+ '& > button': {
2145
+ marginBottom: 1
2146
+ }
2147
+ },
2148
+ container: true,
2149
+ direction: "column"
2150
+ }, children));
2151
+ };
2152
+
2153
+ /* *
2154
+ * Licensed under the Apache License, Version 2.0 (the "License");
2155
+ * you may not use this file except in compliance with the License.
2156
+ * You may obtain a copy of the License at
2157
+ *
2158
+ * http://www.apache.org/licenses/LICENSE-2.0
2159
+ *
2160
+ * Unless required by applicable law or agreed to in writing, software
2161
+ * distributed under the License is distributed on an "AS IS" BASIS,
2162
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2163
+ * See the License for the specific language governing permissions and
2164
+ * limitations under the License.
2165
+ *
2166
+ * Copyright 2024 - Koninklijk Nederlands Meteorologisch Instituut (KNMI)
2167
+ * Copyright 2024 - Finnish Meteorological Institute (FMI)
2168
+ * */
2169
+ const LegendButton = ({
2170
+ openLegendDialog,
2171
+ isOpen
2172
+ }) => {
2173
+ const {
2174
+ t
2175
+ } = useWebmapReactTranslation();
2176
+ const onClickButton = () => openLegendDialog();
2177
+ return /*#__PURE__*/React.createElement(MapControlButton, {
2178
+ title: t('webmap-react-legend'),
2179
+ "data-testid": "open-Legend",
2180
+ onClick: onClickButton,
2181
+ isActive: isOpen
2182
+ }, /*#__PURE__*/React.createElement(List, null));
2183
+ };
2184
+
2065
2185
  var wellKnownSymbol$a = wellKnownSymbol$h;
2066
2186
 
2067
2187
  var TO_STRING_TAG$1 = wellKnownSymbol$a('toStringTag');
@@ -4866,9 +4986,6 @@ const FeatureLayers = ({
4866
4986
  activeFeatureLayerIndex,
4867
4987
  getToolIcon
4868
4988
  }) => {
4869
- const {
4870
- t
4871
- } = useTranslation(WEBMAP_REACT_NAMESPACE);
4872
4989
  const featureLayerList = geojson ? Array.from(Array(geojson.features.length).keys()).map(index => {
4873
4990
  var _a;
4874
4991
  return {
@@ -4888,7 +5005,7 @@ const FeatureLayers = ({
4888
5005
  }
4889
5006
  }, /*#__PURE__*/React__default.createElement(InputLabel, {
4890
5007
  id: "demo-feature-number"
4891
- }, t('webmap-react-features')), /*#__PURE__*/React__default.createElement(Select, {
5008
+ }, "Features"), /*#__PURE__*/React__default.createElement(Select, {
4892
5009
  labelId: "demo-feature-type",
4893
5010
  value: (featureLayerList.length ? activeFeatureLayerIndex : '').toString(),
4894
5011
  onChange: event => {
@@ -4933,19 +5050,16 @@ const EditModeButton = ({
4933
5050
  drawMode,
4934
5051
  onToggleEditMode
4935
5052
  }) => {
4936
- const {
4937
- t
4938
- } = useTranslation(WEBMAP_REACT_NAMESPACE);
4939
5053
  return /*#__PURE__*/React__default.createElement(Grid, {
4940
5054
  item: true,
4941
5055
  xs: 12
4942
5056
  }, /*#__PURE__*/React__default.createElement(CustomTooltip, {
4943
5057
  title: "Switch mode"
4944
- }, /*#__PURE__*/React__default.createElement("span", null, /*#__PURE__*/React__default.createElement(FormLabel, null, t('webmap-react-view')), /*#__PURE__*/React__default.createElement(Switch, {
5058
+ }, /*#__PURE__*/React__default.createElement("span", null, /*#__PURE__*/React__default.createElement(FormLabel, null, "View"), /*#__PURE__*/React__default.createElement(Switch, {
4945
5059
  "data-testid": "switchMode",
4946
5060
  checked: isInEditMode,
4947
5061
  onClick: () => onToggleEditMode(!isInEditMode)
4948
- }), /*#__PURE__*/React__default.createElement(FormLabel, null, t('webmap-react-edit')), drawMode && ( /*#__PURE__*/React__default.createElement(Typography, {
5062
+ }), /*#__PURE__*/React__default.createElement(FormLabel, null, "Edit"), drawMode && ( /*#__PURE__*/React__default.createElement(Typography, {
4949
5063
  component: "span",
4950
5064
  sx: {
4951
5065
  display: 'inline-block',
@@ -4954,7 +5068,7 @@ const EditModeButton = ({
4954
5068
  position: 'relative',
4955
5069
  fontSize: 14
4956
5070
  }
4957
- }, t('webmap-react-esc'))))));
5071
+ }, "press ESC to exit draw mode")))));
4958
5072
  };
4959
5073
 
4960
5074
  /* *
@@ -5460,9 +5574,6 @@ const IntersectionSelect = ({
5460
5574
  isDisabled: _isDisabled = false
5461
5575
  }) => {
5462
5576
  const [activeIntersection, setActiveIntersection] = React__default.useState(0);
5463
- const {
5464
- t
5465
- } = useTranslation(WEBMAP_REACT_NAMESPACE);
5466
5577
  return /*#__PURE__*/React__default.createElement(Grid, {
5467
5578
  item: true,
5468
5579
  sm: 12
@@ -5473,7 +5584,7 @@ const IntersectionSelect = ({
5473
5584
  }
5474
5585
  }, /*#__PURE__*/React__default.createElement(InputLabel, {
5475
5586
  id: "demo-intersection"
5476
- }, t('webmap-react-intersection-shapes')), /*#__PURE__*/React__default.createElement(Select, {
5587
+ }, "Intersection shapes"), /*#__PURE__*/React__default.createElement(Select, {
5477
5588
  labelId: "demo-intersection",
5478
5589
  value: activeIntersection.toString(),
5479
5590
  onChange: event => {
@@ -6558,48 +6669,6 @@ const ReactMapViewLayer = props => {
6558
6669
  }, /*#__PURE__*/React.createElement("div", null, id));
6559
6670
  };
6560
6671
 
6561
- /******************************************************************************
6562
- Copyright (c) Microsoft Corporation.
6563
-
6564
- Permission to use, copy, modify, and/or distribute this software for any
6565
- purpose with or without fee is hereby granted.
6566
-
6567
- THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
6568
- REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
6569
- AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
6570
- INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
6571
- LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
6572
- OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
6573
- PERFORMANCE OF THIS SOFTWARE.
6574
- ***************************************************************************** */
6575
-
6576
- function __rest(s, e) {
6577
- var t = {};
6578
- for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
6579
- t[p] = s[p];
6580
- if (s != null && typeof Object.getOwnPropertySymbols === "function")
6581
- for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
6582
- if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
6583
- t[p[i]] = s[p[i]];
6584
- }
6585
- return t;
6586
- }
6587
-
6588
- function __awaiter(thisArg, _arguments, P, generator) {
6589
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
6590
- return new (P || (P = Promise))(function (resolve, reject) {
6591
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6592
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
6593
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
6594
- step((generator = generator.apply(thisArg, _arguments || [])).next());
6595
- });
6596
- }
6597
-
6598
- typeof SuppressedError === "function" ? SuppressedError : function (error, suppressed, message) {
6599
- var e = new Error(message);
6600
- return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
6601
- };
6602
-
6603
6672
  var defineProperty$1 = objectDefineProperty.f;
6604
6673
 
6605
6674
  var proxyAccessor$1 = function (Target, Source, key) {
@@ -8927,92 +8996,6 @@ ReactMapView.defaultProps = {
8927
8996
  }
8928
8997
  };
8929
8998
 
8930
- const MapControlButton = _a => {
8931
- var {
8932
- onClick,
8933
- children,
8934
- title,
8935
- placement = 'right',
8936
- isActive = false
8937
- } = _a,
8938
- props = __rest(_a, ["onClick", "children", "title", "placement", "isActive"]);
8939
- return /*#__PURE__*/React.createElement(CustomIconButton, Object.assign({
8940
- variant: "tool",
8941
- tooltipProps: {
8942
- placement,
8943
- title
8944
- },
8945
- onClick: onClick,
8946
- isSelected: isActive
8947
- }, props), children);
8948
- };
8949
-
8950
- /* *
8951
- * Licensed under the Apache License, Version 2.0 (the "License");
8952
- * you may not use this file except in compliance with the License.
8953
- * You may obtain a copy of the License at
8954
- *
8955
- * http://www.apache.org/licenses/LICENSE-2.0
8956
- *
8957
- * Unless required by applicable law or agreed to in writing, software
8958
- * distributed under the License is distributed on an "AS IS" BASIS,
8959
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
8960
- * See the License for the specific language governing permissions and
8961
- * limitations under the License.
8962
- *
8963
- * Copyright 2020 - Koninklijk Nederlands Meteorologisch Instituut (KNMI)
8964
- * Copyright 2020 - Finnish Meteorological Institute (FMI)
8965
- * */
8966
- const ZoomControls = ({
8967
- onZoomIn,
8968
- onZoomOut,
8969
- onZoomReset
8970
- }) => {
8971
- const {
8972
- t
8973
- } = useTranslation(WEBMAP_REACT_NAMESPACE);
8974
- return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(MapControlButton, {
8975
- title: t('webmap-react-zoom-reset'),
8976
- "data-testid": "zoom-reset",
8977
- onClick: onZoomReset
8978
- }, /*#__PURE__*/React.createElement(Home, null)), /*#__PURE__*/React.createElement(MapControlButton, {
8979
- title: t('webmap-react-zoom-in'),
8980
- "data-testid": "zoom-in",
8981
- onClick: onZoomIn
8982
- }, /*#__PURE__*/React.createElement(Add, null)), /*#__PURE__*/React.createElement(MapControlButton, {
8983
- title: t('webmap-react-zoom-out'),
8984
- "data-testid": "zoom-out",
8985
- onClick: onZoomOut
8986
- }, /*#__PURE__*/React.createElement(Minus, null)));
8987
- };
8988
-
8989
- const MapControls = _a => {
8990
- var {
8991
- children
8992
- } = _a,
8993
- props = __rest(_a, ["children"]);
8994
- return /*#__PURE__*/React.createElement(Box, Object.assign({
8995
- sx: {
8996
- position: 'absolute',
8997
- overflow: 'visible',
8998
- display: 'block',
8999
- left: 0,
9000
- margin: 1,
9001
- zIndex: 50,
9002
- top: '96px',
9003
- userSelect: 'none'
9004
- }
9005
- }, props), /*#__PURE__*/React.createElement(Grid, {
9006
- sx: {
9007
- '& > button': {
9008
- marginBottom: 1
9009
- }
9010
- },
9011
- container: true,
9012
- direction: "column"
9013
- }, children));
9014
- };
9015
-
9016
8999
  /* *
9017
9000
  * Licensed under the Apache License, Version 2.0 (the "License");
9018
9001
  * you may not use this file except in compliance with the License.
@@ -9418,7 +9401,7 @@ const MapWarningProperties = ({
9418
9401
  const newWidth = parentSize ? parentSize - 100 : 350;
9419
9402
  const {
9420
9403
  t
9421
- } = useTranslation(WEBMAP_REACT_NAMESPACE);
9404
+ } = useWebmapReactTranslation();
9422
9405
  return /*#__PURE__*/React__default.createElement("div", {
9423
9406
  style: {
9424
9407
  position: 'fixed',
@@ -9445,9 +9428,9 @@ const MapWarningProperties = ({
9445
9428
  "data-testid": "map-warning-properties-row"
9446
9429
  }, t('webmap-react-event'), ' ', selectedFeatureProperties.languages && selectedFeatureProperties.languages[language].event)), selectedFeatureProperties.onset && ( /*#__PURE__*/React__default.createElement("pre", {
9447
9430
  "data-testid": "map-warning-properties-row"
9448
- }, t('webmap-react-sent'), ' ', dateUtils.dateToString(dateUtils.utc(selectedFeatureProperties.onset), 'dd MMM yyyy, HH:mm'), ' ', t('webmap-react-utc'))), selectedFeatureProperties.expires && ( /*#__PURE__*/React__default.createElement("pre", {
9431
+ }, t('webmap-react-sent'), ' ', dateUtils.dateToString(dateUtils.utc(selectedFeatureProperties.onset), dateUtils.DATE_FORMAT_NAME_OF_MONTH), ' ', t('webmap-react-utc'))), selectedFeatureProperties.expires && ( /*#__PURE__*/React__default.createElement("pre", {
9449
9432
  "data-testid": "map-warning-properties-row"
9450
- }, t('webmap-react-expires'), ' ', dateUtils.dateToString(dateUtils.utc(selectedFeatureProperties.expires), 'dd MMM yyyy, HH:mm'), ' ', t('webmap-react-utc'))), selectedFeatureProperties.languages && selectedFeatureProperties.languages[language].senderName && ( /*#__PURE__*/React__default.createElement("pre", {
9433
+ }, t('webmap-react-expires'), ' ', dateUtils.dateToString(dateUtils.utc(selectedFeatureProperties.expires), dateUtils.DATE_FORMAT_NAME_OF_MONTH), ' ', t('webmap-react-utc'))), selectedFeatureProperties.languages && selectedFeatureProperties.languages[language].senderName && ( /*#__PURE__*/React__default.createElement("pre", {
9451
9434
  "data-testid": "map-warning-properties-row"
9452
9435
  }, t('webmap-react-sender'), ' ', selectedFeatureProperties.languages && selectedFeatureProperties.languages[language].senderName)), selectedFeatureProperties.identifier && ( /*#__PURE__*/React__default.createElement("pre", {
9453
9436
  "data-testid": "map-warning-properties-row"
@@ -9526,7 +9509,7 @@ const DimensionSelectButton = ({
9526
9509
  }) => {
9527
9510
  const {
9528
9511
  t
9529
- } = useTranslation(WEBMAP_REACT_NAMESPACE);
9512
+ } = useWebmapReactTranslation();
9530
9513
  const showPrefix = t('webmap-react-show');
9531
9514
  const dimConfig = dimensionConfig.find(cnf => cnf.name === dimension);
9532
9515
  const Icon = getDimensionIcon$1(dimConfig && dimConfig.iconType || 'IconLevels');
@@ -9717,7 +9700,7 @@ const MapDimensionSelect = ({
9717
9700
  // eslint-disable-next-line react-hooks/rules-of-hooks
9718
9701
  const {
9719
9702
  t
9720
- } = useTranslation(WEBMAP_REACT_NAMESPACE);
9703
+ } = useWebmapReactTranslation();
9721
9704
  const tooltipTitle = isLayerDimensionSynced ? t('webmap-react-click-disconnect') : t('webmap-react-click-connect');
9722
9705
  return /*#__PURE__*/React.createElement(Grid, {
9723
9706
  key: layerId,
@@ -9850,7 +9833,7 @@ const LayerInfoLegend = ({
9850
9833
  }) => {
9851
9834
  const {
9852
9835
  t
9853
- } = useTranslation(WEBMAP_REACT_NAMESPACE);
9836
+ } = useWebmapReactTranslation();
9854
9837
  return /*#__PURE__*/React__default.createElement(React__default.Fragment, null, /*#__PURE__*/React__default.createElement(Typography$1, {
9855
9838
  variant: "subtitle2",
9856
9839
  sx: textStyleWithMargin
@@ -10403,7 +10386,7 @@ const LayerInfoDialog = ({
10403
10386
  const dimensions = getDimensionsList(layer.dimensions);
10404
10387
  const {
10405
10388
  t
10406
- } = useTranslation(WEBMAP_REACT_NAMESPACE);
10389
+ } = useWebmapReactTranslation();
10407
10390
  return /*#__PURE__*/React__default.createElement(ToolContainerDraggable, {
10408
10391
  onClose: onClose,
10409
10392
  startSize: {
@@ -10442,9 +10425,7 @@ const LayerInfoDialog = ({
10442
10425
  label: t('webmap-react-styles'),
10443
10426
  value: styles
10444
10427
  }), /*#__PURE__*/React__default.createElement(LayerInfoText, {
10445
- label: t('webmap-react-bounding-box', {
10446
- ns: WEBMAP_REACT_NAMESPACE
10447
- }),
10428
+ label: t('webmap-react-bounding-box'),
10448
10429
  value: bbox
10449
10430
  }), /*#__PURE__*/React__default.createElement(LayerInfoText, {
10450
10431
  label: t('webmap-react-groups'),
@@ -11020,4 +11001,4 @@ var publicLayers = /*#__PURE__*/Object.freeze({
11020
11001
  msgNaturalEUMETSAT: msgNaturalEUMETSAT
11021
11002
  });
11022
11003
 
11023
- export { DRAWMODE, DimensionSelectButton, DimensionSelectDialog, DimensionSelectSlider, EDITMODE, EditModeButton as EditModeButtonField, FeatureLayers, GeoJSONTextField, IntersectionSelect, LayerInfoButton, LayerInfoDialog, LayerInfoLegend, LayerInfoList, LayerInfoText, Legend, LegendDialog, LegendLayout, MINUTE_TO_MILLISECOND, MapControlButton, MapControls, MapDimensionSelect, MapDrawContainer, MapTime, MapView, MapViewLayer, MapWarningProperties, NEW_FEATURE_CREATED, NEW_LINESTRING_CREATED, NEW_POINT_CREATED, ORIGIN_REACTMAPVIEW_ONMAPCHANGEDIMENSION, ORIGIN_REACTMAPVIEW_ONUPDATELAYERINFO, ReactMapView, ReactMapViewLayer, SelectField, StoryLayoutGrid, WEBMAP_REACT_NAMESPACE, ZoomControls, addFeatureProperties, addGeoJSONProperties, addSelectionTypeToGeoJSON, addWMLayerPropsBasedOnChildProps, basicExampleDrawOptions, basicExampleMultipleShapeDrawOptions, basicExampleMultipleShapeWithValuesDrawOptions, checkHoverFeatures, createInterSections, currentlySupportedDrawModes, defaultBox, defaultDelete, defaultGeoJSONStyleProperties, defaultIntersectionStyleProperties, defaultLayers, defaultModes, defaultPoint, defaultPolygon, defaultTimeFormat, dimensionConfig, distance, drawPolyStoryStyles, emptyGeoJSON, endToolExampleConfig, exampleIntersectionOptions, exampleIntersectionWithShapeOptions, exampleIntersections, exampleIntersectionsMultiDrawTool, featureBox, featureMultiPoint, featurePoint, featurePolygon, fillOptions, firSelectionType, formatTime, getCurrentDimensionValue, getDimensionIcon, getDimensionLabel, getDimensionValue, getDimensionsList, getDoubleControlToolIcon, getDrawFunctionFromStore, getFeatureCollection, getFeatureExtent, getFeatureLayers, getFirTitle, getGeoJSONPropertyValue, getGeoJson, getIcon, getIntersectionToolIcon, getIsInsideAcceptanceTime, getLastEmptyFeatureIndex, getLayerBbox, getLayerStyles, getLayerUpdateInfo, getTimeDimension, getToolIcon, intersectPointGeoJSONS, intersectPolygonGeoJSONS, intersectionFeatureBE, intersectionFeatureNL, isAGeoJSONLayer, isAMapLayer, isGeoJSONFeatureCreatedByTool, isPointFeatureCollection, lineString, makeLayerPropListFromChildren, marksByDimension, moveFeature, opacityOptions, orderLayers, parseWMJSLayer, publicLayers, publicServices, registerDrawFunction, removeWMLayerFromMap, rewindGeometry, setWMLayerPropsBasedOnChildProps, simpleBoxGeoJSON, simpleBoxGeoJSONWrongOrder, simpleFlightRouteLineStringGeoJSON, simpleFlightRoutePointsGeoJSON, simpleLineStringGeoJSON, simpleMultiPolygon, simplePointsGeojson, simplePolygonGeoJSON, simpleSmallLineStringGeoJSON, startToolExampleConfig, strokeWidthOptions, textStyle, textStyleWithMargin, updateEditModeButtonsWithFir, useGeoJSON, useMapDrawTool, webmapReactTranslations };
11004
+ export { DRAWMODE, DimensionSelectButton, DimensionSelectDialog, DimensionSelectSlider, EDITMODE, EditModeButton as EditModeButtonField, FeatureLayers, GeoJSONTextField, IntersectionSelect, LayerInfoButton, LayerInfoDialog, LayerInfoLegend, LayerInfoList, LayerInfoText, Legend, LegendButton, LegendDialog, LegendLayout, MINUTE_TO_MILLISECOND, MapControlButton, MapControls, MapDimensionSelect, MapDrawContainer, MapTime, MapView, MapViewLayer, MapWarningProperties, NEW_FEATURE_CREATED, NEW_LINESTRING_CREATED, NEW_POINT_CREATED, ORIGIN_REACTMAPVIEW_ONMAPCHANGEDIMENSION, ORIGIN_REACTMAPVIEW_ONUPDATELAYERINFO, ReactMapView, ReactMapViewLayer, SelectField, StoryLayoutGrid, WEBMAP_REACT_NAMESPACE, ZoomControls, addFeatureProperties, addGeoJSONProperties, addSelectionTypeToGeoJSON, addWMLayerPropsBasedOnChildProps, basicExampleDrawOptions, basicExampleMultipleShapeDrawOptions, basicExampleMultipleShapeWithValuesDrawOptions, checkHoverFeatures, createInterSections, currentlySupportedDrawModes, defaultBox, defaultDelete, defaultGeoJSONStyleProperties, defaultIntersectionStyleProperties, defaultLayers, defaultModes, defaultPoint, defaultPolygon, defaultTimeFormat, dimensionConfig, distance, drawPolyStoryStyles, emptyGeoJSON, endToolExampleConfig, exampleIntersectionOptions, exampleIntersectionWithShapeOptions, exampleIntersections, exampleIntersectionsMultiDrawTool, featureBox, featureMultiPoint, featurePoint, featurePolygon, fillOptions, firSelectionType, formatTime, getCurrentDimensionValue, getDimensionIcon, getDimensionLabel, getDimensionValue, getDimensionsList, getDoubleControlToolIcon, getDrawFunctionFromStore, getFeatureCollection, getFeatureExtent, getFeatureLayers, getFirTitle, getGeoJSONPropertyValue, getGeoJson, getIcon, getIntersectionToolIcon, getIsInsideAcceptanceTime, getLastEmptyFeatureIndex, getLayerBbox, getLayerStyles, getLayerUpdateInfo, getTimeDimension, getToolIcon, intersectPointGeoJSONS, intersectPolygonGeoJSONS, intersectionFeatureBE, intersectionFeatureNL, isAGeoJSONLayer, isAMapLayer, isGeoJSONFeatureCreatedByTool, isPointFeatureCollection, lineString, makeLayerPropListFromChildren, marksByDimension, moveFeature, opacityOptions, orderLayers, parseWMJSLayer, publicLayers, publicServices, registerDrawFunction, removeWMLayerFromMap, rewindGeometry, setWMLayerPropsBasedOnChildProps, simpleBoxGeoJSON, simpleBoxGeoJSONWrongOrder, simpleFlightRouteLineStringGeoJSON, simpleFlightRoutePointsGeoJSON, simpleLineStringGeoJSON, simpleMultiPolygon, simplePointsGeojson, simplePolygonGeoJSON, simpleSmallLineStringGeoJSON, startToolExampleConfig, strokeWidthOptions, textStyle, textStyleWithMargin, updateEditModeButtonsWithFir, useGeoJSON, useMapDrawTool, webmapReactTranslations };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@opengeoweb/webmap-react",
3
- "version": "9.16.0",
3
+ "version": "9.18.0",
4
4
  "description": "GeoWeb react wrapper for webmap",
5
5
  "license": "Apache-2.0",
6
6
  "repository": {
@@ -5,7 +5,7 @@ declare const _default: {
5
5
  export default _default;
6
6
  export declare const LayerInfoDialogLight: {
7
7
  (): React.ReactElement;
8
- storyName: string;
8
+ tags: string[];
9
9
  parameters: {
10
10
  zeplinLink: {
11
11
  name: string;
@@ -15,7 +15,7 @@ export declare const LayerInfoDialogLight: {
15
15
  };
16
16
  export declare const LayerInfoDialogDark: {
17
17
  (): React.ReactElement;
18
- storyName: string;
18
+ tags: string[];
19
19
  parameters: {
20
20
  zeplinLink: {
21
21
  name: string;
@@ -0,0 +1,5 @@
1
+ import * as React from 'react';
2
+ export declare const LegendButton: React.FC<{
3
+ openLegendDialog: () => void;
4
+ isOpen: boolean;
5
+ }>;
@@ -1,3 +1,4 @@
1
1
  export * from './Legend';
2
2
  export * from './LegendLayout';
3
3
  export * from './LegendDialog';
4
+ export * from './LegendButton';
@@ -5,25 +5,25 @@ declare const _default: {
5
5
  export default _default;
6
6
  export declare const DimensionSelectElevationLight: {
7
7
  (): React.ReactElement;
8
- storyName: string;
8
+ tags: string[];
9
9
  };
10
10
  export declare const DimensionSelectElevationDark: {
11
11
  (): React.ReactElement;
12
- storyName: string;
12
+ tags: string[];
13
13
  };
14
14
  export declare const DimensionSelectEnsembleMemberLight: {
15
15
  (): React.ReactElement;
16
- storyName: string;
16
+ tags: string[];
17
17
  };
18
18
  export declare const DimensionSelectEnsembleMemberDark: {
19
19
  (): React.ReactElement;
20
- storyName: string;
20
+ tags: string[];
21
21
  };
22
22
  export declare const DimensionSelectInvalidSyncLight: {
23
23
  (): React.ReactElement;
24
- storyName: string;
24
+ tags: string[];
25
25
  };
26
26
  export declare const DimensionSelectInvalidSyncDark: {
27
27
  (): React.ReactElement;
28
- storyName: string;
28
+ tags: string[];
29
29
  };
@@ -1,2 +1,6 @@
1
+ import i18n from 'i18next';
2
+ import { UseTranslationResponse } from 'react-i18next';
1
3
  export declare const WEBMAP_REACT_NAMESPACE = "webmapreact";
2
- export declare const initWebmapReactTestI18n: () => void;
4
+ export declare const translateKeyOutsideComponents: (key: string, params?: Record<string, string | number> | undefined) => string;
5
+ export declare const useWebmapReactTranslation: () => UseTranslationResponse<typeof WEBMAP_REACT_NAMESPACE, typeof i18n>;
6
+ export { i18n };