@opengeoweb/layer-select 10.1.0 → 10.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/index.esm.js
CHANGED
|
@@ -7,7 +7,7 @@ import { Filter, LayersAdd, Add, Cached, Edit, Visibility, Delete, Close, Copy }
|
|
|
7
7
|
import { uiTypes, serviceActions, selectorMemoizationOptions, serviceSelectors, uiActions, getUserAddedServices, setUserAddedServices, layerActions, uiSelectors, layerSelectors, useSetupDialog, mapSelectors, layerTypes } from '@opengeoweb/store';
|
|
8
8
|
import { createEntityAdapter, createSlice, createSelector, createListenerMiddleware, isAnyOf } from '@reduxjs/toolkit';
|
|
9
9
|
import { compact, countBy, partition } from 'lodash';
|
|
10
|
-
import { Switch, Grid2, List, Box, Typography, Backdrop, CircularProgress, Button, ListItem, ListItemText, Dialog, DialogTitle, LinearProgress, DialogContent, InputAdornment, DialogActions } from '@mui/material';
|
|
10
|
+
import { Switch, Grid2, List, Box, Typography, useTheme, Backdrop, CircularProgress, Button, ListItem, ListItemText, Dialog, DialogTitle, LinearProgress, DialogContent, InputAdornment, DialogActions } from '@mui/material';
|
|
11
11
|
import 'i18next';
|
|
12
12
|
import { useTranslation } from 'react-i18next';
|
|
13
13
|
import { FixedSizeList } from 'react-window';
|
|
@@ -622,7 +622,7 @@ var getFilteredLayers = createSelector([getEnabledServiceIds, serviceSelectors.g
|
|
|
622
622
|
/**
|
|
623
623
|
* Returns service popup details
|
|
624
624
|
*
|
|
625
|
-
* Example
|
|
625
|
+
* Example getServicePopupDetails(store, 'server-id');
|
|
626
626
|
* @param {object} store store: object - store object
|
|
627
627
|
* @returns {object} returnType: object of active service
|
|
628
628
|
*/
|
|
@@ -630,6 +630,27 @@ var getServicePopupDetails = function getServicePopupDetails(store) {
|
|
|
630
630
|
var _store$layerSelect3;
|
|
631
631
|
return (store == null || (_store$layerSelect3 = store.layerSelect) == null ? void 0 : _store$layerSelect3.servicePopup) || initialServicePopupState;
|
|
632
632
|
};
|
|
633
|
+
/**
|
|
634
|
+
* Returns service with active filtered layers from seaerch
|
|
635
|
+
*
|
|
636
|
+
* Example getFilteredActiveServices(store);
|
|
637
|
+
* @param {object} store store: object - store object
|
|
638
|
+
* @returns {object} returnType: object of active service
|
|
639
|
+
*/
|
|
640
|
+
var getFilteredActiveServices = createSelector([getFilteredLayers, getActiveServices, getSearchFilter], function (layers, activeServices, searchResult) {
|
|
641
|
+
var servicesResult = searchResult.length ? layers.reduce(function (layers, _ref) {
|
|
642
|
+
var serviceName = _ref.serviceName;
|
|
643
|
+
return layers.includes(serviceName) ? layers : layers.concat(serviceName);
|
|
644
|
+
}, []) : [];
|
|
645
|
+
var updatedServices = Object.fromEntries(Object.entries(activeServices).map(function (_ref2) {
|
|
646
|
+
var key = _ref2[0],
|
|
647
|
+
service = _ref2[1];
|
|
648
|
+
return [key, Object.assign({}, service, {
|
|
649
|
+
isInSearch: servicesResult.includes(service.serviceId)
|
|
650
|
+
})];
|
|
651
|
+
}));
|
|
652
|
+
return updatedServices;
|
|
653
|
+
}, selectorMemoizationOptions);
|
|
633
654
|
|
|
634
655
|
var selectors = /*#__PURE__*/Object.freeze({
|
|
635
656
|
__proto__: null,
|
|
@@ -643,6 +664,7 @@ var selectors = /*#__PURE__*/Object.freeze({
|
|
|
643
664
|
getCheckedFilterIds: getCheckedFilterIds,
|
|
644
665
|
getEnabledServiceIds: getEnabledServiceIds,
|
|
645
666
|
getFilterById: getFilterById,
|
|
667
|
+
getFilteredActiveServices: getFilteredActiveServices,
|
|
646
668
|
getFilteredLayers: getFilteredLayers,
|
|
647
669
|
getFilters: getFilters,
|
|
648
670
|
getSearchFilter: getSearchFilter,
|
|
@@ -1936,9 +1958,12 @@ var ServiceChip = function ServiceChip(_ref) {
|
|
|
1936
1958
|
service = _ref.service,
|
|
1937
1959
|
isSelected = _ref.isSelected,
|
|
1938
1960
|
isDisabled = _ref.isDisabled,
|
|
1939
|
-
toggleChip = _ref.toggleChip
|
|
1961
|
+
toggleChip = _ref.toggleChip,
|
|
1962
|
+
isInSearch = _ref.isInSearch;
|
|
1940
1963
|
var _useLayerSelectTransl = useLayerSelectTranslation(),
|
|
1941
1964
|
t = _useLayerSelectTransl.t;
|
|
1965
|
+
var _useTheme = useTheme(),
|
|
1966
|
+
geowebColors = _useTheme.palette.geowebColors;
|
|
1942
1967
|
var chip = all ? 'all' : service && service.serviceUrl;
|
|
1943
1968
|
return jsx(CustomTooltip, {
|
|
1944
1969
|
title: service != null && service["abstract"] ? "Abstract: " + service["abstract"] : '',
|
|
@@ -1955,7 +1980,17 @@ var ServiceChip = function ServiceChip(_ref) {
|
|
|
1955
1980
|
return toggleChip(chip);
|
|
1956
1981
|
},
|
|
1957
1982
|
disabled: isDisabled,
|
|
1958
|
-
sx: style$1,
|
|
1983
|
+
sx: Object.assign({}, style$1, isInSearch && Object.assign({
|
|
1984
|
+
backgroundColor: geowebColors.chip.highlightDefault.rgba + "!important",
|
|
1985
|
+
'&:hover': {
|
|
1986
|
+
backgroundColor: geowebColors.chip.highlightDefaultMouseOver.rgba + "!important"
|
|
1987
|
+
}
|
|
1988
|
+
}, isSelected && {
|
|
1989
|
+
backgroundColor: geowebColors.chip.highlightActiveDefault.rgba + "!important",
|
|
1990
|
+
'&:hover': {
|
|
1991
|
+
backgroundColor: geowebColors.chip.highlightActiveMouseOver.rgba + "!important"
|
|
1992
|
+
}
|
|
1993
|
+
})),
|
|
1959
1994
|
children: service ? service.serviceName : t('all')
|
|
1960
1995
|
})
|
|
1961
1996
|
})
|
|
@@ -1967,6 +2002,7 @@ var ServiceChipConnect = function ServiceChipConnect(_ref) {
|
|
|
1967
2002
|
isAllSelected = _ref.isAllSelected;
|
|
1968
2003
|
var dispatch = useDispatch();
|
|
1969
2004
|
var serviceId = service.serviceId;
|
|
2005
|
+
var isInSearch = service.isInSearch || false;
|
|
1970
2006
|
var toggleChip = function toggleChip() {
|
|
1971
2007
|
if (service.enabled) {
|
|
1972
2008
|
if (isAllSelected) {
|
|
@@ -1988,7 +2024,8 @@ var ServiceChipConnect = function ServiceChipConnect(_ref) {
|
|
|
1988
2024
|
service: service,
|
|
1989
2025
|
toggleChip: toggleChip,
|
|
1990
2026
|
isSelected: isAllSelected ? false : service.enabled,
|
|
1991
|
-
isDisabled: service.isLoading
|
|
2027
|
+
isDisabled: service.isLoading,
|
|
2028
|
+
isInSearch: isInSearch
|
|
1992
2029
|
});
|
|
1993
2030
|
};
|
|
1994
2031
|
var AllChipConnect = function AllChipConnect(_ref2) {
|
|
@@ -2058,12 +2095,12 @@ var ServiceList = function ServiceList(_ref) {
|
|
|
2058
2095
|
|
|
2059
2096
|
var ServiceListConnect = function ServiceListConnect(_ref) {
|
|
2060
2097
|
var setHeight = _ref.setHeight;
|
|
2061
|
-
var
|
|
2062
|
-
return
|
|
2098
|
+
var filteredActiveServices = useAppSelector(function (store) {
|
|
2099
|
+
return getFilteredActiveServices(store);
|
|
2063
2100
|
});
|
|
2064
2101
|
return jsx(ServiceList, {
|
|
2065
2102
|
setHeight: setHeight,
|
|
2066
|
-
activeServicesById: sortByService(
|
|
2103
|
+
activeServicesById: sortByService(filteredActiveServices)
|
|
2067
2104
|
});
|
|
2068
2105
|
};
|
|
2069
2106
|
|
package/package.json
CHANGED
|
@@ -90,8 +90,48 @@ export declare const getFilteredLayers: ((state: LayerSelectModuleState & import
|
|
|
90
90
|
/**
|
|
91
91
|
* Returns service popup details
|
|
92
92
|
*
|
|
93
|
-
* Example
|
|
93
|
+
* Example getServicePopupDetails(store, 'server-id');
|
|
94
94
|
* @param {object} store store: object - store object
|
|
95
95
|
* @returns {object} returnType: object of active service
|
|
96
96
|
*/
|
|
97
97
|
export declare const getServicePopupDetails: (store: LayerSelectModuleState) => ServicePopupObject;
|
|
98
|
+
/**
|
|
99
|
+
* Returns service with active filtered layers from seaerch
|
|
100
|
+
*
|
|
101
|
+
* Example getFilteredActiveServices(store);
|
|
102
|
+
* @param {object} store store: object - store object
|
|
103
|
+
* @returns {object} returnType: object of active service
|
|
104
|
+
*/
|
|
105
|
+
export declare const getFilteredActiveServices: ((state: LayerSelectModuleState & import("@opengeoweb/store").CoreAppStore) => {
|
|
106
|
+
[k: string]: {
|
|
107
|
+
isInSearch: boolean;
|
|
108
|
+
serviceId?: string | undefined;
|
|
109
|
+
serviceName?: string | undefined;
|
|
110
|
+
serviceUrl?: string | undefined;
|
|
111
|
+
abstract?: string | undefined;
|
|
112
|
+
enabled?: boolean | undefined;
|
|
113
|
+
filterIds?: string[] | undefined;
|
|
114
|
+
scope?: import("dist/libs/store/src/store/map/types").ServiceScope | undefined;
|
|
115
|
+
isLoading?: boolean | undefined;
|
|
116
|
+
keywords?: string[] | undefined;
|
|
117
|
+
groups?: string[] | undefined;
|
|
118
|
+
};
|
|
119
|
+
}) & import("reselect").OutputSelectorFields<(args_0: LayerWithServiceName[], args_1: ActiveServiceObjectEntities, args_2: string) => {
|
|
120
|
+
[k: string]: {
|
|
121
|
+
isInSearch: boolean;
|
|
122
|
+
serviceId?: string | undefined;
|
|
123
|
+
serviceName?: string | undefined;
|
|
124
|
+
serviceUrl?: string | undefined;
|
|
125
|
+
abstract?: string | undefined;
|
|
126
|
+
enabled?: boolean | undefined;
|
|
127
|
+
filterIds?: string[] | undefined;
|
|
128
|
+
scope?: import("dist/libs/store/src/store/map/types").ServiceScope | undefined;
|
|
129
|
+
isLoading?: boolean | undefined;
|
|
130
|
+
keywords?: string[] | undefined;
|
|
131
|
+
groups?: string[] | undefined;
|
|
132
|
+
};
|
|
133
|
+
}, {
|
|
134
|
+
clearCache: () => void;
|
|
135
|
+
}> & {
|
|
136
|
+
clearCache: () => void;
|
|
137
|
+
};
|