@opengeoweb/time-series 15.2.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 +287 -69
- package/package.json +10 -10
- package/src/lib/TimeSeriesDemo.stories.d.ts +1 -0
- package/src/lib/components/TimeSeries/TimeSeriesChart.d.ts +16 -1
- package/src/lib/components/TimeSeries/TimeSeriesView.d.ts +2 -0
- package/src/lib/components/TimeSeries/types.d.ts +7 -0
- package/src/lib/components/TimeSeries/utils.d.ts +6 -2
- package/src/lib/utils/edrUtils.d.ts +3 -2
- package/src/lib/utils/timeseries-api/hooks.d.ts +3 -1
package/index.esm.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
|
|
2
|
-
import React, { useCallback,
|
|
2
|
+
import React, { useCallback, useMemo, useState, useEffect, memo } from 'react';
|
|
3
3
|
import { useDispatch, useSelector } from 'react-redux';
|
|
4
4
|
import { CustomIconButton, dateUtils, TooltipSelect, CustomAccordion, CustomTooltip, CustomToggleButton, ToolContainerDraggable, ToggleMenu, CustomDialog, SearchField, SearchHighlight, AlertBanner, useConfirmationDialog, SwitchButton, useResizeObserver } from '@opengeoweb/shared';
|
|
5
5
|
import { snackbarActions, snackbarTypes, snackbarListener, snackbarReducer } from '@opengeoweb/snackbar';
|
|
6
|
-
import { mapUtils, selectorMemoizationOptions, genericSelectors, uiSelectors, uiTypes, uiActions, useSetupDialog, mapSelectors, mapListener, serviceListener, layersListener, syncGroupsListener, genericListener, openlayersListener, uiReducer, syncGroupsReducer, layerReducer, serviceReducer, mapReducer, loadingIndicatorActions, syncGroupsActions, genericActions, mapActions, layerActions } from '@opengeoweb/store';
|
|
6
|
+
import { mapUtils, selectorMemoizationOptions, genericSelectors, uiSelectors, uiTypes, uiActions, useSetupDialog, mapSelectors, mapListener, serviceListener, layersListener, syncGroupsListener, genericListener, openlayersListener, uiReducer, syncGroupsReducer, layerReducer, serviceReducer, mapReducer, loadingIndicatorActions, syncGroupsActions, genericActions, useSyncgroupTimeState, mapActions, layerActions } from '@opengeoweb/store';
|
|
7
7
|
import { useTheme, MenuItem, LinearProgress, Grid, Box, Typography, ClickAwayListener, Input, Collapse, Button, List, ListItem, ListItemText, InputAdornment, ListItemButton, styled, Card, Stack, Tooltip, ListItemIcon, Checkbox } from '@mui/material';
|
|
8
8
|
import { isString, trim, trimStart, compact, chain, groupBy, countBy, sortBy, uniqBy, isEqual } from 'lodash';
|
|
9
9
|
import { ReactSortable } from 'react-sortablejs';
|
|
@@ -17,7 +17,7 @@ import { v4 } from 'uuid';
|
|
|
17
17
|
import { center } from '@turf/turf';
|
|
18
18
|
import { MapFeatureClass } from '@opengeoweb/webmap-react';
|
|
19
19
|
import { useQueries, useQueryClient, useQuery, queryOptions } from '@tanstack/react-query';
|
|
20
|
-
import { handleResponse } from '@opengeoweb/api';
|
|
20
|
+
import { handleResponse, withJsonFormat } from '@opengeoweb/api';
|
|
21
21
|
import Box$1 from '@mui/material/Box';
|
|
22
22
|
import { useFormContext } from 'react-hook-form';
|
|
23
23
|
import { ReactHookFormProvider, defaultFormOptions, ReactHookFormTextField, ReactHookFormSelect } from '@opengeoweb/form-fields';
|
|
@@ -138,8 +138,10 @@ var en = {
|
|
|
138
138
|
"timeseries-legend": "Legend",
|
|
139
139
|
"timeseries-legend-tooltip-show": "Show legend",
|
|
140
140
|
"timeseries-legend-tooltip-hide": "Hide legend",
|
|
141
|
-
"error-
|
|
141
|
+
"error-message-general": "This parameter could not be loaded.",
|
|
142
|
+
"error-message-general-plural": "These parameters could not be loaded.",
|
|
142
143
|
"error-message-missing-collection-or-service": "No collection and/or service found for parameter.",
|
|
144
|
+
"all-plots": "All plots",
|
|
143
145
|
"timeseries-add-plot": "Add plot"
|
|
144
146
|
};
|
|
145
147
|
var fi = {
|
|
@@ -250,8 +252,10 @@ var fi = {
|
|
|
250
252
|
"timeseries-legend": "Selite",
|
|
251
253
|
"timeseries-legend-tooltip-show": "Näytä selite",
|
|
252
254
|
"timeseries-legend-tooltip-hide": "Piilota selite",
|
|
253
|
-
"error-
|
|
255
|
+
"error-message-general": "Tätä parametria ei voitu ladata.",
|
|
256
|
+
"error-message-general-plural": "Näitä parametreja ei voitu ladata.",
|
|
254
257
|
"error-message-missing-collection-or-service": "Parametrille ei löytynyt kokoelmaa ja/tai palvelua",
|
|
258
|
+
"all-plots": "Kaikki kaaviot",
|
|
255
259
|
"timeseries-add-plot": "Lisää kaavio"
|
|
256
260
|
};
|
|
257
261
|
var no = {
|
|
@@ -362,8 +366,10 @@ var no = {
|
|
|
362
366
|
"timeseries-legend": "Forklaring",
|
|
363
367
|
"timeseries-legend-tooltip-show": "Vis forklaring",
|
|
364
368
|
"timeseries-legend-tooltip-hide": "Skjul forklaring",
|
|
365
|
-
"error-
|
|
369
|
+
"error-message-general": "Denne parameteren kunne ikke lastes.",
|
|
370
|
+
"error-message-general-plural": "Disse parametrene kunne ikke lastes.",
|
|
366
371
|
"error-message-missing-collection-or-service": "Ingen kolleksjon og/eller tjeneste funnet for parameter.",
|
|
372
|
+
"all-plots": "Alle diagrammer",
|
|
367
373
|
"timeseries-add-plot": "Legg til plott"
|
|
368
374
|
};
|
|
369
375
|
var nl = {
|
|
@@ -479,8 +485,10 @@ var nl = {
|
|
|
479
485
|
"timeseries-legend": "Legenda",
|
|
480
486
|
"timeseries-legend-tooltip-show": "Toon legenda",
|
|
481
487
|
"timeseries-legend-tooltip-hide": "Verberg legenda",
|
|
482
|
-
"error-
|
|
488
|
+
"error-message-general": "Deze parameter kon niet worden geladen.",
|
|
489
|
+
"error-message-general-plural": "Deze parameters konden niet worden geladen.",
|
|
483
490
|
"error-message-missing-collection-or-service": "Geen collectie en/of service gevonden voor parameter.",
|
|
491
|
+
"all-plots": "Alle grafieken",
|
|
484
492
|
"timeseries-add-plot": "Grafiek toevoegen"
|
|
485
493
|
};
|
|
486
494
|
var timeseriesTranslations = {
|
|
@@ -1120,9 +1128,15 @@ date) {
|
|
|
1120
1128
|
};
|
|
1121
1129
|
// 1 day to past, 10 days to future
|
|
1122
1130
|
var clipInterval = [1 * 24, 10 * 24];
|
|
1123
|
-
var constructTimeInterval = function constructTimeInterval(collection, instance,
|
|
1131
|
+
var constructTimeInterval = function constructTimeInterval(collection, instance, syncgroupTimeState) {
|
|
1124
1132
|
var _instance$extent$temp, _instance$extent2, _collection$extent4;
|
|
1125
1133
|
var interval = (_instance$extent$temp = (_instance$extent2 = instance.extent) == null || (_instance$extent2 = _instance$extent2.temporal) == null ? void 0 : _instance$extent2.interval[0]) != null ? _instance$extent$temp : collection == null || (_collection$extent4 = collection.extent) == null || (_collection$extent4 = _collection$extent4.temporal) == null ? void 0 : _collection$extent4.interval[0];
|
|
1134
|
+
// If syncgroupTimeState is set, use this instead of the fixed timerange.
|
|
1135
|
+
if ((syncgroupTimeState == null ? void 0 : syncgroupTimeState.start) !== undefined && (syncgroupTimeState == null ? void 0 : syncgroupTimeState.end) !== undefined) {
|
|
1136
|
+
var timeRangeStartIso = dateUtils.dateToString(dateUtils.fromUnix(syncgroupTimeState.start));
|
|
1137
|
+
var timeRangeEndIso = dateUtils.dateToString(dateUtils.fromUnix(syncgroupTimeState.end));
|
|
1138
|
+
return timeRangeStartIso + "/" + timeRangeEndIso;
|
|
1139
|
+
}
|
|
1126
1140
|
var _clipEdrInterval = clipEdrInterval(interval, clipInterval[0], clipInterval[1]),
|
|
1127
1141
|
start = _clipEdrInterval[0],
|
|
1128
1142
|
end = _clipEdrInterval[1];
|
|
@@ -2701,13 +2715,15 @@ var getNearbyLocation = function getNearbyLocation(parameter, service, selectedL
|
|
|
2701
2715
|
}
|
|
2702
2716
|
return null;
|
|
2703
2717
|
};
|
|
2704
|
-
var getPlotsWithParameters = function getPlotsWithParameters(plots, parameters) {
|
|
2718
|
+
var getPlotsWithParameters = function getPlotsWithParameters(plots, parameters, plotErrors, failedParameters) {
|
|
2705
2719
|
var parametersByPlotId = groupBy(parameters, function (parameter) {
|
|
2706
2720
|
return parameter.plotId;
|
|
2707
2721
|
});
|
|
2708
2722
|
var plotsWithParameters = plots.map(function (plot) {
|
|
2709
2723
|
return Object.assign({}, plot, {
|
|
2710
|
-
parametersWithData: parametersByPlotId[plot.plotId]
|
|
2724
|
+
parametersWithData: parametersByPlotId[plot.plotId] || [],
|
|
2725
|
+
errors: plotErrors == null ? void 0 : plotErrors[plot.plotId],
|
|
2726
|
+
failedParameters: failedParameters == null ? void 0 : failedParameters[plot.plotId]
|
|
2711
2727
|
});
|
|
2712
2728
|
}).filter(function (plot) {
|
|
2713
2729
|
var _plot$parametersWithD;
|
|
@@ -2784,7 +2800,7 @@ var getLocations = /*#__PURE__*/function () {
|
|
|
2784
2800
|
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
2785
2801
|
while (1) switch (_context.prev = _context.next) {
|
|
2786
2802
|
case 0:
|
|
2787
|
-
url = createUrl(serviceUrl, "/collections/" + collectionId + "/locations");
|
|
2803
|
+
url = withJsonFormat(createUrl(serviceUrl, "/collections/" + collectionId + "/locations"));
|
|
2788
2804
|
return _context.abrupt("return", fetch(url).then(handleResponse));
|
|
2789
2805
|
case 2:
|
|
2790
2806
|
case "end":
|
|
@@ -2802,7 +2818,7 @@ var getServiceInformation = /*#__PURE__*/function () {
|
|
|
2802
2818
|
return _regeneratorRuntime().wrap(function _callee2$(_context2) {
|
|
2803
2819
|
while (1) switch (_context2.prev = _context2.next) {
|
|
2804
2820
|
case 0:
|
|
2805
|
-
url = createUrl(serviceUrl);
|
|
2821
|
+
url = withJsonFormat(createUrl(serviceUrl));
|
|
2806
2822
|
return _context2.abrupt("return", fetch(url).then(handleResponse));
|
|
2807
2823
|
case 2:
|
|
2808
2824
|
case "end":
|
|
@@ -2820,7 +2836,7 @@ var getCollections = /*#__PURE__*/function () {
|
|
|
2820
2836
|
return _regeneratorRuntime().wrap(function _callee3$(_context3) {
|
|
2821
2837
|
while (1) switch (_context3.prev = _context3.next) {
|
|
2822
2838
|
case 0:
|
|
2823
|
-
url = createUrl(serviceUrl, '/collections');
|
|
2839
|
+
url = withJsonFormat(createUrl(serviceUrl, '/collections'));
|
|
2824
2840
|
return _context3.abrupt("return", fetch(url).then(handleResponse));
|
|
2825
2841
|
case 2:
|
|
2826
2842
|
case "end":
|
|
@@ -2838,7 +2854,7 @@ var getCollection = /*#__PURE__*/function () {
|
|
|
2838
2854
|
return _regeneratorRuntime().wrap(function _callee4$(_context4) {
|
|
2839
2855
|
while (1) switch (_context4.prev = _context4.next) {
|
|
2840
2856
|
case 0:
|
|
2841
|
-
url = createUrl(serviceUrl, "/collections/" + collectionId);
|
|
2857
|
+
url = withJsonFormat(createUrl(serviceUrl, "/collections/" + collectionId));
|
|
2842
2858
|
return _context4.abrupt("return", fetch(url).then(handleResponse));
|
|
2843
2859
|
case 2:
|
|
2844
2860
|
case "end":
|
|
@@ -2856,7 +2872,7 @@ var getInstances = /*#__PURE__*/function () {
|
|
|
2856
2872
|
return _regeneratorRuntime().wrap(function _callee5$(_context5) {
|
|
2857
2873
|
while (1) switch (_context5.prev = _context5.next) {
|
|
2858
2874
|
case 0:
|
|
2859
|
-
url = createUrl(serviceUrl, "/collections/" + collectionId + "/instances");
|
|
2875
|
+
url = withJsonFormat(createUrl(serviceUrl, "/collections/" + collectionId + "/instances"));
|
|
2860
2876
|
return _context5.abrupt("return", fetch(url).then(handleResponse));
|
|
2861
2877
|
case 2:
|
|
2862
2878
|
case "end":
|
|
@@ -2907,8 +2923,8 @@ var getPosition = /*#__PURE__*/function () {
|
|
|
2907
2923
|
return _ref7.apply(this, arguments);
|
|
2908
2924
|
};
|
|
2909
2925
|
}();
|
|
2910
|
-
var getErrorMessage = function getErrorMessage(
|
|
2911
|
-
return
|
|
2926
|
+
var getErrorMessage = function getErrorMessage() {
|
|
2927
|
+
return 'error-message-general';
|
|
2912
2928
|
};
|
|
2913
2929
|
var fetchEdrParameter = /*#__PURE__*/function () {
|
|
2914
2930
|
var _ref8 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee8(parameter, location, service, geojsonMap, intervalParam, collection, instance) {
|
|
@@ -2940,7 +2956,7 @@ var fetchEdrParameter = /*#__PURE__*/function () {
|
|
|
2940
2956
|
case 11:
|
|
2941
2957
|
_context8.prev = 11;
|
|
2942
2958
|
_context8.t0 = _context8["catch"](5);
|
|
2943
|
-
throw new Error(getErrorMessage(
|
|
2959
|
+
throw new Error(getErrorMessage());
|
|
2944
2960
|
case 14:
|
|
2945
2961
|
_context8.prev = 14;
|
|
2946
2962
|
if (!((_instance$data_querie2 = instance.data_queries) != null && _instance$data_querie2.position || (_collection$dataQueri2 = collection.dataQueries) != null && _collection$dataQueri2.position)) {
|
|
@@ -2974,11 +2990,11 @@ var fetchEdrParameter = /*#__PURE__*/function () {
|
|
|
2974
2990
|
case 31:
|
|
2975
2991
|
_context8.prev = 31;
|
|
2976
2992
|
_context8.t2 = _context8["catch"](25);
|
|
2977
|
-
throw new Error(getErrorMessage(
|
|
2993
|
+
throw new Error(getErrorMessage());
|
|
2978
2994
|
case 34:
|
|
2979
|
-
throw new Error(getErrorMessage(
|
|
2995
|
+
throw new Error(getErrorMessage());
|
|
2980
2996
|
case 35:
|
|
2981
|
-
throw new Error(getErrorMessage(
|
|
2997
|
+
throw new Error(getErrorMessage());
|
|
2982
2998
|
case 36:
|
|
2983
2999
|
case "end":
|
|
2984
3000
|
return _context8.stop();
|
|
@@ -3248,10 +3264,7 @@ var useGetCollectionsAndInstanceDetails = function useGetCollectionsAndInstanceD
|
|
|
3248
3264
|
}
|
|
3249
3265
|
});
|
|
3250
3266
|
};
|
|
3251
|
-
var useGetPlotsWithData = function useGetPlotsWithData(plotsWithoutData, selectedLocation, services, splitGeoJsonByCollection, t) {
|
|
3252
|
-
var _useState = useState([]),
|
|
3253
|
-
plotsWithData = _useState[0],
|
|
3254
|
-
setPlotsWithData = _useState[1];
|
|
3267
|
+
var useGetPlotsWithData = function useGetPlotsWithData(plotsWithoutData, selectedLocation, services, splitGeoJsonByCollection, t, syncgroupTimeState) {
|
|
3255
3268
|
// Create array of collections we need to query for the data
|
|
3256
3269
|
var collectionsList = useMemo(function () {
|
|
3257
3270
|
return extractUsedCollections(plotsWithoutData, services);
|
|
@@ -3281,9 +3294,9 @@ var useGetPlotsWithData = function useGetPlotsWithData(plotsWithoutData, selecte
|
|
|
3281
3294
|
};
|
|
3282
3295
|
// Construct timeinterval that needs to be fetched
|
|
3283
3296
|
// Create here so if new data is advertised by the collection/instance a new request is made
|
|
3284
|
-
var intervalParam = constructTimeInterval(collection, instanceInfo);
|
|
3297
|
+
var intervalParam = constructTimeInterval(collection, instanceInfo, syncgroupTimeState);
|
|
3285
3298
|
return {
|
|
3286
|
-
queryKey: generateTimeSeriesQueryKeys(['get-parameter-data', parameter.propertyName, parameter.serviceId, parameter.collectionId, parameter.instanceId || 'undefined', ((_parameter$dimension = parameter.dimension) == null ? void 0 : _parameter$dimension.value) || 'undefined', intervalParam, selectedLocation.lat.toString() || 'undefined', selectedLocation.lon.toString() || 'undefined']),
|
|
3299
|
+
queryKey: generateTimeSeriesQueryKeys(['get-parameter-data', parameter.plotId, parameter.propertyName, parameter.serviceId, parameter.collectionId, parameter.instanceId || 'undefined', ((_parameter$dimension = parameter.dimension) == null ? void 0 : _parameter$dimension.value) || 'undefined', intervalParam, selectedLocation.lat.toString() || 'undefined', selectedLocation.lon.toString() || 'undefined']),
|
|
3287
3300
|
queryFn: function () {
|
|
3288
3301
|
var _queryFn7 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee7() {
|
|
3289
3302
|
var edrResponse;
|
|
@@ -3320,7 +3333,7 @@ var useGetPlotsWithData = function useGetPlotsWithData(plotsWithoutData, selecte
|
|
|
3320
3333
|
retry: false
|
|
3321
3334
|
};
|
|
3322
3335
|
});
|
|
3323
|
-
}, [
|
|
3336
|
+
}, [plotsWithoutData.parameters, collectionsList, collectionDetails, syncgroupTimeState, selectedLocation, isDetailsFetching, geojsonMap]);
|
|
3324
3337
|
var results = useQueries({
|
|
3325
3338
|
queries: queries,
|
|
3326
3339
|
combine: function combine(results) {
|
|
@@ -3332,9 +3345,16 @@ var useGetPlotsWithData = function useGetPlotsWithData(plotsWithoutData, selecte
|
|
|
3332
3345
|
var isFetching = results.some(function (result) {
|
|
3333
3346
|
return result.isFetching;
|
|
3334
3347
|
});
|
|
3335
|
-
var
|
|
3348
|
+
var parameterErrors = {};
|
|
3349
|
+
results.forEach(function (result, index) {
|
|
3336
3350
|
var _result$error;
|
|
3337
|
-
|
|
3351
|
+
if ((_result$error = result.error) != null && _result$error.message) {
|
|
3352
|
+
parameterErrors[index] = result.error.message;
|
|
3353
|
+
}
|
|
3354
|
+
});
|
|
3355
|
+
var errorsWithCount = countBy(results.map(function (result) {
|
|
3356
|
+
var _result$error2;
|
|
3357
|
+
return result == null || (_result$error2 = result.error) == null ? void 0 : _result$error2.message;
|
|
3338
3358
|
}).filter(Boolean));
|
|
3339
3359
|
var errorMessage = Object.entries(errorsWithCount).map(function (_ref) {
|
|
3340
3360
|
var message = _ref[0],
|
|
@@ -3345,17 +3365,38 @@ var useGetPlotsWithData = function useGetPlotsWithData(plotsWithoutData, selecte
|
|
|
3345
3365
|
return {
|
|
3346
3366
|
data: data,
|
|
3347
3367
|
isFetching: isFetching,
|
|
3348
|
-
error: error
|
|
3368
|
+
error: error,
|
|
3369
|
+
parameterErrors: parameterErrors
|
|
3349
3370
|
};
|
|
3350
3371
|
}
|
|
3351
3372
|
});
|
|
3352
|
-
// Combine fetched data with parameters and plots
|
|
3353
|
-
|
|
3373
|
+
// Combine fetched data with parameters and plots, including errors per plot
|
|
3374
|
+
var plotsWithData = useMemo(function () {
|
|
3354
3375
|
var _results$data;
|
|
3355
3376
|
var data = (_results$data = results.data) != null && _results$data.length ? results.data : [];
|
|
3356
|
-
|
|
3357
|
-
|
|
3358
|
-
|
|
3377
|
+
// Create maps of parameter errors and failed parameter names by plotId
|
|
3378
|
+
var plotErrors = {};
|
|
3379
|
+
var failedParametersByPlotId = {};
|
|
3380
|
+
plotsWithoutData.parameters.forEach(function (parameter, index) {
|
|
3381
|
+
var _results$parameterErr;
|
|
3382
|
+
var errorMessage = (_results$parameterErr = results.parameterErrors) == null ? void 0 : _results$parameterErr[index];
|
|
3383
|
+
if (errorMessage) {
|
|
3384
|
+
if (!plotErrors[parameter.plotId]) {
|
|
3385
|
+
plotErrors[parameter.plotId] = [];
|
|
3386
|
+
failedParametersByPlotId[parameter.plotId] = [];
|
|
3387
|
+
}
|
|
3388
|
+
if (!plotErrors[parameter.plotId].includes(errorMessage)) {
|
|
3389
|
+
plotErrors[parameter.plotId].push(errorMessage);
|
|
3390
|
+
}
|
|
3391
|
+
failedParametersByPlotId[parameter.plotId].push({
|
|
3392
|
+
propertyName: parameter.propertyName,
|
|
3393
|
+
serviceId: parameter.serviceId,
|
|
3394
|
+
collectionId: parameter.collectionId
|
|
3395
|
+
});
|
|
3396
|
+
}
|
|
3397
|
+
});
|
|
3398
|
+
return getPlotsWithParameters(plotsWithoutData.plots, combineParametersWithData(plotsWithoutData.parameters, data), plotErrors, failedParametersByPlotId);
|
|
3399
|
+
}, [plotsWithoutData.parameters, plotsWithoutData.plots, results.data, results.parameterErrors]);
|
|
3359
3400
|
return Object.assign({}, results, {
|
|
3360
3401
|
data: plotsWithData
|
|
3361
3402
|
});
|
|
@@ -7595,7 +7636,8 @@ var CalculateTimeSpan = function CalculateTimeSpan(plotsWithData) {
|
|
|
7595
7636
|
var useChartHeight = function useChartHeight(_ref) {
|
|
7596
7637
|
var plotsWithData = _ref.plotsWithData,
|
|
7597
7638
|
shouldShowLegend = _ref.shouldShowLegend,
|
|
7598
|
-
option = _ref.option
|
|
7639
|
+
option = _ref.option,
|
|
7640
|
+
onLegendHeightChange = _ref.onLegendHeightChange;
|
|
7599
7641
|
var getDefaultHeight = function getDefaultHeight(plotsWithData) {
|
|
7600
7642
|
return 100 + PLOT_HEIGHT * plotsWithData.length;
|
|
7601
7643
|
};
|
|
@@ -7621,6 +7663,7 @@ var useChartHeight = function useChartHeight(_ref) {
|
|
|
7621
7663
|
var legendView = echartsInstance.getViewOfComponentModel(legend);
|
|
7622
7664
|
var _legendView$group$get = legendView.group.getBoundingRect(),
|
|
7623
7665
|
height = _legendView$group$get.height;
|
|
7666
|
+
onLegendHeightChange == null || onLegendHeightChange(shouldShowLegend ? height : 0);
|
|
7624
7667
|
var grid = (_option$grid = option.grid) != null ? _option$grid : [];
|
|
7625
7668
|
var gridArray = Array.isArray(grid) ? grid : [];
|
|
7626
7669
|
// eslint-disable-next-line @typescript-eslint/no-unsafe-return
|
|
@@ -7640,7 +7683,7 @@ var useChartHeight = function useChartHeight(_ref) {
|
|
|
7640
7683
|
var newHeight = getDefaultHeight(plotsWithData) + (shouldShowLegend ? height : 0);
|
|
7641
7684
|
setChartHeight(newHeight);
|
|
7642
7685
|
echartsInstance.resize();
|
|
7643
|
-
}, [option.grid, plotsWithData, shouldShowLegend]);
|
|
7686
|
+
}, [option.grid, plotsWithData, shouldShowLegend, onLegendHeightChange]);
|
|
7644
7687
|
React.useEffect(function () {
|
|
7645
7688
|
var onHeight = function onHeight() {
|
|
7646
7689
|
var _chartRef$current2;
|
|
@@ -7660,24 +7703,58 @@ var useChartHeight = function useChartHeight(_ref) {
|
|
|
7660
7703
|
updateHeight: updateHeight
|
|
7661
7704
|
};
|
|
7662
7705
|
};
|
|
7706
|
+
var applyDataZoomState = function applyDataZoomState(option, dataZoomState) {
|
|
7707
|
+
if (!dataZoomState || !(option != null && option.dataZoom) || !Array.isArray(option.dataZoom)) {
|
|
7708
|
+
return option;
|
|
7709
|
+
}
|
|
7710
|
+
return Object.assign({}, option, {
|
|
7711
|
+
dataZoom: option.dataZoom.map(function (dz) {
|
|
7712
|
+
return Object.assign({}, dz, {
|
|
7713
|
+
start: dataZoomState.start,
|
|
7714
|
+
end: dataZoomState.end
|
|
7715
|
+
});
|
|
7716
|
+
})
|
|
7717
|
+
});
|
|
7718
|
+
};
|
|
7719
|
+
var extractDataZoomState = function extractDataZoomState(params) {
|
|
7720
|
+
if (params.batch && params.batch.length > 0) {
|
|
7721
|
+
return {
|
|
7722
|
+
start: params.batch[0].start,
|
|
7723
|
+
end: params.batch[0].end
|
|
7724
|
+
};
|
|
7725
|
+
}
|
|
7726
|
+
if (params.start !== undefined && params.end !== undefined) {
|
|
7727
|
+
return {
|
|
7728
|
+
start: params.start,
|
|
7729
|
+
end: params.end
|
|
7730
|
+
};
|
|
7731
|
+
}
|
|
7732
|
+
return null;
|
|
7733
|
+
};
|
|
7663
7734
|
var TimeSeriesChart = function TimeSeriesChart(_ref2) {
|
|
7664
7735
|
var plotsWithData = _ref2.plotsWithData,
|
|
7665
7736
|
_ref2$animation = _ref2.animation,
|
|
7666
7737
|
animation = _ref2$animation === void 0 ? false : _ref2$animation,
|
|
7667
7738
|
_ref2$shouldShowLegen = _ref2.shouldShowLegend,
|
|
7668
7739
|
shouldShowLegend = _ref2$shouldShowLegen === void 0 ? true : _ref2$shouldShowLegen,
|
|
7669
|
-
onToggleLegendParam = _ref2.onToggleLegendParam
|
|
7740
|
+
onToggleLegendParam = _ref2.onToggleLegendParam,
|
|
7741
|
+
onLegendHeightChange = _ref2.onLegendHeightChange;
|
|
7670
7742
|
var _useThemeContext = useThemeContext(),
|
|
7671
7743
|
namedTheme = _useThemeContext.namedTheme;
|
|
7672
7744
|
var isDark = (namedTheme == null ? void 0 : namedTheme.theme.palette.mode) === 'dark';
|
|
7745
|
+
var dataZoomStateRef = React.useRef(null);
|
|
7673
7746
|
var enabledPlots = plotsWithData.filter(function (plot) {
|
|
7674
7747
|
return plot.enabled === undefined || plot.enabled;
|
|
7675
7748
|
});
|
|
7676
7749
|
var option = getOption(enabledPlots);
|
|
7750
|
+
var optionWithZoom = React.useMemo(function () {
|
|
7751
|
+
return applyDataZoomState(option, dataZoomStateRef.current);
|
|
7752
|
+
}, [option]);
|
|
7677
7753
|
var _useChartHeight = useChartHeight({
|
|
7678
7754
|
plotsWithData: enabledPlots,
|
|
7679
7755
|
shouldShowLegend: shouldShowLegend,
|
|
7680
|
-
option:
|
|
7756
|
+
option: optionWithZoom,
|
|
7757
|
+
onLegendHeightChange: onLegendHeightChange
|
|
7681
7758
|
}),
|
|
7682
7759
|
chartHeight = _useChartHeight.chartHeight,
|
|
7683
7760
|
chartRef = _useChartHeight.chartRef,
|
|
@@ -7690,6 +7767,12 @@ var TimeSeriesChart = function TimeSeriesChart(_ref2) {
|
|
|
7690
7767
|
// noop, prevent flickering when toggling legend
|
|
7691
7768
|
onEvents: {
|
|
7692
7769
|
finished: function finished() {},
|
|
7770
|
+
datazoom: function datazoom(params) {
|
|
7771
|
+
var newState = extractDataZoomState(params);
|
|
7772
|
+
if (newState) {
|
|
7773
|
+
dataZoomStateRef.current = newState;
|
|
7774
|
+
}
|
|
7775
|
+
},
|
|
7693
7776
|
legendselectchanged: function legendselectchanged(params) {
|
|
7694
7777
|
if (!option.legend) {
|
|
7695
7778
|
return;
|
|
@@ -7702,7 +7785,7 @@ var TimeSeriesChart = function TimeSeriesChart(_ref2) {
|
|
|
7702
7785
|
}
|
|
7703
7786
|
}
|
|
7704
7787
|
},
|
|
7705
|
-
option: Object.assign({},
|
|
7788
|
+
option: Object.assign({}, optionWithZoom, {
|
|
7706
7789
|
animation: animation
|
|
7707
7790
|
}),
|
|
7708
7791
|
ref: chartRef,
|
|
@@ -7716,49 +7799,182 @@ var TimeSeriesChart = function TimeSeriesChart(_ref2) {
|
|
|
7716
7799
|
}) : null;
|
|
7717
7800
|
};
|
|
7718
7801
|
|
|
7719
|
-
var
|
|
7720
|
-
|
|
7721
|
-
|
|
7722
|
-
|
|
7723
|
-
|
|
7724
|
-
|
|
7725
|
-
|
|
7726
|
-
|
|
7727
|
-
|
|
7802
|
+
var getParameterKey = function getParameterKey(param) {
|
|
7803
|
+
return param.serviceId + "|" + param.collectionId + "|" + param.propertyName;
|
|
7804
|
+
};
|
|
7805
|
+
var PlotErrorBanners = function PlotErrorBanners(_ref) {
|
|
7806
|
+
var plotsWithData = _ref.plotsWithData,
|
|
7807
|
+
parametersFailingInAllPlots = _ref.parametersFailingInAllPlots,
|
|
7808
|
+
legendHeight = _ref.legendHeight,
|
|
7809
|
+
getErrorTitle = _ref.getErrorTitle,
|
|
7810
|
+
getErrorTranslationKey = _ref.getErrorTranslationKey,
|
|
7811
|
+
t = _ref.t;
|
|
7812
|
+
return jsx(Fragment, {
|
|
7813
|
+
children: plotsWithData.map(function (plot, index) {
|
|
7814
|
+
var _plot$failedParameter, _plot$errors;
|
|
7815
|
+
var parametersFailingKeys = new Set(parametersFailingInAllPlots.map(getParameterKey));
|
|
7816
|
+
var plotSpecificFailedParameters = ((_plot$failedParameter = plot.failedParameters) == null ? void 0 : _plot$failedParameter.filter(function (param) {
|
|
7817
|
+
return !parametersFailingKeys.has(getParameterKey(param));
|
|
7818
|
+
})) || [];
|
|
7819
|
+
if (plotSpecificFailedParameters.length === 0) {
|
|
7820
|
+
return null;
|
|
7821
|
+
}
|
|
7822
|
+
var errorTitle = getErrorTitle(plotSpecificFailedParameters);
|
|
7823
|
+
var errorKey = ((_plot$errors = plot.errors) == null ? void 0 : _plot$errors[0]) || 'error-message-general';
|
|
7824
|
+
var translationKey = getErrorTranslationKey(errorKey, plotSpecificFailedParameters.length);
|
|
7825
|
+
var errorInfo = t(translationKey);
|
|
7826
|
+
return jsx(Box, {
|
|
7827
|
+
sx: {
|
|
7828
|
+
position: 'absolute',
|
|
7829
|
+
top: legendHeight + PLOT_HEIGHT * index + 35,
|
|
7830
|
+
left: 0,
|
|
7831
|
+
right: 0,
|
|
7832
|
+
zIndex: 10,
|
|
7833
|
+
pointerEvents: 'none'
|
|
7834
|
+
},
|
|
7835
|
+
children: jsx(Box, {
|
|
7836
|
+
sx: {
|
|
7837
|
+
pointerEvents: 'auto'
|
|
7838
|
+
},
|
|
7839
|
+
children: jsx(AlertBanner, {
|
|
7840
|
+
info: errorInfo,
|
|
7841
|
+
shouldClose: true,
|
|
7842
|
+
title: errorTitle
|
|
7843
|
+
})
|
|
7844
|
+
})
|
|
7845
|
+
}, "error-" + plot.plotId);
|
|
7846
|
+
})
|
|
7847
|
+
});
|
|
7848
|
+
};
|
|
7849
|
+
var TimeSeriesView = /*#__PURE__*/React.memo(function (_ref2) {
|
|
7850
|
+
var plotPreset = _ref2.plotPreset,
|
|
7851
|
+
selectedLocation = _ref2.selectedLocation,
|
|
7852
|
+
services = _ref2.services,
|
|
7853
|
+
splitGeoJsonByCollection = _ref2.splitGeoJsonByCollection,
|
|
7854
|
+
isLoading = _ref2.isLoading,
|
|
7855
|
+
_ref2$shouldShowLegen = _ref2.shouldShowLegend,
|
|
7856
|
+
shouldShowLegend = _ref2$shouldShowLegen === void 0 ? true : _ref2$shouldShowLegen,
|
|
7857
|
+
onToggleLegendParam = _ref2.onToggleLegendParam,
|
|
7858
|
+
syncgroupTimeState = _ref2.syncgroupTimeState;
|
|
7728
7859
|
var _useTimeseriesTransla = useTimeseriesTranslation(),
|
|
7729
7860
|
t = _useTimeseriesTransla.t;
|
|
7730
|
-
var
|
|
7861
|
+
var _React$useState = React.useState(0),
|
|
7862
|
+
legendHeight = _React$useState[0],
|
|
7863
|
+
setLegendHeight = _React$useState[1];
|
|
7864
|
+
var _useGetPlotsWithData = useGetPlotsWithData(plotPreset, selectedLocation, services, splitGeoJsonByCollection, t, syncgroupTimeState),
|
|
7731
7865
|
plotsWithData = _useGetPlotsWithData.data,
|
|
7732
|
-
isFetchingPlots = _useGetPlotsWithData.isFetching
|
|
7733
|
-
error = _useGetPlotsWithData.error;
|
|
7866
|
+
isFetchingPlots = _useGetPlotsWithData.isFetching;
|
|
7734
7867
|
React.useEffect(function () {
|
|
7735
7868
|
if (isLoading) {
|
|
7736
7869
|
isLoading(isFetchingPlots);
|
|
7737
7870
|
}
|
|
7738
7871
|
}, [isFetchingPlots, isLoading]);
|
|
7739
|
-
|
|
7872
|
+
var getErrorTitle = function getErrorTitle(parameters) {
|
|
7873
|
+
var propertyNames = parameters.map(function (param) {
|
|
7874
|
+
return param.propertyName;
|
|
7875
|
+
});
|
|
7876
|
+
if (propertyNames.length > 1) {
|
|
7877
|
+
return "\"" + propertyNames.join('", "') + "\"";
|
|
7878
|
+
}
|
|
7879
|
+
return "\"" + (propertyNames[0] || '') + "\"";
|
|
7880
|
+
};
|
|
7881
|
+
var getErrorTranslationKey = function getErrorTranslationKey(errorKey, parameterCount) {
|
|
7882
|
+
// Use plural translation only when multiple parameters fail with error-message-general
|
|
7883
|
+
return errorKey === 'error-message-general' && parameterCount > 1 ? 'error-message-general-plural' : errorKey;
|
|
7884
|
+
};
|
|
7885
|
+
var getCombinedErrorInfo = React.useCallback(function (parametersFailingInAllPlots, plotsWithData, totalPlotCount) {
|
|
7886
|
+
var _plotsWithData$;
|
|
7887
|
+
if (parametersFailingInAllPlots.length === 0 || totalPlotCount === 0) {
|
|
7888
|
+
return '';
|
|
7889
|
+
}
|
|
7890
|
+
var errorKey = (plotsWithData == null || (_plotsWithData$ = plotsWithData[0]) == null || (_plotsWithData$ = _plotsWithData$.errors) == null ? void 0 : _plotsWithData$[0]) || 'error-message-general';
|
|
7891
|
+
var translationKey = getErrorTranslationKey(errorKey, parametersFailingInAllPlots.length);
|
|
7892
|
+
var errorMessage = t(translationKey);
|
|
7893
|
+
return totalPlotCount === 1 ? errorMessage : t('all-plots') + ": " + errorMessage;
|
|
7894
|
+
}, [t]);
|
|
7895
|
+
var getParametersFailingInAllPlots = function getParametersFailingInAllPlots(plotsWithData, totalPlotCount) {
|
|
7896
|
+
if (!plotsWithData || totalPlotCount === 0) {
|
|
7897
|
+
return [];
|
|
7898
|
+
}
|
|
7899
|
+
var parameterCounts = {};
|
|
7900
|
+
plotsWithData.forEach(function (plot) {
|
|
7901
|
+
var _plot$failedParameter2;
|
|
7902
|
+
(_plot$failedParameter2 = plot.failedParameters) == null || _plot$failedParameter2.forEach(function (param) {
|
|
7903
|
+
var key = getParameterKey(param);
|
|
7904
|
+
if (parameterCounts[key]) {
|
|
7905
|
+
parameterCounts[key].count += 1;
|
|
7906
|
+
} else {
|
|
7907
|
+
parameterCounts[key] = {
|
|
7908
|
+
count: 1,
|
|
7909
|
+
param: param
|
|
7910
|
+
};
|
|
7911
|
+
}
|
|
7912
|
+
});
|
|
7913
|
+
});
|
|
7914
|
+
return Object.values(parameterCounts).filter(function (_ref3) {
|
|
7915
|
+
var count = _ref3.count;
|
|
7916
|
+
return count === totalPlotCount;
|
|
7917
|
+
}).map(function (_ref4) {
|
|
7918
|
+
var param = _ref4.param;
|
|
7919
|
+
return param;
|
|
7920
|
+
});
|
|
7921
|
+
};
|
|
7922
|
+
var totalPlotCount = (plotsWithData == null ? void 0 : plotsWithData.length) || 0;
|
|
7923
|
+
var parametersFailingInAllPlots = React.useMemo(function () {
|
|
7924
|
+
return getParametersFailingInAllPlots(plotsWithData, totalPlotCount);
|
|
7925
|
+
}, [plotsWithData, totalPlotCount]);
|
|
7926
|
+
var hasParametersFailingInAllPlots = parametersFailingInAllPlots.length > 0;
|
|
7927
|
+
var combinedErrorTitle = getErrorTitle(parametersFailingInAllPlots);
|
|
7928
|
+
var combinedErrorInfo = React.useMemo(function () {
|
|
7929
|
+
return hasParametersFailingInAllPlots ? getCombinedErrorInfo(parametersFailingInAllPlots, plotsWithData, totalPlotCount) : '';
|
|
7930
|
+
}, [getCombinedErrorInfo, hasParametersFailingInAllPlots, parametersFailingInAllPlots, plotsWithData, totalPlotCount]);
|
|
7931
|
+
return jsxs(Box, {
|
|
7740
7932
|
"data-testid": "TimeSeriesView",
|
|
7741
|
-
|
|
7742
|
-
|
|
7743
|
-
|
|
7744
|
-
|
|
7745
|
-
|
|
7746
|
-
|
|
7747
|
-
|
|
7748
|
-
|
|
7749
|
-
|
|
7750
|
-
|
|
7751
|
-
|
|
7752
|
-
|
|
7753
|
-
|
|
7933
|
+
children: [hasParametersFailingInAllPlots ? jsx(Card, {
|
|
7934
|
+
sx: {
|
|
7935
|
+
border: 'solid 1px',
|
|
7936
|
+
borderColor: 'geowebColors.cards.cardContainerBorder',
|
|
7937
|
+
boxShadow: 'none'
|
|
7938
|
+
},
|
|
7939
|
+
children: jsx(Box, {
|
|
7940
|
+
"data-testid": "TimeSeriesView-alert-banner",
|
|
7941
|
+
children: jsx(AlertBanner, {
|
|
7942
|
+
info: combinedErrorInfo,
|
|
7943
|
+
shouldClose: true,
|
|
7944
|
+
title: combinedErrorTitle
|
|
7945
|
+
})
|
|
7946
|
+
})
|
|
7947
|
+
}) : null, !!plotsWithData && plotsWithData.length > 0 && jsxs(Card, {
|
|
7948
|
+
sx: {
|
|
7949
|
+
border: 'solid 1px',
|
|
7950
|
+
borderColor: 'geowebColors.cards.cardContainerBorder',
|
|
7951
|
+
boxShadow: 'none',
|
|
7952
|
+
position: 'relative'
|
|
7953
|
+
},
|
|
7954
|
+
children: [!!plotsWithData && plotsWithData.length > 0 && jsx(PlotErrorBanners, {
|
|
7955
|
+
getErrorTitle: getErrorTitle,
|
|
7956
|
+
getErrorTranslationKey: getErrorTranslationKey,
|
|
7957
|
+
legendHeight: legendHeight,
|
|
7958
|
+
parametersFailingInAllPlots: parametersFailingInAllPlots,
|
|
7959
|
+
plotsWithData: plotsWithData,
|
|
7960
|
+
t: t
|
|
7961
|
+
}), jsx(TimeSeriesChart, {
|
|
7962
|
+
onLegendHeightChange: setLegendHeight,
|
|
7963
|
+
onToggleLegendParam: onToggleLegendParam,
|
|
7964
|
+
plotsWithData: plotsWithData,
|
|
7965
|
+
shouldShowLegend: shouldShowLegend
|
|
7966
|
+
})]
|
|
7754
7967
|
})]
|
|
7755
7968
|
});
|
|
7756
7969
|
}, function (previousProps, nextProps) {
|
|
7970
|
+
var _previousProps$syncgr, _nextProps$syncgroupT, _previousProps$syncgr2, _nextProps$syncgroupT2;
|
|
7757
7971
|
var samePreset = previousProps.plotPreset === nextProps.plotPreset;
|
|
7758
7972
|
var sameLocation = isEqual(previousProps.selectedLocation, nextProps.selectedLocation);
|
|
7759
7973
|
var sameGeoJson = isEqual(previousProps.splitGeoJsonByCollection, nextProps.splitGeoJsonByCollection);
|
|
7760
7974
|
var sameLegend = previousProps.shouldShowLegend === nextProps.shouldShowLegend;
|
|
7761
|
-
|
|
7975
|
+
var sameServices = isEqual(previousProps.services, nextProps.services);
|
|
7976
|
+
var sameTime = ((_previousProps$syncgr = previousProps.syncgroupTimeState) == null ? void 0 : _previousProps$syncgr.start) === ((_nextProps$syncgroupT = nextProps.syncgroupTimeState) == null ? void 0 : _nextProps$syncgroupT.start) && ((_previousProps$syncgr2 = previousProps.syncgroupTimeState) == null ? void 0 : _previousProps$syncgr2.end) === ((_nextProps$syncgroupT2 = nextProps.syncgroupTimeState) == null ? void 0 : _nextProps$syncgroupT2.end);
|
|
7977
|
+
return samePreset && sameLocation && sameGeoJson && sameLegend && sameServices && sameTime;
|
|
7762
7978
|
});
|
|
7763
7979
|
|
|
7764
7980
|
var TOOLTIP_TITLE = 'Timeseries Manager';
|
|
@@ -8089,6 +8305,7 @@ var TimeSeriesConnect = function TimeSeriesConnect(_ref3) {
|
|
|
8089
8305
|
panelId: panelId
|
|
8090
8306
|
}));
|
|
8091
8307
|
};
|
|
8308
|
+
var syncgroupTimeState = useSyncgroupTimeState(panelId, 1000);
|
|
8092
8309
|
return jsxs(Stack, {
|
|
8093
8310
|
"data-testid": "TimeSeriesConnect",
|
|
8094
8311
|
sx: {
|
|
@@ -8152,7 +8369,8 @@ var TimeSeriesConnect = function TimeSeriesConnect(_ref3) {
|
|
|
8152
8369
|
selectedLocation: timeSeriesLocation,
|
|
8153
8370
|
services: services,
|
|
8154
8371
|
shouldShowLegend: shouldShowLegend,
|
|
8155
|
-
splitGeoJsonByCollection: geoJSONWithService || []
|
|
8372
|
+
splitGeoJsonByCollection: geoJSONWithService || [],
|
|
8373
|
+
syncgroupTimeState: syncgroupTimeState
|
|
8156
8374
|
})
|
|
8157
8375
|
})]
|
|
8158
8376
|
});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@opengeoweb/time-series",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "16.0.0",
|
|
4
4
|
"description": "GeoWeb time-series library for the opengeoweb project",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"repository": {
|
|
@@ -9,25 +9,25 @@
|
|
|
9
9
|
},
|
|
10
10
|
"dependencies": {
|
|
11
11
|
"immer": "^10.0.3",
|
|
12
|
-
"@opengeoweb/shared": "
|
|
12
|
+
"@opengeoweb/shared": "16.0.0",
|
|
13
13
|
"@reduxjs/toolkit": "^2.6.1",
|
|
14
14
|
"react-redux": "^9.2.0",
|
|
15
|
-
"@opengeoweb/webmap": "
|
|
16
|
-
"@opengeoweb/webmap-react": "
|
|
15
|
+
"@opengeoweb/webmap": "16.0.0",
|
|
16
|
+
"@opengeoweb/webmap-react": "16.0.0",
|
|
17
17
|
"lodash": "^4.17.21",
|
|
18
|
-
"@opengeoweb/api": "
|
|
19
|
-
"@opengeoweb/theme": "
|
|
20
|
-
"@opengeoweb/store": "
|
|
18
|
+
"@opengeoweb/api": "16.0.0",
|
|
19
|
+
"@opengeoweb/theme": "16.0.0",
|
|
20
|
+
"@opengeoweb/store": "16.0.0",
|
|
21
21
|
"echarts-for-react": "^3.0.2",
|
|
22
22
|
"echarts": "^5.4.3",
|
|
23
23
|
"react-sortablejs": "^6.1.4",
|
|
24
|
-
"@opengeoweb/snackbar": "
|
|
24
|
+
"@opengeoweb/snackbar": "16.0.0",
|
|
25
25
|
"react-window": "^2.2.6",
|
|
26
26
|
"msw": "^2.7.3",
|
|
27
27
|
"i18next": "^25.0.1",
|
|
28
28
|
"react-i18next": "^15.1.1",
|
|
29
|
-
"@opengeoweb/core": "
|
|
30
|
-
"@opengeoweb/form-fields": "
|
|
29
|
+
"@opengeoweb/core": "16.0.0",
|
|
30
|
+
"@opengeoweb/form-fields": "16.0.0",
|
|
31
31
|
"@mui/material": "^7.0.1",
|
|
32
32
|
"react-hook-form": "^7.61.1",
|
|
33
33
|
"uuid": "^10.0.0",
|
|
@@ -35,6 +35,7 @@ export declare const TimeSeriesEDRNetherlandsObsDemo: {
|
|
|
35
35
|
}[];
|
|
36
36
|
};
|
|
37
37
|
};
|
|
38
|
+
export declare const TimeSeriesEDRNetherlandsObsDemoWithSyncGroup: () => React.ReactElement;
|
|
38
39
|
export declare const TimeSeriesUKDemo: () => React.ReactElement;
|
|
39
40
|
declare const _default: {
|
|
40
41
|
title: string;
|
|
@@ -1,18 +1,33 @@
|
|
|
1
1
|
import type { EChartsInstance, EChartsOption } from 'echarts-for-react';
|
|
2
2
|
import React from 'react';
|
|
3
3
|
import type { PlotWithData } from './types';
|
|
4
|
-
export declare const useChartHeight: ({ plotsWithData, shouldShowLegend, option, }: {
|
|
4
|
+
export declare const useChartHeight: ({ plotsWithData, shouldShowLegend, option, onLegendHeightChange, }: {
|
|
5
5
|
plotsWithData: PlotWithData[];
|
|
6
6
|
shouldShowLegend: boolean;
|
|
7
7
|
option: EChartsOption;
|
|
8
|
+
onLegendHeightChange?: (height: number) => void;
|
|
8
9
|
}) => {
|
|
9
10
|
chartHeight: number;
|
|
10
11
|
chartRef: React.RefObject<EChartsInstance>;
|
|
11
12
|
updateHeight: (echartsInstance: EChartsInstance) => void;
|
|
12
13
|
};
|
|
14
|
+
export interface DataZoomState {
|
|
15
|
+
start: number;
|
|
16
|
+
end: number;
|
|
17
|
+
}
|
|
18
|
+
export declare const applyDataZoomState: (option: EChartsOption, dataZoomState: DataZoomState | null) => EChartsOption;
|
|
19
|
+
export declare const extractDataZoomState: (params: {
|
|
20
|
+
start?: number;
|
|
21
|
+
end?: number;
|
|
22
|
+
batch?: {
|
|
23
|
+
start: number;
|
|
24
|
+
end: number;
|
|
25
|
+
}[];
|
|
26
|
+
}) => DataZoomState | null;
|
|
13
27
|
export declare const TimeSeriesChart: React.FC<{
|
|
14
28
|
plotsWithData: PlotWithData[];
|
|
15
29
|
animation?: boolean;
|
|
16
30
|
shouldShowLegend?: boolean;
|
|
17
31
|
onToggleLegendParam?: (legendId: string) => void;
|
|
32
|
+
onLegendHeightChange?: (height: number) => void;
|
|
18
33
|
}>;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import type { PlotPreset, TimeSeriesService } from '@opengeoweb/shared';
|
|
3
|
+
import type { TimeSliderStartEndStep } from '@opengeoweb/store';
|
|
3
4
|
import type { PointerLocation, GeoJsonWithService } from './types';
|
|
4
5
|
interface TimeSeriesViewProps {
|
|
5
6
|
plotPreset: PlotPreset;
|
|
@@ -9,6 +10,7 @@ interface TimeSeriesViewProps {
|
|
|
9
10
|
isLoading?: (startOrFinish: boolean) => void;
|
|
10
11
|
shouldShowLegend?: boolean;
|
|
11
12
|
onToggleLegendParam?: (legendId: string) => void;
|
|
13
|
+
syncgroupTimeState?: TimeSliderStartEndStep;
|
|
12
14
|
}
|
|
13
15
|
export declare const TimeSeriesView: React.FC<TimeSeriesViewProps>;
|
|
14
16
|
export {};
|
|
@@ -10,6 +10,11 @@ export interface Properties {
|
|
|
10
10
|
propertyName: string;
|
|
11
11
|
values: number[];
|
|
12
12
|
}
|
|
13
|
+
export interface FailedParameterInfo {
|
|
14
|
+
propertyName: string;
|
|
15
|
+
serviceId: string;
|
|
16
|
+
collectionId: string;
|
|
17
|
+
}
|
|
13
18
|
export interface UseGetLocationReturnTypeProperties {
|
|
14
19
|
name?: string;
|
|
15
20
|
detail?: string;
|
|
@@ -47,6 +52,8 @@ export interface Plot {
|
|
|
47
52
|
}
|
|
48
53
|
export interface PlotWithData extends Plot {
|
|
49
54
|
parametersWithData: ParameterWithData[];
|
|
55
|
+
errors?: string[];
|
|
56
|
+
failedParameters?: FailedParameterInfo[];
|
|
50
57
|
}
|
|
51
58
|
export type PlotType = 'bar' | 'line' | 'scatter';
|
|
52
59
|
export interface Parameter {
|
|
@@ -1,12 +1,16 @@
|
|
|
1
1
|
import type { FeatureCollection, GeometryObject } from 'geojson';
|
|
2
2
|
import type { Plot, PlotParameter, PlotPreset, TimeSeriesService } from '@opengeoweb/shared';
|
|
3
3
|
import type { syncGroupsTypes } from '@opengeoweb/store';
|
|
4
|
-
import type { EDRPositionResponse, EDRPositionResponseCoverageCollection, GeoJsonWithService, Parameter, ParameterWithData, PlotWithData, PointerLocation, TimeSeriesLocation, UseGetLocationReturnTypeProperties } from './types';
|
|
4
|
+
import type { EDRPositionResponse, EDRPositionResponseCoverageCollection, FailedParameterInfo, GeoJsonWithService, Parameter, ParameterWithData, PlotWithData, PointerLocation, TimeSeriesLocation, UseGetLocationReturnTypeProperties } from './types';
|
|
5
|
+
/** Maps plot ID to array of error message strings */
|
|
6
|
+
export type PlotErrorsMap = Record<Plot['plotId'], string[]>;
|
|
7
|
+
/** Maps plot ID to array of failed parameter information */
|
|
8
|
+
export type FailedParametersMap = Record<Plot['plotId'], FailedParameterInfo[]>;
|
|
5
9
|
export declare const createGeoJsonArrays: (locations: (FeatureCollection<GeometryObject, UseGetLocationReturnTypeProperties> | undefined)[], services: TimeSeriesService[] | undefined, hideFeatures: boolean, memoizedSelectedFeature: TimeSeriesLocation | null) => {
|
|
6
10
|
combinedGeoJson: FeatureCollection<GeometryObject, syncGroupsTypes.PotentialDataProperties>;
|
|
7
11
|
};
|
|
8
12
|
export declare const getNearbyLocation: (parameter: Parameter, service: TimeSeriesService, selectedLocation: PointerLocation, geojsonMap: Map<string, GeoJsonWithService>) => TimeSeriesLocation | null;
|
|
9
|
-
export declare const getPlotsWithParameters: (plots: Plot[], parameters: ParameterWithData[]) => PlotWithData[];
|
|
13
|
+
export declare const getPlotsWithParameters: (plots: Plot[], parameters: ParameterWithData[], plotErrors?: PlotErrorsMap, failedParameters?: FailedParametersMap) => PlotWithData[];
|
|
10
14
|
export declare function consolidateFeatures<P>(features: {
|
|
11
15
|
id: string;
|
|
12
16
|
geoJSON: FeatureCollection<GeometryObject, P>;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type { Feature, Geometry, GeometryObject, Position } from 'geojson';
|
|
2
|
-
import type {
|
|
2
|
+
import type { TimeSeriesService } from '@opengeoweb/shared';
|
|
3
|
+
import type { TimeSliderStartEndStep } from '@opengeoweb/store';
|
|
3
4
|
import { MapFeatureClass } from '@opengeoweb/webmap-react';
|
|
4
5
|
import type { EDRCollection, EDRInstance, EDRParameter, Parameter, PointerLocation, SelectParameter } from '../components/TimeSeries/types';
|
|
5
6
|
import type { TimeseriesCollectionDetail } from '../components/TimeSeriesSelect/utils';
|
|
@@ -44,7 +45,7 @@ export declare const getDetailsForCollectionId: (collections: TimeseriesCollecti
|
|
|
44
45
|
* @returns Clipped EDR interval, e.g. ["startdate_as_isostring","enddate_as_isostring"]
|
|
45
46
|
*/
|
|
46
47
|
export declare const clipEdrInterval: (interval: string[] | undefined, maxHoursBefore?: number, maxHoursAfter?: number, date?: number) => [string, string];
|
|
47
|
-
export declare const constructTimeInterval: (collection: TimeseriesCollectionDetail | undefined, instance: EDRInstance,
|
|
48
|
+
export declare const constructTimeInterval: (collection: TimeseriesCollectionDetail | undefined, instance: EDRInstance, syncgroupTimeState?: TimeSliderStartEndStep) => string;
|
|
48
49
|
/**
|
|
49
50
|
* Find nearest point to the target location in timeseries.
|
|
50
51
|
* Uses equirectangular distance approximation which is not accurate for long
|
|
@@ -2,6 +2,7 @@ import type { UseQueryResult } from '@tanstack/react-query';
|
|
|
2
2
|
import type { FeatureCollection, Geometry } from 'geojson';
|
|
3
3
|
import type { TFunction } from 'i18next';
|
|
4
4
|
import type { PlotPreset, TimeSeriesService } from '@opengeoweb/shared';
|
|
5
|
+
import type { TimeSliderStartEndStep } from '@opengeoweb/store';
|
|
5
6
|
import type { EDRServiceInformation } from './api';
|
|
6
7
|
import type { EDRCollection, EDRInstance, GeoJsonWithService, PlotWithData, PointerLocation, UseGetLocationReturnTypeProperties } from '../../components/TimeSeries/types';
|
|
7
8
|
import type { ParameterCollectionQueryData } from '../../components/TimeSeries/utils';
|
|
@@ -10,6 +11,7 @@ interface CombinedResult<T> {
|
|
|
10
11
|
data: T | undefined;
|
|
11
12
|
isFetching: boolean;
|
|
12
13
|
error: Error | null | undefined;
|
|
14
|
+
parameterErrors?: Record<number, string>;
|
|
13
15
|
}
|
|
14
16
|
export declare const timeseriesEDRQueryOptions: {
|
|
15
17
|
readonly getServiceInformationQuery: (serviceUrl: string) => import("@tanstack/react-query").OmitKeyof<import("@tanstack/react-query").UseQueryOptions<EDRServiceInformation, Error, EDRServiceInformation, string[]>, "queryFn"> & {
|
|
@@ -51,7 +53,7 @@ export declare const useGetDetailsForCollection: (service: TimeSeriesService, co
|
|
|
51
53
|
export declare const useGetInstances: (serviceUrl: string, collectionId: string, supportsInstances?: boolean) => UseQueryResult<EDRInstance[]>;
|
|
52
54
|
export declare const useGetServiceCollectionDetails: (services: TimeSeriesService[], isOpen: boolean) => CombinedResult<TimeseriesCollectionDetail[]>;
|
|
53
55
|
export declare const useGetCollectionsAndInstanceDetails: (queryData: Record<string, ParameterCollectionQueryData>) => CombinedResult<TimeseriesCollectionDetail[]>;
|
|
54
|
-
export declare const useGetPlotsWithData: (plotsWithoutData: PlotPreset, selectedLocation: PointerLocation, services: TimeSeriesService[], splitGeoJsonByCollection: GeoJsonWithService[], t: TFunction) => {
|
|
56
|
+
export declare const useGetPlotsWithData: (plotsWithoutData: PlotPreset, selectedLocation: PointerLocation, services: TimeSeriesService[], splitGeoJsonByCollection: GeoJsonWithService[], t: TFunction, syncgroupTimeState?: TimeSliderStartEndStep) => {
|
|
55
57
|
data: PlotWithData[] | undefined;
|
|
56
58
|
isFetching: boolean;
|
|
57
59
|
error: Error | null | undefined;
|