@opengeoweb/core 4.2.0 → 4.3.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 (56) hide show
  1. package/index.esm.js +999 -810
  2. package/index.umd.js +989 -804
  3. package/lib/components/CanvasComponent/CanvasComponent.d.ts +1 -0
  4. package/lib/components/LayerManager/LayerSelect/KeywordFilterResults/KeywordFilterResults.stories.d.ts +12 -16
  5. package/lib/components/LayerManager/LayerSelect/LayerInfo/LayerInfoLegend.d.ts +10 -0
  6. package/lib/components/{TimeSlider/TimeSliderScaleSlider/TimeSliderScaleSlider.spec.d.ts → LayerManager/LayerSelect/LayerInfo/LayerInfoLegend.spec.d.ts} +0 -0
  7. package/lib/components/LayerManager/LayerSelect/LayerInfo/LayerInfoList.d.ts +6 -5
  8. package/lib/components/LayerManager/LayerSelect/LayerInfo/LayerInfoText.d.ts +9 -0
  9. package/lib/components/LayerManager/LayerSelect/LayerInfo/LayerInfoUtils.d.ts +7 -1
  10. package/lib/components/LayerManager/LayerSelect/LayerList/LayerList.d.ts +4 -5
  11. package/lib/components/LayerManager/LayerSelect/LayerList/LayerListConnect.d.ts +1 -0
  12. package/lib/components/LayerManager/LayerSelect/LayerList/LayerListDimensions.d.ts +7 -0
  13. package/lib/components/LayerManager/LayerSelect/LayerList/LayerListRow.d.ts +1 -0
  14. package/lib/components/LayerManager/LayerSelect/LayerSelect.d.ts +4 -0
  15. package/lib/components/LayerManager/LayerSelect/LayerSelect.stories.d.ts +8 -0
  16. package/lib/components/LayerManager/LayerSelect/LayerSelectUtils.d.ts +75 -0
  17. package/lib/components/LayerManager/LayerSelect/ServiceOptionsDialog/ServiceOptionsDialog.stories.d.ts +12 -16
  18. package/lib/components/LayerManager/LayerSelect/ServicePopup/ServicePopup.stories.d.ts +24 -32
  19. package/lib/components/Legend/LegendLayout.d.ts +13 -0
  20. package/lib/components/{TimeSlider/TimeSliderScaleSlider/TimeSliderScaleSliderConnect.spec.d.ts → Legend/LegendLayout.spec.d.ts} +0 -0
  21. package/lib/components/MapControls/MapControlButton.d.ts +1 -1
  22. package/lib/components/ReactMapView/ReactMapView.d.ts +2 -1
  23. package/lib/components/ReactMapView/ReactMapViewParseLayer.d.ts +2 -2
  24. package/lib/components/TimeSlider/TimeSlider.d.ts +0 -1
  25. package/lib/components/TimeSlider/TimeSliderButtons/NowButton/NowButton.d.ts +8 -0
  26. package/lib/components/TimeSlider/TimeSliderButtons/NowButton/NowButton.spec.d.ts +1 -0
  27. package/lib/components/TimeSlider/TimeSliderButtons/NowButton/NowButtonConnect.d.ts +9 -0
  28. package/lib/components/TimeSlider/TimeSliderButtons/NowButton/NowButtonConnect.spec.d.ts +1 -0
  29. package/lib/components/TimeSlider/TimeSliderButtons/OptionsMenuButton/OptionsMenuButton.d.ts +2 -0
  30. package/lib/components/TimeSlider/TimeSliderButtons/OptionsMenuButton/OptionsMenuButtonConnect.d.ts +1 -0
  31. package/lib/components/TimeSlider/TimeSliderButtons/TimeScaleButton/TimeScaleButton.d.ts +11 -0
  32. package/lib/components/TimeSlider/TimeSliderButtons/TimeScaleButton/TimeScaleButton.spec.d.ts +1 -0
  33. package/lib/components/TimeSlider/TimeSliderButtons/TimeScaleButton/TimeScaleButtonConnect.d.ts +4 -0
  34. package/lib/components/TimeSlider/TimeSliderButtons/TimeScaleButton/TimeScaleButtonConnect.spec.d.ts +1 -0
  35. package/lib/components/TimeSlider/TimeSliderButtons/TimeSliderButtons.stories.d.ts +6 -0
  36. package/lib/components/TimeSlider/TimeSliderButtons/TimeSliderButtonsConnect.d.ts +1 -0
  37. package/lib/components/TimeSlider/TimeSliderButtons/TimeSliderMenu/TimeSliderMenu.stories.d.ts +12 -16
  38. package/lib/components/TimeSlider/TimeSliderButtons/TimeStepButton/TimeStepButton.stories.d.ts +10 -16
  39. package/lib/components/TimeSlider/TimeSliderLegend/TimeSliderLegend.d.ts +1 -0
  40. package/lib/components/TimeSlider/TimeSliderUtils.d.ts +5 -0
  41. package/lib/components/WMSLoader/services.d.ts +2 -1
  42. package/lib/store/generic/synchronizationGroups/selectors.d.ts +2 -2
  43. package/lib/store/layerSelect/selectors.d.ts +18 -0
  44. package/lib/store/layerSelect/types.d.ts +3 -3
  45. package/lib/store/mapStore/map/sagas.d.ts +1 -1
  46. package/lib/store/mapStore/service/selectors.d.ts +0 -27
  47. package/lib/store/mapStore/service/types.d.ts +9 -2
  48. package/lib/store/ui/selectors.d.ts +5 -5
  49. package/lib/store/ui/types.d.ts +11 -3
  50. package/lib/store/utils.d.ts +2 -0
  51. package/lib/utils/__mocks__/getCapabilities.d.ts +2 -14
  52. package/lib/utils/defaultTestSettings.d.ts +3 -1
  53. package/package.json +10 -9
  54. package/lib/components/TimeSlider/TimeSliderScaleSlider/TimeSliderScaleSlider.d.ts +0 -12
  55. package/lib/components/TimeSlider/TimeSliderScaleSlider/TimeSliderScaleSlider.stories.d.ts +0 -13
  56. package/lib/components/TimeSlider/TimeSliderScaleSlider/TimeSliderScaleSliderConnect.d.ts +0 -24
package/index.umd.js CHANGED
@@ -1,8 +1,8 @@
1
1
  (function (global, factory) {
2
- typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@reduxjs/toolkit'), require('immer'), require('moment'), require('react'), require('lodash'), require('redux-saga/effects'), require('react-redux'), require('@mui/material'), require('@opengeoweb/shared'), require('@opengeoweb/theme'), require('@opengeoweb/webmap'), require('react-sortablejs'), require('@opengeoweb/form-fields'), require('react-hook-form'), require('react-window'), require('@mui/material/Box'), require('@mui/material/Typography'), require('@mui/material/Grid'), require('throttle-debounce'), require('lodash.clonedeep'), require('proj4'), require('@turf/turf'), require('redux-dynamic-modules'), require('redux-dynamic-modules-saga')) :
3
- typeof define === 'function' && define.amd ? define(['exports', '@reduxjs/toolkit', 'immer', 'moment', 'react', 'lodash', 'redux-saga/effects', 'react-redux', '@mui/material', '@opengeoweb/shared', '@opengeoweb/theme', '@opengeoweb/webmap', 'react-sortablejs', '@opengeoweb/form-fields', 'react-hook-form', 'react-window', '@mui/material/Box', '@mui/material/Typography', '@mui/material/Grid', 'throttle-debounce', 'lodash.clonedeep', 'proj4', '@turf/turf', 'redux-dynamic-modules', 'redux-dynamic-modules-saga'], factory) :
4
- (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.Core = {}, global.toolkit, global.produce, global.moment, global.React, global._, global.effects, global.reactRedux, global.material, global.shared, global.theme, global.webmap, global.reactSortablejs, global.formFields, global.reactHookForm, global.reactWindow, global.Box, global.Typography, global.Grid, global.throttleDebounce, global.cloneDeep, global.proj4, global.turf, global.reduxDynamicModules, global.reduxDynamicModulesSaga));
5
- })(this, (function (exports, toolkit, produce, moment, React, _, effects, reactRedux, material, shared, theme, webmap, reactSortablejs, formFields, reactHookForm, reactWindow, Box, Typography, Grid, throttleDebounce, cloneDeep, proj4, turf, reduxDynamicModules, reduxDynamicModulesSaga) { 'use strict';
2
+ typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@reduxjs/toolkit'), require('immer'), require('moment'), require('react'), require('lodash'), require('redux-saga/effects'), require('react-redux'), require('@mui/material'), require('@opengeoweb/shared'), require('@opengeoweb/theme'), require('@opengeoweb/webmap'), require('react-sortablejs'), require('sortablejs'), require('@opengeoweb/form-fields'), require('react-hook-form'), require('react-window'), require('@mui/material/Box'), require('@mui/material/Typography'), require('@mui/material/Grid'), require('@mui/material/Tooltip'), require('throttle-debounce'), require('lodash.clonedeep'), require('proj4'), require('@turf/turf'), require('redux-dynamic-modules'), require('redux-dynamic-modules-saga')) :
3
+ typeof define === 'function' && define.amd ? define(['exports', '@reduxjs/toolkit', 'immer', 'moment', 'react', 'lodash', 'redux-saga/effects', 'react-redux', '@mui/material', '@opengeoweb/shared', '@opengeoweb/theme', '@opengeoweb/webmap', 'react-sortablejs', 'sortablejs', '@opengeoweb/form-fields', 'react-hook-form', 'react-window', '@mui/material/Box', '@mui/material/Typography', '@mui/material/Grid', '@mui/material/Tooltip', 'throttle-debounce', 'lodash.clonedeep', 'proj4', '@turf/turf', 'redux-dynamic-modules', 'redux-dynamic-modules-saga'], factory) :
4
+ (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.Core = {}, global.toolkit, global.produce, global.moment, global.React, global._, global.effects, global.reactRedux, global.material, global.shared, global.theme, global.webmap, global.reactSortablejs, global.Sortable, global.formFields, global.reactHookForm, global.reactWindow, global.Box, global.Typography, global.Grid, global.Tooltip, global.throttleDebounce, global.cloneDeep, global.proj4, global.turf, global.reduxDynamicModules, global.reduxDynamicModulesSaga));
5
+ })(this, (function (exports, toolkit, produce, moment, React, _, effects, reactRedux, material, shared, theme, webmap, reactSortablejs, Sortable, formFields, reactHookForm, reactWindow, Box, Typography, Grid, Tooltip, throttleDebounce, cloneDeep, proj4, turf, reduxDynamicModules, reduxDynamicModulesSaga) { 'use strict';
6
6
 
7
7
  function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
8
8
 
@@ -29,9 +29,11 @@
29
29
  var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
30
30
  var React__namespace = /*#__PURE__*/_interopNamespace(React);
31
31
  var ___default = /*#__PURE__*/_interopDefaultLegacy(_);
32
+ var Sortable__default = /*#__PURE__*/_interopDefaultLegacy(Sortable);
32
33
  var Box__default = /*#__PURE__*/_interopDefaultLegacy(Box);
33
34
  var Typography__default = /*#__PURE__*/_interopDefaultLegacy(Typography);
34
35
  var Grid__default = /*#__PURE__*/_interopDefaultLegacy(Grid);
36
+ var Tooltip__default = /*#__PURE__*/_interopDefaultLegacy(Tooltip);
35
37
  var cloneDeep__default = /*#__PURE__*/_interopDefaultLegacy(cloneDeep);
36
38
  var proj4__default = /*#__PURE__*/_interopDefaultLegacy(proj4);
37
39
  var turf__namespace = /*#__PURE__*/_interopNamespace(turf);
@@ -437,6 +439,7 @@
437
439
  get LayerActionOrigin () { return LayerActionOrigin; }
438
440
  });
439
441
 
442
+ var millisecondsInSecond = 1000;
440
443
  var defaultAnimationDelayAtStart = 250;
441
444
  var defaultDelay = 1000; // [ms]
442
445
 
@@ -567,50 +570,6 @@
567
570
  */
568
571
  [2147483647, 0]);
569
572
  };
570
- var getNextTimeStepvalue = function getNextTimeStepvalue(value, max) {
571
- var newValue = value + 1;
572
- return newValue > max ? max : newValue;
573
- };
574
- var getPreviousTimeStepvalue = function getPreviousTimeStepvalue(value, min) {
575
- var newValue = value - 1;
576
- return newValue < min ? min : newValue;
577
- };
578
- var getValueFromKeyboardEvent = function getValueFromKeyboardEvent(event, value, min, max, supportFourDirectionNavigation) {
579
- if (supportFourDirectionNavigation === void 0) {
580
- supportFourDirectionNavigation = false;
581
- }
582
-
583
- if (!supportFourDirectionNavigation) {
584
- if (event.ctrlKey || event.metaKey) {
585
- switch (event.key) {
586
- case 'ArrowDown':
587
- return getPreviousTimeStepvalue(value, min);
588
-
589
- case 'ArrowUp':
590
- return getNextTimeStepvalue(value, max);
591
-
592
- default:
593
- return null;
594
- }
595
- }
596
- } else {
597
- // currently supportFourDirectionNavigation (left/right/up/down) is only used in horizontal slider TimeSliderScaleSlider
598
- switch (event.key) {
599
- case 'ArrowDown':
600
- case 'ArrowLeft':
601
- return getPreviousTimeStepvalue(value, min);
602
-
603
- case 'ArrowUp':
604
- case 'ArrowRight':
605
- return getNextTimeStepvalue(value, max);
606
-
607
- default:
608
- return null;
609
- }
610
- }
611
-
612
- return null;
613
- };
614
573
  var getTimeStepFromDataInterval = function getTimeStepFromDataInterval(timeInterval) {
615
574
  switch (timeInterval.isRegularInterval) {
616
575
  case false:
@@ -768,6 +727,25 @@
768
727
  var getAutoMoveAreaWidth = function getAutoMoveAreaWidth(scale) {
769
728
  return (scale === Scale.Year ? needleGeom.largeWidth : needleGeom.smallWidth) / 2 + AUTO_MOVE_AREA_PADDING;
770
729
  };
730
+ /** Reusable business logic for how to handle events that set time to now (closest).
731
+ * Used in NowButton and TimeSliderLegend.
732
+ */
733
+
734
+ var handleSetNowEvent = function handleSetNowEvent(timeStep, dataStartTime, dataEndTime, currentTime, onSetNewDate, onSetCenterTime) {
735
+ if (dataStartTime < dataEndTime) {
736
+ if (dataEndTime < currentTime) {
737
+ onSetNewDate(moment__default["default"].utc(dataEndTime * millisecondsInSecond).toISOString());
738
+ onSetCenterTime(dataEndTime);
739
+ } else if (dataStartTime > currentTime) {
740
+ onSetNewDate(moment__default["default"].utc(dataStartTime * millisecondsInSecond).toISOString());
741
+ onSetCenterTime(dataStartTime);
742
+ } else {
743
+ var closestToCurrent = roundWithTimeStep(currentTime, timeStep);
744
+ onSetNewDate(moment__default["default"].utc(closestToCurrent * millisecondsInSecond).toISOString());
745
+ onSetCenterTime(closestToCurrent);
746
+ }
747
+ }
748
+ };
771
749
 
772
750
  var createMap = function createMap(_a) {
773
751
  var id = _a.id,
@@ -1697,6 +1675,9 @@
1697
1675
  resultEqualityCheck: _.isEqual
1698
1676
  }
1699
1677
  };
1678
+ var isUserAddedService = function isUserAddedService(scope) {
1679
+ return scope === 'user';
1680
+ };
1700
1681
 
1701
1682
  /* *
1702
1683
  * Licensed under the Apache License, Version 2.0 (the "License");
@@ -1818,25 +1799,6 @@
1818
1799
  var getLayerStyles$1 = toolkit.createSelector(getLayerFromService, function (layer) {
1819
1800
  return layer && layer.styles ? layer.styles : [];
1820
1801
  }, selectorMemoizationOptions);
1821
- /**
1822
- * Gets services and maps them into an array
1823
- *
1824
- * Example: services = getServices(store)
1825
- * @param {object} store store: object - Store object
1826
- * @returns {array} returnType: [] - array containing services
1827
- */
1828
-
1829
- toolkit.createSelector(servicesStore, function (store) {
1830
- var services = store ? store.byId : {};
1831
- var arrayOfServiceObjects = Object.keys(services).map(function (key) {
1832
- return {
1833
- name: services[key].name,
1834
- serviceUrl: services[key].serviceUrl,
1835
- isUserAddedService: services[key].isUserAddedService
1836
- };
1837
- });
1838
- return arrayOfServiceObjects;
1839
- }, selectorMemoizationOptions);
1840
1802
 
1841
1803
  /* *
1842
1804
  * Licensed under the Apache License, Version 2.0 (the "License");
@@ -2941,7 +2903,7 @@
2941
2903
  *
2942
2904
  * Example: getDialogDetailsByType(store, 'legend')
2943
2905
  * @param {object} store store object from which the ui state wll be extracted
2944
- * @param {string} dialogType type of the dialog 'legend' | 'layerManager' | 'dimensionSelect-elevation'
2906
+ * @param {string} dialogType type of the dialog
2945
2907
  * @returns {array} [string, boolean] first element gives the active map id, second element whether the dialog is open
2946
2908
  */
2947
2909
 
@@ -2956,7 +2918,7 @@
2956
2918
  * For a given ui component: gets wether the dialog is open or closed
2957
2919
  *
2958
2920
  * @param {object} store store object from which the ui state wll be extracted
2959
- * @param {string} dialogType type of the dialog 'legend' | 'layerManager' | 'dimensionSelect-elevation'
2921
+ * @param {string} dialogType type of the dialog
2960
2922
  * @returns {boolean} returnType: boolean
2961
2923
  */
2962
2924
 
@@ -2971,7 +2933,7 @@
2971
2933
  *For a given ui component: gets the active map Id
2972
2934
  *
2973
2935
  * @param {object} store store object from which the ui state wll be extracted
2974
- * @param {string} dialogType type of the dialog 'legend' | 'layerManager' | 'dimensionSelect-elevation'
2936
+ * @param {string} dialogType type of the dialog
2975
2937
  * @returns {string} returnType: string - the active map id
2976
2938
  */
2977
2939
 
@@ -2986,7 +2948,7 @@
2986
2948
  *For a given ui component: gets the order of visible dialog
2987
2949
  *
2988
2950
  * @param {object} store store object from which the ui state wll be extracted
2989
- * @param {DialogType} dialogType type of the dialog 'legend' | 'layerManager' | 'dimensionSelect-elevation' | dimensionSelect-ensemble_member
2951
+ * @param {DialogType} dialogType type of the dialog
2990
2952
  * @returns {number} the higher the order number the higher the zIndex
2991
2953
  */
2992
2954
 
@@ -3012,7 +2974,7 @@
3012
2974
  *For a given ui component: returns if ordered on top
3013
2975
  *
3014
2976
  * @param {object} store store object from which the ui state wll be extracted
3015
- * @param {DialogType} dialogType type of the dialog 'legend' | 'layerManager' | 'dimensionSelect-elevation' | dimensionSelect-ensemble_member
2977
+ * @param {DialogType} dialogType type of the dialog
3016
2978
  * @returns {boolean}
3017
2979
  */
3018
2980
 
@@ -4276,6 +4238,25 @@
4276
4238
  getMapPresetError: getMapPresetError
4277
4239
  });
4278
4240
 
4241
+ var DialogTypes;
4242
+
4243
+ (function (DialogTypes) {
4244
+ DialogTypes["LayerInfo"] = "layerInfo";
4245
+ DialogTypes["SyncGroups"] = "syncGroups";
4246
+ DialogTypes["TimeSeriesSelect"] = "timeSeriesSelect";
4247
+ DialogTypes["TimeSeriesManager"] = "timeSeriesManager";
4248
+ DialogTypes["KeywordFilter"] = "keywordFilter";
4249
+ DialogTypes["DimensionSelectEnsembleMember"] = "dimensionSelect-ensemble_member";
4250
+ DialogTypes["DimensionSelectElevation"] = "dimensionSelect-elevation";
4251
+ DialogTypes["LayerManager"] = "layerManager";
4252
+ DialogTypes["LayerSelect"] = "layerSelect";
4253
+ })(DialogTypes || (DialogTypes = {}));
4254
+
4255
+ var types = /*#__PURE__*/Object.freeze({
4256
+ __proto__: null,
4257
+ get DialogTypes () { return DialogTypes; }
4258
+ });
4259
+
4279
4260
  /* *
4280
4261
  * Licensed under the Apache License, Version 2.0 (the "License");
4281
4262
  * you may not use this file except in compliance with the License.
@@ -4315,7 +4296,7 @@
4315
4296
  };
4316
4297
  var slice$1 = toolkit.createSlice({
4317
4298
  initialState: initialState$1,
4318
- name: 'layerSelect',
4299
+ name: DialogTypes.LayerSelect,
4319
4300
  reducers: {
4320
4301
  setSearchFilter: function setSearchFilter(draft, action) {
4321
4302
  var filterText = action.payload.filterText;
@@ -4332,7 +4313,7 @@
4332
4313
  serviceUrl = _a.serviceUrl,
4333
4314
  _abstract = _a["abstract"],
4334
4315
  keywords = _a.keywords,
4335
- isUserAddedService = _a.isUserAddedService,
4316
+ scope = _a.scope,
4336
4317
  groups = _a.groups;
4337
4318
 
4338
4319
  if (!draft.filters.activeServices.byId[serviceId]) {
@@ -4372,7 +4353,7 @@
4372
4353
  serviceId: serviceId,
4373
4354
  enabled: draft.allServicesEnabled,
4374
4355
  filterIds: filterIds,
4375
- isUserAddedService: isUserAddedService,
4356
+ scope: scope,
4376
4357
  serviceName: serviceName,
4377
4358
  serviceUrl: serviceUrl,
4378
4359
  "abstract": _abstract
@@ -4477,6 +4458,61 @@
4477
4458
  var reducer$1 = slice$1.reducer;
4478
4459
  var layerSelectActions = slice$1.actions;
4479
4460
 
4461
+ /* *
4462
+ * Licensed under the Apache License, Version 2.0 (the "License");
4463
+ * you may not use this file except in compliance with the License.
4464
+ * You may obtain a copy of the License at
4465
+ *
4466
+ * http://www.apache.org/licenses/LICENSE-2.0
4467
+ *
4468
+ * Unless required by applicable law or agreed to in writing, software
4469
+ * distributed under the License is distributed on an "AS IS" BASIS,
4470
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
4471
+ * See the License for the specific language governing permissions and
4472
+ * limitations under the License.
4473
+ *
4474
+ * Copyright 2021 - Koninklijk Nederlands Meteorologisch Instituut (KNMI)
4475
+ * Copyright 2021 - Finnish Meteorological Institute (FMI)
4476
+ * */
4477
+ var filterLayersFromService = function filterLayersFromService(serviceId, services, filterIds, allFiltersActive, searchString) {
4478
+ var mapStoreService = services[serviceId];
4479
+ if (!mapStoreService) return [];
4480
+
4481
+ if (searchString === '' && allFiltersActive) {
4482
+ return mapStoreService.layers.filter(function (layer) {
4483
+ return layer.leaf;
4484
+ });
4485
+ }
4486
+
4487
+ var searchStringArray = searchString.split(' ');
4488
+ return mapStoreService.layers.filter(function (layer) {
4489
+ return searchStringArray.every(function (search) {
4490
+ var _a, _b, _c;
4491
+
4492
+ var searchLowercase = search.toLowerCase();
4493
+ var layerFilterIds = layer.path.map(function (group) {
4494
+ return "groups-" + group;
4495
+ }).concat(layer.keywords.map(function (keyword) {
4496
+ return "keywords-" + keyword;
4497
+ }));
4498
+ var isFilterInLayer = (layerFilterIds === null || layerFilterIds === void 0 ? void 0 : layerFilterIds.some(function (id) {
4499
+ return filterIds.includes(id);
4500
+ })) || allFiltersActive;
4501
+ var isSearchTextInLayerFilter = layerFilterIds === null || layerFilterIds === void 0 ? void 0 : layerFilterIds.some(function (filterId) {
4502
+ return filterId.toLowerCase().includes(searchLowercase);
4503
+ });
4504
+ var isSearchTextInLayerName = (_a = layer.name) === null || _a === void 0 ? void 0 : _a.toLowerCase().includes(searchLowercase);
4505
+ var isSearchTextInLayerText = (_b = layer.text) === null || _b === void 0 ? void 0 : _b.toLowerCase().includes(searchLowercase);
4506
+ var isSearchTextInLayerAbstract = (_c = layer["abstract"]) === null || _c === void 0 ? void 0 : _c.toLowerCase().includes(searchLowercase);
4507
+ var isSearchTextInServiceName = mapStoreService.name.toLowerCase().includes(searchLowercase);
4508
+ var isSearchTextInLayer = isSearchTextInLayerName || isSearchTextInLayerText || isSearchTextInLayerAbstract || isSearchTextInLayerFilter || isSearchTextInServiceName;
4509
+ return isFilterInLayer && isSearchTextInLayer;
4510
+ });
4511
+ }).filter(function (layer) {
4512
+ return layer.leaf;
4513
+ });
4514
+ };
4515
+
4480
4516
  /* *
4481
4517
  * Licensed under the Apache License, Version 2.0 (the "License");
4482
4518
  * you may not use this file except in compliance with the License.
@@ -4635,6 +4671,22 @@
4635
4671
  var getActiveLayerInfo = toolkit.createSelector(layerSelectStore, function (store) {
4636
4672
  return store === null || store === void 0 ? void 0 : store.activeLayerInfo;
4637
4673
  });
4674
+ /**
4675
+ * Returns a filtered active layer object based on the given filter settings
4676
+ * Example: layerSelectSelectors.getFilteredLayers(store, filteredSettings);
4677
+ * @param {object} store store: object - object from which the service state will be extracted
4678
+ * @returns {array} returnType: ActiveLayerObject - an array of all filtered activelayers
4679
+ */
4680
+
4681
+ var getFilteredLayers = toolkit.createSelector([getEnabledServiceIds, getServices, getCheckedFilterIds, isAllFiltersChecked, getSearchFilter], function (enabledServiceIds, servicesStore, checkedFilterIds, allFiltersActive, searchFilter) {
4682
+ return enabledServiceIds.reduce(function (layerList, serviceId) {
4683
+ return layerList.concat(filterLayersFromService(serviceId, servicesStore, checkedFilterIds, allFiltersActive, searchFilter).map(function (layer) {
4684
+ return __assign(__assign({}, layer), {
4685
+ serviceName: serviceId
4686
+ });
4687
+ }));
4688
+ }, []);
4689
+ }, selectorMemoizationOptions);
4638
4690
 
4639
4691
  /* *
4640
4692
  * Licensed under the Apache License, Version 2.0 (the "License");
@@ -4708,17 +4760,6 @@
4708
4760
  return currentMessages.length > 0 ? currentMessages[0] : undefined;
4709
4761
  });
4710
4762
 
4711
- var DialogTypes;
4712
-
4713
- (function (DialogTypes) {
4714
- DialogTypes["LayerInfo"] = "layerInfo";
4715
- })(DialogTypes || (DialogTypes = {}));
4716
-
4717
- var types = /*#__PURE__*/Object.freeze({
4718
- __proto__: null,
4719
- get DialogTypes () { return DialogTypes; }
4720
- });
4721
-
4722
4763
  /* *
4723
4764
  * Licensed under the Apache License, Version 2.0 (the "License");
4724
4765
  * you may not use this file except in compliance with the License.
@@ -6056,9 +6097,7 @@
6056
6097
  var isAnimating = _a.isAnimating,
6057
6098
  isDisabled = _a.isDisabled,
6058
6099
  _b = _a.onTogglePlayButton,
6059
- onTogglePlayButton = _b === void 0 ? function () {
6060
- return null;
6061
- } : _b;
6100
+ onTogglePlayButton = _b === void 0 ? function () {} : _b;
6062
6101
 
6063
6102
  var onTogglePlay = function onTogglePlay() {
6064
6103
  onTogglePlayButton();
@@ -7177,6 +7216,84 @@
7177
7216
  return CanvasComponent;
7178
7217
  }(React.Component);
7179
7218
 
7219
+ /* *
7220
+ * Licensed under the Apache License, Version 2.0 (the "License");
7221
+ * you may not use this file except in compliance with the License.
7222
+ * You may obtain a copy of the License at
7223
+ *
7224
+ * http://www.apache.org/licenses/LICENSE-2.0
7225
+ *
7226
+ * Unless required by applicable law or agreed to in writing, software
7227
+ * distributed under the License is distributed on an "AS IS" BASIS,
7228
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
7229
+ * See the License for the specific language governing permissions and
7230
+ * limitations under the License.
7231
+ *
7232
+ * Copyright 2022 - Koninklijk Nederlands Meteorologisch Instituut (KNMI)
7233
+ * Copyright 2022 - Finnish Meteorological Institute (FMI)
7234
+ * */
7235
+
7236
+ var LegendLayout = function LegendLayout(_a) {
7237
+ var title = _a.title,
7238
+ name = _a.name,
7239
+ dimensions = _a.dimensions,
7240
+ children = _a.children,
7241
+ height = _a.height,
7242
+ width = _a.width,
7243
+ minWidth = _a.minWidth;
7244
+ return /*#__PURE__*/React__default["default"].createElement(material.Paper, {
7245
+ "data-testid": "legend",
7246
+ sx: {
7247
+ padding: '10px',
7248
+ border: '1px solid grey',
7249
+ backgroundColor: '#FFF',
7250
+ overflow: 'hidden',
7251
+ marginBottom: 0.5
7252
+ }
7253
+ }, /*#__PURE__*/React__default["default"].createElement(material.Box, {
7254
+ "data-testid": "legend-title"
7255
+ }, /*#__PURE__*/React__default["default"].createElement(material.Typography, {
7256
+ sx: {
7257
+ fontFamily: 'Roboto, Helvetica, Arial',
7258
+ fontSize: '10px',
7259
+ minWidth: '100%',
7260
+ wordWrap: 'break-word',
7261
+ color: 'common.black',
7262
+ whiteSpace: 'nowrap'
7263
+ },
7264
+ variant: "h3"
7265
+ }, title)), /*#__PURE__*/React__default["default"].createElement(material.Tooltip, {
7266
+ title: title || 'loading',
7267
+ placement: "top"
7268
+ }, /*#__PURE__*/React__default["default"].createElement(material.Box, {
7269
+ sx: {
7270
+ margin: '10px 0px 10px 0px',
7271
+ height: height + "px",
7272
+ width: width + "px"
7273
+ }
7274
+ }, children)), /*#__PURE__*/React__default["default"].createElement(material.Box, {
7275
+ "data-testid": "legend-info",
7276
+ sx: __assign({
7277
+ fontFamily: 'Roboto, Helvetica, Arial',
7278
+ fontSize: 10,
7279
+ color: 'common.black',
7280
+ overflowX: 'hidden',
7281
+ wordWrap: 'break-word',
7282
+ whiteSpace: 'nowrap'
7283
+ }, minWidth && {
7284
+ minWidth: minWidth + "px"
7285
+ })
7286
+ }, dimensions && dimensions.map(function (dim) {
7287
+ return /*#__PURE__*/React__default["default"].createElement(material.Box, {
7288
+ key: name + dim.name
7289
+ }, dim.name === 'time' ? "" + dim.currentValue : /*#__PURE__*/React__default["default"].createElement(React__default["default"].Fragment, null, /*#__PURE__*/React__default["default"].createElement(material.Box, {
7290
+ style: {
7291
+ fontWeight: 500
7292
+ }
7293
+ }, dim.name, ":"), dim.currentValue, " ", dim.units));
7294
+ })));
7295
+ };
7296
+
7180
7297
  /* *
7181
7298
  * Licensed under the Apache License, Version 2.0 (the "License");
7182
7299
  * you may not use this file except in compliance with the License.
@@ -7271,46 +7388,20 @@
7271
7388
  like a title and the WMS legendgraphic url */
7272
7389
 
7273
7390
  var wmLayer = getWMLayerById(layer.id);
7274
- return /*#__PURE__*/React__default["default"].createElement(material.Paper, {
7275
- "data-testid": "legend",
7276
- sx: {
7277
- padding: '10px',
7278
- border: '1px solid grey',
7279
- display: 'inline-block',
7280
- backgroundColor: '#FFF',
7281
- overflow: 'hidden',
7282
- marginBottom: 0.5
7283
- }
7284
- }, /*#__PURE__*/React__default["default"].createElement(material.Box, {
7285
- "data-testid": "legend-title",
7286
- style: {
7287
- maxWidth: canvasContainerWidth
7288
- }
7289
- }, /*#__PURE__*/React__default["default"].createElement(material.Typography, {
7290
- sx: {
7291
- fontFamily: 'Roboto, Helvetica, Arial',
7292
- fontSize: '10px',
7293
- minWidth: defaultCanvasWidth + "px",
7294
- wordWrap: 'break-word',
7295
- color: 'common.black'
7296
- },
7297
- variant: "h3"
7298
- }, wmLayer && wmLayer.title)), /*#__PURE__*/React__default["default"].createElement(material.Tooltip, {
7299
- title: wmLayer && wmLayer.title || 'loading',
7300
- placement: "top"
7301
- }, /*#__PURE__*/React__default["default"].createElement(material.Box, {
7302
- sx: {
7303
- margin: '10px 0px 10px 0px',
7304
- height: canvasContainerHeight + "px",
7305
- width: canvasContainerWidth + "px"
7306
- }
7391
+ return /*#__PURE__*/React__default["default"].createElement(LegendLayout, {
7392
+ title: wmLayer === null || wmLayer === void 0 ? void 0 : wmLayer.title,
7393
+ name: wmLayer === null || wmLayer === void 0 ? void 0 : wmLayer.name,
7394
+ dimensions: layer === null || layer === void 0 ? void 0 : layer.dimensions,
7395
+ height: canvasContainerHeight,
7396
+ width: canvasContainerWidth,
7397
+ minWidth: defaultCanvasWidth
7307
7398
  }, /*#__PURE__*/React__default["default"].createElement(CanvasComponent, {
7308
7399
  redrawInterval: 500,
7309
7400
  onRenderCanvas: function onRenderCanvas(ctx, width, height) {
7310
7401
  /*
7311
- Check if the wmLayer is available, this happens when the WMS GetCapabilities is loaded and parsed.
7312
- Note that we cannot use the wmLayer variable above, as this one could contain a non initialized WMJSLayer.
7313
- */
7402
+ Check if the wmLayer is available, this happens when the WMS GetCapabilities is loaded and parsed.
7403
+ Note that we cannot use the wmLayer variable above, as this one could contain a non initialized WMJSLayer.
7404
+ */
7314
7405
  var legendWmLayer = getWMLayerById(layer.id);
7315
7406
  var legendUrl = webmap.getLegendGraphicURLForLayer(legendWmLayer);
7316
7407
  var image = webmap.legendImageStore.getImage(legendUrl);
@@ -7359,26 +7450,7 @@
7359
7450
  renderLegendGraphic(previousLegendImage.current, ctx, imageWidth, imageHeight);
7360
7451
  }
7361
7452
  }
7362
- }))), /*#__PURE__*/React__default["default"].createElement(material.Box, {
7363
- "data-testid": "legend-info",
7364
- sx: {
7365
- fontFamily: 'Roboto, Helvetica, Arial',
7366
- fontSize: 10,
7367
- color: 'common.black',
7368
- overflowX: 'hidden',
7369
- minWidth: defaultCanvasWidth + "px",
7370
- wordWrap: 'break-word',
7371
- maxWidth: canvasContainerWidth + "px"
7372
- }
7373
- }, layer.dimensions && layer.dimensions.map(function (dim) {
7374
- return /*#__PURE__*/React__default["default"].createElement(material.Box, {
7375
- key: layer.name + dim.name
7376
- }, dim.name === 'time' ? "" + dim.currentValue : /*#__PURE__*/React__default["default"].createElement(React__default["default"].Fragment, null, /*#__PURE__*/React__default["default"].createElement(material.Box, {
7377
- style: {
7378
- fontWeight: 500
7379
- }
7380
- }, dim.name, ":"), dim.currentValue, " ", dim.units));
7381
- })));
7453
+ }));
7382
7454
  };
7383
7455
 
7384
7456
  /* *
@@ -7630,8 +7702,8 @@
7630
7702
  switch (_b.label) {
7631
7703
  case 0:
7632
7704
  mapId = payload.mapId, start = payload.start, end = payload.end, interval = payload.interval, timeList = payload.timeList;
7633
- roundedStart = roundWithTimeStep(start && moment__default["default"].utc(start).unix(), interval, 'ceil');
7634
- roundedEnd = roundWithTimeStep(end && moment__default["default"].utc(end).unix(), interval, 'floor');
7705
+ roundedStart = roundWithTimeStep(Number(start && moment__default["default"].utc(start).unix()), interval, 'ceil');
7706
+ roundedEnd = roundWithTimeStep(Number(end && moment__default["default"].utc(end).unix()), interval, 'floor');
7635
7707
  return [4
7636
7708
  /*yield*/
7637
7709
  , timeList || generateTimeList(moment__default["default"].utc(roundedStart * 1000), moment__default["default"].utc(roundedEnd * 1000), interval)];
@@ -8483,7 +8555,7 @@
8483
8555
  service = _c[1];
8484
8556
 
8485
8557
  return __assign(__assign({}, userServices), isNoIdService(service) ? (_b = {}, _b[serviceUrl] = __assign(__assign({}, service), {
8486
- isUserAddedService: true
8558
+ scope: 'user'
8487
8559
  }), _b) : {});
8488
8560
  }, {});
8489
8561
  }
@@ -8523,13 +8595,13 @@
8523
8595
  * Copyright 2022 - Finnish Meteorological Institute (FMI)
8524
8596
  * */
8525
8597
  function newServiceAddedSaga(capturedAction) {
8526
- var addedService, id, serviceUrl, name, isUserAddedService, _abstract, keywords, groups;
8598
+ var addedService, id, serviceUrl, name, scope, _abstract, keywords, groups;
8527
8599
 
8528
8600
  return __generator(this, function (_a) {
8529
8601
  switch (_a.label) {
8530
8602
  case 0:
8531
8603
  addedService = capturedAction.payload;
8532
- id = addedService.id, serviceUrl = addedService.serviceUrl, name = addedService.name, isUserAddedService = addedService.isUserAddedService, _abstract = addedService["abstract"];
8604
+ id = addedService.id, serviceUrl = addedService.serviceUrl, name = addedService.name, scope = addedService.scope, _abstract = addedService["abstract"];
8533
8605
  keywords = addedService.layers.reduce(function (keywords, layer) {
8534
8606
  var _a;
8535
8607
 
@@ -8555,7 +8627,7 @@
8555
8627
  serviceName: name,
8556
8628
  serviceUrl: serviceUrl,
8557
8629
  keywords: keywords,
8558
- isUserAddedService: isUserAddedService,
8630
+ scope: scope,
8559
8631
  groups: groups,
8560
8632
  "abstract": _abstract
8561
8633
  }))];
@@ -8628,11 +8700,11 @@
8628
8700
  var _b;
8629
8701
 
8630
8702
  var payload = _a.payload;
8631
- var isUserAddedService = payload.isUserAddedService,
8703
+ var scope = payload.scope,
8632
8704
  name = payload.name,
8633
8705
  serviceUrl = payload.serviceUrl,
8634
8706
  _abstract2 = payload["abstract"];
8635
- if (!isUserAddedService) return;
8707
+ if (!isUserAddedService(scope)) return;
8636
8708
  var localStorageServices = getUserAddedServices();
8637
8709
  setUserAddedServices(__assign(__assign({}, localStorageServices), (_b = {}, _b[serviceUrl] = {
8638
8710
  name: name,
@@ -9818,14 +9890,14 @@
9818
9890
  source = _b === void 0 ? 'app' : _b;
9819
9891
  var dispatch = reactRedux.useDispatch();
9820
9892
  var currentActiveMapId = reactRedux.useSelector(function (store) {
9821
- return getDialogMapId(store, 'layerSelect');
9893
+ return getDialogMapId(store, DialogTypes.LayerSelect);
9822
9894
  });
9823
9895
  var isOpenInStore = reactRedux.useSelector(function (store) {
9824
- return getisDialogOpen(store, 'layerSelect');
9896
+ return getisDialogOpen(store, DialogTypes.LayerSelect);
9825
9897
  });
9826
9898
  var openLayerSelectDialog = React__namespace.useCallback(function () {
9827
9899
  dispatch(uiActions.setActiveMapIdForDialog({
9828
- type: 'layerSelect',
9900
+ type: DialogTypes.LayerSelect,
9829
9901
  mapId: mapId,
9830
9902
  setOpen: currentActiveMapId !== mapId ? true : !isOpenInStore,
9831
9903
  source: source
@@ -11288,7 +11360,7 @@
11288
11360
  var onStart = React__namespace.useCallback(function (_a) {
11289
11361
  var oldIndex = _a.oldIndex;
11290
11362
  setActiveDragIndex(oldIndex);
11291
- reactSortablejs.Sortable.ghost.style.opacity = '1';
11363
+ Sortable__default["default"].ghost.style.opacity = '1';
11292
11364
  }, []);
11293
11365
  var onEnd = React__namespace.useCallback(function () {
11294
11366
  if (activeDragIndex !== null) {
@@ -11786,14 +11858,14 @@
11786
11858
  source = _b === void 0 ? 'app' : _b;
11787
11859
  var dispatch = reactRedux.useDispatch();
11788
11860
  var currentActiveMapId = reactRedux.useSelector(function (store) {
11789
- return getDialogMapId(store, 'keywordFilter');
11861
+ return getDialogMapId(store, DialogTypes.KeywordFilter);
11790
11862
  });
11791
11863
  var isOpenInStore = reactRedux.useSelector(function (store) {
11792
- return getisDialogOpen(store, 'keywordFilter');
11864
+ return getisDialogOpen(store, DialogTypes.KeywordFilter);
11793
11865
  });
11794
11866
  var openFilterResultsDialog = React__namespace.useCallback(function () {
11795
11867
  dispatch(uiActions.setActiveMapIdForDialog({
11796
- type: 'keywordFilter',
11868
+ type: DialogTypes.KeywordFilter,
11797
11869
  mapId: mapId,
11798
11870
  setOpen: currentActiveMapId !== mapId ? true : !isOpenInStore,
11799
11871
  source: source
@@ -12145,7 +12217,7 @@
12145
12217
  serviceUrl: formValues.serviceUrl,
12146
12218
  "abstract": formValues.serviceAbstracts,
12147
12219
  layers: serviceLayers,
12148
- isUserAddedService: true
12220
+ scope: 'user'
12149
12221
  });
12150
12222
  setIsLoading(false);
12151
12223
  showSnackbar(getSuccesMessage(formValues.serviceName));
@@ -12301,8 +12373,8 @@
12301
12373
  })
12302
12374
  },
12303
12375
  disabled: isServiceUrlDisabled || isLoading,
12376
+ isReadOnly: isShowPopup,
12304
12377
  InputProps: {
12305
- readOnly: isShowPopup,
12306
12378
  disableUnderline: isShowPopup,
12307
12379
  endAdornment: isShowPopup && /*#__PURE__*/React__namespace.createElement(material.InputAdornment, {
12308
12380
  position: "end"
@@ -12325,8 +12397,8 @@
12325
12397
  }
12326
12398
  },
12327
12399
  disabled: isShowPopup || isLoading,
12400
+ isReadOnly: isShowPopup,
12328
12401
  InputProps: {
12329
- readOnly: isShowPopup,
12330
12402
  disableUnderline: isShowPopup
12331
12403
  },
12332
12404
  sx: style$1.textField,
@@ -12337,9 +12409,8 @@
12337
12409
  name: fields.serviceAbstracts.name,
12338
12410
  label: fields.serviceAbstracts.label,
12339
12411
  disabled: isShowPopup || isLoading,
12340
- rules: {},
12412
+ isReadOnly: isShowPopup,
12341
12413
  InputProps: {
12342
- readOnly: isShowPopup,
12343
12414
  disableUnderline: isShowPopup
12344
12415
  },
12345
12416
  helperText: !isShowPopup && 'Short description of what this service does',
@@ -12585,63 +12656,8 @@
12585
12656
  * See the License for the specific language governing permissions and
12586
12657
  * limitations under the License.
12587
12658
  *
12588
- * Copyright 2021 - Koninklijk Nederlands Meteorologisch Instituut (KNMI)
12589
- * Copyright 2021 - Finnish Meteorological Institute (FMI)
12590
- * */
12591
- var filterLayersFromService = function filterLayersFromService(serviceId, services, filterIds, allFiltersActive, searchString) {
12592
- var mapStoreService = services[serviceId];
12593
- if (!mapStoreService) return [];
12594
-
12595
- if (searchString === '' && allFiltersActive) {
12596
- return mapStoreService.layers.filter(function (layer) {
12597
- return layer.leaf;
12598
- });
12599
- }
12600
-
12601
- var searchStringArray = searchString.split(' ');
12602
- return mapStoreService.layers.filter(function (layer) {
12603
- return searchStringArray.every(function (search) {
12604
- var _a, _b, _c;
12605
-
12606
- var searchLowercase = search.toLowerCase();
12607
- var layerFilterIds = layer.path.map(function (group) {
12608
- return "group-" + group;
12609
- }).concat(layer.keywords.map(function (keyword) {
12610
- return "keyword-" + keyword;
12611
- }));
12612
- var isFilterInLayer = (layerFilterIds === null || layerFilterIds === void 0 ? void 0 : layerFilterIds.some(function (id) {
12613
- return filterIds.includes(id);
12614
- })) || allFiltersActive;
12615
- var isSearchTextInLayerFilter = layerFilterIds === null || layerFilterIds === void 0 ? void 0 : layerFilterIds.some(function (filterId) {
12616
- return filterId.toLowerCase().includes(searchLowercase);
12617
- });
12618
- var isSearchTextInLayerName = (_a = layer.name) === null || _a === void 0 ? void 0 : _a.toLowerCase().includes(searchLowercase);
12619
- var isSearchTextInLayerText = (_b = layer.text) === null || _b === void 0 ? void 0 : _b.toLowerCase().includes(searchLowercase);
12620
- var isSearchTextInLayerAbstract = (_c = layer["abstract"]) === null || _c === void 0 ? void 0 : _c.toLowerCase().includes(searchLowercase);
12621
- var isSearchTextInServiceName = mapStoreService.name.toLowerCase().includes(searchLowercase);
12622
- var isSearchTextInLayer = isSearchTextInLayerName || isSearchTextInLayerText || isSearchTextInLayerAbstract || isSearchTextInLayerFilter || isSearchTextInServiceName;
12623
- return isFilterInLayer && isSearchTextInLayer;
12624
- });
12625
- }).filter(function (layer) {
12626
- return layer.leaf;
12627
- });
12628
- };
12629
-
12630
- /* *
12631
- * Licensed under the Apache License, Version 2.0 (the "License");
12632
- * you may not use this file except in compliance with the License.
12633
- * You may obtain a copy of the License at
12634
- *
12635
- * http://www.apache.org/licenses/LICENSE-2.0
12636
- *
12637
- * Unless required by applicable law or agreed to in writing, software
12638
- * distributed under the License is distributed on an "AS IS" BASIS,
12639
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12640
- * See the License for the specific language governing permissions and
12641
- * limitations under the License.
12642
- *
12643
- * Copyright 2022 - Koninklijk Nederlands Meteorologisch Instituut (KNMI)
12644
- * Copyright 2022 - Finnish Meteorological Institute (FMI)
12659
+ * Copyright 2022 - Koninklijk Nederlands Meteorologisch Instituut (KNMI)
12660
+ * Copyright 2022 - Finnish Meteorological Institute (FMI)
12645
12661
  * */
12646
12662
 
12647
12663
  var LayerAddRemoveButton = function LayerAddRemoveButton(_a) {
@@ -12764,12 +12780,11 @@
12764
12780
  * Copyright 2022 - Koninklijk Nederlands Meteorologisch Instituut (KNMI)
12765
12781
  * Copyright 2022 - Finnish Meteorological Institute (FMI)
12766
12782
  * */
12767
- var textStyle$1 = {
12783
+ var textStyle = {
12768
12784
  lineHeight: '20px',
12769
12785
  letterSpacing: '0.25px'
12770
12786
  };
12771
-
12772
- var textStyleWithMargin = __assign(__assign({}, textStyle$1), {
12787
+ var textStyleWithMargin = __assign(__assign({}, textStyle), {
12773
12788
  marginBottom: 1
12774
12789
  });
12775
12790
 
@@ -12778,7 +12793,7 @@
12778
12793
  value = _a.value;
12779
12794
  return /*#__PURE__*/React__default["default"].createElement(React__default["default"].Fragment, null, /*#__PURE__*/React__default["default"].createElement(Typography__default["default"], {
12780
12795
  variant: "subtitle2",
12781
- sx: textStyle$1
12796
+ sx: textStyle
12782
12797
  }, label), /*#__PURE__*/React__default["default"].createElement(Typography__default["default"], {
12783
12798
  variant: "body2",
12784
12799
  sx: textStyleWithMargin
@@ -12801,10 +12816,6 @@
12801
12816
  * Copyright 2022 - Koninklijk Nederlands Meteorologisch Instituut (KNMI)
12802
12817
  * Copyright 2022 - Finnish Meteorological Institute (FMI)
12803
12818
  * */
12804
- var textStyle = {
12805
- lineHeight: '20px',
12806
- letterSpacing: '0.25px'
12807
- };
12808
12819
 
12809
12820
  var valueStyle = __assign(__assign({}, textStyle), {
12810
12821
  overflowWrap: 'break-word'
@@ -12816,12 +12827,15 @@
12816
12827
  return /*#__PURE__*/React__default["default"].createElement(React__default["default"].Fragment, null, /*#__PURE__*/React__default["default"].createElement(Typography__default["default"], {
12817
12828
  variant: "subtitle2",
12818
12829
  sx: textStyle
12819
- }, label), /*#__PURE__*/React__default["default"].createElement(Grid__default["default"], {
12830
+ }, label), list.length === 0 ? /*#__PURE__*/React__default["default"].createElement(Typography__default["default"], {
12831
+ variant: "body2",
12832
+ sx: textStyleWithMargin
12833
+ }, "-") : /*#__PURE__*/React__default["default"].createElement(Grid__default["default"], {
12820
12834
  container: true,
12821
12835
  direction: "column"
12822
12836
  }, list.map(function (item) {
12823
12837
  return /*#__PURE__*/React__default["default"].createElement("div", {
12824
- key: item.name
12838
+ key: item.label
12825
12839
  }, /*#__PURE__*/React__default["default"].createElement(Grid__default["default"], {
12826
12840
  item: true,
12827
12841
  container: true,
@@ -12834,7 +12848,7 @@
12834
12848
  }, /*#__PURE__*/React__default["default"].createElement(Typography__default["default"], {
12835
12849
  variant: "body2",
12836
12850
  sx: textStyle
12837
- }, item.name, ":"))), /*#__PURE__*/React__default["default"].createElement(Grid__default["default"], {
12851
+ }, item.label, ":"))), /*#__PURE__*/React__default["default"].createElement(Grid__default["default"], {
12838
12852
  item: true,
12839
12853
  container: true,
12840
12854
  direction: "row",
@@ -12849,6 +12863,41 @@
12849
12863
  })));
12850
12864
  };
12851
12865
 
12866
+ /* *
12867
+ * Licensed under the Apache License, Version 2.0 (the "License");
12868
+ * you may not use this file except in compliance with the License.
12869
+ * You may obtain a copy of the License at
12870
+ *
12871
+ * http://www.apache.org/licenses/LICENSE-2.0
12872
+ *
12873
+ * Unless required by applicable law or agreed to in writing, software
12874
+ * distributed under the License is distributed on an "AS IS" BASIS,
12875
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12876
+ * See the License for the specific language governing permissions and
12877
+ * limitations under the License.
12878
+ *
12879
+ * Copyright 2022 - Koninklijk Nederlands Meteorologisch Instituut (KNMI)
12880
+ * Copyright 2022 - Finnish Meteorological Institute (FMI)
12881
+ * */
12882
+
12883
+ var LayerInfoLegend = function LayerInfoLegend(_a) {
12884
+ var title = _a.title,
12885
+ name = _a.name,
12886
+ dimensions = _a.dimensions,
12887
+ legendURL = _a.legendURL;
12888
+ return /*#__PURE__*/React__default["default"].createElement(React__default["default"].Fragment, null, /*#__PURE__*/React__default["default"].createElement(Typography__default["default"], {
12889
+ variant: "subtitle2",
12890
+ sx: textStyleWithMargin
12891
+ }, "Legend"), /*#__PURE__*/React__default["default"].createElement(LegendLayout, {
12892
+ title: title,
12893
+ name: name,
12894
+ dimensions: dimensions
12895
+ }, legendURL ? /*#__PURE__*/React__default["default"].createElement("img", {
12896
+ alt: title,
12897
+ src: legendURL
12898
+ }) : '-'));
12899
+ };
12900
+
12852
12901
  /* *
12853
12902
  * Licensed under the Apache License, Version 2.0 (the "License");
12854
12903
  * you may not use this file except in compliance with the License.
@@ -12880,22 +12929,19 @@
12880
12929
 
12881
12930
  return styles.join(', ');
12882
12931
  };
12883
- var getDimensionValue = function getDimensionValue(name, layer, breakAt, includeUnit) {
12884
- var _a;
12885
-
12886
- if (includeUnit === void 0) {
12887
- includeUnit = false;
12888
- }
12889
-
12890
- var dimension = (_a = layer.dimensions) === null || _a === void 0 ? void 0 : _a.find(function (dimension) {
12891
- return dimension.name.toLowerCase() === name;
12932
+ var getDimensionValue = function getDimensionValue(name, dimensions) {
12933
+ var dimension = dimensions === null || dimensions === void 0 ? void 0 : dimensions.find(function (dimension) {
12934
+ return dimension.name.toLowerCase() === name.toLowerCase();
12892
12935
  });
12893
12936
 
12894
- if (!dimension) {
12895
- return '-';
12937
+ if (!dimension || !dimension.currentValue) {
12938
+ return null;
12896
12939
  }
12897
12940
 
12898
- var dimValue = dimension === null || dimension === void 0 ? void 0 : dimension.currentValue.split(breakAt).join(breakAt + " ");
12941
+ var dimName = dimension.name.toLowerCase();
12942
+ var breakAt = dimName === 'time' ? '/' : ',';
12943
+ var includeUnit = dimName !== 'time' && dimName !== 'reference_time';
12944
+ var dimValue = dimension.currentValue.split(breakAt).join(breakAt + " ");
12899
12945
 
12900
12946
  if (includeUnit) {
12901
12947
  return dimValue + " " + dimension.units;
@@ -12906,6 +12952,64 @@
12906
12952
  var getLayerBbox = function getLayerBbox(layer) {
12907
12953
  return layer.geographicBoundingBox ? "west " + layer.geographicBoundingBox.west + ", east " + layer.geographicBoundingBox.east + ", north " + layer.geographicBoundingBox.north + ", south " + layer.geographicBoundingBox.south : '-';
12908
12954
  };
12955
+ var getDimensionIcon$1 = function getDimensionIcon(name, dimensions) {
12956
+ var dimension = dimensions === null || dimensions === void 0 ? void 0 : dimensions.find(function (dimension) {
12957
+ return dimension.name.toLowerCase() === name.toLowerCase();
12958
+ });
12959
+
12960
+ if (!dimension) {
12961
+ return null;
12962
+ }
12963
+
12964
+ switch (dimension.name.toLowerCase()) {
12965
+ case 'time':
12966
+ return /*#__PURE__*/React__default["default"].createElement(theme.DimensionsTime, null);
12967
+
12968
+ case 'reference_time':
12969
+ return /*#__PURE__*/React__default["default"].createElement(theme.DimensionsRefTime, null);
12970
+
12971
+ case 'elevation':
12972
+ return /*#__PURE__*/React__default["default"].createElement(theme.DimensionsElevation, null);
12973
+
12974
+ default:
12975
+ return /*#__PURE__*/React__default["default"].createElement(theme.DimensionsOther, null);
12976
+ }
12977
+ };
12978
+ var getDimensionLabel = function getDimensionLabel(name) {
12979
+ var dimName = name.toLowerCase().split('_').join(' ');
12980
+ return dimName.charAt(0).toUpperCase() + dimName.slice(1);
12981
+ };
12982
+ var getDimensionsList = function getDimensionsList(dimensions) {
12983
+ var result = [];
12984
+ dimensions === null || dimensions === void 0 ? void 0 : dimensions.forEach(function (_a) {
12985
+ var name = _a.name;
12986
+ var value = getDimensionValue(name, dimensions);
12987
+
12988
+ if (!value) {
12989
+ return;
12990
+ }
12991
+
12992
+ var icon = getDimensionIcon$1(name, dimensions);
12993
+ var label = getDimensionLabel(name);
12994
+ result.push({
12995
+ label: label,
12996
+ value: value,
12997
+ icon: icon
12998
+ });
12999
+ }); // sort alphabetically so other dimensions are sorted
13000
+
13001
+ result.sort(function (a, b) {
13002
+ return a.label.localeCompare(b.label);
13003
+ }); // sort by fixed order
13004
+
13005
+ var preferredOrder = ['Time', 'Reference time', 'Elevation']; // using reverse ordering to make sure the other dimensions come last
13006
+
13007
+ preferredOrder.reverse();
13008
+ result.sort(function (a, b) {
13009
+ return preferredOrder.indexOf(b.label) - preferredOrder.indexOf(a.label);
13010
+ });
13011
+ return result;
13012
+ };
12909
13013
 
12910
13014
  /* *
12911
13015
  * Licensed under the Apache License, Version 2.0 (the "License");
@@ -12939,9 +13043,7 @@
12939
13043
  dialogHeight = _a.dialogHeight;
12940
13044
  var styles = getLayerStyles(layer);
12941
13045
  var bbox = getLayerBbox(layer);
12942
- var timeValue = getDimensionValue('time', layer, '/');
12943
- var refTimeValue = getDimensionValue('reference_time', layer, ',');
12944
- var elevationValue = getDimensionValue('elevation', layer, ',', true);
13046
+ var dimensions = getDimensionsList(layer.dimensions);
12945
13047
  return /*#__PURE__*/React__default["default"].createElement(shared.ToolContainerDraggable, {
12946
13048
  onClose: onClose,
12947
13049
  headerSize: "xs",
@@ -12976,23 +13078,7 @@
12976
13078
  value: layer["abstract"] || '-'
12977
13079
  }), /*#__PURE__*/React__default["default"].createElement(LayerInfoList, {
12978
13080
  label: "Dimensions",
12979
- list: [{
12980
- name: 'Time',
12981
- value: timeValue,
12982
- icon: /*#__PURE__*/React__default["default"].createElement(theme.DimensionsTime, null)
12983
- }, {
12984
- name: 'Reference Time',
12985
- value: refTimeValue,
12986
- icon: /*#__PURE__*/React__default["default"].createElement(theme.DimensionsRefTime, null)
12987
- }, {
12988
- name: 'Elevation',
12989
- value: elevationValue,
12990
- icon: /*#__PURE__*/React__default["default"].createElement(theme.DimensionsElevation, null)
12991
- }, {
12992
- name: 'Other dimensions',
12993
- value: '-',
12994
- icon: /*#__PURE__*/React__default["default"].createElement(theme.DimensionsOther, null)
12995
- }]
13081
+ list: dimensions
12996
13082
  }), /*#__PURE__*/React__default["default"].createElement(LayerInfoText, {
12997
13083
  label: "Styles",
12998
13084
  value: styles
@@ -13005,9 +13091,152 @@
13005
13091
  }), /*#__PURE__*/React__default["default"].createElement(LayerInfoText, {
13006
13092
  label: "Keywords",
13007
13093
  value: ((_b = layer.keywords) === null || _b === void 0 ? void 0 : _b.join(', ')) || '-'
13094
+ }), /*#__PURE__*/React__default["default"].createElement(LayerInfoLegend, {
13095
+ title: layer.text,
13096
+ name: layer.name,
13097
+ dimensions: layer.dimensions,
13098
+ legendURL: layer.styles && layer.styles.length && layer.styles[0].legendURL
13008
13099
  })));
13009
13100
  };
13010
13101
 
13102
+ /* *
13103
+ * Licensed under the Apache License, Version 2.0 (the "License");
13104
+ * you may not use this file except in compliance with the License.
13105
+ * You may obtain a copy of the License at
13106
+ *
13107
+ * http://www.apache.org/licenses/LICENSE-2.0
13108
+ *
13109
+ * Unless required by applicable law or agreed to in writing, software
13110
+ * distributed under the License is distributed on an "AS IS" BASIS,
13111
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13112
+ * See the License for the specific language governing permissions and
13113
+ * limitations under the License.
13114
+ *
13115
+ * Copyright 2022 - Koninklijk Nederlands Meteorologisch Instituut (KNMI)
13116
+ * Copyright 2022 - Finnish Meteorological Institute (FMI)
13117
+ * */
13118
+
13119
+ var LayerListDimensions = function LayerListDimensions(_a) {
13120
+ var dimensions = _a.dimensions;
13121
+
13122
+ if (!dimensions || !dimensions.length) {
13123
+ return null;
13124
+ }
13125
+
13126
+ return /*#__PURE__*/React__default["default"].createElement(React__default["default"].Fragment, null, dimensions.map(function (dimension) {
13127
+ return /*#__PURE__*/React__default["default"].createElement(Tooltip__default["default"], {
13128
+ key: dimension.label,
13129
+ title: dimension.label + ": " + dimension.value
13130
+ }, /*#__PURE__*/React__default["default"].createElement("span", {
13131
+ style: {
13132
+ marginRight: 4
13133
+ }
13134
+ }, dimension.icon));
13135
+ }));
13136
+ };
13137
+
13138
+ /* *
13139
+ * Licensed under the Apache License, Version 2.0 (the "License");
13140
+ * you may not use this file except in compliance with the License.
13141
+ * You may obtain a copy of the License at
13142
+ *
13143
+ * http://www.apache.org/licenses/LICENSE-2.0
13144
+ *
13145
+ * Unless required by applicable law or agreed to in writing, software
13146
+ * distributed under the License is distributed on an "AS IS" BASIS,
13147
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13148
+ * See the License for the specific language governing permissions and
13149
+ * limitations under the License.
13150
+ *
13151
+ * Copyright 2022 - Koninklijk Nederlands Meteorologisch Instituut (KNMI)
13152
+ * Copyright 2022 - Finnish Meteorological Institute (FMI)
13153
+ * */
13154
+ var buttonLarge = 80;
13155
+ var buttonSmall = 60;
13156
+ var layerSelectColumnsLarge = {
13157
+ column1: {
13158
+ width: 112
13159
+ },
13160
+ column2: {
13161
+ marginTop: '6px',
13162
+ width: "calc(100% - 112px)",
13163
+ height: '36px',
13164
+ paddingLeft: '20px'
13165
+ },
13166
+ column3: {
13167
+ height: '12px'
13168
+ },
13169
+ column4: {
13170
+ height: '24px'
13171
+ },
13172
+ column5: {
13173
+ height: '24px',
13174
+ width: 140
13175
+ },
13176
+ column6: {
13177
+ height: '24px',
13178
+ width: "calc(100% - 140px)"
13179
+ },
13180
+ column7: {
13181
+ height: '48px',
13182
+ width: buttonLarge,
13183
+ marginRight: 1,
13184
+ marginLeft: 2
13185
+ },
13186
+ column8: {
13187
+ width: "calc(100% - " + buttonLarge + "px - 24px)"
13188
+ },
13189
+ column9: {
13190
+ width: "calc(" + buttonLarge + "px + 24px)"
13191
+ }
13192
+ };
13193
+ var layerSelectColumnsSmall = {
13194
+ column1: {
13195
+ width: '100%'
13196
+ },
13197
+ column2: {
13198
+ marginTop: '4px',
13199
+ width: "calc(100% - 20px)"
13200
+ },
13201
+ column3: {
13202
+ height: '12px'
13203
+ },
13204
+ column4: {
13205
+ height: '48px'
13206
+ },
13207
+ column5: {
13208
+ height: '24px',
13209
+ width: '100%'
13210
+ },
13211
+ column6: {
13212
+ height: '24px',
13213
+ width: '100%'
13214
+ },
13215
+ column7: {
13216
+ height: '48px',
13217
+ width: buttonSmall,
13218
+ marginRight: 0,
13219
+ marginLeft: 1
13220
+ },
13221
+ column8: {
13222
+ width: "calc(100% - " + buttonSmall + "px - 8px)"
13223
+ },
13224
+ column9: {
13225
+ width: "calc(" + buttonSmall + "px + 8px)"
13226
+ }
13227
+ };
13228
+ var breakpoint = 500;
13229
+ var widthToColumns = function widthToColumns(width) {
13230
+ if (width <= breakpoint) return layerSelectColumnsSmall;
13231
+ return layerSelectColumnsLarge;
13232
+ };
13233
+ var rowHeightLarge = 68;
13234
+ var rowHeightSmall = 136;
13235
+ var widthToRowHeight = function widthToRowHeight(width) {
13236
+ if (width <= breakpoint) return rowHeightSmall;
13237
+ return rowHeightLarge;
13238
+ };
13239
+
13011
13240
  /* *
13012
13241
  * Licensed under the Apache License, Version 2.0 (the "License");
13013
13242
  * you may not use this file except in compliance with the License.
@@ -13028,11 +13257,12 @@
13028
13257
  fontSize: '10px',
13029
13258
  textOverflow: 'ellipsis',
13030
13259
  overflow: 'hidden',
13031
- whiteSpace: 'nowrap'
13260
+ whiteSpace: 'nowrap',
13261
+ lineHeight: 1
13032
13262
  };
13033
13263
 
13034
13264
  var LayerListRow = function LayerListRow(_a) {
13035
- var _b, _c, _d;
13265
+ var _b;
13036
13266
 
13037
13267
  var layer = _a.layer,
13038
13268
  layerIndex = _a.layerIndex,
@@ -13040,28 +13270,29 @@
13040
13270
  addLayer = _a.addLayer,
13041
13271
  deleteLayer = _a.deleteLayer,
13042
13272
  mapLayers = _a.mapLayers,
13043
- mapId = _a.mapId;
13273
+ mapId = _a.mapId,
13274
+ layerSelectWidth = _a.layerSelectWidth;
13275
+ var rowHeight = widthToRowHeight(layerSelectWidth);
13276
+ var columns = widthToColumns(layerSelectWidth);
13277
+ var dimensions = getDimensionsList(layer.dimensions);
13044
13278
  return /*#__PURE__*/React__default["default"].createElement(material.Grid, {
13045
13279
  "data-testid": "layerListLayerRow",
13046
13280
  container: true,
13047
- item: true,
13048
- xs: 12,
13049
13281
  justifyContent: "center",
13050
13282
  alignItems: "center",
13051
13283
  sx: {
13052
13284
  backgroundColor: 'geowebColors.cards.cardContainer',
13053
13285
  padding: '8px',
13054
13286
  marginBottom: '4px',
13055
- height: '68px',
13287
+ height: rowHeight,
13056
13288
  border: 'solid 1px',
13057
13289
  borderColor: 'geowebColors.cards.cardContainerBorder'
13058
13290
  }
13059
13291
  }, /*#__PURE__*/React__default["default"].createElement(material.Grid, {
13060
13292
  container: true,
13061
13293
  item: true,
13062
- xs: 10
13294
+ sx: columns.column8
13063
13295
  }, /*#__PURE__*/React__default["default"].createElement(material.Grid, {
13064
- container: true,
13065
13296
  item: true,
13066
13297
  xs: 12
13067
13298
  }, /*#__PURE__*/React__default["default"].createElement(material.Box, {
@@ -13070,25 +13301,19 @@
13070
13301
  height: '14px',
13071
13302
  lineHeight: '14px',
13072
13303
  fontWeight: 500,
13073
- WebkitLineClamp: 1,
13074
- display: '-webkit-box',
13075
- WebkitBoxOrient: 'vertical',
13076
13304
  textOverflow: 'ellipsis',
13077
13305
  overflow: 'hidden'
13078
13306
  }
13079
13307
  }, layer.text)), /*#__PURE__*/React__default["default"].createElement(material.Grid, {
13080
- container: true,
13081
13308
  item: true,
13082
- xs: 4,
13083
- direction: "column"
13309
+ container: true,
13310
+ direction: "column",
13311
+ sx: columns.column1
13084
13312
  }, /*#__PURE__*/React__default["default"].createElement(material.Box, {
13085
13313
  sx: {
13086
13314
  fontSize: '12px',
13087
13315
  height: '18px',
13088
13316
  lineHeight: '18px',
13089
- WebkitLineClamp: 1,
13090
- display: '-webkit-box',
13091
- WebkitBoxOrient: 'vertical',
13092
13317
  textOverflow: 'ellipsis',
13093
13318
  overflow: 'hidden'
13094
13319
  }
@@ -13096,44 +13321,41 @@
13096
13321
  layer: layer,
13097
13322
  mapId: mapId,
13098
13323
  serviceName: service.name
13099
- })), layer["abstract"] || ((_b = layer.keywords) === null || _b === void 0 ? void 0 : _b.length) || layer.path.length ? /*#__PURE__*/React__default["default"].createElement(material.Grid, {
13324
+ })), /*#__PURE__*/React__default["default"].createElement(material.Grid, {
13325
+ item: true,
13326
+ sx: columns.column2
13327
+ }, /*#__PURE__*/React__default["default"].createElement(material.Grid, {
13328
+ item: true,
13329
+ sx: columns.column3
13330
+ }, layer["abstract"] && /*#__PURE__*/React__default["default"].createElement(material.Typography, {
13100
13331
  "data-testid": "layerAbstract",
13332
+ sx: layerInfoStyle
13333
+ }, layer["abstract"])), /*#__PURE__*/React__default["default"].createElement(material.Grid, {
13334
+ item: true,
13101
13335
  container: true,
13336
+ sx: columns.column4
13337
+ }, /*#__PURE__*/React__default["default"].createElement(material.Grid, {
13102
13338
  item: true,
13103
- xs: 8,
13104
- sx: {
13105
- height: '45px',
13106
- paddingLeft: '20px',
13107
- WebkitLineClamp: 2,
13108
- display: '-webkit-box',
13109
- WebkitBoxOrient: 'vertical'
13110
- }
13111
- }, layer["abstract"] && /*#__PURE__*/React__default["default"].createElement(material.Typography, {
13112
- sx: __assign(__assign({}, layerInfoStyle), {
13113
- height: 15
13114
- })
13115
- }, layer["abstract"]), layer.path.length > 0 && /*#__PURE__*/React__default["default"].createElement(material.Typography, {
13116
- sx: __assign(__assign({}, layerInfoStyle), {
13117
- height: ((_c = layer.keywords) === null || _c === void 0 ? void 0 : _c.length) ? 15 : 30
13118
- })
13119
- }, "Groups: ", layer.path.join(' / ')), ((_d = layer.keywords) === null || _d === void 0 ? void 0 : _d.length) > 0 && /*#__PURE__*/React__default["default"].createElement(material.Typography, {
13120
- sx: __assign(__assign({}, layerInfoStyle), {
13121
- height: layer.path.length ? 15 : 30
13122
- })
13339
+ sx: columns.column5
13340
+ }, /*#__PURE__*/React__default["default"].createElement(LayerListDimensions, {
13341
+ dimensions: dimensions
13342
+ })), /*#__PURE__*/React__default["default"].createElement(material.Grid, {
13343
+ item: true,
13344
+ sx: columns.column6
13345
+ }, layer.path.length > 0 && /*#__PURE__*/React__default["default"].createElement(material.Typography, {
13346
+ sx: layerInfoStyle
13347
+ }, "Groups: ", layer.path.join(' / ')), ((_b = layer.keywords) === null || _b === void 0 ? void 0 : _b.length) > 0 && /*#__PURE__*/React__default["default"].createElement(material.Typography, {
13348
+ sx: layerInfoStyle
13123
13349
  }, "Keywords:", ' ', layer.keywords.slice().sort(function (a, b) {
13124
13350
  return a.localeCompare(b);
13125
- }).join(', '))) : null), /*#__PURE__*/React__default["default"].createElement(material.Grid, {
13351
+ }).join(', ')))))), /*#__PURE__*/React__default["default"].createElement(material.Grid, {
13126
13352
  container: true,
13127
13353
  item: true,
13128
- xs: 2,
13354
+ sx: columns.column9,
13129
13355
  justifyContent: "flex-end",
13130
13356
  alignItems: "center"
13131
13357
  }, /*#__PURE__*/React__default["default"].createElement(material.Box, {
13132
- sx: {
13133
- width: '80px',
13134
- height: '48px',
13135
- marginRight: '8px'
13136
- }
13358
+ sx: columns.column7
13137
13359
  }, /*#__PURE__*/React__default["default"].createElement(LayerAddRemoveButton, {
13138
13360
  layer: layer,
13139
13361
  layerIndex: layerIndex,
@@ -13163,38 +13385,17 @@
13163
13385
 
13164
13386
  var LayerList = function LayerList(_a) {
13165
13387
  var services = _a.services,
13166
- serviceIds = _a.serviceIds,
13388
+ filteredLayers = _a.filteredLayers,
13167
13389
  layerSelectHeight = _a.layerSelectHeight,
13168
13390
  serviceListHeight = _a.serviceListHeight,
13391
+ layerSelectWidth = _a.layerSelectWidth,
13169
13392
  addLayer = _a.addLayer,
13170
13393
  deleteLayer = _a.deleteLayer,
13171
- searchString = _a.searchString,
13172
13394
  mapLayers = _a.mapLayers,
13173
- filterIds = _a.filterIds,
13174
- allFiltersActive = _a.allFiltersActive,
13175
13395
  mapId = _a.mapId;
13396
+ var rowMargin = 4;
13397
+ var rowHeight = widthToRowHeight(layerSelectWidth);
13176
13398
  var layerSelectFilterHeight = 155 + serviceListHeight;
13177
-
13178
- var _b = __read(React__namespace.useState(0), 2),
13179
- numberOfLayers = _b[0],
13180
- setNumberOfLayers = _b[1];
13181
-
13182
- var _c = __read(React__namespace.useState([]), 2),
13183
- layersFilteredFromService = _c[0],
13184
- setLayersFilteredFromService = _c[1];
13185
-
13186
- React__namespace.useEffect(function () {
13187
- setNumberOfLayers(serviceIds.reduce(function (totalNumberOfLayers, serviceId) {
13188
- return totalNumberOfLayers + filterLayersFromService(serviceId, services, filterIds, allFiltersActive, searchString).length;
13189
- }, 0));
13190
- setLayersFilteredFromService(serviceIds.reduce(function (layerList, serviceId) {
13191
- return layerList.concat(filterLayersFromService(serviceId, services, filterIds, allFiltersActive, searchString).map(function (layer) {
13192
- return __assign(__assign({}, layer), {
13193
- serviceId: serviceId
13194
- });
13195
- }));
13196
- }, []));
13197
- }, [serviceIds, filterIds, services, searchString, allFiltersActive]);
13198
13399
  return /*#__PURE__*/React__namespace.createElement(material.Box, {
13199
13400
  "data-testid": "layerList"
13200
13401
  }, /*#__PURE__*/React__namespace.createElement(material.Box, {
@@ -13202,24 +13403,27 @@
13202
13403
  marginBottom: '4px',
13203
13404
  fontSize: '12px'
13204
13405
  }
13205
- }, numberOfLayers, " results"), /*#__PURE__*/React__namespace.createElement(reactWindow.FixedSizeList, {
13406
+ }, filteredLayers.length, " results"), /*#__PURE__*/React__namespace.createElement(reactWindow.FixedSizeList, {
13206
13407
  height: layerSelectHeight - layerSelectFilterHeight,
13207
- itemCount: numberOfLayers,
13208
- itemSize: 72
13408
+ itemCount: filteredLayers.length,
13409
+ itemSize: rowHeight + rowMargin
13209
13410
  }, function (_a) {
13210
13411
  var index = _a.index,
13211
13412
  style = _a.style;
13413
+ var filter = filteredLayers[index];
13414
+ var service = services[filter.serviceName];
13212
13415
  return /*#__PURE__*/React__namespace.createElement("div", {
13213
13416
  style: style,
13214
- key: layersFilteredFromService[index].name
13215
- }, services[layersFilteredFromService[index].serviceId] && /*#__PURE__*/React__namespace.createElement(LayerListRow, {
13216
- layer: layersFilteredFromService[index],
13417
+ key: filter.name
13418
+ }, service && /*#__PURE__*/React__namespace.createElement(LayerListRow, {
13419
+ layer: filter,
13217
13420
  layerIndex: index,
13218
- service: services[layersFilteredFromService[index].serviceId],
13421
+ service: service,
13219
13422
  addLayer: addLayer,
13220
13423
  deleteLayer: deleteLayer,
13221
13424
  mapLayers: mapLayers,
13222
- mapId: mapId
13425
+ mapId: mapId,
13426
+ layerSelectWidth: layerSelectWidth
13223
13427
  }));
13224
13428
  }));
13225
13429
  };
@@ -13244,14 +13448,12 @@
13244
13448
  var LayerListConnect = function LayerListConnect(_a) {
13245
13449
  var mapId = _a.mapId,
13246
13450
  layerSelectHeight = _a.layerSelectHeight,
13247
- serviceListHeight = _a.serviceListHeight;
13451
+ serviceListHeight = _a.serviceListHeight,
13452
+ layerSelectWidth = _a.layerSelectWidth;
13453
+ var dispatch = reactRedux.useDispatch();
13248
13454
  var services = reactRedux.useSelector(function (store) {
13249
13455
  return getServices(store);
13250
13456
  });
13251
- var dispatch = reactRedux.useDispatch();
13252
- var enabledServiceIds = reactRedux.useSelector(function (store) {
13253
- return getEnabledServiceIds(store);
13254
- });
13255
13457
  var mapLayers = reactRedux.useSelector(function (store) {
13256
13458
  return getMapLayers(store, mapId);
13257
13459
  });
@@ -13266,7 +13468,6 @@
13266
13468
  layerType: webmap.LayerType.mapLayer
13267
13469
  };
13268
13470
  addMapLayer({
13269
- mapId: mapId,
13270
13471
  layerId: layer.id,
13271
13472
  layer: layer,
13272
13473
  origin: LayerActionOrigin.layerManager
@@ -13294,25 +13495,17 @@
13294
13495
  origin: LayerActionOrigin.layerManager
13295
13496
  }));
13296
13497
  }, [dispatch, mapId]);
13297
- var checkedFilterIds = reactRedux.useSelector(function (store) {
13298
- return getCheckedFilterIds(store);
13299
- });
13300
- var allFiltersActive = reactRedux.useSelector(function (store) {
13301
- return isAllFiltersChecked(store);
13302
- });
13303
- var searchString = reactRedux.useSelector(function (store) {
13304
- return getSearchFilter(store);
13498
+ var filteredLayers = reactRedux.useSelector(function (store) {
13499
+ return getFilteredLayers(store);
13305
13500
  });
13306
13501
  return /*#__PURE__*/React__namespace.createElement(LayerList, {
13502
+ filteredLayers: filteredLayers,
13307
13503
  services: services,
13308
- serviceIds: enabledServiceIds,
13309
13504
  layerSelectHeight: layerSelectHeight,
13310
13505
  serviceListHeight: serviceListHeight,
13506
+ layerSelectWidth: layerSelectWidth,
13311
13507
  addLayer: addLayer,
13312
13508
  deleteLayer: deleteLayer,
13313
- filterIds: checkedFilterIds,
13314
- allFiltersActive: allFiltersActive,
13315
- searchString: searchString,
13316
13509
  mapLayers: mapLayers,
13317
13510
  mapId: mapId
13318
13511
  });
@@ -13336,13 +13529,13 @@
13336
13529
  * */
13337
13530
  var style = {
13338
13531
  borderRadius: '20px!important',
13339
- marginRight: '8px',
13532
+ marginRight: '4px',
13340
13533
  whiteSpace: 'nowrap',
13341
- height: '32px!important',
13534
+ height: '24px!important',
13342
13535
  padding: '5px 12px!important',
13343
13536
  textTransform: 'none!important',
13344
13537
  fontWeight: 'normal',
13345
- marginBottom: '5px'
13538
+ marginBottom: '4px'
13346
13539
  };
13347
13540
 
13348
13541
  var ServiceChip = function ServiceChip(_a) {
@@ -13530,9 +13723,9 @@
13530
13723
  display: 'block',
13531
13724
  alignItems: 'center',
13532
13725
  "float": 'left',
13533
- paddingLeft: '40px',
13534
- paddingRight: '30px',
13535
- marginBottom: '5px',
13726
+ paddingLeft: '48px',
13727
+ paddingRight: '40px',
13728
+ marginBottom: '8px',
13536
13729
  fontSize: '0.875rem'
13537
13730
  },
13538
13731
  ref: ref
@@ -13706,8 +13899,9 @@
13706
13899
  var _a = services[serviceId],
13707
13900
  serviceUrl = _a.serviceUrl,
13708
13901
  serviceName = _a.serviceName,
13709
- isUserAddedService = _a.isUserAddedService;
13902
+ scope = _a.scope;
13710
13903
  var serviceHasActiveLayers = checkIfServiceHasActiveLayers(serviceUrl);
13904
+ var userAddedService = isUserAddedService(scope);
13711
13905
  return /*#__PURE__*/React__namespace.createElement(material.ListItem, {
13712
13906
  key: serviceUrl
13713
13907
  }, /*#__PURE__*/React__namespace.createElement(material.ListItemText, {
@@ -13730,7 +13924,7 @@
13730
13924
  }, /*#__PURE__*/React__namespace.createElement(material.Grid, {
13731
13925
  item: true,
13732
13926
  xs: 6
13733
- }, isUserAddedService ? /*#__PURE__*/React__namespace.createElement(material.Tooltip, {
13927
+ }, userAddedService ? /*#__PURE__*/React__namespace.createElement(material.Tooltip, {
13734
13928
  title: "Edit Service"
13735
13929
  }, /*#__PURE__*/React__namespace.createElement("span", null, /*#__PURE__*/React__namespace.createElement(material.IconButton, {
13736
13930
  "aria-label": "edit service",
@@ -13761,7 +13955,7 @@
13761
13955
  }, /*#__PURE__*/React__namespace.createElement(theme.Visibility, null))))), /*#__PURE__*/React__namespace.createElement(material.Grid, {
13762
13956
  item: true,
13763
13957
  xs: 6
13764
- }, isUserAddedService && /*#__PURE__*/React__namespace.createElement(material.Box, null, /*#__PURE__*/React__namespace.createElement(material.Tooltip, {
13958
+ }, userAddedService && /*#__PURE__*/React__namespace.createElement(material.Box, null, /*#__PURE__*/React__namespace.createElement(material.Tooltip, {
13765
13959
  title: serviceHasActiveLayers ? 'Service has active layers. Cannot remove this service' : 'Delete Service',
13766
13960
  "data-testid": "removeServiceTooltip"
13767
13961
  }, /*#__PURE__*/React__namespace.createElement("span", null, /*#__PURE__*/React__namespace.createElement(material.IconButton, {
@@ -13893,20 +14087,25 @@
13893
14087
  _d = _a.order,
13894
14088
  order = _d === void 0 ? 0 : _d,
13895
14089
  _e = _a.source,
13896
- source = _e === void 0 ? 'module' : _e;
14090
+ source = _e === void 0 ? 'module' : _e,
14091
+ _f = _a.startSize,
14092
+ startSize = _f === void 0 ? {
14093
+ width: 750,
14094
+ height: 500
14095
+ } : _f;
13897
14096
  var initialServiceListHeight = 37;
13898
14097
 
13899
- var _f = __read(React__namespace.useState(500), 2),
13900
- height = _f[0],
13901
- setHeight = _f[1];
14098
+ var _g = __read(React__namespace.useState(startSize.height), 2),
14099
+ height = _g[0],
14100
+ setHeight = _g[1];
13902
14101
 
13903
- var _g = __read(React__namespace.useState(750), 2),
13904
- width = _g[0],
13905
- setWidth = _g[1];
14102
+ var _h = __read(React__namespace.useState(startSize.width), 2),
14103
+ width = _h[0],
14104
+ setWidth = _h[1];
13906
14105
 
13907
- var _h = __read(React__namespace.useState(initialServiceListHeight), 2),
13908
- serviceListHeight = _h[0],
13909
- setServiceListHeight = _h[1];
14106
+ var _j = __read(React__namespace.useState(initialServiceListHeight), 2),
14107
+ serviceListHeight = _j[0],
14108
+ setServiceListHeight = _j[1];
13910
14109
 
13911
14110
  var onChangeSize = function onChangeSize(_a) {
13912
14111
  var height = _a.height,
@@ -13927,7 +14126,7 @@
13927
14126
  width: width,
13928
14127
  height: height
13929
14128
  },
13930
- minWidth: 390,
14129
+ minWidth: 320,
13931
14130
  minHeight: 126,
13932
14131
  startPosition: {
13933
14132
  top: 150,
@@ -13944,13 +14143,13 @@
13944
14143
  source: source
13945
14144
  }, /*#__PURE__*/React__namespace.createElement(material.Box, {
13946
14145
  sx: {
13947
- padding: '6px'
14146
+ padding: '4px 16px 0 16px'
13948
14147
  }
13949
14148
  }, /*#__PURE__*/React__namespace.createElement(SearchFieldConnect, null)), /*#__PURE__*/React__namespace.createElement(material.Box, {
13950
14149
  sx: {
13951
14150
  "float": 'left',
13952
14151
  position: 'absolute',
13953
- margin: '12px 0 0 8px',
14152
+ margin: '8px 8px 0 16px',
13954
14153
  zIndex: 2
13955
14154
  }
13956
14155
  }, /*#__PURE__*/React__namespace.createElement(KeywordFilterButtonConnect, {
@@ -13958,7 +14157,7 @@
13958
14157
  })), /*#__PURE__*/React__namespace.createElement(material.Box, {
13959
14158
  sx: {
13960
14159
  position: 'absolute',
13961
- margin: '12px 0 0 calc(100% - 36px)',
14160
+ margin: '8px 0 0 calc(100% - 40px)',
13962
14161
  zIndex: 2
13963
14162
  }
13964
14163
  }, /*#__PURE__*/React__namespace.createElement(ServiceOptionsButton, {
@@ -13967,12 +14166,13 @@
13967
14166
  setHeight: handleHeightChange
13968
14167
  })), /*#__PURE__*/React__namespace.createElement(material.Box, {
13969
14168
  sx: {
13970
- padding: '0 8px'
14169
+ padding: '0 16px'
13971
14170
  }
13972
14171
  }, /*#__PURE__*/React__namespace.createElement(LayerListConnect, {
13973
14172
  mapId: mapId,
13974
14173
  layerSelectHeight: height,
13975
- serviceListHeight: serviceListHeight
14174
+ serviceListHeight: serviceListHeight,
14175
+ layerSelectWidth: width
13976
14176
  })));
13977
14177
  };
13978
14178
 
@@ -14396,7 +14596,7 @@
14396
14596
  var KeywordFilterResultsConnect = function KeywordFilterResultsConnect(_a) {
14397
14597
  var bounds = _a.bounds;
14398
14598
 
14399
- var _b = useSetupDialog('keywordFilter'),
14599
+ var _b = useSetupDialog(DialogTypes.KeywordFilter),
14400
14600
  dialogOrder = _b.dialogOrder,
14401
14601
  onCloseDialog = _b.onCloseDialog,
14402
14602
  setDialogOrder = _b.setDialogOrder,
@@ -14483,10 +14683,10 @@
14483
14683
  _b = _a.showTitle,
14484
14684
  showTitle = _b === void 0 ? false : _b;
14485
14685
  var mapId = reactRedux.useSelector(function (store) {
14486
- return getDialogMapId(store, 'layerSelect');
14686
+ return getDialogMapId(store, DialogTypes.LayerSelect);
14487
14687
  });
14488
14688
 
14489
- var _c = useSetupDialog('layerSelect'),
14689
+ var _c = useSetupDialog(DialogTypes.LayerSelect),
14490
14690
  dialogOrder = _c.dialogOrder,
14491
14691
  isDialogOpen = _c.isDialogOpen,
14492
14692
  onCloseDialog = _c.onCloseDialog,
@@ -14534,11 +14734,6 @@
14534
14734
  var serviceSetLayers = React__namespace.useCallback(function (payload) {
14535
14735
  dispatch(serviceActions.serviceSetLayers(payload));
14536
14736
  }, [dispatch]);
14537
-
14538
- var checkIfUserAddedService = function checkIfUserAddedService(service) {
14539
- return !!service.isUserAddedService;
14540
- };
14541
-
14542
14737
  React__namespace.useEffect(function () {
14543
14738
  if (isOpenInStore && preloadedServices && preloadedServices.length > 0) {
14544
14739
  mergePresetsAndUserAddedServices(preloadedServices, getUserAddedServices()).forEach(function (service) {
@@ -14550,7 +14745,7 @@
14550
14745
  name: service.name,
14551
14746
  serviceUrl: service.url,
14552
14747
  layers: layers,
14553
- isUserAddedService: checkIfUserAddedService(service),
14748
+ scope: service.scope ? service.scope : 'system',
14554
14749
  // first try to load the user abstract, otherwise the service abstract
14555
14750
  "abstract": service["abstract"] || wmService["abstract"]
14556
14751
  });
@@ -14587,7 +14782,7 @@
14587
14782
  * Copyright 2021 - Koninklijk Nederlands Meteorologisch Instituut (KNMI)
14588
14783
  * Copyright 2021 - Finnish Meteorological Institute (FMI)
14589
14784
  * */
14590
- var dialogType = 'layerManager';
14785
+ var dialogType = DialogTypes.LayerManager;
14591
14786
  /**
14592
14787
  * Layer Managerconnected to the store displaying the layers forthe active map Id
14593
14788
  * Please note that in order to use this and open/close the dialog, every map on the screen that should be able to show
@@ -14748,7 +14943,7 @@
14748
14943
  }, [mapId]);
14749
14944
 
14750
14945
  var onZoomIn = function onZoomIn() {
14751
- return adagucRef.current.zoomIn();
14946
+ return adagucRef.current.zoomIn(undefined);
14752
14947
  };
14753
14948
 
14754
14949
  var onZoomOut = function onZoomOut() {
@@ -14835,14 +15030,14 @@
14835
15030
  source = _b === void 0 ? 'app' : _b;
14836
15031
  var dispatch = reactRedux.useDispatch();
14837
15032
  var currentActiveMapId = reactRedux.useSelector(function (store) {
14838
- return getDialogMapId(store, 'layerManager');
15033
+ return getDialogMapId(store, DialogTypes.LayerManager);
14839
15034
  });
14840
15035
  var isOpenInStore = reactRedux.useSelector(function (store) {
14841
- return getisDialogOpen(store, 'layerManager');
15036
+ return getisDialogOpen(store, DialogTypes.LayerManager);
14842
15037
  });
14843
15038
  var openLayerManagerDialog = React__namespace.useCallback(function () {
14844
15039
  dispatch(uiActions.setActiveMapIdForDialog({
14845
- type: 'layerManager',
15040
+ type: DialogTypes.LayerManager,
14846
15041
  mapId: mapId,
14847
15042
  setOpen: currentActiveMapId !== mapId ? true : !isOpenInStore,
14848
15043
  source: source
@@ -14973,7 +15168,7 @@
14973
15168
  }
14974
15169
 
14975
15170
  var sortedMarks = __spreadArray([], __read(marks)).sort(function (a, b) {
14976
- return typeof a.value === 'number' && typeof b.value === 'number' && a.value - b.value;
15171
+ return Number(typeof a.value === 'number' && typeof b.value === 'number' && a.value - b.value);
14977
15172
  });
14978
15173
 
14979
15174
  var adaptedMarks = reverse ? sortedMarks.reverse() : sortedMarks;
@@ -15460,9 +15655,7 @@
15460
15655
 
15461
15656
  var AutoUpdateButton = function AutoUpdateButton(_a) {
15462
15657
  var _b = _a.toggleAutoUpdate,
15463
- toggleAutoUpdate = _b === void 0 ? function () {
15464
- return null;
15465
- } : _b,
15658
+ toggleAutoUpdate = _b === void 0 ? function () {} : _b,
15466
15659
  _c = _a.isAutoUpdating,
15467
15660
  isAutoUpdating = _c === void 0 ? false : _c,
15468
15661
  _d = _a.disabled,
@@ -15749,9 +15942,7 @@
15749
15942
  timeDimension = _a.timeDimension,
15750
15943
  onChangeTimeStep = _a.onChangeTimeStep,
15751
15944
  _d = _a.onToggleTimestepAuto,
15752
- onToggleTimestepAuto = _d === void 0 ? function () {
15753
- return null;
15754
- } : _d,
15945
+ onToggleTimestepAuto = _d === void 0 ? function () {} : _d,
15755
15946
  _e = _a.isOpenByDefault,
15756
15947
  isOpenByDefault = _e === void 0 ? false : _e;
15757
15948
  var timeStepFromLayer = getActiveLayerTimeStep(timeDimension) || timeStep;
@@ -15782,6 +15973,129 @@
15782
15973
  });
15783
15974
  };
15784
15975
 
15976
+ /* *
15977
+ * Licensed under the Apache License, Version 2.0 (the "License");
15978
+ * you may not use this file except in compliance with the License.
15979
+ * You may obtain a copy of the License at
15980
+ *
15981
+ * http://www.apache.org/licenses/LICENSE-2.0
15982
+ *
15983
+ * Unless required by applicable law or agreed to in writing, software
15984
+ * distributed under the License is distributed on an "AS IS" BASIS,
15985
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15986
+ * See the License for the specific language governing permissions and
15987
+ * limitations under the License.
15988
+ *
15989
+ * Copyright 2022 - Koninklijk Nederlands Meteorologisch Instituut (KNMI)
15990
+ * Copyright 2022 - Finnish Meteorological Institute (FMI)
15991
+ * */
15992
+ var marks = [{
15993
+ label: '5 min',
15994
+ value: Scale.Minutes5,
15995
+ text: '5m'
15996
+ }, {
15997
+ label: '1 h',
15998
+ value: Scale.Hour,
15999
+ text: '1h'
16000
+ }, {
16001
+ label: '3 h',
16002
+ value: Scale.Hours3,
16003
+ text: '3h'
16004
+ }, {
16005
+ label: '6 h',
16006
+ value: Scale.Hours6,
16007
+ text: '6h'
16008
+ }, {
16009
+ label: 'day',
16010
+ value: Scale.Day,
16011
+ text: 'd'
16012
+ }, {
16013
+ label: 'week',
16014
+ value: Scale.Week,
16015
+ text: 'w'
16016
+ }, {
16017
+ label: 'month',
16018
+ value: Scale.Month,
16019
+ text: 'm'
16020
+ }, {
16021
+ label: 'year',
16022
+ value: Scale.Year,
16023
+ text: 'y'
16024
+ }, {
16025
+ label: 'data',
16026
+ value: Scale.DataScale,
16027
+ text: 'data'
16028
+ }].sort(function (a, b) {
16029
+ return b.value - a.value;
16030
+ });
16031
+ var TimeScaleButton = function TimeScaleButton(_a) {
16032
+ var layers = _a.layers,
16033
+ _b = _a.timeSliderScale,
16034
+ timeSliderScale = _b === void 0 ? Scale.Hour : _b,
16035
+ centerTime = _a.centerTime,
16036
+ secondsPerPx = _a.secondsPerPx,
16037
+ selectedTime = _a.selectedTime,
16038
+ onChangeTimeSliderScale = _a.onChangeTimeSliderScale;
16039
+
16040
+ var onChangeSliderValue = function onChangeSliderValue(mark) {
16041
+ var newSliderValue = mark.value;
16042
+ var newValue = newSliderValue ? Math.round(newSliderValue) : 0;
16043
+ var newScale = marks.find(function (el) {
16044
+ return el.value === newValue;
16045
+ }).value;
16046
+ var scaleToSecPerPx = newScale === Scale.DataScale ? getScaleToSecondsPerPxForDataScale(layers) : scaleToSecondsPerPx[newScale];
16047
+ var newCenterTime = getNewCenterOfFixedPointZoom(selectedTime, secondsPerPx, scaleToSecPerPx, centerTime);
16048
+ onChangeTimeSliderScale(newScale, newCenterTime, scaleToSecPerPx);
16049
+ };
16050
+
16051
+ return /*#__PURE__*/React__namespace.createElement(TimeSliderMenu, {
16052
+ handleMenuItemClick: onChangeSliderValue,
16053
+ icon: /*#__PURE__*/React__namespace.createElement(theme.Clock, null),
16054
+ marks: marks,
16055
+ title: "Time scale",
16056
+ value: timeSliderScale
16057
+ });
16058
+ };
16059
+
16060
+ /* *
16061
+ * Licensed under the Apache License, Version 2.0 (the "License");
16062
+ * you may not use this file except in compliance with the License.
16063
+ * You may obtain a copy of the License at
16064
+ *
16065
+ * http://www.apache.org/licenses/LICENSE-2.0
16066
+ *
16067
+ * Unless required by applicable law or agreed to in writing, software
16068
+ * distributed under the License is distributed on an "AS IS" BASIS,
16069
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16070
+ * See the License for the specific language governing permissions and
16071
+ * limitations under the License.
16072
+ *
16073
+ * Copyright 2022 - Koninklijk Nederlands Meteorologisch Instituut (KNMI)
16074
+ * Copyright 2022 - Finnish Meteorological Institute (FMI)
16075
+ * */
16076
+ var title = 'Now';
16077
+
16078
+ var NowButton = function NowButton(_a) {
16079
+ var _b = _a.onSetNow,
16080
+ onSetNow = _b === void 0 ? function () {
16081
+ return null;
16082
+ } : _b,
16083
+ _c = _a.disabled,
16084
+ disabled = _c === void 0 ? false : _c;
16085
+ return /*#__PURE__*/React__namespace.createElement(material.Tooltip, {
16086
+ title: title,
16087
+ "data-testid": "nowButtonTooltip"
16088
+ }, /*#__PURE__*/React__namespace.createElement("span", null, /*#__PURE__*/React__namespace.createElement(shared.ToolButton, {
16089
+ disabled: disabled,
16090
+ onClick: function onClick() {
16091
+ return onSetNow();
16092
+ },
16093
+ "aria-label": "now"
16094
+ }, /*#__PURE__*/React__namespace.createElement(theme.Now, {
16095
+ "data-testid": "now-svg"
16096
+ }))));
16097
+ };
16098
+
15785
16099
  /* *
15786
16100
  * Licensed under the Apache License, Version 2.0 (the "License");
15787
16101
  * you may not use this file except in compliance with the License.
@@ -15810,9 +16124,11 @@
15810
16124
  });
15811
16125
 
15812
16126
  var OptionsMenuButton = function OptionsMenuButton(_a) {
15813
- var autoUpdateBtn = _a.autoUpdateBtn,
16127
+ var nowBtn = _a.nowBtn,
16128
+ autoUpdateBtn = _a.autoUpdateBtn,
15814
16129
  speedBtn = _a.speedBtn,
15815
- timeStepBtn = _a.timeStepBtn;
16130
+ timeStepBtn = _a.timeStepBtn,
16131
+ timeScaleBtn = _a.timeScaleBtn;
15816
16132
 
15817
16133
  var _b = __read(React__namespace.useState(null), 2),
15818
16134
  anchorEl = _b[0],
@@ -15834,10 +16150,9 @@
15834
16150
  }, /*#__PURE__*/React__namespace.createElement("span", null, /*#__PURE__*/React__namespace.createElement(shared.ToolButton, {
15835
16151
  onClick: onClickButton,
15836
16152
  "data-testid": "optionsMenuButton",
15837
- active: open
15838
- }, /*#__PURE__*/React__namespace.createElement(theme.Options, {
15839
- "data-testid": "optionsIcon"
15840
- })))), /*#__PURE__*/React__namespace.createElement(OptionsPopOver, {
16153
+ active: open,
16154
+ "aria-label": "animation options"
16155
+ }, /*#__PURE__*/React__namespace.createElement(theme.Options, null)))), /*#__PURE__*/React__namespace.createElement(OptionsPopOver, {
15841
16156
  id: id,
15842
16157
  open: open,
15843
16158
  "data-testid": "optionsMenuPopOver",
@@ -15857,19 +16172,27 @@
15857
16172
  }, /*#__PURE__*/React__namespace.createElement(material.Grid, {
15858
16173
  item: true,
15859
16174
  xs: "auto"
16175
+ }, nowBtn || /*#__PURE__*/React__namespace.createElement(NowButton, null)), /*#__PURE__*/React__namespace.createElement(material.Grid, {
16176
+ item: true,
16177
+ xs: "auto"
16178
+ }, timeScaleBtn || /*#__PURE__*/React__namespace.createElement(TimeScaleButton, {
16179
+ centerTime: 0,
16180
+ onChangeTimeSliderScale: function onChangeTimeSliderScale() {},
16181
+ secondsPerPx: 0,
16182
+ selectedTime: 0,
16183
+ timeSliderScale: 0
16184
+ })), /*#__PURE__*/React__namespace.createElement(material.Grid, {
16185
+ item: true,
16186
+ xs: "auto"
15860
16187
  }, timeStepBtn || /*#__PURE__*/React__namespace.createElement(TimeStepButton, {
15861
16188
  timeStep: 0,
15862
- onChangeTimeStep: function onChangeTimeStep() {
15863
- return null;
15864
- }
16189
+ onChangeTimeStep: function onChangeTimeStep() {}
15865
16190
  })), /*#__PURE__*/React__namespace.createElement(material.Grid, {
15866
16191
  item: true,
15867
16192
  xs: "auto"
15868
16193
  }, speedBtn || /*#__PURE__*/React__namespace.createElement(SpeedButton, {
15869
16194
  animationDelay: defaultAnimationDelayAtStart,
15870
- setMapAnimationDelay: function setMapAnimationDelay() {
15871
- return null;
15872
- }
16195
+ setMapAnimationDelay: function setMapAnimationDelay() {}
15873
16196
  })), /*#__PURE__*/React__namespace.createElement(material.Grid, {
15874
16197
  item: true,
15875
16198
  xs: "auto"
@@ -15900,10 +16223,7 @@
15900
16223
  "data-testid": "timeSliderButtons"
15901
16224
  }, /*#__PURE__*/React__namespace.createElement(material.Grid, {
15902
16225
  container: true,
15903
- spacing: 2,
15904
- sx: {
15905
- padding: '20px 0px 0px 16px'
15906
- }
16226
+ spacing: 2
15907
16227
  }, /*#__PURE__*/React__namespace.createElement(material.Grid, {
15908
16228
  item: true
15909
16229
  }, optionsMenuBtn || /*#__PURE__*/React__namespace.createElement(OptionsMenuButton, null)), /*#__PURE__*/React__namespace.createElement(material.Grid, {
@@ -16687,19 +17007,7 @@
16687
17007
  React__namespace.useEffect(function () {
16688
17008
  var handleKeyDown = function handleKeyDown(event) {
16689
17009
  if (event.key === 'Home' && mapIsActive) {
16690
- if (dataStartTime < dataEndTime) {
16691
- if (dataEndTime < currentTime) {
16692
- onSetNewDate(moment__default["default"].utc(dataEndTime * 1000).toISOString());
16693
- onSetCenterTime(dataEndTime);
16694
- } else if (dataStartTime > currentTime) {
16695
- onSetNewDate(moment__default["default"].utc(dataStartTime * 1000).toISOString());
16696
- onSetCenterTime(dataStartTime);
16697
- } else {
16698
- var closestToCurrent = roundWithTimeStep(currentTime, timeStep);
16699
- onSetNewDate(moment__default["default"].utc(closestToCurrent * 1000).toISOString());
16700
- onSetCenterTime(closestToCurrent);
16701
- }
16702
- }
17010
+ handleSetNowEvent(timeStep, dataStartTime, dataEndTime, currentTime, onSetNewDate, onSetCenterTime);
16703
17011
  }
16704
17012
  };
16705
17013
 
@@ -16731,7 +17039,7 @@
16731
17039
  return /*#__PURE__*/React__namespace.createElement(material.Box, {
16732
17040
  "data-testid": "timeSliderLegend",
16733
17041
  sx: {
16734
- height: '50px'
17042
+ height: TIME_SLIDER_LEGEND_HEIGHT + "px"
16735
17043
  }
16736
17044
  }, /*#__PURE__*/React__namespace.createElement(CanvasComponent, {
16737
17045
  ref: node,
@@ -16771,249 +17079,25 @@
16771
17079
  },
16772
17080
  onMouseUp: function onMouseUp() {
16773
17081
  setReleased(true);
16774
- setNewSelectionTimeRequested(false);
16775
- },
16776
- onCanvasClick: function onCanvasClick(x, y, width) {
16777
- var isCanvasArea = x >= 0 && x < width;
16778
-
16779
- if (isCanvasArea) {
16780
- if (isReleased && !isDragged) {
16781
- setSelectedTime(x, width);
16782
- }
16783
- }
16784
- },
16785
- onRenderCanvas: function onRenderCanvas(ctx, width, height) {
16786
- renderTimeSliderLegend(ctx, theme, width, height, centerTime, secondsPerPx, dataScaleToSecondsPerPx, selectedTime, scale, currentTime, localAnimationStartTime, localAnimationEndTime);
16787
- }
16788
- }));
16789
- };
16790
-
16791
- /* *
16792
- * Licensed under the Apache License, Version 2.0 (the "License");
16793
- * you may not use this file except in compliance with the License.
16794
- * You may obtain a copy of the License at
16795
- *
16796
- * http://www.apache.org/licenses/LICENSE-2.0
16797
- *
16798
- * Unless required by applicable law or agreed to in writing, software
16799
- * distributed under the License is distributed on an "AS IS" BASIS,
16800
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16801
- * See the License for the specific language governing permissions and
16802
- * limitations under the License.
16803
- *
16804
- * Copyright 2022 - Koninklijk Nederlands Meteorologisch Instituut (KNMI)
16805
- * Copyright 2022 - Finnish Meteorological Institute (FMI)
16806
- * */
16807
- var scaleSliderOtherSettings = {
16808
- LEFT_PADDING: '10%'
16809
- };
16810
-
16811
- var thumbComponent = function thumbComponent(props) {
16812
- var children = props.children,
16813
- other = __rest(props, ["children"]);
16814
-
16815
- return /*#__PURE__*/React__namespace.createElement(material.SliderThumb, __assign({}, other, {
16816
- "data-testid": "scaleSliderSliderThumb",
16817
- tabIndex: 0
16818
- }), children, /*#__PURE__*/React__namespace.createElement(theme.SliderThumb, null));
16819
- };
16820
-
16821
- var marks = [{
16822
- text: '5 min scale',
16823
- paddingLeft: '2px',
16824
- value: Scale.Minutes5
16825
- }, {
16826
- text: '1 h scale',
16827
- paddingLeft: '25px',
16828
- value: Scale.Hour
16829
- }, {
16830
- text: '3 h scale',
16831
- paddingLeft: '45px',
16832
- value: Scale.Hours3
16833
- }, {
16834
- text: '6 h scale',
16835
- paddingLeft: '65px',
16836
- value: Scale.Hours6
16837
- }, {
16838
- text: 'day scale',
16839
- paddingLeft: '80px',
16840
- value: Scale.Day
16841
- }, {
16842
- text: 'week scale',
16843
- paddingLeft: '92px',
16844
- value: Scale.Week
16845
- }, {
16846
- text: 'month scale',
16847
- paddingLeft: '107px',
16848
- value: Scale.Month
16849
- }, {
16850
- text: 'year scale',
16851
- paddingLeft: '130px',
16852
- value: Scale.Year
16853
- }, {
16854
- text: 'data scale',
16855
- paddingLeft: '140px',
16856
- value: Scale.DataScale
16857
- }];
16858
-
16859
- var valueLabelFormat = function valueLabelFormat(value) {
16860
- var valueNew = value.toString();
16861
- return valueNew;
16862
- };
16863
-
16864
- var GeoWebScaleSlider = material.styled(material.Slider)(function (_a) {
16865
- var theme = _a.theme;
16866
- return {
16867
- '&.MuiSlider-root': {
16868
- height: 4,
16869
- width: 167,
16870
- margin: "0 0 18px " + scaleSliderOtherSettings.LEFT_PADDING
16871
- },
16872
- '& .MuiSlider-thumb': {
16873
- backgroundColor: 'rgba(0,0,0,0)',
16874
- marginTop: 0,
16875
- width: 12,
16876
- height: 12,
16877
- color: theme.palette.geowebColors.timeSlider.timeScalePointer.fill,
16878
- '& svg polygon': {
16879
- filter: theme.palette.geowebColors.timeSlider.timeScaleShadowButtonScale.filter
16880
- },
16881
- '&:before': {
16882
- display: 'none'
16883
- }
16884
- },
16885
- '& .MuiSlider-valueLabel': {
16886
- left: '20px'
16887
- },
16888
- '& .MuiSlider-rail': {
16889
- color: theme.palette.geowebColors.timeSlider.timeScaleHorizontalScale.fill,
16890
- height: 4,
16891
- width: 170,
16892
- borderRadius: 4.5,
16893
- opacity: theme.palette.geowebColors.timeSlider.timeScaleHorizontalScale.opacity
16894
- },
16895
- '& .MuiSlider-mark': {
16896
- backgroundColor: theme.palette.geowebColors.timeSlider.timeScaleTimeIndicators.fill,
16897
- height: 6,
16898
- width: 2,
16899
- marginTop: -9,
16900
- '&.MuiSlider-markActive': {
16901
- backgroundColor: theme.palette.geowebColors.timeSlider.timeScaleTimeIndicatorsActive.fill,
16902
- height: 6,
16903
- width: 2,
16904
- marginTop: -9
16905
- }
16906
- },
16907
- '@media (max-width: 585px)': {
16908
- '&.MuiSlider-root': {
16909
- width: 110
16910
- },
16911
- '& .MuiSlider-rail': {
16912
- width: 110
16913
- }
16914
- },
16915
- '@media (max-width: 395px)': {
16916
- '&.MuiSlider-root': {
16917
- width: 60
16918
- },
16919
- '& .MuiSlider-rail': {
16920
- width: 60
16921
- }
16922
- }
16923
- };
16924
- });
16925
- var RAIL_GUTTER_OFFSET = 0.4;
16926
-
16927
- var TimeSliderScaleSlider = function TimeSliderScaleSlider(_a) {
16928
- var layers = _a.layers,
16929
- _b = _a.timeSliderScale,
16930
- timeSliderScale = _b === void 0 ? Scale.Hour : _b,
16931
- centerTime = _a.centerTime,
16932
- secondsPerPx = _a.secondsPerPx,
16933
- selectedTime = _a.selectedTime,
16934
- onChangeTimeSliderScale = _a.onChangeTimeSliderScale;
16935
- var min = 0;
16936
- var max = marks.length - 1;
16937
- var value = marks.findIndex(function (mark) {
16938
- return mark.value === timeSliderScale;
16939
- });
16940
-
16941
- var onChangeSliderValue = function onChangeSliderValue(newSliderValue) {
16942
- var newValue = newSliderValue ? Math.round(newSliderValue) : 0;
16943
- var newScale = marks.find(function (el) {
16944
- return el.value === newValue;
16945
- }).value;
16946
- var scaleToSecPerPx = newScale === Scale.DataScale ? getScaleToSecondsPerPxForDataScale(layers) : scaleToSecondsPerPx[newScale];
16947
- var newCenterTime = getNewCenterOfFixedPointZoom(selectedTime, secondsPerPx, scaleToSecPerPx, centerTime);
16948
- onChangeTimeSliderScale(newScale, newCenterTime, scaleToSecPerPx);
16949
- };
16950
-
16951
- var onChange = function onChange(event, value) {
16952
- if (event.type !== 'keydown') {
16953
- onChangeSliderValue(value);
16954
- }
16955
- };
16956
-
16957
- var onKeyDown = function onKeyDown(event) {
16958
- // disable default Slider behavior
16959
- event.preventDefault();
16960
- event.stopPropagation(); // custom logic
16961
-
16962
- var newValue = getValueFromKeyboardEvent(event, value, min, max, true);
16963
-
16964
- if (newValue !== null) {
16965
- onChangeSliderValue(newValue);
16966
- }
16967
- };
16968
-
16969
- var _c = marks.find(function (mark) {
16970
- return mark.value === value;
16971
- }),
16972
- paddingLeft = _c.paddingLeft,
16973
- text = _c.text;
16974
-
16975
- var scaleTextPadding = {
16976
- paddingLeft: paddingLeft
16977
- };
16978
- return /*#__PURE__*/React__namespace.createElement(material.Box, {
16979
- "data-testid": "scaleSlider",
16980
- sx: {
16981
- backgroundColor: 'geowebColors.background.surface',
16982
- width: '229px',
16983
- height: '40px',
16984
- paddingTop: '4px',
16985
- paddingBottom: '7px',
16986
- boxSizing: 'content-box'
16987
- }
16988
- }, /*#__PURE__*/React__namespace.createElement("div", null, /*#__PURE__*/React__namespace.createElement(material.Box, {
16989
- "data-testid": "scaleSliderText",
16990
- sx: {
16991
- width: '67px',
16992
- height: '15px',
16993
- padding: '0px 10px 0 8px',
16994
- color: 'geowebColors.typographyAndIcons.text',
16995
- font: '12px Roboto'
17082
+ setNewSelectionTimeRequested(false);
16996
17083
  },
16997
- style: scaleTextPadding
16998
- }, text)), /*#__PURE__*/React__namespace.createElement("div", null, /*#__PURE__*/React__namespace.createElement(GeoWebScaleSlider, {
16999
- "data-testid": "scaleSliderSlider",
17000
- defaultValue: Scale.Hour,
17001
- value: value,
17002
- min: min - RAIL_GUTTER_OFFSET,
17003
- step: 1,
17004
- max: max + RAIL_GUTTER_OFFSET,
17005
- getAriaValueText: valueLabelFormat,
17006
- onChange: onChange,
17007
- onKeyDown: onKeyDown,
17008
- "aria-labelledby": "scale-slider",
17009
- components: {
17010
- Thumb: thumbComponent
17084
+ onCanvasClick: function onCanvasClick(x, y, width) {
17085
+ var isCanvasArea = x >= 0 && x < width;
17086
+
17087
+ if (isCanvasArea) {
17088
+ if (isReleased && !isDragged) {
17089
+ setSelectedTime(x, width);
17090
+ }
17091
+ }
17011
17092
  },
17012
- marks: marks,
17013
- track: false
17014
- })));
17093
+ onRenderCanvas: function onRenderCanvas(ctx, width, height) {
17094
+ renderTimeSliderLegend(ctx, theme, width, height, centerTime, secondsPerPx, dataScaleToSecondsPerPx, selectedTime, scale, currentTime, localAnimationStartTime, localAnimationEndTime);
17095
+ }
17096
+ }));
17015
17097
  };
17016
17098
 
17099
+ var TIME_SLIDER_LEGEND_HEIGHT = 50;
17100
+
17017
17101
  /* eslint-disable no-param-reassign */
17018
17102
 
17019
17103
  var drawRoundedRectangle = function drawRoundedRectangle(ctx, x, y, width, height, cornerRadius, theme) {
@@ -17277,11 +17361,11 @@
17277
17361
 
17278
17362
  var curTime = selectedTime !== undefined ? selectedTime.toISOString() : moment__default["default"].utc().toISOString();
17279
17363
 
17280
- var _e = __read(React__namespace.useState(animationStartTime && moment__default["default"].utc(animationStartTime).unix()), 2),
17364
+ var _e = __read(React__namespace.useState(animationStartTime ? moment__default["default"].utc(animationStartTime).unix() : undefined), 2),
17281
17365
  localAnimationStartTime = _e[0],
17282
17366
  setLocalAnimationStartTime = _e[1];
17283
17367
 
17284
- var _f = __read(React__namespace.useState(animationEndTime && moment__default["default"].utc(animationEndTime).unix()), 2),
17368
+ var _f = __read(React__namespace.useState(animationEndTime ? moment__default["default"].utc(animationEndTime).unix() : undefined), 2),
17285
17369
  localAnimationEndTime = _f[0],
17286
17370
  setLocalAnimationEndTime = _f[1];
17287
17371
 
@@ -17416,8 +17500,8 @@
17416
17500
  };
17417
17501
 
17418
17502
  React__namespace.useEffect(function () {
17419
- setLocalAnimationStartTime(animationStartTime && moment__default["default"].utc(animationStartTime).unix());
17420
- setLocalAnimationEndTime(animationEndTime && moment__default["default"].utc(animationEndTime).unix());
17503
+ setLocalAnimationStartTime(animationStartTime ? moment__default["default"].utc(animationStartTime).unix() : undefined);
17504
+ setLocalAnimationEndTime(animationEndTime ? moment__default["default"].utc(animationEndTime).unix() : undefined);
17421
17505
  }, [animationStartTime, animationEndTime]);
17422
17506
  var handleKeyDown = React__namespace.useCallback(function (event) {
17423
17507
  if (event.ctrlKey && dataStartTime && dataEndTime && mapIsActive) {
@@ -17565,7 +17649,6 @@
17565
17649
  var TimeSlider = function TimeSlider(_a) {
17566
17650
  var buttons = _a.buttons,
17567
17651
  rail = _a.rail,
17568
- scaleSlider = _a.scaleSlider,
17569
17652
  legend = _a.legend,
17570
17653
  _b = _a.mapIsActive,
17571
17654
  mapIsActive = _b === void 0 ? true : _b,
@@ -17576,15 +17659,15 @@
17576
17659
  useTimeSliderKeyBoardControl(mapIsActive, isVisible, onToggleTimeSlider);
17577
17660
  return isVisible ? /*#__PURE__*/React__namespace.createElement(material.Grid, {
17578
17661
  container: true,
17579
- "data-testid": "timeSlider",
17580
17662
  sx: {
17581
17663
  display: 'grid',
17582
17664
  gridTemplateColumns: 'minmax(100px, 210px) minmax(66%, 1fr)',
17583
17665
  gridTemplateRows: '50px'
17584
- }
17666
+ },
17667
+ "data-testid": "timeSlider"
17585
17668
  }, /*#__PURE__*/React__namespace.createElement(material.Grid, {
17586
17669
  item: true
17587
- }, " ", buttons || /*#__PURE__*/React__namespace.createElement(TimeSliderButtons, null), " "), /*#__PURE__*/React__namespace.createElement(material.Grid, {
17670
+ }), /*#__PURE__*/React__namespace.createElement(material.Grid, {
17588
17671
  item: true
17589
17672
  }, rail || /*#__PURE__*/React__namespace.createElement(TimeSliderRail, __assign({}, defaultProps, {
17590
17673
  selectedTime: defaultProps.selectedTime,
@@ -17593,14 +17676,11 @@
17593
17676
  item: true,
17594
17677
  sx: {
17595
17678
  height: '50px'
17596
- }
17597
- }, scaleSlider || /*#__PURE__*/React__namespace.createElement(TimeSliderScaleSlider, __assign({}, defaultProps, {
17598
- selectedTime: defaultProps.selectedTime.unix(),
17599
- timeSliderScale: Scale.Hour,
17600
- onChangeTimeSliderScale: function onChangeTimeSliderScale() {
17601
- return null;
17602
- }
17603
- }))), /*#__PURE__*/React__namespace.createElement(material.Grid, {
17679
+ },
17680
+ container: true,
17681
+ alignItems: "center",
17682
+ justifyContent: "center"
17683
+ }, buttons || /*#__PURE__*/React__namespace.createElement(TimeSliderButtons, null)), /*#__PURE__*/React__namespace.createElement(material.Grid, {
17604
17684
  item: true
17605
17685
  }, legend || /*#__PURE__*/React__namespace.createElement(TimeSliderLegend, __assign({}, defaultProps, {
17606
17686
  selectedTime: defaultProps.selectedTime.unix(),
@@ -17750,6 +17830,136 @@
17750
17830
  });
17751
17831
  };
17752
17832
 
17833
+ /* *
17834
+ * Licensed under the Apache License, Version 2.0 (the "License");
17835
+ * you may not use this file except in compliance with the License.
17836
+ * You may obtain a copy of the License at
17837
+ *
17838
+ * http://www.apache.org/licenses/LICENSE-2.0
17839
+ *
17840
+ * Unless required by applicable law or agreed to in writing, software
17841
+ * distributed under the License is distributed on an "AS IS" BASIS,
17842
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17843
+ * See the License for the specific language governing permissions and
17844
+ * limitations under the License.
17845
+ *
17846
+ * Copyright 2020 - Koninklijk Nederlands Meteorologisch Instituut (KNMI)
17847
+ * Copyright 2020 - Finnish Meteorological Institute (FMI)
17848
+ * */
17849
+ var TimeScaleButtonConnect = function TimeScaleButtonConnect(_a) {
17850
+ var mapId = _a.mapId;
17851
+ var layers = reactRedux.useSelector(function (store) {
17852
+ return getMapLayers(store, mapId);
17853
+ });
17854
+ var timeSliderScale = reactRedux.useSelector(function (store) {
17855
+ return getMapTimeSliderScale(store, mapId);
17856
+ });
17857
+ var centerTime = reactRedux.useSelector(function (store) {
17858
+ return getMapTimeSliderCenterTime(store, mapId);
17859
+ });
17860
+ var secondsPerPx = reactRedux.useSelector(function (store) {
17861
+ return getMapTimeSliderSecondsPerPx(store, mapId);
17862
+ });
17863
+ var dimensions = reactRedux.useSelector(function (store) {
17864
+ return getMapDimensions(store, mapId);
17865
+ });
17866
+ var dispatch = reactRedux.useDispatch();
17867
+
17868
+ var onSetTimeSliderScale = function onSetTimeSliderScale(scale, newCenterTime, scaleToSecPerPx) {
17869
+ if (scale === Scale.DataScale) {
17870
+ dispatch(mapActions$1.setTimeSliderDataScaleToSecondsPerPx({
17871
+ mapId: mapId,
17872
+ timeSliderDataScaleToSecondsPerPx: scaleToSecPerPx
17873
+ }));
17874
+ }
17875
+
17876
+ dispatch(mapActions$1.setTimeSliderScale({
17877
+ mapId: mapId,
17878
+ timeSliderScale: scale
17879
+ }));
17880
+ dispatch(mapActions$1.setTimeSliderCenterTime({
17881
+ mapId: mapId,
17882
+ timeSliderCenterTime: newCenterTime
17883
+ }));
17884
+ };
17885
+
17886
+ var selectedTime = getTimeBounds(dimensions).selectedTime;
17887
+ return /*#__PURE__*/React__namespace.createElement(TimeScaleButton, {
17888
+ layers: layers,
17889
+ timeSliderScale: timeSliderScale,
17890
+ onChangeTimeSliderScale: onSetTimeSliderScale,
17891
+ secondsPerPx: secondsPerPx,
17892
+ centerTime: centerTime,
17893
+ selectedTime: selectedTime
17894
+ });
17895
+ };
17896
+
17897
+ /* *
17898
+ * Licensed under the Apache License, Version 2.0 (the "License");
17899
+ * you may not use this file except in compliance with the License.
17900
+ * You may obtain a copy of the License at
17901
+ *
17902
+ * http://www.apache.org/licenses/LICENSE-2.0
17903
+ *
17904
+ * Unless required by applicable law or agreed to in writing, software
17905
+ * distributed under the License is distributed on an "AS IS" BASIS,
17906
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17907
+ * See the License for the specific language governing permissions and
17908
+ * limitations under the License.
17909
+ *
17910
+ * Copyright 2022 - Koninklijk Nederlands Meteorologisch Instituut (KNMI)
17911
+ * Copyright 2022 - Finnish Meteorological Institute (FMI)
17912
+ * */
17913
+
17914
+ var NowButtonConnect = function NowButtonConnect(_a) {
17915
+ var sourceId = _a.sourceId,
17916
+ mapId = _a.mapId,
17917
+ isDisabled = _a.isDisabled;
17918
+ var dispatch = reactRedux.useDispatch();
17919
+ var currentTime = moment__default["default"].utc().unix();
17920
+ var timeStep = reactRedux.useSelector(function (store) {
17921
+ return getMapTimeStep(store, mapId);
17922
+ });
17923
+
17924
+ var _b = __read(getDataLimitsFromLayers(reactRedux.useSelector(function (store) {
17925
+ return getMapLayers(store, mapId);
17926
+ })), 2),
17927
+ dataStartTime = _b[0],
17928
+ dataEndTime = _b[1];
17929
+
17930
+ var isAnimating$1 = reactRedux.useSelector(function (store) {
17931
+ return isAnimating(store, mapId);
17932
+ });
17933
+
17934
+ var onSetNewDate = function onSetNewDate(newDate) {
17935
+ if (isAnimating$1) {
17936
+ dispatch(mapActions$1.mapStopAnimation({
17937
+ mapId: mapId
17938
+ }));
17939
+ }
17940
+
17941
+ dispatch(genericActions.setTime({
17942
+ sourceId: sourceId,
17943
+ origin: 'NowButtonConnect, 140',
17944
+ value: handleMomentISOString(newDate)
17945
+ }));
17946
+ };
17947
+
17948
+ var onSetCenterTime = function onSetCenterTime(newTime) {
17949
+ dispatch(mapActions$1.setTimeSliderCenterTime({
17950
+ mapId: mapId,
17951
+ timeSliderCenterTime: newTime
17952
+ }));
17953
+ };
17954
+
17955
+ return /*#__PURE__*/React__namespace.createElement(NowButton, {
17956
+ disabled: isDisabled,
17957
+ onSetNow: function onSetNow() {
17958
+ return handleSetNowEvent(timeStep, dataStartTime, dataEndTime, currentTime, onSetNewDate, onSetCenterTime);
17959
+ }
17960
+ });
17961
+ };
17962
+
17753
17963
  /* *
17754
17964
  * Licensed under the Apache License, Version 2.0 (the "License");
17755
17965
  * you may not use this file except in compliance with the License.
@@ -17776,8 +17986,13 @@
17776
17986
  */
17777
17987
 
17778
17988
  var OptionsMenuButtonConnect = function OptionsMenuButtonConnect(_a) {
17779
- var mapId = _a.mapId;
17989
+ var sourceId = _a.sourceId,
17990
+ mapId = _a.mapId;
17780
17991
  return /*#__PURE__*/React__namespace.createElement(OptionsMenuButton, {
17992
+ nowBtn: /*#__PURE__*/React__namespace.createElement(NowButtonConnect, {
17993
+ mapId: mapId,
17994
+ sourceId: sourceId
17995
+ }),
17781
17996
  autoUpdateBtn: /*#__PURE__*/React__namespace.createElement(AutoUpdateButtonConnect, {
17782
17997
  mapId: mapId
17783
17998
  }),
@@ -17786,6 +18001,9 @@
17786
18001
  }),
17787
18002
  timeStepBtn: /*#__PURE__*/React__namespace.createElement(TimeStepButtonComponent, {
17788
18003
  mapId: mapId
18004
+ }),
18005
+ timeScaleBtn: /*#__PURE__*/React__namespace.createElement(TimeScaleButtonConnect, {
18006
+ mapId: mapId
17789
18007
  })
17790
18008
  });
17791
18009
  };
@@ -17816,10 +18034,12 @@
17816
18034
  */
17817
18035
 
17818
18036
  var TimeSliderButtonsConnect = function TimeSliderButtonsConnect(_a) {
17819
- var mapId = _a.mapId;
18037
+ var sourceId = _a.sourceId,
18038
+ mapId = _a.mapId;
17820
18039
  return /*#__PURE__*/React__namespace.createElement(TimeSliderButtons, {
17821
18040
  optionsMenuBtn: /*#__PURE__*/React__namespace.createElement(OptionsMenuButtonConnect, {
17822
- mapId: mapId
18041
+ mapId: mapId,
18042
+ sourceId: sourceId
17823
18043
  }),
17824
18044
  playBtn: /*#__PURE__*/React__namespace.createElement(PlayButtonConnect, {
17825
18045
  mapId: mapId
@@ -18095,87 +18315,6 @@
18095
18315
 
18096
18316
  var TimeSliderRailConnect = connectRedux$1(TimeSliderRailConnectComponent);
18097
18317
 
18098
- /* *
18099
- * Licensed under the Apache License, Version 2.0 (the "License");
18100
- * you may not use this file except in compliance with the License.
18101
- * You may obtain a copy of the License at
18102
- *
18103
- * http://www.apache.org/licenses/LICENSE-2.0
18104
- *
18105
- * Unless required by applicable law or agreed to in writing, software
18106
- * distributed under the License is distributed on an "AS IS" BASIS,
18107
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
18108
- * See the License for the specific language governing permissions and
18109
- * limitations under the License.
18110
- *
18111
- * Copyright 2020 - Koninklijk Nederlands Meteorologisch Instituut (KNMI)
18112
- * Copyright 2020 - Finnish Meteorological Institute (FMI)
18113
- * */
18114
- var connectReduxTimeSliderScaleSlider = reactRedux.connect(function (store, props) {
18115
- return {
18116
- layers: getMapLayers(store, props.mapId),
18117
- timeSliderScale: getMapTimeSliderScale(store, props.mapId),
18118
- centerTime: getMapTimeSliderCenterTime(store, props.mapId),
18119
- secondsPerPx: getMapTimeSliderSecondsPerPx(store, props.mapId),
18120
- dimensions: getMapDimensions(store, props.mapId)
18121
- };
18122
- }, {
18123
- mapSetTimeSliderScale: mapActions$1.setTimeSliderScale,
18124
- mapSetTimeSliderDataScaleToSecondsPerPx: mapActions$1.setTimeSliderDataScaleToSecondsPerPx,
18125
- mapSetTimeSliderCenterTime: mapActions$1.setTimeSliderCenterTime
18126
- });
18127
-
18128
- var TimeSliderScaleSliderComponent = function TimeSliderScaleSliderComponent(_a) {
18129
- var timeSliderScale = _a.timeSliderScale,
18130
- mapId = _a.mapId,
18131
- layers = _a.layers,
18132
- centerTime = _a.centerTime,
18133
- secondsPerPx = _a.secondsPerPx,
18134
- dimensions = _a.dimensions,
18135
- mapSetTimeSliderScale = _a.mapSetTimeSliderScale,
18136
- mapSetTimeSliderDataScaleToSecondsPerPx = _a.mapSetTimeSliderDataScaleToSecondsPerPx,
18137
- mapSetTimeSliderCenterTime = _a.mapSetTimeSliderCenterTime;
18138
-
18139
- var onSetTimeSliderScale = function onSetTimeSliderScale(scale, newCenterTime, scaleToSecPerPx) {
18140
- if (scale === Scale.DataScale) {
18141
- mapSetTimeSliderDataScaleToSecondsPerPx({
18142
- mapId: mapId,
18143
- timeSliderDataScaleToSecondsPerPx: scaleToSecPerPx
18144
- });
18145
- }
18146
-
18147
- mapSetTimeSliderScale({
18148
- mapId: mapId,
18149
- timeSliderScale: scale
18150
- });
18151
- mapSetTimeSliderCenterTime({
18152
- mapId: mapId,
18153
- timeSliderCenterTime: newCenterTime
18154
- });
18155
- };
18156
-
18157
- var selectedTime = getTimeBounds(dimensions).selectedTime;
18158
- return /*#__PURE__*/React__namespace.createElement(TimeSliderScaleSlider, {
18159
- layers: layers,
18160
- timeSliderScale: timeSliderScale,
18161
- onChangeTimeSliderScale: onSetTimeSliderScale,
18162
- secondsPerPx: secondsPerPx,
18163
- centerTime: centerTime,
18164
- selectedTime: selectedTime
18165
- });
18166
- };
18167
- /**
18168
- * TimeSliderScaleSlider component connected to the store displaying a scale slider of the time slider
18169
- *
18170
- * Expects the following props:
18171
- * @param {string} mapId mapId: string - Id of the map
18172
- * @example
18173
- * ``` <TimeSliderScaleSliderConnect mapId={mapId} />```
18174
- */
18175
-
18176
-
18177
- var TimeSliderScaleSliderConnect = connectReduxTimeSliderScaleSlider(TimeSliderScaleSliderComponent);
18178
-
18179
18318
  /* *
18180
18319
  * Licensed under the Apache License, Version 2.0 (the "License");
18181
18320
  * you may not use this file except in compliance with the License.
@@ -18243,15 +18382,13 @@
18243
18382
 
18244
18383
  return /*#__PURE__*/React__namespace.createElement(TimeSlider, {
18245
18384
  buttons: /*#__PURE__*/React__namespace.createElement(TimeSliderButtonsConnect, {
18246
- mapId: mapId
18385
+ mapId: mapId,
18386
+ sourceId: sourceId
18247
18387
  }),
18248
18388
  rail: /*#__PURE__*/React__namespace.createElement(TimeSliderRailConnect, {
18249
18389
  mapId: mapId,
18250
18390
  sourceId: sourceId
18251
18391
  }),
18252
- scaleSlider: /*#__PURE__*/React__namespace.createElement(TimeSliderScaleSliderConnect, {
18253
- mapId: mapId
18254
- }),
18255
18392
  legend: /*#__PURE__*/React__namespace.createElement(TimeSliderLegendConnect$1, {
18256
18393
  mapId: mapId,
18257
18394
  sourceId: sourceId
@@ -18744,7 +18881,7 @@
18744
18881
  id: service.id,
18745
18882
  serviceUrl: wmLayer.service,
18746
18883
  layers: layers,
18747
- isUserAddedService: false
18884
+ scope: 'system'
18748
18885
  },
18749
18886
  layerStyle: {
18750
18887
  origin: origin,
@@ -19452,7 +19589,7 @@
19452
19589
  }
19453
19590
 
19454
19591
  if (!featureCoords) {
19455
- return;
19592
+ return undefined;
19456
19593
  }
19457
19594
 
19458
19595
  var vertexSelected = mouseDown === true && this.mouseIsOverVertexNr !== VERTEX.NONE;
@@ -19476,6 +19613,8 @@
19476
19613
 
19477
19614
  return false;
19478
19615
  }
19616
+
19617
+ return undefined;
19479
19618
  };
19480
19619
 
19481
19620
  AdagucMapDraw.prototype.hoverVertex = function (feature, mouseX, mouseY) {
@@ -19590,7 +19729,7 @@
19590
19729
  isInEditMode = _a.isInEditMode,
19591
19730
  featureNrToEdit = _a.featureNrToEdit,
19592
19731
  onHoverFeature = _a.onHoverFeature;
19593
- if (event && event.rightButton === true) return;
19732
+ if (event && event.rightButton === true) return undefined;
19594
19733
  /* adagucMouseMove is an event callback function which is triggered when the mouse moves over the map
19595
19734
  This event is only triggered if the map is in hover state.
19596
19735
  E.g. when the map is dragging/panning, this event is not triggerd
@@ -19631,11 +19770,11 @@
19631
19770
  }
19632
19771
 
19633
19772
  if (isInEditMode === false) {
19634
- return;
19773
+ return undefined;
19635
19774
  }
19636
19775
 
19637
19776
  var feature = this.geojson.features[featureNrToEdit];
19638
- if (!feature) return;
19777
+ if (!feature) return undefined;
19639
19778
  var webmapjs = this.props.webmapjs;
19640
19779
  this.mouseGeoCoord = webmapjs.getLatLongFromPixelCoord({
19641
19780
  x: mouseX,
@@ -19701,6 +19840,8 @@
19701
19840
  /* False means that this component will take over entire controll.
19702
19841
  True means that it is still possible to pan and drag the map while editing */
19703
19842
  }
19843
+
19844
+ return undefined;
19704
19845
  };
19705
19846
  /* Returns true if double click is detected */
19706
19847
 
@@ -19994,6 +20135,8 @@
19994
20135
  return false;
19995
20136
  }
19996
20137
  }
20138
+
20139
+ return undefined;
19997
20140
  };
19998
20141
 
19999
20142
  AdagucMapDraw.prototype.addPointToLineStringFeature = function (event) {
@@ -20762,7 +20905,7 @@
20762
20905
  /* After the image is loaded the canvas will be redrawn and drawIcon will be triggered again
20763
20906
  via the beforecanvasdisplay listener. */
20764
20907
 
20765
- return;
20908
+ return undefined;
20766
20909
  }
20767
20910
 
20768
20911
  if (image.isLoaded()) {
@@ -20775,6 +20918,8 @@
20775
20918
  ctx.strokeRect(parseInt(_coord.x, 10) - imageWidth / 2, parseInt(_coord.y, 10) - imageHeight / 2, imageWidth, imageHeight);
20776
20919
  }
20777
20920
  }
20921
+
20922
+ return undefined;
20778
20923
  };
20779
20924
 
20780
20925
  AdagucMapDraw.prototype.drawMarker = function (ctx, _coord, selected, middle, isInEditMode, featureProperties) {
@@ -21979,12 +22124,8 @@
21979
22124
  shouldAutoFetch: true,
21980
22125
  displayMapPin: false,
21981
22126
  disableMapPin: false,
21982
- onMount: function onMount() {
21983
- return null;
21984
- },
21985
- onUnMount: function onUnMount() {
21986
- return null;
21987
- },
22127
+ onMount: function onMount() {},
22128
+ onUnMount: function onUnMount() {},
21988
22129
  onMapChangeDimension: function onMapChangeDimension() {
21989
22130
  /* nothing */
21990
22131
  },
@@ -22096,7 +22237,7 @@
22096
22237
  }
22097
22238
  }, /*#__PURE__*/React__namespace.createElement(ZoomControls, {
22098
22239
  onZoomIn: function onZoomIn() {
22099
- return adagucRef.current.zoomIn();
22240
+ return adagucRef.current.zoomIn(undefined);
22100
22241
  },
22101
22242
  onZoomOut: function onZoomOut() {
22102
22243
  return adagucRef.current.zoomOut();
@@ -22165,10 +22306,10 @@
22165
22306
  return (touches === null || touches === void 0 ? void 0 : touches.length) === 2;
22166
22307
  };
22167
22308
 
22168
- var isValidMap = React__namespace.useCallback(function (map, event) {
22309
+ var isCanvasElement = React__namespace.useCallback(function (event) {
22169
22310
  var target = event.target;
22170
- return map && target.tagName !== 'INPUT' && mapIsActive;
22171
- }, [mapIsActive]);
22311
+ return target.tagName === 'CANVAS';
22312
+ }, []);
22172
22313
 
22173
22314
  var distance = function distance(x1, y1, x2, y2) {
22174
22315
  var dx = x1 - x2;
@@ -22176,9 +22317,32 @@
22176
22317
  return Math.sqrt(dx * dx + dy * dy);
22177
22318
  };
22178
22319
 
22320
+ var isMatchingWebMapNumbers = function isMatchingWebMapNumbers(firstStr, secondStr) {
22321
+ // Returns true if the same web map (id) number were encountered in both given strings, false otherwise.
22322
+ var webMapNumberBaseFormat = 'WebMapJSMapNo_';
22323
+
22324
+ if (!firstStr.includes(webMapNumberBaseFormat) || !secondStr.includes(webMapNumberBaseFormat)) {
22325
+ return false;
22326
+ }
22327
+
22328
+ var numberMatcher = /\d+/;
22329
+ var firstNumber = firstStr.match(numberMatcher)[0];
22330
+ var secondNumber = secondStr.match(numberMatcher)[0];
22331
+ return Boolean(firstNumber && secondNumber && firstNumber === secondNumber);
22332
+ };
22333
+
22334
+ var isTouchInsideTargetElement = function isTouchInsideTargetElement(elem, touchX, touchY) {
22335
+ var _a = elem.getBoundingClientRect(),
22336
+ left = _a.left,
22337
+ top = _a.top,
22338
+ width = _a.width,
22339
+ height = _a.height;
22340
+
22341
+ var leftMarginWidth = 0.02 * document.body.getBoundingClientRect().width;
22342
+ return touchY > window.scrollY + top && touchY < window.scrollY + top + height - TIME_SLIDER_LEGEND_HEIGHT && touchX > window.scrollX + left + leftMarginWidth && touchX < window.scrollX + left + width;
22343
+ };
22344
+
22179
22345
  var handleStart = React__namespace.useCallback(function (event) {
22180
- var map = getWMJSMapById(mapId);
22181
- if (!isValidMap(map, event)) return;
22182
22346
  var targetTouches = event.targetTouches;
22183
22347
  var firstTouch = targetTouches === null || targetTouches === void 0 ? void 0 : targetTouches.item(0);
22184
22348
  setFirstTouchX(firstTouch === null || firstTouch === void 0 ? void 0 : firstTouch.clientX);
@@ -22189,10 +22353,31 @@
22189
22353
  setSecondTouchX(secondTouch === null || secondTouch === void 0 ? void 0 : secondTouch.clientX);
22190
22354
  setSecondTouchY(secondTouch === null || secondTouch === void 0 ? void 0 : secondTouch.clientY);
22191
22355
  }
22192
- }, [isValidMap, mapId]);
22356
+ }, []);
22193
22357
  var handleMove = React__namespace.useCallback(function (event) {
22194
22358
  var map = getWMJSMapById(mapId);
22195
- if (!isValidMap(map, event)) return;
22359
+ var targetElem = event.target;
22360
+
22361
+ if (!isCanvasElement(event)) {
22362
+ // Elements other than canvas elements are not allowed to be zoomed/panned
22363
+ return;
22364
+ }
22365
+
22366
+ var targetMapId = map.getId();
22367
+ var targetElemId = targetElem.parentElement.id;
22368
+
22369
+ if (!isMatchingWebMapNumbers(targetMapId, targetElemId)) {
22370
+ // Current map (given by map id) was not coupled to the canvas element user touched.
22371
+ // This web map id number comparison is of importance when dealing with multi-window presentations.
22372
+ return;
22373
+ }
22374
+
22375
+ if (!isTouchInsideTargetElement(targetElem, firstTouchX, firstTouchY)) {
22376
+ // A user touch outside the current canvas element will be rejected
22377
+ return;
22378
+ } // Start zooming/panning by touch
22379
+
22380
+
22196
22381
  event.preventDefault();
22197
22382
  var targetTouches = event.targetTouches;
22198
22383
  var firstTouch = targetTouches === null || targetTouches === void 0 ? void 0 : targetTouches.item(0);
@@ -22234,7 +22419,7 @@
22234
22419
  setPrevDist(dist);
22235
22420
  }
22236
22421
  }
22237
- }, [firstTouchX, firstTouchY, isValidMap, mapId, prevDist, secondTouchX, secondTouchY]);
22422
+ }, [mapId, isCanvasElement, firstTouchX, firstTouchY, secondTouchX, secondTouchY, prevDist]);
22238
22423
  var handleEnd = React__namespace.useCallback(function () {}, []);
22239
22424
  React__namespace.useEffect(function () {
22240
22425
  document.addEventListener('touchstart', handleStart, {
@@ -22483,7 +22668,7 @@
22483
22668
  },
22484
22669
  srs: srs,
22485
22670
  bbox: bbox,
22486
- mapPinLocation: displayMapPin && mapPinLocation,
22671
+ mapPinLocation: displayMapPin ? mapPinLocation : undefined,
22487
22672
  dimensions: mapDimensions,
22488
22673
  activeLayerId: activeLayerId,
22489
22674
  animationDelay: animationDelay,
@@ -22704,7 +22889,7 @@
22704
22889
 
22705
22890
  if (shouldShowLayerManager !== undefined) {
22706
22891
  dispatch(uiActions.setActiveMapIdForDialog({
22707
- type: 'layerManager',
22892
+ type: DialogTypes.LayerManager,
22708
22893
  mapId: mapId,
22709
22894
  setOpen: shouldShowLayerManager,
22710
22895
  source: 'app'
@@ -23497,7 +23682,7 @@
23497
23682
  dispatch(actions.syncGroupRemoveTarget(payload));
23498
23683
  }, [dispatch]);
23499
23684
 
23500
- var _a = useSetupDialog('syncGroups'),
23685
+ var _a = useSetupDialog(DialogTypes.SyncGroups),
23501
23686
  dialogOrder = _a.dialogOrder,
23502
23687
  isDialogOpen = _a.isDialogOpen,
23503
23688
  onCloseDialog = _a.onCloseDialog,