@opengeoweb/time-series 21.1.0 → 21.2.0-nightly-20261114
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/dist/index.esm.js +1265 -355
- package/dist/src/lib/components/TimeSeries/{CurrentTime → TimeIndicators}/CurrentTime.d.ts +0 -8
- package/dist/src/lib/components/TimeSeries/TimeIndicators/SelectedTime.d.ts +13 -0
- package/dist/src/lib/components/TimeSeries/TimeIndicators/index.d.ts +3 -0
- package/dist/src/lib/components/TimeSeries/TimeIndicators/timeIndicatorUtils.d.ts +13 -0
- package/dist/src/lib/components/TimeSeries/TimeSeriesChart.d.ts +7 -1
- package/dist/src/lib/components/TimeSeries/TimeSeriesView.d.ts +2 -2
- package/dist/src/lib/components/TimeSeries/chartUtils.d.ts +1 -2
- package/dist/src/lib/components/TimeSeries/hoverLabelUtils.d.ts +53 -0
- package/dist/src/lib/components/TimeSeries/types.d.ts +6 -0
- package/dist/src/lib/components/TimeSeriesManager/MissingUnitWarningConnect.d.ts +8 -0
- package/dist/src/lib/components/TimeSeriesSelect/TimeSeriesSelectList.d.ts +2 -1
- package/dist/src/lib/components/TimeSeriesSelect/utils.d.ts +4 -0
- package/dist/src/lib/index.d.ts +3 -0
- package/dist/src/lib/store/reducer.d.ts +8 -1
- package/dist/src/lib/store/selectors.d.ts +22 -0
- package/dist/src/lib/store/types.d.ts +12 -1
- package/dist/src/lib/utils/timeseries-api/collectionTarget.d.ts +16 -0
- package/package.json +12 -12
- package/dist/src/lib/components/TimeSeries/CurrentTime/index.d.ts +0 -1
package/dist/index.esm.js
CHANGED
|
@@ -1,33 +1,36 @@
|
|
|
1
1
|
import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
|
|
2
2
|
import React, { useCallback, useMemo, useState, useEffect, memo } from 'react';
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
3
|
+
import { useSelector, useDispatch } from 'react-redux';
|
|
4
|
+
import { dateUtils, CustomTooltip, CustomIconButton, TooltipSelect, referenceTimeUtils, CustomAccordion, CustomToggleButton, ToggleMenu, ToolContainerDraggable, CustomDialog, SearchField, SearchHighlight, AlertBanner, useConfirmationDialog, SwitchButton, ResizablePanel, SortablePanels, LegendToggleButton, useResizeObserver } from '@opengeoweb/shared';
|
|
5
5
|
import { snackbarActions, snackbarTypes, snackbarListener, snackbarReducer } from '@opengeoweb/snackbar';
|
|
6
6
|
import { mapUtils, selectorMemoizationOptions, genericSelectors, uiSelectors, uiTypes, uiActions, useSetupDialog, mapSelectors, mapListener, serviceListener, layersListener, syncGroupsListener, genericListener, openlayersListener, uiReducer, syncGroupsReducer, layerReducer, serviceReducer, mapReducer, loadingIndicatorActions, useRegisterFeatureSyncSource, useUpdateFeatureSyncLayers, useSyncgroupTimeState, mapActions, layerActions } from '@opengeoweb/store';
|
|
7
|
-
import { useTheme, MenuItem, LinearProgress, Grid,
|
|
8
|
-
import { isString, trim, trimStart, compact, chain, groupBy, countBy, sortBy, uniqBy
|
|
7
|
+
import { Box, useTheme, MenuItem, LinearProgress, Grid, Typography, ClickAwayListener, Input, Collapse, Button, List, ListItem, ListItemText, InputAdornment, ListItemButton, styled, Card, Stack, Tooltip, ListItemIcon, Checkbox } from '@mui/material';
|
|
8
|
+
import { isString, trim, trimStart, compact, isEqual, chain, groupBy, countBy, sortBy, uniqBy } from 'lodash';
|
|
9
9
|
import { ReactSortable } from 'react-sortablejs';
|
|
10
|
-
import { Info, ArrowDropDownDown, Copy, Delete, Visibility, VisibilityOff, TimeSeriesSelect as TimeSeriesSelect$1, DragHandle, ChevronUp, ChevronDown, Options, Add, DimensionsTime, DrawRegion, Cached, Edit, Location, EChartsDarkTheme, EChartsLightTheme, Layers, LockLocked, LockUnlocked } from '@opengeoweb/theme';
|
|
11
|
-
import i18n from 'i18next';
|
|
12
|
-
import { useTranslation } from 'react-i18next';
|
|
13
|
-
import '@opengeoweb/core';
|
|
10
|
+
import { Exclamation, Info, ArrowDropDownDown, Copy, Delete, Visibility, VisibilityOff, TimeSeriesSelect as TimeSeriesSelect$1, DragHandle, ChevronUp, ChevronDown, Options, Add, DimensionsTime, DrawRegion, Cached, Edit, Location, EChartsDarkTheme, EChartsLightTheme, Layers, LockLocked, LockUnlocked } from '@opengeoweb/theme';
|
|
14
11
|
import { createEntityAdapter, createSlice, createAction, createSelector, createListenerMiddleware, isAnyOf, combineReducers, configureStore } from '@reduxjs/toolkit';
|
|
15
12
|
import { produce } from 'immer';
|
|
16
13
|
import { v4 } from 'uuid';
|
|
17
14
|
import { center } from '@turf/turf';
|
|
18
15
|
import { MapFeatureClass } from '@opengeoweb/webmap-react';
|
|
16
|
+
import i18n from 'i18next';
|
|
17
|
+
import { useTranslation } from 'react-i18next';
|
|
18
|
+
import '@opengeoweb/core';
|
|
19
19
|
import { useQueries, useQueryClient, useQuery, queryOptions } from '@tanstack/react-query';
|
|
20
20
|
import { withJsonFormat, handleResponse } from '@opengeoweb/api';
|
|
21
21
|
import { authFetch } from '@opengeoweb/authentication';
|
|
22
22
|
import Box$1 from '@mui/material/Box';
|
|
23
23
|
import { useFormContext } from 'react-hook-form';
|
|
24
24
|
import { ReactHookFormProvider, defaultFormOptions, ReactHookFormTextField, ReactHookFormSelect } from '@opengeoweb/form-fields';
|
|
25
|
-
import { List as List$1
|
|
25
|
+
import { useListRef, List as List$1 } from 'react-window';
|
|
26
26
|
import { webmapUtils } from '@opengeoweb/webmap';
|
|
27
27
|
import ReactECharts from 'echarts-for-react';
|
|
28
|
+
import { format } from 'echarts';
|
|
28
29
|
|
|
29
30
|
var en = {
|
|
30
|
-
"timeseries-
|
|
31
|
+
"timeseries-missing-units": "The service does not provide a unit for the {{parameter}} parameter.",
|
|
32
|
+
"timeseries-results_one": "{{count}} result",
|
|
33
|
+
"timeseries-results_other": "{{count}} results",
|
|
31
34
|
"timeseries-services": "Services",
|
|
32
35
|
"timeseries-services-options": "Service options dialog for timeseries",
|
|
33
36
|
"timeseries-add-service": "Add a new TS service",
|
|
@@ -148,12 +151,14 @@ var en = {
|
|
|
148
151
|
"timeseries-add-plot": "Add plot"
|
|
149
152
|
};
|
|
150
153
|
var fi = {
|
|
151
|
-
"timeseries-
|
|
154
|
+
"timeseries-missing-units": "Palvelu ei tarjoa yksikköä parametrille {{parameter}}.",
|
|
155
|
+
"timeseries-results_one": "{{count}} tulos",
|
|
156
|
+
"timeseries-results_other": "{{count}} tulosta",
|
|
152
157
|
"timeseries-services": "Palvelut",
|
|
153
|
-
"timeseries-services-options": "
|
|
154
|
-
"timeseries-add-service": "Lisää uusi
|
|
155
|
-
"timeseries-update-service": "Päivitä kokoelmat ja parametrit
|
|
156
|
-
"timeseries-edit-service": "
|
|
158
|
+
"timeseries-services-options": "Aikasarjojen palveluasetukset",
|
|
159
|
+
"timeseries-add-service": "Lisää uusi aikasarjapalvelu",
|
|
160
|
+
"timeseries-update-service": "Päivitä kokoelmat ja parametrit aikasarjapalvelusta",
|
|
161
|
+
"timeseries-edit-service": "Muokkaa palvelua",
|
|
157
162
|
"timeseries-show-service": "Näytä palvelu",
|
|
158
163
|
"timeseries-cannot-remove": "Palvelun tarjoamia karttatasoja on aktiivisena. Tätä palvelua ei voida poistaa",
|
|
159
164
|
"timeseries-delete-service": "Poista palvelu",
|
|
@@ -162,14 +167,18 @@ var fi = {
|
|
|
162
167
|
"timeseries-show": "Näytä",
|
|
163
168
|
"timeseries-hide": "Piilota",
|
|
164
169
|
"timeseries-collection": "Kokoelmat",
|
|
170
|
+
"timeseries-collection-id": "Kokoelman tunniste",
|
|
171
|
+
"timeseries-collection-title": "Kokoelman nimi",
|
|
172
|
+
"timeseries-collection-description": "Kokoelman kuvaus",
|
|
165
173
|
"timeseries-parameter": "Parametrit",
|
|
166
|
-
"timeseries-parameter-info": "
|
|
174
|
+
"timeseries-parameter-info": "Aikasarjan parametrin tiedot",
|
|
167
175
|
"timeseries-style": "Tyyli",
|
|
168
176
|
"timeseries-color": "Väri",
|
|
169
|
-
"timeseries-opacity": "
|
|
177
|
+
"timeseries-opacity": "Peittävyys",
|
|
170
178
|
"timeseries-dimension": "Dimensio",
|
|
171
179
|
"timeseries-dimension-id": "Dimension ID",
|
|
172
180
|
"timeseries-dimension-value": "Dimension arvo",
|
|
181
|
+
"timeseries-dimension-none": "Ei valintaa",
|
|
173
182
|
"timeseries-reference-time": "Vertailuaika",
|
|
174
183
|
"timeseries-type": "Tyyppi",
|
|
175
184
|
"timeseries-line": "Viiva",
|
|
@@ -183,24 +192,24 @@ var fi = {
|
|
|
183
192
|
"timeseries-plot-options": "Valinnat",
|
|
184
193
|
"timeseries-plot-copy-title": "{{title}} (copy {{count}})",
|
|
185
194
|
"timeseries-duplicate": "Monista",
|
|
186
|
-
"timeseries-drag": "
|
|
195
|
+
"timeseries-drag": "Vedä",
|
|
187
196
|
"timeseries-edit-title": "Muokkaa otsikkoa",
|
|
188
197
|
"timeseries-click-to-edit": "Napsauta muokataksesi",
|
|
189
198
|
"timeseries-open-param-list": "Avaa parametrilista",
|
|
190
|
-
"timeseries-manager": "
|
|
191
|
-
"timeseries-ts-manager": "
|
|
192
|
-
"timeseries-select-for": "
|
|
199
|
+
"timeseries-manager": "Aikasarjojen hallinta",
|
|
200
|
+
"timeseries-ts-manager": "Aikasarjat",
|
|
201
|
+
"timeseries-select-for": "Aikasarjan valinta kuvaajalle",
|
|
193
202
|
"timeseries-all": "Kaikki",
|
|
194
203
|
"timeseries-add-param-to-plot": "Lisää parametri kuvaajalle",
|
|
195
204
|
"timeseries-choose-type": "Valitse tyyppi",
|
|
196
205
|
"timeseries-choose-color": "Valitse väri",
|
|
197
|
-
"timeseries-choose-opacity": "Valitse
|
|
206
|
+
"timeseries-choose-opacity": "Valitse peittävyys",
|
|
198
207
|
"timeseries-choose-ref-time": "Valitse vertailuaika",
|
|
199
208
|
"timeseries-location": "Sijainti",
|
|
200
209
|
"timeseries-lock": "Lukitse",
|
|
201
|
-
"timeseries-unlock": "
|
|
210
|
+
"timeseries-unlock": "Poista lukitus",
|
|
202
211
|
"timeseries-lock-location": "Lukitse sijainti",
|
|
203
|
-
"timeseries-unlock-location": "
|
|
212
|
+
"timeseries-unlock-location": "Poista sijainnin lukitus",
|
|
204
213
|
"timeseries-select-location": "Valitse sijainti",
|
|
205
214
|
"timeseries-close": "Sulje",
|
|
206
215
|
"timeseries-cancel": "Peruuta",
|
|
@@ -209,27 +218,27 @@ var fi = {
|
|
|
209
218
|
"timeseries-service-removed": "Palvelu {{ service }} on poistettu",
|
|
210
219
|
"timeseries-save-service": "Tallenna palvelu",
|
|
211
220
|
"timeseries-service": "Palvelu",
|
|
212
|
-
"timeseries-service-url-copy": "
|
|
213
|
-
"timeseries-service-url-copied": "Palvelun URL on kopioitu leikepöydälle",
|
|
214
|
-
"timeseries-service-refers-to-url": "Tämä palvelu viittaa tähän URL
|
|
221
|
+
"timeseries-service-url-copy": "Kopioi URL-osoite",
|
|
222
|
+
"timeseries-service-url-copied": "Palvelun URL-osoite on kopioitu leikepöydälle",
|
|
223
|
+
"timeseries-service-refers-to-url": "Tämä palvelu viittaa tähän URL-osoitteeseen",
|
|
215
224
|
"timeseries-service-name": "Palvelun nimi",
|
|
216
225
|
"timeseries-description": "Kuvaus",
|
|
217
226
|
"timeseries-description-helper-text": "Lyhyt kuvaus siitä, mitä palvelu tekee",
|
|
218
227
|
"timeseries-validations-name-existing": "Tämä nimi on jo olemassa. Valitse toinen nimi.",
|
|
219
|
-
"timeseries-validations-service-existing": "URL on jo
|
|
220
|
-
"timeseries-validations-service-valid-url": "
|
|
221
|
-
"timeseries-validations-request-failed": "Lataus epäonnistui. Tarkista URL.",
|
|
228
|
+
"timeseries-validations-service-existing": "URL-osoite on jo käytössä.",
|
|
229
|
+
"timeseries-validations-service-valid-url": "Virheellinen URL-osoite.",
|
|
230
|
+
"timeseries-validations-request-failed": "Lataus epäonnistui. Tarkista URL-osoite.",
|
|
222
231
|
"timeseries-validations-field-required": "Tämä kenttä vaaditaan",
|
|
223
|
-
"timeseries-search-ts-or-enter-url": "Etsi tai
|
|
224
|
-
"timeseries-service-saved-successfully": "Palvelu \"{{ service }}\" on
|
|
225
|
-
"timeseries-info-title": "
|
|
232
|
+
"timeseries-search-ts-or-enter-url": "Etsi aikasarjapalvelu tai syötä palvelun URL-osoite",
|
|
233
|
+
"timeseries-service-saved-successfully": "Palvelu \"{{ service }}\" on tallennettu",
|
|
234
|
+
"timeseries-info-title": "Aikasarjan tiedot",
|
|
226
235
|
"timeseries-info-name": "Nimi",
|
|
227
236
|
"timeseries-info-service": "Palvelu",
|
|
228
|
-
"timeseries-info-service-url": "Palvelun
|
|
229
|
-
"timeseries-info-service-type": "Palvelun
|
|
237
|
+
"timeseries-info-service-url": "Palvelun URL-osoite",
|
|
238
|
+
"timeseries-info-service-type": "Palvelun tyyppi",
|
|
230
239
|
"timeseries-info-service-description": "Palvelun kuvaus",
|
|
231
240
|
"timeseries-info-instance-dimensions": "Tapauksen dimensiot",
|
|
232
|
-
"timeseries-info-no-data-available": "
|
|
241
|
+
"timeseries-info-no-data-available": "Tietoja ei ole saatavilla",
|
|
233
242
|
"timeseries-info-time": "Aika",
|
|
234
243
|
"timeseries-info-bbox": "Rajaava suorakaide",
|
|
235
244
|
"timeseries-info-bbox-rendering": "länsi {{west}}, itä {{east}}, pohjoinen {{north}}, etelä {{south}}",
|
|
@@ -240,18 +249,18 @@ var fi = {
|
|
|
240
249
|
"timeseries-location-info-button": "Paikka",
|
|
241
250
|
"timeseries-location-info-title": "Paikan tiedot",
|
|
242
251
|
"timeseries-location-info-name": "Paikan nimi",
|
|
243
|
-
"timeseries-location-info-locationId": "Paikan
|
|
244
|
-
"timeseries-location-info-collectionId": "
|
|
252
|
+
"timeseries-location-info-locationId": "Paikan tunniste",
|
|
253
|
+
"timeseries-location-info-collectionId": "Kokoelman tunniste",
|
|
245
254
|
"timeseries-location-info-coordinates": "Paikan koordinaatit",
|
|
246
255
|
"timeseries-location-info-parameters": "Parametrit",
|
|
247
|
-
"timeseries-location-info-no-data": "
|
|
248
|
-
"timeseries-location-info-serviceId": "
|
|
249
|
-
"timeseries-location-info-collections": "
|
|
250
|
-
"timeseries-location-info-collection": "
|
|
251
|
-
"timeseries-location-info-detail": "
|
|
256
|
+
"timeseries-location-info-no-data": "Tietoja ei ole saatavilla",
|
|
257
|
+
"timeseries-location-info-serviceId": "Palvelun tunniste",
|
|
258
|
+
"timeseries-location-info-collections": "kokoelmat",
|
|
259
|
+
"timeseries-location-info-collection": "kokoelma",
|
|
260
|
+
"timeseries-location-info-detail": "Lisätiedot",
|
|
252
261
|
"timeseries-location-info-no-location-selected": "Ei paikkaa valittuna",
|
|
253
262
|
"timeseries-location-info-mapFeatureClass": "Map feature class",
|
|
254
|
-
"timeseries-location-info-parameterName": "
|
|
263
|
+
"timeseries-location-info-parameterName": "Parametrin nimi",
|
|
255
264
|
"timeseries-toggle-location-markers-label": "Merkit",
|
|
256
265
|
"timeseries-toggle-location-markers-tooltip": "Näytä/piilota kohdemerkit",
|
|
257
266
|
"timeseries-legend": "Selite",
|
|
@@ -260,11 +269,13 @@ var fi = {
|
|
|
260
269
|
"error-message-general": "Tätä parametria ei voitu ladata.",
|
|
261
270
|
"error-message-general-plural": "Näitä parametreja ei voitu ladata.",
|
|
262
271
|
"error-message-missing-collection-or-service": "Parametrille ei löytynyt kokoelmaa ja/tai palvelua",
|
|
263
|
-
"all-plots": "Kaikki
|
|
264
|
-
"timeseries-add-plot": "Lisää
|
|
272
|
+
"all-plots": "Kaikki kuvaajat",
|
|
273
|
+
"timeseries-add-plot": "Lisää kuvaaja"
|
|
265
274
|
};
|
|
266
275
|
var no = {
|
|
267
|
-
"timeseries-
|
|
276
|
+
"timeseries-missing-units": "Tjenesten oppgir ikke enhet for parameteren {{parameter}}.",
|
|
277
|
+
"timeseries-results_one": "{{count}} resultat",
|
|
278
|
+
"timeseries-results_other": "{{count}} resultater",
|
|
268
279
|
"timeseries-services": "Tjenester",
|
|
269
280
|
"timeseries-services-options": "Dialog for tjenestevalg av tidsserier",
|
|
270
281
|
"timeseries-add-service": "Legg til ny TS tjeneste",
|
|
@@ -380,7 +391,9 @@ var no = {
|
|
|
380
391
|
"timeseries-add-plot": "Legg til plott"
|
|
381
392
|
};
|
|
382
393
|
var nl = {
|
|
383
|
-
"timeseries-
|
|
394
|
+
"timeseries-missing-units": "De service geeft geen eenheid op voor parameter {{parameter}}.",
|
|
395
|
+
"timeseries-results_one": "{{count}} resultaat",
|
|
396
|
+
"timeseries-results_other": "{{count}} resultaten",
|
|
384
397
|
"timeseries-services": "Services",
|
|
385
398
|
"timeseries-services-options": "Service opties voor tijdreeksen",
|
|
386
399
|
"timeseries-add-service": "Een nieuwe TS service toevoegen",
|
|
@@ -507,43 +520,6 @@ var timeseriesTranslations = {
|
|
|
507
520
|
nl: nl
|
|
508
521
|
};
|
|
509
522
|
|
|
510
|
-
/* *
|
|
511
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
512
|
-
* you may not use this file except in compliance with the License.
|
|
513
|
-
* You may obtain a copy of the License at
|
|
514
|
-
*
|
|
515
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
516
|
-
*
|
|
517
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
518
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
519
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
520
|
-
* See the License for the specific language governing permissions and
|
|
521
|
-
* limitations under the License.
|
|
522
|
-
*
|
|
523
|
-
* Copyright 2024 - Koninklijk Nederlands Meteorologisch Instituut (KNMI)
|
|
524
|
-
* Copyright 2024 - Finnish Meteorological Institute (FMI)
|
|
525
|
-
* Copyright 2024 - The Norwegian Meteorological Institute (MET Norway)
|
|
526
|
-
* */
|
|
527
|
-
var TIME_SERIES_NAMESPACE = 'timeseries';
|
|
528
|
-
var useTimeseriesTranslation = function useTimeseriesTranslation() {
|
|
529
|
-
return useTranslation(TIME_SERIES_NAMESPACE);
|
|
530
|
-
};
|
|
531
|
-
|
|
532
|
-
var ParameterInfoButton = function ParameterInfoButton(_ref) {
|
|
533
|
-
var isOpenInStore = _ref.isOpenInStore,
|
|
534
|
-
isActive = _ref.isActive,
|
|
535
|
-
onClick = _ref.onClick;
|
|
536
|
-
var _useTimeseriesTransla = useTimeseriesTranslation(),
|
|
537
|
-
t = _useTimeseriesTransla.t;
|
|
538
|
-
return jsx(CustomIconButton, {
|
|
539
|
-
"aria-label": t('timeseries-parameter-info'),
|
|
540
|
-
isSelected: !!isActive && isOpenInStore,
|
|
541
|
-
onClick: onClick,
|
|
542
|
-
variant: "flat",
|
|
543
|
-
children: jsx(Info, {})
|
|
544
|
-
});
|
|
545
|
-
};
|
|
546
|
-
|
|
547
523
|
function _arrayLikeToArray(r, a) {
|
|
548
524
|
(null == a || a > r.length) && (a = r.length);
|
|
549
525
|
for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e];
|
|
@@ -574,6 +550,13 @@ function _asyncToGenerator(n) {
|
|
|
574
550
|
});
|
|
575
551
|
};
|
|
576
552
|
}
|
|
553
|
+
function _construct(t, e, r) {
|
|
554
|
+
if (_isNativeReflectConstruct()) return Reflect.construct.apply(null, arguments);
|
|
555
|
+
var o = [null];
|
|
556
|
+
o.push.apply(o, e);
|
|
557
|
+
var p = new (t.bind.apply(t, o))();
|
|
558
|
+
return r && _setPrototypeOf(p, r.prototype), p;
|
|
559
|
+
}
|
|
577
560
|
function _createForOfIteratorHelperLoose(r, e) {
|
|
578
561
|
var t = "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"];
|
|
579
562
|
if (t) return (t = t.call(r)).next.bind(t);
|
|
@@ -591,6 +574,29 @@ function _createForOfIteratorHelperLoose(r, e) {
|
|
|
591
574
|
}
|
|
592
575
|
throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
593
576
|
}
|
|
577
|
+
function _getPrototypeOf(t) {
|
|
578
|
+
return _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function (t) {
|
|
579
|
+
return t.__proto__ || Object.getPrototypeOf(t);
|
|
580
|
+
}, _getPrototypeOf(t);
|
|
581
|
+
}
|
|
582
|
+
function _inheritsLoose(t, o) {
|
|
583
|
+
t.prototype = Object.create(o.prototype), t.prototype.constructor = t, _setPrototypeOf(t, o);
|
|
584
|
+
}
|
|
585
|
+
function _isNativeFunction(t) {
|
|
586
|
+
try {
|
|
587
|
+
return -1 !== Function.toString.call(t).indexOf("[native code]");
|
|
588
|
+
} catch (n) {
|
|
589
|
+
return "function" == typeof t;
|
|
590
|
+
}
|
|
591
|
+
}
|
|
592
|
+
function _isNativeReflectConstruct() {
|
|
593
|
+
try {
|
|
594
|
+
var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {}));
|
|
595
|
+
} catch (t) {}
|
|
596
|
+
return (_isNativeReflectConstruct = function () {
|
|
597
|
+
return !!t;
|
|
598
|
+
})();
|
|
599
|
+
}
|
|
594
600
|
function _objectWithoutPropertiesLoose(r, e) {
|
|
595
601
|
if (null == r) return {};
|
|
596
602
|
var t = {};
|
|
@@ -708,6 +714,11 @@ function _regeneratorDefine(e, r, n, t) {
|
|
|
708
714
|
}) : e[r] = n : (o("next", 0), o("throw", 1), o("return", 2));
|
|
709
715
|
}, _regeneratorDefine(e, r, n, t);
|
|
710
716
|
}
|
|
717
|
+
function _setPrototypeOf(t, e) {
|
|
718
|
+
return _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function (t, e) {
|
|
719
|
+
return t.__proto__ = e, t;
|
|
720
|
+
}, _setPrototypeOf(t, e);
|
|
721
|
+
}
|
|
711
722
|
function _unsupportedIterableToArray(r, a) {
|
|
712
723
|
if (r) {
|
|
713
724
|
if ("string" == typeof r) return _arrayLikeToArray(r, a);
|
|
@@ -715,6 +726,28 @@ function _unsupportedIterableToArray(r, a) {
|
|
|
715
726
|
return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0;
|
|
716
727
|
}
|
|
717
728
|
}
|
|
729
|
+
function _wrapNativeSuper(t) {
|
|
730
|
+
var r = "function" == typeof Map ? new Map() : void 0;
|
|
731
|
+
return _wrapNativeSuper = function (t) {
|
|
732
|
+
if (null === t || !_isNativeFunction(t)) return t;
|
|
733
|
+
if ("function" != typeof t) throw new TypeError("Super expression must either be null or a function");
|
|
734
|
+
if (void 0 !== r) {
|
|
735
|
+
if (r.has(t)) return r.get(t);
|
|
736
|
+
r.set(t, Wrapper);
|
|
737
|
+
}
|
|
738
|
+
function Wrapper() {
|
|
739
|
+
return _construct(t, arguments, _getPrototypeOf(this).constructor);
|
|
740
|
+
}
|
|
741
|
+
return Wrapper.prototype = Object.create(t.prototype, {
|
|
742
|
+
constructor: {
|
|
743
|
+
value: Wrapper,
|
|
744
|
+
enumerable: false,
|
|
745
|
+
writable: true,
|
|
746
|
+
configurable: true
|
|
747
|
+
}
|
|
748
|
+
}), _setPrototypeOf(Wrapper, t);
|
|
749
|
+
}, _wrapNativeSuper(t);
|
|
750
|
+
}
|
|
718
751
|
|
|
719
752
|
/* *
|
|
720
753
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
@@ -903,10 +936,7 @@ var getUnit = function getUnit(param, lang, fallbackLang) {
|
|
|
903
936
|
}
|
|
904
937
|
}
|
|
905
938
|
}
|
|
906
|
-
|
|
907
|
-
unit = '-?-';
|
|
908
|
-
}
|
|
909
|
-
return unit;
|
|
939
|
+
return unit != null ? unit : '';
|
|
910
940
|
};
|
|
911
941
|
var constructParameterObject = function constructParameterObject(serviceId, collectionId, parametersById) {
|
|
912
942
|
return Object.keys(parametersById).map(function (parameterId) {
|
|
@@ -1145,6 +1175,12 @@ var panelSlice = createSlice({
|
|
|
1145
1175
|
initialState: createPanelState(),
|
|
1146
1176
|
name: 'timeseriesPanel',
|
|
1147
1177
|
reducers: {
|
|
1178
|
+
setMissingUnitParameters: function setMissingUnitParameters(draft, action) {
|
|
1179
|
+
var _draft$missingUnitPar;
|
|
1180
|
+
if (!isEqual((_draft$missingUnitPar = draft.missingUnitParameters) != null ? _draft$missingUnitPar : [], action.payload.parameters)) {
|
|
1181
|
+
draft.missingUnitParameters = action.payload.parameters;
|
|
1182
|
+
}
|
|
1183
|
+
},
|
|
1148
1184
|
loadUserAddedTimeSeriesServices: function loadUserAddedTimeSeriesServices(draft, payloadAction) {
|
|
1149
1185
|
var _draft$timeseriesSele, _draft$timeseriesSele2;
|
|
1150
1186
|
var servicesPayload = Array.isArray(payloadAction.payload) ? payloadAction.payload : payloadAction.payload.timeSeriesServices;
|
|
@@ -1211,10 +1247,35 @@ var panelSlice = createSlice({
|
|
|
1211
1247
|
});
|
|
1212
1248
|
},
|
|
1213
1249
|
addPlot: function addPlot(draft, action) {
|
|
1250
|
+
var _action$payload$plotI;
|
|
1214
1251
|
draft.plotPreset.plots.push({
|
|
1215
1252
|
title: action.payload.title,
|
|
1216
|
-
plotId: generateTimeSeriesId()
|
|
1253
|
+
plotId: (_action$payload$plotI = action.payload.plotId) != null ? _action$payload$plotI : generateTimeSeriesId()
|
|
1254
|
+
});
|
|
1255
|
+
},
|
|
1256
|
+
openCollectionSelection: function openCollectionSelection(draft, action) {
|
|
1257
|
+
if (!draft.timeseriesSelect) {
|
|
1258
|
+
return;
|
|
1259
|
+
}
|
|
1260
|
+
var _action$payload = action.payload,
|
|
1261
|
+
plotId = _action$payload.plotId,
|
|
1262
|
+
serviceId = _action$payload.serviceId,
|
|
1263
|
+
collectionId = _action$payload.collectionId;
|
|
1264
|
+
draft.timeseriesSelect.collectionSelection = {
|
|
1265
|
+
plotId: plotId,
|
|
1266
|
+
serviceId: serviceId,
|
|
1267
|
+
collectionId: collectionId
|
|
1268
|
+
};
|
|
1269
|
+
draft.timeseriesSelect.filters.searchFilter = '';
|
|
1270
|
+
var chips = draft.timeseriesSelect.filters.serviceFilterChips;
|
|
1271
|
+
Object.keys(chips.entities).forEach(function (id) {
|
|
1272
|
+
chips.entities[id].enabled = id === serviceId;
|
|
1217
1273
|
});
|
|
1274
|
+
draft.timeseriesSelect.filters.allServiceFilterChipsEnabled = chips.ids.length === 1;
|
|
1275
|
+
},
|
|
1276
|
+
clearCollectionSelection: function clearCollectionSelection(draft, _action) {
|
|
1277
|
+
var _draft$timeseriesSele3;
|
|
1278
|
+
(_draft$timeseriesSele3 = draft.timeseriesSelect) == null || delete _draft$timeseriesSele3.collectionSelection;
|
|
1218
1279
|
},
|
|
1219
1280
|
setPlotIsOpen: function setPlotIsOpen(draft, action) {
|
|
1220
1281
|
var _draft$plotPreset;
|
|
@@ -1322,9 +1383,9 @@ var panelSlice = createSlice({
|
|
|
1322
1383
|
},
|
|
1323
1384
|
movePlot: function movePlot(draft, action) {
|
|
1324
1385
|
var _draft$plotPreset3;
|
|
1325
|
-
var _action$
|
|
1326
|
-
oldIndex = _action$
|
|
1327
|
-
newIndex = _action$
|
|
1386
|
+
var _action$payload2 = action.payload,
|
|
1387
|
+
oldIndex = _action$payload2.oldIndex,
|
|
1388
|
+
newIndex = _action$payload2.newIndex;
|
|
1328
1389
|
if (!((_draft$plotPreset3 = draft.plotPreset) != null && _draft$plotPreset3.plots)) {
|
|
1329
1390
|
return;
|
|
1330
1391
|
}
|
|
@@ -1359,11 +1420,11 @@ var panelSlice = createSlice({
|
|
|
1359
1420
|
});
|
|
1360
1421
|
},
|
|
1361
1422
|
moveParameter: function moveParameter(draft, action) {
|
|
1362
|
-
var _action$
|
|
1363
|
-
oldIndex = _action$
|
|
1364
|
-
newIndex = _action$
|
|
1365
|
-
toPlotId = _action$
|
|
1366
|
-
plotId = _action$
|
|
1423
|
+
var _action$payload3 = action.payload,
|
|
1424
|
+
oldIndex = _action$payload3.oldIndex,
|
|
1425
|
+
newIndex = _action$payload3.newIndex,
|
|
1426
|
+
toPlotId = _action$payload3.toPlotId,
|
|
1427
|
+
plotId = _action$payload3.plotId;
|
|
1367
1428
|
if (!draft.plotPreset) {
|
|
1368
1429
|
return;
|
|
1369
1430
|
}
|
|
@@ -1380,8 +1441,8 @@ var panelSlice = createSlice({
|
|
|
1380
1441
|
},
|
|
1381
1442
|
// Select a filter chip - if this means all will be selected, ensure all gets set to selected
|
|
1382
1443
|
setServiceFilterChipSelected: function setServiceFilterChipSelected(draft, action) {
|
|
1383
|
-
var _draft$
|
|
1384
|
-
var serviceFilterChipsById = (_draft$
|
|
1444
|
+
var _draft$timeseriesSele4;
|
|
1445
|
+
var serviceFilterChipsById = (_draft$timeseriesSele4 = draft.timeseriesSelect) == null ? void 0 : _draft$timeseriesSele4.filters.serviceFilterChips.entities;
|
|
1385
1446
|
if (serviceFilterChipsById) {
|
|
1386
1447
|
var activeServices = compact(Object.values(serviceFilterChipsById));
|
|
1387
1448
|
var countSelectedServices = activeServices.filter(function (service) {
|
|
@@ -1463,11 +1524,11 @@ var panelSlice = createSlice({
|
|
|
1463
1524
|
setServiceFilterChipsInStore: function setServiceFilterChipsInStore(draft, action) {
|
|
1464
1525
|
action.payload.forEach(function (service) {
|
|
1465
1526
|
if (draft.timeseriesSelect) {
|
|
1466
|
-
var _draft$
|
|
1527
|
+
var _draft$timeseriesSele5;
|
|
1467
1528
|
draft.timeseriesSelect.filters.serviceFilterChips.entities[service.serviceId] = {
|
|
1468
1529
|
serviceId: service.serviceId,
|
|
1469
1530
|
serviceName: service.serviceName || service.serviceId,
|
|
1470
|
-
enabled: (_draft$
|
|
1531
|
+
enabled: (_draft$timeseriesSele5 = draft.timeseriesSelect) == null ? void 0 : _draft$timeseriesSele5.filters.allServiceFilterChipsEnabled,
|
|
1471
1532
|
scope: service.scope || 'system',
|
|
1472
1533
|
type: service.type,
|
|
1473
1534
|
serviceUrl: service.serviceUrl,
|
|
@@ -1584,8 +1645,8 @@ var timeSeriesActions = Object.assign({}, panelSlice.actions, {
|
|
|
1584
1645
|
resetTimeSeriesPanels: resetTimeSeriesPanels
|
|
1585
1646
|
});
|
|
1586
1647
|
var resolvePanelId = function resolvePanelId(action) {
|
|
1587
|
-
var _action$
|
|
1588
|
-
return (_action$
|
|
1648
|
+
var _action$payload4;
|
|
1649
|
+
return (_action$payload4 = action.payload) == null ? void 0 : _action$payload4.panelId;
|
|
1589
1650
|
};
|
|
1590
1651
|
var normalizeTimeSeriesState = function normalizeTimeSeriesState(state) {
|
|
1591
1652
|
if ('byId' in state) {
|
|
@@ -1949,6 +2010,12 @@ var getPlotState = function getPlotState(state, panelId) {
|
|
|
1949
2010
|
var _getPanelState;
|
|
1950
2011
|
return (_getPanelState = getPanelState(state, panelId)) == null ? void 0 : _getPanelState.plotPreset;
|
|
1951
2012
|
};
|
|
2013
|
+
var getParameterHasMissingUnit = function getParameterHasMissingUnit(state, panelId, parameter) {
|
|
2014
|
+
var _getPanelState$missin, _getPanelState2;
|
|
2015
|
+
return (_getPanelState$missin = (_getPanelState2 = getPanelState(state, panelId)) == null || (_getPanelState2 = _getPanelState2.missingUnitParameters) == null ? void 0 : _getPanelState2.some(function (item) {
|
|
2016
|
+
return item.propertyName === parameter.propertyName && item.serviceId === parameter.serviceId && item.collectionId === parameter.collectionId && item.instanceId === parameter.instanceId && serializeDimensions(item.dimensions) === serializeDimensions(parameter.dimensions);
|
|
2017
|
+
})) != null ? _getPanelState$missin : false;
|
|
2018
|
+
};
|
|
1952
2019
|
var getPlotById = function getPlotById(state, panelId, plotId) {
|
|
1953
2020
|
var _getPlotState;
|
|
1954
2021
|
return (_getPlotState = getPlotState(state, panelId)) == null ? void 0 : _getPlotState.plots.find(function (plot) {
|
|
@@ -1967,8 +2034,8 @@ var getTimeSeriesState = function getTimeSeriesState(state, panelId) {
|
|
|
1967
2034
|
return getPanelState(state, panelId);
|
|
1968
2035
|
};
|
|
1969
2036
|
var getMapId = function getMapId(state, panelId) {
|
|
1970
|
-
var
|
|
1971
|
-
return (
|
|
2037
|
+
var _getPanelState3;
|
|
2038
|
+
return (_getPanelState3 = getPanelState(state, panelId)) == null || (_getPanelState3 = _getPanelState3.plotPreset) == null ? void 0 : _getPanelState3.mapId;
|
|
1972
2039
|
};
|
|
1973
2040
|
var getPlotWithParameters = createSelector([function (state, _selectPlotId, panelId) {
|
|
1974
2041
|
return getPlotState(state, panelId);
|
|
@@ -2127,6 +2194,10 @@ var getServicePopupDetails = createSelector(getTimeSeriesState, function (store)
|
|
|
2127
2194
|
var _store$timeseriesSele6;
|
|
2128
2195
|
return (store == null || (_store$timeseriesSele6 = store.timeseriesSelect) == null ? void 0 : _store$timeseriesSele6.servicePopup) || initialPanelState.timeseriesSelect.servicePopup;
|
|
2129
2196
|
});
|
|
2197
|
+
var getCollectionSelection = createSelector(getTimeSeriesState, function (store) {
|
|
2198
|
+
var _store$timeseriesSele7;
|
|
2199
|
+
return store == null || (_store$timeseriesSele7 = store.timeseriesSelect) == null ? void 0 : _store$timeseriesSele7.collectionSelection;
|
|
2200
|
+
});
|
|
2130
2201
|
var getLocationDialogRestoreVersion = function getLocationDialogRestoreVersion(state) {
|
|
2131
2202
|
var ts = state.timeSeries;
|
|
2132
2203
|
if (!ts || !('byId' in ts)) {
|
|
@@ -2154,16 +2225,16 @@ var getDialogOpenPanelId = function getDialogOpenPanelId(state) {
|
|
|
2154
2225
|
})) == null ? void 0 : _Object$entries$find[0];
|
|
2155
2226
|
};
|
|
2156
2227
|
var getLocationMenuSize = function getLocationMenuSize(state, panelId) {
|
|
2157
|
-
var
|
|
2158
|
-
return (
|
|
2228
|
+
var _getPanelState4;
|
|
2229
|
+
return (_getPanelState4 = getPanelState(state, panelId)) == null || (_getPanelState4 = _getPanelState4.locationData) == null ? void 0 : _getPanelState4.locationMenuSize;
|
|
2159
2230
|
};
|
|
2160
2231
|
var getLocationMenuPosition = function getLocationMenuPosition(state, panelId) {
|
|
2161
|
-
var
|
|
2162
|
-
return (
|
|
2232
|
+
var _getPanelState5;
|
|
2233
|
+
return (_getPanelState5 = getPanelState(state, panelId)) == null || (_getPanelState5 = _getPanelState5.locationData) == null ? void 0 : _getPanelState5.locationMenuPosition;
|
|
2163
2234
|
};
|
|
2164
2235
|
var getLocationsDialogOpen = function getLocationsDialogOpen(state, panelId) {
|
|
2165
|
-
var _getPanelState$locati,
|
|
2166
|
-
return (_getPanelState$locati = (
|
|
2236
|
+
var _getPanelState$locati, _getPanelState6;
|
|
2237
|
+
return (_getPanelState$locati = (_getPanelState6 = getPanelState(state, panelId)) == null || (_getPanelState6 = _getPanelState6.locationData) == null ? void 0 : _getPanelState6.isLocationsDialogOpen) != null ? _getPanelState$locati : false;
|
|
2167
2238
|
};
|
|
2168
2239
|
var getTimeSeriesPreset = createSelector(getPlotState, getServices, getLocationMenuSize, getLocationMenuPosition, getLocationsDialogOpen, function (plotState, services, locationMenuSize, locationMenuPosition, isLocationsDialogOpen) {
|
|
2169
2240
|
if (!plotState || !services) {
|
|
@@ -2250,6 +2321,7 @@ var getCurrentLocation = createSelector(getTimeSeriesState, function (store) {
|
|
|
2250
2321
|
var selectors = /*#__PURE__*/Object.freeze({
|
|
2251
2322
|
__proto__: null,
|
|
2252
2323
|
getAllFilterChipsEnabled: getAllFilterChipsEnabled,
|
|
2324
|
+
getCollectionSelection: getCollectionSelection,
|
|
2253
2325
|
getCurrentLocation: getCurrentLocation,
|
|
2254
2326
|
getCurrentParameterInfoDisplayed: getCurrentParameterInfoDisplayed,
|
|
2255
2327
|
getDialogOpenPanelId: getDialogOpenPanelId,
|
|
@@ -2263,6 +2335,7 @@ var selectors = /*#__PURE__*/Object.freeze({
|
|
|
2263
2335
|
getMapId: getMapId,
|
|
2264
2336
|
getPanelState: getPanelState,
|
|
2265
2337
|
getParameterById: getParameterById,
|
|
2338
|
+
getParameterHasMissingUnit: getParameterHasMissingUnit,
|
|
2266
2339
|
getParameterInfoParameter: getParameterInfoParameter,
|
|
2267
2340
|
getParametersInUse: getParametersInUse,
|
|
2268
2341
|
getPlotById: getPlotById,
|
|
@@ -2281,6 +2354,83 @@ var selectors = /*#__PURE__*/Object.freeze({
|
|
|
2281
2354
|
getTimeSeriesState: getTimeSeriesState
|
|
2282
2355
|
});
|
|
2283
2356
|
|
|
2357
|
+
var MissingUnitWarningConnect = function MissingUnitWarningConnect(_ref) {
|
|
2358
|
+
var panelId = _ref.panelId,
|
|
2359
|
+
parameter = _ref.parameter,
|
|
2360
|
+
t = _ref.t;
|
|
2361
|
+
var hasMissingUnit = useSelector(function (state) {
|
|
2362
|
+
return getParameterHasMissingUnit(state, panelId, parameter);
|
|
2363
|
+
});
|
|
2364
|
+
if (!hasMissingUnit) {
|
|
2365
|
+
return null;
|
|
2366
|
+
}
|
|
2367
|
+
var parameterName = parameter.propertyLabel || parameter.propertyName;
|
|
2368
|
+
var message = t('timeseries-missing-units', {
|
|
2369
|
+
parameter: parameterName
|
|
2370
|
+
});
|
|
2371
|
+
var _t$split = t('timeseries-missing-units', {
|
|
2372
|
+
parameter: '{{parameter}}'
|
|
2373
|
+
}).split('{{parameter}}'),
|
|
2374
|
+
beforeParameter = _t$split[0],
|
|
2375
|
+
afterParameter = _t$split[1];
|
|
2376
|
+
return jsx(CustomTooltip, {
|
|
2377
|
+
title: jsxs(Fragment, {
|
|
2378
|
+
children: [beforeParameter, jsx("em", {
|
|
2379
|
+
children: parameterName
|
|
2380
|
+
}), afterParameter]
|
|
2381
|
+
}),
|
|
2382
|
+
children: jsx(Box, {
|
|
2383
|
+
"aria-label": message,
|
|
2384
|
+
component: "span",
|
|
2385
|
+
"data-testid": "missing-unit-warning",
|
|
2386
|
+
role: "img",
|
|
2387
|
+
sx: {
|
|
2388
|
+
display: 'inline-flex',
|
|
2389
|
+
color: 'geowebColors.functional.error'
|
|
2390
|
+
},
|
|
2391
|
+
tabIndex: 0,
|
|
2392
|
+
children: jsx(Exclamation, {})
|
|
2393
|
+
})
|
|
2394
|
+
});
|
|
2395
|
+
};
|
|
2396
|
+
|
|
2397
|
+
/* *
|
|
2398
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
2399
|
+
* you may not use this file except in compliance with the License.
|
|
2400
|
+
* You may obtain a copy of the License at
|
|
2401
|
+
*
|
|
2402
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
2403
|
+
*
|
|
2404
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
2405
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
2406
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
2407
|
+
* See the License for the specific language governing permissions and
|
|
2408
|
+
* limitations under the License.
|
|
2409
|
+
*
|
|
2410
|
+
* Copyright 2024 - Koninklijk Nederlands Meteorologisch Instituut (KNMI)
|
|
2411
|
+
* Copyright 2024 - Finnish Meteorological Institute (FMI)
|
|
2412
|
+
* Copyright 2024 - The Norwegian Meteorological Institute (MET Norway)
|
|
2413
|
+
* */
|
|
2414
|
+
var TIME_SERIES_NAMESPACE = 'timeseries';
|
|
2415
|
+
var useTimeseriesTranslation = function useTimeseriesTranslation() {
|
|
2416
|
+
return useTranslation(TIME_SERIES_NAMESPACE);
|
|
2417
|
+
};
|
|
2418
|
+
|
|
2419
|
+
var ParameterInfoButton = function ParameterInfoButton(_ref) {
|
|
2420
|
+
var isOpenInStore = _ref.isOpenInStore,
|
|
2421
|
+
isActive = _ref.isActive,
|
|
2422
|
+
onClick = _ref.onClick;
|
|
2423
|
+
var _useTimeseriesTransla = useTimeseriesTranslation(),
|
|
2424
|
+
t = _useTimeseriesTransla.t;
|
|
2425
|
+
return jsx(CustomIconButton, {
|
|
2426
|
+
"aria-label": t('timeseries-parameter-info'),
|
|
2427
|
+
isSelected: !!isActive && isOpenInStore,
|
|
2428
|
+
onClick: onClick,
|
|
2429
|
+
variant: "flat",
|
|
2430
|
+
children: jsx(Info, {})
|
|
2431
|
+
});
|
|
2432
|
+
};
|
|
2433
|
+
|
|
2284
2434
|
/* *
|
|
2285
2435
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
2286
2436
|
* you may not use this file except in compliance with the License.
|
|
@@ -2872,6 +3022,7 @@ function consolidateFeatures(features) {
|
|
|
2872
3022
|
}
|
|
2873
3023
|
var combineParametersWithData = function combineParametersWithData(parameters, data) {
|
|
2874
3024
|
return parameters.map(function (parameter) {
|
|
3025
|
+
var _ref, _dataPoint$unit;
|
|
2875
3026
|
// for each parameter, find the corresponding data point
|
|
2876
3027
|
var dataPoint = data.find(function (item) {
|
|
2877
3028
|
return item.propertyName === parameter.propertyName && item.serviceId === parameter.serviceId && item.collectionId === parameter.collectionId && item.instanceId === parameter.instanceId && serializeDimensions(item.dimensions) === serializeDimensions(parameter.dimensions);
|
|
@@ -2879,7 +3030,7 @@ var combineParametersWithData = function combineParametersWithData(parameters, d
|
|
|
2879
3030
|
return Object.assign({}, parameter, {
|
|
2880
3031
|
timestep: (dataPoint == null ? void 0 : dataPoint.timestep) || [],
|
|
2881
3032
|
value: (dataPoint == null ? void 0 : dataPoint.value) || [],
|
|
2882
|
-
unit: (dataPoint == null ? void 0 : dataPoint.unit)
|
|
3033
|
+
unit: (_ref = (_dataPoint$unit = dataPoint == null ? void 0 : dataPoint.unit) != null ? _dataPoint$unit : parameter.unit) != null ? _ref : ''
|
|
2883
3034
|
});
|
|
2884
3035
|
});
|
|
2885
3036
|
};
|
|
@@ -3809,8 +3960,16 @@ var TimeSeriesManagerRowAccordion = function TimeSeriesManagerRowAccordion(_ref)
|
|
|
3809
3960
|
alignItems: 'center',
|
|
3810
3961
|
pl: '14px'
|
|
3811
3962
|
},
|
|
3812
|
-
children: [
|
|
3813
|
-
|
|
3963
|
+
children: [jsxs(Grid, {
|
|
3964
|
+
sx: {
|
|
3965
|
+
display: 'flex',
|
|
3966
|
+
alignItems: 'center'
|
|
3967
|
+
},
|
|
3968
|
+
children: [jsx(MissingUnitWarningConnect, {
|
|
3969
|
+
panelId: panelId,
|
|
3970
|
+
parameter: parameter,
|
|
3971
|
+
t: t
|
|
3972
|
+
}), jsx(CustomIconButton, {
|
|
3814
3973
|
"data-testid": "accordionEnableButton",
|
|
3815
3974
|
onClick: function onClick(event) {
|
|
3816
3975
|
event.stopPropagation();
|
|
@@ -3823,7 +3982,7 @@ var TimeSeriesManagerRowAccordion = function TimeSeriesManagerRowAccordion(_ref)
|
|
|
3823
3982
|
}) : jsx(VisibilityOff, {
|
|
3824
3983
|
"data-testid": "disabled-visible"
|
|
3825
3984
|
})
|
|
3826
|
-
})
|
|
3985
|
+
})]
|
|
3827
3986
|
}), jsx(Grid, {
|
|
3828
3987
|
children: jsx(Grid, {
|
|
3829
3988
|
sx: [styles.rowText],
|
|
@@ -4089,17 +4248,25 @@ var ParameterList = function ParameterList(_ref) {
|
|
|
4089
4248
|
rowIsEnabled: rowIsEnabled,
|
|
4090
4249
|
t: t
|
|
4091
4250
|
}),
|
|
4092
|
-
plot:
|
|
4093
|
-
"data-testid": "enableButton",
|
|
4094
|
-
onClick: function onClick() {
|
|
4095
|
-
toggleParameter(parameter.id);
|
|
4096
|
-
},
|
|
4097
|
-
shouldShowAsDisabled: !rowIsEnabled,
|
|
4251
|
+
plot: jsxs(Box, {
|
|
4098
4252
|
sx: {
|
|
4099
|
-
|
|
4253
|
+
display: 'flex',
|
|
4254
|
+
alignItems: 'center',
|
|
4255
|
+
justifyContent: 'flex-end'
|
|
4100
4256
|
},
|
|
4101
|
-
|
|
4102
|
-
|
|
4257
|
+
children: [jsx(MissingUnitWarningConnect, {
|
|
4258
|
+
panelId: panelId,
|
|
4259
|
+
parameter: parameter,
|
|
4260
|
+
t: t
|
|
4261
|
+
}), jsx(CustomIconButton, {
|
|
4262
|
+
"data-testid": "enableButton",
|
|
4263
|
+
onClick: function onClick() {
|
|
4264
|
+
toggleParameter(parameter.id);
|
|
4265
|
+
},
|
|
4266
|
+
shouldShowAsDisabled: !rowIsEnabled,
|
|
4267
|
+
tooltipTitle: (parameterIsEnabled ? t('timeseries-hide') : t('timeseries-show')) + " " + parameter.propertyName,
|
|
4268
|
+
children: rowIsEnabled ? jsx(Visibility, {}) : jsx(VisibilityOff, {})
|
|
4269
|
+
})]
|
|
4103
4270
|
}),
|
|
4104
4271
|
style: jsxs(Grid, {
|
|
4105
4272
|
container: true,
|
|
@@ -5803,6 +5970,9 @@ var SearchFieldConnect = function SearchFieldConnect(_ref) {
|
|
|
5803
5970
|
* Copyright 2023 - Finnish Meteorological Institute (FMI)
|
|
5804
5971
|
* Copyright 2024 - The Norwegian Meteorological Institute (MET Norway)
|
|
5805
5972
|
* */
|
|
5973
|
+
var getCollectionKey = function getCollectionKey(collection) {
|
|
5974
|
+
return JSON.stringify([collection.serviceId, collection.collectionId]);
|
|
5975
|
+
};
|
|
5806
5976
|
var filterCollectionsParametersFromService = function filterCollectionsParametersFromService(collectionList, searchString, serviceFilterChips, allFilterChipsEnabled) {
|
|
5807
5977
|
// If no search string and all filterchips are enabled, simply return the same list
|
|
5808
5978
|
if (searchString === '' && allFilterChipsEnabled) {
|
|
@@ -5858,7 +6028,7 @@ var RowComponent$1 = function RowComponent(_ref) {
|
|
|
5858
6028
|
selectPlot = _ref.selectPlot,
|
|
5859
6029
|
t = _ref.t;
|
|
5860
6030
|
var collectionListItem = filteredCollectionList[index];
|
|
5861
|
-
var
|
|
6031
|
+
var collectionKey = getCollectionKey(collectionListItem);
|
|
5862
6032
|
return jsxs(Box, {
|
|
5863
6033
|
style: style,
|
|
5864
6034
|
children: [jsx(ListItem, {
|
|
@@ -5883,8 +6053,8 @@ var RowComponent$1 = function RowComponent(_ref) {
|
|
|
5883
6053
|
children: jsxs(ListItemButton, {
|
|
5884
6054
|
onClick: function onClick() {
|
|
5885
6055
|
var _Object$assign;
|
|
5886
|
-
var currentState = collectionListItemDetails[
|
|
5887
|
-
setCollectionListItemDetails(Object.assign({}, collectionListItemDetails, (_Object$assign = {}, _Object$assign[
|
|
6056
|
+
var currentState = collectionListItemDetails[collectionKey];
|
|
6057
|
+
setCollectionListItemDetails(Object.assign({}, collectionListItemDetails, (_Object$assign = {}, _Object$assign[collectionKey] = !currentState, _Object$assign)));
|
|
5888
6058
|
},
|
|
5889
6059
|
sx: {
|
|
5890
6060
|
height: '100%',
|
|
@@ -5915,7 +6085,9 @@ var RowComponent$1 = function RowComponent(_ref) {
|
|
|
5915
6085
|
})]
|
|
5916
6086
|
}), jsx(Grid, {
|
|
5917
6087
|
children: jsx(ListItemText, {
|
|
5918
|
-
primary:
|
|
6088
|
+
primary: t('timeseries-results', {
|
|
6089
|
+
count: collectionListItem.parameters.length
|
|
6090
|
+
}),
|
|
5919
6091
|
sx: {
|
|
5920
6092
|
paddingLeft: 1,
|
|
5921
6093
|
paddingRight: 5,
|
|
@@ -5923,10 +6095,10 @@ var RowComponent$1 = function RowComponent(_ref) {
|
|
|
5923
6095
|
}
|
|
5924
6096
|
})
|
|
5925
6097
|
})]
|
|
5926
|
-
}), collectionListItemDetails[
|
|
6098
|
+
}), collectionListItemDetails[collectionKey] ? jsx(ChevronUp, {}) : jsx(ChevronDown, {})]
|
|
5927
6099
|
})
|
|
5928
6100
|
}), jsx(Collapse, {
|
|
5929
|
-
"in": collectionListItemDetails[
|
|
6101
|
+
"in": collectionListItemDetails[collectionKey],
|
|
5930
6102
|
unmountOnExit: true,
|
|
5931
6103
|
children: jsxs(List, {
|
|
5932
6104
|
sx: {
|
|
@@ -6075,7 +6247,10 @@ var TimeSeriesSelectList = function TimeSeriesSelectList(_ref2) {
|
|
|
6075
6247
|
setCollectionListItemDetails = _ref2.setCollectionListItemDetails,
|
|
6076
6248
|
searchFilter = _ref2.searchFilter,
|
|
6077
6249
|
filterChipsServices = _ref2.filterChipsServices,
|
|
6078
|
-
allFilterChipsEnabled = _ref2.allFilterChipsEnabled
|
|
6250
|
+
allFilterChipsEnabled = _ref2.allFilterChipsEnabled,
|
|
6251
|
+
collectionSelection = _ref2.collectionSelection;
|
|
6252
|
+
var listRef = useListRef(null);
|
|
6253
|
+
var lastScrolledTarget = React.useRef(undefined);
|
|
6079
6254
|
var _React$useState = React.useState([]),
|
|
6080
6255
|
filteredCollectionList = _React$useState[0],
|
|
6081
6256
|
setFilteredCollectionList = _React$useState[1];
|
|
@@ -6088,6 +6263,21 @@ var TimeSeriesSelectList = function TimeSeriesSelectList(_ref2) {
|
|
|
6088
6263
|
var filterResults = filterCollectionsParametersFromService(collectionList, searchFilter, filterChipsServices, allFilterChipsEnabled);
|
|
6089
6264
|
setFilteredCollectionList(filterResults);
|
|
6090
6265
|
}, [searchFilter, collectionList, filterChipsServices, allFilterChipsEnabled]);
|
|
6266
|
+
React.useEffect(function () {
|
|
6267
|
+
if (!collectionSelection || lastScrolledTarget.current === collectionSelection) {
|
|
6268
|
+
return;
|
|
6269
|
+
}
|
|
6270
|
+
var index = filteredCollectionList.findIndex(function (collection) {
|
|
6271
|
+
return getCollectionKey(collection) === getCollectionKey(collectionSelection);
|
|
6272
|
+
});
|
|
6273
|
+
if (index >= 0 && listRef.current) {
|
|
6274
|
+
listRef.current.scrollToRow({
|
|
6275
|
+
index: index,
|
|
6276
|
+
align: 'start'
|
|
6277
|
+
});
|
|
6278
|
+
lastScrolledTarget.current = collectionSelection;
|
|
6279
|
+
}
|
|
6280
|
+
}, [collectionSelection, filteredCollectionList, listRef]);
|
|
6091
6281
|
return jsxs(Box, {
|
|
6092
6282
|
"data-testid": "timeseriesSelectList",
|
|
6093
6283
|
sx: {
|
|
@@ -6095,18 +6285,21 @@ var TimeSeriesSelectList = function TimeSeriesSelectList(_ref2) {
|
|
|
6095
6285
|
minHeight: 0,
|
|
6096
6286
|
overflow: 'hidden'
|
|
6097
6287
|
},
|
|
6098
|
-
children: [
|
|
6288
|
+
children: [jsx(Box, {
|
|
6099
6289
|
sx: {
|
|
6100
6290
|
marginBottom: '4px',
|
|
6101
6291
|
fontSize: '12px'
|
|
6102
6292
|
},
|
|
6103
|
-
children:
|
|
6293
|
+
children: t('timeseries-results', {
|
|
6294
|
+
count: filteredCollectionList.length
|
|
6295
|
+
})
|
|
6104
6296
|
}), jsx(List$1, {
|
|
6297
|
+
listRef: listRef,
|
|
6105
6298
|
rowComponent: RowComponent$1,
|
|
6106
6299
|
rowCount: filteredCollectionList.length,
|
|
6107
6300
|
rowHeight: function rowHeight(index) {
|
|
6108
|
-
var
|
|
6109
|
-
if (!collectionListItemDetails[
|
|
6301
|
+
var collectionKey = getCollectionKey(filteredCollectionList[index]);
|
|
6302
|
+
if (!collectionListItemDetails[collectionKey]) {
|
|
6110
6303
|
return DEFAULT_COLLECTION_ROW_HEIGHT;
|
|
6111
6304
|
}
|
|
6112
6305
|
if (filteredCollectionList[index].parameters.length < 1) {
|
|
@@ -6143,6 +6336,15 @@ var TimeSeriesSelectListConnect = /*#__PURE__*/memo(function (_ref) {
|
|
|
6143
6336
|
var _useState = useState({}),
|
|
6144
6337
|
collectionListItemDetails = _useState[0],
|
|
6145
6338
|
setCollectionListItemDetails = _useState[1];
|
|
6339
|
+
var collectionSelection = useSelector(function (store) {
|
|
6340
|
+
return getCollectionSelection(store, panelId);
|
|
6341
|
+
});
|
|
6342
|
+
useEffect(function () {
|
|
6343
|
+
if (isOpen && collectionSelection) {
|
|
6344
|
+
var _setCollectionListIte;
|
|
6345
|
+
setCollectionListItemDetails((_setCollectionListIte = {}, _setCollectionListIte[getCollectionKey(collectionSelection)] = true, _setCollectionListIte));
|
|
6346
|
+
}
|
|
6347
|
+
}, [collectionSelection, isOpen]);
|
|
6146
6348
|
var filterChipsServices = useSelector(function (store) {
|
|
6147
6349
|
return getServiceFilterChips(store, panelId);
|
|
6148
6350
|
});
|
|
@@ -6156,6 +6358,7 @@ var TimeSeriesSelectListConnect = /*#__PURE__*/memo(function (_ref) {
|
|
|
6156
6358
|
allFilterChipsEnabled: allFilterChipsEnabled,
|
|
6157
6359
|
collectionList: collectionList,
|
|
6158
6360
|
collectionListItemDetails: collectionListItemDetails,
|
|
6361
|
+
collectionSelection: collectionSelection,
|
|
6159
6362
|
filterChipsServices: filterChipsServices,
|
|
6160
6363
|
handleAddOrRemoveClick: handleAddOrRemoveClick,
|
|
6161
6364
|
panelId: panelId,
|
|
@@ -6503,10 +6706,32 @@ var TimeSeriesManagerConnect = function TimeSeriesManagerConnect(_ref) {
|
|
|
6503
6706
|
onCloseDialog = _useSetupDialog.onCloseDialog;
|
|
6504
6707
|
var _useTimeseriesTransla = useTimeseriesTranslation(),
|
|
6505
6708
|
t = _useTimeseriesTransla.t;
|
|
6506
|
-
var
|
|
6709
|
+
var dispatch = useDispatch();
|
|
6710
|
+
var collectionSelection = useSelector(function (state) {
|
|
6711
|
+
return getCollectionSelection(state, panelId);
|
|
6712
|
+
});
|
|
6713
|
+
var targetPlotId = collectionSelection == null ? void 0 : collectionSelection.plotId;
|
|
6714
|
+
var _useState = useState(targetPlotId != null ? targetPlotId : ''),
|
|
6507
6715
|
selectPlotId = _useState[0],
|
|
6508
6716
|
setSelectPlotId = _useState[1];
|
|
6509
|
-
var
|
|
6717
|
+
var _useState2 = useState(targetPlotId),
|
|
6718
|
+
syncedTargetPlotId = _useState2[0],
|
|
6719
|
+
setSyncedTargetPlotId = _useState2[1];
|
|
6720
|
+
// Follow the plot targeted by the Data Explorer before children render.
|
|
6721
|
+
if (targetPlotId !== syncedTargetPlotId) {
|
|
6722
|
+
setSyncedTargetPlotId(targetPlotId);
|
|
6723
|
+
if (targetPlotId) {
|
|
6724
|
+
setSelectPlotId(targetPlotId);
|
|
6725
|
+
}
|
|
6726
|
+
}
|
|
6727
|
+
var onSelectPlot = function onSelectPlot(plotId) {
|
|
6728
|
+
setSelectPlotId(plotId);
|
|
6729
|
+
if (targetPlotId && targetPlotId !== plotId) {
|
|
6730
|
+
dispatch(timeSeriesActions.clearCollectionSelection({
|
|
6731
|
+
panelId: panelId
|
|
6732
|
+
}));
|
|
6733
|
+
}
|
|
6734
|
+
};
|
|
6510
6735
|
var confirmDialog = useConfirmationDialog();
|
|
6511
6736
|
var plotState = useSelector(function (state) {
|
|
6512
6737
|
return getPlotState(state, panelId);
|
|
@@ -6642,7 +6867,7 @@ var TimeSeriesManagerConnect = function TimeSeriesManagerConnect(_ref) {
|
|
|
6642
6867
|
patchParameter: patchParameter,
|
|
6643
6868
|
plotState: plotState,
|
|
6644
6869
|
selectPlotId: selectPlotId,
|
|
6645
|
-
setSelectPlotId:
|
|
6870
|
+
setSelectPlotId: onSelectPlot,
|
|
6646
6871
|
toggleParameter: toggleParameter,
|
|
6647
6872
|
togglePlot: togglePlot,
|
|
6648
6873
|
updateTitle: updateTitle
|
|
@@ -7343,8 +7568,8 @@ var dateFormatter = function dateFormatter(date, format) {
|
|
|
7343
7568
|
};
|
|
7344
7569
|
|
|
7345
7570
|
var MIN_GRAPH_WIDTH = 300;
|
|
7346
|
-
var
|
|
7347
|
-
return
|
|
7571
|
+
var roundDecimalValues = function roundDecimalValues(value) {
|
|
7572
|
+
return Number.isInteger(value) ? value.toString() : value.toFixed(1);
|
|
7348
7573
|
};
|
|
7349
7574
|
var createParameterNames = function createParameterNames(plotsWithData) {
|
|
7350
7575
|
var plotTitles = new Map();
|
|
@@ -7558,7 +7783,7 @@ var getYAxis = function getYAxis(plotCharts) {
|
|
|
7558
7783
|
show: true
|
|
7559
7784
|
},
|
|
7560
7785
|
axisLabel: {
|
|
7561
|
-
formatter: "{value} " + unit
|
|
7786
|
+
formatter: unit ? "{value} " + unit : '{value}'
|
|
7562
7787
|
},
|
|
7563
7788
|
nameTextStyle: {
|
|
7564
7789
|
align: 'left'
|
|
@@ -7615,13 +7840,6 @@ var getXAxis = function getXAxis(plotCharts) {
|
|
|
7615
7840
|
};
|
|
7616
7841
|
});
|
|
7617
7842
|
};
|
|
7618
|
-
var isTimeSeriesParam = function isTimeSeriesParam(param) {
|
|
7619
|
-
if (!param || typeof param !== 'object') {
|
|
7620
|
-
return false;
|
|
7621
|
-
}
|
|
7622
|
-
var obj = param;
|
|
7623
|
-
return typeof obj.seriesName === 'string' && Array.isArray(obj.data) && obj.data.length === 2 && typeof obj.data[0] === 'string';
|
|
7624
|
-
};
|
|
7625
7843
|
var getParameterDisplayName = function getParameterDisplayName(parameter) {
|
|
7626
7844
|
return parameter.propertyName + " - " + parameter.collectionId;
|
|
7627
7845
|
};
|
|
@@ -7633,12 +7851,6 @@ var getParameterKey$1 = function getParameterKey(parameter) {
|
|
|
7633
7851
|
}
|
|
7634
7852
|
return [parameter.plotId, parameter.propertyName, parameter.collectionId, (_parameter$instanceId = parameter.instanceId) != null ? _parameter$instanceId : '', serializeDimensions(parameter.dimensions)].join('|');
|
|
7635
7853
|
};
|
|
7636
|
-
var roundDecimalValues = function roundDecimalValues(value) {
|
|
7637
|
-
if (isNaN(value) || value === null || value === undefined) {
|
|
7638
|
-
return 'no data';
|
|
7639
|
-
}
|
|
7640
|
-
return Number.isInteger(value) ? value.toString() : value.toFixed(1);
|
|
7641
|
-
};
|
|
7642
7854
|
/** Shared category order for panel charts and their zoom preview. */
|
|
7643
7855
|
var getSharedTimesteps = function getSharedTimesteps(plots) {
|
|
7644
7856
|
// Keep the time domain stable when collapsing a panel; only its preview contribution changes.
|
|
@@ -7733,7 +7945,14 @@ var getOption = function getOption(plotsWithData, shouldShowLegend, sharedTimest
|
|
|
7733
7945
|
var parameterNames = createParameterNames(plotsWithData);
|
|
7734
7946
|
var plotCharts = getPlotCharts(plotsWithData);
|
|
7735
7947
|
var xAxis = getXAxis(plotCharts).map(function (axis) {
|
|
7736
|
-
return Object.assign({}, axis,
|
|
7948
|
+
return Object.assign({}, axis, {
|
|
7949
|
+
axisPointer: {
|
|
7950
|
+
snap: true,
|
|
7951
|
+
label: {
|
|
7952
|
+
show: false
|
|
7953
|
+
}
|
|
7954
|
+
}
|
|
7955
|
+
}, sharedTimesteps && {
|
|
7737
7956
|
data: sharedTimesteps.map(function (time) {
|
|
7738
7957
|
return time.toISOString();
|
|
7739
7958
|
})
|
|
@@ -7744,30 +7963,7 @@ var getOption = function getOption(plotsWithData, shouldShowLegend, sharedTimest
|
|
|
7744
7963
|
var grid = getGrid(plotCharts);
|
|
7745
7964
|
var tooltip = {
|
|
7746
7965
|
trigger: 'axis',
|
|
7747
|
-
|
|
7748
|
-
extraCssText: 'white-space:pre-wrap;',
|
|
7749
|
-
formatter: function formatter(newParams) {
|
|
7750
|
-
var params = Array.isArray(newParams) ? newParams : [newParams];
|
|
7751
|
-
var _params$reduce = params.reduce(function (acc, param) {
|
|
7752
|
-
if (isTimeSeriesParam(param)) {
|
|
7753
|
-
var _timestamp = param.data[0];
|
|
7754
|
-
var dataValue = param.data[1];
|
|
7755
|
-
var _value = acc.value + "<br />" + param.seriesName + ": " + roundDecimalValues(dataValue);
|
|
7756
|
-
return {
|
|
7757
|
-
timestamp: _timestamp,
|
|
7758
|
-
value: _value
|
|
7759
|
-
};
|
|
7760
|
-
}
|
|
7761
|
-
return acc;
|
|
7762
|
-
}, {
|
|
7763
|
-
timestamp: '',
|
|
7764
|
-
value: ''
|
|
7765
|
-
}),
|
|
7766
|
-
timestamp = _params$reduce.timestamp,
|
|
7767
|
-
value = _params$reduce.value;
|
|
7768
|
-
var timeLabel = getTooltipTimeLabel(timestamp);
|
|
7769
|
-
return "<b>" + timeLabel + "</b>" + value;
|
|
7770
|
-
}
|
|
7966
|
+
showContent: false
|
|
7771
7967
|
};
|
|
7772
7968
|
var legend = parameterNames.reduce(function (legendConfig, parameter) {
|
|
7773
7969
|
var _legendConfig$data, _parameter$enabled4, _Object$assign;
|
|
@@ -7930,6 +8126,30 @@ var getSeries = function getSeries(plotCharts, parameterNames, sharedTimesteps)
|
|
|
7930
8126
|
return pName.id === getParameterKey$1(parameter);
|
|
7931
8127
|
})) == null ? void 0 : _parameterNames$find.name,
|
|
7932
8128
|
type: type,
|
|
8129
|
+
label: {
|
|
8130
|
+
show: false,
|
|
8131
|
+
opacity: 1
|
|
8132
|
+
},
|
|
8133
|
+
emphasis: Object.assign({}, parameter.plotType === 'area' && {
|
|
8134
|
+
areaStyle: {
|
|
8135
|
+
color: 'inherit'
|
|
8136
|
+
}
|
|
8137
|
+
}, {
|
|
8138
|
+
label: {
|
|
8139
|
+
// Show hovered value next to its data point
|
|
8140
|
+
show: true,
|
|
8141
|
+
position: 'right',
|
|
8142
|
+
distance: 8,
|
|
8143
|
+
formatter: function formatter(_ref3) {
|
|
8144
|
+
var value = _ref3.value;
|
|
8145
|
+
var rawValue = Array.isArray(value) ? value[1] : value;
|
|
8146
|
+
if (typeof rawValue !== 'number' || !Number.isFinite(rawValue)) {
|
|
8147
|
+
return ''; // Missing and invalid data points are not displayed in the plot so we don't need a label
|
|
8148
|
+
}
|
|
8149
|
+
return "" + roundDecimalValues(rawValue) + (parameter.unit ? " " + parameter.unit : '');
|
|
8150
|
+
}
|
|
8151
|
+
}
|
|
8152
|
+
}),
|
|
7933
8153
|
xAxisIndex: plotIndex,
|
|
7934
8154
|
yAxisIndex: plotChart.countPreviousUnits + unitIndex,
|
|
7935
8155
|
lineStyle: {
|
|
@@ -7993,31 +8213,25 @@ function getPlotCharts(plotsWithData) {
|
|
|
7993
8213
|
return plotCharts;
|
|
7994
8214
|
}
|
|
7995
8215
|
|
|
7996
|
-
|
|
7997
|
-
|
|
7998
|
-
|
|
7999
|
-
|
|
8000
|
-
|
|
8001
|
-
|
|
8002
|
-
|
|
8003
|
-
|
|
8004
|
-
|
|
8005
|
-
|
|
8006
|
-
|
|
8007
|
-
|
|
8008
|
-
|
|
8009
|
-
|
|
8010
|
-
|
|
8011
|
-
|
|
8012
|
-
|
|
8013
|
-
|
|
8014
|
-
|
|
8015
|
-
};
|
|
8016
|
-
}, [enabled]);
|
|
8017
|
-
return now;
|
|
8018
|
-
};
|
|
8019
|
-
var getCurrentTimeLines = function getCurrentTimeLines(instance, currentTime, showPlots, showZoom) {
|
|
8020
|
-
if (instance.isDisposed() || !Number.isFinite(currentTime)) {
|
|
8216
|
+
/* *
|
|
8217
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
8218
|
+
* you may not use this file except in compliance with the License.
|
|
8219
|
+
* You may obtain a copy of the License at
|
|
8220
|
+
*
|
|
8221
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
8222
|
+
*
|
|
8223
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
8224
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
8225
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
8226
|
+
* See the License for the specific language governing permissions and
|
|
8227
|
+
* limitations under the License.
|
|
8228
|
+
*
|
|
8229
|
+
* Copyright 2026 - Koninklijk Nederlands Meteorologisch Instituut (KNMI)
|
|
8230
|
+
* Copyright 2026 - Finnish Meteorological Institute (FMI)
|
|
8231
|
+
* Copyright 2026 - The Norwegian Meteorological Institute (MET Norway)
|
|
8232
|
+
* */
|
|
8233
|
+
var getTimeIndicatorLines = function getTimeIndicatorLines(instance, timestamp, showPlots, showZoom, getZoomTimePixel) {
|
|
8234
|
+
if (instance.isDisposed() || !Number.isFinite(timestamp)) {
|
|
8021
8235
|
return [];
|
|
8022
8236
|
}
|
|
8023
8237
|
var api = instance;
|
|
@@ -8033,12 +8247,12 @@ var getCurrentTimeLines = function getCurrentTimeLines(instance, currentTime, sh
|
|
|
8033
8247
|
var _axis$axis$scale$getE = axis.axis.scale.getExtent(),
|
|
8034
8248
|
min = _axis$axis$scale$getE[0],
|
|
8035
8249
|
max = _axis$axis$scale$getE[1];
|
|
8036
|
-
if (showPlots &&
|
|
8250
|
+
if (showPlots && timestamp >= min && timestamp <= max) {
|
|
8037
8251
|
var _model$getComponent;
|
|
8038
8252
|
var rect = (_model$getComponent = model.getComponent('grid', axis.get('gridIndex'))) == null || (_model$getComponent = _model$getComponent.coordinateSystem) == null ? void 0 : _model$getComponent.getRect();
|
|
8039
8253
|
var x = instance.convertToPixel({
|
|
8040
8254
|
xAxisIndex: axis.componentIndex
|
|
8041
|
-
},
|
|
8255
|
+
}, timestamp);
|
|
8042
8256
|
if (rect && Number.isFinite(x) && x >= rect.x && x <= rect.x + rect.width) {
|
|
8043
8257
|
lines.push({
|
|
8044
8258
|
id: "plot-" + axis.componentIndex,
|
|
@@ -8058,14 +8272,15 @@ var getCurrentTimeLines = function getCurrentTimeLines(instance, currentTime, sh
|
|
|
8058
8272
|
// The proxy retains the full axis extent while the scale is zoomed.
|
|
8059
8273
|
var _ref2 = (_zoom$getAxisProxy = zoom == null || zoom.getAxisProxy == null ? void 0 : zoom.getAxisProxy('x', axis.componentIndex)) != null ? _zoom$getAxisProxy : {},
|
|
8060
8274
|
extent = _ref2._extent;
|
|
8061
|
-
if (background && extent && extent.every(Number.isFinite) &&
|
|
8275
|
+
if (background && extent && extent.every(Number.isFinite) && timestamp >= extent[0] && timestamp <= extent[1]) {
|
|
8276
|
+
var _getZoomTimePixel;
|
|
8062
8277
|
background.getComputedTransform();
|
|
8063
8278
|
var start = background.transformCoordToGlobal(0, 0);
|
|
8064
8279
|
var end = background.transformCoordToGlobal(background.shape.width, background.shape.height);
|
|
8065
|
-
var fraction = extent[0] === extent[1] ? 0.5 : (
|
|
8280
|
+
var fraction = extent[0] === extent[1] ? 0.5 : (timestamp - extent[0]) / (extent[1] - extent[0]);
|
|
8066
8281
|
lines.push({
|
|
8067
8282
|
id: 'zoom',
|
|
8068
|
-
x: start[0] + fraction * (end[0] - start[0]),
|
|
8283
|
+
x: (_getZoomTimePixel = getZoomTimePixel == null ? void 0 : getZoomTimePixel(fraction, instance)) != null ? _getZoomTimePixel : start[0] + fraction * (end[0] - start[0]),
|
|
8069
8284
|
y: Math.min(start[1], end[1]),
|
|
8070
8285
|
height: Math.abs(end[1] - start[1])
|
|
8071
8286
|
});
|
|
@@ -8074,71 +8289,530 @@ var getCurrentTimeLines = function getCurrentTimeLines(instance, currentTime, sh
|
|
|
8074
8289
|
});
|
|
8075
8290
|
return lines;
|
|
8076
8291
|
};
|
|
8077
|
-
|
|
8078
|
-
|
|
8079
|
-
|
|
8080
|
-
|
|
8081
|
-
|
|
8082
|
-
|
|
8083
|
-
var
|
|
8084
|
-
|
|
8085
|
-
|
|
8292
|
+
/** Project the full time range of a plot into another chart's local coordinates. */
|
|
8293
|
+
var getFullTimePixel = function getFullTimePixel(plot, target, fraction) {
|
|
8294
|
+
var rect = plot.getModel().getComponent('grid', 0).coordinateSystem.getRect();
|
|
8295
|
+
return plot.getDom().getBoundingClientRect().left - target.getDom().getBoundingClientRect().left + rect.x + fraction * rect.width;
|
|
8296
|
+
};
|
|
8297
|
+
var getIndicatorGraphics = function getIndicatorGraphics(instance, id) {
|
|
8298
|
+
var _instance$getOption$g, _instance$getOption$g2;
|
|
8299
|
+
return (_instance$getOption$g = (_instance$getOption$g2 = instance.getOption().graphic) == null ? void 0 : _instance$getOption$g2.flatMap(function (entry) {
|
|
8300
|
+
var _entry$elements;
|
|
8301
|
+
return (_entry$elements = entry.elements) != null ? _entry$elements : [];
|
|
8302
|
+
}).filter(function (entry) {
|
|
8303
|
+
var _entry$id;
|
|
8304
|
+
return (_entry$id = entry.id) == null ? void 0 : _entry$id.startsWith(id + "-");
|
|
8305
|
+
})) != null ? _instance$getOption$g : [];
|
|
8306
|
+
};
|
|
8307
|
+
/** Keep passive annotations in ECharts so native hover labels can paint above them. */
|
|
8308
|
+
var useTimeIndicatorGraphics = function useTimeIndicatorGraphics(instance, id, timestamp, showPlots, showZoom, outerColor, centreColor, getZoomTimePixel, subscribeLayout) {
|
|
8086
8309
|
React.useEffect(function () {
|
|
8087
|
-
if (!instance) {
|
|
8310
|
+
if (!instance || instance.isDisposed()) {
|
|
8088
8311
|
return undefined;
|
|
8089
8312
|
}
|
|
8313
|
+
var frame;
|
|
8090
8314
|
var update = function update() {
|
|
8091
|
-
|
|
8092
|
-
|
|
8093
|
-
return
|
|
8094
|
-
});
|
|
8095
|
-
};
|
|
8096
|
-
update();
|
|
8097
|
-
instance.on('rendered', update);
|
|
8098
|
-
return function () {
|
|
8099
|
-
if (!instance.isDisposed()) {
|
|
8100
|
-
instance.off('rendered', update);
|
|
8315
|
+
frame = undefined;
|
|
8316
|
+
if (instance.isDisposed()) {
|
|
8317
|
+
return;
|
|
8101
8318
|
}
|
|
8102
|
-
|
|
8103
|
-
|
|
8104
|
-
|
|
8319
|
+
var elements = getTimeIndicatorLines(instance, timestamp, showPlots, showZoom, getZoomTimePixel).flatMap(function (_ref3) {
|
|
8320
|
+
var lineId = _ref3.id,
|
|
8321
|
+
x = _ref3.x,
|
|
8322
|
+
y = _ref3.y,
|
|
8323
|
+
height = _ref3.height;
|
|
8324
|
+
return [outerColor, centreColor].map(function (stroke, index) {
|
|
8325
|
+
return {
|
|
8326
|
+
id: id + "-" + lineId + "-" + index,
|
|
8327
|
+
type: 'line',
|
|
8328
|
+
silent: true,
|
|
8329
|
+
// Plot lines sit above ordinary data and below highlighted labels.
|
|
8330
|
+
// Slider lines sit above its fill and below its handles/detail labels.
|
|
8331
|
+
z: lineId === 'zoom' ? 4 : 10,
|
|
8332
|
+
// Selected time keeps priority when both timestamps coincide.
|
|
8333
|
+
z2: (lineId === 'zoom' ? 1 : 11) + (id === 'selected-time' ? 1 : 0),
|
|
8334
|
+
shape: {
|
|
8335
|
+
x1: x,
|
|
8336
|
+
x2: x,
|
|
8337
|
+
y1: y,
|
|
8338
|
+
y2: y + height
|
|
8339
|
+
},
|
|
8340
|
+
style: {
|
|
8341
|
+
stroke: stroke,
|
|
8342
|
+
lineWidth: index === 0 ? 7 : 2
|
|
8343
|
+
}
|
|
8344
|
+
};
|
|
8345
|
+
});
|
|
8346
|
+
});
|
|
8347
|
+
var previous = getIndicatorGraphics(instance, id);
|
|
8348
|
+
var removed = previous.filter(function (entry) {
|
|
8349
|
+
return !elements.some(function (child) {
|
|
8350
|
+
return child.id === entry.id;
|
|
8351
|
+
});
|
|
8352
|
+
});
|
|
8353
|
+
if (!removed.length && isEqual(previous.map(function (_ref4) {
|
|
8354
|
+
var elementId = _ref4.id,
|
|
8355
|
+
shape = _ref4.shape,
|
|
8356
|
+
style = _ref4.style;
|
|
8357
|
+
return {
|
|
8358
|
+
id: elementId,
|
|
8359
|
+
shape: shape,
|
|
8360
|
+
style: style
|
|
8361
|
+
};
|
|
8362
|
+
}), elements.map(function (_ref5) {
|
|
8363
|
+
var elementId = _ref5.id,
|
|
8364
|
+
shape = _ref5.shape,
|
|
8365
|
+
style = _ref5.style;
|
|
8366
|
+
return {
|
|
8367
|
+
id: elementId,
|
|
8368
|
+
shape: shape,
|
|
8369
|
+
style: style
|
|
8370
|
+
};
|
|
8371
|
+
}))) {
|
|
8372
|
+
return;
|
|
8373
|
+
}
|
|
8374
|
+
instance.setOption({
|
|
8375
|
+
graphic: {
|
|
8376
|
+
elements: [].concat(elements, removed.map(function (_ref6) {
|
|
8377
|
+
var elementId = _ref6.id;
|
|
8378
|
+
return {
|
|
8379
|
+
id: elementId,
|
|
8380
|
+
$action: 'remove'
|
|
8381
|
+
};
|
|
8382
|
+
}))
|
|
8383
|
+
}
|
|
8384
|
+
}, {
|
|
8385
|
+
silent: true
|
|
8386
|
+
});
|
|
8387
|
+
};
|
|
8388
|
+
// rendered can fire inside setOption/resize. Defer mutations until that
|
|
8389
|
+
// update completes, and coalesce multiple render/layout notifications.
|
|
8390
|
+
var schedule = function schedule() {
|
|
8391
|
+
if (frame === undefined) {
|
|
8392
|
+
frame = requestAnimationFrame(update);
|
|
8393
|
+
}
|
|
8394
|
+
};
|
|
8395
|
+
update();
|
|
8396
|
+
instance.on('rendered', schedule);
|
|
8397
|
+
var unsubscribe = subscribeLayout == null ? void 0 : subscribeLayout(schedule);
|
|
8398
|
+
return function () {
|
|
8399
|
+
if (frame !== undefined) {
|
|
8400
|
+
cancelAnimationFrame(frame);
|
|
8401
|
+
}
|
|
8402
|
+
unsubscribe == null || unsubscribe();
|
|
8403
|
+
if (!instance.isDisposed()) {
|
|
8404
|
+
instance.off('rendered', schedule);
|
|
8405
|
+
var elements = getIndicatorGraphics(instance, id).map(function (_ref7) {
|
|
8406
|
+
var elementId = _ref7.id;
|
|
8407
|
+
return {
|
|
8408
|
+
id: elementId,
|
|
8409
|
+
$action: 'remove'
|
|
8410
|
+
};
|
|
8411
|
+
});
|
|
8412
|
+
if (elements.length) {
|
|
8413
|
+
instance.setOption({
|
|
8414
|
+
graphic: {
|
|
8415
|
+
elements: elements
|
|
8416
|
+
}
|
|
8417
|
+
}, {
|
|
8418
|
+
silent: true
|
|
8419
|
+
});
|
|
8420
|
+
}
|
|
8421
|
+
}
|
|
8422
|
+
};
|
|
8423
|
+
}, [instance, id, timestamp, showPlots, showZoom, outerColor, centreColor, getZoomTimePixel, subscribeLayout]);
|
|
8424
|
+
};
|
|
8425
|
+
|
|
8426
|
+
/* *
|
|
8427
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
8428
|
+
* you may not use this file except in compliance with the License.
|
|
8429
|
+
* You may obtain a copy of the License at
|
|
8430
|
+
*
|
|
8431
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
8432
|
+
*
|
|
8433
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
8434
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
8435
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
8436
|
+
* See the License for the specific language governing permissions and
|
|
8437
|
+
* limitations under the License.
|
|
8438
|
+
*
|
|
8439
|
+
* Copyright 2026 - Koninklijk Nederlands Meteorologisch Instituut (KNMI)
|
|
8440
|
+
* Copyright 2026 - Finnish Meteorological Institute (FMI)
|
|
8441
|
+
* Copyright 2026 - The Norwegian Meteorological Institute (MET Norway)
|
|
8442
|
+
* */
|
|
8443
|
+
/** One clock per view; standalone charts can use their own clock. Times are milliseconds. */
|
|
8444
|
+
var useCurrentTime = function useCurrentTime(enabled) {
|
|
8445
|
+
if (enabled === void 0) {
|
|
8446
|
+
enabled = true;
|
|
8447
|
+
}
|
|
8448
|
+
var _React$useState = React.useState(Date.now),
|
|
8449
|
+
now = _React$useState[0],
|
|
8450
|
+
setNow = _React$useState[1];
|
|
8451
|
+
React.useEffect(function () {
|
|
8452
|
+
if (!enabled) {
|
|
8453
|
+
return undefined;
|
|
8454
|
+
}
|
|
8455
|
+
var update = function update() {
|
|
8456
|
+
return setNow(Date.now());
|
|
8457
|
+
};
|
|
8458
|
+
update();
|
|
8459
|
+
var timer = window.setInterval(update, 60000);
|
|
8460
|
+
return function () {
|
|
8461
|
+
return window.clearInterval(timer);
|
|
8462
|
+
};
|
|
8463
|
+
}, [enabled]);
|
|
8464
|
+
return now;
|
|
8465
|
+
};
|
|
8466
|
+
var CurrentTime = function CurrentTime(_ref) {
|
|
8467
|
+
var instance = _ref.instance,
|
|
8468
|
+
currentTime = _ref.currentTime,
|
|
8469
|
+
showPlots = _ref.showPlots,
|
|
8470
|
+
showZoom = _ref.showZoom;
|
|
8471
|
+
var theme = useTheme();
|
|
8472
|
+
var _theme$palette$geoweb = theme.palette.geowebColors.timeSlider,
|
|
8105
8473
|
playerNeedleTime = _theme$palette$geoweb.playerNeedleTime,
|
|
8106
8474
|
playerNeedleTimeTop = _theme$palette$geoweb.playerNeedleTimeTop;
|
|
8107
|
-
|
|
8108
|
-
|
|
8109
|
-
|
|
8110
|
-
|
|
8111
|
-
|
|
8112
|
-
|
|
8113
|
-
|
|
8114
|
-
|
|
8115
|
-
|
|
8116
|
-
|
|
8117
|
-
|
|
8118
|
-
|
|
8119
|
-
|
|
8120
|
-
|
|
8121
|
-
|
|
8122
|
-
|
|
8123
|
-
|
|
8124
|
-
|
|
8125
|
-
|
|
8126
|
-
|
|
8127
|
-
|
|
8128
|
-
|
|
8129
|
-
|
|
8130
|
-
|
|
8131
|
-
|
|
8132
|
-
|
|
8133
|
-
|
|
8134
|
-
|
|
8135
|
-
|
|
8136
|
-
|
|
8137
|
-
|
|
8138
|
-
|
|
8139
|
-
|
|
8140
|
-
|
|
8475
|
+
useTimeIndicatorGraphics(instance, 'current-time', currentTime, showPlots, showZoom, playerNeedleTime.rgba, playerNeedleTimeTop.rgba);
|
|
8476
|
+
return null;
|
|
8477
|
+
};
|
|
8478
|
+
|
|
8479
|
+
/* *
|
|
8480
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
8481
|
+
* you may not use this file except in compliance with the License.
|
|
8482
|
+
* You may obtain a copy of the License at
|
|
8483
|
+
*
|
|
8484
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
8485
|
+
*
|
|
8486
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
8487
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
8488
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
8489
|
+
* See the License for the specific language governing permissions and
|
|
8490
|
+
* limitations under the License.
|
|
8491
|
+
*
|
|
8492
|
+
* Copyright 2026 - Koninklijk Nederlands Meteorologisch Instituut (KNMI)
|
|
8493
|
+
* Copyright 2026 - Finnish Meteorological Institute (FMI)
|
|
8494
|
+
* Copyright 2026 - The Norwegian Meteorological Institute (MET Norway)
|
|
8495
|
+
* */
|
|
8496
|
+
// The slider and its indicator share these dimensions, including in standalone charts.
|
|
8497
|
+
var TIME_SERIES_ZOOM_HEIGHT = 30;
|
|
8498
|
+
var TIME_SERIES_ZOOM_BOTTOM = 14;
|
|
8499
|
+
/** A passive annotation: chart hover, slider handles and dragging remain available. */
|
|
8500
|
+
var SelectedTime = function SelectedTime(_ref) {
|
|
8501
|
+
var instance = _ref.instance,
|
|
8502
|
+
selectedTime = _ref.selectedTime,
|
|
8503
|
+
controlsOnly = _ref.controlsOnly,
|
|
8504
|
+
shouldShowZoom = _ref.shouldShowZoom,
|
|
8505
|
+
getZoomTimePixel = _ref.getZoomTimePixel,
|
|
8506
|
+
subscribeLayout = _ref.subscribeLayout;
|
|
8507
|
+
var theme = useTheme();
|
|
8508
|
+
var colors = theme.palette.geowebColors.timeSlider;
|
|
8509
|
+
useTimeIndicatorGraphics(instance, 'selected-time', selectedTime * 1000, !controlsOnly, controlsOnly !== 'legend' && (shouldShowZoom || controlsOnly === 'zoom'), colors.playerNeedlePlayer.rgba, colors.playerNeedlePlayerTop.rgba, getZoomTimePixel, subscribeLayout);
|
|
8510
|
+
return null;
|
|
8511
|
+
};
|
|
8512
|
+
|
|
8513
|
+
/* *
|
|
8514
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
8515
|
+
* you may not use this file except in compliance with the License.
|
|
8516
|
+
* You may obtain a copy of the License at
|
|
8517
|
+
*
|
|
8518
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
8519
|
+
*
|
|
8520
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
8521
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
8522
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
8523
|
+
* See the License for the specific language governing permissions and
|
|
8524
|
+
* limitations under the License.
|
|
8525
|
+
*
|
|
8526
|
+
* Copyright 2026 - Koninklijk Nederlands Meteorologisch Instituut (KNMI)
|
|
8527
|
+
* Copyright 2026 - Finnish Meteorological Institute (FMI)
|
|
8528
|
+
* Copyright 2026 - The Norwegian Meteorological Institute (MET Norway)
|
|
8529
|
+
* */
|
|
8530
|
+
var getHoverLabels = function getHoverLabels(instance, timestamp, side) {
|
|
8531
|
+
if (instance.isDisposed()) {
|
|
8532
|
+
return [];
|
|
8533
|
+
}
|
|
8534
|
+
var labels = [];
|
|
8535
|
+
var model = instance.getModel();
|
|
8536
|
+
model == null || model.eachSeries(function (series) {
|
|
8537
|
+
var _series$get, _series$get2;
|
|
8538
|
+
var data = series.getData();
|
|
8539
|
+
var index = series.indicesOfNearest('x', 'x', timestamp)[0];
|
|
8540
|
+
if (index === undefined || data.get('x', index) !== timestamp || !Number.isFinite(data.get('y', index))) {
|
|
8541
|
+
return;
|
|
8542
|
+
}
|
|
8543
|
+
var axisIndex = (_series$get = series.get('xAxisIndex')) != null ? _series$get : 0;
|
|
8544
|
+
var rect = model.getComponent('xAxis', axisIndex).axis.grid.getRect();
|
|
8545
|
+
var pointerX = instance.convertToPixel({
|
|
8546
|
+
xAxisIndex: axisIndex
|
|
8547
|
+
}, timestamp);
|
|
8548
|
+
var x = pointerX;
|
|
8549
|
+
var y = instance.convertToPixel({
|
|
8550
|
+
yAxisIndex: (_series$get2 = series.get('yAxisIndex')) != null ? _series$get2 : 0
|
|
8551
|
+
}, data.get('y', index));
|
|
8552
|
+
if (series.get('type') === 'bar') {
|
|
8553
|
+
var element = data.getItemGraphicEl(index);
|
|
8554
|
+
if (element) {
|
|
8555
|
+
// Side labels are centred on the rendered bar, not on its value endpoint.
|
|
8556
|
+
var bounds = element.getBoundingRect();
|
|
8557
|
+
var _element$transformCoo = element.transformCoordToGlobal(bounds.x + (side === 'right' ? bounds.width : 0), bounds.y + bounds.height / 2);
|
|
8558
|
+
x = _element$transformCoo[0];
|
|
8559
|
+
y = _element$transformCoo[1];
|
|
8560
|
+
}
|
|
8561
|
+
}
|
|
8562
|
+
if (!Number.isFinite(x) || !Number.isFinite(y) || pointerX < rect.x || pointerX > rect.x + rect.width || y < rect.y || y > rect.y + rect.height) {
|
|
8563
|
+
return;
|
|
8564
|
+
}
|
|
8565
|
+
var text = series.getFormattedLabel(index, 'emphasis');
|
|
8566
|
+
var size = format.getTextRect(text, 'bold 11px sans-serif');
|
|
8567
|
+
// Include the native label's padding and border, independently of series opacity.
|
|
8568
|
+
labels.push({
|
|
8569
|
+
seriesIndex: series.seriesIndex,
|
|
8570
|
+
axisIndex: axisIndex,
|
|
8571
|
+
x: x,
|
|
8572
|
+
y: y,
|
|
8573
|
+
pointerX: pointerX,
|
|
8574
|
+
width: size.width + 14,
|
|
8575
|
+
height: Math.max(11, size.height) + 10,
|
|
8576
|
+
rect: rect
|
|
8577
|
+
});
|
|
8578
|
+
});
|
|
8579
|
+
return labels;
|
|
8580
|
+
};
|
|
8581
|
+
// Hover-only emphasis labels bypass ECharts' normal labelLayout pass.
|
|
8582
|
+
// Keep ECharts responsible for drawing, and supply non-overlapping offsets.
|
|
8583
|
+
var layoutHoverLabels = function layoutHoverLabels(labels, side) {
|
|
8584
|
+
var result = [];
|
|
8585
|
+
var axes = Array.from(new Set(labels.map(function (_ref) {
|
|
8586
|
+
var axisIndex = _ref.axisIndex;
|
|
8587
|
+
return axisIndex;
|
|
8588
|
+
})));
|
|
8589
|
+
axes.forEach(function (axisIndex) {
|
|
8590
|
+
var group = labels.filter(function (label) {
|
|
8591
|
+
return label.axisIndex === axisIndex;
|
|
8592
|
+
}).sort(function (first, second) {
|
|
8593
|
+
return first.y - second.y || first.seriesIndex - second.seriesIndex;
|
|
8594
|
+
});
|
|
8595
|
+
var rect = group[0].rect;
|
|
8596
|
+
var height = Math.max.apply(Math, group.map(function (label) {
|
|
8597
|
+
return label.height;
|
|
8598
|
+
}));
|
|
8599
|
+
var spacing = height + 4;
|
|
8600
|
+
var rows = Math.max(1, Math.floor((rect.height + 4) / spacing));
|
|
8601
|
+
var columnOffset = 0;
|
|
8602
|
+
// Dense plots use additional columns on the same side rather than overlapping.
|
|
8603
|
+
var _loop = function _loop() {
|
|
8604
|
+
var column = group.slice(start, start + rows);
|
|
8605
|
+
var centers = column.map(function (label) {
|
|
8606
|
+
return Math.max(rect.y + height / 2, Math.min(label.y, rect.y + rect.height - height / 2));
|
|
8607
|
+
});
|
|
8608
|
+
for (var index = 1; index < centers.length; index += 1) {
|
|
8609
|
+
centers[index] = Math.max(centers[index], centers[index - 1] + spacing);
|
|
8610
|
+
}
|
|
8611
|
+
var overflow = Math.max(0, centers[centers.length - 1] - (rect.y + rect.height - height / 2));
|
|
8612
|
+
centers[centers.length - 1] -= overflow;
|
|
8613
|
+
for (var _index = centers.length - 2; _index >= 0; _index -= 1) {
|
|
8614
|
+
centers[_index] = Math.min(centers[_index], centers[_index + 1] - spacing);
|
|
8615
|
+
}
|
|
8616
|
+
var horizontalOffset = (side === 'right' ? 1 : -1) * columnOffset;
|
|
8617
|
+
column.forEach(function (label, index) {
|
|
8618
|
+
return result.push(Object.assign({}, label, {
|
|
8619
|
+
offset: [horizontalOffset, centers[index] - label.y]
|
|
8620
|
+
}));
|
|
8621
|
+
});
|
|
8622
|
+
columnOffset += Math.max.apply(Math, column.map(function (label) {
|
|
8623
|
+
return label.width;
|
|
8624
|
+
})) + 4;
|
|
8625
|
+
};
|
|
8626
|
+
for (var start = 0; start < group.length; start += rows) {
|
|
8627
|
+
_loop();
|
|
8628
|
+
}
|
|
8629
|
+
});
|
|
8630
|
+
return result;
|
|
8631
|
+
};
|
|
8632
|
+
var getHoverLabelSide = function getHoverLabelSide(instances, timestamp) {
|
|
8633
|
+
return instances.every(function (instance) {
|
|
8634
|
+
return layoutHoverLabels(getHoverLabels(instance, timestamp, 'right'), 'right').every(function (label) {
|
|
8635
|
+
var _label$pointerX;
|
|
8636
|
+
return ((_label$pointerX = label.pointerX) != null ? _label$pointerX : label.x) + 12 + label.offset[0] + label.width <= label.rect.x + label.rect.width;
|
|
8637
|
+
});
|
|
8638
|
+
}) ? 'right' : 'left';
|
|
8639
|
+
};
|
|
8640
|
+
var TIME_LABEL_PREFIX = 'hover-time-label-';
|
|
8641
|
+
var getHoverTimeLabels = function getHoverTimeLabels(instance, timestamp, style) {
|
|
8642
|
+
var _instance$getModel;
|
|
8643
|
+
if (instance.isDisposed() || timestamp === null || !Number.isFinite(timestamp)) {
|
|
8644
|
+
return [];
|
|
8645
|
+
}
|
|
8646
|
+
var text = new Date(timestamp).toISOString().slice(11, 16);
|
|
8647
|
+
var textSize = format.getTextRect(text, style.fontSize + "px sans-serif");
|
|
8648
|
+
var width = textSize.width + style.padding[1] + style.padding[3];
|
|
8649
|
+
var height = textSize.height + style.padding[0] + style.padding[2];
|
|
8650
|
+
var labels = [];
|
|
8651
|
+
(_instance$getModel = instance.getModel()) == null || _instance$getModel.eachComponent('xAxis', function (axis) {
|
|
8652
|
+
var _axis$axis$scale$getE = axis.axis.scale.getExtent(),
|
|
8653
|
+
min = _axis$axis$scale$getE[0],
|
|
8654
|
+
max = _axis$axis$scale$getE[1];
|
|
8655
|
+
if (axis.axis.scale.isBlank() || timestamp < min || timestamp > max) {
|
|
8656
|
+
return;
|
|
8657
|
+
}
|
|
8658
|
+
var rect = axis.axis.grid.getRect();
|
|
8659
|
+
var x = instance.convertToPixel({
|
|
8660
|
+
xAxisIndex: axis.componentIndex
|
|
8661
|
+
}, timestamp);
|
|
8662
|
+
if (!Number.isFinite(x) || rect.width <= 0 || rect.height <= 0) {
|
|
8663
|
+
return;
|
|
8664
|
+
}
|
|
8665
|
+
labels.push({
|
|
8666
|
+
id: "" + TIME_LABEL_PREFIX + axis.componentIndex,
|
|
8667
|
+
type: 'text',
|
|
8668
|
+
silent: true,
|
|
8669
|
+
z: 100,
|
|
8670
|
+
x: Math.max(rect.x + width / 2, Math.min(x, rect.x + rect.width - width / 2)),
|
|
8671
|
+
// Tight plot margins must not clip the annotation above the canvas.
|
|
8672
|
+
y: Math.max(height, rect.y - 1),
|
|
8673
|
+
style: {
|
|
8674
|
+
text: text,
|
|
8675
|
+
fill: style.color,
|
|
8676
|
+
backgroundColor: style.backgroundColor,
|
|
8677
|
+
fontSize: style.fontSize,
|
|
8678
|
+
fontFamily: 'sans-serif',
|
|
8679
|
+
padding: style.padding,
|
|
8680
|
+
borderRadius: style.borderRadius,
|
|
8681
|
+
align: 'center',
|
|
8682
|
+
verticalAlign: 'bottom',
|
|
8683
|
+
opacity: 1
|
|
8684
|
+
}
|
|
8685
|
+
});
|
|
8686
|
+
});
|
|
8687
|
+
return labels;
|
|
8688
|
+
};
|
|
8689
|
+
// Attached series labels inherit the series z during ECharts updates. Lift only
|
|
8690
|
+
// the hovered labels after those updates; moving a whole series would also lift
|
|
8691
|
+
// its data over labels belonging to another series.
|
|
8692
|
+
var alignHoverValueLabels = function alignHoverValueLabels(instance, timestamp, side, placements) {
|
|
8693
|
+
var _instance$getModel2;
|
|
8694
|
+
var placement;
|
|
8695
|
+
var align = function align(element) {
|
|
8696
|
+
var _placement$pointerX;
|
|
8697
|
+
var label = element.getTextContent();
|
|
8698
|
+
if (!label) {
|
|
8699
|
+
return;
|
|
8700
|
+
}
|
|
8701
|
+
if (label.z !== 100) {
|
|
8702
|
+
label.attr({
|
|
8703
|
+
z: 100
|
|
8704
|
+
});
|
|
8705
|
+
}
|
|
8706
|
+
if (label.ignore || !label.transform || !placement) {
|
|
8707
|
+
return;
|
|
8708
|
+
}
|
|
8709
|
+
// Align the visible label box, independently of bar width, symbol size and
|
|
8710
|
+
// hover scaling. Updating the text avoids resetting the series' hover state.
|
|
8711
|
+
var bounds = label.getBoundingRect();
|
|
8712
|
+
var _label$transformCoord = label.transformCoordToGlobal(bounds.x + (side === 'left' ? bounds.width : 0), bounds.y),
|
|
8713
|
+
edge = _label$transformCoord[0];
|
|
8714
|
+
var target = ((_placement$pointerX = placement.pointerX) != null ? _placement$pointerX : placement.x) + (side === 'right' ? 12 : -12) + placement.offset[0];
|
|
8715
|
+
var delta = target - edge;
|
|
8716
|
+
if (Number.isFinite(delta) && Math.abs(delta) > 0.01) {
|
|
8717
|
+
var _label$style$x;
|
|
8718
|
+
label.attr({
|
|
8719
|
+
style: {
|
|
8720
|
+
x: ((_label$style$x = label.style.x) != null ? _label$style$x : 0) + delta
|
|
8721
|
+
}
|
|
8722
|
+
});
|
|
8723
|
+
}
|
|
8724
|
+
};
|
|
8725
|
+
(_instance$getModel2 = instance.getModel()) == null || _instance$getModel2.eachSeries(function (series) {
|
|
8726
|
+
var data = series.getData();
|
|
8727
|
+
var index = series.indicesOfNearest('x', 'x', timestamp)[0];
|
|
8728
|
+
if (index === undefined || data.get('x', index) !== timestamp) {
|
|
8729
|
+
return;
|
|
8730
|
+
}
|
|
8731
|
+
var element = data.getItemGraphicEl(index);
|
|
8732
|
+
placement = placements.find(function (entry) {
|
|
8733
|
+
return entry.seriesIndex === series.seriesIndex;
|
|
8734
|
+
});
|
|
8735
|
+
if (element) {
|
|
8736
|
+
align(element);
|
|
8737
|
+
// Line and scatter symbols contain the labelled shape inside a group.
|
|
8738
|
+
element.traverse == null || element.traverse(align);
|
|
8739
|
+
}
|
|
8740
|
+
});
|
|
8741
|
+
};
|
|
8742
|
+
var updateChartHoverLabels = function updateChartHoverLabels(instance, side, timestamp, timeLabelStyle) {
|
|
8743
|
+
var _option$series, _option$graphic$flatM, _option$graphic;
|
|
8744
|
+
if (timestamp === void 0) {
|
|
8745
|
+
timestamp = null;
|
|
8746
|
+
}
|
|
8747
|
+
var option = instance.getOption();
|
|
8748
|
+
var placements = timestamp === null ? [] : layoutHoverLabels(getHoverLabels(instance, timestamp, side), side);
|
|
8749
|
+
var series = (_option$series = option.series) == null ? void 0 : _option$series.map(function (entry, index) {
|
|
8750
|
+
var _placements$find$offs, _placements$find;
|
|
8751
|
+
var offset = (_placements$find$offs = (_placements$find = placements.find(function (label) {
|
|
8752
|
+
return label.seriesIndex === index;
|
|
8753
|
+
})) == null ? void 0 : _placements$find.offset) != null ? _placements$find$offs : [0, 0];
|
|
8754
|
+
return {
|
|
8755
|
+
id: entry.id,
|
|
8756
|
+
emphasis: {
|
|
8757
|
+
label: {
|
|
8758
|
+
position: side,
|
|
8759
|
+
offset: offset
|
|
8760
|
+
}
|
|
8761
|
+
}
|
|
8762
|
+
};
|
|
8763
|
+
});
|
|
8764
|
+
var seriesChanged = series == null ? void 0 : series.some(function (entry, index) {
|
|
8765
|
+
var _option$series$index$;
|
|
8766
|
+
var previous = (_option$series$index$ = option.series[index].emphasis) == null ? void 0 : _option$series$index$.label;
|
|
8767
|
+
return (previous == null ? void 0 : previous.position) !== side || entry.emphasis.label.offset.some(function (value, dimension) {
|
|
8768
|
+
var _previous$offset$dime, _previous$offset;
|
|
8769
|
+
return Math.abs(value - ((_previous$offset$dime = previous == null || (_previous$offset = previous.offset) == null ? void 0 : _previous$offset[dimension]) != null ? _previous$offset$dime : 0)) > 0.01;
|
|
8770
|
+
});
|
|
8141
8771
|
});
|
|
8772
|
+
var previousLabels = (_option$graphic$flatM = (_option$graphic = option.graphic) == null ? void 0 : _option$graphic.flatMap(function (graphic) {
|
|
8773
|
+
var _graphic$elements;
|
|
8774
|
+
return (_graphic$elements = graphic.elements) != null ? _graphic$elements : [];
|
|
8775
|
+
}).filter(function (element) {
|
|
8776
|
+
var _element$id;
|
|
8777
|
+
return (_element$id = element.id) == null ? void 0 : _element$id.startsWith(TIME_LABEL_PREFIX);
|
|
8778
|
+
})) != null ? _option$graphic$flatM : [];
|
|
8779
|
+
var timeLabels = timeLabelStyle ? getHoverTimeLabels(instance, timestamp, timeLabelStyle) : [];
|
|
8780
|
+
var removedLabels = previousLabels.filter(function (previous) {
|
|
8781
|
+
return !timeLabels.some(function (label) {
|
|
8782
|
+
return label.id === previous.id;
|
|
8783
|
+
});
|
|
8784
|
+
});
|
|
8785
|
+
var graphicsChanged = !!timeLabelStyle && (removedLabels.length > 0 || timeLabels.some(function (label) {
|
|
8786
|
+
var previous = previousLabels.find(function (entry) {
|
|
8787
|
+
return entry.id === label.id;
|
|
8788
|
+
});
|
|
8789
|
+
return (previous == null ? void 0 : previous.x) !== label.x || previous.y !== label.y || Object.entries(label.style).some(function (_ref2) {
|
|
8790
|
+
var _previous$style;
|
|
8791
|
+
var key = _ref2[0],
|
|
8792
|
+
value = _ref2[1];
|
|
8793
|
+
return JSON.stringify((_previous$style = previous.style) == null ? void 0 : _previous$style[key]) !== JSON.stringify(value);
|
|
8794
|
+
});
|
|
8795
|
+
}));
|
|
8796
|
+
if (seriesChanged || graphicsChanged) {
|
|
8797
|
+
instance.setOption(Object.assign({}, seriesChanged && {
|
|
8798
|
+
series: series
|
|
8799
|
+
}, graphicsChanged && {
|
|
8800
|
+
graphic: {
|
|
8801
|
+
elements: [].concat(timeLabels, removedLabels.map(function (label) {
|
|
8802
|
+
return {
|
|
8803
|
+
id: label.id,
|
|
8804
|
+
$action: 'remove'
|
|
8805
|
+
};
|
|
8806
|
+
}))
|
|
8807
|
+
}
|
|
8808
|
+
}), {
|
|
8809
|
+
silent: true
|
|
8810
|
+
});
|
|
8811
|
+
}
|
|
8812
|
+
if (timestamp !== null) {
|
|
8813
|
+
alignHoverValueLabels(instance, timestamp, side, placements);
|
|
8814
|
+
}
|
|
8815
|
+
return !!seriesChanged || graphicsChanged;
|
|
8142
8816
|
};
|
|
8143
8817
|
|
|
8144
8818
|
/* *
|
|
@@ -8368,7 +9042,8 @@ var useChartHeight = function useChartHeight(_ref) {
|
|
|
8368
9042
|
return Object.assign({}, grid, {
|
|
8369
9043
|
top: shouldShowLegend ? parseInt(grid.top, 10) + height + "px" : grid.top
|
|
8370
9044
|
}, fitToContainer ? {
|
|
8371
|
-
|
|
9045
|
+
// Fit the 12px time label plus its 1px gap above the graph.
|
|
9046
|
+
top: shouldShowLegend ? 20 + height : 13,
|
|
8372
9047
|
height: 'auto',
|
|
8373
9048
|
bottom: shouldShowZoom ? 75 : 24
|
|
8374
9049
|
} : {});
|
|
@@ -8425,14 +9100,72 @@ var useChartHeight = function useChartHeight(_ref) {
|
|
|
8425
9100
|
var useChartSynchronization = function useChartSynchronization() {
|
|
8426
9101
|
var instances = React.useRef(new Map());
|
|
8427
9102
|
var zoomState = React.useRef(null);
|
|
9103
|
+
var layoutListeners = React.useRef(new Set());
|
|
9104
|
+
var notifyLayout = React.useCallback(function () {
|
|
9105
|
+
layoutListeners.current.forEach(function (listener) {
|
|
9106
|
+
return listener();
|
|
9107
|
+
});
|
|
9108
|
+
}, []);
|
|
8428
9109
|
return React.useMemo(function () {
|
|
9110
|
+
var timeLabelStyles = new Map();
|
|
9111
|
+
var hoverTime = null;
|
|
9112
|
+
var refreshFrame = null;
|
|
9113
|
+
var activeInstances = function activeInstances() {
|
|
9114
|
+
return Array.from(instances.current).filter(function (_ref2) {
|
|
9115
|
+
var instance = _ref2[0],
|
|
9116
|
+
syncPointer = _ref2[1];
|
|
9117
|
+
return syncPointer && !instance.isDisposed();
|
|
9118
|
+
}).map(function (_ref3) {
|
|
9119
|
+
var instance = _ref3[0];
|
|
9120
|
+
return instance;
|
|
9121
|
+
});
|
|
9122
|
+
};
|
|
9123
|
+
var updateHover = function updateHover() {
|
|
9124
|
+
var charts = activeInstances();
|
|
9125
|
+
var next = hoverTime === null ? 'right' : getHoverLabelSide(charts, hoverTime);
|
|
9126
|
+
var changed = false;
|
|
9127
|
+
charts.forEach(function (instance) {
|
|
9128
|
+
changed = updateChartHoverLabels(instance, next, hoverTime, timeLabelStyles.get(instance)) || changed;
|
|
9129
|
+
});
|
|
9130
|
+
return changed;
|
|
9131
|
+
};
|
|
8429
9132
|
return {
|
|
9133
|
+
refreshHover: function refreshHover() {
|
|
9134
|
+
if (hoverTime !== null && refreshFrame === null) {
|
|
9135
|
+
refreshFrame = window.requestAnimationFrame(function () {
|
|
9136
|
+
refreshFrame = null;
|
|
9137
|
+
updateHover();
|
|
9138
|
+
});
|
|
9139
|
+
}
|
|
9140
|
+
},
|
|
8430
9141
|
zoomState: zoomState,
|
|
8431
|
-
|
|
9142
|
+
getZoomTimePixel: function getZoomTimePixel(fraction, target) {
|
|
9143
|
+
var _Array$from$find;
|
|
9144
|
+
var plot = (_Array$from$find = Array.from(instances.current).find(function (_ref4) {
|
|
9145
|
+
var instance = _ref4[0],
|
|
9146
|
+
syncPointer = _ref4[1];
|
|
9147
|
+
return syncPointer && !instance.isDisposed();
|
|
9148
|
+
})) == null ? void 0 : _Array$from$find[0];
|
|
9149
|
+
return plot ? getFullTimePixel(plot, target, fraction) : undefined;
|
|
9150
|
+
},
|
|
9151
|
+
subscribeLayout: function subscribeLayout(listener) {
|
|
9152
|
+
layoutListeners.current.add(listener);
|
|
9153
|
+
return function () {
|
|
9154
|
+
layoutListeners.current["delete"](listener);
|
|
9155
|
+
};
|
|
9156
|
+
},
|
|
9157
|
+
register: function register(instance, syncPointer, timeLabelStyle) {
|
|
8432
9158
|
if (syncPointer === void 0) {
|
|
8433
9159
|
syncPointer = true;
|
|
8434
9160
|
}
|
|
9161
|
+
if (timeLabelStyle) {
|
|
9162
|
+
timeLabelStyles.set(instance, timeLabelStyle);
|
|
9163
|
+
}
|
|
8435
9164
|
instances.current.set(instance, syncPointer);
|
|
9165
|
+
if (syncPointer) {
|
|
9166
|
+
instance.on('rendered', notifyLayout);
|
|
9167
|
+
}
|
|
9168
|
+
notifyLayout();
|
|
8436
9169
|
if (zoomState.current && !instance.isDisposed()) {
|
|
8437
9170
|
instance.dispatchAction(Object.assign({
|
|
8438
9171
|
type: 'dataZoom'
|
|
@@ -8443,6 +9176,15 @@ var useChartSynchronization = function useChartSynchronization() {
|
|
|
8443
9176
|
},
|
|
8444
9177
|
unregister: function unregister(instance) {
|
|
8445
9178
|
instances.current["delete"](instance);
|
|
9179
|
+
timeLabelStyles["delete"](instance);
|
|
9180
|
+
if (!instances.current.size && refreshFrame !== null) {
|
|
9181
|
+
window.cancelAnimationFrame(refreshFrame);
|
|
9182
|
+
refreshFrame = null;
|
|
9183
|
+
}
|
|
9184
|
+
if (!instance.isDisposed()) {
|
|
9185
|
+
instance.off('rendered', notifyLayout);
|
|
9186
|
+
}
|
|
9187
|
+
notifyLayout();
|
|
8446
9188
|
},
|
|
8447
9189
|
zoom: function zoom(state, source) {
|
|
8448
9190
|
zoomState.current = state;
|
|
@@ -8458,12 +9200,15 @@ var useChartSynchronization = function useChartSynchronization() {
|
|
|
8458
9200
|
},
|
|
8459
9201
|
pointer: function pointer(event, source) {
|
|
8460
9202
|
var _event$axesInfo;
|
|
8461
|
-
var axis = (_event$axesInfo = event.axesInfo) == null ? void 0 : _event$axesInfo.find(function (
|
|
8462
|
-
var axisDim =
|
|
9203
|
+
var axis = (_event$axesInfo = event.axesInfo) == null ? void 0 : _event$axesInfo.find(function (_ref5) {
|
|
9204
|
+
var axisDim = _ref5.axisDim;
|
|
8463
9205
|
return axisDim === 'x';
|
|
8464
9206
|
});
|
|
9207
|
+
var timestamp = axis ? Number(axis.value) : null;
|
|
9208
|
+
hoverTime = timestamp !== null && Number.isFinite(timestamp) ? timestamp : null;
|
|
9209
|
+
var labelsChanged = updateHover();
|
|
8465
9210
|
instances.current.forEach(function (syncPointer, instance) {
|
|
8466
|
-
if (syncPointer && instance !== source && !instance.isDisposed()) {
|
|
9211
|
+
if (syncPointer && (instance !== source || labelsChanged) && !instance.isDisposed()) {
|
|
8467
9212
|
instance.dispatchAction(axis ? {
|
|
8468
9213
|
type: 'updateAxisPointer',
|
|
8469
9214
|
x: instance.convertToPixel({
|
|
@@ -8485,7 +9230,7 @@ var useChartSynchronization = function useChartSynchronization() {
|
|
|
8485
9230
|
});
|
|
8486
9231
|
}
|
|
8487
9232
|
};
|
|
8488
|
-
}, []);
|
|
9233
|
+
}, [notifyLayout]);
|
|
8489
9234
|
};
|
|
8490
9235
|
var applyDataZoomState = function applyDataZoomState(option, dataZoomState) {
|
|
8491
9236
|
if (!dataZoomState || !(option != null && option.dataZoom) || !Array.isArray(option.dataZoom)) {
|
|
@@ -8515,21 +9260,24 @@ var extractDataZoomState = function extractDataZoomState(params) {
|
|
|
8515
9260
|
}
|
|
8516
9261
|
return null;
|
|
8517
9262
|
};
|
|
8518
|
-
var TimeSeriesChart = function TimeSeriesChart(
|
|
8519
|
-
var plotsWithData =
|
|
8520
|
-
|
|
8521
|
-
animation =
|
|
8522
|
-
|
|
8523
|
-
shouldShowLegend =
|
|
8524
|
-
onToggleLegendParam =
|
|
8525
|
-
|
|
8526
|
-
fitToContainer =
|
|
8527
|
-
|
|
8528
|
-
shouldShowZoom =
|
|
8529
|
-
controlsOnly =
|
|
8530
|
-
synchronization =
|
|
8531
|
-
sharedTimesteps =
|
|
8532
|
-
|
|
9263
|
+
var TimeSeriesChart = function TimeSeriesChart(_ref6) {
|
|
9264
|
+
var plotsWithData = _ref6.plotsWithData,
|
|
9265
|
+
_ref6$animation = _ref6.animation,
|
|
9266
|
+
animation = _ref6$animation === void 0 ? false : _ref6$animation,
|
|
9267
|
+
_ref6$shouldShowLegen = _ref6.shouldShowLegend,
|
|
9268
|
+
shouldShowLegend = _ref6$shouldShowLegen === void 0 ? true : _ref6$shouldShowLegen,
|
|
9269
|
+
onToggleLegendParam = _ref6.onToggleLegendParam,
|
|
9270
|
+
_ref6$fitToContainer = _ref6.fitToContainer,
|
|
9271
|
+
fitToContainer = _ref6$fitToContainer === void 0 ? false : _ref6$fitToContainer,
|
|
9272
|
+
_ref6$shouldShowZoom = _ref6.shouldShowZoom,
|
|
9273
|
+
shouldShowZoom = _ref6$shouldShowZoom === void 0 ? true : _ref6$shouldShowZoom,
|
|
9274
|
+
controlsOnly = _ref6.controlsOnly,
|
|
9275
|
+
synchronization = _ref6.synchronization,
|
|
9276
|
+
sharedTimesteps = _ref6.sharedTimesteps,
|
|
9277
|
+
selectedTime = _ref6.selectedTime,
|
|
9278
|
+
currentTime = _ref6.currentTime;
|
|
9279
|
+
var localSynchronization = useChartSynchronization();
|
|
9280
|
+
var chartSynchronization = synchronization != null ? synchronization : localSynchronization;
|
|
8533
9281
|
var now = useCurrentTime(currentTime === undefined && controlsOnly !== 'legend');
|
|
8534
9282
|
var _React$useState2 = React.useState(null),
|
|
8535
9283
|
indicatorInstance = _React$useState2[0],
|
|
@@ -8541,10 +9289,10 @@ var TimeSeriesChart = function TimeSeriesChart(_ref3) {
|
|
|
8541
9289
|
React.useEffect(function () {
|
|
8542
9290
|
return function () {
|
|
8543
9291
|
if (registeredInstance.current) {
|
|
8544
|
-
|
|
9292
|
+
chartSynchronization.unregister(registeredInstance.current);
|
|
8545
9293
|
}
|
|
8546
9294
|
};
|
|
8547
|
-
}, [
|
|
9295
|
+
}, [chartSynchronization]);
|
|
8548
9296
|
var dataZoomStateRef = React.useRef(null);
|
|
8549
9297
|
var formatZoomLabel = React.useCallback(function (timestamp) {
|
|
8550
9298
|
var range = getVisibleTimeRange(registeredInstance.current);
|
|
@@ -8563,7 +9311,9 @@ var TimeSeriesChart = function TimeSeriesChart(_ref3) {
|
|
|
8563
9311
|
return Object.assign({}, base, {
|
|
8564
9312
|
dataZoom: dataZoom.map(function (zoom) {
|
|
8565
9313
|
return Object.assign({}, zoom, {
|
|
8566
|
-
show: shouldShowZoom
|
|
9314
|
+
show: shouldShowZoom,
|
|
9315
|
+
height: TIME_SERIES_ZOOM_HEIGHT,
|
|
9316
|
+
bottom: TIME_SERIES_ZOOM_BOTTOM
|
|
8567
9317
|
});
|
|
8568
9318
|
})
|
|
8569
9319
|
});
|
|
@@ -8620,6 +9370,7 @@ var TimeSeriesChart = function TimeSeriesChart(_ref3) {
|
|
|
8620
9370
|
dataZoom: controlsOnly === 'zoom' ? dataZoom.map(function (zoom) {
|
|
8621
9371
|
return Object.assign({}, zoom, {
|
|
8622
9372
|
top: 4,
|
|
9373
|
+
height: TIME_SERIES_ZOOM_HEIGHT,
|
|
8623
9374
|
bottom: undefined,
|
|
8624
9375
|
showDataShadow: true
|
|
8625
9376
|
});
|
|
@@ -8632,9 +9383,9 @@ var TimeSeriesChart = function TimeSeriesChart(_ref3) {
|
|
|
8632
9383
|
var timeAxisStyle = (isDark ? EChartsDarkTheme : EChartsLightTheme).timeAxis;
|
|
8633
9384
|
var gridlineStyle = timeAxisStyle.splitLine.lineStyle;
|
|
8634
9385
|
var optionWithZoom = React.useMemo(function () {
|
|
8635
|
-
var
|
|
8636
|
-
return applyDataZoomState(option, (
|
|
8637
|
-
}, [option,
|
|
9386
|
+
var _chartSynchronization;
|
|
9387
|
+
return applyDataZoomState(option, (_chartSynchronization = chartSynchronization.zoomState.current) != null ? _chartSynchronization : dataZoomStateRef.current);
|
|
9388
|
+
}, [option, chartSynchronization]);
|
|
8638
9389
|
var _useChartHeight = useChartHeight({
|
|
8639
9390
|
plotsWithData: enabledPlots,
|
|
8640
9391
|
shouldShowLegend: shouldShowLegend,
|
|
@@ -8677,16 +9428,62 @@ var TimeSeriesChart = function TimeSeriesChart(_ref3) {
|
|
|
8677
9428
|
} : {
|
|
8678
9429
|
position: 'relative'
|
|
8679
9430
|
},
|
|
8680
|
-
children: [jsx(
|
|
9431
|
+
children: [jsx("svg", {
|
|
9432
|
+
"aria-hidden": "true",
|
|
9433
|
+
"data-testid": "TimeSeriesChart-gridlines",
|
|
9434
|
+
style: {
|
|
9435
|
+
position: 'absolute',
|
|
9436
|
+
inset: 0,
|
|
9437
|
+
width: '100%',
|
|
9438
|
+
height: '100%',
|
|
9439
|
+
pointerEvents: 'none'
|
|
9440
|
+
},
|
|
9441
|
+
children: lines.map(function (line) {
|
|
9442
|
+
return jsxs("g", {
|
|
9443
|
+
children: [jsx("line", {
|
|
9444
|
+
opacity: gridlineStyle.opacity,
|
|
9445
|
+
stroke: gridlineStyle.color[0],
|
|
9446
|
+
strokeWidth: 1,
|
|
9447
|
+
x1: line.x,
|
|
9448
|
+
x2: line.x,
|
|
9449
|
+
y1: line.top,
|
|
9450
|
+
y2: line.bottom
|
|
9451
|
+
}), line.label ? jsxs(Fragment, {
|
|
9452
|
+
children: [jsx("line", {
|
|
9453
|
+
stroke: timeAxisStyle.axisTick.lineStyle.color,
|
|
9454
|
+
x1: line.x,
|
|
9455
|
+
x2: line.x,
|
|
9456
|
+
y1: line.bottom,
|
|
9457
|
+
y2: line.bottom + 4
|
|
9458
|
+
}), jsxs("text", {
|
|
9459
|
+
"data-testid": "TimeSeriesChart-timeLabel",
|
|
9460
|
+
fill: timeAxisStyle.axisLabel.color,
|
|
9461
|
+
fontSize: timeAxisStyle.axisLabel.fontSize,
|
|
9462
|
+
textAnchor: "middle",
|
|
9463
|
+
x: line.x,
|
|
9464
|
+
y: line.bottom + 12,
|
|
9465
|
+
children: [jsx("tspan", {
|
|
9466
|
+
x: line.x,
|
|
9467
|
+
children: line.label[0]
|
|
9468
|
+
}), jsx("tspan", {
|
|
9469
|
+
dy: 10,
|
|
9470
|
+
x: line.x,
|
|
9471
|
+
children: line.label[1]
|
|
9472
|
+
})]
|
|
9473
|
+
})]
|
|
9474
|
+
}) : null]
|
|
9475
|
+
}, line.top + "-" + line.x);
|
|
9476
|
+
})
|
|
9477
|
+
}), jsx(ReactECharts, {
|
|
8681
9478
|
autoResize: !observesContainer,
|
|
8682
9479
|
notMerge: true,
|
|
8683
9480
|
onChartReady: function onChartReady(instance) {
|
|
8684
9481
|
if (registeredInstance.current) {
|
|
8685
|
-
|
|
9482
|
+
chartSynchronization.unregister(registeredInstance.current);
|
|
8686
9483
|
}
|
|
8687
9484
|
registeredInstance.current = instance;
|
|
8688
9485
|
if (controlsOnly !== 'legend') {
|
|
8689
|
-
|
|
9486
|
+
chartSynchronization.register(instance, controlsOnly !== 'zoom', (isDark ? EChartsDarkTheme : EChartsLightTheme).hoverTimeLabel);
|
|
8690
9487
|
}
|
|
8691
9488
|
updateHeight(instance);
|
|
8692
9489
|
updateGridlines(instance);
|
|
@@ -8697,13 +9494,14 @@ var TimeSeriesChart = function TimeSeriesChart(_ref3) {
|
|
|
8697
9494
|
finished: function finished() {},
|
|
8698
9495
|
rendered: function rendered(_params, chart) {
|
|
8699
9496
|
updateGridlines(chart);
|
|
9497
|
+
chartSynchronization.refreshHover();
|
|
8700
9498
|
},
|
|
8701
9499
|
datazoom: function datazoom(params) {
|
|
8702
9500
|
var newState = extractDataZoomState(params);
|
|
8703
9501
|
if (newState) {
|
|
8704
9502
|
var _registeredInstance$c;
|
|
8705
9503
|
dataZoomStateRef.current = newState;
|
|
8706
|
-
|
|
9504
|
+
chartSynchronization.zoom(newState, (_registeredInstance$c = registeredInstance.current) != null ? _registeredInstance$c : undefined);
|
|
8707
9505
|
}
|
|
8708
9506
|
},
|
|
8709
9507
|
updateAxisPointer: function updateAxisPointer(event) {
|
|
@@ -8711,7 +9509,7 @@ var TimeSeriesChart = function TimeSeriesChart(_ref3) {
|
|
|
8711
9509
|
if (controlsOnly) {
|
|
8712
9510
|
return;
|
|
8713
9511
|
}
|
|
8714
|
-
|
|
9512
|
+
chartSynchronization.pointer(event, (_registeredInstance$c2 = registeredInstance.current) != null ? _registeredInstance$c2 : undefined);
|
|
8715
9513
|
},
|
|
8716
9514
|
legendselectchanged: function legendselectchanged(params) {
|
|
8717
9515
|
if (!option.legend) {
|
|
@@ -8736,63 +9534,26 @@ var TimeSeriesChart = function TimeSeriesChart(_ref3) {
|
|
|
8736
9534
|
}),
|
|
8737
9535
|
ref: chartRef,
|
|
8738
9536
|
style: {
|
|
9537
|
+
// Plot content paints above the gridline overlay.
|
|
9538
|
+
position: 'relative',
|
|
8739
9539
|
background: 'transparent',
|
|
8740
9540
|
height: fitToContainer ? '100%' : chartHeight,
|
|
8741
9541
|
minWidth: fitToContainer ? 0 : MIN_GRAPH_WIDTH
|
|
8742
9542
|
},
|
|
8743
9543
|
theme: isDark ? EChartsDarkTheme : EChartsLightTheme
|
|
8744
|
-
}), jsx("svg", {
|
|
8745
|
-
"aria-hidden": "true",
|
|
8746
|
-
"data-testid": "TimeSeriesChart-gridlines",
|
|
8747
|
-
style: {
|
|
8748
|
-
position: 'absolute',
|
|
8749
|
-
inset: 0,
|
|
8750
|
-
width: '100%',
|
|
8751
|
-
height: '100%',
|
|
8752
|
-
pointerEvents: 'none'
|
|
8753
|
-
},
|
|
8754
|
-
children: lines.map(function (line) {
|
|
8755
|
-
return jsxs("g", {
|
|
8756
|
-
children: [jsx("line", {
|
|
8757
|
-
opacity: gridlineStyle.opacity,
|
|
8758
|
-
stroke: gridlineStyle.color[0],
|
|
8759
|
-
strokeWidth: 1,
|
|
8760
|
-
x1: line.x,
|
|
8761
|
-
x2: line.x,
|
|
8762
|
-
y1: line.top,
|
|
8763
|
-
y2: line.bottom
|
|
8764
|
-
}), line.label ? jsxs(Fragment, {
|
|
8765
|
-
children: [jsx("line", {
|
|
8766
|
-
stroke: timeAxisStyle.axisTick.lineStyle.color,
|
|
8767
|
-
x1: line.x,
|
|
8768
|
-
x2: line.x,
|
|
8769
|
-
y1: line.bottom,
|
|
8770
|
-
y2: line.bottom + 4
|
|
8771
|
-
}), jsxs("text", {
|
|
8772
|
-
"data-testid": "TimeSeriesChart-timeLabel",
|
|
8773
|
-
fill: timeAxisStyle.axisLabel.color,
|
|
8774
|
-
fontSize: timeAxisStyle.axisLabel.fontSize,
|
|
8775
|
-
textAnchor: "middle",
|
|
8776
|
-
x: line.x,
|
|
8777
|
-
y: line.bottom + 12,
|
|
8778
|
-
children: [jsx("tspan", {
|
|
8779
|
-
x: line.x,
|
|
8780
|
-
children: line.label[0]
|
|
8781
|
-
}), jsx("tspan", {
|
|
8782
|
-
dy: 10,
|
|
8783
|
-
x: line.x,
|
|
8784
|
-
children: line.label[1]
|
|
8785
|
-
})]
|
|
8786
|
-
})]
|
|
8787
|
-
}) : null]
|
|
8788
|
-
}, line.top + "-" + line.x);
|
|
8789
|
-
})
|
|
8790
9544
|
}), controlsOnly !== 'legend' && jsx(CurrentTime, {
|
|
8791
9545
|
currentTime: currentTime != null ? currentTime : now,
|
|
8792
9546
|
instance: indicatorInstance,
|
|
8793
9547
|
showPlots: !controlsOnly,
|
|
8794
9548
|
showZoom: controlsOnly === 'zoom' || shouldShowZoom
|
|
8795
|
-
})
|
|
9549
|
+
}), indicatorInstance && selectedTime !== undefined && Number.isFinite(selectedTime) && controlsOnly !== 'legend' ? jsx(SelectedTime, {
|
|
9550
|
+
controlsOnly: controlsOnly,
|
|
9551
|
+
getZoomTimePixel: synchronization == null ? void 0 : synchronization.getZoomTimePixel,
|
|
9552
|
+
instance: indicatorInstance,
|
|
9553
|
+
selectedTime: selectedTime,
|
|
9554
|
+
shouldShowZoom: shouldShowZoom,
|
|
9555
|
+
subscribeLayout: controlsOnly === 'zoom' ? synchronization == null ? void 0 : synchronization.subscribeLayout : undefined
|
|
9556
|
+
}) : null]
|
|
8796
9557
|
}) : null;
|
|
8797
9558
|
};
|
|
8798
9559
|
|
|
@@ -8946,6 +9707,7 @@ var TimeSeriesPlot = function TimeSeriesPlot(_ref) {
|
|
|
8946
9707
|
parametersFailingInAllPlots = _ref.parametersFailingInAllPlots,
|
|
8947
9708
|
synchronization = _ref.synchronization,
|
|
8948
9709
|
sharedTimesteps = _ref.sharedTimesteps,
|
|
9710
|
+
selectedTime = _ref.selectedTime,
|
|
8949
9711
|
currentTime = _ref.currentTime;
|
|
8950
9712
|
var _useTimeseriesTransla = useTimeseriesTranslation(),
|
|
8951
9713
|
t = _useTimeseriesTransla.t;
|
|
@@ -8977,6 +9739,7 @@ var TimeSeriesPlot = function TimeSeriesPlot(_ref) {
|
|
|
8977
9739
|
currentTime: currentTime,
|
|
8978
9740
|
fitToContainer: true,
|
|
8979
9741
|
plotsWithData: [plot],
|
|
9742
|
+
selectedTime: selectedTime,
|
|
8980
9743
|
sharedTimesteps: sharedTimesteps,
|
|
8981
9744
|
shouldShowLegend: false,
|
|
8982
9745
|
shouldShowZoom: false,
|
|
@@ -8998,11 +9761,50 @@ var TimeSeriesView = /*#__PURE__*/React.memo(function (_ref2) {
|
|
|
8998
9761
|
syncgroupTimeState = _ref2.syncgroupTimeState;
|
|
8999
9762
|
var _useTimeseriesTransla2 = useTimeseriesTranslation(),
|
|
9000
9763
|
t = _useTimeseriesTransla2.t;
|
|
9764
|
+
var dispatch = useDispatch();
|
|
9001
9765
|
var synchronization = useChartSynchronization();
|
|
9766
|
+
// The data query depends on the range; playback only moves the indicator.
|
|
9767
|
+
var _ref3 = syncgroupTimeState != null ? syncgroupTimeState : {},
|
|
9768
|
+
start = _ref3.start,
|
|
9769
|
+
end = _ref3.end,
|
|
9770
|
+
step = _ref3.step;
|
|
9771
|
+
var fetchTimeState = React.useMemo(function () {
|
|
9772
|
+
return start !== undefined && end !== undefined && step !== undefined ? {
|
|
9773
|
+
start: start,
|
|
9774
|
+
end: end,
|
|
9775
|
+
step: step
|
|
9776
|
+
} : undefined;
|
|
9777
|
+
}, [start, end, step]);
|
|
9002
9778
|
var currentTime = useCurrentTime();
|
|
9003
|
-
var _useGetPlotsWithData = useGetPlotsWithData(plotPreset, selectedLocation, services, splitGeoJsonByCollection, t,
|
|
9779
|
+
var _useGetPlotsWithData = useGetPlotsWithData(plotPreset, selectedLocation, services, splitGeoJsonByCollection, t, fetchTimeState),
|
|
9004
9780
|
plotsWithData = _useGetPlotsWithData.data,
|
|
9005
9781
|
isFetchingPlots = _useGetPlotsWithData.isFetching;
|
|
9782
|
+
var missingUnitParameters = React.useMemo(function () {
|
|
9783
|
+
return (plotsWithData != null ? plotsWithData : []).flatMap(function (plot) {
|
|
9784
|
+
return plot.parametersWithData.filter(function (parameter) {
|
|
9785
|
+
return parameter.timestep.length > 0 && !parameter.unit;
|
|
9786
|
+
}).map(function (_ref4) {
|
|
9787
|
+
var propertyName = _ref4.propertyName,
|
|
9788
|
+
serviceId = _ref4.serviceId,
|
|
9789
|
+
collectionId = _ref4.collectionId,
|
|
9790
|
+
instanceId = _ref4.instanceId,
|
|
9791
|
+
dimensions = _ref4.dimensions;
|
|
9792
|
+
return {
|
|
9793
|
+
propertyName: propertyName,
|
|
9794
|
+
serviceId: serviceId,
|
|
9795
|
+
collectionId: collectionId,
|
|
9796
|
+
instanceId: instanceId,
|
|
9797
|
+
dimensions: dimensions
|
|
9798
|
+
};
|
|
9799
|
+
});
|
|
9800
|
+
});
|
|
9801
|
+
}, [plotsWithData]);
|
|
9802
|
+
React.useEffect(function () {
|
|
9803
|
+
dispatch(timeSeriesActions.setMissingUnitParameters({
|
|
9804
|
+
panelId: viewId,
|
|
9805
|
+
parameters: missingUnitParameters
|
|
9806
|
+
}));
|
|
9807
|
+
}, [dispatch, missingUnitParameters, viewId]);
|
|
9006
9808
|
var sharedTimesteps = React.useMemo(function () {
|
|
9007
9809
|
return getSharedTimesteps(plotsWithData != null ? plotsWithData : []);
|
|
9008
9810
|
}, [plotsWithData]);
|
|
@@ -9040,11 +9842,11 @@ var TimeSeriesView = /*#__PURE__*/React.memo(function (_ref2) {
|
|
|
9040
9842
|
}
|
|
9041
9843
|
});
|
|
9042
9844
|
});
|
|
9043
|
-
return Object.values(parameterCounts).filter(function (
|
|
9044
|
-
var count =
|
|
9845
|
+
return Object.values(parameterCounts).filter(function (_ref5) {
|
|
9846
|
+
var count = _ref5.count;
|
|
9045
9847
|
return count === totalPlotCount;
|
|
9046
|
-
}).map(function (
|
|
9047
|
-
var param =
|
|
9848
|
+
}).map(function (_ref6) {
|
|
9849
|
+
var param = _ref6.param;
|
|
9048
9850
|
return param;
|
|
9049
9851
|
});
|
|
9050
9852
|
};
|
|
@@ -9065,6 +9867,7 @@ var TimeSeriesView = /*#__PURE__*/React.memo(function (_ref2) {
|
|
|
9065
9867
|
currentTime: currentTime,
|
|
9066
9868
|
parametersFailingInAllPlots: parametersFailingInAllPlots,
|
|
9067
9869
|
plot: plot,
|
|
9870
|
+
selectedTime: syncgroupTimeState == null ? void 0 : syncgroupTimeState.current,
|
|
9068
9871
|
sharedTimesteps: sharedTimesteps,
|
|
9069
9872
|
synchronization: synchronization
|
|
9070
9873
|
}) : null;
|
|
@@ -9123,6 +9926,7 @@ var TimeSeriesView = /*#__PURE__*/React.memo(function (_ref2) {
|
|
|
9123
9926
|
controlsOnly: "zoom",
|
|
9124
9927
|
currentTime: currentTime,
|
|
9125
9928
|
plotsWithData: plotsWithData,
|
|
9929
|
+
selectedTime: syncgroupTimeState == null ? void 0 : syncgroupTimeState.current,
|
|
9126
9930
|
sharedTimesteps: sharedTimesteps,
|
|
9127
9931
|
shouldShowLegend: false,
|
|
9128
9932
|
synchronization: synchronization
|
|
@@ -9130,7 +9934,7 @@ var TimeSeriesView = /*#__PURE__*/React.memo(function (_ref2) {
|
|
|
9130
9934
|
})]
|
|
9131
9935
|
});
|
|
9132
9936
|
}, function (previousProps, nextProps) {
|
|
9133
|
-
var _previousProps$syncgr, _nextProps$syncgroupT, _previousProps$syncgr2, _nextProps$syncgroupT2;
|
|
9937
|
+
var _previousProps$syncgr, _nextProps$syncgroupT, _previousProps$syncgr2, _nextProps$syncgroupT2, _previousProps$syncgr3, _nextProps$syncgroupT3, _previousProps$syncgr4, _nextProps$syncgroupT4;
|
|
9134
9938
|
var sameView = previousProps.viewId === nextProps.viewId;
|
|
9135
9939
|
var sameCallbacks = previousProps.isLoading === nextProps.isLoading && previousProps.onToggleLegendParam === nextProps.onToggleLegendParam;
|
|
9136
9940
|
var samePreset = previousProps.plotPreset === nextProps.plotPreset;
|
|
@@ -9138,7 +9942,7 @@ var TimeSeriesView = /*#__PURE__*/React.memo(function (_ref2) {
|
|
|
9138
9942
|
var sameGeoJson = isEqual(previousProps.splitGeoJsonByCollection, nextProps.splitGeoJsonByCollection);
|
|
9139
9943
|
var sameLegend = previousProps.shouldShowLegend === nextProps.shouldShowLegend;
|
|
9140
9944
|
var sameServices = isEqual(previousProps.services, nextProps.services);
|
|
9141
|
-
var sameTime = ((_previousProps$syncgr = previousProps.syncgroupTimeState) == null ? void 0 : _previousProps$syncgr.
|
|
9945
|
+
var sameTime = ((_previousProps$syncgr = previousProps.syncgroupTimeState) == null ? void 0 : _previousProps$syncgr.step) === ((_nextProps$syncgroupT = nextProps.syncgroupTimeState) == null ? void 0 : _nextProps$syncgroupT.step) && ((_previousProps$syncgr2 = previousProps.syncgroupTimeState) == null ? void 0 : _previousProps$syncgr2.current) === ((_nextProps$syncgroupT2 = nextProps.syncgroupTimeState) == null ? void 0 : _nextProps$syncgroupT2.current) && ((_previousProps$syncgr3 = previousProps.syncgroupTimeState) == null ? void 0 : _previousProps$syncgr3.start) === ((_nextProps$syncgroupT3 = nextProps.syncgroupTimeState) == null ? void 0 : _nextProps$syncgroupT3.start) && ((_previousProps$syncgr4 = previousProps.syncgroupTimeState) == null ? void 0 : _previousProps$syncgr4.end) === ((_nextProps$syncgroupT4 = nextProps.syncgroupTimeState) == null ? void 0 : _nextProps$syncgroupT4.end);
|
|
9142
9946
|
return sameView && sameCallbacks && samePreset && sameLocation && sameGeoJson && sameLegend && sameServices && sameTime;
|
|
9143
9947
|
});
|
|
9144
9948
|
|
|
@@ -9454,7 +10258,7 @@ var TimeSeriesConnect = function TimeSeriesConnect(_ref2) {
|
|
|
9454
10258
|
panelId: panelId
|
|
9455
10259
|
}));
|
|
9456
10260
|
};
|
|
9457
|
-
var syncgroupTimeState = useSyncgroupTimeState(panelId, 1000);
|
|
10261
|
+
var syncgroupTimeState = useSyncgroupTimeState(panelId, 1000, true);
|
|
9458
10262
|
return jsxs(Stack, {
|
|
9459
10263
|
"data-testid": "TimeSeriesConnect",
|
|
9460
10264
|
sx: {
|
|
@@ -10310,4 +11114,110 @@ var LocationSelectDialogConnect = function LocationSelectDialogConnect() {
|
|
|
10310
11114
|
});
|
|
10311
11115
|
};
|
|
10312
11116
|
|
|
10313
|
-
|
|
11117
|
+
/** Failure with a stable code, so that the application can show a translated message. */
|
|
11118
|
+
var EdrCollectionTargetError = /*#__PURE__*/function (_Error) {
|
|
11119
|
+
function EdrCollectionTargetError(code, message) {
|
|
11120
|
+
var _this;
|
|
11121
|
+
_this = _Error.call(this, message) || this;
|
|
11122
|
+
_this.name = 'EdrCollectionTargetError';
|
|
11123
|
+
_this.code = code;
|
|
11124
|
+
return _this;
|
|
11125
|
+
}
|
|
11126
|
+
_inheritsLoose(EdrCollectionTargetError, _Error);
|
|
11127
|
+
return EdrCollectionTargetError;
|
|
11128
|
+
}(/*#__PURE__*/_wrapNativeSuper(Error));
|
|
11129
|
+
var normalizeEdrServiceUrl = function normalizeEdrServiceUrl(href) {
|
|
11130
|
+
var url = new URL(href);
|
|
11131
|
+
url.hash = '';
|
|
11132
|
+
url.searchParams["delete"]('f');
|
|
11133
|
+
url.pathname = url.pathname.replace(/\/$/, '');
|
|
11134
|
+
return url.toString();
|
|
11135
|
+
};
|
|
11136
|
+
var requireHttpUrl = function requireHttpUrl(href) {
|
|
11137
|
+
var url;
|
|
11138
|
+
try {
|
|
11139
|
+
url = new URL(href);
|
|
11140
|
+
} catch (_unused) {
|
|
11141
|
+
throw new EdrCollectionTargetError('invalid-link', 'The dataset link is not a valid URL.');
|
|
11142
|
+
}
|
|
11143
|
+
if (url.protocol !== 'http:' && url.protocol !== 'https:') {
|
|
11144
|
+
throw new EdrCollectionTargetError('invalid-link', 'The dataset link must use HTTP or HTTPS.');
|
|
11145
|
+
}
|
|
11146
|
+
return url;
|
|
11147
|
+
};
|
|
11148
|
+
var getCollectionServiceUrl = function getCollectionServiceUrl(collection, responseUrl) {
|
|
11149
|
+
var _collection$links, _collection$links2, _selfLink$href;
|
|
11150
|
+
var rootLink = (_collection$links = collection.links) == null ? void 0 : _collection$links.find(function (link) {
|
|
11151
|
+
return link.rel === 'root';
|
|
11152
|
+
});
|
|
11153
|
+
if (rootLink) {
|
|
11154
|
+
return normalizeEdrServiceUrl(requireHttpUrl(new URL(rootLink.href, responseUrl).toString()).toString());
|
|
11155
|
+
}
|
|
11156
|
+
var selfLink = (_collection$links2 = collection.links) == null ? void 0 : _collection$links2.find(function (link) {
|
|
11157
|
+
var _link$type;
|
|
11158
|
+
return link.rel === 'self' && ((_link$type = link.type) == null ? void 0 : _link$type.split(';')[0]) === 'application/json';
|
|
11159
|
+
});
|
|
11160
|
+
var url = requireHttpUrl(new URL((_selfLink$href = selfLink == null ? void 0 : selfLink.href) != null ? _selfLink$href : responseUrl, responseUrl).toString());
|
|
11161
|
+
var marker = '/collections/';
|
|
11162
|
+
var markerIndex = url.pathname.lastIndexOf(marker);
|
|
11163
|
+
var collectionPath = url.pathname.slice(markerIndex + marker.length).replace(/\/$/, '');
|
|
11164
|
+
if (markerIndex < 0 || collectionPath !== collection.id && decodeURIComponent(collectionPath) !== collection.id) {
|
|
11165
|
+
throw new EdrCollectionTargetError('service-unidentified', 'The EDR service URL could not be identified from the collection link.');
|
|
11166
|
+
}
|
|
11167
|
+
url.pathname = url.pathname.slice(0, markerIndex);
|
|
11168
|
+
url.search = '';
|
|
11169
|
+
url.hash = '';
|
|
11170
|
+
return normalizeEdrServiceUrl(url.toString());
|
|
11171
|
+
};
|
|
11172
|
+
/** Resolve a Records data link without assuming that the Record ID is an EDR ID. */
|
|
11173
|
+
var resolveEdrCollectionTarget = /*#__PURE__*/function () {
|
|
11174
|
+
var _ref = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee(collectionUrl) {
|
|
11175
|
+
var _collection$data_quer, _collection$data_quer2, _listing$collections;
|
|
11176
|
+
var requestUrl, response, collection, serviceUrl, _yield$Promise$all, serviceInformation, listing;
|
|
11177
|
+
return _regenerator().w(function (_context) {
|
|
11178
|
+
while (1) switch (_context.n) {
|
|
11179
|
+
case 0:
|
|
11180
|
+
requestUrl = withJsonFormat(requireHttpUrl(collectionUrl).toString());
|
|
11181
|
+
_context.n = 1;
|
|
11182
|
+
return authFetch(requestUrl);
|
|
11183
|
+
case 1:
|
|
11184
|
+
response = _context.v;
|
|
11185
|
+
_context.n = 2;
|
|
11186
|
+
return handleResponse(response);
|
|
11187
|
+
case 2:
|
|
11188
|
+
collection = _context.v;
|
|
11189
|
+
if (!(!collection || typeof collection.id !== 'string' || !collection.id || !((_collection$data_quer = collection.data_queries) != null && _collection$data_quer.locations) && !((_collection$data_quer2 = collection.data_queries) != null && _collection$data_quer2.position) || !collection.parameter_names || typeof collection.parameter_names !== 'object')) {
|
|
11190
|
+
_context.n = 3;
|
|
11191
|
+
break;
|
|
11192
|
+
}
|
|
11193
|
+
throw new EdrCollectionTargetError('not-edr', 'This data link does not describe an EDR collection supported by Timeseries.');
|
|
11194
|
+
case 3:
|
|
11195
|
+
serviceUrl = getCollectionServiceUrl(collection, response.url || requestUrl);
|
|
11196
|
+
_context.n = 4;
|
|
11197
|
+
return Promise.all([getServiceInformation(serviceUrl), getCollections(serviceUrl)]);
|
|
11198
|
+
case 4:
|
|
11199
|
+
_yield$Promise$all = _context.v;
|
|
11200
|
+
serviceInformation = _yield$Promise$all[0];
|
|
11201
|
+
listing = _yield$Promise$all[1];
|
|
11202
|
+
if ((_listing$collections = listing.collections) != null && _listing$collections.some(function (entry) {
|
|
11203
|
+
return entry.id === collection.id;
|
|
11204
|
+
})) {
|
|
11205
|
+
_context.n = 5;
|
|
11206
|
+
break;
|
|
11207
|
+
}
|
|
11208
|
+
throw new EdrCollectionTargetError('not-advertised', 'The selected collection is not advertised by its EDR service.');
|
|
11209
|
+
case 5:
|
|
11210
|
+
return _context.a(2, {
|
|
11211
|
+
collection: collection,
|
|
11212
|
+
serviceUrl: serviceUrl,
|
|
11213
|
+
serviceInformation: serviceInformation
|
|
11214
|
+
});
|
|
11215
|
+
}
|
|
11216
|
+
}, _callee);
|
|
11217
|
+
}));
|
|
11218
|
+
return function resolveEdrCollectionTarget(_x) {
|
|
11219
|
+
return _ref.apply(this, arguments);
|
|
11220
|
+
};
|
|
11221
|
+
}();
|
|
11222
|
+
|
|
11223
|
+
export { DIALOG_TYPE_MANAGER, EdrCollectionTargetError, LocationInfoConnect, LocationSelectDialogConnect, TIME_SERIES_NAMESPACE, TimeSeriesManagerConnect, types as TimeSeriesTypes, TimeSeriesView, componentsLookUp, createMockStore, getUserAddedEDRServices, isTimeSeriesLocation, normalizeEdrServiceUrl, resolveEdrCollectionTarget, timeSeriesActions, timeSeriesMiddlewares, timeSeriesReducer, timeSeriesReducersMap, selectors as timeSeriesSelectors, timeseriesListener, timeseriesTranslations };
|