@eeacms/volto-arcgis-block 0.1.46 → 0.1.49
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 +39 -0
- package/package.json +1 -1
- package/src/components/MapViewer/MapViewer.jsx +44 -3
- package/src/components/MapViewer/MenuWidget.jsx +61 -2
- package/src/components/MapViewer/css/ArcgisMap.css +2 -4
- package/src/components/UseCasesMapViewer/UseCasesMapViewer.jsx +3 -1
- package/src/components/UseCasesMapViewer/css/ArcgisMap.css +0 -6
package/CHANGELOG.md
CHANGED
|
@@ -4,8 +4,47 @@ 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.49](https://github.com/eea/volto-arcgis-block/compare/0.1.48...0.1.49)
|
|
8
|
+
|
|
9
|
+
- Use cases tooltip bug [`#159`](https://github.com/eea/volto-arcgis-block/pull/159)
|
|
10
|
+
|
|
11
|
+
#### [0.1.48](https://github.com/eea/volto-arcgis-block/compare/0.1.47...0.1.48)
|
|
12
|
+
|
|
13
|
+
> 12 July 2022
|
|
14
|
+
|
|
15
|
+
- mapviewer bugfix [`#158`](https://github.com/eea/volto-arcgis-block/pull/158)
|
|
16
|
+
- mapviewer bugfix [`#157`](https://github.com/eea/volto-arcgis-block/pull/157)
|
|
17
|
+
- Revert "MapViewer persistence implemented" [`#156`](https://github.com/eea/volto-arcgis-block/pull/156)
|
|
18
|
+
- MapViewer persistence implemented [`#154`](https://github.com/eea/volto-arcgis-block/pull/154)
|
|
19
|
+
- Merge pull request #155 from eea/develop [`07c592d`](https://github.com/eea/volto-arcgis-block/commit/07c592dc40d943a0904b67a641c22de2251b0b64)
|
|
20
|
+
- Update cypress.json [`d02b2b8`](https://github.com/eea/volto-arcgis-block/commit/d02b2b8ee74d5059e51ab36ea95a6b0b650d92a0)
|
|
21
|
+
|
|
22
|
+
#### [0.1.47](https://github.com/eea/volto-arcgis-block/compare/0.1.46...0.1.47)
|
|
23
|
+
|
|
24
|
+
> 11 July 2022
|
|
25
|
+
|
|
26
|
+
- Arrow icon [`#153`](https://github.com/eea/volto-arcgis-block/pull/153)
|
|
27
|
+
- Revert all changes [`#152`](https://github.com/eea/volto-arcgis-block/pull/152)
|
|
28
|
+
- code coverage removal [`#150`](https://github.com/eea/volto-arcgis-block/pull/150)
|
|
29
|
+
- Revert "Mapviewer menu and map viewer options persistence" [`#149`](https://github.com/eea/volto-arcgis-block/pull/149)
|
|
30
|
+
- Mapviewer menu and map viewer options persistence [`#147`](https://github.com/eea/volto-arcgis-block/pull/147)
|
|
31
|
+
- Merge pull request #148 from eea/develop [`24266fb`](https://github.com/eea/volto-arcgis-block/commit/24266fb3a0c1662d22ae0529dc1d5a25c711cf97)
|
|
32
|
+
- Revert "Revert "Mapviewer menu and map viewer options persistence"" [`ad6e440`](https://github.com/eea/volto-arcgis-block/commit/ad6e440cdc160cffb1e86e1b26e501dbe648476c)
|
|
33
|
+
- Revert "code coverage removal" [`376f2d1`](https://github.com/eea/volto-arcgis-block/commit/376f2d1cd6e4e5110b3b63d5114af1bcfebe094b)
|
|
34
|
+
- Revert "Update cypress.json" [`43d01a0`](https://github.com/eea/volto-arcgis-block/commit/43d01a0a95a58ef5215c6cbf18223ca30a11b9cc)
|
|
35
|
+
- Revert "Update cypress.json" [`054c4ae`](https://github.com/eea/volto-arcgis-block/commit/054c4ae1767e1f26e6ec7e96a0e26a9711f29f04)
|
|
36
|
+
- Update cypress.json [`be285ff`](https://github.com/eea/volto-arcgis-block/commit/be285fff0c53e06a0180d5318cce81195eabcf80)
|
|
37
|
+
- Update cypress.json [`a7f2118`](https://github.com/eea/volto-arcgis-block/commit/a7f2118acb7b048b4cef85aa9663c2244a1c9ca0)
|
|
38
|
+
- linting fix [`27e969a`](https://github.com/eea/volto-arcgis-block/commit/27e969a7a411fd4646e0e742ce846efc0d79703e)
|
|
39
|
+
- linting fix [`7f6fcc7`](https://github.com/eea/volto-arcgis-block/commit/7f6fcc738b9407c8caf27e999ac2a2f810235284)
|
|
40
|
+
- code cleaning [`3fdf30e`](https://github.com/eea/volto-arcgis-block/commit/3fdf30e6c7dba8689ddd33278886dda90c781c3d)
|
|
41
|
+
- map viewer persistence implemented [`7173c05`](https://github.com/eea/volto-arcgis-block/commit/7173c057aafe2cfad5fb717952a5d686030bef05)
|
|
42
|
+
|
|
7
43
|
#### [0.1.46](https://github.com/eea/volto-arcgis-block/compare/0.1.45...0.1.46)
|
|
8
44
|
|
|
45
|
+
> 23 June 2022
|
|
46
|
+
|
|
47
|
+
- Develop [`#146`](https://github.com/eea/volto-arcgis-block/pull/146)
|
|
9
48
|
- Bugs n improvements [`#145`](https://github.com/eea/volto-arcgis-block/pull/145)
|
|
10
49
|
- Develop [`#144`](https://github.com/eea/volto-arcgis-block/pull/144)
|
|
11
50
|
- ESLint fix [`6ce7032`](https://github.com/eea/volto-arcgis-block/commit/6ce7032bbb204cbca03badc6a770d6d46801ce6c)
|
package/package.json
CHANGED
|
@@ -19,7 +19,7 @@ import MenuWidget from './MenuWidget';
|
|
|
19
19
|
|
|
20
20
|
//import "isomorphic-fetch"; <-- Necessary to use fetch?
|
|
21
21
|
var Map, MapView, Zoom, intl;
|
|
22
|
-
|
|
22
|
+
let mapStatus = {};
|
|
23
23
|
const CheckLanguage = () => {
|
|
24
24
|
const { locale } = useIntl();
|
|
25
25
|
intl.setLocale(locale);
|
|
@@ -50,6 +50,20 @@ class MapViewer extends React.Component {
|
|
|
50
50
|
this.state = {};
|
|
51
51
|
}
|
|
52
52
|
|
|
53
|
+
setCenterState(centerStatus) {
|
|
54
|
+
mapStatus.center = centerStatus;
|
|
55
|
+
sessionStorage.setItem('mapStatus', JSON.stringify(mapStatus));
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
setZoomState(zoomStatus) {
|
|
59
|
+
mapStatus.zoom = zoomStatus;
|
|
60
|
+
sessionStorage.setItem('mapStatus', JSON.stringify(mapStatus));
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
recoverState() {
|
|
64
|
+
return JSON.parse(sessionStorage.getItem('mapStatus'));
|
|
65
|
+
}
|
|
66
|
+
|
|
53
67
|
updateArea(shared_value) {
|
|
54
68
|
this.mapViewer.setState({ area: shared_value });
|
|
55
69
|
}
|
|
@@ -73,17 +87,32 @@ class MapViewer extends React.Component {
|
|
|
73
87
|
async componentDidMount() {
|
|
74
88
|
loadCss();
|
|
75
89
|
await this.loader();
|
|
90
|
+
|
|
76
91
|
// this.mapdiv.current is the reference to the current DOM element of
|
|
77
92
|
// this.mapdiv after it was mounted by the render() method
|
|
78
93
|
this.map = new Map({
|
|
79
94
|
basemap: 'topo',
|
|
80
95
|
});
|
|
81
96
|
|
|
97
|
+
if (
|
|
98
|
+
mapStatus === null ||
|
|
99
|
+
(mapStatus.zoom === null && mapStatus.center === null) ||
|
|
100
|
+
Object.entries(mapStatus).length === 0
|
|
101
|
+
) {
|
|
102
|
+
mapStatus = {};
|
|
103
|
+
mapStatus.zoom = this.mapCfg.zoom;
|
|
104
|
+
mapStatus.center = this.mapCfg.center;
|
|
105
|
+
this.setCenterState(this.mapCfg.zoom);
|
|
106
|
+
this.setZoomState(this.mapCfg.center);
|
|
107
|
+
} else {
|
|
108
|
+
mapStatus = this.recoverState();
|
|
109
|
+
}
|
|
110
|
+
|
|
82
111
|
this.view = new MapView({
|
|
83
112
|
container: this.mapdiv.current,
|
|
84
113
|
map: this.map,
|
|
85
|
-
center:
|
|
86
|
-
zoom:
|
|
114
|
+
center: mapStatus.center,
|
|
115
|
+
zoom: mapStatus.zoom,
|
|
87
116
|
constraints: {
|
|
88
117
|
minZoom: this.mapCfg.minZoom,
|
|
89
118
|
maxZoom: this.mapCfg.maxZoom,
|
|
@@ -98,6 +127,14 @@ class MapViewer extends React.Component {
|
|
|
98
127
|
this.view.ui.add(this.zoom, {
|
|
99
128
|
position: 'top-right',
|
|
100
129
|
});
|
|
130
|
+
|
|
131
|
+
this.view.watch('center', (newValue, oldValue, property, object) => {
|
|
132
|
+
this.setCenterState(newValue);
|
|
133
|
+
});
|
|
134
|
+
|
|
135
|
+
this.view.watch('zoom', (newValue, oldValue, property, object) => {
|
|
136
|
+
this.setZoomState(newValue);
|
|
137
|
+
});
|
|
101
138
|
this.view.popup.autoOpenEnabled = false;
|
|
102
139
|
// After launching the MapViewerConfig action
|
|
103
140
|
// we will have stored the json response here:
|
|
@@ -111,6 +148,10 @@ class MapViewer extends React.Component {
|
|
|
111
148
|
//this.setState({});
|
|
112
149
|
}
|
|
113
150
|
|
|
151
|
+
setWidgetState() {}
|
|
152
|
+
|
|
153
|
+
setSaveMapChange() {}
|
|
154
|
+
|
|
114
155
|
setActiveWidget(widget) {
|
|
115
156
|
if (!widget) {
|
|
116
157
|
this.activeWidget = null;
|
|
@@ -461,6 +461,7 @@ class MenuWidget extends React.Component {
|
|
|
461
461
|
//to watch the component
|
|
462
462
|
this.setState({});
|
|
463
463
|
this.openMenu();
|
|
464
|
+
this.loadLayers();
|
|
464
465
|
}
|
|
465
466
|
|
|
466
467
|
checkUrl() {
|
|
@@ -1021,7 +1022,7 @@ class MenuWidget extends React.Component {
|
|
|
1021
1022
|
let group = this.getGroup(elem);
|
|
1022
1023
|
if (elem.checked) {
|
|
1023
1024
|
this.map.add(this.layers[elem.id]);
|
|
1024
|
-
this.layers[elem.id].visible = true;
|
|
1025
|
+
this.layers[elem.id].visible = true; //layer id
|
|
1025
1026
|
this.visibleLayers[elem.id] = ['fas', 'eye'];
|
|
1026
1027
|
this.timeLayers[elem.id] = ['far', 'clock'];
|
|
1027
1028
|
if (group) {
|
|
@@ -1043,12 +1044,14 @@ class MenuWidget extends React.Component {
|
|
|
1043
1044
|
elem,
|
|
1044
1045
|
Object.keys(this.activeLayersJSON).length,
|
|
1045
1046
|
);
|
|
1047
|
+
this.saveLayer(elem.id);
|
|
1046
1048
|
}
|
|
1047
1049
|
let nuts = this.map.layers.items.find((layer) => layer.title === 'nuts');
|
|
1048
1050
|
if (nuts) {
|
|
1049
1051
|
this.map.reorder(nuts, this.map.layers.items.length + 1);
|
|
1050
1052
|
}
|
|
1051
1053
|
} else {
|
|
1054
|
+
this.deleteLayer(elem.id);
|
|
1052
1055
|
this.layers[elem.id].opacity = 1;
|
|
1053
1056
|
this.map.remove(this.layers[elem.id]);
|
|
1054
1057
|
delete this.activeLayersJSON[elem.id];
|
|
@@ -1097,7 +1100,6 @@ class MenuWidget extends React.Component {
|
|
|
1097
1100
|
toggleDataset(value, id, e) {
|
|
1098
1101
|
let layerdef = e.getAttribute('defcheck');
|
|
1099
1102
|
let splitdefCheck = layerdef.split(',');
|
|
1100
|
-
|
|
1101
1103
|
let layerChecks = [];
|
|
1102
1104
|
let selector = [];
|
|
1103
1105
|
if (value) {
|
|
@@ -1632,6 +1634,63 @@ class MenuWidget extends React.Component {
|
|
|
1632
1634
|
});
|
|
1633
1635
|
}
|
|
1634
1636
|
|
|
1637
|
+
/**
|
|
1638
|
+
* Method to save checked layers
|
|
1639
|
+
*/
|
|
1640
|
+
saveLayer(layer) {
|
|
1641
|
+
let checkedLayers = JSON.parse(sessionStorage.getItem('checkedLayers'));
|
|
1642
|
+
if (checkedLayers === null) {
|
|
1643
|
+
checkedLayers = [layer];
|
|
1644
|
+
sessionStorage.setItem('checkedLayers', JSON.stringify(checkedLayers));
|
|
1645
|
+
} else {
|
|
1646
|
+
if (!checkedLayers.includes(layer)) {
|
|
1647
|
+
checkedLayers.push(layer);
|
|
1648
|
+
}
|
|
1649
|
+
sessionStorage.setItem('checkedLayers', JSON.stringify(checkedLayers));
|
|
1650
|
+
}
|
|
1651
|
+
}
|
|
1652
|
+
|
|
1653
|
+
/**
|
|
1654
|
+
* Method to delete checked layers
|
|
1655
|
+
*/
|
|
1656
|
+
deleteLayer(layer) {
|
|
1657
|
+
let checkedLayers = JSON.parse(sessionStorage.getItem('checkedLayers'));
|
|
1658
|
+
for (var i = 0; i < checkedLayers.length; i++) {
|
|
1659
|
+
if (checkedLayers[i] === layer) {
|
|
1660
|
+
checkedLayers.splice(i, 1);
|
|
1661
|
+
}
|
|
1662
|
+
}
|
|
1663
|
+
sessionStorage.setItem('checkedLayers', JSON.stringify(checkedLayers));
|
|
1664
|
+
}
|
|
1665
|
+
/**
|
|
1666
|
+
* Method to load previously checked layers
|
|
1667
|
+
*/
|
|
1668
|
+
loadLayers() {
|
|
1669
|
+
let event = new MouseEvent('click', {
|
|
1670
|
+
view: window,
|
|
1671
|
+
bubbles: true,
|
|
1672
|
+
cancelable: false,
|
|
1673
|
+
});
|
|
1674
|
+
|
|
1675
|
+
let layers = JSON.parse(sessionStorage.getItem('checkedLayers'));
|
|
1676
|
+
if (layers) {
|
|
1677
|
+
for (let i = 0; i < layers.length; i++) {
|
|
1678
|
+
let elem = layers[i];
|
|
1679
|
+
let node = document.getElementById(elem);
|
|
1680
|
+
node.dispatchEvent(event);
|
|
1681
|
+
let dropdown = document
|
|
1682
|
+
.getElementById(elem)
|
|
1683
|
+
.closest('.map-menu-dropdown');
|
|
1684
|
+
dropdown
|
|
1685
|
+
.querySelector('.ccl-expandable__button')
|
|
1686
|
+
.setAttribute('aria-expanded', 'true');
|
|
1687
|
+
let scrollPosition = document
|
|
1688
|
+
.getElementById(elem)
|
|
1689
|
+
.closest('.map-menu-product-dropdown').offsetTop;
|
|
1690
|
+
document.querySelector('.panels').scrollTop = scrollPosition;
|
|
1691
|
+
}
|
|
1692
|
+
}
|
|
1693
|
+
}
|
|
1635
1694
|
/**
|
|
1636
1695
|
* Method to change between tabs
|
|
1637
1696
|
*/
|
|
@@ -411,6 +411,7 @@
|
|
|
411
411
|
}
|
|
412
412
|
|
|
413
413
|
.map-menu-dropdown .ccl-expandable__button .dropdown-icon {
|
|
414
|
+
height: 1.25rem;
|
|
414
415
|
margin-right: 1rem;
|
|
415
416
|
color: black;
|
|
416
417
|
}
|
|
@@ -419,16 +420,12 @@
|
|
|
419
420
|
.ccl-expandable__button[aria-expanded='false']
|
|
420
421
|
.dropdown-icon {
|
|
421
422
|
transform: rotate(0deg);
|
|
422
|
-
-webkit-transition: transform 0.3s ease-out;
|
|
423
|
-
transition: transform 0.3s ease-out;
|
|
424
423
|
}
|
|
425
424
|
|
|
426
425
|
.map-menu-dropdown
|
|
427
426
|
.ccl-expandable__button[aria-expanded='true']
|
|
428
427
|
.dropdown-icon {
|
|
429
428
|
transform: rotate(90deg);
|
|
430
|
-
-webkit-transition: transform 0.3s ease-out;
|
|
431
|
-
transition: transform 0.3s ease-out;
|
|
432
429
|
}
|
|
433
430
|
|
|
434
431
|
.map-menu-dropdown .ccl-expandable__button::after {
|
|
@@ -840,6 +837,7 @@
|
|
|
840
837
|
|
|
841
838
|
.right-panel-content {
|
|
842
839
|
overflow: auto;
|
|
840
|
+
height: 100%;
|
|
843
841
|
padding: 1rem;
|
|
844
842
|
}
|
|
845
843
|
|
|
@@ -382,7 +382,9 @@ class UseCasesMapViewer extends React.Component {
|
|
|
382
382
|
if (data_country > 0) {
|
|
383
383
|
string += `<div>${data_country} Use cases with one or multi-country coverage</div>`;
|
|
384
384
|
}
|
|
385
|
-
|
|
385
|
+
if (data.features.length === 0) {
|
|
386
|
+
string += `<div>0 Use cases</div>`;
|
|
387
|
+
}
|
|
386
388
|
view.popup.open({
|
|
387
389
|
location: {
|
|
388
390
|
latitude: response.results[0].graphic.geometry.latitude,
|
|
@@ -123,22 +123,16 @@
|
|
|
123
123
|
font-family: 'ccl-icons';
|
|
124
124
|
-moz-osx-font-smoothing: grayscale;
|
|
125
125
|
-webkit-font-smoothing: antialiased;
|
|
126
|
-
-webkit-transition: all 0.3s ease-in-out;
|
|
127
|
-
transition: all 0.3s ease-in-out;
|
|
128
126
|
}
|
|
129
127
|
|
|
130
128
|
.use-cases-dropdown .ccl-expandable__button[aria-expanded='false']::after {
|
|
131
129
|
content: '\e914';
|
|
132
130
|
transform: rotate(0deg);
|
|
133
|
-
-webkit-transition: transform 0.3s ease-out;
|
|
134
|
-
transition: transform 0.3s ease-out;
|
|
135
131
|
}
|
|
136
132
|
|
|
137
133
|
.use-cases-dropdown .ccl-expandable__button[aria-expanded='true']::after {
|
|
138
134
|
content: '\e914';
|
|
139
135
|
transform: rotate(-180deg);
|
|
140
|
-
-webkit-transition: transform 0.3s ease-out;
|
|
141
|
-
transition: transform 0.3s ease-out;
|
|
142
136
|
}
|
|
143
137
|
|
|
144
138
|
.use-cases-dropdown .ccl-expandable__button::after {
|