@eeacms/volto-arcgis-block 0.1.349 → 0.1.352
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/CHANGELOG.md
CHANGED
|
@@ -4,6 +4,18 @@ All notable changes to this project will be documented in this file. Dates are d
|
|
|
4
4
|
|
|
5
5
|
Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).
|
|
6
6
|
|
|
7
|
+
### [0.1.352](https://github.com/eea/volto-arcgis-block/compare/0.1.351...0.1.352) - 11 April 2025
|
|
8
|
+
|
|
9
|
+
#### :hammer_and_wrench: Others
|
|
10
|
+
|
|
11
|
+
- CLMS-285178 (bug): Swipe widget loads if coming from dataset catalogue and also auto updates without having to close and open widget manually. [Unai Bolivar - [`2d18dc2`](https://github.com/eea/volto-arcgis-block/commit/2d18dc28cdba2a1056894c70a0ebb06f8bf30c41)]
|
|
12
|
+
### [0.1.351](https://github.com/eea/volto-arcgis-block/compare/0.1.350...0.1.351) - 11 April 2025
|
|
13
|
+
|
|
14
|
+
### [0.1.350](https://github.com/eea/volto-arcgis-block/compare/0.1.349...0.1.350) - 11 April 2025
|
|
15
|
+
|
|
16
|
+
#### :hammer_and_wrench: Others
|
|
17
|
+
|
|
18
|
+
- CLMS-286418 (bug): saved user services correctly load opacity level on slider [Unai Bolivar - [`b2276c6`](https://github.com/eea/volto-arcgis-block/commit/b2276c640a050067bbfc0edcffff4bec719e3b89)]
|
|
7
19
|
### [0.1.349](https://github.com/eea/volto-arcgis-block/compare/0.1.348...0.1.349) - 7 April 2025
|
|
8
20
|
|
|
9
21
|
### [0.1.348](https://github.com/eea/volto-arcgis-block/compare/0.1.347...0.1.348) - 3 April 2025
|
package/package.json
CHANGED
|
@@ -926,9 +926,15 @@ class MenuWidget extends React.Component {
|
|
|
926
926
|
this.openMenu();
|
|
927
927
|
this.loadComponentFilters();
|
|
928
928
|
this.expandDropdowns();
|
|
929
|
+
// Add "My Services" component to the UI
|
|
930
|
+
const myServicesComponent = this.createMyServicesComponent();
|
|
931
|
+
const myServicesContainer = document.createElement('div');
|
|
932
|
+
ReactDOM.render(myServicesComponent, myServicesContainer);
|
|
933
|
+
this.container.current.appendChild(myServicesContainer.firstChild);
|
|
934
|
+
this.loadUserServicesFromStorage();
|
|
929
935
|
this.loadLayers();
|
|
930
|
-
this.loadOpacity();
|
|
931
|
-
this.loadVisibility();
|
|
936
|
+
// this.loadOpacity();
|
|
937
|
+
// this.loadVisibility();
|
|
932
938
|
this.handleRasterVectorLegend();
|
|
933
939
|
this.map.when(() => {
|
|
934
940
|
this.map.layers.on('change', () => {
|
|
@@ -998,13 +1004,6 @@ class MenuWidget extends React.Component {
|
|
|
998
1004
|
this.props.bookmarkHandler(bookmarkData);
|
|
999
1005
|
});
|
|
1000
1006
|
});
|
|
1001
|
-
|
|
1002
|
-
// Add "My Services" component to the UI
|
|
1003
|
-
const myServicesComponent = this.createMyServicesComponent();
|
|
1004
|
-
const myServicesContainer = document.createElement('div');
|
|
1005
|
-
ReactDOM.render(myServicesComponent, myServicesContainer);
|
|
1006
|
-
this.container.current.appendChild(myServicesContainer.firstChild);
|
|
1007
|
-
this.loadUserServicesFromStorage();
|
|
1008
1007
|
}
|
|
1009
1008
|
|
|
1010
1009
|
setSliderTag(val) {
|
|
@@ -1962,10 +1961,46 @@ class MenuWidget extends React.Component {
|
|
|
1962
1961
|
}
|
|
1963
1962
|
}
|
|
1964
1963
|
|
|
1964
|
+
createMyServicesComponent() {
|
|
1965
|
+
let dropdowns = document.querySelectorAll('.map-menu-dropdown');
|
|
1966
|
+
let i = dropdowns.length === 0 ? 0 : dropdowns.length - 1;
|
|
1967
|
+
let componentId = `component_${i}`;
|
|
1968
|
+
let dropdownId = `dropdown_${i}`;
|
|
1969
|
+
|
|
1970
|
+
// Create "My Services" component from the start and set its display to none
|
|
1971
|
+
let myServicesStyle =
|
|
1972
|
+
this.state.wmsUserServiceLayers.length > 0 ? {} : { display: 'none' };
|
|
1973
|
+
return (
|
|
1974
|
+
<div
|
|
1975
|
+
className="map-menu-dropdown"
|
|
1976
|
+
id={componentId}
|
|
1977
|
+
key="a5"
|
|
1978
|
+
style={myServicesStyle}
|
|
1979
|
+
>
|
|
1980
|
+
<div
|
|
1981
|
+
id={dropdownId}
|
|
1982
|
+
className="ccl-expandable__button"
|
|
1983
|
+
aria-expanded="false"
|
|
1984
|
+
onClick={this.toggleDropdownContent.bind(this)}
|
|
1985
|
+
onKeyDown={this.toggleDropdownContent.bind(this)}
|
|
1986
|
+
tabIndex="0"
|
|
1987
|
+
role="button"
|
|
1988
|
+
>
|
|
1989
|
+
<div className="dropdown-icon">
|
|
1990
|
+
<FontAwesomeIcon icon={['fas', 'caret-right']} />
|
|
1991
|
+
</div>
|
|
1992
|
+
{<span>{'My Service'}</span>}
|
|
1993
|
+
</div>
|
|
1994
|
+
<div className="map-menu-components-container" id="map-menu-services" />
|
|
1995
|
+
</div>
|
|
1996
|
+
);
|
|
1997
|
+
}
|
|
1998
|
+
|
|
1965
1999
|
async handleNewMapServiceLayer(viewService) {
|
|
1966
2000
|
// First, properly normalize the URL for comparison
|
|
1967
2001
|
const normalizedViewService = viewService.trim();
|
|
1968
2002
|
|
|
2003
|
+
// Check if the layer already exists in this.layers before adding
|
|
1969
2004
|
if (
|
|
1970
2005
|
this.state.wmsUserServiceLayers.some(
|
|
1971
2006
|
(layer) =>
|
|
@@ -2063,41 +2098,6 @@ class MenuWidget extends React.Component {
|
|
|
2063
2098
|
}
|
|
2064
2099
|
}
|
|
2065
2100
|
|
|
2066
|
-
createMyServicesComponent() {
|
|
2067
|
-
let dropdowns = document.querySelectorAll('.map-menu-dropdown');
|
|
2068
|
-
let i = dropdowns.length === 0 ? 0 : dropdowns.length - 1;
|
|
2069
|
-
let componentId = `component_${i}`;
|
|
2070
|
-
let dropdownId = `dropdown_${i}`;
|
|
2071
|
-
|
|
2072
|
-
// Create "My Services" component from the start and set its display to none
|
|
2073
|
-
let myServicesStyle =
|
|
2074
|
-
this.state.wmsUserServiceLayers.length > 0 ? {} : { display: 'none' };
|
|
2075
|
-
return (
|
|
2076
|
-
<div
|
|
2077
|
-
className="map-menu-dropdown"
|
|
2078
|
-
id={componentId}
|
|
2079
|
-
key="a5"
|
|
2080
|
-
style={myServicesStyle}
|
|
2081
|
-
>
|
|
2082
|
-
<div
|
|
2083
|
-
id={dropdownId}
|
|
2084
|
-
className="ccl-expandable__button"
|
|
2085
|
-
aria-expanded="false"
|
|
2086
|
-
onClick={this.toggleDropdownContent.bind(this)}
|
|
2087
|
-
onKeyDown={this.toggleDropdownContent.bind(this)}
|
|
2088
|
-
tabIndex="0"
|
|
2089
|
-
role="button"
|
|
2090
|
-
>
|
|
2091
|
-
<div className="dropdown-icon">
|
|
2092
|
-
<FontAwesomeIcon icon={['fas', 'caret-right']} />
|
|
2093
|
-
</div>
|
|
2094
|
-
{<span>{'My Service'}</span>}
|
|
2095
|
-
</div>
|
|
2096
|
-
<div className="map-menu-components-container" id="map-menu-services" />
|
|
2097
|
-
</div>
|
|
2098
|
-
);
|
|
2099
|
-
}
|
|
2100
|
-
|
|
2101
2101
|
createUserServices(serviceLayers) {
|
|
2102
2102
|
const fieldset = document.getElementById('map-menu-services');
|
|
2103
2103
|
if (!fieldset) return;
|
|
@@ -2273,17 +2273,18 @@ class MenuWidget extends React.Component {
|
|
|
2273
2273
|
// Update state with recreated layers
|
|
2274
2274
|
this.setState({ wmsUserServiceLayers: validLayers });
|
|
2275
2275
|
// Get checked layers from session storage
|
|
2276
|
-
const checkedLayers =
|
|
2277
|
-
|
|
2276
|
+
// const checkedLayers =
|
|
2277
|
+
// JSON.parse(sessionStorage.getItem('checkedLayers')) || [];
|
|
2278
2278
|
|
|
2279
2279
|
// For each valid layer that was previously checked, make it visible
|
|
2280
2280
|
validLayers.forEach((layer) => {
|
|
2281
|
-
if (checkedLayers.includes(layer.LayerId)) {
|
|
2282
|
-
|
|
2283
|
-
|
|
2284
|
-
|
|
2285
|
-
|
|
2286
|
-
|
|
2281
|
+
// if (checkedLayers.includes(layer.LayerId)) {
|
|
2282
|
+
const node = document.getElementById(layer.LayerId);
|
|
2283
|
+
if (node) {
|
|
2284
|
+
layer.visible === true
|
|
2285
|
+
? (node.checked = true)
|
|
2286
|
+
: (node.checked = false);
|
|
2287
|
+
this.toggleLayer(node);
|
|
2287
2288
|
}
|
|
2288
2289
|
});
|
|
2289
2290
|
}
|
|
@@ -2516,7 +2517,6 @@ class MenuWidget extends React.Component {
|
|
|
2516
2517
|
|
|
2517
2518
|
let group = this.getGroup(elem);
|
|
2518
2519
|
if (elem.checked) {
|
|
2519
|
-
//this.props.loadingHandler(true);
|
|
2520
2520
|
if (
|
|
2521
2521
|
this.props.download ||
|
|
2522
2522
|
this.location.search.includes('product=') ||
|
|
@@ -4039,6 +4039,22 @@ class MenuWidget extends React.Component {
|
|
|
4039
4039
|
layerOpacities[layer] = value;
|
|
4040
4040
|
sessionStorage.setItem('layerOpacities', JSON.stringify(layerOpacities));
|
|
4041
4041
|
}
|
|
4042
|
+
let savedServices = JSON.parse(
|
|
4043
|
+
localStorage.getItem(USER_SERVICES_KEY + '_' + this.userID),
|
|
4044
|
+
);
|
|
4045
|
+
if (savedServices === null) {
|
|
4046
|
+
return;
|
|
4047
|
+
} else {
|
|
4048
|
+
for (const service of Object.values(savedServices)) {
|
|
4049
|
+
if (service.LayerId === layer) {
|
|
4050
|
+
service.opacity = value;
|
|
4051
|
+
}
|
|
4052
|
+
localStorage.setItem(
|
|
4053
|
+
USER_SERVICES_KEY + '_' + this.userID,
|
|
4054
|
+
JSON.stringify(savedServices),
|
|
4055
|
+
);
|
|
4056
|
+
}
|
|
4057
|
+
}
|
|
4042
4058
|
}
|
|
4043
4059
|
|
|
4044
4060
|
/**
|
|
@@ -4047,7 +4063,32 @@ class MenuWidget extends React.Component {
|
|
|
4047
4063
|
* @param {*} value The opacity value retrieved from the input
|
|
4048
4064
|
*/
|
|
4049
4065
|
loadOpacity() {
|
|
4050
|
-
let layerOpacities =
|
|
4066
|
+
let layerOpacities =
|
|
4067
|
+
JSON.parse(sessionStorage.getItem('layerOpacities')) || {};
|
|
4068
|
+
const savedUserServices = JSON.parse(
|
|
4069
|
+
localStorage.getItem(USER_SERVICES_KEY + '_' + this.userID),
|
|
4070
|
+
);
|
|
4071
|
+
if (savedUserServices) {
|
|
4072
|
+
Object.values(savedUserServices).forEach((service) => {
|
|
4073
|
+
let layer = service.LayerId;
|
|
4074
|
+
let value = service.opacity;
|
|
4075
|
+
// Check if the layer is already in layerOpacities
|
|
4076
|
+
if (layerOpacities[layer] === undefined) {
|
|
4077
|
+
//add to layerOpacties
|
|
4078
|
+
layerOpacities[layer] = value;
|
|
4079
|
+
// if (this.layers[service]) {
|
|
4080
|
+
// // set map
|
|
4081
|
+
// this.layers[service].opacity = value;
|
|
4082
|
+
// // set slider
|
|
4083
|
+
// let nodeValue = `.active-layer[layer-id="${layer}"] .active-layer-opacity`;
|
|
4084
|
+
// let node = document.querySelector(nodeValue);
|
|
4085
|
+
// if (node) {
|
|
4086
|
+
// node.dataset.opacity = value * 100;
|
|
4087
|
+
// }
|
|
4088
|
+
// }
|
|
4089
|
+
}
|
|
4090
|
+
});
|
|
4091
|
+
}
|
|
4051
4092
|
if (layerOpacities) {
|
|
4052
4093
|
for (const layer in layerOpacities) {
|
|
4053
4094
|
if (this.layers[layer]) {
|
|
@@ -4245,6 +4286,8 @@ class MenuWidget extends React.Component {
|
|
|
4245
4286
|
});
|
|
4246
4287
|
}
|
|
4247
4288
|
this.setLegendOpacity();
|
|
4289
|
+
this.loadOpacity();
|
|
4290
|
+
this.loadVisibility();
|
|
4248
4291
|
}
|
|
4249
4292
|
|
|
4250
4293
|
/**
|
|
@@ -4260,11 +4303,38 @@ class MenuWidget extends React.Component {
|
|
|
4260
4303
|
*/
|
|
4261
4304
|
loadVisibility() {
|
|
4262
4305
|
if (this.props.download) return;
|
|
4306
|
+
|
|
4307
|
+
// Load visibility settings from sessionStorage
|
|
4263
4308
|
let vl = JSON.parse(sessionStorage.getItem('visibleLayers'));
|
|
4264
4309
|
if (vl) {
|
|
4265
4310
|
this.visibleLayers = vl;
|
|
4311
|
+
} else {
|
|
4312
|
+
this.visibleLayers = {};
|
|
4313
|
+
}
|
|
4314
|
+
|
|
4315
|
+
// Load visibility settings from saved user services in localStorage
|
|
4316
|
+
const savedUserServices = JSON.parse(
|
|
4317
|
+
localStorage.getItem(USER_SERVICES_KEY + '_' + this.userID),
|
|
4318
|
+
);
|
|
4319
|
+
|
|
4320
|
+
if (savedUserServices) {
|
|
4321
|
+
Object.values(savedUserServices).forEach((service) => {
|
|
4322
|
+
let layerId = service.LayerId;
|
|
4323
|
+
let visibility = service.visibility;
|
|
4324
|
+
// Only add visibility from localStorage if not already in sessionStorage
|
|
4325
|
+
if (this.visibleLayers[layerId] === undefined) {
|
|
4326
|
+
if (visibility) {
|
|
4327
|
+
this.visibleLayers[layerId] = ['fas', 'eye'];
|
|
4328
|
+
} else {
|
|
4329
|
+
this.visibleLayers[layerId] = ['fas', 'eye-slash'];
|
|
4330
|
+
}
|
|
4331
|
+
}
|
|
4332
|
+
});
|
|
4333
|
+
}
|
|
4266
4334
|
|
|
4267
|
-
|
|
4335
|
+
// Apply visibility settings to layers
|
|
4336
|
+
for (const key in this.visibleLayers) {
|
|
4337
|
+
if (this.layers[key]) {
|
|
4268
4338
|
if (this.visibleLayers[key][1] === 'eye') {
|
|
4269
4339
|
this.layers[key].visible = true;
|
|
4270
4340
|
} else {
|
|
@@ -4272,10 +4342,10 @@ class MenuWidget extends React.Component {
|
|
|
4272
4342
|
}
|
|
4273
4343
|
|
|
4274
4344
|
let elem = document.getElementById(key);
|
|
4275
|
-
if (this.activeLayersJSON[
|
|
4276
|
-
let order = this.activeLayersJSON[
|
|
4345
|
+
if (elem && this.activeLayersJSON[key]) {
|
|
4346
|
+
let order = this.activeLayersJSON[key].props['layer-order'];
|
|
4277
4347
|
// add active layer to DOM
|
|
4278
|
-
this.activeLayersJSON[
|
|
4348
|
+
this.activeLayersJSON[key] = this.addActiveLayer(elem, order);
|
|
4279
4349
|
// reorder layers
|
|
4280
4350
|
this.layersReorder();
|
|
4281
4351
|
// show/hide info widget
|
|
@@ -73,6 +73,7 @@ class SwipeWidget extends React.Component {
|
|
|
73
73
|
// and ensure that the component is rendered again
|
|
74
74
|
this.loadOptions();
|
|
75
75
|
this.map.layers.on('change', () => {
|
|
76
|
+
this.loadOptions();
|
|
76
77
|
if (this.hasSwipe) {
|
|
77
78
|
this.map.layers.removeAll();
|
|
78
79
|
if (this.swipe.leadingLayers && this.swipe.leadingLayers.items[0]) {
|
|
@@ -82,7 +83,6 @@ class SwipeWidget extends React.Component {
|
|
|
82
83
|
this.map.layers.add(this.swipe.trailingLayers.items[0]);
|
|
83
84
|
}
|
|
84
85
|
}
|
|
85
|
-
this.loadOptions();
|
|
86
86
|
});
|
|
87
87
|
this.setState({ showMapMenu: true });
|
|
88
88
|
}
|
|
@@ -136,7 +136,31 @@ class SwipeWidget extends React.Component {
|
|
|
136
136
|
selectTrailingLayer.options[0].disabled = true;
|
|
137
137
|
}
|
|
138
138
|
let cl = JSON.parse(sessionStorage.getItem('checkedLayers'));
|
|
139
|
-
if (
|
|
139
|
+
if (
|
|
140
|
+
(!cl || cl.length === 0) &&
|
|
141
|
+
this.map &&
|
|
142
|
+
this.map.layers &&
|
|
143
|
+
this.map.layers.items.length > 0
|
|
144
|
+
) {
|
|
145
|
+
cl = [];
|
|
146
|
+
// Find the layer ID in this.layers that corresponds to each map.layers item
|
|
147
|
+
for (const mapLayer of this.map.layers.items) {
|
|
148
|
+
for (const [layerKey, layerObj] of Object.entries(this.layers)) {
|
|
149
|
+
if (layerObj.id === mapLayer.id) {
|
|
150
|
+
cl.push(layerKey);
|
|
151
|
+
break;
|
|
152
|
+
}
|
|
153
|
+
}
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
// Save the newly created checkedLayers to sessionStorage
|
|
157
|
+
if (cl.length > 0) {
|
|
158
|
+
sessionStorage.setItem('checkedLayers', JSON.stringify(cl));
|
|
159
|
+
}
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
// Process the layers
|
|
163
|
+
if (cl && cl.length > 0) {
|
|
140
164
|
cl.forEach((layer) => {
|
|
141
165
|
if (this.layers[layer]) {
|
|
142
166
|
let layerId = this.layers[layer].id;
|