@opengeoweb/time-series 15.0.0 → 15.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (25) hide show
  1. package/index.esm.js +1111 -753
  2. package/package.json +11 -12
  3. package/src/lib/components/TimeSeries/TimeSeriesConnectWrapper.d.ts +2 -2
  4. package/src/lib/components/TimeSeriesManager/ParameterInfo/ParameterInfoButtonConnect.d.ts +1 -2
  5. package/src/lib/components/TimeSeriesManager/ParameterList.d.ts +1 -0
  6. package/src/lib/components/TimeSeriesManager/PlotRows.d.ts +1 -0
  7. package/src/lib/components/TimeSeriesManager/TimeSeriesManager.d.ts +1 -0
  8. package/src/lib/components/TimeSeriesManager/TimeSeriesManagerMapButtonConnect.d.ts +0 -2
  9. package/src/lib/components/TimeSeriesManager/TimeSeriesManagerRowAccordion.d.ts +1 -0
  10. package/src/lib/components/TimeSeriesSelect/ServiceChips/ServiceChipConnect.d.ts +2 -0
  11. package/src/lib/components/TimeSeriesSelect/ServiceOptionsConnect.d.ts +5 -1
  12. package/src/lib/components/TimeSeriesSelect/ServicePopup/ServicePopupConnect.d.ts +5 -1
  13. package/src/lib/components/TimeSeriesSelect/ServicePopup/ServicePopupDialogConnect.d.ts +1 -0
  14. package/src/lib/components/TimeSeriesSelect/TimeSeriesSearchConnect.d.ts +4 -1
  15. package/src/lib/components/TimeSeriesSelect/TimeSeriesSelect.d.ts +1 -0
  16. package/src/lib/components/TimeSeriesSelect/TimeSeriesSelectButtonConnect.d.ts +1 -0
  17. package/src/lib/components/TimeSeriesSelect/TimeSeriesSelectList.d.ts +1 -0
  18. package/src/lib/components/TimeSeriesSelect/TimeSeriesSelectListConnect.d.ts +1 -0
  19. package/src/lib/components/TimeSeriesSelect/TimeSeriesServiceList.d.ts +1 -0
  20. package/src/lib/components/TimeSeriesSelect/TimeSeriesServiceListConnect.d.ts +4 -1
  21. package/src/lib/store/reducer.d.ts +48 -37
  22. package/src/lib/store/selectors.d.ts +71 -81
  23. package/src/lib/store/store.d.ts +1 -1
  24. package/src/lib/store/types.d.ts +22 -1
  25. package/src/lib/components/TimeSeries/LocationDropdown/LocationDropdownRenderRow.d.ts +0 -3
package/index.esm.js CHANGED
@@ -11,7 +11,7 @@ import { Info, ArrowDropDownDown, Copy, Delete, Visibility, VisibilityOff, TimeS
11
11
  import i18n from 'i18next';
12
12
  import { useTranslation } from 'react-i18next';
13
13
  import '@opengeoweb/core';
14
- import { createEntityAdapter, createSlice, createSelector, createListenerMiddleware, isAnyOf, combineReducers, configureStore } from '@reduxjs/toolkit';
14
+ import { createEntityAdapter, createSlice, createAction, createSelector, createListenerMiddleware, isAnyOf, combineReducers, configureStore } from '@reduxjs/toolkit';
15
15
  import { produce } from 'immer';
16
16
  import { v4 } from 'uuid';
17
17
  import { center } from '@turf/turf';
@@ -21,8 +21,7 @@ import { handleResponse } from '@opengeoweb/api';
21
21
  import Box$1 from '@mui/material/Box';
22
22
  import { useFormContext } from 'react-hook-form';
23
23
  import { ReactHookFormProvider, defaultFormOptions, ReactHookFormTextField, ReactHookFormSelect } from '@opengeoweb/form-fields';
24
- import AutoSizer from 'react-virtualized-auto-sizer';
25
- import { VariableSizeList, FixedSizeList } from 'react-window';
24
+ import { List as List$1, useListRef } from 'react-window';
26
25
  import { webmapUtils } from '@opengeoweb/webmap';
27
26
  import ReactECharts from 'echarts-for-react';
28
27
 
@@ -1181,23 +1180,7 @@ var getLocationPositionPath = function getLocationPositionPath(collectionId, ins
1181
1180
  return "/collections/" + collectionId;
1182
1181
  };
1183
1182
 
1184
- /* *
1185
- * Licensed under the Apache License, Version 2.0 (the "License");
1186
- * you may not use this file except in compliance with the License.
1187
- * You may obtain a copy of the License at
1188
- *
1189
- * http://www.apache.org/licenses/LICENSE-2.0
1190
- *
1191
- * Unless required by applicable law or agreed to in writing, software
1192
- * distributed under the License is distributed on an "AS IS" BASIS,
1193
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1194
- * See the License for the specific language governing permissions and
1195
- * limitations under the License.
1196
- *
1197
- * Copyright 2024 - Koninklijk Nederlands Meteorologisch Instituut (KNMI)
1198
- * Copyright 2024 - Finnish Meteorological Institute (FMI)
1199
- * Copyright 2024 - The Norwegian Meteorological Institute (MET Norway)
1200
- * */
1183
+ var _excluded$3 = ["services"];
1201
1184
  var patchableParameterProperties = {
1202
1185
  color: true,
1203
1186
  plotType: true,
@@ -1218,156 +1201,78 @@ var timeseriesSelectServiceFilterChipsAdapter = createEntityAdapter({
1218
1201
  }
1219
1202
  });
1220
1203
  var initialState = {
1221
- plotPreset: undefined,
1222
- services: undefined,
1223
- timeseriesSelect: {
1224
- currentParameterInfo: undefined,
1225
- filters: {
1226
- searchFilter: '',
1227
- serviceFilterChips: timeseriesSelectServiceFilterChipsAdapter.getInitialState(),
1228
- allServiceFilterChipsEnabled: true
1204
+ byId: {},
1205
+ services: []
1206
+ };
1207
+ var createPanelState = function createPanelState() {
1208
+ return {
1209
+ plotPreset: undefined,
1210
+ timeseriesSelect: {
1211
+ currentParameterInfo: undefined,
1212
+ filters: {
1213
+ searchFilter: '',
1214
+ serviceFilterChips: timeseriesSelectServiceFilterChipsAdapter.getInitialState(),
1215
+ allServiceFilterChipsEnabled: true
1216
+ },
1217
+ servicePopup: {
1218
+ isOpen: false,
1219
+ variant: 'add'
1220
+ }
1229
1221
  },
1230
- servicePopup: {
1231
- isOpen: false,
1232
- variant: 'add'
1222
+ locationData: {
1223
+ isMapPinDisabled: false,
1224
+ shouldHideLocationMarkers: false,
1225
+ isLegendVisible: true
1233
1226
  }
1234
- },
1235
- locationData: {
1236
- isMapPinDisabled: false,
1237
- shouldHideLocationMarkers: false,
1238
- isLegendVisible: true
1239
- }
1227
+ };
1240
1228
  };
1241
- var slice = createSlice({
1242
- initialState: initialState,
1243
- name: 'timeseries',
1229
+ var initialPanelState = createPanelState();
1230
+ var panelSlice = createSlice({
1231
+ initialState: createPanelState(),
1232
+ name: 'timeseriesPanel',
1244
1233
  reducers: {
1245
1234
  loadUserAddedTimeSeriesServices: function loadUserAddedTimeSeriesServices(draft, payloadAction) {
1246
- var _draft$services, _draft$services3;
1247
- // Make sure to initialize services to empty array (if not set)
1248
- if (!((_draft$services = draft.services) != null && _draft$services.length)) {
1249
- draft.services = [];
1250
- }
1251
- var newServices = [];
1252
- payloadAction.payload.forEach(function (service) {
1253
- var _draft$services2;
1254
- var existingService = (_draft$services2 = draft.services) == null ? void 0 : _draft$services2.find(function (el) {
1255
- return el.url === service.url;
1235
+ var _draft$timeseriesSele, _draft$timeseriesSele2;
1236
+ var servicesPayload = Array.isArray(payloadAction.payload) ? payloadAction.payload : payloadAction.payload.timeSeriesServices;
1237
+ var existingIds = new Set((_draft$timeseriesSele = (_draft$timeseriesSele2 = draft.timeseriesSelect) == null ? void 0 : _draft$timeseriesSele2.filters.serviceFilterChips.ids) != null ? _draft$timeseriesSele : []);
1238
+ var newServices = servicesPayload.map(function (service) {
1239
+ var _service$scope;
1240
+ var id = service.scope === 'system' ? service.id : generateServiceId();
1241
+ return Object.assign({}, service, {
1242
+ id: id,
1243
+ scope: (_service$scope = service.scope) != null ? _service$scope : 'user'
1256
1244
  });
1257
- if (!existingService) {
1258
- var newService = Object.assign({}, service, {
1259
- id: service.scope === 'system' ? service.id : generateServiceId(),
1260
- scope: 'user'
1261
- });
1262
- newServices.push(newService);
1263
- }
1264
- });
1265
- (_draft$services3 = draft.services) == null || _draft$services3.push.apply(_draft$services3, newServices);
1266
- // Add filterchips for any new services that were added
1267
- timeSeriesReducer(draft, {
1268
- payload: newServices.map(function (service) {
1269
- return {
1270
- serviceId: service.id,
1271
- serviceName: service.name,
1272
- serviceUrl: service.url,
1273
- type: service.type,
1274
- scope: service.scope
1275
- };
1276
- }),
1277
- type: timeSeriesActions.setServiceFilterChipsInStore.type
1245
+ }).filter(function (service) {
1246
+ return !existingIds.has(service.id);
1278
1247
  });
1248
+ if (newServices.length) {
1249
+ panelSlice.caseReducers.setServiceFilterChipsInStore(draft, {
1250
+ payload: newServices.map(function (service) {
1251
+ return {
1252
+ serviceId: service.id,
1253
+ serviceName: service.name,
1254
+ serviceUrl: service.url,
1255
+ type: service.type,
1256
+ scope: service.scope || 'user'
1257
+ };
1258
+ }),
1259
+ type: timeSeriesActions.setServiceFilterChipsInStore.type
1260
+ });
1261
+ }
1279
1262
  },
1280
1263
  registerTimeSeriesPreset: function registerTimeSeriesPreset(draft, action) {
1281
- var _draft$services4, _timeSeriesPresetWith;
1282
- // Make sure to initialize services to empty array (if not set)
1283
- if (!((_draft$services4 = draft.services) != null && _draft$services4.length)) {
1284
- draft.services = [];
1285
- }
1286
- var newServicesAdded = [];
1287
- var timeSeriesPresetWithParameterIds = produce(action.payload, function (draftPreset) {
1288
- var _draftPreset$services;
1289
- if (!draftPreset.plotPreset) {
1290
- console.warn('missing draft plotpresets', draftPreset);
1291
- return;
1292
- }
1293
- // Make sure to initialize services to empty array (if not set)
1294
- if (!((_draftPreset$services = draftPreset.services) != null && _draftPreset$services.length)) {
1295
- draftPreset.services = [];
1296
- }
1297
- draftPreset.plotPreset.parameters.forEach(function (draftParameter) {
1298
- // Add parameter id to plotPreset.parameters
1299
- draftParameter.id = generateParameterId();
1300
- // Add opacity value to plotPreset.parameters
1301
- draftParameter.opacity = draftParameter.opacity || 70;
1302
- // Check if service is already in the services list
1303
- var serviceFromStore = getServiceById(draft.services, draftParameter.serviceId);
1304
- if (!serviceFromStore) {
1305
- var _draft$services5;
1306
- // The service is not in the store. Add it based on the preset
1307
- var serviceFromAction = getServiceById(draftPreset.services, draftParameter.serviceId);
1308
- if (!serviceFromAction) {
1309
- console.error("A parameter from the preset has a service with id " + draftParameter.serviceId + " which is not in the store or in the preset");
1310
- return;
1311
- }
1312
- // Now check if the url is already in the store, it might be there with a different id
1313
- var reUseAbleService = (_draft$services5 = draft.services) == null ? void 0 : _draft$services5.find(function (storeService) {
1314
- return storeService.url === serviceFromAction.url;
1315
- });
1316
- if (!reUseAbleService) {
1317
- var _draft$services6;
1318
- // The url and or serviceId were not yet in the services state
1319
- (_draft$services6 = draft.services) == null || _draft$services6.push(Object.assign({}, serviceFromAction, {
1320
- scope: 'system'
1321
- }));
1322
- newServicesAdded.push({
1323
- serviceId: serviceFromAction.id,
1324
- serviceUrl: serviceFromAction.url,
1325
- serviceName: serviceFromAction.name,
1326
- type: serviceFromAction.type,
1327
- scope: 'system'
1328
- });
1329
- } else {
1330
- // The same url is already in the store, but has the wrong id. Adjust the parameters serviceId.
1331
- draftParameter.serviceId = reUseAbleService.id;
1332
- // Make sure the service has correct scope as it might have been added by user previously
1333
- reUseAbleService.scope = 'system';
1334
- }
1335
- }
1336
- });
1337
- });
1338
- // Check if all the services from the preset are now in the store. Some services might not be used in the parameter.
1339
- timeSeriesPresetWithParameterIds == null || (_timeSeriesPresetWith = timeSeriesPresetWithParameterIds.services) == null || _timeSeriesPresetWith.forEach(function (serviceFromPreset) {
1340
- var _draft$services7;
1341
- var serviceFromAction = (_draft$services7 = draft.services) == null ? void 0 : _draft$services7.find(function (serviceFromStore) {
1342
- return serviceFromPreset.url === serviceFromStore.url;
1343
- });
1344
- // The service from the preset was not added yet because it was not used in any parameter
1345
- if (!serviceFromAction) {
1346
- var _draft$services8, _draft$services9;
1347
- // Check if the id was already taken, if it was generate a new one.
1348
- var uniqueServiceId = (_draft$services8 = draft.services) != null && _draft$services8.find(function (service) {
1349
- return serviceFromPreset.id === service.id;
1350
- }) ? generateServiceId() : serviceFromPreset.id;
1351
- // Finally push the new (and unused) service to the store
1352
- (_draft$services9 = draft.services) == null || _draft$services9.push(Object.assign({}, serviceFromPreset, {
1353
- id: uniqueServiceId,
1354
- scope: 'system'
1355
- }));
1356
- newServicesAdded.push({
1357
- serviceId: uniqueServiceId,
1358
- serviceUrl: serviceFromPreset.url,
1359
- serviceName: serviceFromPreset.name,
1360
- type: serviceFromPreset.type,
1361
- scope: 'system'
1362
- });
1363
- } else {
1364
- // Make sure the service has correct scope as it might have been added by user previously
1365
- serviceFromAction.scope = 'system';
1366
- }
1264
+ var _action$payload$servi;
1265
+ draft.plotPreset = action.payload.plotPreset;
1266
+ var newServicesAdded = ((_action$payload$servi = action.payload.services) != null ? _action$payload$servi : []).map(function (service) {
1267
+ return {
1268
+ serviceId: service.id,
1269
+ serviceUrl: service.url,
1270
+ serviceName: service.name,
1271
+ type: service.type,
1272
+ scope: service.scope || 'system'
1273
+ };
1367
1274
  });
1368
- draft.plotPreset = timeSeriesPresetWithParameterIds.plotPreset;
1369
- // Add filterchips for any new services that were added
1370
- timeSeriesReducer(draft, {
1275
+ panelSlice.caseReducers.setServiceFilterChipsInStore(draft, {
1371
1276
  payload: newServicesAdded,
1372
1277
  type: timeSeriesActions.setServiceFilterChipsInStore.type
1373
1278
  });
@@ -1482,8 +1387,8 @@ var slice = createSlice({
1482
1387
  },
1483
1388
  // Select a filter chip - if this means all will be selected, ensure all gets set to selected
1484
1389
  setServiceFilterChipSelected: function setServiceFilterChipSelected(draft, action) {
1485
- var _draft$timeseriesSele;
1486
- var serviceFilterChipsById = (_draft$timeseriesSele = draft.timeseriesSelect) == null ? void 0 : _draft$timeseriesSele.filters.serviceFilterChips.entities;
1390
+ var _draft$timeseriesSele3;
1391
+ var serviceFilterChipsById = (_draft$timeseriesSele3 = draft.timeseriesSelect) == null ? void 0 : _draft$timeseriesSele3.filters.serviceFilterChips.entities;
1487
1392
  if (serviceFilterChipsById) {
1488
1393
  var activeServices = compact(Object.values(serviceFilterChipsById));
1489
1394
  var countSelectedServices = activeServices.filter(function (service) {
@@ -1491,7 +1396,10 @@ var slice = createSlice({
1491
1396
  }).length;
1492
1397
  var isAllServicesGoingToBeEnabled = countSelectedServices === activeServices.length - 1;
1493
1398
  if (isAllServicesGoingToBeEnabled) {
1494
- slice.caseReducers.setAllServiceFilterChipSelected(draft);
1399
+ panelSlice.caseReducers.setAllServiceFilterChipSelected(draft, {
1400
+ type: timeSeriesActions.setAllServiceFilterChipSelected.type,
1401
+ payload: {}
1402
+ });
1495
1403
  return;
1496
1404
  }
1497
1405
  var service = serviceFilterChipsById[action.payload.serviceId];
@@ -1499,7 +1407,7 @@ var slice = createSlice({
1499
1407
  }
1500
1408
  },
1501
1409
  // Select all filter chips
1502
- setAllServiceFilterChipSelected: function setAllServiceFilterChipSelected(draft) {
1410
+ setAllServiceFilterChipSelected: function setAllServiceFilterChipSelected(draft, _action) {
1503
1411
  if (draft.timeseriesSelect) {
1504
1412
  var serviceFilterChipsById = draft.timeseriesSelect.filters.serviceFilterChips.entities;
1505
1413
  var servicesToTurnOn = compact(Object.values(serviceFilterChipsById)).filter(function (service) {
@@ -1533,6 +1441,10 @@ var slice = createSlice({
1533
1441
  };
1534
1442
  });
1535
1443
  timeseriesSelectServiceFilterChipsAdapter.updateMany(draft.timeseriesSelect.filters.serviceFilterChips, updates);
1444
+ var selectedService = serviceFilterChipsById[action.payload.serviceId];
1445
+ if (selectedService) {
1446
+ selectedService.enabled = true;
1447
+ }
1536
1448
  draft.timeseriesSelect.filters.allServiceFilterChipsEnabled = false;
1537
1449
  }
1538
1450
  },
@@ -1545,7 +1457,10 @@ var slice = createSlice({
1545
1457
  }).length;
1546
1458
  var isAllServicesGoingToBeDisabled = countPressedServices === 1;
1547
1459
  if (isAllServicesGoingToBeDisabled) {
1548
- slice.caseReducers.setAllServiceFilterChipSelected(draft);
1460
+ panelSlice.caseReducers.setAllServiceFilterChipSelected(draft, {
1461
+ type: timeSeriesActions.setAllServiceFilterChipSelected.type,
1462
+ payload: {}
1463
+ });
1549
1464
  return;
1550
1465
  }
1551
1466
  var service = serviceFilterChipsById[action.payload.serviceId];
@@ -1555,11 +1470,11 @@ var slice = createSlice({
1555
1470
  setServiceFilterChipsInStore: function setServiceFilterChipsInStore(draft, action) {
1556
1471
  action.payload.forEach(function (service) {
1557
1472
  if (draft.timeseriesSelect) {
1558
- var _draft$timeseriesSele2;
1473
+ var _draft$timeseriesSele4;
1559
1474
  draft.timeseriesSelect.filters.serviceFilterChips.entities[service.serviceId] = {
1560
1475
  serviceId: service.serviceId,
1561
1476
  serviceName: service.serviceName || service.serviceId,
1562
- enabled: (_draft$timeseriesSele2 = draft.timeseriesSelect) == null ? void 0 : _draft$timeseriesSele2.filters.allServiceFilterChipsEnabled,
1477
+ enabled: (_draft$timeseriesSele4 = draft.timeseriesSelect) == null ? void 0 : _draft$timeseriesSele4.filters.allServiceFilterChipsEnabled,
1563
1478
  scope: service.scope || 'system',
1564
1479
  type: service.type,
1565
1480
  serviceUrl: service.serviceUrl,
@@ -1586,90 +1501,41 @@ var slice = createSlice({
1586
1501
  }
1587
1502
  },
1588
1503
  addServices: function addServices(draft, action) {
1589
- var _draft$services0;
1590
- if (!((_draft$services0 = draft.services) != null && _draft$services0.length)) {
1591
- draft.services = action.payload.timeSeriesServices;
1592
- } else {
1593
- var filteredServices = action.payload.timeSeriesServices.reduce(function (acc, service) {
1594
- if (!draft.services.some(function (existingService) {
1595
- return existingService.url === service.url;
1596
- })) {
1597
- var hasDuplicateId = draft.services.some(function (existingService) {
1598
- return existingService.id === service.id;
1599
- });
1600
- if (hasDuplicateId) {
1601
- acc.push(Object.assign({}, service, {
1602
- id: generateServiceId()
1603
- }));
1604
- } else {
1605
- acc.push(service);
1606
- }
1607
- }
1608
- return acc;
1609
- }, []);
1610
- draft.services = [].concat(draft.services, filteredServices);
1611
- }
1612
- var newServicesAdded = draft.services.map(function (service) {
1504
+ var newServicesAdded = action.payload.timeSeriesServices.map(function (service) {
1613
1505
  return {
1614
1506
  serviceId: service.id,
1615
1507
  serviceUrl: service.url,
1616
1508
  serviceName: service.name,
1617
1509
  type: service.type,
1618
- scope: 'system'
1510
+ scope: service.scope || 'system'
1619
1511
  };
1620
1512
  });
1621
1513
  // Add filterchips for any new services that were added
1622
- timeSeriesReducer(draft, {
1514
+ panelSlice.caseReducers.setServiceFilterChipsInStore(draft, {
1623
1515
  payload: newServicesAdded,
1624
1516
  type: timeSeriesActions.setServiceFilterChipsInStore.type
1625
1517
  });
1626
1518
  },
1627
1519
  upsertService: function upsertService(draft, action) {
1628
- var _draft$services1;
1629
- var newService = {
1630
- id: action.payload.id || generateServiceId(),
1631
- description: action.payload.description,
1632
- url: action.payload.url,
1633
- name: action.payload.name,
1634
- type: action.payload.type,
1635
- scope: 'user'
1636
- };
1637
- if (!((_draft$services1 = draft.services) != null && _draft$services1.length)) {
1638
- draft.services = [newService];
1639
- } else if (action.payload.isUpdate) {
1640
- var index = draft.services.findIndex(function (el) {
1641
- return el.id === action.payload.id;
1642
- });
1643
- if (index >= 0) {
1644
- draft.services[index] = newService;
1645
- }
1646
- } else {
1647
- draft.services = [].concat(draft.services, [newService]);
1648
- }
1649
1520
  // Add filterchips for any new services that were added
1650
- timeSeriesReducer(draft, {
1521
+ panelSlice.caseReducers.setServiceFilterChipsInStore(draft, {
1651
1522
  payload: [{
1652
- serviceId: newService.id,
1653
- serviceUrl: newService.url,
1654
- serviceName: newService.name,
1655
- type: newService.type,
1523
+ serviceId: action.payload.id || generateServiceId(),
1524
+ serviceUrl: action.payload.url,
1525
+ serviceName: action.payload.name,
1526
+ type: action.payload.type,
1656
1527
  scope: 'user'
1657
1528
  }],
1658
1529
  type: timeSeriesActions.setServiceFilterChipsInStore.type
1659
1530
  });
1660
1531
  },
1661
1532
  removeService: function removeService(draft, action) {
1662
- if (draft.services) {
1663
- draft.services = draft.services.filter(function (el) {
1664
- return el.id !== action.payload.id;
1665
- });
1666
- timeSeriesReducer(draft, {
1667
- payload: action.payload,
1668
- type: timeSeriesActions.removeServiceFilterChipFromStore.type
1669
- });
1670
- }
1533
+ panelSlice.caseReducers.removeServiceFilterChipFromStore(draft, {
1534
+ payload: action.payload,
1535
+ type: timeSeriesActions.removeServiceFilterChipFromStore.type
1536
+ });
1671
1537
  },
1672
- closeServicePopup: function closeServicePopup(draft) {
1538
+ closeServicePopup: function closeServicePopup(draft, _action) {
1673
1539
  if (draft.timeseriesSelect) {
1674
1540
  draft.timeseriesSelect.servicePopup.isOpen = false;
1675
1541
  }
@@ -1708,8 +1574,316 @@ var slice = createSlice({
1708
1574
  }
1709
1575
  }
1710
1576
  });
1711
- var timeSeriesReducer = slice.reducer,
1712
- timeSeriesActions = slice.actions;
1577
+ var resetTimeSeriesPanels = createAction('timeseriesPanel/resetPanels');
1578
+ var timeSeriesActions = Object.assign({}, panelSlice.actions, {
1579
+ resetTimeSeriesPanels: resetTimeSeriesPanels
1580
+ });
1581
+ var resolvePanelId = function resolvePanelId(action) {
1582
+ var _action$payload3;
1583
+ return (_action$payload3 = action.payload) == null ? void 0 : _action$payload3.panelId;
1584
+ };
1585
+ var normalizeTimeSeriesState = function normalizeTimeSeriesState(state) {
1586
+ if ('byId' in state) {
1587
+ return state;
1588
+ }
1589
+ var legacyServices = state.services || [];
1590
+ state.services;
1591
+ var panelState = _objectWithoutPropertiesLoose(state, _excluded$3);
1592
+ return Object.assign({}, initialState, {
1593
+ services: legacyServices,
1594
+ byId: Object.assign({}, initialState.byId, {
1595
+ "default": panelState
1596
+ })
1597
+ });
1598
+ };
1599
+ var toServiceFilterChip = function toServiceFilterChip(service) {
1600
+ return {
1601
+ serviceId: service.id,
1602
+ serviceUrl: service.url,
1603
+ serviceName: service.name,
1604
+ type: service.type,
1605
+ scope: service.scope || 'system'
1606
+ };
1607
+ };
1608
+ var addServiceFilterChipsToPanel = function addServiceFilterChipsToPanel(panelState, servicesToAdd) {
1609
+ var _panelState$timeserie;
1610
+ if (!servicesToAdd.length) {
1611
+ return panelState;
1612
+ }
1613
+ var existingChips = ((_panelState$timeserie = panelState.timeseriesSelect) == null ? void 0 : _panelState$timeserie.filters.serviceFilterChips.entities) || {};
1614
+ var servicesMissingChips = servicesToAdd.filter(function (service) {
1615
+ return !existingChips[service.id];
1616
+ });
1617
+ if (!servicesMissingChips.length) {
1618
+ return panelState;
1619
+ }
1620
+ return panelSlice.reducer(panelState, timeSeriesActions.setServiceFilterChipsInStore(servicesMissingChips.map(toServiceFilterChip)));
1621
+ };
1622
+ var removeServiceFilterChipsFromPanel = function removeServiceFilterChipsFromPanel(panelState, serviceIdsToRemove) {
1623
+ if (!serviceIdsToRemove.length) {
1624
+ return panelState;
1625
+ }
1626
+ return serviceIdsToRemove.reduce(function (nextState, id) {
1627
+ return panelSlice.reducer(nextState, timeSeriesActions.removeServiceFilterChipFromStore({
1628
+ id: id
1629
+ }));
1630
+ }, panelState);
1631
+ };
1632
+ var timeSeriesReducer = function timeSeriesReducer(state, action) {
1633
+ var _Object$assign2, _Object$assign3;
1634
+ var normalizedState = normalizeTimeSeriesState(state != null ? state : initialState);
1635
+ var isTimeSeriesAction = typeof action.type === 'string' && action.type.startsWith(panelSlice.name + "/");
1636
+ if (action.type === resetTimeSeriesPanels.type) {
1637
+ return Object.assign({}, normalizedState, {
1638
+ byId: {}
1639
+ });
1640
+ }
1641
+ if (!isTimeSeriesAction) {
1642
+ return normalizedState;
1643
+ }
1644
+ var panelId = resolvePanelId(action);
1645
+ var serviceActionTypes = new Set([timeSeriesActions.loadUserAddedTimeSeriesServices.type, timeSeriesActions.addServices.type, timeSeriesActions.upsertService.type, timeSeriesActions.removeService.type, timeSeriesActions.registerTimeSeriesPreset.type]);
1646
+ var nextServices = normalizedState.services;
1647
+ if (action.type === timeSeriesActions.loadUserAddedTimeSeriesServices.type) {
1648
+ var payload = action.payload;
1649
+ var servicesPayload = Array.isArray(payload) ? payload : payload.timeSeriesServices;
1650
+ var newServices = [];
1651
+ servicesPayload.forEach(function (service) {
1652
+ var existingService = nextServices.find(function (el) {
1653
+ return el.url === service.url;
1654
+ });
1655
+ if (!existingService) {
1656
+ var _service$scope2;
1657
+ newServices.push(Object.assign({}, service, {
1658
+ id: service.scope === 'system' ? service.id : generateServiceId(),
1659
+ scope: (_service$scope2 = service.scope) != null ? _service$scope2 : 'user'
1660
+ }));
1661
+ }
1662
+ });
1663
+ if (newServices.length) {
1664
+ nextServices = [].concat(nextServices, newServices);
1665
+ }
1666
+ }
1667
+ if (action.type === timeSeriesActions.addServices.type) {
1668
+ var timeSeriesServices = action.payload.timeSeriesServices;
1669
+ var filteredServices = timeSeriesServices.reduce(function (acc, service) {
1670
+ if (!nextServices.some(function (existing) {
1671
+ return existing.url === service.url;
1672
+ })) {
1673
+ var hasDuplicateId = nextServices.some(function (existing) {
1674
+ return existing.id === service.id;
1675
+ });
1676
+ if (hasDuplicateId) {
1677
+ acc.push(Object.assign({}, service, {
1678
+ id: generateServiceId()
1679
+ }));
1680
+ } else {
1681
+ acc.push(service);
1682
+ }
1683
+ }
1684
+ return acc;
1685
+ }, []);
1686
+ if (filteredServices.length) {
1687
+ nextServices = [].concat(nextServices, filteredServices);
1688
+ }
1689
+ }
1690
+ if (action.type === timeSeriesActions.upsertService.type) {
1691
+ var _payload = action.payload;
1692
+ var newService = {
1693
+ id: _payload.id || generateServiceId(),
1694
+ description: _payload.description,
1695
+ url: _payload.url,
1696
+ name: _payload.name,
1697
+ type: _payload.type,
1698
+ scope: 'user'
1699
+ };
1700
+ if (_payload.isUpdate) {
1701
+ var index = nextServices.findIndex(function (el) {
1702
+ return el.id === _payload.id;
1703
+ });
1704
+ if (index >= 0) {
1705
+ nextServices = [].concat(nextServices.slice(0, index), [newService], nextServices.slice(index + 1));
1706
+ }
1707
+ } else {
1708
+ nextServices = [].concat(nextServices, [newService]);
1709
+ }
1710
+ }
1711
+ if (action.type === timeSeriesActions.removeService.type) {
1712
+ var id = action.payload.id;
1713
+ nextServices = nextServices.filter(function (service) {
1714
+ return service.id !== id;
1715
+ });
1716
+ }
1717
+ var previousServices = normalizedState.services;
1718
+ var addedServices = nextServices.filter(function (service) {
1719
+ return !previousServices.some(function (existing) {
1720
+ return existing.url === service.url;
1721
+ });
1722
+ });
1723
+ var updatedServices = nextServices.filter(function (service) {
1724
+ var previous = previousServices.find(function (existing) {
1725
+ return existing.id === service.id;
1726
+ });
1727
+ return previous && (previous.name !== service.name || previous.url !== service.url || previous.type !== service.type || previous.scope !== service.scope);
1728
+ });
1729
+ var removedServiceIds = previousServices.filter(function (service) {
1730
+ return !nextServices.some(function (existing) {
1731
+ return existing.id === service.id;
1732
+ });
1733
+ }).map(function (service) {
1734
+ return service.id;
1735
+ });
1736
+ var servicesToSync = [].concat(addedServices, updatedServices.filter(function (service) {
1737
+ return !addedServices.some(function (added) {
1738
+ return added.id === service.id;
1739
+ });
1740
+ }));
1741
+ var syncServiceChipsAcrossPanels = function syncServiceChipsAcrossPanels(byId, overrideServicesToSync, overrideRemovedServiceIds) {
1742
+ var servicesForSync = overrideServicesToSync != null ? overrideServicesToSync : servicesToSync;
1743
+ var removedIdsForSync = removedServiceIds;
1744
+ var shouldSync = servicesForSync.length > 0 || removedIdsForSync.length > 0;
1745
+ if (!shouldSync) {
1746
+ return byId;
1747
+ }
1748
+ var nextById = {};
1749
+ var didChange = false;
1750
+ Object.entries(byId).forEach(function (_ref) {
1751
+ var id = _ref[0],
1752
+ panelState = _ref[1];
1753
+ var nextPanelState = panelState;
1754
+ nextPanelState = addServiceFilterChipsToPanel(nextPanelState, servicesForSync);
1755
+ nextPanelState = removeServiceFilterChipsFromPanel(nextPanelState, removedIdsForSync);
1756
+ if (nextPanelState !== panelState) {
1757
+ didChange = true;
1758
+ }
1759
+ nextById[id] = nextPanelState;
1760
+ });
1761
+ return didChange ? nextById : byId;
1762
+ };
1763
+ if (action.type === timeSeriesActions.registerTimeSeriesPreset.type) {
1764
+ var _normalizedState$byId, _payload2$services, _Object$assign;
1765
+ var _payload2 = action.payload;
1766
+ if (!panelId) {
1767
+ return Object.assign({}, normalizedState, {
1768
+ services: nextServices,
1769
+ byId: syncServiceChipsAcrossPanels(normalizedState.byId)
1770
+ });
1771
+ }
1772
+ var _currentPanelState = (_normalizedState$byId = normalizedState.byId[panelId]) != null ? _normalizedState$byId : createPanelState();
1773
+ var newServicesAdded = [];
1774
+ var presetServices = (_payload2$services = _payload2.services) != null ? _payload2$services : [];
1775
+ var timeSeriesPresetWithParameterIds = produce(_payload2, function (draftPreset) {
1776
+ draftPreset.plotPreset.parameters.forEach(function (draftParameter) {
1777
+ draftParameter.id = generateParameterId();
1778
+ draftParameter.opacity = draftParameter.opacity || 70;
1779
+ var serviceFromStore = getServiceById(nextServices, draftParameter.serviceId);
1780
+ if (!serviceFromStore) {
1781
+ var serviceFromPreset = getServiceById(presetServices, draftParameter.serviceId);
1782
+ if (!serviceFromPreset) {
1783
+ console.error("A parameter from the preset has a service with id " + draftParameter.serviceId + " which is not in the store or in the preset");
1784
+ return;
1785
+ }
1786
+ var reUseAbleService = nextServices.find(function (storeService) {
1787
+ return storeService.url === serviceFromPreset.url;
1788
+ });
1789
+ if (!reUseAbleService) {
1790
+ nextServices = [].concat(nextServices, [Object.assign({}, serviceFromPreset, {
1791
+ scope: 'system'
1792
+ })]);
1793
+ newServicesAdded.push({
1794
+ serviceId: serviceFromPreset.id,
1795
+ serviceUrl: serviceFromPreset.url,
1796
+ serviceName: serviceFromPreset.name,
1797
+ type: serviceFromPreset.type,
1798
+ scope: 'system'
1799
+ });
1800
+ } else {
1801
+ draftParameter.serviceId = reUseAbleService.id;
1802
+ nextServices = nextServices.map(function (service) {
1803
+ return service.id === reUseAbleService.id ? Object.assign({}, service, {
1804
+ scope: 'system'
1805
+ }) : service;
1806
+ });
1807
+ }
1808
+ }
1809
+ });
1810
+ });
1811
+ presetServices.forEach(function (serviceFromPreset) {
1812
+ var serviceFromStore = nextServices.find(function (service) {
1813
+ return service.url === serviceFromPreset.url;
1814
+ });
1815
+ if (!serviceFromStore) {
1816
+ var uniqueServiceId = nextServices.some(function (service) {
1817
+ return service.id === serviceFromPreset.id;
1818
+ }) ? generateServiceId() : serviceFromPreset.id;
1819
+ nextServices = [].concat(nextServices, [Object.assign({}, serviceFromPreset, {
1820
+ id: uniqueServiceId,
1821
+ scope: 'system'
1822
+ })]);
1823
+ newServicesAdded.push({
1824
+ serviceId: uniqueServiceId,
1825
+ serviceUrl: serviceFromPreset.url,
1826
+ serviceName: serviceFromPreset.name,
1827
+ type: serviceFromPreset.type,
1828
+ scope: 'system'
1829
+ });
1830
+ } else {
1831
+ nextServices = nextServices.map(function (service) {
1832
+ return service.id === serviceFromStore.id ? Object.assign({}, service, {
1833
+ scope: 'system'
1834
+ }) : service;
1835
+ });
1836
+ }
1837
+ });
1838
+ var _nextPanelState = produce(_currentPanelState, function (draft) {
1839
+ draft.plotPreset = timeSeriesPresetWithParameterIds.plotPreset;
1840
+ panelSlice.caseReducers.setServiceFilterChipsInStore(draft, {
1841
+ payload: newServicesAdded,
1842
+ type: timeSeriesActions.setServiceFilterChipsInStore.type
1843
+ });
1844
+ });
1845
+ var updatedById = Object.assign({}, normalizedState.byId, (_Object$assign = {}, _Object$assign[panelId] = _nextPanelState, _Object$assign));
1846
+ var servicesToSyncFromPreset = Array.from(new Map([].concat(newServicesAdded.map(function (service) {
1847
+ return nextServices.find(function (nextService) {
1848
+ return nextService.id === service.serviceId;
1849
+ });
1850
+ }), presetServices.map(function (service) {
1851
+ return nextServices.find(function (nextService) {
1852
+ return nextService.url === service.url || nextService.id === service.id;
1853
+ });
1854
+ })).filter(function (service) {
1855
+ return !!service;
1856
+ }).map(function (service) {
1857
+ return [service.id, service];
1858
+ })).values());
1859
+ return Object.assign({}, normalizedState, {
1860
+ services: nextServices,
1861
+ byId: syncServiceChipsAcrossPanels(updatedById, servicesToSyncFromPreset)
1862
+ });
1863
+ }
1864
+ if (!panelId) {
1865
+ if (serviceActionTypes.has(action.type)) {
1866
+ return Object.assign({}, normalizedState, {
1867
+ services: nextServices,
1868
+ byId: syncServiceChipsAcrossPanels(normalizedState.byId)
1869
+ });
1870
+ }
1871
+ return normalizedState;
1872
+ }
1873
+ var currentPanelState = normalizedState.byId[panelId];
1874
+ var basePanelState = currentPanelState != null ? currentPanelState : createPanelState();
1875
+ if (normalizedState.services.length) {
1876
+ basePanelState = addServiceFilterChipsToPanel(basePanelState, normalizedState.services);
1877
+ }
1878
+ var nextPanelState = panelSlice.reducer(basePanelState, action);
1879
+ if (nextPanelState === currentPanelState && nextServices === normalizedState.services) {
1880
+ return normalizedState;
1881
+ }
1882
+ return Object.assign({}, normalizedState, {
1883
+ services: nextServices,
1884
+ byId: serviceActionTypes.has(action.type) ? syncServiceChipsAcrossPanels(Object.assign({}, normalizedState.byId, (_Object$assign2 = {}, _Object$assign2[panelId] = nextPanelState, _Object$assign2))) : Object.assign({}, normalizedState.byId, (_Object$assign3 = {}, _Object$assign3[panelId] = nextPanelState, _Object$assign3))
1885
+ });
1886
+ };
1713
1887
  var generateTimeSeriesId = function generateTimeSeriesId() {
1714
1888
  return "timeseriesid_" + v4();
1715
1889
  };
@@ -1737,20 +1911,36 @@ var generateServiceId = function generateServiceId() {
1737
1911
  * Copyright 2024 - Finnish Meteorological Institute (FMI)
1738
1912
  * Copyright 2024 - The Norwegian Meteorological Institute (MET Norway)
1739
1913
  * */
1740
- var getPlotState = function getPlotState(state) {
1741
- var _state$timeSeries;
1742
- return (_state$timeSeries = state.timeSeries) == null ? void 0 : _state$timeSeries.plotPreset;
1914
+ var getPanelState = function getPanelState(state, panelId) {
1915
+ var timeSeriesState = state.timeSeries;
1916
+ if (!timeSeriesState) {
1917
+ return undefined;
1918
+ }
1919
+ if ('byId' in timeSeriesState) {
1920
+ var _timeSeriesState$byId;
1921
+ if (!panelId) {
1922
+ return undefined;
1923
+ }
1924
+ return (_timeSeriesState$byId = timeSeriesState.byId) == null ? void 0 : _timeSeriesState$byId[panelId];
1925
+ }
1926
+ return timeSeriesState;
1743
1927
  };
1744
- var getTimeSeriesState = function getTimeSeriesState(state) {
1745
- return state.timeSeries;
1928
+ var getPlotState = function getPlotState(state, panelId) {
1929
+ var _getPanelState;
1930
+ return (_getPanelState = getPanelState(state, panelId)) == null ? void 0 : _getPanelState.plotPreset;
1931
+ };
1932
+ var getTimeSeriesState = function getTimeSeriesState(state, panelId) {
1933
+ return getPanelState(state, panelId);
1746
1934
  };
1747
- var getMapId = function getMapId(state) {
1748
- var _state$timeSeries2;
1749
- return (_state$timeSeries2 = state.timeSeries) == null || (_state$timeSeries2 = _state$timeSeries2.plotPreset) == null ? void 0 : _state$timeSeries2.mapId;
1935
+ var getMapId = function getMapId(state, panelId) {
1936
+ var _getPanelState2;
1937
+ return (_getPanelState2 = getPanelState(state, panelId)) == null || (_getPanelState2 = _getPanelState2.plotPreset) == null ? void 0 : _getPanelState2.mapId;
1750
1938
  };
1751
- var getPlotWithParameters = createSelector(getPlotState, function (_, selectPlotId) {
1939
+ var getPlotWithParameters = createSelector([function (state, _selectPlotId, panelId) {
1940
+ return getPlotState(state, panelId);
1941
+ }, function (_, selectPlotId) {
1752
1942
  return selectPlotId;
1753
- }, function (plotPreset, selectPlotId) {
1943
+ }], function (plotPreset, selectPlotId) {
1754
1944
  if (!plotPreset || !selectPlotId) {
1755
1945
  return undefined;
1756
1946
  }
@@ -1767,13 +1957,26 @@ var getPlotWithParameters = createSelector(getPlotState, function (_, selectPlot
1767
1957
  parameters: parameters
1768
1958
  });
1769
1959
  });
1770
- var getService = createSelector(getTimeSeriesState, function (_, serviceId) {
1960
+ var getService = createSelector([function (state, _serviceId, _panelId) {
1961
+ return state.timeSeries;
1962
+ }, function (_, serviceId) {
1771
1963
  return serviceId;
1772
- }, function (timeSeriesState, serviceId) {
1773
- return timeSeriesState != null && timeSeriesState.services ? getServiceById(timeSeriesState.services, serviceId) : undefined;
1964
+ }], function (timeSeriesState, serviceId) {
1965
+ if (!timeSeriesState || !('byId' in timeSeriesState)) {
1966
+ return undefined;
1967
+ }
1968
+ return getServiceById(timeSeriesState.services || [], serviceId);
1774
1969
  });
1775
- var getServices = createSelector(getTimeSeriesState, function (timeSeriesState) {
1776
- return timeSeriesState == null ? void 0 : timeSeriesState.services;
1970
+ var getServices = createSelector([function (state, _panelId) {
1971
+ return state.timeSeries;
1972
+ }], function (timeSeriesState) {
1973
+ if (!timeSeriesState) {
1974
+ return [];
1975
+ }
1976
+ if ('byId' in timeSeriesState) {
1977
+ return timeSeriesState.services;
1978
+ }
1979
+ return [];
1777
1980
  }, selectorMemoizationOptions);
1778
1981
  /**
1779
1982
  * Returns search filter string
@@ -1805,18 +2008,31 @@ var getParametersInUse = createSelector(getTimeSeriesState, function (store) {
1805
2008
  * @returns {ActiveServiceObjectEntities} returnType: ActiveServiceObjectEntitiesobject of active services
1806
2009
  */
1807
2010
  // cast to usable type - selectEntities returns Dictionary<ActiveServiceObject> which is not usable inside of the code
1808
- var getServiceFilterChips = function getServiceFilterChips(store) {
1809
- return getServiceFilterChipsDictionary(store);
1810
- };
1811
- var _timeseriesSelectServ = timeseriesSelectServiceFilterChipsAdapter.getSelectors(function (store) {
1812
- var _store$timeSeries;
1813
- return (store == null || (_store$timeSeries = store.timeSeries) == null || (_store$timeSeries = _store$timeSeries.timeseriesSelect) == null || (_store$timeSeries = _store$timeSeries.filters) == null ? void 0 : _store$timeSeries.serviceFilterChips) || {
1814
- entities: {},
1815
- ids: []
1816
- };
1817
- }),
1818
- getServiceFilterChipsDictionary = _timeseriesSelectServ.selectEntities,
1819
- getServiceFilterChipsById = _timeseriesSelectServ.selectById;
2011
+ var getServiceFilterChipsState = function getServiceFilterChipsState(store, panelId) {
2012
+ var _getTimeSeriesState;
2013
+ return ((_getTimeSeriesState = getTimeSeriesState(store, panelId)) == null || (_getTimeSeriesState = _getTimeSeriesState.timeseriesSelect) == null || (_getTimeSeriesState = _getTimeSeriesState.filters) == null ? void 0 : _getTimeSeriesState.serviceFilterChips) || {
2014
+ entities: {},
2015
+ ids: []
2016
+ };
2017
+ };
2018
+ var makeServiceFilterChipsSelectors = function makeServiceFilterChipsSelectors(panelId) {
2019
+ return timeseriesSelectServiceFilterChipsAdapter.getSelectors(function (store) {
2020
+ return getServiceFilterChipsState(store, panelId);
2021
+ });
2022
+ };
2023
+ var getServiceFilterChips = function getServiceFilterChips(store, panelId) {
2024
+ return makeServiceFilterChipsSelectors(panelId).selectEntities(store);
2025
+ };
2026
+ var getServiceFilterChipsById = function getServiceFilterChipsById(store, id, panelId) {
2027
+ return makeServiceFilterChipsSelectors(panelId).selectById(store, id);
2028
+ };
2029
+ /**
2030
+ * Returns whether all service filter chips are enabled
2031
+ *
2032
+ * Example getAllFilterChipsEnabled(store);
2033
+ * @param {object} store store: object - store object
2034
+ * @returns {boolean} returnType: boolean
2035
+ */
1820
2036
  var getAllFilterChipsEnabled = createSelector(getTimeSeriesState, function (store) {
1821
2037
  var _store$timeseriesSele2;
1822
2038
  return (store == null || (_store$timeseriesSele2 = store.timeseriesSelect) == null || (_store$timeseriesSele2 = _store$timeseriesSele2.filters) == null ? void 0 : _store$timeseriesSele2.allServiceFilterChipsEnabled) || false;
@@ -1860,9 +2076,11 @@ var getParameterInfoParameter = createSelector(getTimeSeriesState, function (sto
1860
2076
  * @param {string} parameterId parameterId
1861
2077
  * @returns {Parameter} returnType: Parameter
1862
2078
  */
1863
- var getParameterById = createSelector(getTimeSeriesState, function (store, parameterId) {
1864
- return parameterId;
2079
+ var getParameterById = createSelector([function (store, _parameterId, panelId) {
2080
+ return getTimeSeriesState(store, panelId);
1865
2081
  }, function (store, parameterId) {
2082
+ return parameterId;
2083
+ }], function (store, parameterId) {
1866
2084
  if (store != null && store.plotPreset) {
1867
2085
  var _store$plotPreset$par2;
1868
2086
  return (_store$plotPreset$par2 = store.plotPreset.parameters) == null ? void 0 : _store$plotPreset$par2.find(function (parameter) {
@@ -1873,7 +2091,7 @@ var getParameterById = createSelector(getTimeSeriesState, function (store, param
1873
2091
  });
1874
2092
  var getServicePopupDetails = createSelector(getTimeSeriesState, function (store) {
1875
2093
  var _store$timeseriesSele6;
1876
- return (store == null || (_store$timeseriesSele6 = store.timeseriesSelect) == null ? void 0 : _store$timeseriesSele6.servicePopup) || initialState.timeseriesSelect.servicePopup;
2094
+ return (store == null || (_store$timeseriesSele6 = store.timeseriesSelect) == null ? void 0 : _store$timeseriesSele6.servicePopup) || initialPanelState.timeseriesSelect.servicePopup;
1877
2095
  });
1878
2096
  var getTimeSeriesPreset = createSelector(getPlotState, getServices, function (plotState, services) {
1879
2097
  if (!plotState || !services) {
@@ -1961,6 +2179,7 @@ var selectors = /*#__PURE__*/Object.freeze({
1961
2179
  getIsLegendVisible: getIsLegendVisible,
1962
2180
  getIsMapPinDisabled: getIsMapPinDisabled,
1963
2181
  getMapId: getMapId,
2182
+ getPanelState: getPanelState,
1964
2183
  getParameterById: getParameterById,
1965
2184
  getParameterInfoParameter: getParameterInfoParameter,
1966
2185
  getParametersInUse: getParametersInUse,
@@ -1970,7 +2189,6 @@ var selectors = /*#__PURE__*/Object.freeze({
1970
2189
  getService: getService,
1971
2190
  getServiceFilterChips: getServiceFilterChips,
1972
2191
  getServiceFilterChipsById: getServiceFilterChipsById,
1973
- getServiceFilterChipsDictionary: getServiceFilterChipsDictionary,
1974
2192
  getServicePopupDetails: getServicePopupDetails,
1975
2193
  getServices: getServices,
1976
2194
  getShouldHideLocationMarkers: getShouldHideLocationMarkers,
@@ -2008,47 +2226,50 @@ var types = /*#__PURE__*/Object.freeze({
2008
2226
 
2009
2227
  var ParameterInfoButtonConnect = function ParameterInfoButtonConnect(_ref) {
2010
2228
  var parameter = _ref.parameter,
2011
- _ref$source = _ref.source,
2012
- source = _ref$source === void 0 ? 'app' : _ref$source;
2229
+ panelId = _ref.panelId;
2013
2230
  var dispatch = useDispatch();
2231
+ var currentSourcePanelId = useSelector(function (store) {
2232
+ return uiSelectors.getSourcePanelId(store, uiTypes.DialogTypes.TimeSeriesInfo);
2233
+ });
2014
2234
  var isOpenInStore = useSelector(function (store) {
2015
2235
  return uiSelectors.getisDialogOpen(store, uiTypes.DialogTypes.TimeSeriesInfo);
2016
2236
  });
2017
2237
  var currentParameterDisplayed = useSelector(function (store) {
2018
- return getParameterInfoParameter(store);
2238
+ return getParameterInfoParameter(store, panelId);
2019
2239
  });
2020
2240
  var isActive = parameter.id ? parameter.id === (currentParameterDisplayed == null ? void 0 : currentParameterDisplayed.id) : parameter.propertyName === (currentParameterDisplayed == null ? void 0 : currentParameterDisplayed.propertyName) && parameter.serviceId === (currentParameterDisplayed == null ? void 0 : currentParameterDisplayed.serviceId) && parameter.collectionId === (currentParameterDisplayed == null ? void 0 : currentParameterDisplayed.collectionId);
2021
2241
  var toggleInfoDialog = React.useCallback(function () {
2022
- dispatch(uiActions.setActiveMapIdForDialog({
2242
+ dispatch(uiActions.setToggleOpenDialog({
2023
2243
  type: uiTypes.DialogTypes.TimeSeriesInfo,
2024
- mapId: '',
2025
- setOpen: !isOpenInStore,
2026
- source: source
2244
+ setOpen: currentSourcePanelId !== panelId ? true : !isOpenInStore,
2245
+ sourcePanelId: panelId
2027
2246
  }));
2028
- }, [dispatch, isOpenInStore, source]);
2247
+ }, [dispatch, isOpenInStore, currentSourcePanelId, panelId]);
2029
2248
  var setCurrentParameterInfoDisplayed = React.useCallback(function () {
2030
2249
  dispatch(timeSeriesActions.setCurrentParameterInfoDisplayed({
2250
+ panelId: panelId,
2031
2251
  parameter: parameter.id || parameter
2032
2252
  }));
2033
2253
  dispatch(uiActions.orderDialog({
2034
2254
  type: uiTypes.DialogTypes.TimeSeriesInfo
2035
2255
  }));
2036
- }, [dispatch, parameter]);
2256
+ }, [dispatch, panelId, parameter]);
2257
+ var isOpenForPanel = isOpenInStore && currentSourcePanelId === panelId;
2037
2258
  var onClick = useCallback(function () {
2038
2259
  if (isActive) {
2039
2260
  toggleInfoDialog();
2040
2261
  }
2041
- if (!isActive && isOpenInStore) {
2262
+ if (!isActive && isOpenForPanel) {
2042
2263
  setCurrentParameterInfoDisplayed();
2043
2264
  }
2044
- if (!isActive && !isOpenInStore) {
2265
+ if (!isActive && !isOpenForPanel) {
2045
2266
  setCurrentParameterInfoDisplayed();
2046
2267
  toggleInfoDialog();
2047
2268
  }
2048
- }, [isActive, toggleInfoDialog, isOpenInStore, setCurrentParameterInfoDisplayed]);
2269
+ }, [isActive, toggleInfoDialog, isOpenForPanel, setCurrentParameterInfoDisplayed]);
2049
2270
  return jsx(ParameterInfoButton, {
2050
2271
  isActive: isActive,
2051
- isOpenInStore: isOpenInStore,
2272
+ isOpenInStore: isOpenForPanel,
2052
2273
  onClick: onClick
2053
2274
  });
2054
2275
  };
@@ -3417,7 +3638,8 @@ var ParameterNameSelect = function ParameterNameSelect(_ref) {
3417
3638
  };
3418
3639
 
3419
3640
  var TimeSeriesManagerRowAccordion = function TimeSeriesManagerRowAccordion(_ref) {
3420
- var plotIsEnabled = _ref.plotIsEnabled,
3641
+ var panelId = _ref.panelId,
3642
+ plotIsEnabled = _ref.plotIsEnabled,
3421
3643
  rowIsEnabled = _ref.rowIsEnabled,
3422
3644
  parameter = _ref.parameter,
3423
3645
  styles = _ref.styles,
@@ -3540,6 +3762,7 @@ var TimeSeriesManagerRowAccordion = function TimeSeriesManagerRowAccordion(_ref)
3540
3762
  },
3541
3763
  children: [jsx(Grid, {
3542
3764
  children: jsx(ParameterInfoButtonConnect, {
3765
+ panelId: panelId,
3543
3766
  parameter: parameter
3544
3767
  })
3545
3768
  }), jsx(Grid, {
@@ -3624,7 +3847,8 @@ var RowLayout = function RowLayout(_ref) {
3624
3847
 
3625
3848
  var ParameterList = function ParameterList(_ref) {
3626
3849
  var _plot$parameters, _plot$parameters2;
3627
- var plot = _ref.plot,
3850
+ var panelId = _ref.panelId,
3851
+ plot = _ref.plot,
3628
3852
  plotIsEnabled = _ref.plotIsEnabled,
3629
3853
  deleteParameter = _ref.deleteParameter,
3630
3854
  toggleParameter = _ref.toggleParameter,
@@ -3666,6 +3890,7 @@ var ParameterList = function ParameterList(_ref) {
3666
3890
  children: [jsx(Box, {
3667
3891
  className: "medium-timeseriesmanager",
3668
3892
  children: jsx(TimeSeriesManagerRowAccordion, {
3893
+ panelId: panelId,
3669
3894
  addParameter: addParameter,
3670
3895
  deleteParameter: deleteParameter,
3671
3896
  parameter: parameter,
@@ -3681,6 +3906,7 @@ var ParameterList = function ParameterList(_ref) {
3681
3906
  container: true,
3682
3907
  justifyContent: "space-between",
3683
3908
  children: [jsx(ParameterInfoButtonConnect, {
3909
+ panelId: panelId,
3684
3910
  parameter: parameter
3685
3911
  }), ' ', jsx(CustomIconButton, {
3686
3912
  "data-testid": "duplicateButton",
@@ -3792,36 +4018,36 @@ var TimeSeriesSelectButtonConnect = function TimeSeriesSelectButtonConnect(_ref)
3792
4018
  onClick = _ref.onClick,
3793
4019
  t = _ref.t,
3794
4020
  plotId = _ref.plotId,
3795
- selectPlotId = _ref.selectPlotId;
4021
+ selectPlotId = _ref.selectPlotId,
4022
+ panelId = _ref.panelId;
3796
4023
  var dispatch = useDispatch();
3797
- var currentActiveMapId = useSelector(function (store) {
3798
- return uiSelectors.getDialogMapId(store, uiTypes.DialogTypes.TimeSeriesSelect);
4024
+ var currentSourcePanelId = useSelector(function (store) {
4025
+ return uiSelectors.getSourcePanelId(store, uiTypes.DialogTypes.TimeSeriesSelect);
3799
4026
  });
3800
4027
  var isOpenInStore = useSelector(function (store) {
3801
4028
  return uiSelectors.getisDialogOpen(store, uiTypes.DialogTypes.TimeSeriesSelect);
3802
4029
  });
3803
- var mapId = useSelector(getMapId);
3804
4030
  var handleClick = function handleClick() {
3805
4031
  onClick();
3806
- var openDialogForDifferentMap = currentActiveMapId !== mapId;
3807
- var dialogIsNotOpenForCurrentMap = openDialogForDifferentMap || !isOpenInStore;
3808
- if (dialogIsNotOpenForCurrentMap) {
3809
- dispatch(uiActions.setActiveMapIdForDialog({
4032
+ var openDialogForDifferentPanel = currentSourcePanelId !== panelId;
4033
+ var dialogIsNotOpenForCurrentPanel = openDialogForDifferentPanel || !isOpenInStore;
4034
+ if (dialogIsNotOpenForCurrentPanel) {
4035
+ dispatch(uiActions.setToggleOpenDialog({
3810
4036
  type: uiTypes.DialogTypes.TimeSeriesSelect,
3811
- mapId: mapId,
3812
4037
  setOpen: true,
3813
- source: 'app'
4038
+ sourcePanelId: panelId
3814
4039
  }));
3815
4040
  }
3816
4041
  };
3817
4042
  var isSelectOpenForCurrentPlot = plotId === selectPlotId;
4043
+ var isOpenForPanel = isOpenInStore && currentSourcePanelId === panelId;
3818
4044
  return jsx(CustomTooltip, {
3819
4045
  title: t('timeseries-add-param-to-plot'),
3820
4046
  children: jsx(CustomToggleButton, {
3821
4047
  "data-testid": "timeSeriesSelectButton",
3822
4048
  disabled: !isEnabled,
3823
4049
  onClick: handleClick,
3824
- selected: !!isOpenInStore && isSelectOpenForCurrentPlot,
4050
+ selected: !!isOpenForPanel && isSelectOpenForCurrentPlot,
3825
4051
  sx: {
3826
4052
  marginLeft: '4px',
3827
4053
  height: '24px!important',
@@ -3838,7 +4064,8 @@ var TimeSeriesSelectButtonConnect = function TimeSeriesSelectButtonConnect(_ref)
3838
4064
  };
3839
4065
 
3840
4066
  var PlotRows = function PlotRows(_ref) {
3841
- var plot = _ref.plot,
4067
+ var panelId = _ref.panelId,
4068
+ plot = _ref.plot,
3842
4069
  rowIndex = _ref.rowIndex,
3843
4070
  showTooltip = _ref.showTooltip,
3844
4071
  deletePlot = _ref.deletePlot,
@@ -3903,6 +4130,7 @@ var PlotRows = function PlotRows(_ref) {
3903
4130
  onClick: function onClick() {
3904
4131
  return setSelectPlotId(plot.plotId);
3905
4132
  },
4133
+ panelId: panelId,
3906
4134
  plotId: plot.plotId,
3907
4135
  selectPlotId: selectPlotId,
3908
4136
  t: t
@@ -3982,6 +4210,7 @@ var PlotRows = function PlotRows(_ref) {
3982
4210
  timeout: "auto",
3983
4211
  unmountOnExit: true,
3984
4212
  children: jsx(ParameterList, {
4213
+ panelId: panelId,
3985
4214
  addParameter: addParameter,
3986
4215
  deleteParameter: deleteParameter,
3987
4216
  moveParameter: moveParameter,
@@ -4084,7 +4313,8 @@ var timeSeriesManagerStyle = {
4084
4313
  }
4085
4314
  };
4086
4315
  var TimeSeriesManager = function TimeSeriesManager(_ref) {
4087
- var onClose = _ref.onClose,
4316
+ var panelId = _ref.panelId,
4317
+ onClose = _ref.onClose,
4088
4318
  isOpen = _ref.isOpen,
4089
4319
  onMouseDown = _ref.onMouseDown,
4090
4320
  order = _ref.order,
@@ -4220,6 +4450,7 @@ var TimeSeriesManager = function TimeSeriesManager(_ref) {
4220
4450
  addParameter: addParameter,
4221
4451
  deleteParameter: deleteParameter,
4222
4452
  deletePlot: deletePlot,
4453
+ panelId: panelId,
4223
4454
  moveParameter: moveParameter,
4224
4455
  patchParameter: patchParameter,
4225
4456
  plot: plot,
@@ -4506,7 +4737,12 @@ var ParameterInfoList = function ParameterInfoList(_ref6) {
4506
4737
 
4507
4738
  var ParameterInfoDialogConnect = function ParameterInfoDialogConnect() {
4508
4739
  var _collection$dataQueri;
4509
- var currentParameterInfoDisplayed = useSelector(getParameterInfoParameter);
4740
+ var panelId = useSelector(function (store) {
4741
+ return uiSelectors.getSourcePanelId(store, uiTypes.DialogTypes.TimeSeriesInfo);
4742
+ });
4743
+ var currentParameterInfoDisplayed = useSelector(function (store) {
4744
+ return getParameterInfoParameter(store, panelId);
4745
+ });
4510
4746
  var relatedService = useSelector(function (store) {
4511
4747
  return getService(store, (currentParameterInfoDisplayed == null ? void 0 : currentParameterInfoDisplayed.serviceId) || '');
4512
4748
  }) || {
@@ -4788,30 +5024,34 @@ var Rows = function Rows(_ref2) {
4788
5024
  });
4789
5025
  };
4790
5026
 
4791
- var ServiceOptionsButtonConnect = function ServiceOptionsButtonConnect() {
5027
+ var ServiceOptionsButtonConnect = function ServiceOptionsButtonConnect(_ref) {
5028
+ var panelId = _ref.panelId;
4792
5029
  var dispatch = useDispatch();
4793
5030
  var services = useSelector(function (store) {
4794
5031
  return getServices(store);
4795
5032
  });
4796
5033
  var parametersInUse = useSelector(function (store) {
4797
- return getParametersInUse(store);
5034
+ return getParametersInUse(store, panelId);
4798
5035
  });
4799
5036
  var openNewServicePopup = React.useCallback(function () {
4800
5037
  dispatch(timeSeriesActions.setServicePopup({
5038
+ panelId: panelId,
4801
5039
  isOpen: true,
4802
5040
  variant: 'add'
4803
5041
  }));
4804
- }, [dispatch]);
5042
+ }, [dispatch, panelId]);
4805
5043
  var openServicePopup = React.useCallback(function (variant, serviceId, url) {
4806
5044
  dispatch(timeSeriesActions.setServicePopup({
5045
+ panelId: panelId,
4807
5046
  isOpen: true,
4808
5047
  variant: variant,
4809
5048
  serviceId: serviceId,
4810
5049
  url: url
4811
5050
  }));
4812
- }, [dispatch]);
5051
+ }, [dispatch, panelId]);
4813
5052
  var removeService = React.useCallback(function (id, message) {
4814
5053
  dispatch(timeSeriesActions.removeService({
5054
+ panelId: panelId,
4815
5055
  id: id
4816
5056
  }));
4817
5057
  if (message) {
@@ -4820,7 +5060,7 @@ var ServiceOptionsButtonConnect = function ServiceOptionsButtonConnect() {
4820
5060
  message: message
4821
5061
  }));
4822
5062
  }
4823
- }, [dispatch]);
5063
+ }, [dispatch, panelId]);
4824
5064
  return jsx(ToggleMenu, {
4825
5065
  menuPosition: "bottom",
4826
5066
  children: jsx(ServiceOptionsDialog, {
@@ -5273,6 +5513,7 @@ var ServicePopup = function ServicePopup(props) {
5273
5513
  // when the dialog is open
5274
5514
  var ServicePopupDialogConnect = function ServicePopupDialogConnect(_ref) {
5275
5515
  var isOpen = _ref.isOpen,
5516
+ panelId = _ref.panelId,
5276
5517
  _ref$serviceId = _ref.serviceId,
5277
5518
  serviceId = _ref$serviceId === void 0 ? '' : _ref$serviceId,
5278
5519
  variant = _ref.variant,
@@ -5287,13 +5528,15 @@ var ServicePopupDialogConnect = function ServicePopupDialogConnect(_ref) {
5287
5528
  return getService(store, serviceId);
5288
5529
  });
5289
5530
  var popupState = useSelector(function (store) {
5290
- return getServicePopupDetails(store);
5531
+ return getServicePopupDetails(store, panelId);
5291
5532
  });
5292
5533
  var serviceSetService = React.useCallback(function (payload) {
5293
- dispatch(timeSeriesActions.upsertService(Object.assign({}, payload, {
5534
+ dispatch(timeSeriesActions.upsertService(Object.assign({
5535
+ panelId: panelId
5536
+ }, payload, {
5294
5537
  isUpdate: popupState.variant === 'edit'
5295
5538
  })));
5296
- }, [dispatch, popupState]);
5539
+ }, [dispatch, panelId, popupState]);
5297
5540
  var showSnackbar = React.useCallback(function (message) {
5298
5541
  dispatch(snackbarActions.openSnackbar({
5299
5542
  type: snackbarTypes.SnackbarMessageType.VERBATIM_MESSAGE,
@@ -5313,23 +5556,27 @@ var ServicePopupDialogConnect = function ServicePopupDialogConnect(_ref) {
5313
5556
  });
5314
5557
  };
5315
5558
 
5316
- var ServicePopupConnect = function ServicePopupConnect() {
5559
+ var ServicePopupConnect = function ServicePopupConnect(_ref) {
5560
+ var panelId = _ref.panelId;
5317
5561
  var dispatch = useDispatch();
5318
5562
  var _useSelector = useSelector(function (store) {
5319
- return getServicePopupDetails(store);
5563
+ return getServicePopupDetails(store, panelId);
5320
5564
  }),
5321
5565
  isOpen = _useSelector.isOpen,
5322
5566
  url = _useSelector.url,
5323
5567
  serviceId = _useSelector.serviceId,
5324
5568
  variant = _useSelector.variant;
5325
5569
  var setServicePopupClosed = React.useCallback(function () {
5326
- dispatch(timeSeriesActions.closeServicePopup());
5327
- }, [dispatch]);
5570
+ dispatch(timeSeriesActions.closeServicePopup({
5571
+ panelId: panelId
5572
+ }));
5573
+ }, [dispatch, panelId]);
5328
5574
  if (!isOpen) {
5329
5575
  return null;
5330
5576
  }
5331
5577
  return jsx(ServicePopupDialogConnect, {
5332
5578
  isOpen: isOpen,
5579
+ panelId: panelId,
5333
5580
  serviceId: serviceId,
5334
5581
  setServicePopupClosed: setServicePopupClosed,
5335
5582
  url: url,
@@ -5337,15 +5584,17 @@ var ServicePopupConnect = function ServicePopupConnect() {
5337
5584
  });
5338
5585
  };
5339
5586
 
5340
- var SearchFieldConnect = function SearchFieldConnect() {
5587
+ var SearchFieldConnect = function SearchFieldConnect(_ref) {
5588
+ var panelId = _ref.panelId;
5341
5589
  var dispatch = useDispatch();
5342
5590
  var _useTimeseriesTransla = useTimeseriesTranslation(),
5343
5591
  t = _useTimeseriesTransla.t;
5344
5592
  var searchFilter = useSelector(function (state) {
5345
- return getSearchFilter(state);
5593
+ return getSearchFilter(state, panelId);
5346
5594
  });
5347
5595
  var toggleServicePopup = function toggleServicePopup(url) {
5348
5596
  dispatch(timeSeriesActions.setServicePopup({
5597
+ panelId: panelId,
5349
5598
  isOpen: true,
5350
5599
  url: url,
5351
5600
  variant: 'save'
@@ -5353,7 +5602,8 @@ var SearchFieldConnect = function SearchFieldConnect() {
5353
5602
  };
5354
5603
  var setSearchFilter = function setSearchFilter(filterText) {
5355
5604
  dispatch(timeSeriesActions.setSearchFilter({
5356
- filterText: filterText
5605
+ filterText: filterText,
5606
+ panelId: panelId
5357
5607
  }));
5358
5608
  };
5359
5609
  return jsx(SearchField, {
@@ -5424,13 +5674,212 @@ var filterCollectionsParametersFromService = function filterCollectionsParameter
5424
5674
  }, []);
5425
5675
  };
5426
5676
 
5427
- var DEFAULT_DIALOG_HEIGHT = 500;
5428
- var DEFAULT_PADDING_TOP = 6;
5429
- var DEFAULT_RESULTS_HEIGHT = 22;
5430
- var DEFAULT_COLLECTION_ROW_HEIGHT = 48; // listItem height + 4px marginTop
5431
- var DEFAULT_PARAMETER_ROW_HEIGHT = 34; // listItem height
5432
- var DEFAULT_PARAMTER_LIST_PADDING_BOTTOM = 0;
5433
- var DEFAULT_PARAMTER_LIST_BORDER_BOTTOM = 1;
5677
+ var RowComponent$1 = function RowComponent(_ref) {
5678
+ var index = _ref.index,
5679
+ style = _ref.style,
5680
+ filteredCollectionList = _ref.filteredCollectionList,
5681
+ collectionListItemDetails = _ref.collectionListItemDetails,
5682
+ setCollectionListItemDetails = _ref.setCollectionListItemDetails,
5683
+ handleAddOrRemoveClick = _ref.handleAddOrRemoveClick,
5684
+ searchFilter = _ref.searchFilter,
5685
+ panelId = _ref.panelId,
5686
+ selectPlot = _ref.selectPlot,
5687
+ t = _ref.t;
5688
+ var collectionListItem = filteredCollectionList[index];
5689
+ var collectionId = collectionListItem.collectionId;
5690
+ return jsxs(Box, {
5691
+ style: style,
5692
+ children: [jsx(ListItem, {
5693
+ sx: {
5694
+ backgroundColor: 'geowebColors.cards.cardContainer',
5695
+ height: '44px',
5696
+ marginTop: 0.5,
5697
+ borderWidth: '1px',
5698
+ borderStyle: 'solid',
5699
+ borderRadius: '3px',
5700
+ padding: 0,
5701
+ zIndex: 10,
5702
+ overflow: 'hidden',
5703
+ borderColor: 'geowebColors.cards.cardContainerBorder',
5704
+ '.MuiListItemText-primary': {
5705
+ fontSize: '12px',
5706
+ fontWeight: 500,
5707
+ textOverflow: 'ellipsis',
5708
+ overflow: 'hidden'
5709
+ }
5710
+ },
5711
+ children: jsxs(ListItemButton, {
5712
+ onClick: function onClick() {
5713
+ var _Object$assign;
5714
+ var currentState = collectionListItemDetails[collectionId];
5715
+ setCollectionListItemDetails(Object.assign({}, collectionListItemDetails, (_Object$assign = {}, _Object$assign[collectionId] = !currentState, _Object$assign)));
5716
+ },
5717
+ sx: {
5718
+ height: '100%',
5719
+ paddingLeft: '24px',
5720
+ paddingRight: '8px'
5721
+ },
5722
+ children: [jsxs(Grid, {
5723
+ container: true,
5724
+ size: "grow",
5725
+ sx: {
5726
+ justifyContent: 'space-between',
5727
+ alignItems: 'center'
5728
+ },
5729
+ children: [jsxs(Grid, {
5730
+ size: "grow",
5731
+ children: [jsx(Box, {
5732
+ sx: fontStyling(),
5733
+ children: jsx(SearchHighlight, {
5734
+ search: searchFilter,
5735
+ text: collectionListItem.collectionTitle || collectionListItem.collectionId
5736
+ })
5737
+ }), jsx(Box, {
5738
+ sx: fontStyling(false),
5739
+ children: jsx(SearchHighlight, {
5740
+ search: searchFilter,
5741
+ text: collectionListItem.serviceName
5742
+ })
5743
+ })]
5744
+ }), jsx(Grid, {
5745
+ children: jsx(ListItemText, {
5746
+ primary: collectionListItem.parameters.length + " " + t('timeseries-results'),
5747
+ sx: {
5748
+ paddingLeft: 1,
5749
+ paddingRight: 5,
5750
+ textAlign: 'right'
5751
+ }
5752
+ })
5753
+ })]
5754
+ }), collectionListItemDetails[collectionId] ? jsx(ChevronUp, {}) : jsx(ChevronDown, {})]
5755
+ })
5756
+ }), jsx(Collapse, {
5757
+ "in": collectionListItemDetails[collectionId],
5758
+ unmountOnExit: true,
5759
+ children: jsxs(List, {
5760
+ sx: {
5761
+ paddingBottom: DEFAULT_PARAMTER_LIST_PADDING_BOTTOM + "px",
5762
+ paddingTop: 0,
5763
+ backgroundColor: 'geowebColors.cards.cardContainer',
5764
+ borderWidth: DEFAULT_PARAMTER_LIST_BORDER_BOTTOM + "px",
5765
+ borderStyle: 'none solid solid solid',
5766
+ borderColor: 'geowebColors.cards.cardContainerBorder',
5767
+ borderBottomLeftRadius: '3px',
5768
+ borderBottomRightRadius: '3px',
5769
+ boxShadow: 1,
5770
+ top: -5
5771
+ },
5772
+ children: [(collectionListItem == null ? void 0 : collectionListItem.parameters.length) < 1 && jsx(ListItem, {
5773
+ role: "listitem",
5774
+ sx: {
5775
+ height: DEFAULT_PARAMETER_ROW_HEIGHT + 4 + "px",
5776
+ minHeight: '36px',
5777
+ paddingLeft: '40px',
5778
+ paddingRight: '4px',
5779
+ paddingTop: '13px',
5780
+ ' .MuiListItemText-primary': {
5781
+ fontSize: '12px',
5782
+ fontWeight: 500,
5783
+ whiteSpace: 'nowrap',
5784
+ textOverflow: 'ellipsis',
5785
+ overflow: 'hidden'
5786
+ }
5787
+ },
5788
+ children: jsx(ListItemText, {
5789
+ secondary: t('timeseries-no-params'),
5790
+ sx: {
5791
+ paddingLeft: 1,
5792
+ paddingRight: 1
5793
+ }
5794
+ })
5795
+ }), collectionListItem.parameters.map(function (parameter) {
5796
+ var plotParameter = selectPlot.parameters.find(function (plotParameter) {
5797
+ return collectionListItem.serviceId === plotParameter.serviceId && collectionListItem.collectionId === plotParameter.collectionId && parameter.propertyName === plotParameter.propertyName;
5798
+ });
5799
+ var plotHasParameter = Boolean(plotParameter);
5800
+ var paramDisplayName = parameter.propertyLabel ? parameter.propertyLabel + " (" + parameter.propertyName + ")" : parameter.propertyName;
5801
+ return jsx(ListItem, {
5802
+ "aria-label": paramDisplayName,
5803
+ role: "listitem",
5804
+ sx: {
5805
+ paddingLeft: '40px',
5806
+ paddingRight: '4px',
5807
+ ':not(:first-of-type)': {
5808
+ borderTopColor: 'geowebColors.cards.cardContainerBorder',
5809
+ borderTopStyle: 'solid',
5810
+ borderTopWidth: '1px',
5811
+ height: DEFAULT_PARAMETER_ROW_HEIGHT + "px",
5812
+ minHeight: '32px'
5813
+ },
5814
+ ':first-of-type': {
5815
+ height: DEFAULT_PARAMETER_ROW_HEIGHT + 4 + "px",
5816
+ minHeight: '36px',
5817
+ paddingTop: '13px'
5818
+ },
5819
+ ':hover': {
5820
+ backgroundColor: 'geowebColors.cards.cardContainerMouseOver'
5821
+ }
5822
+ },
5823
+ children: jsxs(Grid, {
5824
+ container: true,
5825
+ size: "grow",
5826
+ sx: {
5827
+ justifyContent: 'space-between',
5828
+ alignItems: 'center'
5829
+ },
5830
+ children: [jsx(Grid, {
5831
+ size: "grow",
5832
+ children: jsx(Box, {
5833
+ sx: fontStyling(),
5834
+ children: jsx(SearchHighlight, {
5835
+ search: searchFilter,
5836
+ text: paramDisplayName
5837
+ })
5838
+ })
5839
+ }), jsx(Grid, {
5840
+ children: jsxs(Box, {
5841
+ sx: {
5842
+ marginRight: '8px'
5843
+ },
5844
+ children: [jsx(ParameterInfoButtonConnect, {
5845
+ panelId: panelId,
5846
+ parameter: plotParameter != null ? plotParameter : Object.assign({}, parameter, {
5847
+ plotId: selectPlot.plotId
5848
+ })
5849
+ }), jsx(CustomToggleButton, {
5850
+ fullWidth: true,
5851
+ onClick: function onClick() {
5852
+ var parameterWithPlotId = Object.assign({}, parameter, {
5853
+ plotId: selectPlot.plotId,
5854
+ id: plotParameter == null ? void 0 : plotParameter.id
5855
+ });
5856
+ handleAddOrRemoveClick(parameterWithPlotId, plotHasParameter);
5857
+ },
5858
+ selected: plotHasParameter,
5859
+ sx: {
5860
+ width: '60px',
5861
+ height: '24px !important',
5862
+ marginLeft: '4px'
5863
+ },
5864
+ variant: "tool",
5865
+ children: plotHasParameter ? 'Remove' : 'Add'
5866
+ })]
5867
+ })
5868
+ })]
5869
+ })
5870
+ }, parameter.propertyName);
5871
+ })]
5872
+ })
5873
+ })]
5874
+ });
5875
+ };
5876
+ var DEFAULT_DIALOG_HEIGHT = 500;
5877
+ var DEFAULT_PADDING_TOP = 6;
5878
+ var DEFAULT_RESULTS_HEIGHT = 22;
5879
+ var DEFAULT_COLLECTION_ROW_HEIGHT = 48; // listItem height + 4px marginTop
5880
+ var DEFAULT_PARAMETER_ROW_HEIGHT = 34; // listItem height
5881
+ var DEFAULT_PARAMTER_LIST_PADDING_BOTTOM = 0;
5882
+ var DEFAULT_PARAMTER_LIST_BORDER_BOTTOM = 1;
5434
5883
  var fontStyling = function fontStyling(primary) {
5435
5884
  if (primary === void 0) {
5436
5885
  primary = true;
@@ -5445,35 +5894,34 @@ var fontStyling = function fontStyling(primary) {
5445
5894
  overflow: 'hidden'
5446
5895
  };
5447
5896
  };
5448
- var TimeSeriesSelectList = function TimeSeriesSelectList(_ref) {
5449
- var selectPlot = _ref.selectPlot,
5450
- collectionListItemDetails = _ref.collectionListItemDetails,
5451
- collectionList = _ref.collectionList,
5452
- handleAddOrRemoveClick = _ref.handleAddOrRemoveClick,
5453
- setCollectionListItemDetails = _ref.setCollectionListItemDetails,
5454
- searchFilter = _ref.searchFilter,
5455
- filterChipsServices = _ref.filterChipsServices,
5456
- allFilterChipsEnabled = _ref.allFilterChipsEnabled;
5457
- var listRef = React.useRef(null);
5897
+ var TimeSeriesSelectList = function TimeSeriesSelectList(_ref2) {
5898
+ var selectPlot = _ref2.selectPlot,
5899
+ panelId = _ref2.panelId,
5900
+ collectionListItemDetails = _ref2.collectionListItemDetails,
5901
+ collectionList = _ref2.collectionList,
5902
+ handleAddOrRemoveClick = _ref2.handleAddOrRemoveClick,
5903
+ setCollectionListItemDetails = _ref2.setCollectionListItemDetails,
5904
+ searchFilter = _ref2.searchFilter,
5905
+ filterChipsServices = _ref2.filterChipsServices,
5906
+ allFilterChipsEnabled = _ref2.allFilterChipsEnabled;
5458
5907
  var _React$useState = React.useState([]),
5459
5908
  filteredCollectionList = _React$useState[0],
5460
5909
  setFilteredCollectionList = _React$useState[1];
5461
5910
  var _useTimeseriesTransla = useTimeseriesTranslation(),
5462
5911
  t = _useTimeseriesTransla.t;
5463
5912
  React.useEffect(function () {
5464
- var _listRef$current;
5465
5913
  if (!collectionList) {
5466
5914
  return;
5467
5915
  }
5468
5916
  var filterResults = filterCollectionsParametersFromService(collectionList, searchFilter, filterChipsServices, allFilterChipsEnabled);
5469
5917
  setFilteredCollectionList(filterResults);
5470
- // Needed to recalculate the height of the list elements now that some collections/parameters have been filtered out
5471
- listRef == null || (_listRef$current = listRef.current) == null || _listRef$current.resetAfterIndex(0);
5472
5918
  }, [searchFilter, collectionList, filterChipsServices, allFilterChipsEnabled]);
5473
5919
  return jsxs(Box, {
5474
5920
  "data-testid": "timeseriesSelectList",
5475
5921
  sx: {
5476
- flex: 1
5922
+ flex: 1,
5923
+ minHeight: 0,
5924
+ overflow: 'hidden'
5477
5925
  },
5478
5926
  children: [jsxs(Box, {
5479
5927
  sx: {
@@ -5481,219 +5929,32 @@ var TimeSeriesSelectList = function TimeSeriesSelectList(_ref) {
5481
5929
  fontSize: '12px'
5482
5930
  },
5483
5931
  children: [filteredCollectionList.length, " ", t('timeseries-results')]
5484
- }), jsx(AutoSizer, {
5485
- children: function children(_ref2) {
5486
- var _ref2$height = _ref2.height,
5487
- height = _ref2$height === void 0 ? 0 : _ref2$height,
5488
- _ref2$width = _ref2.width,
5489
- width = _ref2$width === void 0 ? 0 : _ref2$width;
5490
- return jsx(VariableSizeList, {
5491
- height: height - DEFAULT_RESULTS_HEIGHT - DEFAULT_PADDING_TOP,
5492
- itemCount: filteredCollectionList.length,
5493
- itemSize: function itemSize(index) {
5494
- var collectionId = filteredCollectionList[index].collectionId;
5495
- if (!collectionListItemDetails[collectionId]) {
5496
- return DEFAULT_COLLECTION_ROW_HEIGHT;
5497
- }
5498
- if (filteredCollectionList[index].parameters.length < 1) {
5499
- return DEFAULT_PARAMETER_ROW_HEIGHT + DEFAULT_COLLECTION_ROW_HEIGHT + DEFAULT_PARAMTER_LIST_PADDING_BOTTOM + DEFAULT_PARAMTER_LIST_BORDER_BOTTOM;
5500
- }
5501
- return filteredCollectionList[index].parameters.length * DEFAULT_PARAMETER_ROW_HEIGHT + DEFAULT_COLLECTION_ROW_HEIGHT + DEFAULT_PARAMTER_LIST_PADDING_BOTTOM + DEFAULT_PARAMTER_LIST_BORDER_BOTTOM;
5502
- },
5503
- ref: listRef,
5504
- width: width,
5505
- children: function children(_ref3) {
5506
- var index = _ref3.index,
5507
- style = _ref3.style;
5508
- var collectionListItem = filteredCollectionList[index];
5509
- var collectionId = collectionListItem.collectionId;
5510
- return jsxs(Box, {
5511
- style: style,
5512
- children: [jsx(ListItem, {
5513
- sx: {
5514
- backgroundColor: 'geowebColors.cards.cardContainer',
5515
- height: '44px',
5516
- marginTop: 0.5,
5517
- borderWidth: '1px',
5518
- borderStyle: 'solid',
5519
- borderRadius: '3px',
5520
- padding: 0,
5521
- zIndex: 10,
5522
- overflow: 'hidden',
5523
- borderColor: 'geowebColors.cards.cardContainerBorder',
5524
- '.MuiListItemText-primary': {
5525
- fontSize: '12px',
5526
- fontWeight: 500,
5527
- textOverflow: 'ellipsis',
5528
- overflow: 'hidden'
5529
- }
5530
- },
5531
- children: jsxs(ListItemButton, {
5532
- onClick: function onClick() {
5533
- var _Object$assign, _listRef$current2;
5534
- var currentState = collectionListItemDetails[collectionId];
5535
- setCollectionListItemDetails(Object.assign({}, collectionListItemDetails, (_Object$assign = {}, _Object$assign[collectionId] = !currentState, _Object$assign)));
5536
- listRef == null || (_listRef$current2 = listRef.current) == null || _listRef$current2.resetAfterIndex(index);
5537
- },
5538
- sx: {
5539
- height: '100%',
5540
- paddingLeft: '24px',
5541
- paddingRight: '8px'
5542
- },
5543
- children: [jsxs(Grid, {
5544
- container: true,
5545
- size: "grow",
5546
- sx: {
5547
- justifyContent: 'space-between',
5548
- alignItems: 'center'
5549
- },
5550
- children: [jsxs(Grid, {
5551
- size: "grow",
5552
- children: [jsx(Box, {
5553
- sx: fontStyling(),
5554
- children: jsx(SearchHighlight, {
5555
- search: searchFilter,
5556
- text: collectionListItem.collectionTitle || collectionListItem.collectionId
5557
- })
5558
- }), jsx(Box, {
5559
- sx: fontStyling(false),
5560
- children: jsx(SearchHighlight, {
5561
- search: searchFilter,
5562
- text: collectionListItem.serviceName
5563
- })
5564
- })]
5565
- }), jsx(Grid, {
5566
- children: jsx(ListItemText, {
5567
- primary: collectionListItem.parameters.length + " " + t('timeseries-results'),
5568
- sx: {
5569
- paddingLeft: 1,
5570
- paddingRight: 5,
5571
- textAlign: 'right'
5572
- }
5573
- })
5574
- })]
5575
- }), collectionListItemDetails[collectionId] ? jsx(ChevronUp, {}) : jsx(ChevronDown, {})]
5576
- })
5577
- }), jsx(Collapse, {
5578
- "in": collectionListItemDetails[collectionId],
5579
- unmountOnExit: true,
5580
- children: jsxs(List, {
5581
- sx: {
5582
- paddingBottom: DEFAULT_PARAMTER_LIST_PADDING_BOTTOM + "px",
5583
- paddingTop: 0,
5584
- backgroundColor: 'geowebColors.cards.cardContainer',
5585
- borderWidth: DEFAULT_PARAMTER_LIST_BORDER_BOTTOM + "px",
5586
- borderStyle: 'none solid solid solid',
5587
- borderColor: 'geowebColors.cards.cardContainerBorder',
5588
- borderBottomLeftRadius: '3px',
5589
- borderBottomRightRadius: '3px',
5590
- boxShadow: 1,
5591
- top: -5
5592
- },
5593
- children: [(collectionListItem == null ? void 0 : collectionListItem.parameters.length) < 1 && jsx(ListItem, {
5594
- role: "listitem",
5595
- sx: {
5596
- height: DEFAULT_PARAMETER_ROW_HEIGHT + 4 + "px",
5597
- minHeight: '36px',
5598
- paddingLeft: '40px',
5599
- paddingRight: '4px',
5600
- paddingTop: '13px',
5601
- ' .MuiListItemText-primary': {
5602
- fontSize: '12px',
5603
- fontWeight: 500,
5604
- whiteSpace: 'nowrap',
5605
- textOverflow: 'ellipsis',
5606
- overflow: 'hidden'
5607
- }
5608
- },
5609
- children: jsx(ListItemText, {
5610
- secondary: t('timeseries-no-params'),
5611
- sx: {
5612
- paddingLeft: 1,
5613
- paddingRight: 1
5614
- }
5615
- })
5616
- }), collectionListItem.parameters.map(function (parameter) {
5617
- var plotParameter = selectPlot.parameters.find(function (plotParameter) {
5618
- return collectionListItem.serviceId === plotParameter.serviceId && collectionListItem.collectionId === plotParameter.collectionId && parameter.propertyName === plotParameter.propertyName;
5619
- });
5620
- var plotHasParameter = Boolean(plotParameter);
5621
- var paramDisplayName = parameter.propertyLabel ? parameter.propertyLabel + " (" + parameter.propertyName + ")" : parameter.propertyName;
5622
- return jsx(ListItem, {
5623
- "aria-label": paramDisplayName,
5624
- role: "listitem",
5625
- sx: {
5626
- paddingLeft: '40px',
5627
- paddingRight: '4px',
5628
- ':not(:first-of-type)': {
5629
- borderTopColor: 'geowebColors.cards.cardContainerBorder',
5630
- borderTopStyle: 'solid',
5631
- borderTopWidth: '1px',
5632
- height: DEFAULT_PARAMETER_ROW_HEIGHT + "px",
5633
- minHeight: '32px'
5634
- },
5635
- ':first-of-type': {
5636
- height: DEFAULT_PARAMETER_ROW_HEIGHT + 4 + "px",
5637
- minHeight: '36px',
5638
- paddingTop: '13px'
5639
- },
5640
- ':hover': {
5641
- backgroundColor: 'geowebColors.cards.cardContainerMouseOver'
5642
- }
5643
- },
5644
- children: jsxs(Grid, {
5645
- container: true,
5646
- size: "grow",
5647
- sx: {
5648
- justifyContent: 'space-between',
5649
- alignItems: 'center'
5650
- },
5651
- children: [jsx(Grid, {
5652
- size: "grow",
5653
- children: jsx(Box, {
5654
- sx: fontStyling(),
5655
- children: jsx(SearchHighlight, {
5656
- search: searchFilter,
5657
- text: paramDisplayName
5658
- })
5659
- })
5660
- }), jsx(Grid, {
5661
- children: jsxs(Box, {
5662
- sx: {
5663
- marginRight: '8px'
5664
- },
5665
- children: [jsx(ParameterInfoButtonConnect, {
5666
- parameter: plotParameter != null ? plotParameter : Object.assign({}, parameter, {
5667
- plotId: selectPlot.plotId
5668
- })
5669
- }), jsx(CustomToggleButton, {
5670
- fullWidth: true,
5671
- onClick: function onClick() {
5672
- var parameterWithPlotId = Object.assign({}, parameter, {
5673
- plotId: selectPlot.plotId,
5674
- id: plotParameter == null ? void 0 : plotParameter.id
5675
- });
5676
- handleAddOrRemoveClick(parameterWithPlotId, plotHasParameter);
5677
- },
5678
- selected: plotHasParameter,
5679
- sx: {
5680
- width: '60px',
5681
- height: '24px !important',
5682
- marginLeft: '4px'
5683
- },
5684
- variant: "tool",
5685
- children: plotHasParameter ? 'Remove' : 'Add'
5686
- })]
5687
- })
5688
- })]
5689
- })
5690
- }, parameter.propertyName);
5691
- })]
5692
- })
5693
- })]
5694
- });
5695
- }
5696
- });
5932
+ }), jsx(List$1, {
5933
+ rowComponent: RowComponent$1,
5934
+ rowCount: filteredCollectionList.length,
5935
+ rowHeight: function rowHeight(index) {
5936
+ var collectionId = filteredCollectionList[index].collectionId;
5937
+ if (!collectionListItemDetails[collectionId]) {
5938
+ return DEFAULT_COLLECTION_ROW_HEIGHT;
5939
+ }
5940
+ if (filteredCollectionList[index].parameters.length < 1) {
5941
+ return DEFAULT_PARAMETER_ROW_HEIGHT + DEFAULT_COLLECTION_ROW_HEIGHT + DEFAULT_PARAMTER_LIST_PADDING_BOTTOM + DEFAULT_PARAMTER_LIST_BORDER_BOTTOM;
5942
+ }
5943
+ return filteredCollectionList[index].parameters.length * DEFAULT_PARAMETER_ROW_HEIGHT + DEFAULT_COLLECTION_ROW_HEIGHT + DEFAULT_PARAMTER_LIST_PADDING_BOTTOM + DEFAULT_PARAMTER_LIST_BORDER_BOTTOM;
5944
+ },
5945
+ rowProps: {
5946
+ collectionListItemDetails: collectionListItemDetails,
5947
+ setCollectionListItemDetails: setCollectionListItemDetails,
5948
+ filteredCollectionList: filteredCollectionList,
5949
+ handleAddOrRemoveClick: handleAddOrRemoveClick,
5950
+ searchFilter: searchFilter,
5951
+ panelId: panelId,
5952
+ selectPlot: selectPlot,
5953
+ t: t
5954
+ },
5955
+ style: {
5956
+ width: '100%',
5957
+ height: "calc(100% - " + (DEFAULT_RESULTS_HEIGHT + DEFAULT_PADDING_TOP) + "px)"
5697
5958
  }
5698
5959
  })]
5699
5960
  });
@@ -5703,20 +5964,21 @@ var TimeSeriesSelectListConnect = /*#__PURE__*/memo(function (_ref) {
5703
5964
  var selectPlot = _ref.selectPlot,
5704
5965
  handleAddOrRemoveClick = _ref.handleAddOrRemoveClick,
5705
5966
  services = _ref.services,
5706
- isOpen = _ref.isOpen;
5967
+ isOpen = _ref.isOpen,
5968
+ panelId = _ref.panelId;
5707
5969
  var _useGetServiceCollect = useGetServiceCollectionDetails(services, isOpen),
5708
5970
  collectionList = _useGetServiceCollect.data;
5709
5971
  var _useState = useState({}),
5710
5972
  collectionListItemDetails = _useState[0],
5711
5973
  setCollectionListItemDetails = _useState[1];
5712
5974
  var filterChipsServices = useSelector(function (store) {
5713
- return getServiceFilterChips(store);
5975
+ return getServiceFilterChips(store, panelId);
5714
5976
  });
5715
5977
  var allFilterChipsEnabled = useSelector(function (store) {
5716
- return getAllFilterChipsEnabled(store);
5978
+ return getAllFilterChipsEnabled(store, panelId);
5717
5979
  });
5718
5980
  var searchFilter = useSelector(function (state) {
5719
- return getSearchFilter(state);
5981
+ return getSearchFilter(state, panelId);
5720
5982
  });
5721
5983
  return jsx(TimeSeriesSelectList, {
5722
5984
  allFilterChipsEnabled: allFilterChipsEnabled,
@@ -5724,6 +5986,7 @@ var TimeSeriesSelectListConnect = /*#__PURE__*/memo(function (_ref) {
5724
5986
  collectionListItemDetails: collectionListItemDetails,
5725
5987
  filterChipsServices: filterChipsServices,
5726
5988
  handleAddOrRemoveClick: handleAddOrRemoveClick,
5989
+ panelId: panelId,
5727
5990
  searchFilter: searchFilter,
5728
5991
  selectPlot: selectPlot,
5729
5992
  setCollectionListItemDetails: setCollectionListItemDetails
@@ -5770,24 +6033,28 @@ var ServiceChip = function ServiceChip(_ref) {
5770
6033
 
5771
6034
  var ServiceChipConnect = function ServiceChipConnect(_ref) {
5772
6035
  var service = _ref.service,
5773
- isAllSelected = _ref.isAllSelected;
6036
+ isAllSelected = _ref.isAllSelected,
6037
+ panelId = _ref.panelId;
5774
6038
  var dispatch = useDispatch();
5775
6039
  var serviceId = service.serviceId;
5776
6040
  var toggleChip = function toggleChip() {
5777
6041
  if (service.enabled) {
5778
6042
  if (isAllSelected) {
5779
6043
  dispatch(timeSeriesActions.setOnlyThisServiceFilterChipSelected({
5780
- serviceId: serviceId
6044
+ serviceId: serviceId,
6045
+ panelId: panelId
5781
6046
  }));
5782
6047
  return;
5783
6048
  }
5784
6049
  dispatch(timeSeriesActions.setServiceFilterChipUnselected({
5785
- serviceId: serviceId
6050
+ serviceId: serviceId,
6051
+ panelId: panelId
5786
6052
  }));
5787
6053
  return;
5788
6054
  }
5789
6055
  dispatch(timeSeriesActions.setServiceFilterChipSelected({
5790
- serviceId: serviceId
6056
+ serviceId: serviceId,
6057
+ panelId: panelId
5791
6058
  }));
5792
6059
  };
5793
6060
  return jsx(ServiceChip, {
@@ -5798,13 +6065,16 @@ var ServiceChipConnect = function ServiceChipConnect(_ref) {
5798
6065
  });
5799
6066
  };
5800
6067
  var AllChipConnect = function AllChipConnect(_ref2) {
5801
- var isAllSelected = _ref2.isAllSelected;
6068
+ var isAllSelected = _ref2.isAllSelected,
6069
+ panelId = _ref2.panelId;
5802
6070
  var dispatch = useDispatch();
5803
6071
  return jsx(ServiceChip, {
5804
6072
  isSelected: isAllSelected,
5805
6073
  toggleChip: function toggleChip() {
5806
6074
  if (!isAllSelected) {
5807
- dispatch(timeSeriesActions.setAllServiceFilterChipSelected());
6075
+ dispatch(timeSeriesActions.setAllServiceFilterChipSelected({
6076
+ panelId: panelId
6077
+ }));
5808
6078
  }
5809
6079
  }
5810
6080
  });
@@ -5812,7 +6082,8 @@ var AllChipConnect = function AllChipConnect(_ref2) {
5812
6082
 
5813
6083
  var TimeSeriesServiceList = function TimeSeriesServiceList(_ref) {
5814
6084
  var filterChipsServicesById = _ref.filterChipsServicesById,
5815
- isAllSelected = _ref.isAllSelected;
6085
+ isAllSelected = _ref.isAllSelected,
6086
+ panelId = _ref.panelId;
5816
6087
  var activeServices = Object.values(filterChipsServicesById);
5817
6088
  return jsx(Box, {
5818
6089
  "data-testid": "serviceList",
@@ -5831,10 +6102,12 @@ var TimeSeriesServiceList = function TimeSeriesServiceList(_ref) {
5831
6102
  fontSize: '0.875rem'
5832
6103
  },
5833
6104
  children: [activeServices.length ? jsx(AllChipConnect, {
5834
- isAllSelected: isAllSelected
6105
+ isAllSelected: isAllSelected,
6106
+ panelId: panelId
5835
6107
  }) : null, activeServices.map(function (service) {
5836
6108
  return jsx(ServiceChipConnect, {
5837
6109
  isAllSelected: isAllSelected,
6110
+ panelId: panelId,
5838
6111
  service: service
5839
6112
  }, service.serviceUrl);
5840
6113
  })]
@@ -5854,21 +6127,24 @@ var sortByService = function sortByService(serviceObj) {
5854
6127
  return Object.assign({}, result, (_Object$assign = {}, _Object$assign[key] = value, _Object$assign));
5855
6128
  }, {});
5856
6129
  };
5857
- var TimeSeriesServiceListConnect = function TimeSeriesServiceListConnect() {
6130
+ var TimeSeriesServiceListConnect = function TimeSeriesServiceListConnect(_ref4) {
6131
+ var panelId = _ref4.panelId;
5858
6132
  var filterChipsServices = useSelector(function (store) {
5859
- return getServiceFilterChips(store);
6133
+ return getServiceFilterChips(store, panelId);
5860
6134
  });
5861
6135
  var isAllFilterchipsEnabled = useSelector(function (store) {
5862
- return getAllFilterChipsEnabled(store);
6136
+ return getAllFilterChipsEnabled(store, panelId);
5863
6137
  });
5864
6138
  return jsx(TimeSeriesServiceList, {
5865
6139
  filterChipsServicesById: sortByService(filterChipsServices),
5866
- isAllSelected: isAllFilterchipsEnabled
6140
+ isAllSelected: isAllFilterchipsEnabled,
6141
+ panelId: panelId
5867
6142
  });
5868
6143
  };
5869
6144
 
5870
6145
  var TimeSeriesSelect = function TimeSeriesSelect(_ref) {
5871
- var onClose = _ref.onClose,
6146
+ var panelId = _ref.panelId,
6147
+ onClose = _ref.onClose,
5872
6148
  isOpen = _ref.isOpen,
5873
6149
  onMouseDown = _ref.onMouseDown,
5874
6150
  order = _ref.order,
@@ -5916,28 +6192,38 @@ var TimeSeriesSelect = function TimeSeriesSelect(_ref) {
5916
6192
  padding: '6px 8px',
5917
6193
  height: "calc(100% - " + (error ? 48 : 0) + "px)",
5918
6194
  display: 'flex',
5919
- flexDirection: 'column'
6195
+ flexDirection: 'column',
6196
+ minHeight: 0
5920
6197
  },
5921
- children: [jsx(SearchFieldConnect, {}), jsx(Box, {
6198
+ children: [jsx(SearchFieldConnect, {
6199
+ panelId: panelId
6200
+ }), jsx(Box, {
5922
6201
  sx: {
5923
6202
  position: 'absolute',
5924
6203
  margin: '64px 0 0 calc(100% - 40px)',
5925
6204
  zIndex: 2,
5926
6205
  "float": 'right'
5927
6206
  },
5928
- children: jsx(ServiceOptionsButtonConnect, {})
6207
+ children: jsx(ServiceOptionsButtonConnect, {
6208
+ panelId: panelId
6209
+ })
5929
6210
  }), jsx(Box, {
5930
6211
  sx: {
5931
6212
  paddingBottom: '6px',
5932
6213
  paddingRight: '32px'
5933
6214
  },
5934
- children: jsx(TimeSeriesServiceListConnect, {})
6215
+ children: jsx(TimeSeriesServiceListConnect, {
6216
+ panelId: panelId
6217
+ })
5935
6218
  }), jsx(TimeSeriesSelectListConnect, {
5936
6219
  handleAddOrRemoveClick: handleAddOrRemoveClick,
5937
6220
  isOpen: isOpen,
6221
+ panelId: panelId,
5938
6222
  selectPlot: selectPlot,
5939
6223
  services: services
5940
- }), jsx(ServicePopupConnect, {})]
6224
+ }), jsx(ServicePopupConnect, {
6225
+ panelId: panelId
6226
+ })]
5941
6227
  })]
5942
6228
  });
5943
6229
  };
@@ -5952,16 +6238,19 @@ var TimeSeriesSelectConnect = function TimeSeriesSelectConnect(_ref) {
5952
6238
  dialogOrder = _useSetupDialog.dialogOrder,
5953
6239
  isDialogOpen = _useSetupDialog.isDialogOpen,
5954
6240
  onCloseDialog = _useSetupDialog.onCloseDialog;
6241
+ var activePanelId = useSelector(function (state) {
6242
+ return uiSelectors.getSourcePanelId(state, DIALOG_TYPE);
6243
+ });
5955
6244
  var dispatch = useDispatch();
5956
6245
  var plot = useSelector(function (state) {
5957
- return getPlotWithParameters(state, selectPlotId);
6246
+ return getPlotWithParameters(state, selectPlotId, panelId);
5958
6247
  });
5959
6248
  // If select dialog for a plot is open but the plot is deleted, close the dialog
5960
6249
  React.useEffect(function () {
5961
- if (isDialogOpen && !plot) {
6250
+ if (isDialogOpen && activePanelId === panelId && !plot) {
5962
6251
  onCloseDialog();
5963
6252
  }
5964
- }, [plot, isDialogOpen, onCloseDialog]);
6253
+ }, [plot, isDialogOpen, onCloseDialog, activePanelId, panelId]);
5965
6254
  var handleAddOrRemoveClick = React.useCallback(function (parameter, plotHasParameter) {
5966
6255
  if (plotHasParameter) {
5967
6256
  dispatch(timeSeriesActions.deleteParameter({
@@ -5980,12 +6269,14 @@ var TimeSeriesSelectConnect = function TimeSeriesSelectConnect(_ref) {
5980
6269
  var services = useSelector(function (state) {
5981
6270
  return getServices(state);
5982
6271
  });
6272
+ var isDialogOpenForPanel = isDialogOpen && activePanelId === panelId;
5983
6273
  return plot && services && services.length > 0 ? jsx(TimeSeriesSelect, {
5984
6274
  handleAddOrRemoveClick: handleAddOrRemoveClick,
5985
- isOpen: isDialogOpen,
6275
+ isOpen: isDialogOpenForPanel,
5986
6276
  onClose: onCloseDialog,
5987
6277
  onMouseDown: setDialogOrder,
5988
6278
  order: dialogOrder,
6279
+ panelId: panelId,
5989
6280
  selectPlot: plot,
5990
6281
  services: services
5991
6282
  }) : null;
@@ -5996,7 +6287,7 @@ var origin = TimeSeriesActionOrigin.timeSeriesManager;
5996
6287
  var TimeSeriesManagerConnect = function TimeSeriesManagerConnect(_ref) {
5997
6288
  var preloadedTimeseriesServices = _ref.preloadedTimeseriesServices;
5998
6289
  var panelId = useSelector(function (store) {
5999
- return uiSelectors.getDialogMapId(store, uiTypes.DialogTypes.TimeSeriesManager);
6290
+ return uiSelectors.getSourcePanelId(store, uiTypes.DialogTypes.TimeSeriesManager);
6000
6291
  });
6001
6292
  var _useSetupDialog = useSetupDialog(DIALOG_TYPE_MANAGER),
6002
6293
  setDialogOrder = _useSetupDialog.setDialogOrder,
@@ -6010,15 +6301,14 @@ var TimeSeriesManagerConnect = function TimeSeriesManagerConnect(_ref) {
6010
6301
  setSelectPlotId = _useState[1];
6011
6302
  var dispatch = useDispatch();
6012
6303
  var confirmDialog = useConfirmationDialog();
6013
- var plotState = useSelector(getPlotState);
6304
+ var plotState = useSelector(function (state) {
6305
+ return getPlotState(state, panelId);
6306
+ });
6014
6307
  React.useEffect(function () {
6015
- var addServices = function addServices(timeSeriesServices) {
6308
+ if (preloadedTimeseriesServices) {
6016
6309
  dispatch(timeSeriesActions.addServices({
6017
- timeSeriesServices: timeSeriesServices
6310
+ timeSeriesServices: preloadedTimeseriesServices
6018
6311
  }));
6019
- };
6020
- if (preloadedTimeseriesServices) {
6021
- addServices(preloadedTimeseriesServices);
6022
6312
  }
6023
6313
  }, [preloadedTimeseriesServices, dispatch]);
6024
6314
  var showSnackbar = React.useCallback(function (message) {
@@ -6126,6 +6416,7 @@ var TimeSeriesManagerConnect = function TimeSeriesManagerConnect(_ref) {
6126
6416
  onClose: onCloseDialog,
6127
6417
  onMouseDown: setDialogOrder,
6128
6418
  order: dialogOrder,
6419
+ panelId: panelId,
6129
6420
  patchParameter: patchParameter,
6130
6421
  plotState: plotState,
6131
6422
  selectPlotId: selectPlotId,
@@ -6270,7 +6561,7 @@ var LocationInfo = function LocationInfo(_ref) {
6270
6561
  return Math.abs(lat) + "\xB0 " + latHemisphere + ", " + Math.abs(lon) + "\xB0 " + lonHemisphere;
6271
6562
  };
6272
6563
  var formattedCoordinates = useMemo(function () {
6273
- if (location && location.geometry.type === 'Point') {
6564
+ if ((location == null ? void 0 : location.geometry.type) === 'Point') {
6274
6565
  var latitude = location.geometry.coordinates[1];
6275
6566
  var longitude = location.geometry.coordinates[0];
6276
6567
  return getFormattedCoordinates(latitude, longitude);
@@ -6455,10 +6746,12 @@ var ParameterInfoText = function ParameterInfoText(_ref6) {
6455
6746
  };
6456
6747
 
6457
6748
  var LocationInfoConnect = function LocationInfoConnect() {
6458
- var services = useSelector(getServices);
6459
6749
  var panelId = useSelector(function (store) {
6460
6750
  return uiSelectors.getSourcePanelId(store, uiTypes.DialogTypes.TimeSeriesLocationInfo);
6461
6751
  });
6752
+ var services = useSelector(function (state) {
6753
+ return getServices(state);
6754
+ });
6462
6755
  var selectedMapIds = useSelector(function (state) {
6463
6756
  return genericSelectors.getLinkedMaps(state, panelId);
6464
6757
  });
@@ -6524,11 +6817,14 @@ timeseriesListener.startListening({
6524
6817
  matcher: isAnyOf(timeSeriesActions.loadUserAddedTimeSeriesServices, timeSeriesActions.upsertService, timeSeriesActions.removeService, timeSeriesActions.registerTimeSeriesPreset),
6525
6818
  effect: function () {
6526
6819
  var _effect = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee(action, listenerApi) {
6820
+ var _listenerApi$getState;
6821
+ var services;
6527
6822
  return _regeneratorRuntime().wrap(function _callee$(_context) {
6528
6823
  while (1) switch (_context.prev = _context.next) {
6529
6824
  case 0:
6530
- setUserAddedEDRServices(listenerApi.getState().timeSeries.services || []);
6531
- case 1:
6825
+ services = ((_listenerApi$getState = listenerApi.getState().timeSeries) == null ? void 0 : _listenerApi$getState.services) || [];
6826
+ setUserAddedEDRServices(services);
6827
+ case 2:
6532
6828
  case "end":
6533
6829
  return _context.stop();
6534
6830
  }
@@ -6629,13 +6925,17 @@ var LocationInfoButtonConnect = function LocationInfoButtonConnect(_ref) {
6629
6925
  var isOpenInStore = useSelector(function (store) {
6630
6926
  return uiSelectors.getisDialogOpen(store, uiTypes.DialogTypes.TimeSeriesLocationInfo);
6631
6927
  });
6928
+ var currentSourcePanelId = useSelector(function (store) {
6929
+ return uiSelectors.getSourcePanelId(store, uiTypes.DialogTypes.TimeSeriesLocationInfo);
6930
+ });
6632
6931
  var handleClick = function handleClick() {
6633
6932
  dispatch(uiActions.setToggleOpenDialog({
6634
6933
  type: uiTypes.DialogTypes.TimeSeriesLocationInfo,
6635
- setOpen: !isOpenInStore,
6934
+ setOpen: currentSourcePanelId !== panelId ? true : !isOpenInStore,
6636
6935
  sourcePanelId: panelId
6637
6936
  }));
6638
6937
  };
6938
+ var isOpenForPanel = isOpenInStore && currentSourcePanelId === panelId;
6639
6939
  return jsx(CustomTooltip, {
6640
6940
  title: t('timeseries-location-info-title'),
6641
6941
  children: jsx("span", {
@@ -6644,7 +6944,7 @@ var LocationInfoButtonConnect = function LocationInfoButtonConnect(_ref) {
6644
6944
  icon: jsx(Info, {}),
6645
6945
  longText: t('timeseries-location-info-button'),
6646
6946
  onClick: handleClick,
6647
- selected: isOpenInStore,
6947
+ selected: isOpenForPanel,
6648
6948
  variant: "tool"
6649
6949
  })
6650
6950
  })
@@ -7463,27 +7763,24 @@ var TimeSeriesView = /*#__PURE__*/React.memo(function (_ref) {
7463
7763
 
7464
7764
  var TOOLTIP_TITLE = 'Timeseries Manager';
7465
7765
  var TimeSeriesManagerMapButtonConnect = function TimeSeriesManagerMapButtonConnect(_ref) {
7466
- var viewId = _ref.viewId,
7467
- _ref$source = _ref.source,
7468
- source = _ref$source === void 0 ? 'app' : _ref$source;
7766
+ var viewId = _ref.viewId;
7469
7767
  var dispatch = useDispatch();
7470
7768
  var _useTimeseriesTransla = useTimeseriesTranslation(),
7471
7769
  t = _useTimeseriesTransla.t;
7472
- var currentActiveMapId = useSelector(function (store) {
7473
- return uiSelectors.getDialogMapId(store, DIALOG_TYPE_MANAGER);
7770
+ var currentSourcePanelId = useSelector(function (store) {
7771
+ return uiSelectors.getSourcePanelId(store, DIALOG_TYPE_MANAGER);
7474
7772
  });
7475
7773
  var isOpenInStore = useSelector(function (store) {
7476
7774
  return uiSelectors.getisDialogOpen(store, DIALOG_TYPE_MANAGER);
7477
7775
  });
7478
7776
  var openTimeSeriesManagerDialog = React.useCallback(function () {
7479
- dispatch(uiActions.setActiveMapIdForDialog({
7777
+ dispatch(uiActions.setToggleOpenDialog({
7480
7778
  type: DIALOG_TYPE_MANAGER,
7481
- mapId: viewId,
7482
- setOpen: currentActiveMapId !== viewId ? true : !isOpenInStore,
7483
- source: source
7779
+ setOpen: currentSourcePanelId !== viewId ? true : !isOpenInStore,
7780
+ sourcePanelId: viewId
7484
7781
  }));
7485
- }, [currentActiveMapId, dispatch, isOpenInStore, viewId, source]);
7486
- var isOpen = currentActiveMapId === viewId && isOpenInStore;
7782
+ }, [currentSourcePanelId, dispatch, isOpenInStore, viewId]);
7783
+ var isOpen = currentSourcePanelId === viewId && isOpenInStore;
7487
7784
  return jsx(CustomTooltip, {
7488
7785
  title: TOOLTIP_TITLE,
7489
7786
  children: jsx("span", {
@@ -7505,29 +7802,43 @@ var LocationSelectButtonConnect = function LocationSelectButtonConnect(_ref) {
7505
7802
  var dispatch = useDispatch();
7506
7803
  var _useTimeseriesTransla = useTimeseriesTranslation(),
7507
7804
  t = _useTimeseriesTransla.t;
7508
- var timeSeriesLocation = useSelector(getCurrentLocation);
7805
+ var timeSeriesLocation = useSelector(function (state) {
7806
+ return getCurrentLocation(state, panelId);
7807
+ });
7808
+ var currentSourcePanelId = useSelector(function (store) {
7809
+ return uiSelectors.getSourcePanelId(store, uiTypes.DialogTypes.TimeseriesLocations);
7810
+ });
7509
7811
  var isLocationsDialogOpen = useSelector(function (store) {
7510
7812
  return uiSelectors.getisDialogOpen(store, uiTypes.DialogTypes.TimeseriesLocations);
7511
7813
  });
7512
- var isMapPinDisabled = useSelector(getIsMapPinDisabled);
7814
+ var isMapPinDisabled = useSelector(function (state) {
7815
+ return getIsMapPinDisabled(state, panelId);
7816
+ });
7817
+ var isLocationsDialogOpenRef = React.useRef(isLocationsDialogOpen);
7818
+ var currentSourcePanelIdRef = React.useRef(currentSourcePanelId);
7819
+ React.useEffect(function () {
7820
+ isLocationsDialogOpenRef.current = isLocationsDialogOpen;
7821
+ currentSourcePanelIdRef.current = currentSourcePanelId;
7822
+ }, [isLocationsDialogOpen, currentSourcePanelId]);
7513
7823
  var selectedLocationName = typeof (timeSeriesLocation == null || (_timeSeriesLocation$o = timeSeriesLocation.occurrences) == null || (_timeSeriesLocation$o = _timeSeriesLocation$o[0]) == null || (_timeSeriesLocation$o = _timeSeriesLocation$o.properties) == null ? void 0 : _timeSeriesLocation$o.name) === 'string' ? timeSeriesLocation.occurrences[0].properties.name : '';
7514
7824
  var toggleLocationsDialog = function toggleLocationsDialog() {
7515
7825
  dispatch(uiActions.setToggleOpenDialog({
7516
7826
  type: uiTypes.DialogTypes.TimeseriesLocations,
7517
- setOpen: !isLocationsDialogOpen,
7827
+ setOpen: currentSourcePanelId !== panelId ? true : !isLocationsDialogOpen,
7518
7828
  sourcePanelId: panelId
7519
7829
  }));
7520
7830
  };
7521
7831
  React.useEffect(function () {
7522
7832
  return function () {
7523
- if (isLocationsDialogOpen) {
7833
+ if (isLocationsDialogOpenRef.current && currentSourcePanelIdRef.current === panelId) {
7524
7834
  dispatch(uiActions.setToggleOpenDialog({
7525
7835
  setOpen: false,
7526
- type: uiTypes.DialogTypes.TimeseriesLocations
7836
+ type: uiTypes.DialogTypes.TimeseriesLocations,
7837
+ sourcePanelId: panelId
7527
7838
  }));
7528
7839
  }
7529
7840
  };
7530
- }, [dispatch, isLocationsDialogOpen]);
7841
+ }, [dispatch, panelId]);
7531
7842
  return jsx(CustomTooltip, {
7532
7843
  title: selectedLocationName || t('timeseries-select-location'),
7533
7844
  children: jsx("span", {
@@ -7544,7 +7855,7 @@ var LocationSelectButtonConnect = function LocationSelectButtonConnect(_ref) {
7544
7855
  }),
7545
7856
  longText: selectedLocationName || t('timeseries-location'),
7546
7857
  onClick: toggleLocationsDialog,
7547
- selected: isLocationsDialogOpen,
7858
+ selected: isLocationsDialogOpen ? currentSourcePanelId === panelId : null,
7548
7859
  shortText: selectedLocationName || t('timeseries-location')
7549
7860
  })
7550
7861
  })
@@ -7584,7 +7895,9 @@ var useMapPin = function useMapPin(_ref2) {
7584
7895
  var selectedMapIds = useSelector(function (state) {
7585
7896
  return genericSelectors.getLinkedMaps(state, panelId);
7586
7897
  });
7587
- var isMapPinDisabled = useSelector(getIsMapPinDisabled);
7898
+ var isMapPinDisabled = useSelector(function (state) {
7899
+ return getIsMapPinDisabled(state, panelId);
7900
+ });
7588
7901
  /* Make sure the mappin is visible when linking new maps */
7589
7902
  useEffect(function () {
7590
7903
  var toggleMapPinVisibility = function toggleMapPinVisibility(displayMapPin) {
@@ -7604,6 +7917,7 @@ var useMapPin = function useMapPin(_ref2) {
7604
7917
  var toggleDisableMapPin = function toggleDisableMapPin() {
7605
7918
  var newDisableMapPinState = !isMapPinDisabled;
7606
7919
  dispatch(timeSeriesActions.disableMapPin({
7920
+ panelId: panelId,
7607
7921
  isMapPinDisabled: newDisableMapPinState
7608
7922
  }));
7609
7923
  selectedMapIds.forEach(function (mapId) {
@@ -7619,23 +7933,38 @@ var useMapPin = function useMapPin(_ref2) {
7619
7933
  };
7620
7934
  };
7621
7935
  var TimeSeriesConnect = function TimeSeriesConnect(_ref3) {
7622
- var _sharedGeoJSON$featur;
7936
+ var _linkedMapIds$, _sharedGeoJSON$featur;
7623
7937
  var panelId = _ref3.panelId;
7624
7938
  var dispatch = useDispatch();
7625
7939
  var _useTimeseriesTransla = useTimeseriesTranslation(),
7626
7940
  t = _useTimeseriesTransla.t;
7627
7941
  var geojsonLayerId = React.useRef(webmapUtils.generateLayerId()).current;
7628
- var shouldShowLegend = useSelector(getIsLegendVisible);
7629
- var services = useSelector(getServices);
7630
- var shouldHideLocationMarkers = useSelector(getShouldHideLocationMarkers);
7631
- var plotPresetState = useSelector(getPlotState);
7632
- var activeMapId = useSelector(function (store) {
7633
- return uiSelectors.getActiveWindowId(store);
7634
- });
7635
- var timeSeriesLocation = useSelector(getCurrentLocation);
7636
- var selectedFeature = useSelector(function (state) {
7942
+ var shouldShowLegend = useSelector(function (state) {
7943
+ return getIsLegendVisible(state, panelId);
7944
+ });
7945
+ var services = useSelector(function (state) {
7946
+ return getServices(state);
7947
+ });
7948
+ var shouldHideLocationMarkers = useSelector(function (state) {
7949
+ return getShouldHideLocationMarkers(state, panelId);
7950
+ });
7951
+ var plotPresetState = useSelector(function (state) {
7952
+ return getPlotState(state, panelId);
7953
+ });
7954
+ var linkedMapIds = useSelector(function (state) {
7955
+ return genericSelectors.getLinkedMaps(state, panelId);
7956
+ });
7957
+ var panelMapId = (_linkedMapIds$ = linkedMapIds == null ? void 0 : linkedMapIds[0]) != null ? _linkedMapIds$ : plotPresetState == null ? void 0 : plotPresetState.mapId;
7958
+ var timeSeriesLocation = useSelector(function (state) {
7959
+ return getCurrentLocation(state, panelId);
7960
+ });
7961
+ var selectedFeatureFromPanel = useSelector(function (state) {
7637
7962
  return genericSelectors.getSelectedFeature(state.syncGroups, panelId);
7638
7963
  });
7964
+ var selectedFeatureFromMap = useSelector(function (state) {
7965
+ return panelMapId ? genericSelectors.getSelectedFeature(state.syncGroups, panelMapId) : null;
7966
+ });
7967
+ var selectedFeature = selectedFeatureFromPanel != null ? selectedFeatureFromPanel : selectedFeatureFromMap;
7639
7968
  var allMaps = useSelector(function (store) {
7640
7969
  return mapSelectors.getAllMapsByIds(store);
7641
7970
  });
@@ -7659,9 +7988,10 @@ var TimeSeriesConnect = function TimeSeriesConnect(_ref3) {
7659
7988
  }, [dispatch, panelId]);
7660
7989
  var setTimeSeriesLocation = useCallback(function (location) {
7661
7990
  dispatch(timeSeriesActions.setCurrentLocation({
7991
+ panelId: panelId,
7662
7992
  location: location
7663
7993
  }));
7664
- }, [dispatch]);
7994
+ }, [dispatch, panelId]);
7665
7995
  var memoizedSelectedFeature = React.useMemo(function () {
7666
7996
  if (!selectedFeature) {
7667
7997
  return null;
@@ -7675,9 +8005,9 @@ var TimeSeriesConnect = function TimeSeriesConnect(_ref3) {
7675
8005
  // eslint-disable-next-line react-hooks/exhaustive-deps
7676
8006
  }, [selectedFeature == null ? void 0 : selectedFeature.lat, selectedFeature == null ? void 0 : selectedFeature.lon]);
7677
8007
  useEffect(function () {
7678
- if (!memoizedSelectedFeature && activeMapId) {
7679
- var _allMaps$activeMapId;
7680
- var activeMapCoordinates = (_allMaps$activeMapId = allMaps[activeMapId]) == null ? void 0 : _allMaps$activeMapId.mapPinLocation;
8008
+ if (!memoizedSelectedFeature && panelMapId) {
8009
+ var _allMaps$panelMapId;
8010
+ var activeMapCoordinates = (_allMaps$panelMapId = allMaps[panelMapId]) == null ? void 0 : _allMaps$panelMapId.mapPinLocation;
7681
8011
  if ((activeMapCoordinates == null ? void 0 : activeMapCoordinates.lat) !== undefined && (activeMapCoordinates == null ? void 0 : activeMapCoordinates.lon) !== undefined) {
7682
8012
  setTimeSeriesLocation(activeMapCoordinates);
7683
8013
  }
@@ -7692,7 +8022,7 @@ var TimeSeriesConnect = function TimeSeriesConnect(_ref3) {
7692
8022
  };
7693
8023
  setTimeSeriesLocation(validLocation);
7694
8024
  }
7695
- }, [activeMapId, selectedFeature, setTimeSeriesLocation, memoizedSelectedFeature, allMaps]);
8025
+ }, [panelMapId, selectedFeature, setTimeSeriesLocation, memoizedSelectedFeature, allMaps]);
7696
8026
  useEffect(function () {
7697
8027
  return function () {
7698
8028
  if (panelId) {
@@ -7743,11 +8073,13 @@ var TimeSeriesConnect = function TimeSeriesConnect(_ref3) {
7743
8073
  }, [dispatch, geojsonLayerId, shouldHideLocationMarkers, locationsData, memoizedSelectedFeature, panelId, stableServices, setTimeSeriesLocation]);
7744
8074
  var toggleLocationMarkers = function toggleLocationMarkers(shouldHide) {
7745
8075
  dispatch(timeSeriesActions.toggleLocationMarkers({
8076
+ panelId: panelId,
7746
8077
  shouldHideLocationMarkers: shouldHide
7747
8078
  }));
7748
8079
  };
7749
8080
  var toggleLegend = function toggleLegend() {
7750
8081
  dispatch(timeSeriesActions.toggleLegend({
8082
+ panelId: panelId,
7751
8083
  isLegendVisible: !shouldShowLegend
7752
8084
  }));
7753
8085
  };
@@ -7837,17 +8169,20 @@ var TimeSeriesConnectWrapper = function TimeSeriesConnectWrapper(_ref) {
7837
8169
  React.useEffect(function () {
7838
8170
  var localStorageServices = getUserAddedEDRServices();
7839
8171
  dispatch(timeSeriesActions.loadUserAddedTimeSeriesServices(localStorageServices));
7840
- }, [dispatch, timeSeriesPreset, timeSeriesPresetRef]);
8172
+ }, [dispatch, panelId, timeSeriesPreset, timeSeriesPresetRef]);
7841
8173
  React.useEffect(function () {
7842
8174
  // Check if the preset has changed
7843
8175
  if (!isEqual(timeSeriesPreset, timeSeriesPresetRef.current)) {
7844
8176
  timeSeriesPresetRef.current = timeSeriesPreset;
7845
- timeSeriesPreset && dispatch(timeSeriesActions.registerTimeSeriesPreset(timeSeriesPreset));
8177
+ timeSeriesPreset && dispatch(timeSeriesActions.registerTimeSeriesPreset(Object.assign({}, timeSeriesPreset, {
8178
+ panelId: panelId
8179
+ })));
7846
8180
  hideLocationMarkers !== undefined && dispatch(timeSeriesActions.toggleLocationMarkers({
8181
+ panelId: panelId,
7847
8182
  shouldHideLocationMarkers: hideLocationMarkers
7848
8183
  }));
7849
8184
  }
7850
- }, [dispatch, timeSeriesPreset, timeSeriesPresetRef, hideLocationMarkers]);
8185
+ }, [dispatch, timeSeriesPreset, timeSeriesPresetRef, hideLocationMarkers, panelId]);
7851
8186
  return jsx(TimeSeriesConnect, {
7852
8187
  panelId: panelId
7853
8188
  });
@@ -8140,164 +8475,126 @@ var LocationListItem = function LocationListItem(_ref) {
8140
8475
  });
8141
8476
  };
8142
8477
 
8143
- var renderRow = function renderRow(features, handleChange, selectedLocation, isDisabled) {
8144
- if (isDisabled === void 0) {
8145
- isDisabled = false;
8146
- }
8147
- return function (props) {
8148
- var _feature$properties;
8149
- var index = props.index,
8150
- style = props.style;
8151
- var feature = features[index];
8152
- return jsx("div", {
8153
- style: Object.assign({}, style),
8154
- children: jsx(LocationListItem, {
8155
- handleChange: handleChange,
8156
- isDisabled: isDisabled,
8157
- location: (_feature$properties = feature.properties) == null ? void 0 : _feature$properties.name,
8158
- selectedLocation: selectedLocation
8159
- }, feature.id)
8160
- });
8161
- };
8478
+ var RowComponent = function RowComponent(_ref) {
8479
+ var _feature$properties;
8480
+ var index = _ref.index,
8481
+ style = _ref.style,
8482
+ handleChange = _ref.handleChange,
8483
+ selectedLocation = _ref.selectedLocation,
8484
+ features = _ref.features,
8485
+ _ref$isDisabled = _ref.isDisabled,
8486
+ isDisabled = _ref$isDisabled === void 0 ? false : _ref$isDisabled;
8487
+ var feature = features[index];
8488
+ return jsx("div", {
8489
+ style: Object.assign({}, style),
8490
+ children: jsx(LocationListItem, {
8491
+ handleChange: handleChange,
8492
+ isDisabled: isDisabled,
8493
+ location: (_feature$properties = feature.properties) == null ? void 0 : _feature$properties.name,
8494
+ selectedLocation: selectedLocation
8495
+ }, feature.id)
8496
+ });
8162
8497
  };
8163
-
8164
- var FocusableListOuter = /*#__PURE__*/React.forwardRef(function (props, ref) {
8165
- // Track last interaction modality to conditionally show focus ring only for keyboard navigation.
8166
- var lastInteractionWasKeyboard = React.useRef(false);
8498
+ function useFocusVisible() {
8499
+ var lastWasKeyboard = React.useRef(false);
8500
+ var _React$useState = React.useState(false),
8501
+ focusVisible = _React$useState[0],
8502
+ setFocusVisible = _React$useState[1];
8167
8503
  React.useEffect(function () {
8168
- var handleKey = function handleKey(e) {
8169
- // Ignore modifier-only keys; any navigation key sets keyboard modality.
8170
- if (e.key) {
8171
- lastInteractionWasKeyboard.current = true;
8172
- }
8504
+ var onKey = function onKey() {
8505
+ lastWasKeyboard.current = true;
8173
8506
  };
8174
- var handlePointer = function handlePointer() {
8175
- lastInteractionWasKeyboard.current = false;
8507
+ var onPointer = function onPointer() {
8508
+ lastWasKeyboard.current = false;
8176
8509
  };
8177
- window.addEventListener('keydown', handleKey, {
8510
+ window.addEventListener('keydown', onKey, {
8178
8511
  capture: true
8179
8512
  });
8180
- window.addEventListener('mousedown', handlePointer, {
8513
+ window.addEventListener('pointerdown', onPointer, {
8181
8514
  capture: true
8182
8515
  });
8183
- window.addEventListener('pointerdown', handlePointer, {
8516
+ window.addEventListener('mousedown', onPointer, {
8184
8517
  capture: true
8185
8518
  });
8186
- window.addEventListener('touchstart', handlePointer, {
8519
+ window.addEventListener('touchstart', onPointer, {
8187
8520
  capture: true
8188
8521
  });
8189
- // Listen for custom selection event to remove focus styling after keyboard activation.
8190
- var handleSelection = function handleSelection() {
8191
- setIsFocusVisible(false);
8192
- };
8193
- window.addEventListener('location-list-selection', handleSelection);
8194
8522
  return function () {
8195
- window.removeEventListener('keydown', handleKey, {
8523
+ window.removeEventListener('keydown', onKey, {
8196
8524
  capture: true
8197
8525
  });
8198
- window.removeEventListener('mousedown', handlePointer, {
8526
+ window.removeEventListener('pointerdown', onPointer, {
8199
8527
  capture: true
8200
8528
  });
8201
- window.removeEventListener('pointerdown', handlePointer, {
8529
+ window.removeEventListener('mousedown', onPointer, {
8202
8530
  capture: true
8203
8531
  });
8204
- window.removeEventListener('touchstart', handlePointer, {
8532
+ window.removeEventListener('touchstart', onPointer, {
8205
8533
  capture: true
8206
8534
  });
8207
- window.removeEventListener('location-list-selection', handleSelection);
8208
8535
  };
8209
8536
  }, []);
8210
- var handleKeyDown = function handleKeyDown(e) {
8211
- var el = ref && typeof ref === 'object' && 'current' in ref ? ref.current : null;
8212
- if (!el) {
8213
- return;
8214
- }
8215
- var lineHeight = 40; // matches itemSize
8216
- var pageHeight = el.clientHeight;
8217
- switch (e.key) {
8218
- case 'ArrowDown':
8219
- e.preventDefault();
8220
- el.scrollTop += lineHeight;
8221
- break;
8222
- case 'ArrowUp':
8223
- e.preventDefault();
8224
- el.scrollTop -= lineHeight;
8225
- break;
8226
- case 'PageDown':
8227
- e.preventDefault();
8228
- el.scrollTop += pageHeight;
8229
- break;
8230
- case 'PageUp':
8231
- e.preventDefault();
8232
- el.scrollTop -= pageHeight;
8233
- break;
8234
- case 'Home':
8235
- e.preventDefault();
8236
- el.scrollTop = 0;
8237
- break;
8238
- case 'End':
8239
- e.preventDefault();
8240
- el.scrollTop = el.scrollHeight;
8241
- break;
8242
- }
8243
- };
8244
- // merge any existing style prop with our outline override
8245
- var mergedStyle = Object.assign({}, props.style, {
8246
- outline: 'none',
8247
- transition: 'box-shadow 120ms ease, background-color 120ms ease'
8248
- });
8249
- var _React$useState = React.useState(false),
8250
- isFocusVisible = _React$useState[0],
8251
- setIsFocusVisible = _React$useState[1];
8252
- var onFocus = function onFocus() {
8253
- if (lastInteractionWasKeyboard.current) {
8254
- setIsFocusVisible(true);
8537
+ return {
8538
+ focusVisible: focusVisible,
8539
+ onFocus: function onFocus() {
8540
+ if (lastWasKeyboard.current) {
8541
+ setFocusVisible(true);
8542
+ }
8543
+ },
8544
+ onBlur: function onBlur() {
8545
+ return setFocusVisible(false);
8546
+ },
8547
+ clear: function clear() {
8548
+ return setFocusVisible(false);
8255
8549
  }
8256
8550
  };
8257
- var onBlur = function onBlur() {
8258
- return setIsFocusVisible(false);
8259
- };
8260
- if (isFocusVisible) {
8261
- mergedStyle.boxShadow = '0 0 0 2px var(--focus-ring-color, #1976d2)';
8262
- mergedStyle.backgroundColor = 'rgba(25,118,210,0.06)';
8263
- }
8264
- return jsx("div", Object.assign({}, props, {
8265
- "aria-label": "Locations list",
8266
- onBlur: onBlur,
8267
- onFocus: onFocus,
8268
- onKeyDown: handleKeyDown,
8269
- // Remove focus styling immediately on mouse interaction
8270
- onMouseDown: function onMouseDown() {
8271
- setIsFocusVisible(false);
8272
- },
8273
- ref: ref,
8551
+ }
8552
+ var FocusableListWrapper = function FocusableListWrapper(_ref2) {
8553
+ var children = _ref2.children,
8554
+ onKeyDown = _ref2.onKeyDown,
8555
+ ariaLabel = _ref2['aria-label'];
8556
+ var fv = useFocusVisible();
8557
+ return jsx("div", {
8558
+ "aria-label": ariaLabel,
8559
+ onBlur: fv.onBlur,
8560
+ onFocus: fv.onFocus,
8561
+ onKeyDown: onKeyDown,
8562
+ onMouseDown: fv.clear,
8274
8563
  role: "listbox",
8275
- style: mergedStyle,
8276
- tabIndex: 0
8277
- }));
8278
- });
8279
- var LocationDropdown = function LocationDropdown(_ref) {
8564
+ style: Object.assign({
8565
+ outline: 'none',
8566
+ transition: 'box-shadow 120ms ease, background-color 120ms ease'
8567
+ }, fv.focusVisible ? {
8568
+ boxShadow: '0 0 0 2px var(--focus-ring-color, #1976d2)',
8569
+ backgroundColor: 'rgba(25,118,210,0.06)'
8570
+ } : null),
8571
+ tabIndex: 0,
8572
+ children: children
8573
+ });
8574
+ };
8575
+ var LocationDropdown = function LocationDropdown(_ref3) {
8280
8576
  var _combinedSelectedLoca;
8281
- var geoJson = _ref.geoJson,
8282
- splitGeoJson = _ref.splitGeoJson,
8283
- handleChange = _ref.handleChange,
8284
- selectedLocation = _ref.selectedLocation,
8285
- _ref$isDisabled = _ref.isDisabled,
8286
- isDisabled = _ref$isDisabled === void 0 ? false : _ref$isDisabled,
8287
- defaultExpanded = _ref.defaultExpanded;
8577
+ var geoJson = _ref3.geoJson,
8578
+ splitGeoJson = _ref3.splitGeoJson,
8579
+ handleChange = _ref3.handleChange,
8580
+ selectedLocation = _ref3.selectedLocation,
8581
+ _ref3$isDisabled = _ref3.isDisabled,
8582
+ isDisabled = _ref3$isDisabled === void 0 ? false : _ref3$isDisabled,
8583
+ defaultExpanded = _ref3.defaultExpanded;
8584
+ var listRef = useListRef(null);
8288
8585
  var _React$useState2 = React.useState(''),
8289
8586
  searchTerm = _React$useState2[0],
8290
8587
  setSearchTerm = _React$useState2[1];
8291
8588
  var combinedSelectedLocation = geoJson == null ? void 0 : geoJson.features.find(function (feature) {
8292
- var _feature$properties;
8293
- return selectedLocation === ((_feature$properties = feature.properties) == null ? void 0 : _feature$properties.name);
8589
+ var _feature$properties2;
8590
+ return selectedLocation === ((_feature$properties2 = feature.properties) == null ? void 0 : _feature$properties2.name);
8294
8591
  });
8295
8592
  var selectedLocationNames = combinedSelectedLocation ? Object.keys(combinedSelectedLocation == null || (_combinedSelectedLoca = combinedSelectedLocation.properties) == null ? void 0 : _combinedSelectedLoca.names) : [];
8296
8593
  var filteredResults = useMemo(function () {
8297
8594
  return splitGeoJson == null ? void 0 : splitGeoJson.map(function (dataset) {
8298
8595
  var filteredFeatures = dataset.geoJson.features.filter(function (feature) {
8299
- var _feature$properties2;
8300
- return (_feature$properties2 = feature.properties) == null ? void 0 : _feature$properties2.name.toLowerCase().includes(searchTerm.toLowerCase());
8596
+ var _feature$properties3;
8597
+ return (_feature$properties3 = feature.properties) == null ? void 0 : _feature$properties3.name.toLowerCase().includes(searchTerm.toLowerCase());
8301
8598
  });
8302
8599
  return Object.assign({}, dataset, {
8303
8600
  geoJson: Object.assign({}, dataset.geoJson, {
@@ -8308,6 +8605,40 @@ var LocationDropdown = function LocationDropdown(_ref) {
8308
8605
  }, [searchTerm, splitGeoJson]);
8309
8606
  var listContainerRef = React.useRef(null);
8310
8607
  var heightObserver = useResizeObserver(listContainerRef, filteredResults);
8608
+ var handleKeyDown = function handleKeyDown(e) {
8609
+ var _listContainerRef$cur, _listContainerRef$cur2;
8610
+ var lineHeight = 40;
8611
+ var page = 8 * lineHeight; // or compute from measured height if you want
8612
+ var next = (listContainerRef == null || (_listContainerRef$cur = listContainerRef.current) == null ? void 0 : _listContainerRef$cur.scrollTop) || 0;
8613
+ switch (e.key) {
8614
+ case 'ArrowDown':
8615
+ e.preventDefault();
8616
+ next += lineHeight;
8617
+ break;
8618
+ case 'ArrowUp':
8619
+ e.preventDefault();
8620
+ next -= lineHeight;
8621
+ break;
8622
+ case 'PageDown':
8623
+ e.preventDefault();
8624
+ next += page;
8625
+ break;
8626
+ case 'PageUp':
8627
+ e.preventDefault();
8628
+ next -= page;
8629
+ break;
8630
+ case 'Home':
8631
+ e.preventDefault();
8632
+ next = 0;
8633
+ break;
8634
+ default:
8635
+ return;
8636
+ }
8637
+ listContainerRef == null || (_listContainerRef$cur2 = listContainerRef.current) == null || _listContainerRef$cur2.scrollTo({
8638
+ top: Math.max(0, next),
8639
+ behavior: 'smooth'
8640
+ });
8641
+ };
8311
8642
  return jsx(Box, {
8312
8643
  "data-testid": "locationDropdownContainer",
8313
8644
  ref: listContainerRef,
@@ -8341,8 +8672,8 @@ var LocationDropdown = function LocationDropdown(_ref) {
8341
8672
  var collectionGeoJson = object.geoJson;
8342
8673
  // Find location from the collection that matches the selected location
8343
8674
  var collectionSelectedLocation = collectionGeoJson.features.find(function (feature) {
8344
- var _feature$properties3;
8345
- return selectedLocationNames.includes((_feature$properties3 = feature.properties) == null ? void 0 : _feature$properties3.name);
8675
+ var _feature$properties4;
8676
+ return selectedLocationNames.includes((_feature$properties4 = feature.properties) == null ? void 0 : _feature$properties4.name);
8346
8677
  });
8347
8678
  return jsx(Box, {
8348
8679
  "data-testid": "serviceDropdown",
@@ -8359,13 +8690,25 @@ var LocationDropdown = function LocationDropdown(_ref) {
8359
8690
  },
8360
8691
  title: collectionName,
8361
8692
  title2: serviceName,
8362
- children: jsx(FixedSizeList, {
8363
- height: heightObserver,
8364
- itemCount: collectionGeoJson.features.length,
8365
- itemSize: 40,
8366
- outerElementType: FocusableListOuter,
8367
- width: "100%",
8368
- children: renderRow(collectionGeoJson.features, handleChange, collectionSelectedLocation == null || (_collectionSelectedLo = collectionSelectedLocation.properties) == null ? void 0 : _collectionSelectedLo.name, isDisabled)
8693
+ children: jsx(FocusableListWrapper, {
8694
+ "aria-label": "Locations list",
8695
+ onKeyDown: handleKeyDown,
8696
+ children: jsx(List$1, {
8697
+ listRef: listRef,
8698
+ rowComponent: RowComponent,
8699
+ rowCount: collectionGeoJson.features.length,
8700
+ rowHeight: 40,
8701
+ rowProps: {
8702
+ handleChange: handleChange,
8703
+ selectedLocation: collectionSelectedLocation == null || (_collectionSelectedLo = collectionSelectedLocation.properties) == null ? void 0 : _collectionSelectedLo.name,
8704
+ features: collectionGeoJson.features,
8705
+ isDisabled: isDisabled
8706
+ },
8707
+ style: {
8708
+ height: heightObserver,
8709
+ width: '100%'
8710
+ }
8711
+ })
8369
8712
  })
8370
8713
  })
8371
8714
  }, collectionName + "-" + serviceName);
@@ -8375,6 +8718,7 @@ var LocationDropdown = function LocationDropdown(_ref) {
8375
8718
  };
8376
8719
 
8377
8720
  var _excluded = ["occurrences"];
8721
+ var emptyMapIdList = [];
8378
8722
  var LocationSelectDialogConnect = function LocationSelectDialogConnect() {
8379
8723
  var _timeSeriesLocation$o;
8380
8724
  var _useTimeseriesTransla = useTimeseriesTranslation(),
@@ -8389,16 +8733,20 @@ var LocationSelectDialogConnect = function LocationSelectDialogConnect() {
8389
8733
  dialogOrder = _useSetupDialog.dialogOrder,
8390
8734
  setDialogOrder = _useSetupDialog.setDialogOrder;
8391
8735
  var geoJSONWithService = useSelector(function (state) {
8392
- return getGeoJSONWithService(state, panelId);
8736
+ return panelId ? getGeoJSONWithService(state, panelId) : undefined;
8393
8737
  });
8394
8738
  var sharedGeoJSON = useSelector(function (state) {
8395
- return genericSelectors.selectSharedData(state, panelId);
8739
+ return panelId ? genericSelectors.selectSharedData(state, panelId) : undefined;
8396
8740
  });
8397
8741
  var selectedMapIds = useSelector(function (state) {
8398
- return genericSelectors.getLinkedMaps(state, panelId);
8742
+ return panelId ? genericSelectors.getLinkedMaps(state, panelId) : emptyMapIdList;
8743
+ });
8744
+ var isMapPinDisabled = useSelector(function (state) {
8745
+ return panelId ? getIsMapPinDisabled(state, panelId) : false;
8746
+ });
8747
+ var timeSeriesLocation = useSelector(function (state) {
8748
+ return panelId ? getCurrentLocation(state, panelId) : undefined;
8399
8749
  });
8400
- var isMapPinDisabled = useSelector(getIsMapPinDisabled);
8401
- var timeSeriesLocation = useSelector(getCurrentLocation);
8402
8750
  var setSelectedFeatureIndex = function setSelectedFeatureIndex(selectedFeatureIndex) {
8403
8751
  dispatch(layerActions.setSelectedFeature({
8404
8752
  layerId: geojsonLayerId,
@@ -8414,10 +8762,14 @@ var LocationSelectDialogConnect = function LocationSelectDialogConnect() {
8414
8762
  }));
8415
8763
  };
8416
8764
  var setTimeSeriesLocation = useCallback(function (location) {
8765
+ if (!panelId) {
8766
+ return;
8767
+ }
8417
8768
  dispatch(timeSeriesActions.setCurrentLocation({
8769
+ panelId: panelId,
8418
8770
  location: location
8419
8771
  }));
8420
- }, [dispatch]);
8772
+ }, [dispatch, panelId]);
8421
8773
  var setMapPinLocation = function setMapPinLocation(mapPinLocation) {
8422
8774
  selectedMapIds.forEach(function (mapId) {
8423
8775
  dispatch(mapActions.setMapPinLocation({
@@ -8432,6 +8784,9 @@ var LocationSelectDialogConnect = function LocationSelectDialogConnect() {
8432
8784
  var selectedLocationName = typeof (timeSeriesLocation == null || (_timeSeriesLocation$o = timeSeriesLocation.occurrences) == null || (_timeSeriesLocation$o = _timeSeriesLocation$o[0]) == null || (_timeSeriesLocation$o = _timeSeriesLocation$o.properties) == null ? void 0 : _timeSeriesLocation$o.name) === 'string' ? timeSeriesLocation.occurrences[0].properties.name : '';
8433
8785
  var onChangeLocation = function onChangeLocation(newSelectedLocation) {
8434
8786
  var _geojson$features, _feature$properties;
8787
+ if (!panelId) {
8788
+ return;
8789
+ }
8435
8790
  if (!(geojson != null && (_geojson$features = geojson.features) != null && _geojson$features.length)) {
8436
8791
  return;
8437
8792
  }
@@ -8467,6 +8822,9 @@ var LocationSelectDialogConnect = function LocationSelectDialogConnect() {
8467
8822
  var newMapPin = _objectWithoutPropertiesLoose(location, _excluded);
8468
8823
  setMapPinLocation(newMapPin);
8469
8824
  };
8825
+ if (!panelId) {
8826
+ return null;
8827
+ }
8470
8828
  return jsx(ToolContainerDraggable, {
8471
8829
  bounds: "parent",
8472
8830
  isOpen: isDialogOpen,