@opengeoweb/layer-select 9.21.0 → 9.23.1
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 +359 -207
- package/package.json +2 -5
- 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/store/listeners.d.ts +2 -0
- package/src/lib/store/listeners.spec.d.ts +1 -0
- package/src/lib/utils/i18n.d.ts +6 -2
- package/src/lib/components/testUtils/TestThemeStoreProvider.d.ts +0 -6
- package/src/lib/store/sagas.d.ts +0 -8
- /package/src/lib/{store/sagas.spec.d.ts → components/LayerSelect/LayerSelectConnect.integration.spec.d.ts} +0 -0
package/index.esm.js
CHANGED
|
@@ -4,13 +4,12 @@ import React__default from 'react';
|
|
|
4
4
|
import { useSelector, useDispatch } from 'react-redux';
|
|
5
5
|
import { CustomIconButton, 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
|
-
import { uiTypes, serviceActions, selectorMemoizationOptions, serviceSelectors, uiActions,
|
|
8
|
-
import { createEntityAdapter, createSlice, createSelector } from '@reduxjs/toolkit';
|
|
7
|
+
import { uiTypes, serviceActions, selectorMemoizationOptions, serviceSelectors, uiActions, getUserAddedServices, setUserAddedServices, layerActions, uiSelectors, layerSelectors, useSetupDialog, mapSelectors, layerTypes } from '@opengeoweb/store';
|
|
8
|
+
import { createEntityAdapter, createSlice, createSelector, createListenerMiddleware, isAnyOf } from '@reduxjs/toolkit';
|
|
9
9
|
import { compact, countBy, partition } from 'lodash';
|
|
10
|
-
import { createStore } from '@redux-eggs/redux-toolkit';
|
|
11
|
-
import { getSagaExtension } from '@redux-eggs/saga-extension';
|
|
12
|
-
import { takeEvery, select, put, all } from 'redux-saga/effects';
|
|
13
10
|
import { ListItem, ListItemIcon, Checkbox, Typography, ListItemSecondaryAction, Switch, Grid, List, Box, Backdrop, CircularProgress, Button, ListItemText, Dialog, DialogTitle, LinearProgress, DialogContent, InputAdornment, DialogActions } from '@mui/material';
|
|
11
|
+
import i18n from 'i18next';
|
|
12
|
+
import { useTranslation } from 'react-i18next';
|
|
14
13
|
import { FixedSizeList } from 'react-window';
|
|
15
14
|
import { getDimensionsList, LayerInfoButton } from '@opengeoweb/webmap-react';
|
|
16
15
|
import { webmapUtils, LayerType, getCapabilities, WMGetServiceFromStore, clearImageCacheForAllMaps } from '@opengeoweb/webmap';
|
|
@@ -19,18 +18,158 @@ import { ReactHookFormProvider, defaultFormOptions, ReactHookFormTextField } fro
|
|
|
19
18
|
import { useFormContext } from 'react-hook-form';
|
|
20
19
|
|
|
21
20
|
var en = {
|
|
22
|
-
"layer-select": "Layer Select"
|
|
21
|
+
"layer-select": "Layer Select",
|
|
22
|
+
"select-all": "Select all",
|
|
23
|
+
"groups-and-keywords-dialog-title": "Groups & Keywords",
|
|
24
|
+
only: "ONLY",
|
|
25
|
+
add: "add",
|
|
26
|
+
remove: "remove",
|
|
27
|
+
"layer-list-results": "results",
|
|
28
|
+
groups: "Groups",
|
|
29
|
+
keywords: "Keywords",
|
|
30
|
+
"layer-select-button-tooltip": "Open the layer selector",
|
|
31
|
+
all: "All",
|
|
32
|
+
services: "Services",
|
|
33
|
+
"add-a-new-service": "Add a new service",
|
|
34
|
+
"update-service-title": "Update layers from WMS service",
|
|
35
|
+
"edit-service-title": "Edit Service",
|
|
36
|
+
"save-service-title": "Save service",
|
|
37
|
+
"show-service-title": "Show Service",
|
|
38
|
+
"service-has-active-layers-error": "Service has active layers. Cannot remove this service",
|
|
39
|
+
"delete-service": "Delete Service",
|
|
40
|
+
"copy-url-message": "Service URL copied to clipboard",
|
|
41
|
+
"get-success-message": "Service \"{{serviceName}}\" has been saved successfully",
|
|
42
|
+
"service-popup-helper-text": "Short description of what this service does",
|
|
43
|
+
close: "close",
|
|
44
|
+
cancel: "cancel",
|
|
45
|
+
save: "save",
|
|
46
|
+
"validations-name-existing": "This name already exists. Choose another name.",
|
|
47
|
+
"validations-service-existing": "URL already exists.",
|
|
48
|
+
"validations-service-valid-url": "Not a valid URL.",
|
|
49
|
+
"validations-request-failed": "Download failed. Check the URL.",
|
|
50
|
+
"validations-field-required": "This field is required",
|
|
51
|
+
"service-url-label": "This service refers to this URL",
|
|
52
|
+
"service-name-label": "Service name",
|
|
53
|
+
"service-abstracts-label": "Abstracts",
|
|
54
|
+
"service-successfully-updated": "Service \"{{serviceName}}\" has been succesfully updated",
|
|
55
|
+
"unable-to-update-service": "Unable to update service, reason: \"{{message}}\"",
|
|
56
|
+
"service-has-been-deleted": "Service \"{{serviceName}}\" has been deleted"
|
|
23
57
|
};
|
|
24
58
|
var fi = {
|
|
25
|
-
"layer-select": "Layer Select"
|
|
59
|
+
"layer-select": "Layer Select",
|
|
60
|
+
"select-all": "Valitse kaikki",
|
|
61
|
+
"groups-and-keywords-dialog-title": "Ryhmät ja Avainsanat",
|
|
62
|
+
only: "Pelkästään",
|
|
63
|
+
add: "lisää",
|
|
64
|
+
remove: "poista",
|
|
65
|
+
"layer-list-results": "tulosta",
|
|
66
|
+
groups: "Ryhmät",
|
|
67
|
+
keywords: "Avainsanat",
|
|
68
|
+
"layer-select-button-tooltip": "Avaa Layer Select",
|
|
69
|
+
all: "Kaikki",
|
|
70
|
+
services: "Palvelut",
|
|
71
|
+
"add-a-new-service": "Lisää uusi pavelu",
|
|
72
|
+
"update-service-title": "Päivitä karttatasot WMS palvelusta",
|
|
73
|
+
"edit-service-title": "Muokkaa palvelua",
|
|
74
|
+
"save-service-title": "Tallenna palvelu",
|
|
75
|
+
"show-service-title": "Näytä palvelu",
|
|
76
|
+
"service-has-active-layers-error": "Palvelu sisältää aktiivisia karttatasoja. Palvelua ei voi poistaa",
|
|
77
|
+
"delete-service": "Poista palvelu",
|
|
78
|
+
"copy-url-message": "Palvelun osoite kopioitu leikepöydälle",
|
|
79
|
+
"get-success-message": "Palvelu \"{{serviceName}}\" tallennettu onnistuneesti",
|
|
80
|
+
"service-popup-helper-text": "Lyhyt kuvaus siitä mitä palvelu tekee",
|
|
81
|
+
close: "sulje",
|
|
82
|
+
cancel: "peruuta",
|
|
83
|
+
save: "tallenna",
|
|
84
|
+
"validations-name-existing": "Nimi on jo käytössä. Valitse toinen nimi.",
|
|
85
|
+
"validations-service-existing": "Osoite on jo käytössä.",
|
|
86
|
+
"validations-service-valid-url": "Epäkelpo URL-osoite",
|
|
87
|
+
"validations-request-failed": "Lataus epäonnistui. Tarkista URL-osoite",
|
|
88
|
+
"validations-field-required": "Kenttä tulee täyttää",
|
|
89
|
+
"service-url-label": "Tämä palvelu viittaa tähän URL-osoitteeseen",
|
|
90
|
+
"service-name-label": "Palvelun nimi",
|
|
91
|
+
"service-abstracts-label": "Tiivistelmä",
|
|
92
|
+
"service-successfully-updated": "Palvelu \"{{serviceName}}\" päivitetty onnistuunnesti",
|
|
93
|
+
"unable-to-update-service": "Palvelun päivitys epäonnistui. Syy: \"{{message}}\"",
|
|
94
|
+
"service-has-been-deleted": "Palvelu \"{{serviceName}}\" poistettu"
|
|
26
95
|
};
|
|
27
96
|
var no = {
|
|
28
|
-
"layer-select": "
|
|
97
|
+
"layer-select": "Lagvalg",
|
|
98
|
+
"select-all": "Velg alle",
|
|
99
|
+
"groups-and-keywords-dialog-title": "Grupper & Nøkkelord",
|
|
100
|
+
only: "BARE",
|
|
101
|
+
add: "legg til",
|
|
102
|
+
remove: "fjern",
|
|
103
|
+
"layer-list-results": "resultat",
|
|
104
|
+
groups: "Grupper",
|
|
105
|
+
keywords: "Nøkkelord",
|
|
106
|
+
"layer-select-button-tooltip": "Åpne lagvalg",
|
|
107
|
+
all: "ALLE",
|
|
108
|
+
services: "Tjenester",
|
|
109
|
+
"add-a-new-service": "Legg til en ny tjeneste",
|
|
110
|
+
"update-service-title": "Oppdater lag fra WMS-tjeneste",
|
|
111
|
+
"edit-service-title": "Rediger tjeneste",
|
|
112
|
+
"save-service-title": "Lagre tjeneste",
|
|
113
|
+
"show-service-title": "Vis tjeneste",
|
|
114
|
+
"service-has-active-layers-error": "Tjenesten har aktive lag. Kan ikke fjerne denne tjenesten",
|
|
115
|
+
"delete-service": "Slett tjeneste",
|
|
116
|
+
"copy-url-message": "Kopier tjeneste-URL til utklippstavle",
|
|
117
|
+
"get-success-message": "Tjeneste \"{{serviceName}}\" har blitt lagret",
|
|
118
|
+
"service-popup-helper-text": "Kort beskrivelse av hva denne tjenesten gjør",
|
|
119
|
+
close: "lukk",
|
|
120
|
+
cancel: "avbryt",
|
|
121
|
+
save: "lagre",
|
|
122
|
+
"validations-name-existing": "Dette navnet eksisterer fra før. Velg et annet navn.",
|
|
123
|
+
"validations-service-existing": "URL eksisterer fra før.",
|
|
124
|
+
"validations-service-valid-url": "Ikke en gyldig URL",
|
|
125
|
+
"validations-request-failed": "Nedlasting feilet. Sjekk URLen",
|
|
126
|
+
"validations-field-required": "Dette feltet er påkrevd",
|
|
127
|
+
"service-url-label": "Denne tjenesten referer til denne URLen",
|
|
128
|
+
"service-name-label": "Tjenestenavn",
|
|
129
|
+
"service-abstracts-label": "Sammendrag",
|
|
130
|
+
"service-successfully-updated": "Tjeneste \"{{serviceName}}\" har blitt oppdatert",
|
|
131
|
+
"unable-to-update-service": "Kan ikke oppdatere tjeneste, grunn: \"{{message}}\"",
|
|
132
|
+
"service-has-been-deleted": "Tjeneste \"{{serviceName}}\" har blitt slettet"
|
|
29
133
|
};
|
|
30
134
|
var nl = {
|
|
31
|
-
"layer-select": "Layer Select"
|
|
32
|
-
|
|
33
|
-
|
|
135
|
+
"layer-select": "Layer Select",
|
|
136
|
+
"select-all": "Selecteer alles",
|
|
137
|
+
"groups-and-keywords-dialog-title": "Groepen & Trefwoorden",
|
|
138
|
+
only: "ALLEEN",
|
|
139
|
+
add: "toevoegen",
|
|
140
|
+
remove: "verwijderen",
|
|
141
|
+
"layer-list-results": "resultaten",
|
|
142
|
+
groups: "Groepen",
|
|
143
|
+
keywords: "Trefwoorden",
|
|
144
|
+
"layer-select-button-tooltip": "Open de Layer Select",
|
|
145
|
+
all: "Alle",
|
|
146
|
+
services: "Services",
|
|
147
|
+
"add-a-new-service": "Voeg een nieuwe service toe",
|
|
148
|
+
"update-service-title": "Lagen bijwerken vanaf WMS service",
|
|
149
|
+
"edit-service-title": "Service bewerken",
|
|
150
|
+
"save-service-title": "Service opslaan",
|
|
151
|
+
"show-service-title": "Service tonen",
|
|
152
|
+
"service-has-active-layers-error": "Service heeft actieve lagen. Kan niet verwijderd worden",
|
|
153
|
+
"delete-service": "Service verwijderen",
|
|
154
|
+
"copy-url-message": "Service URL is naar het klembord gekopieerd",
|
|
155
|
+
"get-success-message": "Service \"{{serviceName}}\" is succesvol opgeslagen",
|
|
156
|
+
"service-popup-helper-text": "Korte beschrijving van wat de service doet",
|
|
157
|
+
close: "sluiten",
|
|
158
|
+
cancel: "annuleren",
|
|
159
|
+
save: "opslaan",
|
|
160
|
+
"validations-name-existing": "Deze naam is al in gebruik. Kies een andere naam.",
|
|
161
|
+
"validations-service-existing": "URL is al in gebruik.",
|
|
162
|
+
"validations-service-valid-url": "Geen geldige URL.",
|
|
163
|
+
"validations-request-failed": "Download mislukt. Controleer de URL.",
|
|
164
|
+
"validations-field-required": "Dit veld is verplicht",
|
|
165
|
+
"service-url-label": "Deze service verwijst naar deze URL",
|
|
166
|
+
"service-name-label": "Service naam",
|
|
167
|
+
"service-abstracts-label": "Beschrijving",
|
|
168
|
+
"service-successfully-updated": "Service \"{{serviceName}}\" is succesvol bijgewerkt",
|
|
169
|
+
"unable-to-update-service": "Bijwerken service niet mogelijk, reden: \"{{message}}\"",
|
|
170
|
+
"service-has-been-deleted": "Service \"{{serviceName}}\" is verwijderd"
|
|
171
|
+
};
|
|
172
|
+
var layerSelectTranslations = {
|
|
34
173
|
en: en,
|
|
35
174
|
fi: fi,
|
|
36
175
|
no: no,
|
|
@@ -2656,117 +2795,137 @@ var types = /*#__PURE__*/Object.freeze({
|
|
|
2656
2795
|
__proto__: null
|
|
2657
2796
|
});
|
|
2658
2797
|
|
|
2659
|
-
|
|
2660
|
-
|
|
2661
|
-
|
|
2662
|
-
|
|
2663
|
-
|
|
2664
|
-
|
|
2665
|
-
|
|
2666
|
-
|
|
2667
|
-
|
|
2668
|
-
|
|
2669
|
-
|
|
2670
|
-
|
|
2671
|
-
|
|
2672
|
-
|
|
2673
|
-
|
|
2674
|
-
|
|
2675
|
-
|
|
2676
|
-
|
|
2677
|
-
|
|
2678
|
-
|
|
2679
|
-
|
|
2680
|
-
|
|
2681
|
-
|
|
2682
|
-
|
|
2683
|
-
|
|
2684
|
-
|
|
2685
|
-
|
|
2686
|
-
|
|
2687
|
-
|
|
2688
|
-
|
|
2689
|
-
|
|
2690
|
-
|
|
2691
|
-
|
|
2692
|
-
|
|
2693
|
-
}
|
|
2694
|
-
|
|
2695
|
-
|
|
2696
|
-
}
|
|
2697
|
-
|
|
2698
|
-
|
|
2699
|
-
|
|
2700
|
-
|
|
2701
|
-
|
|
2702
|
-
|
|
2703
|
-
|
|
2704
|
-
|
|
2705
|
-
|
|
2706
|
-
|
|
2707
|
-
|
|
2708
|
-
|
|
2709
|
-
|
|
2710
|
-
|
|
2798
|
+
/******************************************************************************
|
|
2799
|
+
Copyright (c) Microsoft Corporation.
|
|
2800
|
+
|
|
2801
|
+
Permission to use, copy, modify, and/or distribute this software for any
|
|
2802
|
+
purpose with or without fee is hereby granted.
|
|
2803
|
+
|
|
2804
|
+
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
|
|
2805
|
+
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
|
2806
|
+
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
|
|
2807
|
+
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
|
|
2808
|
+
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
|
2809
|
+
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
|
2810
|
+
PERFORMANCE OF THIS SOFTWARE.
|
|
2811
|
+
***************************************************************************** */
|
|
2812
|
+
/* global Reflect, Promise, SuppressedError, Symbol */
|
|
2813
|
+
|
|
2814
|
+
|
|
2815
|
+
function __rest(s, e) {
|
|
2816
|
+
var t = {};
|
|
2817
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
2818
|
+
t[p] = s[p];
|
|
2819
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
2820
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
2821
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
2822
|
+
t[p[i]] = s[p[i]];
|
|
2823
|
+
}
|
|
2824
|
+
return t;
|
|
2825
|
+
}
|
|
2826
|
+
|
|
2827
|
+
function __awaiter(thisArg, _arguments, P, generator) {
|
|
2828
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
2829
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
2830
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
2831
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
2832
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
2833
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
2834
|
+
});
|
|
2835
|
+
}
|
|
2836
|
+
|
|
2837
|
+
typeof SuppressedError === "function" ? SuppressedError : function (error, suppressed, message) {
|
|
2838
|
+
var e = new Error(message);
|
|
2839
|
+
return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
|
|
2840
|
+
};
|
|
2841
|
+
|
|
2842
|
+
const layerSelectListener = createListenerMiddleware();
|
|
2843
|
+
layerSelectListener.startListening({
|
|
2844
|
+
actionCreator: serviceActions.mapStoreRemoveService,
|
|
2845
|
+
effect: action => __awaiter(void 0, void 0, void 0, function* () {
|
|
2846
|
+
const {
|
|
2847
|
+
serviceUrl
|
|
2848
|
+
} = action.payload;
|
|
2849
|
+
const localStorageServices = getUserAddedServices();
|
|
2850
|
+
delete localStorageServices[serviceUrl];
|
|
2851
|
+
setUserAddedServices(localStorageServices);
|
|
2852
|
+
})
|
|
2853
|
+
});
|
|
2854
|
+
layerSelectListener.startListening({
|
|
2855
|
+
actionCreator: layerSelectActions.layerSelectRemoveService,
|
|
2856
|
+
effect: (action, listenerApi) => __awaiter(void 0, void 0, void 0, function* () {
|
|
2857
|
+
const removedService = action.payload;
|
|
2858
|
+
const {
|
|
2859
|
+
serviceId,
|
|
2860
|
+
serviceUrl
|
|
2861
|
+
} = removedService;
|
|
2862
|
+
const services = getActiveServices(listenerApi.getState());
|
|
2863
|
+
const servicesEnabled = Object.values(services).find(service => service === null || service === void 0 ? void 0 : service.enabled);
|
|
2864
|
+
if (servicesEnabled === undefined) {
|
|
2865
|
+
Object.entries(services).map(([entryServiceId]) => {
|
|
2866
|
+
return listenerApi.dispatch(layerSelectActions.enableActiveService({
|
|
2867
|
+
serviceId: entryServiceId
|
|
2868
|
+
}));
|
|
2869
|
+
});
|
|
2870
|
+
}
|
|
2871
|
+
listenerApi.dispatch(serviceActions.mapStoreRemoveService({
|
|
2872
|
+
id: serviceId,
|
|
2873
|
+
serviceUrl: serviceUrl
|
|
2711
2874
|
}));
|
|
2712
|
-
}
|
|
2713
|
-
|
|
2714
|
-
|
|
2715
|
-
|
|
2716
|
-
|
|
2717
|
-
|
|
2718
|
-
|
|
2719
|
-
payload
|
|
2720
|
-
}) {
|
|
2721
|
-
const {
|
|
2722
|
-
scope,
|
|
2723
|
-
name,
|
|
2724
|
-
serviceUrl,
|
|
2725
|
-
abstract
|
|
2726
|
-
} = payload;
|
|
2727
|
-
if (!isUserAddedService(scope)) {
|
|
2728
|
-
return;
|
|
2729
|
-
}
|
|
2730
|
-
const localStorageServices = getUserAddedServices();
|
|
2731
|
-
setUserAddedServices(Object.assign(Object.assign({}, localStorageServices), {
|
|
2732
|
-
[serviceUrl]: {
|
|
2875
|
+
})
|
|
2876
|
+
});
|
|
2877
|
+
layerSelectListener.startListening({
|
|
2878
|
+
actionCreator: serviceActions.serviceSetLayers,
|
|
2879
|
+
effect: action => __awaiter(void 0, void 0, void 0, function* () {
|
|
2880
|
+
const {
|
|
2881
|
+
scope,
|
|
2733
2882
|
name,
|
|
2734
|
-
|
|
2883
|
+
serviceUrl,
|
|
2735
2884
|
abstract
|
|
2885
|
+
} = action.payload;
|
|
2886
|
+
if (isUserAddedService(scope)) {
|
|
2887
|
+
const localStorageServices = getUserAddedServices();
|
|
2888
|
+
setUserAddedServices(Object.assign(Object.assign({}, localStorageServices), {
|
|
2889
|
+
[serviceUrl]: {
|
|
2890
|
+
name,
|
|
2891
|
+
url: serviceUrl,
|
|
2892
|
+
abstract
|
|
2893
|
+
}
|
|
2894
|
+
}));
|
|
2736
2895
|
}
|
|
2737
|
-
})
|
|
2738
|
-
}
|
|
2739
|
-
function removeServiceFromLocalStorageSaga({
|
|
2740
|
-
payload
|
|
2741
|
-
}) {
|
|
2742
|
-
const {
|
|
2743
|
-
serviceUrl
|
|
2744
|
-
} = payload;
|
|
2745
|
-
const localStorageServices = getUserAddedServices();
|
|
2746
|
-
if (!localStorageServices[serviceUrl]) {
|
|
2747
|
-
return;
|
|
2748
|
-
}
|
|
2749
|
-
const updatedServices = Object.assign({}, localStorageServices);
|
|
2750
|
-
delete updatedServices[serviceUrl];
|
|
2751
|
-
setUserAddedServices(updatedServices);
|
|
2752
|
-
}
|
|
2753
|
-
function* rootSaga() {
|
|
2754
|
-
yield takeEvery(layerSelectActions.layerSelectRemoveService.type, layerSelectRemoveServiceSaga);
|
|
2755
|
-
yield takeEvery(serviceActions.serviceSetLayers.type, addServiceToLocalStorageSaga);
|
|
2756
|
-
yield takeEvery(serviceActions.mapStoreRemoveService.type, removeServiceFromLocalStorageSaga);
|
|
2757
|
-
yield takeEvery([uiActions.setToggleOpenDialog.type, uiActions.setActiveMapIdForDialog.type, layerSelectActions.disableActiveService.type, layerSelectActions.toggleFilter.type, layerSelectActions.setSearchFilter.type], layerSelectCloseInfoDialogSaga);
|
|
2758
|
-
}
|
|
2759
|
-
|
|
2760
|
-
// TODO: This fixes typecheck errors but maybe there is a better way to do that
|
|
2761
|
-
createStore({
|
|
2762
|
-
extensions: [getSagaExtension()]
|
|
2896
|
+
})
|
|
2763
2897
|
});
|
|
2898
|
+
layerSelectListener.startListening({
|
|
2899
|
+
matcher: isAnyOf(uiActions.setToggleOpenDialog, uiActions.setActiveMapIdForDialog),
|
|
2900
|
+
effect: (action, listenerApi) => __awaiter(void 0, void 0, void 0, function* () {
|
|
2901
|
+
const {
|
|
2902
|
+
payload
|
|
2903
|
+
} = action;
|
|
2904
|
+
if (!payload.setOpen && payload.type === uiTypes.DialogTypes.LayerSelect) {
|
|
2905
|
+
listenerApi.dispatch(layerActions.hideLayerInfo());
|
|
2906
|
+
}
|
|
2907
|
+
})
|
|
2908
|
+
});
|
|
2909
|
+
layerSelectListener.startListening({
|
|
2910
|
+
matcher: isAnyOf(layerSelectActions.disableActiveService, layerSelectActions.onlyThisServiceEnabled, layerSelectActions.toggleFilter, layerSelectActions.setSearchFilter),
|
|
2911
|
+
effect: (action, listenerApi) => __awaiter(void 0, void 0, void 0, function* () {
|
|
2912
|
+
if (uiSelectors.getisDialogOpen(listenerApi.getState(), uiTypes.DialogTypes.LayerInfo)) {
|
|
2913
|
+
const filteredLayers = getFilteredLayers(listenerApi.getState());
|
|
2914
|
+
const dialogInfo = layerSelectors.getActiveLayerInfo(listenerApi.getState());
|
|
2915
|
+
const layerWithData = dialogInfo && serviceSelectors.getLayerFromService(listenerApi.getState(), dialogInfo.serviceUrl, dialogInfo.layerName);
|
|
2916
|
+
if (!filteredLayers.map(layer => layer.title).includes((layerWithData === null || layerWithData === void 0 ? void 0 : layerWithData.title) || '')) {
|
|
2917
|
+
listenerApi.dispatch(layerActions.hideLayerInfo());
|
|
2918
|
+
}
|
|
2919
|
+
}
|
|
2920
|
+
})
|
|
2921
|
+
});
|
|
2922
|
+
|
|
2764
2923
|
const layerSelectConfig = {
|
|
2765
2924
|
id: 'layerSelect-module',
|
|
2766
2925
|
reducersMap: {
|
|
2767
2926
|
layerSelect: reducer
|
|
2768
2927
|
},
|
|
2769
|
-
|
|
2928
|
+
middlewares: [layerSelectListener.middleware]
|
|
2770
2929
|
};
|
|
2771
2930
|
|
|
2772
2931
|
const KeywordFilterButtonConnect = ({
|
|
@@ -2797,11 +2956,20 @@ const KeywordFilterButtonConnect = ({
|
|
|
2797
2956
|
}));
|
|
2798
2957
|
};
|
|
2799
2958
|
|
|
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
|
+
|
|
2800
2965
|
const FilterListItem = ({
|
|
2801
2966
|
filter,
|
|
2802
2967
|
toggleFilter,
|
|
2803
2968
|
enableOnlyOneFilter
|
|
2804
2969
|
}) => {
|
|
2970
|
+
const {
|
|
2971
|
+
t
|
|
2972
|
+
} = useLayerSelectTranslation();
|
|
2805
2973
|
const [isHovering, setIsHovering] = React.useState(false);
|
|
2806
2974
|
const handleMouseEnter = React.useCallback(() => {
|
|
2807
2975
|
setIsHovering(true);
|
|
@@ -2900,7 +3068,7 @@ const FilterListItem = ({
|
|
|
2900
3068
|
fontWeight: 500
|
|
2901
3069
|
}
|
|
2902
3070
|
}, {
|
|
2903
|
-
children:
|
|
3071
|
+
children: t('only')
|
|
2904
3072
|
}))
|
|
2905
3073
|
}))
|
|
2906
3074
|
}) : null]
|
|
@@ -2952,7 +3120,6 @@ const KeywordFilterSelectAllSwitchConnect = () => {
|
|
|
2952
3120
|
});
|
|
2953
3121
|
};
|
|
2954
3122
|
|
|
2955
|
-
const DIALOG_TITLE = 'Groups & Keywords';
|
|
2956
3123
|
const listStyle = {
|
|
2957
3124
|
padding: '0px'
|
|
2958
3125
|
};
|
|
@@ -2969,8 +3136,11 @@ const KeywordFilterResults = ({
|
|
|
2969
3136
|
order: _order = 0,
|
|
2970
3137
|
source: _source = 'module'
|
|
2971
3138
|
}) => {
|
|
3139
|
+
const {
|
|
3140
|
+
t
|
|
3141
|
+
} = useLayerSelectTranslation();
|
|
2972
3142
|
return jsxs(ToolContainerDraggable, Object.assign({
|
|
2973
|
-
title:
|
|
3143
|
+
title: t('groups-and-keywords-dialog-title'),
|
|
2974
3144
|
"data-testid": "keywordFilterResults",
|
|
2975
3145
|
startSize: {
|
|
2976
3146
|
width: 349,
|
|
@@ -3008,7 +3178,7 @@ const KeywordFilterResults = ({
|
|
|
3008
3178
|
padding: '15px 15px 0 24px'
|
|
3009
3179
|
}
|
|
3010
3180
|
}, {
|
|
3011
|
-
children:
|
|
3181
|
+
children: t('select-all')
|
|
3012
3182
|
})), jsx(Grid, Object.assign({
|
|
3013
3183
|
container: true,
|
|
3014
3184
|
item: true,
|
|
@@ -3022,7 +3192,7 @@ const KeywordFilterResults = ({
|
|
|
3022
3192
|
children: jsx(KeywordFilterSelectAllSwitchConnect, {})
|
|
3023
3193
|
}))]
|
|
3024
3194
|
})), jsx(CustomAccordion, Object.assign({
|
|
3025
|
-
title:
|
|
3195
|
+
title: t('groups'),
|
|
3026
3196
|
detailsSx: accordionDetailsStyle
|
|
3027
3197
|
}, {
|
|
3028
3198
|
children: jsx(List, Object.assign({
|
|
@@ -3034,7 +3204,7 @@ const KeywordFilterResults = ({
|
|
|
3034
3204
|
}, group.id))
|
|
3035
3205
|
}))
|
|
3036
3206
|
})), jsx(CustomAccordion, Object.assign({
|
|
3037
|
-
title:
|
|
3207
|
+
title: t('keywords'),
|
|
3038
3208
|
detailsSx: accordionDetailsStyle
|
|
3039
3209
|
}, {
|
|
3040
3210
|
children: jsx(List, Object.assign({
|
|
@@ -3084,6 +3254,9 @@ const LayerAddRemoveButton = ({
|
|
|
3084
3254
|
deleteLayer,
|
|
3085
3255
|
mapLayers
|
|
3086
3256
|
}) => {
|
|
3257
|
+
const {
|
|
3258
|
+
t
|
|
3259
|
+
} = useLayerSelectTranslation();
|
|
3087
3260
|
const foundLayer = mapLayers.find(lr => lr.name === layer.name && lr.service === serviceUrl);
|
|
3088
3261
|
return jsx(CustomToggleButton, Object.assign({
|
|
3089
3262
|
"data-testid": `layerAddRemoveButton-${layer.name}`,
|
|
@@ -3104,7 +3277,7 @@ const LayerAddRemoveButton = ({
|
|
|
3104
3277
|
},
|
|
3105
3278
|
className: "layerAddRemoveButton"
|
|
3106
3279
|
}, {
|
|
3107
|
-
children: !foundLayer ? '
|
|
3280
|
+
children: !foundLayer ? t('add') : t('remove')
|
|
3108
3281
|
}));
|
|
3109
3282
|
};
|
|
3110
3283
|
|
|
@@ -3258,6 +3431,9 @@ const LayerListRow = ({
|
|
|
3258
3431
|
onToggleActiveLayer
|
|
3259
3432
|
}) => {
|
|
3260
3433
|
var _a;
|
|
3434
|
+
const {
|
|
3435
|
+
t
|
|
3436
|
+
} = useLayerSelectTranslation();
|
|
3261
3437
|
const rowHeight = widthToRowHeight(layerSelectWidth);
|
|
3262
3438
|
const columns = widthToColumns(layerSelectWidth);
|
|
3263
3439
|
const dimensions = getDimensionsList(layer.dimensions);
|
|
@@ -3358,14 +3534,14 @@ const LayerListRow = ({
|
|
|
3358
3534
|
children: [layer.path.length > 0 && jsxs(Typography, Object.assign({
|
|
3359
3535
|
sx: layerInfoStyle
|
|
3360
3536
|
}, {
|
|
3361
|
-
children: ["
|
|
3537
|
+
children: [t('groups'), ":", ' ', jsx(SearchHighlight, {
|
|
3362
3538
|
text: layer.path.join(' / '),
|
|
3363
3539
|
search: searchFilter
|
|
3364
3540
|
})]
|
|
3365
3541
|
})), ((_a = layer.keywords) === null || _a === void 0 ? void 0 : _a.length) > 0 && jsxs(Typography, Object.assign({
|
|
3366
3542
|
sx: layerInfoStyle
|
|
3367
3543
|
}, {
|
|
3368
|
-
children: ["
|
|
3544
|
+
children: [t('keywords'), ":", ' ', jsx(SearchHighlight, {
|
|
3369
3545
|
text: layer.keywords.slice().sort((a, b) => {
|
|
3370
3546
|
return a.localeCompare(b);
|
|
3371
3547
|
}).join(', '),
|
|
@@ -3412,6 +3588,9 @@ const LayerList = ({
|
|
|
3412
3588
|
onToggleActiveLayer,
|
|
3413
3589
|
currentLayerInfo
|
|
3414
3590
|
}) => {
|
|
3591
|
+
const {
|
|
3592
|
+
t
|
|
3593
|
+
} = useLayerSelectTranslation();
|
|
3415
3594
|
const rowMargin = 4;
|
|
3416
3595
|
const rowHeight = widthToRowHeight(layerSelectWidth);
|
|
3417
3596
|
const layerSelectFilterHeight = 155 + serviceListHeight;
|
|
@@ -3425,7 +3604,7 @@ const LayerList = ({
|
|
|
3425
3604
|
fontSize: '12px'
|
|
3426
3605
|
}
|
|
3427
3606
|
}, {
|
|
3428
|
-
children: [filteredLayers.length, " results
|
|
3607
|
+
children: [filteredLayers.length, " ", t('layer-list-results')]
|
|
3429
3608
|
})), jsx(FixedSizeList, Object.assign({
|
|
3430
3609
|
height: layerSelectHeight - layerSelectFilterHeight < minHeight ? minHeight : layerSelectHeight - layerSelectFilterHeight,
|
|
3431
3610
|
itemCount: filteredLayers.length,
|
|
@@ -3549,12 +3728,15 @@ const style$2 = {
|
|
|
3549
3728
|
const LayerSelectButtonConnect = ({
|
|
3550
3729
|
mapId,
|
|
3551
3730
|
source: _source = 'app',
|
|
3552
|
-
tooltipTitle
|
|
3731
|
+
tooltipTitle,
|
|
3553
3732
|
icon: _icon = jsx(LayersAdd, {
|
|
3554
3733
|
"data-testid": "layerSelectButtonConnectIcon"
|
|
3555
3734
|
}),
|
|
3556
3735
|
isMultiMap: _isMultiMap = false
|
|
3557
3736
|
}) => {
|
|
3737
|
+
const {
|
|
3738
|
+
t
|
|
3739
|
+
} = useLayerSelectTranslation();
|
|
3558
3740
|
const dispatch = useDispatch();
|
|
3559
3741
|
const dialogType = _isMultiMap ? `${uiTypes.DialogTypes.LayerSelect}-${mapId}` : uiTypes.DialogTypes.LayerSelect;
|
|
3560
3742
|
const currentActiveMapId = useAppSelector(store => uiSelectors.getDialogMapId(store, dialogType));
|
|
@@ -3572,7 +3754,7 @@ const LayerSelectButtonConnect = ({
|
|
|
3572
3754
|
sx: style$2,
|
|
3573
3755
|
id: "layerSelectButton",
|
|
3574
3756
|
"data-testid": "layerSelectButton",
|
|
3575
|
-
tooltipTitle:
|
|
3757
|
+
tooltipTitle: tooltipTitle || t('layer-select-button-tooltip')
|
|
3576
3758
|
}, {
|
|
3577
3759
|
children: _icon
|
|
3578
3760
|
}));
|
|
@@ -3617,6 +3799,9 @@ const ServiceChip = ({
|
|
|
3617
3799
|
isDisabled,
|
|
3618
3800
|
toggleChip
|
|
3619
3801
|
}) => {
|
|
3802
|
+
const {
|
|
3803
|
+
t
|
|
3804
|
+
} = useLayerSelectTranslation();
|
|
3620
3805
|
const chip = _all ? 'all' : service && service.serviceUrl;
|
|
3621
3806
|
return jsx(CustomTooltip, Object.assign({
|
|
3622
3807
|
title: (service === null || service === void 0 ? void 0 : service.abstract) ? `Abstract: ${service.abstract}` : ''
|
|
@@ -3632,7 +3817,7 @@ const ServiceChip = ({
|
|
|
3632
3817
|
disabled: isDisabled,
|
|
3633
3818
|
sx: style$1
|
|
3634
3819
|
}, {
|
|
3635
|
-
children: service ? service.serviceName : '
|
|
3820
|
+
children: service ? service.serviceName : t('all')
|
|
3636
3821
|
}))
|
|
3637
3822
|
})
|
|
3638
3823
|
}));
|
|
@@ -3743,50 +3928,6 @@ const ServiceListConnect = ({
|
|
|
3743
3928
|
});
|
|
3744
3929
|
};
|
|
3745
3930
|
|
|
3746
|
-
/******************************************************************************
|
|
3747
|
-
Copyright (c) Microsoft Corporation.
|
|
3748
|
-
|
|
3749
|
-
Permission to use, copy, modify, and/or distribute this software for any
|
|
3750
|
-
purpose with or without fee is hereby granted.
|
|
3751
|
-
|
|
3752
|
-
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
|
|
3753
|
-
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
|
3754
|
-
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
|
|
3755
|
-
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
|
|
3756
|
-
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
|
3757
|
-
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
|
3758
|
-
PERFORMANCE OF THIS SOFTWARE.
|
|
3759
|
-
***************************************************************************** */
|
|
3760
|
-
/* global Reflect, Promise, SuppressedError, Symbol */
|
|
3761
|
-
|
|
3762
|
-
|
|
3763
|
-
function __rest(s, e) {
|
|
3764
|
-
var t = {};
|
|
3765
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
3766
|
-
t[p] = s[p];
|
|
3767
|
-
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
3768
|
-
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
3769
|
-
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
3770
|
-
t[p[i]] = s[p[i]];
|
|
3771
|
-
}
|
|
3772
|
-
return t;
|
|
3773
|
-
}
|
|
3774
|
-
|
|
3775
|
-
function __awaiter(thisArg, _arguments, P, generator) {
|
|
3776
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
3777
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
3778
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
3779
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
3780
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
3781
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
3782
|
-
});
|
|
3783
|
-
}
|
|
3784
|
-
|
|
3785
|
-
typeof SuppressedError === "function" ? SuppressedError : function (error, suppressed, message) {
|
|
3786
|
-
var e = new Error(message);
|
|
3787
|
-
return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
|
|
3788
|
-
};
|
|
3789
|
-
|
|
3790
3931
|
const styles = {
|
|
3791
3932
|
servicesContainer: {
|
|
3792
3933
|
width: '360px',
|
|
@@ -3837,6 +3978,9 @@ const ServiceOptionsDialog = ({
|
|
|
3837
3978
|
setServicePopupInfo,
|
|
3838
3979
|
isLoading: _isLoading = false
|
|
3839
3980
|
}) => {
|
|
3981
|
+
const {
|
|
3982
|
+
t
|
|
3983
|
+
} = useLayerSelectTranslation();
|
|
3840
3984
|
const openAddService = () => {
|
|
3841
3985
|
setServicePopupInfo({
|
|
3842
3986
|
isOpen: true,
|
|
@@ -3862,7 +4006,7 @@ const ServiceOptionsDialog = ({
|
|
|
3862
4006
|
children: [jsx(Box, Object.assign({
|
|
3863
4007
|
sx: styles.header
|
|
3864
4008
|
}, {
|
|
3865
|
-
children:
|
|
4009
|
+
children: t('services')
|
|
3866
4010
|
})), jsx(Backdrop, Object.assign({
|
|
3867
4011
|
sx: styles.loading,
|
|
3868
4012
|
open: _isLoading
|
|
@@ -3885,16 +4029,13 @@ const ServiceOptionsDialog = ({
|
|
|
3885
4029
|
variant: "tertiary",
|
|
3886
4030
|
startIcon: jsx(Add, {})
|
|
3887
4031
|
}, {
|
|
3888
|
-
children:
|
|
4032
|
+
children: t('add-a-new-service')
|
|
3889
4033
|
}))
|
|
3890
4034
|
}))]
|
|
3891
4035
|
}));
|
|
3892
4036
|
};
|
|
3893
|
-
const updateServiceTitle = 'Update layers from WMS service';
|
|
3894
|
-
const editServiceTitle = 'Edit Service';
|
|
3895
|
-
const showServiceTitle = 'Show Service';
|
|
3896
4037
|
const deleteServiceTitle = hasActiveLayers => {
|
|
3897
|
-
return hasActiveLayers ? '
|
|
4038
|
+
return hasActiveLayers ? translateKeyOutsideComponents('service-has-active-layers-error') : translateKeyOutsideComponents('delete-service');
|
|
3898
4039
|
};
|
|
3899
4040
|
const tooltipPlacement = () => {
|
|
3900
4041
|
return 'left';
|
|
@@ -3917,6 +4058,9 @@ const Rows = ({
|
|
|
3917
4058
|
setServicePopupInfo,
|
|
3918
4059
|
selectedLayers
|
|
3919
4060
|
}) => {
|
|
4061
|
+
const {
|
|
4062
|
+
t
|
|
4063
|
+
} = useLayerSelectTranslation();
|
|
3920
4064
|
const checkIfServiceHasActiveLayers = serviceUrl => {
|
|
3921
4065
|
const foundService = selectedLayers.find(object => object.service === serviceUrl);
|
|
3922
4066
|
if (foundService) {
|
|
@@ -3966,7 +4110,7 @@ const Rows = ({
|
|
|
3966
4110
|
}, {
|
|
3967
4111
|
children: [jsx(CustomTooltip, Object.assign({
|
|
3968
4112
|
"data-testid": "updateServiceTooltip",
|
|
3969
|
-
title:
|
|
4113
|
+
title: t('update-service-title'),
|
|
3970
4114
|
placement: tooltipPlacement(),
|
|
3971
4115
|
PopperProps: tooltipPopperProps
|
|
3972
4116
|
}, {
|
|
@@ -3981,7 +4125,7 @@ const Rows = ({
|
|
|
3981
4125
|
children: jsx(Cached, {})
|
|
3982
4126
|
}))
|
|
3983
4127
|
})), userAddedService ? jsx(CustomTooltip, Object.assign({
|
|
3984
|
-
title:
|
|
4128
|
+
title: t('edit-service-title'),
|
|
3985
4129
|
placement: tooltipPlacement(),
|
|
3986
4130
|
PopperProps: tooltipPopperProps
|
|
3987
4131
|
}, {
|
|
@@ -4003,7 +4147,7 @@ const Rows = ({
|
|
|
4003
4147
|
}))
|
|
4004
4148
|
})
|
|
4005
4149
|
})) : jsx(CustomTooltip, Object.assign({
|
|
4006
|
-
title:
|
|
4150
|
+
title: t('show-service-title'),
|
|
4007
4151
|
placement: tooltipPlacement(),
|
|
4008
4152
|
PopperProps: tooltipPopperProps
|
|
4009
4153
|
}, {
|
|
@@ -4284,17 +4428,13 @@ $({ target: 'RegExp', proto: true, forced: !DELEGATES_TO_EXEC }, {
|
|
|
4284
4428
|
}
|
|
4285
4429
|
});
|
|
4286
4430
|
|
|
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
4431
|
const validateServiceName = (value, services, ownServiceName = '') => {
|
|
4292
4432
|
const serviceName = value === null || value === void 0 ? void 0 : value.toLowerCase();
|
|
4293
4433
|
const foundName = Object.keys(services).find(serviceId => {
|
|
4294
4434
|
var _a;
|
|
4295
4435
|
return ((_a = services[serviceId]) === null || _a === void 0 ? void 0 : _a.serviceName.toLowerCase()) === serviceName && serviceName !== ownServiceName.toLocaleLowerCase();
|
|
4296
4436
|
});
|
|
4297
|
-
return foundName === undefined ? true :
|
|
4437
|
+
return foundName === undefined ? true : translateKeyOutsideComponents('validations-name-existing');
|
|
4298
4438
|
};
|
|
4299
4439
|
const isValidUrl = url => {
|
|
4300
4440
|
if (url === '' || url === null || typeof url === 'undefined') {
|
|
@@ -4311,7 +4451,7 @@ const validateServiceUrl = (value, services) => {
|
|
|
4311
4451
|
// validate valid url
|
|
4312
4452
|
const isServiceUrlValid = isValidUrl(serviceUrl);
|
|
4313
4453
|
if (!isServiceUrlValid) {
|
|
4314
|
-
return
|
|
4454
|
+
return translateKeyOutsideComponents('validations-service-valid-url');
|
|
4315
4455
|
}
|
|
4316
4456
|
// check url existing
|
|
4317
4457
|
const foundUrl = Object.keys(services).find(serviceId => {
|
|
@@ -4319,7 +4459,7 @@ const validateServiceUrl = (value, services) => {
|
|
|
4319
4459
|
return ((_a = services[serviceId]) === null || _a === void 0 ? void 0 : _a.serviceUrl) === serviceUrl;
|
|
4320
4460
|
});
|
|
4321
4461
|
if (foundUrl) {
|
|
4322
|
-
return
|
|
4462
|
+
return translateKeyOutsideComponents('validations-service-existing');
|
|
4323
4463
|
}
|
|
4324
4464
|
return true;
|
|
4325
4465
|
};
|
|
@@ -4347,8 +4487,17 @@ const getService = (services, serviceUrl) => {
|
|
|
4347
4487
|
}
|
|
4348
4488
|
return services[serviceIds[serviceIndex]];
|
|
4349
4489
|
};
|
|
4350
|
-
const getServiceSuccesUpdateMessage = serviceName =>
|
|
4351
|
-
|
|
4490
|
+
const getServiceSuccesUpdateMessage = serviceName => translateKeyOutsideComponents('service-successfully-updated', {
|
|
4491
|
+
serviceName
|
|
4492
|
+
});
|
|
4493
|
+
const getServiceFailedUpdateMessage = error => {
|
|
4494
|
+
const {
|
|
4495
|
+
message
|
|
4496
|
+
} = error;
|
|
4497
|
+
return translateKeyOutsideComponents('unable-to-update-service', {
|
|
4498
|
+
message
|
|
4499
|
+
});
|
|
4500
|
+
};
|
|
4352
4501
|
const ServiceOptionsDialogConnect = ({
|
|
4353
4502
|
mapId
|
|
4354
4503
|
}) => {
|
|
@@ -4370,7 +4519,9 @@ const ServiceOptionsDialogConnect = ({
|
|
|
4370
4519
|
const services = useAppSelector(store => getActiveServices(store));
|
|
4371
4520
|
const selectedLayers = useAppSelector(store => mapSelectors.getMapLayersWithoutDimensionCurrentValue(store, mapId));
|
|
4372
4521
|
const layerSelectRemoveService = React.useCallback((serviceId, serviceUrl, serviceName) => {
|
|
4373
|
-
const message =
|
|
4522
|
+
const message = translateKeyOutsideComponents('service-has-been-deleted', {
|
|
4523
|
+
serviceName
|
|
4524
|
+
});
|
|
4374
4525
|
showSnackbar(message);
|
|
4375
4526
|
dispatch(layerSelectActions.layerSelectRemoveService({
|
|
4376
4527
|
serviceId,
|
|
@@ -4548,19 +4699,17 @@ const style = {
|
|
|
4548
4699
|
marginBottom: 2
|
|
4549
4700
|
}
|
|
4550
4701
|
};
|
|
4551
|
-
const
|
|
4552
|
-
|
|
4553
|
-
|
|
4554
|
-
const COPY_URL_MESSAGE = 'Service URL copied to clipboard';
|
|
4555
|
-
const getSuccesMessage = serviceName => `Service "${serviceName}" has been saved succesfully`;
|
|
4702
|
+
const getSuccesMessage = serviceName => translateKeyOutsideComponents('get-success-message', {
|
|
4703
|
+
serviceName
|
|
4704
|
+
});
|
|
4556
4705
|
const getTitleForVariant = variant => {
|
|
4557
4706
|
switch (variant) {
|
|
4558
4707
|
case 'add':
|
|
4559
|
-
return
|
|
4708
|
+
return translateKeyOutsideComponents('add-a-new-service');
|
|
4560
4709
|
case 'edit':
|
|
4561
|
-
return
|
|
4710
|
+
return translateKeyOutsideComponents('edit-service-title');
|
|
4562
4711
|
case 'save':
|
|
4563
|
-
return
|
|
4712
|
+
return translateKeyOutsideComponents('save-service-title');
|
|
4564
4713
|
default:
|
|
4565
4714
|
return 'Service';
|
|
4566
4715
|
}
|
|
@@ -4605,6 +4754,9 @@ const ServicePopupUnwrapped = ({
|
|
|
4605
4754
|
serviceName,
|
|
4606
4755
|
showSnackbar: _showSnackbar = () => {}
|
|
4607
4756
|
}) => {
|
|
4757
|
+
const {
|
|
4758
|
+
t
|
|
4759
|
+
} = useLayerSelectTranslation();
|
|
4608
4760
|
const {
|
|
4609
4761
|
formState: {
|
|
4610
4762
|
errors
|
|
@@ -4631,7 +4783,7 @@ const ServicePopupUnwrapped = ({
|
|
|
4631
4783
|
setIsLoading(false);
|
|
4632
4784
|
setShouldForceReload(true);
|
|
4633
4785
|
setError(fields.serviceUrl.name, {
|
|
4634
|
-
message:
|
|
4786
|
+
message: t('validations-request-failed'),
|
|
4635
4787
|
type: 'SYSTEM'
|
|
4636
4788
|
});
|
|
4637
4789
|
}
|
|
@@ -4655,7 +4807,7 @@ const ServicePopupUnwrapped = ({
|
|
|
4655
4807
|
} catch (error) {
|
|
4656
4808
|
setIsLoading(false);
|
|
4657
4809
|
setError(fields.serviceUrl.name, {
|
|
4658
|
-
message:
|
|
4810
|
+
message: t('validations-request-failed'),
|
|
4659
4811
|
type: 'SYSTEM'
|
|
4660
4812
|
});
|
|
4661
4813
|
}
|
|
@@ -4777,7 +4929,7 @@ const ServicePopupUnwrapped = ({
|
|
|
4777
4929
|
}, {
|
|
4778
4930
|
children: [jsx(ReactHookFormTextField, {
|
|
4779
4931
|
name: fields.serviceUrl.name,
|
|
4780
|
-
label:
|
|
4932
|
+
label: t('service-url-label'),
|
|
4781
4933
|
onFocus: onFocusServiceUrl,
|
|
4782
4934
|
autoFocus: !shouldDisableAutoFocus,
|
|
4783
4935
|
onBlur: onBlurServiceUrl,
|
|
@@ -4800,7 +4952,7 @@ const ServicePopupUnwrapped = ({
|
|
|
4800
4952
|
"aria-label": "copy url",
|
|
4801
4953
|
onClick: () => {
|
|
4802
4954
|
navigator.clipboard.writeText(serviceUrl);
|
|
4803
|
-
_showSnackbar(
|
|
4955
|
+
_showSnackbar(t('copy-url-message'));
|
|
4804
4956
|
},
|
|
4805
4957
|
sx: {
|
|
4806
4958
|
marginTop: 0.5
|
|
@@ -4813,7 +4965,7 @@ const ServicePopupUnwrapped = ({
|
|
|
4813
4965
|
defaultValue: serviceUrl
|
|
4814
4966
|
}), jsx(ReactHookFormTextField, {
|
|
4815
4967
|
name: fields.serviceName.name,
|
|
4816
|
-
label:
|
|
4968
|
+
label: t('service-name-label'),
|
|
4817
4969
|
rules: {
|
|
4818
4970
|
required: true,
|
|
4819
4971
|
validate: {
|
|
@@ -4831,13 +4983,13 @@ const ServicePopupUnwrapped = ({
|
|
|
4831
4983
|
multiline: true,
|
|
4832
4984
|
rows: 4,
|
|
4833
4985
|
name: fields.serviceAbstracts.name,
|
|
4834
|
-
label:
|
|
4986
|
+
label: t('service-abstracts-label'),
|
|
4835
4987
|
disabled: isShowPopup || isLoading,
|
|
4836
4988
|
isReadOnly: isShowPopup,
|
|
4837
4989
|
InputProps: {
|
|
4838
4990
|
disableUnderline: isShowPopup
|
|
4839
4991
|
},
|
|
4840
|
-
helperText: !isShowPopup ? '
|
|
4992
|
+
helperText: !isShowPopup ? t('service-popup-helper-text') : '',
|
|
4841
4993
|
sx: style.textField,
|
|
4842
4994
|
defaultValue: ""
|
|
4843
4995
|
}), !isServiceUrlDisabled && jsx(InitialValidationsTrigger, {
|
|
@@ -4857,7 +5009,7 @@ const ServicePopupUnwrapped = ({
|
|
|
4857
5009
|
width: '117px'
|
|
4858
5010
|
}
|
|
4859
5011
|
}, {
|
|
4860
|
-
children:
|
|
5012
|
+
children: t('close')
|
|
4861
5013
|
})) : jsxs(Fragment, {
|
|
4862
5014
|
children: [jsx(Button, Object.assign({
|
|
4863
5015
|
onClick: closePopup,
|
|
@@ -4867,7 +5019,7 @@ const ServicePopupUnwrapped = ({
|
|
|
4867
5019
|
width: '117px'
|
|
4868
5020
|
}
|
|
4869
5021
|
}, {
|
|
4870
|
-
children:
|
|
5022
|
+
children: t('cancel')
|
|
4871
5023
|
})), jsx(Button, Object.assign({
|
|
4872
5024
|
type: "submit",
|
|
4873
5025
|
variant: "primary",
|
|
@@ -4878,7 +5030,7 @@ const ServicePopupUnwrapped = ({
|
|
|
4878
5030
|
marginLeft: '16px!important'
|
|
4879
5031
|
}
|
|
4880
5032
|
}, {
|
|
4881
|
-
children:
|
|
5033
|
+
children: t('save')
|
|
4882
5034
|
}))]
|
|
4883
5035
|
})
|
|
4884
5036
|
}))]
|
|
@@ -4998,4 +5150,4 @@ const LayerSelectConnect = ({
|
|
|
4998
5150
|
});
|
|
4999
5151
|
};
|
|
5000
5152
|
|
|
5001
|
-
export {
|
|
5153
|
+
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.23.1",
|
|
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",
|
|
@@ -21,10 +21,7 @@
|
|
|
21
21
|
"react-hook-form": "^7.50.1",
|
|
22
22
|
"@reduxjs/toolkit": "^1.9.7",
|
|
23
23
|
"@redux-eggs/core": "^2.2.0",
|
|
24
|
-
"@redux-eggs/redux-toolkit": "^2.2.0",
|
|
25
|
-
"@redux-eggs/saga-extension": "^2.2.0",
|
|
26
24
|
"lodash": "^4.17.21",
|
|
27
|
-
"redux-saga": "^1.2.3",
|
|
28
25
|
"i18next": "^23.11.5",
|
|
29
26
|
"react-i18next": "^14.1.2"
|
|
30
27
|
},
|
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>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
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;
|
package/src/lib/store/sagas.d.ts
DELETED
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import { SagaIterator } from 'redux-saga';
|
|
2
|
-
import { serviceActions, uiActions } from '@opengeoweb/store';
|
|
3
|
-
import { layerSelectActions, LayerSelectActions } from './reducer';
|
|
4
|
-
export declare function layerSelectCloseInfoDialogSaga({ type, payload, }: ReturnType<typeof uiActions.setToggleOpenDialog | typeof uiActions.setActiveMapIdForDialog | typeof layerSelectActions.disableActiveService | typeof layerSelectActions.toggleFilter | typeof layerSelectActions.setSearchFilter>): SagaIterator;
|
|
5
|
-
export declare function layerSelectRemoveServiceSaga(capturedAction: LayerSelectActions): SagaIterator;
|
|
6
|
-
export declare function addServiceToLocalStorageSaga({ payload, }: ReturnType<typeof serviceActions.serviceSetLayers>): void;
|
|
7
|
-
export declare function removeServiceFromLocalStorageSaga({ payload, }: ReturnType<typeof serviceActions.mapStoreRemoveService>): void;
|
|
8
|
-
export declare function rootSaga(): SagaIterator;
|
|
File without changes
|