@eeacms/volto-eea-map 0.1.30 → 0.1.32
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/.project.eslintrc.js +7 -6
- package/CHANGELOG.md +14 -1
- package/package.json +4 -2
- package/src/components/Blocks/EmbedEEAMap/Edit.jsx +17 -2
- package/src/components/Blocks/EmbedEEAMap/View.jsx +15 -2
- package/src/components/Webmap.jsx +18 -5
- package/src/components/visualization/panelsSchema.js +4 -1
- package/src/components/widgets/LegendWidget.jsx +14 -15
package/.project.eslintrc.js
CHANGED
|
@@ -1,15 +1,18 @@
|
|
|
1
1
|
const fs = require('fs');
|
|
2
2
|
const path = require('path');
|
|
3
3
|
|
|
4
|
-
const projectRootPath = fs.
|
|
4
|
+
const projectRootPath = fs.existsSync('./project')
|
|
5
|
+
? fs.realpathSync('./project')
|
|
6
|
+
: fs.realpathSync('./../../../');
|
|
5
7
|
const packageJson = require(path.join(projectRootPath, 'package.json'));
|
|
6
|
-
const jsConfig = require(path.join(projectRootPath, 'jsconfig.json'))
|
|
8
|
+
const jsConfig = require(path.join(projectRootPath, 'jsconfig.json'))
|
|
9
|
+
.compilerOptions;
|
|
7
10
|
|
|
8
11
|
const pathsConfig = jsConfig.paths;
|
|
9
12
|
|
|
10
13
|
let voltoPath = path.join(projectRootPath, 'node_modules/@plone/volto');
|
|
11
14
|
|
|
12
|
-
Object.keys(pathsConfig).forEach(pkg => {
|
|
15
|
+
Object.keys(pathsConfig).forEach((pkg) => {
|
|
13
16
|
if (pkg === '@plone/volto') {
|
|
14
17
|
voltoPath = `./${jsConfig.baseUrl}/${pathsConfig[pkg][0]}`;
|
|
15
18
|
}
|
|
@@ -18,12 +21,11 @@ const AddonConfigurationRegistry = require(`${voltoPath}/addon-registry.js`);
|
|
|
18
21
|
const reg = new AddonConfigurationRegistry(projectRootPath);
|
|
19
22
|
|
|
20
23
|
// Extends ESlint configuration for adding the aliases to `src` directories in Volto addons
|
|
21
|
-
const addonAliases = Object.keys(reg.packages).map(o => [
|
|
24
|
+
const addonAliases = Object.keys(reg.packages).map((o) => [
|
|
22
25
|
o,
|
|
23
26
|
reg.packages[o].modulePath,
|
|
24
27
|
]);
|
|
25
28
|
|
|
26
|
-
|
|
27
29
|
module.exports = {
|
|
28
30
|
extends: `${projectRootPath}/node_modules/@plone/volto/.eslintrc`,
|
|
29
31
|
settings: {
|
|
@@ -43,4 +45,3 @@ module.exports = {
|
|
|
43
45
|
},
|
|
44
46
|
},
|
|
45
47
|
};
|
|
46
|
-
|
package/CHANGELOG.md
CHANGED
|
@@ -4,6 +4,20 @@ 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.32](https://github.com/eea/volto-eea-map/compare/0.1.31...0.1.32) - 20 February 2023
|
|
8
|
+
|
|
9
|
+
#### :hammer_and_wrench: Others
|
|
10
|
+
|
|
11
|
+
- remove console.log [tedw87 - [`3aeb3e8`](https://github.com/eea/volto-eea-map/commit/3aeb3e8ec5474387f3cd22eb9b387c6681e17120)]
|
|
12
|
+
- refactor code [tedw87 - [`6d7830e`](https://github.com/eea/volto-eea-map/commit/6d7830eb934f56c255eea5642bdefba30d892946)]
|
|
13
|
+
- add Blossom basemap layer [tedw87 - [`5226ee2`](https://github.com/eea/volto-eea-map/commit/5226ee218df3401cf467afbc7a4d720dc30719e1)]
|
|
14
|
+
- Add Sonarqube tag using cca-frontend addons list [EEA Jenkins - [`1dad5c6`](https://github.com/eea/volto-eea-map/commit/1dad5c6617096ff85223165a6dd2b1d5d7deea6a)]
|
|
15
|
+
### [0.1.31](https://github.com/eea/volto-eea-map/compare/0.1.30...0.1.31) - 11 November 2022
|
|
16
|
+
|
|
17
|
+
#### :hammer_and_wrench: Others
|
|
18
|
+
|
|
19
|
+
- fix project rootpath [andreiggr - [`ad4801d`](https://github.com/eea/volto-eea-map/commit/ad4801d8b17a68bf227f2a75f2d3fdd9a3491c13)]
|
|
20
|
+
- blocks styles for embed map block [andreiggr - [`a6263d5`](https://github.com/eea/volto-eea-map/commit/a6263d54374719914e6f52ee8e3ae7e3cc9450f5)]
|
|
7
21
|
### [0.1.30](https://github.com/eea/volto-eea-map/compare/0.1.29...0.1.30) - 4 November 2022
|
|
8
22
|
|
|
9
23
|
#### :hammer_and_wrench: Others
|
|
@@ -12,7 +26,6 @@ Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).
|
|
|
12
26
|
- cy10/razzle4 updates [Andrei Grigore - [`419fe6b`](https://github.com/eea/volto-eea-map/commit/419fe6b8a7cfbc7561ba2585a2cc4f5a7583fac5)]
|
|
13
27
|
- config new slate route [andreiggr - [`5343926`](https://github.com/eea/volto-eea-map/commit/5343926755aa0ace5ee4741e00df3aa4679e8bd7)]
|
|
14
28
|
- use alpha in cy [andreiggr - [`775a92c`](https://github.com/eea/volto-eea-map/commit/775a92c959013a08c9a5c9c121df798a289088a9)]
|
|
15
|
-
- update embed version and slate from volto [andreiggr - [`72bcc90`](https://github.com/eea/volto-eea-map/commit/72bcc90b993b1a40f81e272a6b15b41c9cf59f1b)]
|
|
16
29
|
### [0.1.29](https://github.com/eea/volto-eea-map/compare/0.1.28...0.1.29) - 19 October 2022
|
|
17
30
|
|
|
18
31
|
### [0.1.28](https://github.com/eea/volto-eea-map/compare/0.1.27...0.1.28) - 7 October 2022
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@eeacms/volto-eea-map",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.32",
|
|
4
4
|
"description": "@eeacms/volto-eea-map: Volto add-on",
|
|
5
5
|
"main": "src/index.js",
|
|
6
6
|
"author": "European Environment Agency: IDM2 A-Team",
|
|
@@ -17,9 +17,11 @@
|
|
|
17
17
|
"url": "git@github.com:eea/volto-eea-map.git"
|
|
18
18
|
},
|
|
19
19
|
"addons": [
|
|
20
|
-
"@eeacms/volto-embed"
|
|
20
|
+
"@eeacms/volto-embed",
|
|
21
|
+
"@eeacms/volto-block-style"
|
|
21
22
|
],
|
|
22
23
|
"dependencies": {
|
|
24
|
+
"@eeacms/volto-block-style": "4.1.0",
|
|
23
25
|
"@eeacms/volto-embed": "5.0.0",
|
|
24
26
|
"@plone/scripts": "*",
|
|
25
27
|
"esri-loader": "3.6.0",
|
|
@@ -4,6 +4,8 @@ import { SidebarPortal } from '@plone/volto/components';
|
|
|
4
4
|
import { connect } from 'react-redux';
|
|
5
5
|
import { compose } from 'redux';
|
|
6
6
|
|
|
7
|
+
import { BlockStyleWrapperEdit } from '@eeacms/volto-block-style/BlockStyleWrapper';
|
|
8
|
+
import cx from 'classnames';
|
|
7
9
|
import { getContent } from '@plone/volto/actions';
|
|
8
10
|
|
|
9
11
|
import BlockDataForm from '@plone/volto/components/manage/Form/BlockDataForm';
|
|
@@ -58,7 +60,20 @@ const Edit = (props) => {
|
|
|
58
60
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
59
61
|
}, [props.block, props.data_query, data.data_query_params]);
|
|
60
62
|
return (
|
|
61
|
-
<
|
|
63
|
+
<BlockStyleWrapperEdit
|
|
64
|
+
{...props}
|
|
65
|
+
role="presentation"
|
|
66
|
+
data={{
|
|
67
|
+
...(props.data || {}),
|
|
68
|
+
styles: {
|
|
69
|
+
...(props.data?.styles || {}),
|
|
70
|
+
customClass: cx(
|
|
71
|
+
props.data?.styles?.customClass || '',
|
|
72
|
+
'custom-map-class',
|
|
73
|
+
),
|
|
74
|
+
},
|
|
75
|
+
}}
|
|
76
|
+
>
|
|
62
77
|
<View data={data} id={id} isEdit={true} />
|
|
63
78
|
<SidebarPortal selected={selected}>
|
|
64
79
|
<BlockDataForm
|
|
@@ -74,7 +89,7 @@ const Edit = (props) => {
|
|
|
74
89
|
formData={data}
|
|
75
90
|
/>
|
|
76
91
|
</SidebarPortal>
|
|
77
|
-
</
|
|
92
|
+
</BlockStyleWrapperEdit>
|
|
78
93
|
);
|
|
79
94
|
};
|
|
80
95
|
|
|
@@ -9,6 +9,9 @@ import { getContent } from '@plone/volto/actions';
|
|
|
9
9
|
import Webmap from '../../Webmap';
|
|
10
10
|
import ExtraViews from '../../ExtraViews';
|
|
11
11
|
|
|
12
|
+
import { StyleWrapperView } from '@eeacms/volto-block-style/StyleWrapper';
|
|
13
|
+
import cx from 'classnames';
|
|
14
|
+
|
|
12
15
|
const View = (props) => {
|
|
13
16
|
const { data, id, isEdit, map_visualization = '', data_provenance = {} } =
|
|
14
17
|
props || {};
|
|
@@ -74,7 +77,17 @@ const View = (props) => {
|
|
|
74
77
|
}, [map_visualization, props.data, props.data_query, isEdit, enable_queries]);
|
|
75
78
|
|
|
76
79
|
return (
|
|
77
|
-
<
|
|
80
|
+
<StyleWrapperView
|
|
81
|
+
{...props}
|
|
82
|
+
data={data}
|
|
83
|
+
styleData={{
|
|
84
|
+
...data.styles,
|
|
85
|
+
customClass: cx(
|
|
86
|
+
data.styles?.customClass || '',
|
|
87
|
+
'columns-tabs-container',
|
|
88
|
+
),
|
|
89
|
+
}}
|
|
90
|
+
>
|
|
78
91
|
<PrivacyProtection data={data} height={height} {...props}>
|
|
79
92
|
{mapData && (
|
|
80
93
|
<div>
|
|
@@ -92,7 +105,7 @@ const View = (props) => {
|
|
|
92
105
|
<p>No map view to show. Set visualization in block configuration.</p>
|
|
93
106
|
)}
|
|
94
107
|
</PrivacyProtection>
|
|
95
|
-
</
|
|
108
|
+
</StyleWrapperView>
|
|
96
109
|
);
|
|
97
110
|
};
|
|
98
111
|
|
|
@@ -190,24 +190,37 @@ const Webmap = (props) => {
|
|
|
190
190
|
)
|
|
191
191
|
: [];
|
|
192
192
|
|
|
193
|
-
const
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
193
|
+
const generateMapBaselayer = (compositeType) => {
|
|
194
|
+
return new WebTileLayer({
|
|
195
|
+
urlTemplate: `https://gisco-services.ec.europa.eu/maps/tiles/OSM${compositeType}Composite/EPSG3857/{level}/{col}/{row}.png`,
|
|
196
|
+
});
|
|
197
|
+
};
|
|
197
198
|
|
|
198
199
|
// Create a Basemap with the WebTileLayer.
|
|
200
|
+
|
|
199
201
|
const positronCompositeBasemap = new Basemap({
|
|
200
|
-
baseLayers: [
|
|
202
|
+
baseLayers: [generateMapBaselayer('Positron')],
|
|
201
203
|
title: 'Positron Composite',
|
|
202
204
|
id: 'positron-composite',
|
|
203
205
|
thumbnailUrl:
|
|
204
206
|
'https://gisco-services.ec.europa.eu/maps/tiles/OSMPositronComposite/EPSG3857/0/0/0.png',
|
|
205
207
|
});
|
|
206
208
|
|
|
209
|
+
const blossomCompositeBasemap = new Basemap({
|
|
210
|
+
baseLayers: [generateMapBaselayer('Blossom')],
|
|
211
|
+
title: 'Blossom Composite',
|
|
212
|
+
id: 'blossom-composite',
|
|
213
|
+
thumbnailUrl:
|
|
214
|
+
'https://gisco-services.ec.europa.eu/maps/tiles/OSMBlossomComposite/EPSG3857/0/0/0.png',
|
|
215
|
+
});
|
|
216
|
+
|
|
207
217
|
const setBasemap = (basemap) => {
|
|
208
218
|
if (basemap === 'positron-composite') {
|
|
209
219
|
return positronCompositeBasemap;
|
|
210
220
|
}
|
|
221
|
+
if (basemap === 'blossom-composite') {
|
|
222
|
+
return blossomCompositeBasemap;
|
|
223
|
+
}
|
|
211
224
|
if (!basemap) {
|
|
212
225
|
return 'hybrid';
|
|
213
226
|
}
|
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
import { base_layers } from '../../constants';
|
|
2
2
|
|
|
3
|
-
const customBaselayers = [
|
|
3
|
+
const customBaselayers = [
|
|
4
|
+
['positron-composite', 'positron-composite'],
|
|
5
|
+
['blossom-composite', 'blossom-composite'],
|
|
6
|
+
];
|
|
4
7
|
|
|
5
8
|
const BaseLayerSchema = ({ data = {} }) => {
|
|
6
9
|
const useCustomBase = data?.map_data?.base?.use_custom_base;
|
|
@@ -99,20 +99,19 @@ const LegendWidget = (props) => {
|
|
|
99
99
|
const [expand, setExpand] = React.useState(true);
|
|
100
100
|
|
|
101
101
|
const { layers = {} } = data;
|
|
102
|
-
const map_layers =
|
|
103
|
-
layers &&
|
|
104
|
-
layers.map_layers &&
|
|
105
|
-
layers.map_layers.length > 0 &&
|
|
106
|
-
layers.map_layers.length > 3
|
|
107
|
-
? layers?.map_layers.slice(0, 3)
|
|
108
|
-
: layers?.map_layers;
|
|
109
102
|
|
|
110
|
-
const visible_layers =
|
|
111
|
-
|
|
112
|
-
|
|
103
|
+
const visible_layers =
|
|
104
|
+
layers && layers.map_layers && layers.map_layers.length
|
|
105
|
+
? layers.map_layers.filter((l) => !l?.map_layer?.hide)
|
|
106
|
+
: '';
|
|
107
|
+
|
|
108
|
+
const map_layers =
|
|
109
|
+
visible_layers && visible_layers.length > 0 && visible_layers.length > 3
|
|
110
|
+
? visible_layers.slice(0, 3)
|
|
111
|
+
: visible_layers;
|
|
113
112
|
|
|
114
113
|
const legendColumns =
|
|
115
|
-
|
|
114
|
+
map_layers && setLegendColumns(map_layers.length, device);
|
|
116
115
|
return (
|
|
117
116
|
<>
|
|
118
117
|
<div className="legend-container">
|
|
@@ -127,16 +126,16 @@ const LegendWidget = (props) => {
|
|
|
127
126
|
</h3>
|
|
128
127
|
</button>
|
|
129
128
|
<Grid columns={legendColumns}>
|
|
130
|
-
{(!
|
|
129
|
+
{(!map_layers || map_layers.length === 0) && (
|
|
131
130
|
<p>
|
|
132
131
|
No layer found for legend. Please add a map layer from editor.
|
|
133
132
|
</p>
|
|
134
133
|
)}
|
|
135
134
|
{expand && (
|
|
136
135
|
<Grid.Row divided>
|
|
137
|
-
{
|
|
138
|
-
|
|
139
|
-
|
|
136
|
+
{map_layers &&
|
|
137
|
+
map_layers.length > 0 &&
|
|
138
|
+
map_layers.map((l, i) => (
|
|
140
139
|
<LayerLegend
|
|
141
140
|
key={i}
|
|
142
141
|
data={l.map_layer}
|