@opengeoweb/webmap-react 15.3.0 → 16.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/index.esm.js +266 -137
- package/package.json +4 -4
- package/src/lib/components/Clock/Clock.d.ts +5 -2
- package/src/lib/components/Clock/ClockContainer.d.ts +5 -9
- package/src/lib/components/LayerInfo/LayerInfoDialog.d.ts +2 -0
- package/src/lib/components/LayerInfo/LayerInfoLegend.d.ts +2 -3
- package/src/lib/components/Legend/Legend.d.ts +1 -0
- package/src/lib/components/Legend/LegendDialog.d.ts +1 -0
- package/src/lib/components/Legend/LegendLayout.d.ts +2 -4
package/index.esm.js
CHANGED
|
@@ -11,14 +11,14 @@ import ImageWrapper, { load } from 'ol/Image';
|
|
|
11
11
|
import { getImageSrc, getRequestParams, createLoader } from 'ol/source/wms';
|
|
12
12
|
import { jsxs, jsx, Fragment } from 'react/jsx-runtime';
|
|
13
13
|
import { CustomTooltip, CanvasComponent, useWheelStopPropagation, ToolContainerDraggable, CustomIconButton, dateUtils, useMakeSureContainerStaysInsideWindow, Draggable, Resizable } from '@opengeoweb/shared';
|
|
14
|
-
import {
|
|
14
|
+
import { useTheme, Card, Box, Typography, Grid, styled, Slider, FormGroup, FormControlLabel, Checkbox, TextField, FormControl, InputLabel, Select, MenuItem, Icon as Icon$2, FormLabel, Switch, Paper, ThemeProvider } from '@mui/material';
|
|
15
|
+
import { Visibility, VisibilityOff, arrowUpPath, Home, Add, Minus, List, Equalizer, DimensionsElevation, Link, LinkOff, Info, DimensionsOther, DimensionsRefTime, DimensionsTime, locationPath, rotatePath, Location, DrawToolSmoothLine, DrawToolFreehand, DrawToolOval, DrawToolCircle, DrawToolSquare, Delete, DrawToolLineString, DrawToolRectangle, DrawToolPolygon, DrawToolPoint, DrawFIRLand, ArrowUp, darkTheme, ChevronRight, Options, Clock as Clock$1 } from '@opengeoweb/theme';
|
|
16
|
+
import 'i18next';
|
|
17
|
+
import { useTranslation } from 'react-i18next';
|
|
15
18
|
import { queryOptions, useQuery } from '@tanstack/react-query';
|
|
16
19
|
import { Point, MultiPoint, LineString, Polygon } from 'ol/geom';
|
|
17
20
|
import { Style, Icon as Icon$1, Circle, Stroke, Fill, Text } from 'ol/style';
|
|
18
|
-
import { arrowUpPath, Home, Add, Minus, List, Equalizer, DimensionsElevation, Link, LinkOff, Info, DimensionsOther, DimensionsRefTime, DimensionsTime, locationPath, rotatePath, Location, DrawToolSmoothLine, DrawToolFreehand, DrawToolOval, DrawToolCircle, DrawToolSquare, Delete, DrawToolLineString, DrawToolRectangle, DrawToolPolygon, DrawToolPoint, DrawFIRLand, ArrowUp, darkTheme, ChevronRight, Clock as Clock$1, Resize } from '@opengeoweb/theme';
|
|
19
21
|
import { http, HttpResponse } from 'msw';
|
|
20
|
-
import 'i18next';
|
|
21
|
-
import { useTranslation } from 'react-i18next';
|
|
22
22
|
import Box$1 from '@mui/material/Box';
|
|
23
23
|
import Typography$1 from '@mui/material/Typography';
|
|
24
24
|
import { View, Map, Feature, Collection, Overlay } from 'ol';
|
|
@@ -103,7 +103,11 @@ var en = {
|
|
|
103
103
|
"webmap-react-legend-no-image": "No legend graphic available",
|
|
104
104
|
"webmap-react-map-measure-help-tooltip": "Click to measure",
|
|
105
105
|
"clock-show": "Show clock",
|
|
106
|
-
"clock-hide": "Hide clock"
|
|
106
|
+
"clock-hide": "Hide clock",
|
|
107
|
+
"clock-animation-options": "Animation options",
|
|
108
|
+
"webmap-react-show-layer-legend": "Show layer legend",
|
|
109
|
+
"webmap-react-show-layer": "Show layer in legend",
|
|
110
|
+
"webmap-react-hide-layer": "Hide layer in legend"
|
|
107
111
|
};
|
|
108
112
|
var fi = {
|
|
109
113
|
"webmap-react-event": "tapahtuma:",
|
|
@@ -152,7 +156,11 @@ var fi = {
|
|
|
152
156
|
"webmap-react-linestring": "Viivajono",
|
|
153
157
|
"webmap-react-delete": "Poista",
|
|
154
158
|
"clock-show": "Näytä kello",
|
|
155
|
-
"clock-hide": "Piilota kello"
|
|
159
|
+
"clock-hide": "Piilota kello",
|
|
160
|
+
"clock-animation-options": "Animoinnin asetukset",
|
|
161
|
+
"webmap-react-show-layer-legend": "Näytä karttatason selite",
|
|
162
|
+
"webmap-react-show-layer": "Näytä karttataso selitteessä",
|
|
163
|
+
"webmap-react-hide-layer": "Piilota karttataso selitteestä"
|
|
156
164
|
};
|
|
157
165
|
var no = {
|
|
158
166
|
"webmap-react-event": "hendelse:",
|
|
@@ -201,7 +209,11 @@ var no = {
|
|
|
201
209
|
"webmap-react-linestring": "Linje",
|
|
202
210
|
"webmap-react-delete": "Fjerne",
|
|
203
211
|
"clock-show": "Vis klokke",
|
|
204
|
-
"clock-hide": "Skjul klokke"
|
|
212
|
+
"clock-hide": "Skjul klokke",
|
|
213
|
+
"clock-animation-options": "Animasjonsinnstillinger",
|
|
214
|
+
"webmap-react-show-layer-legend": "Vis",
|
|
215
|
+
"webmap-react-show-layer": "Vis laget i tegnforklaringen",
|
|
216
|
+
"webmap-react-hide-layer": "Skjul laget i tegnforklaringen"
|
|
205
217
|
};
|
|
206
218
|
var nl = {
|
|
207
219
|
"webmap-react-event": "event:",
|
|
@@ -258,7 +270,11 @@ var nl = {
|
|
|
258
270
|
"webmap-react-legend-no-image": "Geen legenda beschikbaar",
|
|
259
271
|
"webmap-react-map-measure-help-tooltip": "Klik om te meten",
|
|
260
272
|
"clock-show": "Klok tonen",
|
|
261
|
-
"clock-hide": "Klok verbergen"
|
|
273
|
+
"clock-hide": "Klok verbergen",
|
|
274
|
+
"clock-animation-options": "Animatie opties",
|
|
275
|
+
"webmap-react-show-layer-legend": "Toon laag in legenda",
|
|
276
|
+
"webmap-react-show-layer": "Toon laag in legenda",
|
|
277
|
+
"webmap-react-hide-layer": "Verberg laag in legenda"
|
|
262
278
|
};
|
|
263
279
|
var webmapReactTranslations = {
|
|
264
280
|
en: en,
|
|
@@ -1549,25 +1565,92 @@ var TimeawareImageSource = /*#__PURE__*/function (_ImageSource) {
|
|
|
1549
1565
|
}]);
|
|
1550
1566
|
}(ImageSource);
|
|
1551
1567
|
|
|
1568
|
+
var WEBMAP_REACT_NAMESPACE = 'webmapreact';
|
|
1569
|
+
var useWebmapReactTranslation = function useWebmapReactTranslation() {
|
|
1570
|
+
var ns = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : WEBMAP_REACT_NAMESPACE;
|
|
1571
|
+
return useTranslation(ns);
|
|
1572
|
+
};
|
|
1573
|
+
|
|
1552
1574
|
var LegendLayout = function LegendLayout(_ref) {
|
|
1553
1575
|
var title = _ref.title,
|
|
1554
|
-
name = _ref.name,
|
|
1555
|
-
dimensions = _ref.dimensions,
|
|
1556
1576
|
children = _ref.children,
|
|
1557
1577
|
height = _ref.height,
|
|
1558
1578
|
width = _ref.width,
|
|
1559
|
-
|
|
1560
|
-
|
|
1579
|
+
_ref$showLayerLegend = _ref.showLayerLegend,
|
|
1580
|
+
showLayerLegend = _ref$showLayerLegend === void 0 ? true : _ref$showLayerLegend,
|
|
1581
|
+
toggleLayerLegendVisibility = _ref.toggleLayerLegendVisibility;
|
|
1582
|
+
var _useWebmapReactTransl = useWebmapReactTranslation(),
|
|
1583
|
+
t = _useWebmapReactTransl.t;
|
|
1584
|
+
var theme = useTheme();
|
|
1585
|
+
return jsxs(Card, {
|
|
1561
1586
|
"data-testid": "legend",
|
|
1562
1587
|
sx: {
|
|
1563
|
-
|
|
1564
|
-
|
|
1565
|
-
backgroundColor: '#FFF',
|
|
1588
|
+
border: 'none',
|
|
1589
|
+
// eslint-disable-next-line no-nested-ternary
|
|
1590
|
+
backgroundColor: toggleLayerLegendVisibility ? showLayerLegend ? 'geowebColors.cards.cardContainer' : 'geowebColors.cards.cardContainerDisabled' : '#FFF',
|
|
1566
1591
|
overflow: 'hidden',
|
|
1567
|
-
marginBottom: 0.5
|
|
1592
|
+
marginBottom: 0.5,
|
|
1593
|
+
boxShadow: 0,
|
|
1594
|
+
borderRadius: '3px',
|
|
1595
|
+
padding: toggleLayerLegendVisibility ? 'none' : '10px'
|
|
1568
1596
|
},
|
|
1569
|
-
children: [jsx(Box, {
|
|
1597
|
+
children: [toggleLayerLegendVisibility ? jsx(Box, {
|
|
1570
1598
|
"data-testid": "legend-title",
|
|
1599
|
+
children: jsx(CustomTooltip, {
|
|
1600
|
+
title: showLayerLegend ? t('webmap-react-hide-layer') : t('webmap-react-show-layer'),
|
|
1601
|
+
children: jsxs(Typography, {
|
|
1602
|
+
alignItems: "center",
|
|
1603
|
+
component: "button",
|
|
1604
|
+
display: "flex",
|
|
1605
|
+
gap: 1,
|
|
1606
|
+
onClick: function onClick(event) {
|
|
1607
|
+
event.stopPropagation();
|
|
1608
|
+
toggleLayerLegendVisibility(!showLayerLegend);
|
|
1609
|
+
},
|
|
1610
|
+
sx: {
|
|
1611
|
+
fontFamily: 'Roboto, Helvetica, Arial',
|
|
1612
|
+
fontSize: '12px',
|
|
1613
|
+
width: "".concat(width, "px"),
|
|
1614
|
+
minWidth: '100%',
|
|
1615
|
+
padding: '4px',
|
|
1616
|
+
margin: '0 0 1px',
|
|
1617
|
+
wordWrap: 'break-word',
|
|
1618
|
+
color: showLayerLegend ? 'geowebColors.typographyAndIcons.text' : 'geowebColors.typographyAndIcons.inactiveText',
|
|
1619
|
+
whiteSpace: 'nowrap',
|
|
1620
|
+
border: showLayerLegend ? 'none' : "1px solid ".concat(theme.palette.geowebColors.cards.cardContainerDisabledBorder),
|
|
1621
|
+
backgroundColor: showLayerLegend ? 'geowebColors.cards.cardContainer' : 'geowebColors.cards.cardContainerDisabled',
|
|
1622
|
+
textAlign: 'left',
|
|
1623
|
+
cursor: 'pointer',
|
|
1624
|
+
'&:hover': {
|
|
1625
|
+
backgroundColor: 'geowebColors.cards.cardContainerMouseOver',
|
|
1626
|
+
border: showLayerLegend ? 'none' : "1px solid ".concat(theme.palette.geowebColors.cards.cardContainerBorder)
|
|
1627
|
+
}
|
|
1628
|
+
},
|
|
1629
|
+
variant: "subtitle2",
|
|
1630
|
+
children: [showLayerLegend ? jsx(Visibility, {
|
|
1631
|
+
fontSize: "medium",
|
|
1632
|
+
sx: {
|
|
1633
|
+
margin: 'auto 0px'
|
|
1634
|
+
}
|
|
1635
|
+
}) : jsx(VisibilityOff, {
|
|
1636
|
+
fontSize: "medium",
|
|
1637
|
+
sx: {
|
|
1638
|
+
margin: 'auto 0px'
|
|
1639
|
+
}
|
|
1640
|
+
}), jsx("span", {
|
|
1641
|
+
style: {
|
|
1642
|
+
overflow: 'hidden',
|
|
1643
|
+
textOverflow: 'ellipsis'
|
|
1644
|
+
},
|
|
1645
|
+
children: title
|
|
1646
|
+
})]
|
|
1647
|
+
})
|
|
1648
|
+
})
|
|
1649
|
+
}) : jsx(Box, {
|
|
1650
|
+
"data-testid": "legend-title",
|
|
1651
|
+
sx: {
|
|
1652
|
+
backgroundColor: '#FFF'
|
|
1653
|
+
},
|
|
1571
1654
|
children: jsx(Typography, {
|
|
1572
1655
|
sx: {
|
|
1573
1656
|
fontFamily: 'Roboto, Helvetica, Arial',
|
|
@@ -1580,41 +1663,19 @@ var LegendLayout = function LegendLayout(_ref) {
|
|
|
1580
1663
|
variant: "h3",
|
|
1581
1664
|
children: title
|
|
1582
1665
|
})
|
|
1583
|
-
}), jsx(CustomTooltip, {
|
|
1666
|
+
}), !!showLayerLegend && jsx(CustomTooltip, {
|
|
1584
1667
|
placement: "top",
|
|
1585
1668
|
title: title || 'loading',
|
|
1586
1669
|
children: jsx(Box, {
|
|
1587
1670
|
sx: {
|
|
1588
|
-
margin: '10px 0px 10px 0px',
|
|
1671
|
+
margin: toggleLayerLegendVisibility ? '2px 0 8px 12px' : '10px 0px 10px 0px',
|
|
1589
1672
|
height: "".concat(height, "px"),
|
|
1590
|
-
width: "".concat(width, "px")
|
|
1673
|
+
width: "".concat(width, "px"),
|
|
1674
|
+
minWidth: '100%',
|
|
1675
|
+
backgroundColor: '#FFF'
|
|
1591
1676
|
},
|
|
1592
1677
|
children: children
|
|
1593
1678
|
})
|
|
1594
|
-
}), jsx(Box, {
|
|
1595
|
-
"data-testid": "legend-info",
|
|
1596
|
-
sx: _objectSpread2({
|
|
1597
|
-
fontFamily: 'Roboto, Helvetica, Arial',
|
|
1598
|
-
fontSize: 10,
|
|
1599
|
-
color: 'common.black',
|
|
1600
|
-
overflowX: 'hidden',
|
|
1601
|
-
wordWrap: 'break-word',
|
|
1602
|
-
whiteSpace: 'nowrap'
|
|
1603
|
-
}, minWidth && {
|
|
1604
|
-
minWidth: "".concat(minWidth, "px")
|
|
1605
|
-
}),
|
|
1606
|
-
children: dimensions === null || dimensions === void 0 ? void 0 : dimensions.map(function (dim) {
|
|
1607
|
-
return jsx(Box, {
|
|
1608
|
-
children: dim.name === 'time' ? "".concat(dim.currentValue) : jsxs(Fragment, {
|
|
1609
|
-
children: [jsxs(Box, {
|
|
1610
|
-
style: {
|
|
1611
|
-
fontWeight: 500
|
|
1612
|
-
},
|
|
1613
|
-
children: [dim.name, ":"]
|
|
1614
|
-
}), dim.currentValue, " ", dim.units]
|
|
1615
|
-
})
|
|
1616
|
-
}, name + dim.name);
|
|
1617
|
-
})
|
|
1618
1679
|
})]
|
|
1619
1680
|
});
|
|
1620
1681
|
};
|
|
@@ -1697,6 +1758,12 @@ var joinUrlParams = function joinUrlParams(params) {
|
|
|
1697
1758
|
return x !== undefined && x.length > 0;
|
|
1698
1759
|
}).join('/');
|
|
1699
1760
|
};
|
|
1761
|
+
// This is a copy from libs/api/src/utils.ts due to circular dependency
|
|
1762
|
+
var withJsonFormat = function withJsonFormat(url) {
|
|
1763
|
+
var urlObj = new URL(url);
|
|
1764
|
+
urlObj.searchParams.set('f', 'json');
|
|
1765
|
+
return urlObj.toString();
|
|
1766
|
+
};
|
|
1700
1767
|
var fetchEDRCollectionDetails = /*#__PURE__*/function () {
|
|
1701
1768
|
var _ref3 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee3(edrBaseUrlWithCollection) {
|
|
1702
1769
|
var instanceId,
|
|
@@ -1705,7 +1772,7 @@ var fetchEDRCollectionDetails = /*#__PURE__*/function () {
|
|
|
1705
1772
|
while (1) switch (_context3.prev = _context3.next) {
|
|
1706
1773
|
case 0:
|
|
1707
1774
|
instanceId = _args3.length > 1 && _args3[1] !== undefined ? _args3[1] : '';
|
|
1708
|
-
return _context3.abrupt("return", fetch(joinUrlParams([edrBaseUrlWithCollection, instanceId])).then(handleResponse));
|
|
1775
|
+
return _context3.abrupt("return", fetch(withJsonFormat(joinUrlParams([edrBaseUrlWithCollection, instanceId]))).then(handleResponse));
|
|
1709
1776
|
case 2:
|
|
1710
1777
|
case "end":
|
|
1711
1778
|
return _context3.stop();
|
|
@@ -10527,12 +10594,6 @@ var fakeEdrLayerApiHandlers = [http.get('https://gw-edr.pub.knmi.cloud/edr/colle
|
|
|
10527
10594
|
});
|
|
10528
10595
|
})];
|
|
10529
10596
|
|
|
10530
|
-
var WEBMAP_REACT_NAMESPACE = 'webmapreact';
|
|
10531
|
-
var useWebmapReactTranslation = function useWebmapReactTranslation() {
|
|
10532
|
-
var ns = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : WEBMAP_REACT_NAMESPACE;
|
|
10533
|
-
return useTranslation(ns);
|
|
10534
|
-
};
|
|
10535
|
-
|
|
10536
10597
|
var defaultCanvasWidth = 150;
|
|
10537
10598
|
var defaultCanvasHeight = 30;
|
|
10538
10599
|
/**
|
|
@@ -10565,7 +10626,8 @@ var renderLegendGraphic = function renderLegendGraphic(wmImage, ctx, width, heig
|
|
|
10565
10626
|
};
|
|
10566
10627
|
var Legend = function Legend(_ref) {
|
|
10567
10628
|
var _layer$options;
|
|
10568
|
-
var layer = _ref.layer
|
|
10629
|
+
var layer = _ref.layer,
|
|
10630
|
+
onToggleLayerLegendVisibility = _ref.onToggleLayerLegendVisibility;
|
|
10569
10631
|
/* Variable to remember the previous image */
|
|
10570
10632
|
var previousLegendImage = useRef(null);
|
|
10571
10633
|
/* Function to force rerender of this component when legend image loads */
|
|
@@ -10614,12 +10676,15 @@ var Legend = function Legend(_ref) {
|
|
|
10614
10676
|
var wmLayer = webmapUtils.getWMLayerById(layer.id);
|
|
10615
10677
|
var isEdrLayer = layer.layerType === LayerType.edrFeatureLayer;
|
|
10616
10678
|
var title = isEdrLayer ? (_layer$options = layer.options) === null || _layer$options === void 0 ? void 0 : _layer$options.collectionId : wmLayer === null || wmLayer === void 0 ? void 0 : wmLayer.title;
|
|
10679
|
+
/* Custom legend toggle for layer */
|
|
10680
|
+
var toggleLayerLegendVisibility = function toggleLayerLegendVisibility(showLegend) {
|
|
10681
|
+
return onToggleLayerLegendVisibility(layerId, showLegend);
|
|
10682
|
+
};
|
|
10617
10683
|
return jsx(LegendLayout, {
|
|
10618
|
-
dimensions: layer === null || layer === void 0 ? void 0 : layer.dimensions,
|
|
10619
10684
|
height: canvasContainerHeight,
|
|
10620
|
-
|
|
10621
|
-
name: wmLayer === null || wmLayer === void 0 ? void 0 : wmLayer.name,
|
|
10685
|
+
showLayerLegend: layer === null || layer === void 0 ? void 0 : layer.showLayerLegend,
|
|
10622
10686
|
title: title,
|
|
10687
|
+
toggleLayerLegendVisibility: toggleLayerLegendVisibility,
|
|
10623
10688
|
width: canvasContainerWidth,
|
|
10624
10689
|
children: jsx(CanvasComponent, {
|
|
10625
10690
|
onRenderCanvas: function onRenderCanvas(ctx, width, height) {
|
|
@@ -10694,7 +10759,8 @@ var LegendDialog = function LegendDialog(_ref) {
|
|
|
10694
10759
|
_ref$order = _ref.order,
|
|
10695
10760
|
order = _ref$order === void 0 ? 0 : _ref$order,
|
|
10696
10761
|
_ref$source = _ref.source,
|
|
10697
|
-
source = _ref$source === void 0 ? 'app' : _ref$source
|
|
10762
|
+
source = _ref$source === void 0 ? 'app' : _ref$source,
|
|
10763
|
+
onToggleLayerLegendVisibility = _ref.onToggleLayerLegendVisibility;
|
|
10698
10764
|
var _useWebmapReactTransl = useWebmapReactTranslation(),
|
|
10699
10765
|
t = _useWebmapReactTransl.t;
|
|
10700
10766
|
var stopWheelEventPropagationRef = useWheelStopPropagation();
|
|
@@ -10723,13 +10789,18 @@ var LegendDialog = function LegendDialog(_ref) {
|
|
|
10723
10789
|
sx: {
|
|
10724
10790
|
display: 'flex',
|
|
10725
10791
|
flexDirection: 'column',
|
|
10792
|
+
padding: '0 16px',
|
|
10726
10793
|
'&>div:last-child': {
|
|
10727
10794
|
marginBottom: 0
|
|
10795
|
+
},
|
|
10796
|
+
'&>div:first-child': {
|
|
10797
|
+
marginTop: '8px'
|
|
10728
10798
|
}
|
|
10729
10799
|
},
|
|
10730
10800
|
children: layers.map(function (layer) {
|
|
10731
10801
|
return jsx(Legend, {
|
|
10732
|
-
layer: layer
|
|
10802
|
+
layer: layer,
|
|
10803
|
+
onToggleLayerLegendVisibility: onToggleLayerLegendVisibility
|
|
10733
10804
|
}, layer.id);
|
|
10734
10805
|
})
|
|
10735
10806
|
}) : jsx(Typography, {
|
|
@@ -11292,19 +11363,36 @@ var LayerInfoText = function LayerInfoText(_ref) {
|
|
|
11292
11363
|
|
|
11293
11364
|
var LayerInfoLegend = function LayerInfoLegend(_ref) {
|
|
11294
11365
|
var title = _ref.title,
|
|
11295
|
-
|
|
11296
|
-
|
|
11297
|
-
|
|
11366
|
+
legendURL = _ref.legendURL,
|
|
11367
|
+
showLayerLegend = _ref.showLayerLegend,
|
|
11368
|
+
onToggleLayerLegendVisibility = _ref.onToggleLayerLegendVisibility;
|
|
11298
11369
|
var _useWebmapReactTransl = useWebmapReactTranslation(),
|
|
11299
11370
|
t = _useWebmapReactTransl.t;
|
|
11300
11371
|
return jsxs(Fragment, {
|
|
11301
|
-
children: [
|
|
11302
|
-
sx:
|
|
11303
|
-
|
|
11304
|
-
|
|
11372
|
+
children: [jsxs(Box, {
|
|
11373
|
+
sx: {
|
|
11374
|
+
display: 'flex',
|
|
11375
|
+
justifyContent: 'space-between',
|
|
11376
|
+
alignItems: 'center',
|
|
11377
|
+
width: '100%'
|
|
11378
|
+
},
|
|
11379
|
+
children: [jsx(Typography$1, {
|
|
11380
|
+
sx: textStyleWithMargin,
|
|
11381
|
+
variant: "subtitle2",
|
|
11382
|
+
children: t('webmap-react-legend')
|
|
11383
|
+
}), jsx(FormGroup, {
|
|
11384
|
+
children: jsx(FormControlLabel, {
|
|
11385
|
+
control: jsx(Checkbox, {
|
|
11386
|
+
checked: showLayerLegend,
|
|
11387
|
+
onChange: function onChange() {
|
|
11388
|
+
onToggleLayerLegendVisibility(!showLayerLegend);
|
|
11389
|
+
}
|
|
11390
|
+
}),
|
|
11391
|
+
label: t('webmap-react-show-layer-legend'),
|
|
11392
|
+
sx: textStyleWithMargin
|
|
11393
|
+
})
|
|
11394
|
+
})]
|
|
11305
11395
|
}), jsx(LegendLayout, {
|
|
11306
|
-
dimensions: dimensions,
|
|
11307
|
-
name: name,
|
|
11308
11396
|
title: title,
|
|
11309
11397
|
children: legendURL ? jsx("img", {
|
|
11310
11398
|
alt: title,
|
|
@@ -11468,7 +11556,9 @@ var LayerInfoDialog = function LayerInfoDialog(_ref) {
|
|
|
11468
11556
|
top: 150,
|
|
11469
11557
|
left: 900
|
|
11470
11558
|
} : _ref$startPosition,
|
|
11471
|
-
selectedStyle = _ref.selectedStyle
|
|
11559
|
+
selectedStyle = _ref.selectedStyle,
|
|
11560
|
+
showLayerLegend = _ref.showLayerLegend,
|
|
11561
|
+
onToggleLayerLegendVisibility = _ref.onToggleLayerLegendVisibility;
|
|
11472
11562
|
var styles = getLayerStyles(layer);
|
|
11473
11563
|
var dimensions = getDimensionsList(layer.dimensions);
|
|
11474
11564
|
var _useWebmapReactTransl = useWebmapReactTranslation(),
|
|
@@ -11476,7 +11566,7 @@ var LayerInfoDialog = function LayerInfoDialog(_ref) {
|
|
|
11476
11566
|
var bbox = getLayerBbox(t, layer);
|
|
11477
11567
|
var legendURL = ((_layer$styles = layer.styles) === null || _layer$styles === void 0 || (_layer$styles = _layer$styles.find(function (styleItem) {
|
|
11478
11568
|
return styleItem.name === selectedStyle;
|
|
11479
|
-
})) === null || _layer$styles === void 0 ? void 0 : _layer$styles.legendURL) || ((_layer$styles2 = layer.styles) === null || _layer$styles2 === void 0 ? void 0 : _layer$styles2
|
|
11569
|
+
})) === null || _layer$styles === void 0 ? void 0 : _layer$styles.legendURL) || ((_layer$styles2 = layer.styles) === null || _layer$styles2 === void 0 || (_layer$styles2 = _layer$styles2[0]) === null || _layer$styles2 === void 0 ? void 0 : _layer$styles2.legendURL) ||
|
|
11480
11570
|
// show first style if none selected
|
|
11481
11571
|
undefined;
|
|
11482
11572
|
return jsx(ToolContainerDraggable, {
|
|
@@ -11526,9 +11616,9 @@ var LayerInfoDialog = function LayerInfoDialog(_ref) {
|
|
|
11526
11616
|
label: t('webmap-react-keywords'),
|
|
11527
11617
|
value: ((_layer$keywords = layer.keywords) === null || _layer$keywords === void 0 ? void 0 : _layer$keywords.join(', ')) || '-'
|
|
11528
11618
|
}), jsx(LayerInfoLegend, {
|
|
11529
|
-
dimensions: layer.dimensions,
|
|
11530
11619
|
legendURL: legendURL,
|
|
11531
|
-
|
|
11620
|
+
onToggleLayerLegendVisibility: onToggleLayerLegendVisibility,
|
|
11621
|
+
showLayerLegend: showLayerLegend,
|
|
11532
11622
|
title: layer.title
|
|
11533
11623
|
})]
|
|
11534
11624
|
})
|
|
@@ -11660,7 +11750,7 @@ var MapMousePosition = function MapMousePosition() {
|
|
|
11660
11750
|
sx: {
|
|
11661
11751
|
zIndex: 10,
|
|
11662
11752
|
justifySelf: 'center',
|
|
11663
|
-
bottom: '
|
|
11753
|
+
bottom: '26px',
|
|
11664
11754
|
left: '6px',
|
|
11665
11755
|
position: 'absolute'
|
|
11666
11756
|
},
|
|
@@ -19099,84 +19189,124 @@ var dateToManualFormatString = function dateToManualFormatString(inDate) {
|
|
|
19099
19189
|
return "".concat(EEE, " ").concat(dd, " ").concat(MMM, " ").concat(HH, ":").concat(mm, " UTC");
|
|
19100
19190
|
};
|
|
19101
19191
|
|
|
19102
|
-
|
|
19103
|
-
|
|
19104
|
-
|
|
19105
|
-
|
|
19106
|
-
|
|
19107
|
-
|
|
19108
|
-
|
|
19192
|
+
var getButtonSizes = function getButtonSizes(fontSize) {
|
|
19193
|
+
if (fontSize > 40) {
|
|
19194
|
+
return {
|
|
19195
|
+
buttonSize: 'large',
|
|
19196
|
+
iconSize: 40
|
|
19197
|
+
};
|
|
19198
|
+
}
|
|
19199
|
+
if (fontSize > 24) {
|
|
19200
|
+
return {
|
|
19201
|
+
buttonSize: 'medium',
|
|
19202
|
+
iconSize: 32
|
|
19203
|
+
};
|
|
19204
|
+
}
|
|
19205
|
+
return {
|
|
19206
|
+
buttonSize: 'small',
|
|
19207
|
+
iconSize: 24
|
|
19208
|
+
};
|
|
19209
|
+
};
|
|
19109
19210
|
var ClockContainer = function ClockContainer(_ref) {
|
|
19110
|
-
var
|
|
19111
|
-
|
|
19112
|
-
|
|
19211
|
+
var _ref$isOptionsMenuVis = _ref.isOptionsMenuVisible,
|
|
19212
|
+
isOptionsMenuVisible = _ref$isOptionsMenuVis === void 0 ? false : _ref$isOptionsMenuVis,
|
|
19213
|
+
fontSize = _ref.fontSize,
|
|
19214
|
+
onToggleClock = _ref.onToggleClock,
|
|
19215
|
+
time = _ref.time,
|
|
19216
|
+
onToggleOptions = _ref.onToggleOptions,
|
|
19217
|
+
optionsElement = _ref.optionsElement;
|
|
19113
19218
|
var _useWebmapReactTransl = useWebmapReactTranslation(),
|
|
19114
19219
|
t = _useWebmapReactTransl.t;
|
|
19115
19220
|
var title = t('clock-hide');
|
|
19221
|
+
var optionsTitle = t('clock-animation-options');
|
|
19116
19222
|
var currentDateString = dateToManualFormatString(dateUtils.fromUnix(time));
|
|
19117
|
-
|
|
19118
|
-
|
|
19119
|
-
|
|
19120
|
-
|
|
19121
|
-
|
|
19122
|
-
|
|
19123
|
-
|
|
19124
|
-
width: '100%',
|
|
19125
|
-
backgroundColor: 'geowebColors.timeSlider.playerTimeMarkers.fill',
|
|
19126
|
-
borderRadius: '5px'
|
|
19127
|
-
},
|
|
19128
|
-
wrap: "nowrap",
|
|
19129
|
-
children: [jsx(Grid, {
|
|
19223
|
+
var _getButtonSizes = getButtonSizes(fontSize),
|
|
19224
|
+
buttonSize = _getButtonSizes.buttonSize,
|
|
19225
|
+
iconSize = _getButtonSizes.iconSize;
|
|
19226
|
+
return jsx(ThemeProvider, {
|
|
19227
|
+
theme: darkTheme,
|
|
19228
|
+
children: jsxs(Grid, {
|
|
19229
|
+
container: true,
|
|
19130
19230
|
sx: {
|
|
19131
|
-
|
|
19132
|
-
|
|
19133
|
-
|
|
19134
|
-
|
|
19135
|
-
|
|
19231
|
+
justifyContent: 'space-evenly',
|
|
19232
|
+
alignItems: 'center',
|
|
19233
|
+
cursor: 'move',
|
|
19234
|
+
height: '100%',
|
|
19235
|
+
width: '100%',
|
|
19236
|
+
backgroundColor: 'geowebColors.timeSlider.playerTimeMarkers.fill',
|
|
19237
|
+
borderRadius: '5px'
|
|
19238
|
+
},
|
|
19239
|
+
wrap: "nowrap",
|
|
19240
|
+
children: [jsx(Grid, {
|
|
19136
19241
|
sx: {
|
|
19137
|
-
|
|
19242
|
+
marginLeft: '12px',
|
|
19243
|
+
marginRight: '12px'
|
|
19138
19244
|
},
|
|
19139
|
-
children: jsx(
|
|
19140
|
-
|
|
19141
|
-
|
|
19142
|
-
|
|
19143
|
-
|
|
19144
|
-
|
|
19145
|
-
|
|
19245
|
+
children: jsx(CustomIconButton, {
|
|
19246
|
+
"aria-label": title,
|
|
19247
|
+
onClick: onToggleClock,
|
|
19248
|
+
size: buttonSize,
|
|
19249
|
+
tooltipTitle: title,
|
|
19250
|
+
variant: "boxed",
|
|
19251
|
+
children: jsx(ChevronRight, {
|
|
19252
|
+
sx: {
|
|
19253
|
+
width: iconSize,
|
|
19254
|
+
height: iconSize
|
|
19255
|
+
}
|
|
19146
19256
|
})
|
|
19147
19257
|
})
|
|
19148
|
-
})
|
|
19149
|
-
|
|
19150
|
-
|
|
19258
|
+
}), jsx(Grid, {
|
|
19259
|
+
children: jsx(Typography, {
|
|
19260
|
+
sx: {
|
|
19261
|
+
whiteSpace: 'nowrap',
|
|
19262
|
+
fontSize: fontSize,
|
|
19263
|
+
color: 'geowebColors.timeSlider.playerTimeText.color'
|
|
19264
|
+
},
|
|
19265
|
+
variant: "subtitle2",
|
|
19266
|
+
children: currentDateString
|
|
19267
|
+
})
|
|
19268
|
+
}), jsx(Grid, {
|
|
19151
19269
|
sx: {
|
|
19152
|
-
|
|
19153
|
-
|
|
19154
|
-
color: '#fff'
|
|
19270
|
+
marginLeft: '12px',
|
|
19271
|
+
marginRight: '12px'
|
|
19155
19272
|
},
|
|
19156
|
-
|
|
19157
|
-
|
|
19158
|
-
|
|
19159
|
-
|
|
19273
|
+
children: jsx(CustomIconButton, {
|
|
19274
|
+
"aria-label": optionsTitle,
|
|
19275
|
+
isSelected: isOptionsMenuVisible,
|
|
19276
|
+
onClick: onToggleOptions,
|
|
19277
|
+
ref: optionsElement,
|
|
19278
|
+
size: buttonSize,
|
|
19279
|
+
tooltipTitle: optionsTitle,
|
|
19280
|
+
variant: "boxed",
|
|
19281
|
+
children: jsx(Options, {
|
|
19282
|
+
sx: {
|
|
19283
|
+
width: iconSize,
|
|
19284
|
+
height: iconSize
|
|
19285
|
+
}
|
|
19286
|
+
})
|
|
19287
|
+
})
|
|
19288
|
+
})]
|
|
19289
|
+
})
|
|
19160
19290
|
});
|
|
19161
19291
|
};
|
|
19162
19292
|
|
|
19163
|
-
var MIN_WIDTH =
|
|
19293
|
+
var MIN_WIDTH = 240;
|
|
19164
19294
|
var MIN_HEIGHT = 32;
|
|
19165
19295
|
var MIN_FONT_SIZE = 14; // bigger font size will cause render delay in LCP
|
|
19166
19296
|
var FONT_SIZE_WIDTH_RATIO = MIN_FONT_SIZE / MIN_WIDTH;
|
|
19167
|
-
var BUTTON_WIDTH = 40;
|
|
19168
19297
|
var resizeHandlePlacement = {
|
|
19169
19298
|
top: false,
|
|
19170
19299
|
right: false,
|
|
19171
19300
|
bottom: false,
|
|
19172
19301
|
left: false,
|
|
19173
|
-
topRight:
|
|
19174
|
-
bottomRight:
|
|
19302
|
+
topRight: true,
|
|
19303
|
+
bottomRight: true,
|
|
19175
19304
|
bottomLeft: true,
|
|
19176
|
-
topLeft:
|
|
19305
|
+
topLeft: true
|
|
19177
19306
|
};
|
|
19178
19307
|
var Clock = function Clock(_ref2) {
|
|
19179
|
-
var
|
|
19308
|
+
var optionsElement = _ref2.optionsElement,
|
|
19309
|
+
time = _ref2.time,
|
|
19180
19310
|
_ref2$isVisible = _ref2.isVisible,
|
|
19181
19311
|
isClockVisible = _ref2$isVisible === void 0 ? true : _ref2$isVisible,
|
|
19182
19312
|
onToggleClock = _ref2.onToggleClock,
|
|
@@ -19191,7 +19321,10 @@ var Clock = function Clock(_ref2) {
|
|
|
19191
19321
|
width: MIN_WIDTH,
|
|
19192
19322
|
height: MIN_HEIGHT
|
|
19193
19323
|
} : _ref2$size,
|
|
19194
|
-
onSetSize = _ref2.onSetSize
|
|
19324
|
+
onSetSize = _ref2.onSetSize,
|
|
19325
|
+
onToggleOptions = _ref2.onToggleOptions,
|
|
19326
|
+
_ref2$isOptionsMenuVi = _ref2.isOptionsMenuVisible,
|
|
19327
|
+
isOptionsMenuVisible = _ref2$isOptionsMenuVi === void 0 ? false : _ref2$isOptionsMenuVi;
|
|
19195
19328
|
var _useWebmapReactTransl = useWebmapReactTranslation(),
|
|
19196
19329
|
t = _useWebmapReactTransl.t;
|
|
19197
19330
|
var clockElement = useRef(null);
|
|
@@ -19215,6 +19348,9 @@ var Clock = function Clock(_ref2) {
|
|
|
19215
19348
|
var setSize = function setSize(size) {
|
|
19216
19349
|
onSetSize === null || onSetSize === void 0 || onSetSize(size);
|
|
19217
19350
|
};
|
|
19351
|
+
var toggleOptions = function toggleOptions() {
|
|
19352
|
+
onToggleOptions === null || onToggleOptions === void 0 || onToggleOptions();
|
|
19353
|
+
};
|
|
19218
19354
|
return jsx(Fragment, {
|
|
19219
19355
|
children: !isClockVisible ? jsx(CustomIconButton, {
|
|
19220
19356
|
"aria-label": t('clock-show'),
|
|
@@ -19242,9 +19378,7 @@ var Clock = function Clock(_ref2) {
|
|
|
19242
19378
|
},
|
|
19243
19379
|
position: position,
|
|
19244
19380
|
children: jsx("div", {
|
|
19245
|
-
ref:
|
|
19246
|
-
clockElement.current = _ref3;
|
|
19247
|
-
},
|
|
19381
|
+
ref: clockElement,
|
|
19248
19382
|
style: {
|
|
19249
19383
|
position: 'absolute',
|
|
19250
19384
|
zIndex: 1001,
|
|
@@ -19253,17 +19387,9 @@ var Clock = function Clock(_ref2) {
|
|
|
19253
19387
|
},
|
|
19254
19388
|
children: jsx(Resizable, {
|
|
19255
19389
|
enable: resizeHandlePlacement,
|
|
19256
|
-
handleComponent: {
|
|
19257
|
-
bottomLeft: jsx(Resize, {
|
|
19258
|
-
isRightAligned: true,
|
|
19259
|
-
style: {
|
|
19260
|
-
fill: '#FFFFFF'
|
|
19261
|
-
}
|
|
19262
|
-
})
|
|
19263
|
-
},
|
|
19264
19390
|
lockAspectRatio: true,
|
|
19265
19391
|
minHeight: MIN_HEIGHT,
|
|
19266
|
-
minWidth: MIN_WIDTH
|
|
19392
|
+
minWidth: MIN_WIDTH,
|
|
19267
19393
|
nodeRef: clockElement,
|
|
19268
19394
|
onResize: function onResize(_event, _direction, _ref, delta) {
|
|
19269
19395
|
var width = size.width + delta.width;
|
|
@@ -19287,9 +19413,12 @@ var Clock = function Clock(_ref2) {
|
|
|
19287
19413
|
size: size,
|
|
19288
19414
|
children: jsx(ClockContainer, {
|
|
19289
19415
|
fontSize: fontSize,
|
|
19290
|
-
|
|
19416
|
+
isOptionsMenuVisible: isOptionsMenuVisible,
|
|
19417
|
+
onToggleClock: function onToggleClock() {
|
|
19291
19418
|
toggleClock(false);
|
|
19292
19419
|
},
|
|
19420
|
+
onToggleOptions: toggleOptions,
|
|
19421
|
+
optionsElement: optionsElement,
|
|
19293
19422
|
time: time
|
|
19294
19423
|
})
|
|
19295
19424
|
})
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@opengeoweb/webmap-react",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "16.0.0",
|
|
4
4
|
"description": "GeoWeb react wrapper for webmap",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"repository": {
|
|
@@ -8,9 +8,9 @@
|
|
|
8
8
|
"url": "git@gitlab.com:opengeoweb/opengeoweb.git"
|
|
9
9
|
},
|
|
10
10
|
"dependencies": {
|
|
11
|
-
"@opengeoweb/webmap": "
|
|
12
|
-
"@opengeoweb/theme": "
|
|
13
|
-
"@opengeoweb/shared": "
|
|
11
|
+
"@opengeoweb/webmap": "16.0.0",
|
|
12
|
+
"@opengeoweb/theme": "16.0.0",
|
|
13
|
+
"@opengeoweb/shared": "16.0.0",
|
|
14
14
|
"lodash": "^4.17.21",
|
|
15
15
|
"ol": "^10.4.0",
|
|
16
16
|
"proj4": "^2.9.2",
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { FC } from 'react';
|
|
2
|
-
export declare const MIN_WIDTH =
|
|
1
|
+
import type { FC, Ref } from 'react';
|
|
2
|
+
export declare const MIN_WIDTH = 240;
|
|
3
3
|
export declare const MIN_HEIGHT = 32;
|
|
4
4
|
export interface Position {
|
|
5
5
|
x: number;
|
|
@@ -10,6 +10,7 @@ export interface Size {
|
|
|
10
10
|
height: number;
|
|
11
11
|
}
|
|
12
12
|
export declare const Clock: FC<{
|
|
13
|
+
optionsElement: Ref<HTMLButtonElement>;
|
|
13
14
|
time: number;
|
|
14
15
|
isVisible?: boolean;
|
|
15
16
|
onToggleClock?: (isVisible: boolean) => void;
|
|
@@ -17,4 +18,6 @@ export declare const Clock: FC<{
|
|
|
17
18
|
onSetPosition: (position: Position) => void;
|
|
18
19
|
size?: Size | undefined;
|
|
19
20
|
onSetSize: (size: Size) => void;
|
|
21
|
+
onToggleOptions?: () => void;
|
|
22
|
+
isOptionsMenuVisible?: boolean;
|
|
20
23
|
}>;
|
|
@@ -1,13 +1,9 @@
|
|
|
1
|
-
import type { FC } from 'react';
|
|
2
|
-
/**
|
|
3
|
-
* Format a date to a string
|
|
4
|
-
*
|
|
5
|
-
* Expects the following props:
|
|
6
|
-
* @param {Date} inDate - date to be formatted
|
|
7
|
-
*
|
|
8
|
-
*/
|
|
1
|
+
import type { FC, Ref } from 'react';
|
|
9
2
|
export declare const ClockContainer: FC<{
|
|
10
|
-
|
|
3
|
+
isOptionsMenuVisible?: boolean;
|
|
4
|
+
onToggleClock: () => void;
|
|
5
|
+
onToggleOptions: () => void;
|
|
6
|
+
optionsElement: Ref<HTMLButtonElement>;
|
|
11
7
|
fontSize: number;
|
|
12
8
|
time: number;
|
|
13
9
|
}>;
|
|
@@ -12,5 +12,7 @@ export interface LayerInfoDialogProps {
|
|
|
12
12
|
dialogHeight?: number;
|
|
13
13
|
startPosition?: Position;
|
|
14
14
|
selectedStyle?: string;
|
|
15
|
+
showLayerLegend: boolean;
|
|
16
|
+
onToggleLayerLegendVisibility: (showLegend: boolean) => void;
|
|
15
17
|
}
|
|
16
18
|
export declare const LayerInfoDialog: React.FC<LayerInfoDialogProps>;
|
|
@@ -1,8 +1,7 @@
|
|
|
1
|
-
import type { Dimension } from '@opengeoweb/webmap';
|
|
2
1
|
export interface LayerInfoLegendProps {
|
|
3
2
|
title: string;
|
|
4
|
-
name: string;
|
|
5
|
-
dimensions: Dimension[];
|
|
6
3
|
legendURL?: string;
|
|
4
|
+
showLayerLegend: boolean;
|
|
5
|
+
onToggleLayerLegendVisibility: (showLegend: boolean) => void;
|
|
7
6
|
}
|
|
8
7
|
export declare const LayerInfoLegend: React.FC<LayerInfoLegendProps>;
|
|
@@ -2,6 +2,7 @@ import React from 'react';
|
|
|
2
2
|
import type { LayerFoundation } from '@opengeoweb/webmap';
|
|
3
3
|
interface LegendProps {
|
|
4
4
|
layer: LayerFoundation;
|
|
5
|
+
onToggleLayerLegendVisibility: (layerId: string, showLegend: boolean) => void;
|
|
5
6
|
}
|
|
6
7
|
export declare const Legend: React.FC<LegendProps>;
|
|
7
8
|
export {};
|
|
@@ -1,12 +1,10 @@
|
|
|
1
|
-
import type { Dimension } from '@opengeoweb/webmap';
|
|
2
1
|
interface LegendLayoutProps {
|
|
3
2
|
title: string;
|
|
4
|
-
name: string;
|
|
5
|
-
dimensions: Dimension[];
|
|
6
3
|
children: React.ReactNode;
|
|
7
4
|
height?: number;
|
|
8
5
|
width?: number;
|
|
9
|
-
|
|
6
|
+
showLayerLegend?: boolean;
|
|
7
|
+
toggleLayerLegendVisibility?: (showLegend: boolean) => void;
|
|
10
8
|
}
|
|
11
9
|
export declare const LegendLayout: React.FC<LegendLayoutProps>;
|
|
12
10
|
export {};
|