@eeacms/volto-cca-policy 0.3.47 → 0.3.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 +24 -1
- package/jest-addon.config.js +421 -6
- package/package.json +2 -2
- package/src/components/manage/Blocks/CaseStudyExplorer/CaseStudyMap.jsx +7 -5
- package/src/components/manage/Blocks/CaseStudyExplorer/CaseStudyMap.test.jsx +17 -0
- package/src/components/manage/Blocks/CaseStudyExplorer/FeatureInteraction.jsx +8 -7
- package/src/components/manage/Blocks/CaseStudyExplorer/useInteractiveStyles.jsx +37 -31
- package/src/components/manage/Blocks/CaseStudyExplorer/utils.js +1 -3
- package/src/components/manage/Blocks/CountryMapObservatory/CountryMapObservatoryOLView.jsx +5 -4
- package/src/components/manage/Blocks/CountryMapObservatory/mapstyle.js +3 -5
- package/src/components/manage/Blocks/index.js +7 -6
- package/src/index.js +2 -2
- package/src/components/manage/Blocks/MKHMap/Edit.jsx +0 -29
- package/src/components/manage/Blocks/MKHMap/FeatureDisplay.jsx +0 -87
- package/src/components/manage/Blocks/MKHMap/FeatureInteraction.jsx +0 -56
- package/src/components/manage/Blocks/MKHMap/InfoOverlay.jsx +0 -80
- package/src/components/manage/Blocks/MKHMap/View.jsx +0 -118
- package/src/components/manage/Blocks/MKHMap/index.js +0 -25
- package/src/components/manage/Blocks/MKHMap/layers.js +0 -107
- package/src/components/manage/Blocks/MKHMap/map.svg +0 -3
- package/src/components/manage/Blocks/MKHMap/schema.js +0 -15
- package/src/components/manage/Blocks/MKHMap/styles.less +0 -41
- package/src/components/manage/Blocks/MKHMap/useWhyDidYouUpdate.js +0 -33
|
@@ -1,107 +0,0 @@
|
|
|
1
|
-
import { openlayers as ol } from '@eeacms/volto-openlayers-map';
|
|
2
|
-
import mapSVG from './map.svg';
|
|
3
|
-
|
|
4
|
-
const serviceUrl =
|
|
5
|
-
'https://nest.discomap.eea.europa.eu/arcgis/rest/services/CLIMA/Regions_cities/MapServer/';
|
|
6
|
-
|
|
7
|
-
// console.log('ol', ol);
|
|
8
|
-
|
|
9
|
-
function r() {
|
|
10
|
-
return Math.floor(Math.random() * 256);
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
const fillColors = {
|
|
14
|
-
'0': [125, 125, 125, 1],
|
|
15
|
-
'NUTS 0': [0, 0, 0, 1],
|
|
16
|
-
'NUTS 1': [255, 0, 0, 1],
|
|
17
|
-
'NUTS 2': [0, 255, 0, 1],
|
|
18
|
-
'NUTS 3': [0, 0, 255, 1],
|
|
19
|
-
};
|
|
20
|
-
|
|
21
|
-
const makeLayer = (layerId) => {
|
|
22
|
-
// return null;
|
|
23
|
-
|
|
24
|
-
const fillStyle = new ol.style.Style({
|
|
25
|
-
fill: new ol.style.Fill(),
|
|
26
|
-
stroke: new ol.style.Stroke({
|
|
27
|
-
color: [0, 0, 0, 1],
|
|
28
|
-
width: 0.5,
|
|
29
|
-
}),
|
|
30
|
-
});
|
|
31
|
-
|
|
32
|
-
const pinStyle = new ol.style.Style({
|
|
33
|
-
image: new ol.style.Icon({
|
|
34
|
-
src: mapSVG,
|
|
35
|
-
color: '#BADA55',
|
|
36
|
-
crossOrigin: 'anonymous',
|
|
37
|
-
}),
|
|
38
|
-
});
|
|
39
|
-
|
|
40
|
-
const vectorSource = new ol.source.Vector({
|
|
41
|
-
format: new ol.format.EsriJSON(),
|
|
42
|
-
url: function (extent, resolution, projection) {
|
|
43
|
-
// ArcGIS Server only wants the numeric portion of the projection ID.
|
|
44
|
-
const srid = projection
|
|
45
|
-
.getCode()
|
|
46
|
-
.split(/:(?=\d+$)/)
|
|
47
|
-
.pop();
|
|
48
|
-
|
|
49
|
-
const url =
|
|
50
|
-
serviceUrl +
|
|
51
|
-
layerId +
|
|
52
|
-
'/query/?f=json&' +
|
|
53
|
-
'returnGeometry=true&spatialRel=esriSpatialRelIntersects&geometry=' +
|
|
54
|
-
encodeURIComponent(
|
|
55
|
-
'{"xmin":' +
|
|
56
|
-
extent[0] +
|
|
57
|
-
',"ymin":' +
|
|
58
|
-
extent[1] +
|
|
59
|
-
',"xmax":' +
|
|
60
|
-
extent[2] +
|
|
61
|
-
',"ymax":' +
|
|
62
|
-
extent[3] +
|
|
63
|
-
',"spatialReference":{"wkid":' +
|
|
64
|
-
srid +
|
|
65
|
-
'}}',
|
|
66
|
-
) +
|
|
67
|
-
'&geometryType=esriGeometryEnvelope&inSR=' +
|
|
68
|
-
srid +
|
|
69
|
-
'&outFields=*' +
|
|
70
|
-
'&outSR=' +
|
|
71
|
-
srid;
|
|
72
|
-
|
|
73
|
-
return url;
|
|
74
|
-
},
|
|
75
|
-
strategy: ol.loadingstrategy.tile(
|
|
76
|
-
ol.tilegrid.createXYZ({
|
|
77
|
-
tileSize: 512,
|
|
78
|
-
}),
|
|
79
|
-
),
|
|
80
|
-
attributions: 'European Environment Agency',
|
|
81
|
-
});
|
|
82
|
-
|
|
83
|
-
return {
|
|
84
|
-
source: vectorSource,
|
|
85
|
-
style: function (feature) {
|
|
86
|
-
const nuts_id = feature.get('NUTS_ID');
|
|
87
|
-
const level_code = feature.get('LEVEL_CODE');
|
|
88
|
-
|
|
89
|
-
// const nuts_name = feature.get('NUTS_NAME');
|
|
90
|
-
// const country_code = feature.get('CNTR_CODE');
|
|
91
|
-
// const shape = feature.get('SHAPE');
|
|
92
|
-
|
|
93
|
-
// console.log({ country_code, nuts_id, nuts_name, level_code, feature });
|
|
94
|
-
|
|
95
|
-
// const classify = feature.get('LU_2014');
|
|
96
|
-
const color = fillColors[level_code] || [r(), r(), r(), 1];
|
|
97
|
-
fillStyle.getFill().setColor(color);
|
|
98
|
-
|
|
99
|
-
return nuts_id ? fillStyle : pinStyle;
|
|
100
|
-
},
|
|
101
|
-
opacity: 0.7,
|
|
102
|
-
};
|
|
103
|
-
};
|
|
104
|
-
|
|
105
|
-
export const countries = __CLIENT__ && makeLayer('0');
|
|
106
|
-
export const cities = __CLIENT__ && makeLayer('1');
|
|
107
|
-
export const regions = __CLIENT__ && makeLayer('2');
|
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
<svg xmlns="http://www.w3.org/2000/svg" width="36" height="36" viewBox="0 0 36 36">
|
|
2
|
-
<path d="M18,32 C11.3333333,23.6818983 8,17.6818983 8,14 C8,8.4771525 12.4771525,4 18,4 C23.5228475,4 28,8.4771525 28,14 C28,17.6818983 24.6666667,23.6818983 18,32 Z M26,14 C26,9.581722 22.418278,6 18,6 C13.581722,6 10,9.581722 10,14 C10,16.8065316 12.6565091,21.827053 18,28.7642044 C23.3434909,21.827053 26,16.8065316 26,14 Z M18,11 C19.656,11 21,12.344 21,14 C21,15.656 19.656,17 18,17 C16.344,17 15,15.656 15,14 C15,12.344 16.344,11 18,11 Z"/>
|
|
3
|
-
</svg>
|
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
div#view .ui.container > .explore-sites-wrapper,
|
|
2
|
-
div#view .ui.container > .explore-sites {
|
|
3
|
-
margin-bottom: 0;
|
|
4
|
-
}
|
|
5
|
-
|
|
6
|
-
.explore-sites {
|
|
7
|
-
display: flex;
|
|
8
|
-
justify-content: center;
|
|
9
|
-
margin-bottom: 0;
|
|
10
|
-
background-color: #f8f8f8;
|
|
11
|
-
|
|
12
|
-
&.visible.transition {
|
|
13
|
-
display: flex !important;
|
|
14
|
-
}
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
.explore-sites-wrapper {
|
|
18
|
-
.field .ui {
|
|
19
|
-
margin-right: 2em;
|
|
20
|
-
}
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
#popup-overlay {
|
|
24
|
-
width: 40ch;
|
|
25
|
-
padding: 0 1em 1em 1em;
|
|
26
|
-
background-color: white;
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
.feature-info {
|
|
30
|
-
font-size: small;
|
|
31
|
-
|
|
32
|
-
div {
|
|
33
|
-
display: flex;
|
|
34
|
-
column-gap: 1em;
|
|
35
|
-
|
|
36
|
-
dt {
|
|
37
|
-
width: 10ch;
|
|
38
|
-
font-weight: bold;
|
|
39
|
-
}
|
|
40
|
-
}
|
|
41
|
-
}
|
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
|
|
3
|
-
export default function useWhyDidYouUpdate(name, props) {
|
|
4
|
-
// Get a mutable ref object where we can store props ...
|
|
5
|
-
// ... for comparison next time this hook runs.
|
|
6
|
-
const previousProps = React.useRef();
|
|
7
|
-
React.useEffect(() => {
|
|
8
|
-
if (previousProps.current) {
|
|
9
|
-
// Get all keys from previous and current props
|
|
10
|
-
const allKeys = Object.keys({ ...previousProps.current, ...props });
|
|
11
|
-
// Use this object to keep track of changed props
|
|
12
|
-
const changesObj = {};
|
|
13
|
-
// Iterate through keys
|
|
14
|
-
allKeys.forEach((key) => {
|
|
15
|
-
// If previous is different from current
|
|
16
|
-
if (previousProps.current[key] !== props[key]) {
|
|
17
|
-
// Add to changesObj
|
|
18
|
-
changesObj[key] = {
|
|
19
|
-
from: previousProps.current[key],
|
|
20
|
-
to: props[key],
|
|
21
|
-
};
|
|
22
|
-
}
|
|
23
|
-
});
|
|
24
|
-
// If changesObj not empty then output to console
|
|
25
|
-
if (Object.keys(changesObj).length) {
|
|
26
|
-
// eslint-disable-next-line no-console
|
|
27
|
-
console.log('[why-did-you-update]', name, changesObj);
|
|
28
|
-
}
|
|
29
|
-
}
|
|
30
|
-
// Finally update previousProps with current props for next hook call
|
|
31
|
-
previousProps.current = props;
|
|
32
|
-
});
|
|
33
|
-
}
|