@opengeoweb/webmap-react 9.32.1 → 9.33.1-spike-ol.3
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 +40 -64
- package/package.json +1 -1
- package/src/lib/utils/i18n.d.ts +1 -0
package/index.esm.js
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { legendImageStore, WMImageEventType, webmapUtils, getLegendGraphicURLForLayer, getPixelCoordFromLatLong, WMJSMAP_LONLAT_EPSGCODE, getLatLongFromPixelCoord, LayerType, getWMJSMapById, debugLogger, DebugType, WMLayer, registerWMLayer, WMBBOX, getWMLayerById, WMJSMap, tilesettings } 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
6
|
import { CustomTooltip, CanvasComponent, ToolContainerDraggable, CustomIconButton, dateUtils, PROJECTION } from '@opengeoweb/shared';
|
|
7
|
-
import
|
|
8
|
-
import {
|
|
7
|
+
import 'i18next';
|
|
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';
|
|
10
10
|
import { Home, Add, Minus, List, Delete, Edit, DrawRegion, DrawPolygon, Location, DrawFIRLand, ArrowUp, Equalizer, DimensionsElevation, Link, LinkOff, Info, DimensionsOther, DimensionsRefTime, DimensionsTime } from '@opengeoweb/theme';
|
|
11
11
|
import { cloneDeep, debounce, isEqual } from 'lodash';
|
|
@@ -71,18 +71,18 @@ var fi = {
|
|
|
71
71
|
"webmap-react-identifier": "Tunniste",
|
|
72
72
|
"webmap-react-no-layers": "Ei karttatasoja",
|
|
73
73
|
"webmap-react-legend": "Selite",
|
|
74
|
-
"webmap-react-title": "
|
|
74
|
+
"webmap-react-title": "Otsikko",
|
|
75
75
|
"webmap-react-name": "Nimi",
|
|
76
76
|
"webmap-react-service": "Palvelu",
|
|
77
77
|
"webmap-react-abstract": "Tiivistelmä",
|
|
78
|
-
"webmap-react-dimensions": "
|
|
78
|
+
"webmap-react-dimensions": "Ulottuvuudet",
|
|
79
79
|
"webmap-react-styles": "Tyylit",
|
|
80
80
|
"webmap-react-bounding-box": "Rajaava-alue",
|
|
81
81
|
"webmap-react-groups": "Ryhmät",
|
|
82
82
|
"webmap-react-keywords": "Avainsanat",
|
|
83
|
-
"webmap-react-zoom-reset": "
|
|
84
|
-
"webmap-react-zoom-in": "
|
|
85
|
-
"webmap-react-zoom-out": "
|
|
83
|
+
"webmap-react-zoom-reset": "Palauta zoomaustaso",
|
|
84
|
+
"webmap-react-zoom-in": "Lähennä",
|
|
85
|
+
"webmap-react-zoom-out": "Loitonna",
|
|
86
86
|
"webmap-react-show": "Näytä",
|
|
87
87
|
"webmap-react-click-disconnect": "Irroita karttataso napsauttamalla",
|
|
88
88
|
"webmap-react-click-connect": "Yhdistä karttataso napsauttamalla",
|
|
@@ -1829,31 +1829,6 @@ $$h({ target: 'Object', stat: true, arity: 2, forced: Object.assign !== assign }
|
|
|
1829
1829
|
});
|
|
1830
1830
|
|
|
1831
1831
|
const WEBMAP_REACT_NAMESPACE = 'webmapreact';
|
|
1832
|
-
void i18n.use(initReactI18next).init({
|
|
1833
|
-
lng: 'en',
|
|
1834
|
-
ns: WEBMAP_REACT_NAMESPACE,
|
|
1835
|
-
interpolation: {
|
|
1836
|
-
escapeValue: false
|
|
1837
|
-
},
|
|
1838
|
-
resources: {
|
|
1839
|
-
en: {
|
|
1840
|
-
[WEBMAP_REACT_NAMESPACE]: webmapReactTranslations.en,
|
|
1841
|
-
[WEBMAP_NAMESPACE]: webmapTranslations.en
|
|
1842
|
-
},
|
|
1843
|
-
fi: {
|
|
1844
|
-
[WEBMAP_REACT_NAMESPACE]: webmapReactTranslations.fi,
|
|
1845
|
-
[WEBMAP_NAMESPACE]: webmapTranslations.fi
|
|
1846
|
-
},
|
|
1847
|
-
no: {
|
|
1848
|
-
[WEBMAP_REACT_NAMESPACE]: webmapReactTranslations.no,
|
|
1849
|
-
[WEBMAP_NAMESPACE]: webmapTranslations.no
|
|
1850
|
-
},
|
|
1851
|
-
nl: {
|
|
1852
|
-
[WEBMAP_REACT_NAMESPACE]: webmapReactTranslations.nl,
|
|
1853
|
-
[WEBMAP_NAMESPACE]: webmapTranslations.nl
|
|
1854
|
-
}
|
|
1855
|
-
}
|
|
1856
|
-
});
|
|
1857
1832
|
const useWebmapReactTranslation = () => useTranslation(WEBMAP_REACT_NAMESPACE);
|
|
1858
1833
|
|
|
1859
1834
|
const LegendLayout = ({
|
|
@@ -9845,15 +9820,11 @@ class ReactMapView extends React.Component {
|
|
|
9845
9820
|
const autoFetchInterval = Number(shouldAutoFetch); // Default true -> 1 minute
|
|
9846
9821
|
const autoFetchIntervalMilliSeconds = Math.abs(autoFetchInterval) * MINUTE_TO_MILLISECOND;
|
|
9847
9822
|
if (document.visibilityState === 'visible') {
|
|
9848
|
-
if
|
|
9849
|
-
|
|
9850
|
-
|
|
9823
|
+
// Check if the last refetch time is not set or if the time since the last refetch exceeds the interval
|
|
9824
|
+
if (!this.lastRefetched || new Date().getTime() - this.lastRefetched > autoFetchIntervalMilliSeconds) {
|
|
9825
|
+
// Refetch immediately and restart the timer
|
|
9851
9826
|
this.onStartRefetchTimer(true);
|
|
9852
|
-
} else {
|
|
9853
|
-
this.onStartRefetchTimer();
|
|
9854
9827
|
}
|
|
9855
|
-
} else {
|
|
9856
|
-
this.clearRefetchTimer();
|
|
9857
9828
|
}
|
|
9858
9829
|
};
|
|
9859
9830
|
/**
|
|
@@ -9871,31 +9842,36 @@ class ReactMapView extends React.Component {
|
|
|
9871
9842
|
this.clearRefetchTimer();
|
|
9872
9843
|
const autoFetchInterval = Number(shouldAutoFetch); // Default true -> 1 minute
|
|
9873
9844
|
const refetch = () => {
|
|
9874
|
-
|
|
9875
|
-
|
|
9876
|
-
|
|
9877
|
-
|
|
9878
|
-
|
|
9879
|
-
|
|
9880
|
-
|
|
9881
|
-
|
|
9882
|
-
|
|
9883
|
-
|
|
9884
|
-
|
|
9885
|
-
|
|
9886
|
-
|
|
9887
|
-
|
|
9888
|
-
|
|
9889
|
-
|
|
9890
|
-
|
|
9891
|
-
|
|
9892
|
-
|
|
9893
|
-
|
|
9894
|
-
|
|
9895
|
-
|
|
9896
|
-
|
|
9845
|
+
const isVisible = document.visibilityState === 'visible';
|
|
9846
|
+
if (isVisible) {
|
|
9847
|
+
this.lastRefetched = new Date().getTime();
|
|
9848
|
+
const {
|
|
9849
|
+
mapId
|
|
9850
|
+
} = this.props;
|
|
9851
|
+
const wmjsMap = webmapUtils.getWMJSMapById(mapId);
|
|
9852
|
+
const layers = wmjsMap == null ? void 0 : wmjsMap.getLayers();
|
|
9853
|
+
layers == null || layers.forEach(layer => {
|
|
9854
|
+
if (layer.enabled !== false) {
|
|
9855
|
+
parseWMJSLayer(layer, true).then(wmLayer => {
|
|
9856
|
+
const {
|
|
9857
|
+
props
|
|
9858
|
+
} = this;
|
|
9859
|
+
const {
|
|
9860
|
+
mapId,
|
|
9861
|
+
onUpdateLayerInformation
|
|
9862
|
+
} = props;
|
|
9863
|
+
const layerInfo = getLayerUpdateInfo(wmLayer, mapId);
|
|
9864
|
+
onUpdateLayerInformation && onUpdateLayerInformation(layerInfo);
|
|
9865
|
+
}).catch(e => {
|
|
9866
|
+
console.error(e);
|
|
9867
|
+
});
|
|
9868
|
+
}
|
|
9869
|
+
});
|
|
9870
|
+
}
|
|
9897
9871
|
};
|
|
9898
|
-
|
|
9872
|
+
if (autoFetchInterval > 0) {
|
|
9873
|
+
this.refetchTimer = setInterval(refetch, Math.abs(autoFetchInterval) * MINUTE_TO_MILLISECOND);
|
|
9874
|
+
}
|
|
9899
9875
|
if (force) {
|
|
9900
9876
|
refetch();
|
|
9901
9877
|
}
|
package/package.json
CHANGED
package/src/lib/utils/i18n.d.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import i18n from 'i18next';
|
|
2
2
|
import { UseTranslationResponse } from 'react-i18next';
|
|
3
3
|
export declare const WEBMAP_REACT_NAMESPACE = "webmapreact";
|
|
4
|
+
export declare const initWebmapReactTestI18n: () => void;
|
|
4
5
|
export declare const translateKeyOutsideComponents: (key: string, params?: Record<string, string | number> | undefined) => string;
|
|
5
6
|
export declare const useWebmapReactTranslation: () => UseTranslationResponse<typeof WEBMAP_REACT_NAMESPACE, typeof i18n>;
|
|
6
7
|
export { i18n };
|