@opengeoweb/layer-select 9.20.2 → 9.22.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 +236 -57
- package/package.json +4 -4
- package/src/index.d.ts +1 -0
- package/src/lib/components/KeywordFilterResults/KeywordFilterResults.d.ts +0 -1
- package/src/lib/components/Providers/Providers.d.ts +14 -0
- package/src/lib/components/ServicePopup/ServicePopup.d.ts +0 -4
- package/src/lib/components/ServicePopup/utils.d.ts +0 -5
- package/src/lib/utils/i18n.d.ts +6 -2
- package/src/lib/components/testUtils/TestThemeStoreProvider.d.ts +0 -6
package/index.esm.js
CHANGED
|
@@ -11,6 +11,8 @@ import { createStore } from '@redux-eggs/redux-toolkit';
|
|
|
11
11
|
import { getSagaExtension } from '@redux-eggs/saga-extension';
|
|
12
12
|
import { takeEvery, select, put, all } from 'redux-saga/effects';
|
|
13
13
|
import { ListItem, ListItemIcon, Checkbox, Typography, ListItemSecondaryAction, Switch, Grid, List, Box, Backdrop, CircularProgress, Button, ListItemText, Dialog, DialogTitle, LinearProgress, DialogContent, InputAdornment, DialogActions } from '@mui/material';
|
|
14
|
+
import i18n from 'i18next';
|
|
15
|
+
import { useTranslation } from 'react-i18next';
|
|
14
16
|
import { FixedSizeList } from 'react-window';
|
|
15
17
|
import { getDimensionsList, LayerInfoButton } from '@opengeoweb/webmap-react';
|
|
16
18
|
import { webmapUtils, LayerType, getCapabilities, WMGetServiceFromStore, clearImageCacheForAllMaps } from '@opengeoweb/webmap';
|
|
@@ -19,18 +21,158 @@ import { ReactHookFormProvider, defaultFormOptions, ReactHookFormTextField } fro
|
|
|
19
21
|
import { useFormContext } from 'react-hook-form';
|
|
20
22
|
|
|
21
23
|
var en = {
|
|
22
|
-
"layer-select": "Layer Select"
|
|
24
|
+
"layer-select": "Layer Select",
|
|
25
|
+
"select-all": "Select all",
|
|
26
|
+
"groups-and-keywords-dialog-title": "Groups & Keywords",
|
|
27
|
+
only: "ONLY",
|
|
28
|
+
add: "add",
|
|
29
|
+
remove: "remove",
|
|
30
|
+
"layer-list-results": "results",
|
|
31
|
+
groups: "Groups",
|
|
32
|
+
keywords: "Keywords",
|
|
33
|
+
"layer-select-button-tooltip": "Open the layer selector",
|
|
34
|
+
all: "All",
|
|
35
|
+
services: "Services",
|
|
36
|
+
"add-a-new-service": "Add a new service",
|
|
37
|
+
"update-service-title": "Update layers from WMS service",
|
|
38
|
+
"edit-service-title": "Edit Service",
|
|
39
|
+
"save-service-title": "Save service",
|
|
40
|
+
"show-service-title": "Show Service",
|
|
41
|
+
"service-has-active-layers-error": "Service has active layers. Cannot remove this service",
|
|
42
|
+
"delete-service": "Delete Service",
|
|
43
|
+
"copy-url-message": "Service URL copied to clipboard",
|
|
44
|
+
"get-success-message": "Service \"{{serviceName}}\" has been saved successfully",
|
|
45
|
+
"service-popup-helper-text": "Short description of what this service does",
|
|
46
|
+
close: "close",
|
|
47
|
+
cancel: "cancel",
|
|
48
|
+
save: "save",
|
|
49
|
+
"validations-name-existing": "This name already exists. Choose another name.",
|
|
50
|
+
"validations-service-existing": "URL already exists.",
|
|
51
|
+
"validations-service-valid-url": "Not a valid URL.",
|
|
52
|
+
"validations-request-failed": "Download failed. Check the URL.",
|
|
53
|
+
"validations-field-required": "This field is required",
|
|
54
|
+
"service-url-label": "This service refers to this URL",
|
|
55
|
+
"service-name-label": "Service name",
|
|
56
|
+
"service-abstracts-label": "Abstracts",
|
|
57
|
+
"service-successfully-updated": "Service \"{{serviceName}}\" has been succesfully updated",
|
|
58
|
+
"unable-to-update-service": "Unable to update service, reason: \"{{message}}\"",
|
|
59
|
+
"service-has-been-deleted": "Service \"{{serviceName}}\" has been deleted"
|
|
23
60
|
};
|
|
24
61
|
var fi = {
|
|
25
|
-
"layer-select": "Layer Select"
|
|
62
|
+
"layer-select": "Layer Select",
|
|
63
|
+
"select-all": "Ei käännetty",
|
|
64
|
+
"groups-and-keywords-dialog-title": "Ei käännetty",
|
|
65
|
+
only: "Ei käännetty",
|
|
66
|
+
add: "Ei käännetty",
|
|
67
|
+
remove: "Ei käännetty",
|
|
68
|
+
"layer-list-results": "Ei käännetty",
|
|
69
|
+
groups: "Ei käännetty",
|
|
70
|
+
keywords: "Ei käännetty",
|
|
71
|
+
"layer-select-button-tooltip": "Ei käännetty",
|
|
72
|
+
all: "Ei käännetty",
|
|
73
|
+
services: "Ei käännetty",
|
|
74
|
+
"add-a-new-service": "Ei käännetty",
|
|
75
|
+
"update-service-title": "Ei käännetty",
|
|
76
|
+
"edit-service-title": "Ei käännetty",
|
|
77
|
+
"save-service-title": "Ei käännetty",
|
|
78
|
+
"show-service-title": "Ei käännetty",
|
|
79
|
+
"service-has-active-layers-error": "Ei käännetty",
|
|
80
|
+
"delete-service": "Ei käännetty",
|
|
81
|
+
"copy-url-message": "Ei käännetty",
|
|
82
|
+
"get-success-message": "Ei käännetty",
|
|
83
|
+
"service-popup-helper-text": "Ei käännetty",
|
|
84
|
+
close: "Ei käännetty",
|
|
85
|
+
cancel: "Ei käännetty",
|
|
86
|
+
save: "Ei käännetty",
|
|
87
|
+
"validations-name-existing": "Ei käännetty",
|
|
88
|
+
"validations-service-existing": "Ei käännetty",
|
|
89
|
+
"validations-service-valid-url": "Ei käännetty",
|
|
90
|
+
"validations-request-failed": "Ei käännetty",
|
|
91
|
+
"validations-field-required": "Ei käännetty",
|
|
92
|
+
"service-url-label": "Ei käännetty",
|
|
93
|
+
"service-name-label": "Ei käännetty",
|
|
94
|
+
"service-abstracts-label": "Ei käännetty",
|
|
95
|
+
"service-successfully-updated": "Ei käännetty",
|
|
96
|
+
"unable-to-update-service": "Ei käännetty",
|
|
97
|
+
"service-has-been-deleted": "Ei käännetty"
|
|
26
98
|
};
|
|
27
99
|
var no = {
|
|
28
|
-
"layer-select": "
|
|
100
|
+
"layer-select": "Lagvalg",
|
|
101
|
+
"select-all": "Velg alle",
|
|
102
|
+
"groups-and-keywords-dialog-title": "Grupper & Nøkkelord",
|
|
103
|
+
only: "BARE",
|
|
104
|
+
add: "legg til",
|
|
105
|
+
remove: "fjern",
|
|
106
|
+
"layer-list-results": "resultat",
|
|
107
|
+
groups: "Grupper",
|
|
108
|
+
keywords: "Nøkkelord",
|
|
109
|
+
"layer-select-button-tooltip": "Åpne lagvalg",
|
|
110
|
+
all: "ALLE",
|
|
111
|
+
services: "Tjenester",
|
|
112
|
+
"add-a-new-service": "Legg til en ny tjeneste",
|
|
113
|
+
"update-service-title": "Oppdater lag fra WMS-tjeneste",
|
|
114
|
+
"edit-service-title": "Rediger tjeneste",
|
|
115
|
+
"save-service-title": "Lagre tjeneste",
|
|
116
|
+
"show-service-title": "Vis tjeneste",
|
|
117
|
+
"service-has-active-layers-error": "Tjenesten har aktive lag. Kan ikke fjerne denne tjenesten",
|
|
118
|
+
"delete-service": "Slett tjeneste",
|
|
119
|
+
"copy-url-message": "Kopier tjeneste-URL til utklippstavle",
|
|
120
|
+
"get-success-message": "Tjeneste \"{{serviceName}}\" har blitt lagret",
|
|
121
|
+
"service-popup-helper-text": "Kort beskrivelse av hva denne tjenesten gjør",
|
|
122
|
+
close: "lukk",
|
|
123
|
+
cancel: "avbryt",
|
|
124
|
+
save: "lagre",
|
|
125
|
+
"validations-name-existing": "Dette navnet eksisterer fra før. Velg et annet navn.",
|
|
126
|
+
"validations-service-existing": "URL eksisterer fra før.",
|
|
127
|
+
"validations-service-valid-url": "Ikke en gyldig URL",
|
|
128
|
+
"validations-request-failed": "Nedlasting feilet. Sjekk URLen",
|
|
129
|
+
"validations-field-required": "Dette feltet er påkrevd",
|
|
130
|
+
"service-url-label": "Denne tjenesten referer til denne URLen",
|
|
131
|
+
"service-name-label": "Tjenestenavn",
|
|
132
|
+
"service-abstracts-label": "Sammendrag",
|
|
133
|
+
"service-successfully-updated": "Tjeneste \"{{serviceName}}\" har blitt oppdatert",
|
|
134
|
+
"unable-to-update-service": "Kan ikke oppdatere tjeneste, grunn: \"{{message}}\"",
|
|
135
|
+
"service-has-been-deleted": "Tjeneste \"{{serviceName}}\" har blitt slettet"
|
|
29
136
|
};
|
|
30
137
|
var nl = {
|
|
31
|
-
"layer-select": "Layer Select"
|
|
32
|
-
|
|
33
|
-
|
|
138
|
+
"layer-select": "Layer Select",
|
|
139
|
+
"select-all": "Selecteer alles",
|
|
140
|
+
"groups-and-keywords-dialog-title": "Groepen & Trefwoorden",
|
|
141
|
+
only: "ALLEEN",
|
|
142
|
+
add: "toevoegen",
|
|
143
|
+
remove: "verwijderen",
|
|
144
|
+
"layer-list-results": "resultaten",
|
|
145
|
+
groups: "Groepen",
|
|
146
|
+
keywords: "Trefwoorden",
|
|
147
|
+
"layer-select-button-tooltip": "Open de Layer Select",
|
|
148
|
+
all: "Alle",
|
|
149
|
+
services: "Services",
|
|
150
|
+
"add-a-new-service": "Voeg een nieuwe service toe",
|
|
151
|
+
"update-service-title": "Lagen bijwerken vanaf WMS service",
|
|
152
|
+
"edit-service-title": "Service bewerken",
|
|
153
|
+
"save-service-title": "Service opslaan",
|
|
154
|
+
"show-service-title": "Service tonen",
|
|
155
|
+
"service-has-active-layers-error": "Service heeft actieve lagen. Kan niet verwijderd worden",
|
|
156
|
+
"delete-service": "Service verwijderen",
|
|
157
|
+
"copy-url-message": "Service URL is naar het klembord gekopieerd",
|
|
158
|
+
"get-success-message": "Service \"{{serviceName}}\" is succesvol opgeslagen",
|
|
159
|
+
"service-popup-helper-text": "Korte beschrijving van wat de service doet",
|
|
160
|
+
close: "sluiten",
|
|
161
|
+
cancel: "annuleren",
|
|
162
|
+
save: "opslaan",
|
|
163
|
+
"validations-name-existing": "Deze naam is al in gebruik. Kies een andere naam.",
|
|
164
|
+
"validations-service-existing": "URL is al in gebruik.",
|
|
165
|
+
"validations-service-valid-url": "Geen geldige URL.",
|
|
166
|
+
"validations-request-failed": "Download mislukt. Controleer de URL.",
|
|
167
|
+
"validations-field-required": "Dit veld is verplicht",
|
|
168
|
+
"service-url-label": "Deze service verwijst naar deze URL",
|
|
169
|
+
"service-name-label": "Service naam",
|
|
170
|
+
"service-abstracts-label": "Beschrijving",
|
|
171
|
+
"service-successfully-updated": "Service \"{{serviceName}}\" is succesvol bijgewerkt",
|
|
172
|
+
"unable-to-update-service": "Bijwerken service niet mogelijk, reden: \"{{message}}\"",
|
|
173
|
+
"service-has-been-deleted": "Service \"{{serviceName}}\" is verwijderd"
|
|
174
|
+
};
|
|
175
|
+
var layerSelectTranslations = {
|
|
34
176
|
en: en,
|
|
35
177
|
fi: fi,
|
|
36
178
|
no: no,
|
|
@@ -2797,11 +2939,20 @@ const KeywordFilterButtonConnect = ({
|
|
|
2797
2939
|
}));
|
|
2798
2940
|
};
|
|
2799
2941
|
|
|
2942
|
+
const LAYER_SELECT_NAMESPACE = 'layerselect';
|
|
2943
|
+
const useLayerSelectTranslation = () => useTranslation(LAYER_SELECT_NAMESPACE);
|
|
2944
|
+
const translateKeyOutsideComponents = (key, params = undefined) => i18n.t(key, Object.assign({
|
|
2945
|
+
ns: [LAYER_SELECT_NAMESPACE]
|
|
2946
|
+
}, params));
|
|
2947
|
+
|
|
2800
2948
|
const FilterListItem = ({
|
|
2801
2949
|
filter,
|
|
2802
2950
|
toggleFilter,
|
|
2803
2951
|
enableOnlyOneFilter
|
|
2804
2952
|
}) => {
|
|
2953
|
+
const {
|
|
2954
|
+
t
|
|
2955
|
+
} = useLayerSelectTranslation();
|
|
2805
2956
|
const [isHovering, setIsHovering] = React.useState(false);
|
|
2806
2957
|
const handleMouseEnter = React.useCallback(() => {
|
|
2807
2958
|
setIsHovering(true);
|
|
@@ -2900,7 +3051,7 @@ const FilterListItem = ({
|
|
|
2900
3051
|
fontWeight: 500
|
|
2901
3052
|
}
|
|
2902
3053
|
}, {
|
|
2903
|
-
children:
|
|
3054
|
+
children: t('only')
|
|
2904
3055
|
}))
|
|
2905
3056
|
}))
|
|
2906
3057
|
}) : null]
|
|
@@ -2952,7 +3103,6 @@ const KeywordFilterSelectAllSwitchConnect = () => {
|
|
|
2952
3103
|
});
|
|
2953
3104
|
};
|
|
2954
3105
|
|
|
2955
|
-
const DIALOG_TITLE = 'Groups & Keywords';
|
|
2956
3106
|
const listStyle = {
|
|
2957
3107
|
padding: '0px'
|
|
2958
3108
|
};
|
|
@@ -2969,8 +3119,11 @@ const KeywordFilterResults = ({
|
|
|
2969
3119
|
order: _order = 0,
|
|
2970
3120
|
source: _source = 'module'
|
|
2971
3121
|
}) => {
|
|
3122
|
+
const {
|
|
3123
|
+
t
|
|
3124
|
+
} = useLayerSelectTranslation();
|
|
2972
3125
|
return jsxs(ToolContainerDraggable, Object.assign({
|
|
2973
|
-
title:
|
|
3126
|
+
title: t('groups-and-keywords-dialog-title'),
|
|
2974
3127
|
"data-testid": "keywordFilterResults",
|
|
2975
3128
|
startSize: {
|
|
2976
3129
|
width: 349,
|
|
@@ -3008,7 +3161,7 @@ const KeywordFilterResults = ({
|
|
|
3008
3161
|
padding: '15px 15px 0 24px'
|
|
3009
3162
|
}
|
|
3010
3163
|
}, {
|
|
3011
|
-
children:
|
|
3164
|
+
children: t('select-all')
|
|
3012
3165
|
})), jsx(Grid, Object.assign({
|
|
3013
3166
|
container: true,
|
|
3014
3167
|
item: true,
|
|
@@ -3022,7 +3175,7 @@ const KeywordFilterResults = ({
|
|
|
3022
3175
|
children: jsx(KeywordFilterSelectAllSwitchConnect, {})
|
|
3023
3176
|
}))]
|
|
3024
3177
|
})), jsx(CustomAccordion, Object.assign({
|
|
3025
|
-
title:
|
|
3178
|
+
title: t('groups'),
|
|
3026
3179
|
detailsSx: accordionDetailsStyle
|
|
3027
3180
|
}, {
|
|
3028
3181
|
children: jsx(List, Object.assign({
|
|
@@ -3034,7 +3187,7 @@ const KeywordFilterResults = ({
|
|
|
3034
3187
|
}, group.id))
|
|
3035
3188
|
}))
|
|
3036
3189
|
})), jsx(CustomAccordion, Object.assign({
|
|
3037
|
-
title:
|
|
3190
|
+
title: t('keywords'),
|
|
3038
3191
|
detailsSx: accordionDetailsStyle
|
|
3039
3192
|
}, {
|
|
3040
3193
|
children: jsx(List, Object.assign({
|
|
@@ -3084,6 +3237,9 @@ const LayerAddRemoveButton = ({
|
|
|
3084
3237
|
deleteLayer,
|
|
3085
3238
|
mapLayers
|
|
3086
3239
|
}) => {
|
|
3240
|
+
const {
|
|
3241
|
+
t
|
|
3242
|
+
} = useLayerSelectTranslation();
|
|
3087
3243
|
const foundLayer = mapLayers.find(lr => lr.name === layer.name && lr.service === serviceUrl);
|
|
3088
3244
|
return jsx(CustomToggleButton, Object.assign({
|
|
3089
3245
|
"data-testid": `layerAddRemoveButton-${layer.name}`,
|
|
@@ -3104,7 +3260,7 @@ const LayerAddRemoveButton = ({
|
|
|
3104
3260
|
},
|
|
3105
3261
|
className: "layerAddRemoveButton"
|
|
3106
3262
|
}, {
|
|
3107
|
-
children: !foundLayer ? '
|
|
3263
|
+
children: !foundLayer ? t('add') : t('remove')
|
|
3108
3264
|
}));
|
|
3109
3265
|
};
|
|
3110
3266
|
|
|
@@ -3258,6 +3414,9 @@ const LayerListRow = ({
|
|
|
3258
3414
|
onToggleActiveLayer
|
|
3259
3415
|
}) => {
|
|
3260
3416
|
var _a;
|
|
3417
|
+
const {
|
|
3418
|
+
t
|
|
3419
|
+
} = useLayerSelectTranslation();
|
|
3261
3420
|
const rowHeight = widthToRowHeight(layerSelectWidth);
|
|
3262
3421
|
const columns = widthToColumns(layerSelectWidth);
|
|
3263
3422
|
const dimensions = getDimensionsList(layer.dimensions);
|
|
@@ -3358,14 +3517,14 @@ const LayerListRow = ({
|
|
|
3358
3517
|
children: [layer.path.length > 0 && jsxs(Typography, Object.assign({
|
|
3359
3518
|
sx: layerInfoStyle
|
|
3360
3519
|
}, {
|
|
3361
|
-
children: ["
|
|
3520
|
+
children: [t('groups'), ":", ' ', jsx(SearchHighlight, {
|
|
3362
3521
|
text: layer.path.join(' / '),
|
|
3363
3522
|
search: searchFilter
|
|
3364
3523
|
})]
|
|
3365
3524
|
})), ((_a = layer.keywords) === null || _a === void 0 ? void 0 : _a.length) > 0 && jsxs(Typography, Object.assign({
|
|
3366
3525
|
sx: layerInfoStyle
|
|
3367
3526
|
}, {
|
|
3368
|
-
children: ["
|
|
3527
|
+
children: [t('keywords'), ":", ' ', jsx(SearchHighlight, {
|
|
3369
3528
|
text: layer.keywords.slice().sort((a, b) => {
|
|
3370
3529
|
return a.localeCompare(b);
|
|
3371
3530
|
}).join(', '),
|
|
@@ -3412,6 +3571,9 @@ const LayerList = ({
|
|
|
3412
3571
|
onToggleActiveLayer,
|
|
3413
3572
|
currentLayerInfo
|
|
3414
3573
|
}) => {
|
|
3574
|
+
const {
|
|
3575
|
+
t
|
|
3576
|
+
} = useLayerSelectTranslation();
|
|
3415
3577
|
const rowMargin = 4;
|
|
3416
3578
|
const rowHeight = widthToRowHeight(layerSelectWidth);
|
|
3417
3579
|
const layerSelectFilterHeight = 155 + serviceListHeight;
|
|
@@ -3425,7 +3587,7 @@ const LayerList = ({
|
|
|
3425
3587
|
fontSize: '12px'
|
|
3426
3588
|
}
|
|
3427
3589
|
}, {
|
|
3428
|
-
children: [filteredLayers.length, " results
|
|
3590
|
+
children: [filteredLayers.length, " ", t('layer-list-results')]
|
|
3429
3591
|
})), jsx(FixedSizeList, Object.assign({
|
|
3430
3592
|
height: layerSelectHeight - layerSelectFilterHeight < minHeight ? minHeight : layerSelectHeight - layerSelectFilterHeight,
|
|
3431
3593
|
itemCount: filteredLayers.length,
|
|
@@ -3549,12 +3711,15 @@ const style$2 = {
|
|
|
3549
3711
|
const LayerSelectButtonConnect = ({
|
|
3550
3712
|
mapId,
|
|
3551
3713
|
source: _source = 'app',
|
|
3552
|
-
tooltipTitle
|
|
3714
|
+
tooltipTitle,
|
|
3553
3715
|
icon: _icon = jsx(LayersAdd, {
|
|
3554
3716
|
"data-testid": "layerSelectButtonConnectIcon"
|
|
3555
3717
|
}),
|
|
3556
3718
|
isMultiMap: _isMultiMap = false
|
|
3557
3719
|
}) => {
|
|
3720
|
+
const {
|
|
3721
|
+
t
|
|
3722
|
+
} = useLayerSelectTranslation();
|
|
3558
3723
|
const dispatch = useDispatch();
|
|
3559
3724
|
const dialogType = _isMultiMap ? `${uiTypes.DialogTypes.LayerSelect}-${mapId}` : uiTypes.DialogTypes.LayerSelect;
|
|
3560
3725
|
const currentActiveMapId = useAppSelector(store => uiSelectors.getDialogMapId(store, dialogType));
|
|
@@ -3572,7 +3737,7 @@ const LayerSelectButtonConnect = ({
|
|
|
3572
3737
|
sx: style$2,
|
|
3573
3738
|
id: "layerSelectButton",
|
|
3574
3739
|
"data-testid": "layerSelectButton",
|
|
3575
|
-
tooltipTitle:
|
|
3740
|
+
tooltipTitle: tooltipTitle || t('layer-select-button-tooltip')
|
|
3576
3741
|
}, {
|
|
3577
3742
|
children: _icon
|
|
3578
3743
|
}));
|
|
@@ -3617,6 +3782,9 @@ const ServiceChip = ({
|
|
|
3617
3782
|
isDisabled,
|
|
3618
3783
|
toggleChip
|
|
3619
3784
|
}) => {
|
|
3785
|
+
const {
|
|
3786
|
+
t
|
|
3787
|
+
} = useLayerSelectTranslation();
|
|
3620
3788
|
const chip = _all ? 'all' : service && service.serviceUrl;
|
|
3621
3789
|
return jsx(CustomTooltip, Object.assign({
|
|
3622
3790
|
title: (service === null || service === void 0 ? void 0 : service.abstract) ? `Abstract: ${service.abstract}` : ''
|
|
@@ -3632,7 +3800,7 @@ const ServiceChip = ({
|
|
|
3632
3800
|
disabled: isDisabled,
|
|
3633
3801
|
sx: style$1
|
|
3634
3802
|
}, {
|
|
3635
|
-
children: service ? service.serviceName : '
|
|
3803
|
+
children: service ? service.serviceName : t('all')
|
|
3636
3804
|
}))
|
|
3637
3805
|
})
|
|
3638
3806
|
}));
|
|
@@ -3837,6 +4005,9 @@ const ServiceOptionsDialog = ({
|
|
|
3837
4005
|
setServicePopupInfo,
|
|
3838
4006
|
isLoading: _isLoading = false
|
|
3839
4007
|
}) => {
|
|
4008
|
+
const {
|
|
4009
|
+
t
|
|
4010
|
+
} = useLayerSelectTranslation();
|
|
3840
4011
|
const openAddService = () => {
|
|
3841
4012
|
setServicePopupInfo({
|
|
3842
4013
|
isOpen: true,
|
|
@@ -3862,7 +4033,7 @@ const ServiceOptionsDialog = ({
|
|
|
3862
4033
|
children: [jsx(Box, Object.assign({
|
|
3863
4034
|
sx: styles.header
|
|
3864
4035
|
}, {
|
|
3865
|
-
children:
|
|
4036
|
+
children: t('services')
|
|
3866
4037
|
})), jsx(Backdrop, Object.assign({
|
|
3867
4038
|
sx: styles.loading,
|
|
3868
4039
|
open: _isLoading
|
|
@@ -3885,16 +4056,13 @@ const ServiceOptionsDialog = ({
|
|
|
3885
4056
|
variant: "tertiary",
|
|
3886
4057
|
startIcon: jsx(Add, {})
|
|
3887
4058
|
}, {
|
|
3888
|
-
children:
|
|
4059
|
+
children: t('add-a-new-service')
|
|
3889
4060
|
}))
|
|
3890
4061
|
}))]
|
|
3891
4062
|
}));
|
|
3892
4063
|
};
|
|
3893
|
-
const updateServiceTitle = 'Update layers from WMS service';
|
|
3894
|
-
const editServiceTitle = 'Edit Service';
|
|
3895
|
-
const showServiceTitle = 'Show Service';
|
|
3896
4064
|
const deleteServiceTitle = hasActiveLayers => {
|
|
3897
|
-
return hasActiveLayers ? '
|
|
4065
|
+
return hasActiveLayers ? translateKeyOutsideComponents('service-has-active-layers-error') : translateKeyOutsideComponents('delete-service');
|
|
3898
4066
|
};
|
|
3899
4067
|
const tooltipPlacement = () => {
|
|
3900
4068
|
return 'left';
|
|
@@ -3917,6 +4085,9 @@ const Rows = ({
|
|
|
3917
4085
|
setServicePopupInfo,
|
|
3918
4086
|
selectedLayers
|
|
3919
4087
|
}) => {
|
|
4088
|
+
const {
|
|
4089
|
+
t
|
|
4090
|
+
} = useLayerSelectTranslation();
|
|
3920
4091
|
const checkIfServiceHasActiveLayers = serviceUrl => {
|
|
3921
4092
|
const foundService = selectedLayers.find(object => object.service === serviceUrl);
|
|
3922
4093
|
if (foundService) {
|
|
@@ -3966,7 +4137,7 @@ const Rows = ({
|
|
|
3966
4137
|
}, {
|
|
3967
4138
|
children: [jsx(CustomTooltip, Object.assign({
|
|
3968
4139
|
"data-testid": "updateServiceTooltip",
|
|
3969
|
-
title:
|
|
4140
|
+
title: t('update-service-title'),
|
|
3970
4141
|
placement: tooltipPlacement(),
|
|
3971
4142
|
PopperProps: tooltipPopperProps
|
|
3972
4143
|
}, {
|
|
@@ -3981,7 +4152,7 @@ const Rows = ({
|
|
|
3981
4152
|
children: jsx(Cached, {})
|
|
3982
4153
|
}))
|
|
3983
4154
|
})), userAddedService ? jsx(CustomTooltip, Object.assign({
|
|
3984
|
-
title:
|
|
4155
|
+
title: t('edit-service-title'),
|
|
3985
4156
|
placement: tooltipPlacement(),
|
|
3986
4157
|
PopperProps: tooltipPopperProps
|
|
3987
4158
|
}, {
|
|
@@ -4003,7 +4174,7 @@ const Rows = ({
|
|
|
4003
4174
|
}))
|
|
4004
4175
|
})
|
|
4005
4176
|
})) : jsx(CustomTooltip, Object.assign({
|
|
4006
|
-
title:
|
|
4177
|
+
title: t('show-service-title'),
|
|
4007
4178
|
placement: tooltipPlacement(),
|
|
4008
4179
|
PopperProps: tooltipPopperProps
|
|
4009
4180
|
}, {
|
|
@@ -4284,17 +4455,13 @@ $({ target: 'RegExp', proto: true, forced: !DELEGATES_TO_EXEC }, {
|
|
|
4284
4455
|
}
|
|
4285
4456
|
});
|
|
4286
4457
|
|
|
4287
|
-
const VALIDATIONS_NAME_EXISTING = 'This name already exists. Choose another name.';
|
|
4288
|
-
const VALIDATIONS_SERVICE_EXISTING = 'URL already exists.';
|
|
4289
|
-
const VALIDATIONS_SERVICE_VALID_URL = 'Not a valid URL.';
|
|
4290
|
-
const VALIDATIONS_REQUEST_FAILED = 'Download failed. Check the URL.';
|
|
4291
4458
|
const validateServiceName = (value, services, ownServiceName = '') => {
|
|
4292
4459
|
const serviceName = value === null || value === void 0 ? void 0 : value.toLowerCase();
|
|
4293
4460
|
const foundName = Object.keys(services).find(serviceId => {
|
|
4294
4461
|
var _a;
|
|
4295
4462
|
return ((_a = services[serviceId]) === null || _a === void 0 ? void 0 : _a.serviceName.toLowerCase()) === serviceName && serviceName !== ownServiceName.toLocaleLowerCase();
|
|
4296
4463
|
});
|
|
4297
|
-
return foundName === undefined ? true :
|
|
4464
|
+
return foundName === undefined ? true : translateKeyOutsideComponents('validations-name-existing');
|
|
4298
4465
|
};
|
|
4299
4466
|
const isValidUrl = url => {
|
|
4300
4467
|
if (url === '' || url === null || typeof url === 'undefined') {
|
|
@@ -4311,7 +4478,7 @@ const validateServiceUrl = (value, services) => {
|
|
|
4311
4478
|
// validate valid url
|
|
4312
4479
|
const isServiceUrlValid = isValidUrl(serviceUrl);
|
|
4313
4480
|
if (!isServiceUrlValid) {
|
|
4314
|
-
return
|
|
4481
|
+
return translateKeyOutsideComponents('validations-service-valid-url');
|
|
4315
4482
|
}
|
|
4316
4483
|
// check url existing
|
|
4317
4484
|
const foundUrl = Object.keys(services).find(serviceId => {
|
|
@@ -4319,7 +4486,7 @@ const validateServiceUrl = (value, services) => {
|
|
|
4319
4486
|
return ((_a = services[serviceId]) === null || _a === void 0 ? void 0 : _a.serviceUrl) === serviceUrl;
|
|
4320
4487
|
});
|
|
4321
4488
|
if (foundUrl) {
|
|
4322
|
-
return
|
|
4489
|
+
return translateKeyOutsideComponents('validations-service-existing');
|
|
4323
4490
|
}
|
|
4324
4491
|
return true;
|
|
4325
4492
|
};
|
|
@@ -4347,8 +4514,17 @@ const getService = (services, serviceUrl) => {
|
|
|
4347
4514
|
}
|
|
4348
4515
|
return services[serviceIds[serviceIndex]];
|
|
4349
4516
|
};
|
|
4350
|
-
const getServiceSuccesUpdateMessage = serviceName =>
|
|
4351
|
-
|
|
4517
|
+
const getServiceSuccesUpdateMessage = serviceName => translateKeyOutsideComponents('service-successfully-updated', {
|
|
4518
|
+
serviceName
|
|
4519
|
+
});
|
|
4520
|
+
const getServiceFailedUpdateMessage = error => {
|
|
4521
|
+
const {
|
|
4522
|
+
message
|
|
4523
|
+
} = error;
|
|
4524
|
+
return translateKeyOutsideComponents('unable-to-update-service', {
|
|
4525
|
+
message
|
|
4526
|
+
});
|
|
4527
|
+
};
|
|
4352
4528
|
const ServiceOptionsDialogConnect = ({
|
|
4353
4529
|
mapId
|
|
4354
4530
|
}) => {
|
|
@@ -4370,7 +4546,9 @@ const ServiceOptionsDialogConnect = ({
|
|
|
4370
4546
|
const services = useAppSelector(store => getActiveServices(store));
|
|
4371
4547
|
const selectedLayers = useAppSelector(store => mapSelectors.getMapLayersWithoutDimensionCurrentValue(store, mapId));
|
|
4372
4548
|
const layerSelectRemoveService = React.useCallback((serviceId, serviceUrl, serviceName) => {
|
|
4373
|
-
const message =
|
|
4549
|
+
const message = translateKeyOutsideComponents('service-has-been-deleted', {
|
|
4550
|
+
serviceName
|
|
4551
|
+
});
|
|
4374
4552
|
showSnackbar(message);
|
|
4375
4553
|
dispatch(layerSelectActions.layerSelectRemoveService({
|
|
4376
4554
|
serviceId,
|
|
@@ -4548,19 +4726,17 @@ const style = {
|
|
|
4548
4726
|
marginBottom: 2
|
|
4549
4727
|
}
|
|
4550
4728
|
};
|
|
4551
|
-
const
|
|
4552
|
-
|
|
4553
|
-
|
|
4554
|
-
const COPY_URL_MESSAGE = 'Service URL copied to clipboard';
|
|
4555
|
-
const getSuccesMessage = serviceName => `Service "${serviceName}" has been saved succesfully`;
|
|
4729
|
+
const getSuccesMessage = serviceName => translateKeyOutsideComponents('get-success-message', {
|
|
4730
|
+
serviceName
|
|
4731
|
+
});
|
|
4556
4732
|
const getTitleForVariant = variant => {
|
|
4557
4733
|
switch (variant) {
|
|
4558
4734
|
case 'add':
|
|
4559
|
-
return
|
|
4735
|
+
return translateKeyOutsideComponents('add-a-new-service');
|
|
4560
4736
|
case 'edit':
|
|
4561
|
-
return
|
|
4737
|
+
return translateKeyOutsideComponents('edit-service-title');
|
|
4562
4738
|
case 'save':
|
|
4563
|
-
return
|
|
4739
|
+
return translateKeyOutsideComponents('save-service-title');
|
|
4564
4740
|
default:
|
|
4565
4741
|
return 'Service';
|
|
4566
4742
|
}
|
|
@@ -4605,6 +4781,9 @@ const ServicePopupUnwrapped = ({
|
|
|
4605
4781
|
serviceName,
|
|
4606
4782
|
showSnackbar: _showSnackbar = () => {}
|
|
4607
4783
|
}) => {
|
|
4784
|
+
const {
|
|
4785
|
+
t
|
|
4786
|
+
} = useLayerSelectTranslation();
|
|
4608
4787
|
const {
|
|
4609
4788
|
formState: {
|
|
4610
4789
|
errors
|
|
@@ -4631,7 +4810,7 @@ const ServicePopupUnwrapped = ({
|
|
|
4631
4810
|
setIsLoading(false);
|
|
4632
4811
|
setShouldForceReload(true);
|
|
4633
4812
|
setError(fields.serviceUrl.name, {
|
|
4634
|
-
message:
|
|
4813
|
+
message: t('validations-request-failed'),
|
|
4635
4814
|
type: 'SYSTEM'
|
|
4636
4815
|
});
|
|
4637
4816
|
}
|
|
@@ -4655,7 +4834,7 @@ const ServicePopupUnwrapped = ({
|
|
|
4655
4834
|
} catch (error) {
|
|
4656
4835
|
setIsLoading(false);
|
|
4657
4836
|
setError(fields.serviceUrl.name, {
|
|
4658
|
-
message:
|
|
4837
|
+
message: t('validations-request-failed'),
|
|
4659
4838
|
type: 'SYSTEM'
|
|
4660
4839
|
});
|
|
4661
4840
|
}
|
|
@@ -4777,7 +4956,7 @@ const ServicePopupUnwrapped = ({
|
|
|
4777
4956
|
}, {
|
|
4778
4957
|
children: [jsx(ReactHookFormTextField, {
|
|
4779
4958
|
name: fields.serviceUrl.name,
|
|
4780
|
-
label:
|
|
4959
|
+
label: t('service-url-label'),
|
|
4781
4960
|
onFocus: onFocusServiceUrl,
|
|
4782
4961
|
autoFocus: !shouldDisableAutoFocus,
|
|
4783
4962
|
onBlur: onBlurServiceUrl,
|
|
@@ -4800,7 +4979,7 @@ const ServicePopupUnwrapped = ({
|
|
|
4800
4979
|
"aria-label": "copy url",
|
|
4801
4980
|
onClick: () => {
|
|
4802
4981
|
navigator.clipboard.writeText(serviceUrl);
|
|
4803
|
-
_showSnackbar(
|
|
4982
|
+
_showSnackbar(t('copy-url-message'));
|
|
4804
4983
|
},
|
|
4805
4984
|
sx: {
|
|
4806
4985
|
marginTop: 0.5
|
|
@@ -4813,7 +4992,7 @@ const ServicePopupUnwrapped = ({
|
|
|
4813
4992
|
defaultValue: serviceUrl
|
|
4814
4993
|
}), jsx(ReactHookFormTextField, {
|
|
4815
4994
|
name: fields.serviceName.name,
|
|
4816
|
-
label:
|
|
4995
|
+
label: t('service-name-label'),
|
|
4817
4996
|
rules: {
|
|
4818
4997
|
required: true,
|
|
4819
4998
|
validate: {
|
|
@@ -4831,13 +5010,13 @@ const ServicePopupUnwrapped = ({
|
|
|
4831
5010
|
multiline: true,
|
|
4832
5011
|
rows: 4,
|
|
4833
5012
|
name: fields.serviceAbstracts.name,
|
|
4834
|
-
label:
|
|
5013
|
+
label: t('service-abstracts-label'),
|
|
4835
5014
|
disabled: isShowPopup || isLoading,
|
|
4836
5015
|
isReadOnly: isShowPopup,
|
|
4837
5016
|
InputProps: {
|
|
4838
5017
|
disableUnderline: isShowPopup
|
|
4839
5018
|
},
|
|
4840
|
-
helperText: !isShowPopup ? '
|
|
5019
|
+
helperText: !isShowPopup ? t('service-popup-helper-text') : '',
|
|
4841
5020
|
sx: style.textField,
|
|
4842
5021
|
defaultValue: ""
|
|
4843
5022
|
}), !isServiceUrlDisabled && jsx(InitialValidationsTrigger, {
|
|
@@ -4857,7 +5036,7 @@ const ServicePopupUnwrapped = ({
|
|
|
4857
5036
|
width: '117px'
|
|
4858
5037
|
}
|
|
4859
5038
|
}, {
|
|
4860
|
-
children:
|
|
5039
|
+
children: t('close')
|
|
4861
5040
|
})) : jsxs(Fragment, {
|
|
4862
5041
|
children: [jsx(Button, Object.assign({
|
|
4863
5042
|
onClick: closePopup,
|
|
@@ -4867,7 +5046,7 @@ const ServicePopupUnwrapped = ({
|
|
|
4867
5046
|
width: '117px'
|
|
4868
5047
|
}
|
|
4869
5048
|
}, {
|
|
4870
|
-
children:
|
|
5049
|
+
children: t('cancel')
|
|
4871
5050
|
})), jsx(Button, Object.assign({
|
|
4872
5051
|
type: "submit",
|
|
4873
5052
|
variant: "primary",
|
|
@@ -4878,7 +5057,7 @@ const ServicePopupUnwrapped = ({
|
|
|
4878
5057
|
marginLeft: '16px!important'
|
|
4879
5058
|
}
|
|
4880
5059
|
}, {
|
|
4881
|
-
children:
|
|
5060
|
+
children: t('save')
|
|
4882
5061
|
}))]
|
|
4883
5062
|
})
|
|
4884
5063
|
}))]
|
|
@@ -4998,4 +5177,4 @@ const LayerSelectConnect = ({
|
|
|
4998
5177
|
});
|
|
4999
5178
|
};
|
|
5000
5179
|
|
|
5001
|
-
export {
|
|
5180
|
+
export { AllChipConnect, FilterListItem, 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
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@opengeoweb/layer-select",
|
|
3
|
-
"version": "9.
|
|
3
|
+
"version": "9.22.0",
|
|
4
4
|
"description": "GeoWeb layer select library for the opengeoweb project",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"repository": {
|
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
"@opengeoweb/store": "*",
|
|
13
13
|
"react-redux": "^8.1.3",
|
|
14
14
|
"@opengeoweb/theme": "*",
|
|
15
|
-
"@mui/material": "
|
|
15
|
+
"@mui/material": "^5.16.0",
|
|
16
16
|
"@opengeoweb/webmap-react": "*",
|
|
17
17
|
"@opengeoweb/webmap": "*",
|
|
18
18
|
"react-window": "^1.8.10",
|
|
@@ -25,8 +25,8 @@
|
|
|
25
25
|
"@redux-eggs/saga-extension": "^2.2.0",
|
|
26
26
|
"lodash": "^4.17.21",
|
|
27
27
|
"redux-saga": "^1.2.3",
|
|
28
|
-
"i18next": "^23.
|
|
29
|
-
"react-i18next": "^
|
|
28
|
+
"i18next": "^23.11.5",
|
|
29
|
+
"react-i18next": "^14.1.2"
|
|
30
30
|
},
|
|
31
31
|
"peerDependencies": {
|
|
32
32
|
"react": "18"
|
package/src/index.d.ts
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import { uiTypes } from '@opengeoweb/store';
|
|
3
3
|
import { FiltersGrouped } from '../../store/selectors';
|
|
4
|
-
export declare const DIALOG_TITLE = "Groups & Keywords";
|
|
5
4
|
export interface KeywordFilterResultsProps {
|
|
6
5
|
bounds?: string;
|
|
7
6
|
onClose?: () => void;
|
|
@@ -1,6 +1,20 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
+
import i18n from 'i18next';
|
|
3
|
+
import { Theme } from '@mui/material';
|
|
4
|
+
import { ThemeProviderProps } from '@opengeoweb/theme';
|
|
5
|
+
import { Store } from '@reduxjs/toolkit';
|
|
6
|
+
interface BaseProviderProps {
|
|
7
|
+
children?: React.ReactNode;
|
|
8
|
+
theme?: Theme;
|
|
9
|
+
}
|
|
2
10
|
interface LayerSelectTranslationWrapperProps {
|
|
3
11
|
children?: React.ReactNode;
|
|
12
|
+
i18nInstance?: typeof i18n;
|
|
4
13
|
}
|
|
14
|
+
export declare const ThemeProvider: React.FC<BaseProviderProps>;
|
|
5
15
|
export declare const LayerSelecti18nProvider: React.FC<LayerSelectTranslationWrapperProps>;
|
|
16
|
+
export declare const DemoWrapper: React.FC<BaseProviderProps>;
|
|
17
|
+
export declare const TestThemeStoreProvider: React.FC<ThemeProviderProps & {
|
|
18
|
+
store: Store;
|
|
19
|
+
}>;
|
|
6
20
|
export {};
|
|
@@ -15,9 +15,5 @@ export interface ServicePopupProps {
|
|
|
15
15
|
serviceSetLayers: (payload: serviceTypes.SetLayersForServicePayload) => void;
|
|
16
16
|
showSnackbar?: (message: string) => void;
|
|
17
17
|
}
|
|
18
|
-
export declare const ADD_HEADING = "Add a new service";
|
|
19
|
-
export declare const EDIT_HEADING = "Edit service";
|
|
20
|
-
export declare const SAVE_HEADING = "Save service";
|
|
21
|
-
export declare const COPY_URL_MESSAGE = "Service URL copied to clipboard";
|
|
22
18
|
export declare const getSuccesMessage: (serviceName: string) => string;
|
|
23
19
|
export declare const ServicePopup: React.FC<ServicePopupProps>;
|
|
@@ -1,11 +1,6 @@
|
|
|
1
1
|
import { serviceTypes } from '@opengeoweb/store';
|
|
2
2
|
import { layerSelectTypes } from '../../store';
|
|
3
3
|
export type ValidationResult = string | boolean;
|
|
4
|
-
export declare const VALIDATIONS_NAME_EXISTING = "This name already exists. Choose another name.";
|
|
5
|
-
export declare const VALIDATIONS_SERVICE_EXISTING = "URL already exists.";
|
|
6
|
-
export declare const VALIDATIONS_SERVICE_VALID_URL = "Not a valid URL.";
|
|
7
|
-
export declare const VALIDATIONS_REQUEST_FAILED = "Download failed. Check the URL.";
|
|
8
|
-
export declare const VALIDATIONS_FIELD_REQUIRED = "This field is required";
|
|
9
4
|
export declare const validateServiceName: (value: string, services: layerSelectTypes.ActiveServiceObjectEntities, ownServiceName?: string) => ValidationResult;
|
|
10
5
|
export declare const validateServiceUrl: (value: string, services: layerSelectTypes.ActiveServiceObjectEntities) => ValidationResult;
|
|
11
6
|
export declare const loadWMSService: (serviceUrl: string, forceReload?: boolean) => Promise<serviceTypes.SetLayersForServicePayload>;
|
package/src/lib/utils/i18n.d.ts
CHANGED
|
@@ -1,2 +1,6 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
import i18n from 'i18next';
|
|
2
|
+
import { UseTranslationResponse } from 'react-i18next';
|
|
3
|
+
export declare const LAYER_SELECT_NAMESPACE = "layerselect";
|
|
4
|
+
export declare const initLayerSelectI18n: () => typeof i18n;
|
|
5
|
+
export declare const useLayerSelectTranslation: () => UseTranslationResponse<typeof LAYER_SELECT_NAMESPACE, typeof i18n>;
|
|
6
|
+
export declare const translateKeyOutsideComponents: (key: string, params?: Record<string, string | number> | undefined) => string;
|