@opengeoweb/layer-select 9.23.1 → 9.24.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
|
@@ -2,12 +2,12 @@ import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
|
|
|
2
2
|
import * as React from 'react';
|
|
3
3
|
import React__default from 'react';
|
|
4
4
|
import { useSelector, useDispatch } from 'react-redux';
|
|
5
|
-
import { CustomIconButton, ToolContainerDraggable, CustomAccordion, CustomToggleButton, CustomTooltip, SearchHighlight, SearchField, ToggleMenu } from '@opengeoweb/shared';
|
|
5
|
+
import { CustomIconButton, FilterListItem, ToolContainerDraggable, CustomAccordion, CustomToggleButton, CustomTooltip, SearchHighlight, SearchField, ToggleMenu } from '@opengeoweb/shared';
|
|
6
6
|
import { Filter, LayersAdd, Add, Cached, Edit, Visibility, Delete, Close, Copy } from '@opengeoweb/theme';
|
|
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 {
|
|
10
|
+
import { Switch, Grid, List, Box, Typography, Backdrop, CircularProgress, Button, ListItem, ListItemText, ListItemSecondaryAction, Dialog, DialogTitle, LinearProgress, DialogContent, InputAdornment, DialogActions } from '@mui/material';
|
|
11
11
|
import i18n from 'i18next';
|
|
12
12
|
import { useTranslation } from 'react-i18next';
|
|
13
13
|
import { FixedSizeList } from 'react-window';
|
|
@@ -21,7 +21,6 @@ var en = {
|
|
|
21
21
|
"layer-select": "Layer Select",
|
|
22
22
|
"select-all": "Select all",
|
|
23
23
|
"groups-and-keywords-dialog-title": "Groups & Keywords",
|
|
24
|
-
only: "ONLY",
|
|
25
24
|
add: "add",
|
|
26
25
|
remove: "remove",
|
|
27
26
|
"layer-list-results": "results",
|
|
@@ -59,7 +58,6 @@ var fi = {
|
|
|
59
58
|
"layer-select": "Layer Select",
|
|
60
59
|
"select-all": "Valitse kaikki",
|
|
61
60
|
"groups-and-keywords-dialog-title": "Ryhmät ja Avainsanat",
|
|
62
|
-
only: "Pelkästään",
|
|
63
61
|
add: "lisää",
|
|
64
62
|
remove: "poista",
|
|
65
63
|
"layer-list-results": "tulosta",
|
|
@@ -97,7 +95,6 @@ var no = {
|
|
|
97
95
|
"layer-select": "Lagvalg",
|
|
98
96
|
"select-all": "Velg alle",
|
|
99
97
|
"groups-and-keywords-dialog-title": "Grupper & Nøkkelord",
|
|
100
|
-
only: "BARE",
|
|
101
98
|
add: "legg til",
|
|
102
99
|
remove: "fjern",
|
|
103
100
|
"layer-list-results": "resultat",
|
|
@@ -135,7 +132,6 @@ var nl = {
|
|
|
135
132
|
"layer-select": "Layer Select",
|
|
136
133
|
"select-all": "Selecteer alles",
|
|
137
134
|
"groups-and-keywords-dialog-title": "Groepen & Trefwoorden",
|
|
138
|
-
only: "ALLEEN",
|
|
139
135
|
add: "toevoegen",
|
|
140
136
|
remove: "verwijderen",
|
|
141
137
|
"layer-list-results": "resultaten",
|
|
@@ -2956,128 +2952,6 @@ const KeywordFilterButtonConnect = ({
|
|
|
2956
2952
|
}));
|
|
2957
2953
|
};
|
|
2958
2954
|
|
|
2959
|
-
const LAYER_SELECT_NAMESPACE = 'layerselect';
|
|
2960
|
-
const useLayerSelectTranslation = () => useTranslation(LAYER_SELECT_NAMESPACE);
|
|
2961
|
-
const translateKeyOutsideComponents = (key, params = undefined) => i18n.t(key, Object.assign({
|
|
2962
|
-
ns: [LAYER_SELECT_NAMESPACE]
|
|
2963
|
-
}, params));
|
|
2964
|
-
|
|
2965
|
-
const FilterListItem = ({
|
|
2966
|
-
filter,
|
|
2967
|
-
toggleFilter,
|
|
2968
|
-
enableOnlyOneFilter
|
|
2969
|
-
}) => {
|
|
2970
|
-
const {
|
|
2971
|
-
t
|
|
2972
|
-
} = useLayerSelectTranslation();
|
|
2973
|
-
const [isHovering, setIsHovering] = React.useState(false);
|
|
2974
|
-
const handleMouseEnter = React.useCallback(() => {
|
|
2975
|
-
setIsHovering(true);
|
|
2976
|
-
}, []);
|
|
2977
|
-
const handleMouseLeave = React.useCallback(() => {
|
|
2978
|
-
setIsHovering(false);
|
|
2979
|
-
}, []);
|
|
2980
|
-
const selectOnlyOne = filterId => {
|
|
2981
|
-
enableOnlyOneFilter(filterId);
|
|
2982
|
-
};
|
|
2983
|
-
const toggleCheckbox = filterId => {
|
|
2984
|
-
toggleFilter([filterId]);
|
|
2985
|
-
};
|
|
2986
|
-
const mouseMoveRef = React.useRef(null);
|
|
2987
|
-
React.useEffect(() => {
|
|
2988
|
-
window.addEventListener('mousemove', checkHover, true);
|
|
2989
|
-
return () => {
|
|
2990
|
-
window.removeEventListener('mousemove', checkHover, true);
|
|
2991
|
-
};
|
|
2992
|
-
});
|
|
2993
|
-
const checkHover = e => {
|
|
2994
|
-
if (mouseMoveRef.current) {
|
|
2995
|
-
const mouseOver = mouseMoveRef.current.contains(e.target);
|
|
2996
|
-
if (!isHovering && mouseOver) {
|
|
2997
|
-
handleMouseEnter();
|
|
2998
|
-
}
|
|
2999
|
-
if (isHovering && !mouseOver) {
|
|
3000
|
-
handleMouseLeave();
|
|
3001
|
-
}
|
|
3002
|
-
}
|
|
3003
|
-
};
|
|
3004
|
-
if (filter.amountVisible !== 0) {
|
|
3005
|
-
return jsx("div", Object.assign({
|
|
3006
|
-
ref: mouseMoveRef,
|
|
3007
|
-
onMouseEnter: handleMouseEnter,
|
|
3008
|
-
onMouseLeave: handleMouseLeave,
|
|
3009
|
-
onFocus: handleMouseEnter,
|
|
3010
|
-
onBlur: handleMouseLeave
|
|
3011
|
-
}, {
|
|
3012
|
-
children: jsxs(ListItem, Object.assign({
|
|
3013
|
-
sx: {
|
|
3014
|
-
width: '100%',
|
|
3015
|
-
minWidth: '300px',
|
|
3016
|
-
padding: '0px',
|
|
3017
|
-
paddingLeft: '0px',
|
|
3018
|
-
paddingRight: '50px',
|
|
3019
|
-
fontSize: '12px'
|
|
3020
|
-
}
|
|
3021
|
-
}, {
|
|
3022
|
-
children: [jsx(ListItemIcon, Object.assign({
|
|
3023
|
-
sx: {
|
|
3024
|
-
minWidth: '42px'
|
|
3025
|
-
}
|
|
3026
|
-
}, {
|
|
3027
|
-
children: jsx(Checkbox, {
|
|
3028
|
-
inputProps: {
|
|
3029
|
-
'aria-label': filter.name
|
|
3030
|
-
},
|
|
3031
|
-
color: "secondary",
|
|
3032
|
-
checked: filter.checked,
|
|
3033
|
-
onChange: () => {
|
|
3034
|
-
toggleCheckbox(filter.id);
|
|
3035
|
-
},
|
|
3036
|
-
sx: {
|
|
3037
|
-
paddingTop: '6px',
|
|
3038
|
-
paddingBottom: '7px',
|
|
3039
|
-
'&&:hover': {
|
|
3040
|
-
backgroundColor: 'transparent'
|
|
3041
|
-
}
|
|
3042
|
-
}
|
|
3043
|
-
})
|
|
3044
|
-
})), jsxs(Typography, Object.assign({
|
|
3045
|
-
variant: "body2",
|
|
3046
|
-
sx: {
|
|
3047
|
-
fontSize: '16px',
|
|
3048
|
-
textOverflow: 'ellipsis',
|
|
3049
|
-
whiteSpace: 'nowrap',
|
|
3050
|
-
overflow: 'hidden'
|
|
3051
|
-
}
|
|
3052
|
-
}, {
|
|
3053
|
-
children: [filter.name, " (", filter.amountVisible, ")"]
|
|
3054
|
-
})), isHovering ? jsx(ListItemSecondaryAction, {
|
|
3055
|
-
children: jsx(CustomIconButton, Object.assign({
|
|
3056
|
-
"aria-label": `Only ${filter.name}`,
|
|
3057
|
-
style: {
|
|
3058
|
-
backgroundColor: 'transparent',
|
|
3059
|
-
width: 'auto'
|
|
3060
|
-
},
|
|
3061
|
-
edge: "end",
|
|
3062
|
-
onClick: () => selectOnlyOne(filter.id)
|
|
3063
|
-
}, {
|
|
3064
|
-
children: jsx(Typography, Object.assign({
|
|
3065
|
-
sx: {
|
|
3066
|
-
color: 'geowebColors.buttons.primary.default.fill',
|
|
3067
|
-
fontSize: '14px',
|
|
3068
|
-
fontWeight: 500
|
|
3069
|
-
}
|
|
3070
|
-
}, {
|
|
3071
|
-
children: t('only')
|
|
3072
|
-
}))
|
|
3073
|
-
}))
|
|
3074
|
-
}) : null]
|
|
3075
|
-
}))
|
|
3076
|
-
}));
|
|
3077
|
-
}
|
|
3078
|
-
return null;
|
|
3079
|
-
};
|
|
3080
|
-
|
|
3081
2955
|
const KeywordFilterResultsListItemConnect = ({
|
|
3082
2956
|
filter
|
|
3083
2957
|
}) => {
|
|
@@ -3120,6 +2994,12 @@ const KeywordFilterSelectAllSwitchConnect = () => {
|
|
|
3120
2994
|
});
|
|
3121
2995
|
};
|
|
3122
2996
|
|
|
2997
|
+
const LAYER_SELECT_NAMESPACE = 'layerselect';
|
|
2998
|
+
const useLayerSelectTranslation = () => useTranslation(LAYER_SELECT_NAMESPACE);
|
|
2999
|
+
const translateKeyOutsideComponents = (key, params = undefined) => i18n.t(key, Object.assign({
|
|
3000
|
+
ns: [LAYER_SELECT_NAMESPACE]
|
|
3001
|
+
}, params));
|
|
3002
|
+
|
|
3123
3003
|
const listStyle = {
|
|
3124
3004
|
padding: '0px'
|
|
3125
3005
|
};
|
|
@@ -5150,4 +5030,4 @@ const LayerSelectConnect = ({
|
|
|
5150
5030
|
});
|
|
5151
5031
|
};
|
|
5152
5032
|
|
|
5153
|
-
export { AllChipConnect,
|
|
5033
|
+
export { AllChipConnect, KeywordFilterButtonConnect, KeywordFilterResults, KeywordFilterResultsConnect, KeywordFilterResultsListItemConnect, KeywordFilterSelectAllSwitchConnect, LAYER_SELECT_NAMESPACE, LayerAddRemoveButton, LayerList, LayerListConnect, LayerListDimensions, LayerListRow, LayerSelectButtonConnect, LayerSelectConnect, SearchFieldConnect, ServiceChip, ServiceChipConnect, ServiceList, ServiceListConnect, ServiceOptionsButton, ServiceOptionsDialog, ServiceOptionsDialogConnect, ServicePopup, ServicePopupConnect, ServicePopupDialogConnect, getServiceFailedUpdateMessage, getServiceSuccesUpdateMessage, getSuccesMessage, isUserAddedService, layerSelectActions, layerSelectConfig, initialState as layerSelectInitialState, reducer as layerSelectReducer, selectors as layerSelectSelectors, layerSelectTranslations, types as layerSelectTypes, useAppSelector };
|
package/package.json
CHANGED
package/src/lib/store/types.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { FilterListItemFilter } from '@opengeoweb/shared';
|
|
1
2
|
import { CoreAppStore, serviceTypes } from '@opengeoweb/store';
|
|
2
3
|
import { EntityState } from '@reduxjs/toolkit';
|
|
3
4
|
export type RootState = CoreAppStore & LayerSelectModuleState;
|
|
@@ -17,12 +18,8 @@ export interface ActiveServiceObject {
|
|
|
17
18
|
groups?: string[];
|
|
18
19
|
}
|
|
19
20
|
export type FilterType = 'keywords' | 'groups';
|
|
20
|
-
export interface Filter {
|
|
21
|
-
id: string;
|
|
22
|
-
name: string;
|
|
23
|
-
checked?: boolean;
|
|
21
|
+
export interface Filter extends FilterListItemFilter {
|
|
24
22
|
type: FilterType;
|
|
25
|
-
amountVisible?: number;
|
|
26
23
|
}
|
|
27
24
|
export type ActiveServiceObjectEntities = Record<string, ActiveServiceObject>;
|
|
28
25
|
export type Filters = EntityState<Filter>;
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import * as React from 'react';
|
|
2
|
-
import { layerSelectTypes } from '../../store';
|
|
3
|
-
export interface FilterListItemProps {
|
|
4
|
-
filter: layerSelectTypes.Filter;
|
|
5
|
-
toggleFilter: (filterIds: string[]) => void;
|
|
6
|
-
enableOnlyOneFilter: (filterId: string) => void;
|
|
7
|
-
}
|
|
8
|
-
export declare const FilterListItem: React.FC<FilterListItemProps>;
|