@opengeoweb/layer-select 20.0.1 → 20.1.0-nightly-20261017

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.esm.js CHANGED
@@ -3,15 +3,15 @@ import React from 'react';
3
3
  import { useSelector, useDispatch } from 'react-redux';
4
4
  import { CustomIconButton, FilterOption, ToolContainerDraggable, CustomAccordion, CustomTooltip, SearchHighlight, SearchField, CustomToggleButton, AlertBanner, ToggleMenu, CustomDialog, sessionStorageProvider } from '@opengeoweb/shared';
5
5
  import { uiTypes, serviceActions, selectorMemoizationOptions, serviceSelectors, uiActions, getUserAddedServices, setUserAddedServices, layerActions, uiSelectors, layerSelectors, mapListener, serviceListener, layersListener, openlayersListener, uiReducer, layerReducer, serviceReducer, mapReducer, useSetupDialog, mapSelectors, layerTypes, mapEnums } from '@opengeoweb/store';
6
- import { Filter, ArrowDropDownDown, StacIcon, LayersAdd, MeteoGate, CustomServiceIcon, Add, Cached, Edit, Visibility, Delete, Copy } from '@opengeoweb/theme';
6
+ import { Filter, ArrowDropDownDown, ChevronUp, ChevronDown, StacIcon, LayersAdd, MeteoGate, CustomServiceIcon, Add, Cached, Edit, Visibility, Delete, Copy } from '@opengeoweb/theme';
7
7
  import { createEntityAdapter, createSlice, createSelector, createListenerMiddleware, isAnyOf, combineReducers, configureStore } from '@reduxjs/toolkit';
8
8
  import { compact, countBy, partition } from 'lodash';
9
9
  import { snackbarListener, snackbarReducer, snackbarActions, snackbarTypes } from '@opengeoweb/snackbar';
10
- import { Switch, Grid, List, ToggleButtonGroup, ToggleButton, Box, Popper, Grow, Paper, ClickAwayListener, MenuList, MenuItem, Typography, useTheme, Backdrop, CircularProgress, Button, ListItem, ListItemText, LinearProgress, InputAdornment } from '@mui/material';
10
+ import { Switch, Grid, List, ToggleButtonGroup, ToggleButton, Box, Popper, Grow, Paper, ClickAwayListener, MenuList, MenuItem, ListItem, ListItemButton, ListItemText, Typography, useTheme, Backdrop, CircularProgress, Button, LinearProgress, InputAdornment } from '@mui/material';
11
11
  import 'i18next';
12
12
  import { useTranslation } from 'react-i18next';
13
13
  import { List as List$1 } from 'react-window';
14
- import { getDimensionsList, LayerInfoButton, stacCatalogCollectionToLayerProps, fetchStacCatalogRoot, fetchStacCatalogCollections, clearImageCacheForAllMaps } from '@opengeoweb/webmap-react';
14
+ import { getDimensionsList, LayerInfoButton, defaultEdrStyles, normalizeEDRLabel, fetchEDRJson, stacCatalogCollectionToLayerProps, fetchStacCatalogRoot, fetchStacCatalogCollections, clearImageCacheForAllMaps } from '@opengeoweb/webmap-react';
15
15
  import { LayerType, webmapUtils, getWMSServiceId, queryWMSServiceInfo, queryWMSLayers, invalidateWMSGetCapabilities } from '@opengeoweb/webmap';
16
16
  import { useFormContext } from 'react-hook-form';
17
17
  import { ReactHookFormProvider, defaultFormOptions, ReactHookFormTextField } from '@opengeoweb/form-fields';
@@ -396,10 +396,6 @@ var slice = createSlice({
396
396
  if (isUpdating) {
397
397
  return;
398
398
  }
399
- if (type === 'EDR') {
400
- // EDR services do not work yet in the layer-select, so skip them for now
401
- return;
402
- }
403
399
  var keywords = layers.reduce(function (keywords, layer) {
404
400
  if (layer.leaf) {
405
401
  var _layer$keywords;
@@ -1367,6 +1363,76 @@ var LayerAddRemoveButton = function LayerAddRemoveButton(_ref) {
1367
1363
  });
1368
1364
  };
1369
1365
 
1366
+ var CollectionListRow = function CollectionListRow(_ref) {
1367
+ var title = _ref.title,
1368
+ count = _ref.count,
1369
+ level = _ref.level,
1370
+ expanded = _ref.expanded,
1371
+ onToggle = _ref.onToggle;
1372
+ return jsx(ListItem, {
1373
+ "data-testid": "layerListCollectionRow",
1374
+ sx: {
1375
+ backgroundColor: 'geowebColors.cards.cardContainer',
1376
+ height: '44px',
1377
+ marginTop: 0.5,
1378
+ borderWidth: '1px',
1379
+ borderStyle: 'solid',
1380
+ borderRadius: '3px',
1381
+ padding: 0,
1382
+ zIndex: 10,
1383
+ overflow: 'hidden',
1384
+ borderColor: 'geowebColors.cards.cardContainerBorder'
1385
+ },
1386
+ children: jsxs(ListItemButton, {
1387
+ "aria-expanded": expanded,
1388
+ "aria-label": (expanded ? 'Collapse' : 'Expand') + " " + title,
1389
+ onClick: onToggle,
1390
+ sx: {
1391
+ height: '100%',
1392
+ paddingLeft: 24 + level * 20 + "px",
1393
+ paddingRight: '8px'
1394
+ },
1395
+ children: [jsxs(Grid, {
1396
+ container: true,
1397
+ size: "grow",
1398
+ sx: {
1399
+ justifyContent: 'space-between',
1400
+ alignItems: 'center'
1401
+ },
1402
+ children: [jsx(Grid, {
1403
+ size: "grow",
1404
+ children: jsx(ListItemText, {
1405
+ primary: title,
1406
+ sx: {
1407
+ margin: 0,
1408
+ '.MuiListItemText-primary': {
1409
+ fontSize: '12px',
1410
+ fontWeight: 500,
1411
+ textOverflow: 'ellipsis',
1412
+ whiteSpace: 'nowrap',
1413
+ overflow: 'hidden'
1414
+ }
1415
+ }
1416
+ })
1417
+ }), jsx(Grid, {
1418
+ children: jsx(ListItemText, {
1419
+ primary: "(" + count + ")",
1420
+ sx: {
1421
+ paddingLeft: 1,
1422
+ paddingRight: 1,
1423
+ textAlign: 'right',
1424
+ '.MuiListItemText-primary': {
1425
+ fontSize: '12px',
1426
+ opacity: 0.67
1427
+ }
1428
+ }
1429
+ })
1430
+ })]
1431
+ }), expanded ? jsx(ChevronUp, {}) : jsx(ChevronDown, {})]
1432
+ })
1433
+ });
1434
+ };
1435
+
1370
1436
  var LayerListDimensions = function LayerListDimensions(_ref) {
1371
1437
  var dimensions = _ref.dimensions;
1372
1438
  if (!(dimensions != null && dimensions.length)) {
@@ -1536,11 +1602,15 @@ var LayerListRow = function LayerListRow(_ref) {
1536
1602
  var dimensions = getDimensionsList(layer.dimensions);
1537
1603
  var layerServiceUrl = React.useMemo(function () {
1538
1604
  if (service.type !== 'STAC') {
1605
+ if (service.type === 'EDR') {
1606
+ var collectionId = layer.edrCollectionId;
1607
+ return service.serviceUrl.replace(/\/$/, '') + "/collections/" + encodeURIComponent(collectionId != null ? collectionId : '');
1608
+ }
1539
1609
  return service.serviceUrl;
1540
1610
  }
1541
1611
  var baseUrl = service.serviceUrl.replace(/\/$/, '');
1542
1612
  return baseUrl + "/collections/" + encodeURIComponent(layer.name);
1543
- }, [layer.name, service.serviceUrl, service.type]);
1613
+ }, [layer, service.serviceUrl, service.type]);
1544
1614
  return jsxs(Grid, {
1545
1615
  container: true,
1546
1616
  "data-testid": "layerListLayerRow",
@@ -1683,11 +1753,16 @@ var LayerListRow = function LayerListRow(_ref) {
1683
1753
  });
1684
1754
  };
1685
1755
 
1756
+ var _countTreeLayers = function countTreeLayers(node) {
1757
+ return node.layers.length + Array.from(node.children.values()).reduce(function (count, child) {
1758
+ return count + _countTreeLayers(child);
1759
+ }, 0);
1760
+ };
1686
1761
  var LayerRow = function LayerRow(_ref) {
1687
1762
  var index = _ref.index,
1688
1763
  style = _ref.style,
1689
1764
  services = _ref.services,
1690
- filteredLayers = _ref.filteredLayers,
1765
+ displayRows = _ref.displayRows,
1691
1766
  allLayers = _ref.allLayers,
1692
1767
  allMapIds = _ref.allMapIds,
1693
1768
  addLayer = _ref.addLayer,
@@ -1701,7 +1776,20 @@ var LayerRow = function LayerRow(_ref) {
1701
1776
  currentLayerInfo = _ref.currentLayerInfo,
1702
1777
  layerSelectWidth = _ref.layerSelectWidth,
1703
1778
  rowMargin = _ref.rowMargin;
1704
- var layer = filteredLayers[index];
1779
+ var displayRow = displayRows[index];
1780
+ if (displayRow.type === 'collection') {
1781
+ return jsx("div", {
1782
+ style: style,
1783
+ children: jsx(CollectionListRow, {
1784
+ count: displayRow.count,
1785
+ expanded: displayRow.expanded,
1786
+ level: displayRow.level,
1787
+ onToggle: displayRow.onToggle,
1788
+ title: displayRow.title
1789
+ })
1790
+ });
1791
+ }
1792
+ var layer = displayRow.layer;
1705
1793
  var service = services[layer.serviceName];
1706
1794
  if (!service) {
1707
1795
  return jsx("div", {
@@ -1754,11 +1842,84 @@ var LayerList = function LayerList(_ref2) {
1754
1842
  searchFilter = _ref2.searchFilter,
1755
1843
  isLayerInfoVisibleInStore = _ref2.isLayerInfoVisibleInStore,
1756
1844
  onToggleActiveLayer = _ref2.onToggleActiveLayer,
1757
- currentLayerInfo = _ref2.currentLayerInfo;
1845
+ currentLayerInfo = _ref2.currentLayerInfo,
1846
+ _ref2$expandEdrGroups = _ref2.expandEdrGroupsByDefault,
1847
+ expandEdrGroupsByDefault = _ref2$expandEdrGroups === void 0 ? false : _ref2$expandEdrGroups;
1758
1848
  var _useLayerSelectTransl = useLayerSelectTranslation(),
1759
1849
  t = _useLayerSelectTransl.t;
1850
+ var _React$useState = React.useState({}),
1851
+ expandedCollections = _React$useState[0],
1852
+ setExpandedCollections = _React$useState[1];
1853
+ var displayRows = React.useMemo(function () {
1854
+ var rows = [];
1855
+ var roots = new Map();
1856
+ filteredLayers.forEach(function (layer) {
1857
+ var _parent2;
1858
+ var service = services[layer.serviceName];
1859
+ var isEDR = (service == null ? void 0 : service.type) === 'EDR';
1860
+ if (!isEDR || layer.path.length === 0) {
1861
+ rows.push({
1862
+ type: 'layer',
1863
+ layer: layer
1864
+ });
1865
+ return;
1866
+ }
1867
+ var parent = roots.get(layer.serviceName + ":" + layer.path[0]);
1868
+ layer.path.forEach(function (title, level) {
1869
+ var _parent;
1870
+ var key = layer.serviceName + ":" + layer.path.slice(0, level + 1).join('/');
1871
+ var existing = level === 0 ? roots.get(key) : (_parent = parent) == null ? void 0 : _parent.children.get(key);
1872
+ var node = existing != null ? existing : {
1873
+ key: key,
1874
+ title: title,
1875
+ level: level,
1876
+ children: new Map(),
1877
+ layers: []
1878
+ };
1879
+ if (!existing) {
1880
+ if (parent) {
1881
+ parent.children.set(key, node);
1882
+ } else {
1883
+ roots.set(key, node);
1884
+ }
1885
+ }
1886
+ parent = node;
1887
+ });
1888
+ (_parent2 = parent) == null || _parent2.layers.push(layer);
1889
+ });
1890
+ var _flatten = function flatten(node) {
1891
+ var _expandedCollections$;
1892
+ var expanded = (_expandedCollections$ = expandedCollections[node.key]) != null ? _expandedCollections$ : expandEdrGroupsByDefault;
1893
+ rows.push({
1894
+ type: 'collection',
1895
+ key: node.key,
1896
+ title: node.title,
1897
+ count: _countTreeLayers(node),
1898
+ level: node.level,
1899
+ expanded: expanded,
1900
+ onToggle: function onToggle() {
1901
+ return setExpandedCollections(function (current) {
1902
+ var _Object$assign;
1903
+ return Object.assign({}, current, (_Object$assign = {}, _Object$assign[node.key] = !expanded, _Object$assign));
1904
+ });
1905
+ }
1906
+ });
1907
+ if (!expanded) {
1908
+ return;
1909
+ }
1910
+ node.children.forEach(_flatten);
1911
+ node.layers.forEach(function (layer) {
1912
+ return rows.push({
1913
+ type: 'layer',
1914
+ layer: layer
1915
+ });
1916
+ });
1917
+ };
1918
+ roots.forEach(_flatten);
1919
+ return rows;
1920
+ }, [expandEdrGroupsByDefault, expandedCollections, filteredLayers, services]);
1760
1921
  var rowMargin = 4;
1761
- var rowHeight = widthToRowHeight(layerSelectWidth);
1922
+ var _rowHeight = widthToRowHeight(layerSelectWidth);
1762
1923
  var layerSelectFilterHeight = 155 + serviceListHeight;
1763
1924
  var minHeight = 320;
1764
1925
  var listHeight = layerSelectHeight - layerSelectFilterHeight < minHeight ? minHeight : layerSelectHeight - layerSelectFilterHeight;
@@ -1773,11 +1934,14 @@ var LayerList = function LayerList(_ref2) {
1773
1934
  }), jsx(List$1, {
1774
1935
  defaultHeight: minHeight,
1775
1936
  rowComponent: LayerRow,
1776
- rowCount: filteredLayers.length,
1777
- rowHeight: rowHeight + rowMargin,
1937
+ rowCount: displayRows.length,
1938
+ rowHeight: function rowHeight(index) {
1939
+ return displayRows[index].type === 'collection' ? 48 : _rowHeight + rowMargin;
1940
+ },
1778
1941
  rowProps: {
1779
1942
  services: services,
1780
1943
  filteredLayers: filteredLayers,
1944
+ displayRows: displayRows,
1781
1945
  allLayers: allLayers,
1782
1946
  allMapIds: allMapIds,
1783
1947
  addLayer: addLayer,
@@ -1804,7 +1968,9 @@ var LayerListConnect = function LayerListConnect(_ref) {
1804
1968
  var mapId = _ref.mapId,
1805
1969
  layerSelectHeight = _ref.layerSelectHeight,
1806
1970
  serviceListHeight = _ref.serviceListHeight,
1807
- layerSelectWidth = _ref.layerSelectWidth;
1971
+ layerSelectWidth = _ref.layerSelectWidth,
1972
+ _ref$expandEdrGroupsB = _ref.expandEdrGroupsByDefault,
1973
+ expandEdrGroupsByDefault = _ref$expandEdrGroupsB === void 0 ? false : _ref$expandEdrGroupsB;
1808
1974
  var dispatch = useDispatch();
1809
1975
  var services = useAppSelector(function (store) {
1810
1976
  return serviceSelectors.getServices(store);
@@ -1819,15 +1985,38 @@ var LayerListConnect = function LayerListConnect(_ref) {
1819
1985
  return mapSelectors.getAllMapIds(store);
1820
1986
  });
1821
1987
  var _addLayer = function addLayer(_ref2, mapId) {
1988
+ var _defaultEdrStyles$;
1822
1989
  var serviceUrl = _ref2.serviceUrl,
1823
1990
  layerName = _ref2.layerName,
1824
1991
  serviceType = _ref2.serviceType;
1992
+ var layerType = LayerType.mapLayer;
1993
+ if (serviceType === 'STAC') {
1994
+ layerType = LayerType.stacGeoTIFFLayer;
1995
+ } else if (serviceType === 'EDR') {
1996
+ layerType = LayerType.edrFeatureLayer;
1997
+ }
1825
1998
  var layer = {
1826
1999
  service: serviceUrl,
1827
2000
  name: layerName,
1828
2001
  id: webmapUtils.generateLayerId(),
1829
- layerType: serviceType === 'STAC' ? LayerType.stacGeoTIFFLayer : LayerType.mapLayer
2002
+ layerType: layerType,
2003
+ style: serviceType === 'EDR' ? (_defaultEdrStyles$ = defaultEdrStyles[0]) == null ? void 0 : _defaultEdrStyles$.name : undefined
1830
2004
  };
2005
+ if (serviceType === 'EDR') {
2006
+ var collectionId = decodeURIComponent(serviceUrl.replace(/\/$/, '').split('/').pop());
2007
+ var serviceLayer = Object.values(services).flatMap(function (service) {
2008
+ var _service$layers;
2009
+ return (_service$layers = service.layers) != null ? _service$layers : [];
2010
+ }).find(function (candidate) {
2011
+ var edrCandidate = candidate;
2012
+ return candidate.name === layerName && edrCandidate.edrCollectionId === collectionId;
2013
+ });
2014
+ layer.options = {
2015
+ collectionId: collectionId,
2016
+ parameterNames: [layerName],
2017
+ parameterMetadata: serviceLayer == null ? void 0 : serviceLayer.edrParameter
2018
+ };
2019
+ }
1831
2020
  addMapLayer({
1832
2021
  mapId: mapId,
1833
2022
  layerId: layer.id,
@@ -1925,6 +2114,7 @@ var LayerListConnect = function LayerListConnect(_ref) {
1925
2114
  allMapIds: allMapIds,
1926
2115
  currentLayerInfo: currentLayerInfo,
1927
2116
  deleteLayer: deleteLayer,
2117
+ expandEdrGroupsByDefault: expandEdrGroupsByDefault,
1928
2118
  filteredLayers: filteredLayers,
1929
2119
  isLayerInfoVisibleInStore: isLayerInfoVisibleInStore,
1930
2120
  layerSelectHeight: layerSelectHeight,
@@ -2540,6 +2730,7 @@ var Rows = function Rows(_ref2) {
2540
2730
  var DetectableServiceType;
2541
2731
  (function (DetectableServiceType) {
2542
2732
  DetectableServiceType["STAC"] = "STAC";
2733
+ DetectableServiceType["EDR"] = "EDR";
2543
2734
  DetectableServiceType["WMS"] = "WMS";
2544
2735
  })(DetectableServiceType || (DetectableServiceType = {}));
2545
2736
  var stripStacCollectionsAndTrailingSlashes = function stripStacCollectionsAndTrailingSlashes(serviceUrl) {
@@ -2627,96 +2818,211 @@ var loadWMSService = /*#__PURE__*/function () {
2627
2818
  return _ref.apply(this, arguments);
2628
2819
  };
2629
2820
  }();
2630
- var detectServiceType = /*#__PURE__*/function () {
2631
- var _ref2 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee3(url) {
2632
- var trimmedUrl, isStacServiceUrl, _t2;
2821
+ var getEDRParameters = function getEDRParameters(collection) {
2822
+ var _collection$parameter;
2823
+ if (Array.isArray(collection.parameter_names)) {
2824
+ return collection.parameter_names.map(function (parameter, index) {
2825
+ var _parameter$id;
2826
+ return [(_parameter$id = parameter.id) != null ? _parameter$id : String(index), parameter];
2827
+ });
2828
+ }
2829
+ return Object.entries((_collection$parameter = collection.parameter_names) != null ? _collection$parameter : {});
2830
+ };
2831
+ var getEDRPath = function getEDRPath(collection) {
2832
+ var _ref2, _collection$path, _collection$title;
2833
+ return [].concat((_ref2 = (_collection$path = collection.path) != null ? _collection$path : collection.groups) != null ? _ref2 : collection.group ? [collection.group] : [], [(_collection$title = collection.title) != null ? _collection$title : collection.id]);
2834
+ };
2835
+ var loadEDRService = /*#__PURE__*/function () {
2836
+ var _ref3 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee2(serviceUrl) {
2837
+ var _service$title, _service$description;
2838
+ var normalizedUrl, _yield$Promise$all, service, collectionsResponse, serviceId, layers;
2839
+ return _regenerator().w(function (_context2) {
2840
+ while (1) switch (_context2.n) {
2841
+ case 0:
2842
+ normalizedUrl = serviceUrl.replace(/\/$/, '');
2843
+ _context2.n = 1;
2844
+ return Promise.all([fetchEDRJson(normalizedUrl), fetchEDRJson(normalizedUrl + "/collections")]);
2845
+ case 1:
2846
+ _yield$Promise$all = _context2.v;
2847
+ service = _yield$Promise$all[0];
2848
+ collectionsResponse = _yield$Promise$all[1];
2849
+ serviceId = normalizedUrl.replace(/[^a-zA-Z0-9]/g, '_');
2850
+ layers = collectionsResponse.collections.flatMap(function (collection) {
2851
+ return getEDRParameters(collection).map(function (_ref4) {
2852
+ var _parameter$label, _parameter$observedPr, _parameter$label2;
2853
+ var parameterId = _ref4[0],
2854
+ parameter = _ref4[1];
2855
+ return {
2856
+ name: parameterId,
2857
+ leaf: true,
2858
+ path: getEDRPath(collection),
2859
+ title: (_parameter$label = parameter.label) != null ? _parameter$label : parameterId,
2860
+ "abstract": parameter.description,
2861
+ keywords: (_parameter$observedPr = parameter.observedProperty) != null && _parameter$observedPr.label ? [normalizeEDRLabel(parameter.observedProperty.label, (_parameter$label2 = parameter.label) != null ? _parameter$label2 : parameterId)] : [],
2862
+ // LayerSelect uses these fields when creating an EDR map layer.
2863
+ edrCollectionId: collection.id,
2864
+ edrParameter: parameter,
2865
+ styles: defaultEdrStyles
2866
+ };
2867
+ });
2868
+ });
2869
+ return _context2.a(2, {
2870
+ id: serviceId,
2871
+ name: (_service$title = service.title) != null ? _service$title : serviceId,
2872
+ serviceUrl: normalizedUrl,
2873
+ "abstract": (_service$description = service.description) != null ? _service$description : '',
2874
+ layers: layers,
2875
+ scope: 'user',
2876
+ type: DetectableServiceType.EDR
2877
+ });
2878
+ }
2879
+ }, _callee2);
2880
+ }));
2881
+ return function loadEDRService(_x3) {
2882
+ return _ref3.apply(this, arguments);
2883
+ };
2884
+ }();
2885
+ var isEDRServiceUrl = /*#__PURE__*/function () {
2886
+ var _ref5 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee3(serviceUrl) {
2887
+ var _service$links, service;
2633
2888
  return _regenerator().w(function (_context3) {
2634
- while (1) switch (_context3.n) {
2889
+ while (1) switch (_context3.p = _context3.n) {
2890
+ case 0:
2891
+ _context3.p = 0;
2892
+ _context3.n = 1;
2893
+ return fetchEDRJson(serviceUrl.replace(/\/$/, ''));
2894
+ case 1:
2895
+ service = _context3.v;
2896
+ return _context3.a(2, Boolean((_service$links = service.links) == null ? void 0 : _service$links.some(function (link) {
2897
+ var _link$href;
2898
+ return (link.rel === 'data' || link.rel === 'collections') && ((_link$href = link.href) == null ? void 0 : _link$href.includes('/collections'));
2899
+ })));
2900
+ case 2:
2901
+ _context3.p = 2;
2902
+ _context3.v;
2903
+ return _context3.a(2, false);
2904
+ }
2905
+ }, _callee3, null, [[0, 2]]);
2906
+ }));
2907
+ return function isEDRServiceUrl(_x4) {
2908
+ return _ref5.apply(this, arguments);
2909
+ };
2910
+ }();
2911
+ var detectServiceType = /*#__PURE__*/function () {
2912
+ var _ref6 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee5(url) {
2913
+ var trimmedUrl, isStacServiceUrl, _t3, _t4;
2914
+ return _regenerator().w(function (_context5) {
2915
+ while (1) switch (_context5.n) {
2635
2916
  case 0:
2636
2917
  trimmedUrl = url.trim();
2637
2918
  isStacServiceUrl = /*#__PURE__*/function () {
2638
- var _ref3 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee2(candidateUrl) {
2919
+ var _ref7 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee4(candidateUrl) {
2639
2920
  var root, hasStacRootShape;
2640
- return _regenerator().w(function (_context2) {
2641
- while (1) switch (_context2.p = _context2.n) {
2921
+ return _regenerator().w(function (_context4) {
2922
+ while (1) switch (_context4.p = _context4.n) {
2642
2923
  case 0:
2643
- _context2.p = 0;
2644
- _context2.n = 1;
2924
+ _context4.p = 0;
2925
+ _context4.n = 1;
2645
2926
  return fetchStacCatalogRoot(candidateUrl);
2646
2927
  case 1:
2647
- root = _context2.v;
2928
+ root = _context4.v;
2648
2929
  hasStacRootShape = root.stac_version || root.type === 'Catalog' || Array.isArray(root.conformsTo);
2649
2930
  if (!hasStacRootShape) {
2650
- _context2.n = 2;
2931
+ _context4.n = 2;
2651
2932
  break;
2652
2933
  }
2653
- return _context2.a(2, true);
2934
+ return _context4.a(2, true);
2654
2935
  case 2:
2655
- return _context2.a(2, Boolean(root.type === 'Collection' && root.stac_version && Array.isArray(root.links)));
2936
+ return _context4.a(2, Boolean(root.type === 'Collection' && root.stac_version && Array.isArray(root.links)));
2656
2937
  case 3:
2657
- _context2.p = 3;
2658
- _context2.v;
2659
- return _context2.a(2, false);
2938
+ _context4.p = 3;
2939
+ _context4.v;
2940
+ return _context4.a(2, false);
2660
2941
  }
2661
- }, _callee2, null, [[0, 3]]);
2942
+ }, _callee4, null, [[0, 3]]);
2662
2943
  }));
2663
- return function isStacServiceUrl(_x4) {
2664
- return _ref3.apply(this, arguments);
2944
+ return function isStacServiceUrl(_x6) {
2945
+ return _ref7.apply(this, arguments);
2665
2946
  };
2666
2947
  }();
2667
- _context3.n = 1;
2948
+ _context5.n = 1;
2668
2949
  return isStacServiceUrl(trimmedUrl);
2669
2950
  case 1:
2670
- if (!_context3.v) {
2671
- _context3.n = 2;
2951
+ if (!_context5.v) {
2952
+ _context5.n = 2;
2672
2953
  break;
2673
2954
  }
2674
- return _context3.a(2, DetectableServiceType.STAC);
2955
+ return _context5.a(2, DetectableServiceType.STAC);
2675
2956
  case 2:
2676
- _t2 = !trimmedUrl.endsWith('/');
2677
- if (!_t2) {
2678
- _context3.n = 4;
2957
+ _t3 = !trimmedUrl.endsWith('/');
2958
+ if (!_t3) {
2959
+ _context5.n = 4;
2679
2960
  break;
2680
2961
  }
2681
- _context3.n = 3;
2962
+ _context5.n = 3;
2682
2963
  return isStacServiceUrl(trimmedUrl + "/");
2683
2964
  case 3:
2684
- _t2 = _context3.v;
2965
+ _t3 = _context5.v;
2685
2966
  case 4:
2686
- if (!_t2) {
2687
- _context3.n = 5;
2967
+ if (!_t3) {
2968
+ _context5.n = 5;
2688
2969
  break;
2689
2970
  }
2690
- return _context3.a(2, DetectableServiceType.STAC);
2971
+ return _context5.a(2, DetectableServiceType.STAC);
2691
2972
  case 5:
2692
- return _context3.a(2, DetectableServiceType.WMS);
2973
+ _context5.n = 6;
2974
+ return isEDRServiceUrl(trimmedUrl);
2975
+ case 6:
2976
+ if (!_context5.v) {
2977
+ _context5.n = 7;
2978
+ break;
2979
+ }
2980
+ return _context5.a(2, DetectableServiceType.EDR);
2981
+ case 7:
2982
+ _t4 = !trimmedUrl.endsWith('/');
2983
+ if (!_t4) {
2984
+ _context5.n = 9;
2985
+ break;
2986
+ }
2987
+ _context5.n = 8;
2988
+ return isEDRServiceUrl(trimmedUrl + "/");
2989
+ case 8:
2990
+ _t4 = _context5.v;
2991
+ case 9:
2992
+ if (!_t4) {
2993
+ _context5.n = 10;
2994
+ break;
2995
+ }
2996
+ return _context5.a(2, DetectableServiceType.EDR);
2997
+ case 10:
2998
+ return _context5.a(2, DetectableServiceType.WMS);
2693
2999
  }
2694
- }, _callee3);
3000
+ }, _callee5);
2695
3001
  }));
2696
- return function detectServiceType(_x3) {
2697
- return _ref2.apply(this, arguments);
3002
+ return function detectServiceType(_x5) {
3003
+ return _ref6.apply(this, arguments);
2698
3004
  };
2699
3005
  }();
2700
3006
  var loadSTACService = /*#__PURE__*/function () {
2701
- var _ref4 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee4(serviceUrl) {
2702
- var _ref5, _root$title, _root$description;
2703
- var _yield$Promise$all, root, collections, serviceId, layers;
2704
- return _regenerator().w(function (_context4) {
2705
- while (1) switch (_context4.n) {
3007
+ var _ref8 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee6(serviceUrl) {
3008
+ var _ref9, _root$title, _root$description;
3009
+ var _yield$Promise$all2, root, collections, serviceId, layers;
3010
+ return _regenerator().w(function (_context6) {
3011
+ while (1) switch (_context6.n) {
2706
3012
  case 0:
2707
- _context4.n = 1;
3013
+ _context6.n = 1;
2708
3014
  return Promise.all([fetchStacCatalogRoot(serviceUrl), fetchStacCatalogCollections(serviceUrl)]);
2709
3015
  case 1:
2710
- _yield$Promise$all = _context4.v;
2711
- root = _yield$Promise$all[0];
2712
- collections = _yield$Promise$all[1];
3016
+ _yield$Promise$all2 = _context6.v;
3017
+ root = _yield$Promise$all2[0];
3018
+ collections = _yield$Promise$all2[1];
2713
3019
  serviceId = serviceUrl.replace(/\/+$/, '').replace(/[^a-zA-Z0-9]/g, '_');
2714
3020
  layers = collections.map(stacCatalogCollectionToLayerProps);
2715
- return _context4.a(2, {
3021
+ return _context6.a(2, {
2716
3022
  // Use URL-based ids so different STAC endpoints with identical root.id
2717
3023
  // values (e.g. "stac-fastapi") can coexist in the service store.
2718
3024
  id: serviceId,
2719
- name: (_ref5 = (_root$title = root.title) != null ? _root$title : root.id) != null ? _ref5 : serviceId,
3025
+ name: (_ref9 = (_root$title = root.title) != null ? _root$title : root.id) != null ? _ref9 : serviceId,
2720
3026
  serviceUrl: serviceUrl,
2721
3027
  "abstract": (_root$description = root.description) != null ? _root$description : '',
2722
3028
  layers: layers,
@@ -2724,10 +3030,10 @@ var loadSTACService = /*#__PURE__*/function () {
2724
3030
  type: DetectableServiceType.STAC
2725
3031
  });
2726
3032
  }
2727
- }, _callee4);
3033
+ }, _callee6);
2728
3034
  }));
2729
- return function loadSTACService(_x5) {
2730
- return _ref4.apply(this, arguments);
3035
+ return function loadSTACService(_x7) {
3036
+ return _ref8.apply(this, arguments);
2731
3037
  };
2732
3038
  }();
2733
3039
 
@@ -2886,7 +3192,9 @@ var LayerSelect = function LayerSelect(_ref) {
2886
3192
  _ref$isMultiMap = _ref.isMultiMap,
2887
3193
  isMultiMap = _ref$isMultiMap === void 0 ? false : _ref$isMultiMap,
2888
3194
  _ref$hasDataExplorer = _ref.hasDataExplorer,
2889
- hasDataExplorer = _ref$hasDataExplorer === void 0 ? false : _ref$hasDataExplorer;
3195
+ hasDataExplorer = _ref$hasDataExplorer === void 0 ? false : _ref$hasDataExplorer,
3196
+ _ref$expandEdrGroupsB = _ref.expandEdrGroupsByDefault,
3197
+ expandEdrGroupsByDefault = _ref$expandEdrGroupsB === void 0 ? false : _ref$expandEdrGroupsB;
2890
3198
  var initialServiceListHeight = hasDataExplorer ? 52 : 37;
2891
3199
  var _React$useState = React.useState(startSize.height),
2892
3200
  height = _React$useState[0],
@@ -2993,6 +3301,7 @@ var LayerSelect = function LayerSelect(_ref) {
2993
3301
  padding: '0 16px'
2994
3302
  },
2995
3303
  children: jsx(LayerListConnect, {
3304
+ expandEdrGroupsByDefault: expandEdrGroupsByDefault,
2996
3305
  layerSelectHeight: height,
2997
3306
  layerSelectWidth: width,
2998
3307
  mapId: mapId,
@@ -3083,7 +3392,7 @@ var ServicePopupUnwrapped = function ServicePopupUnwrapped(_ref2) {
3083
3392
  setDetectedServiceType = _React$useState3[1];
3084
3393
  var fetchServiceData = /*#__PURE__*/function () {
3085
3394
  var _ref3 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee(newServiceUrl) {
3086
- var type, serviceUrlForLoading, service, _t;
3395
+ var type, serviceUrlForLoading, service;
3087
3396
  return _regenerator().w(function (_context) {
3088
3397
  while (1) switch (_context.p = _context.n) {
3089
3398
  case 0:
@@ -3105,24 +3414,34 @@ var ServicePopupUnwrapped = function ServicePopupUnwrapped(_ref2) {
3105
3414
  _context.n = 2;
3106
3415
  return loadSTACService(serviceUrlForLoading);
3107
3416
  case 2:
3108
- _t = _context.v;
3109
- _context.n = 5;
3417
+ service = _context.v;
3418
+ _context.n = 7;
3110
3419
  break;
3111
3420
  case 3:
3421
+ if (!(type === DetectableServiceType.EDR)) {
3422
+ _context.n = 5;
3423
+ break;
3424
+ }
3112
3425
  _context.n = 4;
3113
- return loadWMSService(serviceUrlForLoading, true);
3426
+ return loadEDRService(serviceUrlForLoading);
3114
3427
  case 4:
3115
- _t = _context.v;
3428
+ service = _context.v;
3429
+ _context.n = 7;
3430
+ break;
3116
3431
  case 5:
3117
- service = _t;
3432
+ _context.n = 6;
3433
+ return loadWMSService(serviceUrlForLoading, true);
3434
+ case 6:
3435
+ service = _context.v;
3436
+ case 7:
3118
3437
  setValue(FormFields.serviceName, service.name);
3119
3438
  setValue(FormFields.serviceAbstracts, service["abstract"] || '');
3120
3439
  setIsLoading(false);
3121
3440
  setShouldForceReload(false);
3122
- _context.n = 7;
3441
+ _context.n = 9;
3123
3442
  break;
3124
- case 6:
3125
- _context.p = 6;
3443
+ case 8:
3444
+ _context.p = 8;
3126
3445
  _context.v;
3127
3446
  setIsLoading(false);
3128
3447
  setShouldForceReload(true);
@@ -3130,10 +3449,10 @@ var ServicePopupUnwrapped = function ServicePopupUnwrapped(_ref2) {
3130
3449
  message: t('validations-request-failed'),
3131
3450
  type: 'SYSTEM'
3132
3451
  });
3133
- case 7:
3452
+ case 9:
3134
3453
  return _context.a(2);
3135
3454
  }
3136
- }, _callee, null, [[0, 6]]);
3455
+ }, _callee, null, [[0, 8]]);
3137
3456
  }));
3138
3457
  return function fetchServiceData(_x) {
3139
3458
  return _ref3.apply(this, arguments);
@@ -3141,7 +3460,7 @@ var ServicePopupUnwrapped = function ServicePopupUnwrapped(_ref2) {
3141
3460
  }();
3142
3461
  var addNewService = /*#__PURE__*/function () {
3143
3462
  var _ref4 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee2(formValues) {
3144
- var type, serviceUrlForSaving, service, _t3, _t4;
3463
+ var type, serviceUrlForSaving, service, _t2;
3145
3464
  return _regenerator().w(function (_context2) {
3146
3465
  while (1) switch (_context2.p = _context2.n) {
3147
3466
  case 0:
@@ -3152,16 +3471,16 @@ var ServicePopupUnwrapped = function ServicePopupUnwrapped(_ref2) {
3152
3471
  _context2.n = 2;
3153
3472
  break;
3154
3473
  }
3155
- _t3 = detectedServiceType;
3474
+ _t2 = detectedServiceType;
3156
3475
  _context2.n = 4;
3157
3476
  break;
3158
3477
  case 2:
3159
3478
  _context2.n = 3;
3160
3479
  return detectServiceType(formValues.serviceUrl);
3161
3480
  case 3:
3162
- _t3 = _context2.v;
3481
+ _t2 = _context2.v;
3163
3482
  case 4:
3164
- type = _t3;
3483
+ type = _t2;
3165
3484
  serviceUrlForSaving = type === DetectableServiceType.STAC ? normalizeStacServiceUrl(formValues.serviceUrl) : formValues.serviceUrl;
3166
3485
  if (!(type === DetectableServiceType.STAC)) {
3167
3486
  _context2.n = 6;
@@ -3170,16 +3489,26 @@ var ServicePopupUnwrapped = function ServicePopupUnwrapped(_ref2) {
3170
3489
  _context2.n = 5;
3171
3490
  return loadSTACService(serviceUrlForSaving);
3172
3491
  case 5:
3173
- _t4 = _context2.v;
3174
- _context2.n = 8;
3492
+ service = _context2.v;
3493
+ _context2.n = 10;
3175
3494
  break;
3176
3495
  case 6:
3496
+ if (!(type === DetectableServiceType.EDR)) {
3497
+ _context2.n = 8;
3498
+ break;
3499
+ }
3177
3500
  _context2.n = 7;
3178
- return loadWMSService(serviceUrlForSaving, shouldForceReload);
3501
+ return loadEDRService(serviceUrlForSaving);
3179
3502
  case 7:
3180
- _t4 = _context2.v;
3503
+ service = _context2.v;
3504
+ _context2.n = 10;
3505
+ break;
3181
3506
  case 8:
3182
- service = _t4;
3507
+ _context2.n = 9;
3508
+ return loadWMSService(serviceUrlForSaving, shouldForceReload);
3509
+ case 9:
3510
+ service = _context2.v;
3511
+ case 10:
3183
3512
  if (serviceUrlForSaving !== formValues.serviceUrl) {
3184
3513
  setValue(FormFields.serviceUrl, serviceUrlForSaving);
3185
3514
  }
@@ -3195,20 +3524,20 @@ var ServicePopupUnwrapped = function ServicePopupUnwrapped(_ref2) {
3195
3524
  setIsLoading(false);
3196
3525
  showSnackbar(getSuccesMessage(formValues.serviceName, t));
3197
3526
  closePopup();
3198
- _context2.n = 10;
3527
+ _context2.n = 12;
3199
3528
  break;
3200
- case 9:
3201
- _context2.p = 9;
3529
+ case 11:
3530
+ _context2.p = 11;
3202
3531
  _context2.v;
3203
3532
  setIsLoading(false);
3204
3533
  setError(FormFields.serviceUrl, {
3205
3534
  message: t('validations-request-failed'),
3206
3535
  type: 'SYSTEM'
3207
3536
  });
3208
- case 10:
3537
+ case 12:
3209
3538
  return _context2.a(2);
3210
3539
  }
3211
- }, _callee2, null, [[1, 9]]);
3540
+ }, _callee2, null, [[1, 11]]);
3212
3541
  }));
3213
3542
  return function addNewService(_x2) {
3214
3543
  return _ref4.apply(this, arguments);
@@ -0,0 +1,10 @@
1
+ import React from 'react';
2
+ interface CollectionListRowProps {
3
+ title: string;
4
+ count: number;
5
+ level: number;
6
+ expanded: boolean;
7
+ onToggle: () => void;
8
+ }
9
+ export declare const CollectionListRow: React.FC<CollectionListRowProps>;
10
+ export {};
@@ -27,6 +27,7 @@ export interface LayerListProps {
27
27
  isActiveLayer: boolean;
28
28
  }) => void;
29
29
  currentLayerInfo?: AddLayerParams;
30
+ expandEdrGroupsByDefault?: boolean;
30
31
  }
31
32
  export declare const LayerList: React.FC<LayerListProps>;
32
33
  export {};
@@ -4,6 +4,7 @@ interface LayerListConnectProps {
4
4
  layerSelectHeight: number;
5
5
  serviceListHeight: number;
6
6
  layerSelectWidth: number;
7
+ expandEdrGroupsByDefault?: boolean;
7
8
  }
8
9
  export declare const LayerListConnect: React.FC<LayerListConnectProps>;
9
10
  export {};
@@ -16,6 +16,7 @@ interface LayerSelectProps {
16
16
  startSize?: Size;
17
17
  isMultiMap?: boolean;
18
18
  hasDataExplorer?: boolean;
19
+ expandEdrGroupsByDefault?: boolean;
19
20
  }
20
21
  export declare const LayerSelect: React.FC<LayerSelectProps>;
21
22
  export {};
@@ -3,6 +3,7 @@ import type { serviceTypes } from '@opengeoweb/store';
3
3
  import type { layerSelectTypes } from '../../store';
4
4
  export declare enum DetectableServiceType {
5
5
  STAC = "STAC",
6
+ EDR = "EDR",
6
7
  WMS = "WMS"
7
8
  }
8
9
  export type ValidationResult = string | boolean;
@@ -10,5 +11,6 @@ export declare const normalizeStacServiceUrl: (serviceUrl: string | null | undef
10
11
  export declare const validateServiceName: (t: TFunction, value: string, services: layerSelectTypes.ActiveServiceObjectEntities, ownServiceName?: string) => ValidationResult;
11
12
  export declare const validateServiceUrl: (t: TFunction, value: string, services: layerSelectTypes.ActiveServiceObjectEntities) => ValidationResult;
12
13
  export declare const loadWMSService: (serviceUrl: string, forceReload?: boolean) => Promise<serviceTypes.SetLayersForServicePayload>;
14
+ export declare const loadEDRService: (serviceUrl: string) => Promise<serviceTypes.SetLayersForServicePayload>;
13
15
  export declare const detectServiceType: (url: string) => Promise<DetectableServiceType>;
14
16
  export declare const loadSTACService: (serviceUrl: string) => Promise<serviceTypes.SetLayersForServicePayload>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@opengeoweb/layer-select",
3
- "version": "20.0.1",
3
+ "version": "20.1.0-nightly-20261017",
4
4
  "description": "GeoWeb layer select library for the opengeoweb project",
5
5
  "license": "Apache-2.0",
6
6
  "repository": {
@@ -20,15 +20,15 @@
20
20
  }
21
21
  },
22
22
  "dependencies": {
23
- "@opengeoweb/shared": "20.0.1",
24
- "@opengeoweb/store": "20.0.1",
23
+ "@opengeoweb/shared": "20.1.0-nightly-20261017",
24
+ "@opengeoweb/store": "20.1.0-nightly-20261017",
25
25
  "react-redux": "^9.2.0",
26
- "@opengeoweb/theme": "20.0.1",
27
- "@opengeoweb/webmap-react": "20.0.1",
28
- "@opengeoweb/webmap": "20.0.1",
26
+ "@opengeoweb/theme": "20.1.0-nightly-20261017",
27
+ "@opengeoweb/webmap-react": "20.1.0-nightly-20261017",
28
+ "@opengeoweb/webmap": "20.1.0-nightly-20261017",
29
29
  "react-window": "^2.2.6",
30
- "@opengeoweb/snackbar": "20.0.1",
31
- "@opengeoweb/form-fields": "20.0.1",
30
+ "@opengeoweb/snackbar": "20.1.0-nightly-20261017",
31
+ "@opengeoweb/form-fields": "20.1.0-nightly-20261017",
32
32
  "react-hook-form": "^7.50.1",
33
33
  "@reduxjs/toolkit": "^2.6.1",
34
34
  "lodash": "^4.18.1",