@eeacms/volto-eea-map 0.1.18 → 0.1.21
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 +15 -0
- package/package.json +1 -1
- package/src/components/ExtraViews.jsx +42 -51
- package/src/components/widgets/LegendWidget.jsx +49 -12
- package/src/styles/map.css +7 -2
package/CHANGELOG.md
CHANGED
|
@@ -4,6 +4,21 @@ 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.21](https://github.com/eea/volto-eea-map/compare/0.1.20...0.1.21) - 13 September 2022
|
|
8
|
+
|
|
9
|
+
#### :hammer_and_wrench: Others
|
|
10
|
+
|
|
11
|
+
- sources expandable also [andreiggr - [`cd89898`](https://github.com/eea/volto-eea-map/commit/cd89898f026a67b43779575219503eb3ce2ae6fc)]
|
|
12
|
+
### [0.1.20](https://github.com/eea/volto-eea-map/compare/0.1.19...0.1.20) - 31 August 2022
|
|
13
|
+
|
|
14
|
+
#### :hammer_and_wrench: Others
|
|
15
|
+
|
|
16
|
+
- Api link end of row [andreiggr - [`7eb826f`](https://github.com/eea/volto-eea-map/commit/7eb826fcc902b94fe6961b6568597d38e2217b21)]
|
|
17
|
+
### [0.1.19](https://github.com/eea/volto-eea-map/compare/0.1.18...0.1.19) - 31 August 2022
|
|
18
|
+
|
|
19
|
+
#### :hammer_and_wrench: Others
|
|
20
|
+
|
|
21
|
+
- Api link updates [andreiggr - [`50c28c9`](https://github.com/eea/volto-eea-map/commit/50c28c93341fcd36bdf3328e194672526ad23408)]
|
|
7
22
|
### [0.1.18](https://github.com/eea/volto-eea-map/compare/0.1.17...0.1.18) - 30 August 2022
|
|
8
23
|
|
|
9
24
|
#### :hammer_and_wrench: Others
|
package/package.json
CHANGED
|
@@ -1,11 +1,47 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import {
|
|
3
|
-
import { UniversalLink } from '@plone/volto/components';
|
|
2
|
+
import { UniversalLink, Icon } from '@plone/volto/components';
|
|
4
3
|
|
|
5
4
|
import LegendWidget from './widgets/LegendWidget';
|
|
6
5
|
import { serializeNodes } from 'volto-slate/editor/render';
|
|
7
6
|
|
|
8
|
-
import
|
|
7
|
+
import rightKeySVG from '@plone/volto/icons/right-key.svg';
|
|
8
|
+
import downKeySVG from '@plone/volto/icons/down-key.svg';
|
|
9
|
+
|
|
10
|
+
const SourcesWidget = ({ data }) => {
|
|
11
|
+
const [expand, setExpand] = React.useState(true);
|
|
12
|
+
|
|
13
|
+
return (
|
|
14
|
+
<div>
|
|
15
|
+
<button className="legend-action" onClick={() => setExpand(!expand)}>
|
|
16
|
+
<h3>
|
|
17
|
+
<Icon
|
|
18
|
+
name={expand ? downKeySVG : rightKeySVG}
|
|
19
|
+
title={expand ? 'Collapse' : 'Expand'}
|
|
20
|
+
size="17px"
|
|
21
|
+
/>
|
|
22
|
+
Sources:
|
|
23
|
+
</h3>
|
|
24
|
+
</button>
|
|
25
|
+
{expand && (
|
|
26
|
+
<ul>
|
|
27
|
+
{data.map((param, i) => (
|
|
28
|
+
<li key={i}>
|
|
29
|
+
<div className="map_source_param_container">
|
|
30
|
+
<UniversalLink className="map_source_title" href={param.link}>
|
|
31
|
+
{param.title}
|
|
32
|
+
</UniversalLink>
|
|
33
|
+
,
|
|
34
|
+
<span className="map_source_description">
|
|
35
|
+
{param.organisation}
|
|
36
|
+
</span>
|
|
37
|
+
</div>
|
|
38
|
+
</li>
|
|
39
|
+
))}
|
|
40
|
+
</ul>
|
|
41
|
+
)}
|
|
42
|
+
</div>
|
|
43
|
+
);
|
|
44
|
+
};
|
|
9
45
|
|
|
10
46
|
const ExtraViews = ({ data }) => {
|
|
11
47
|
const {
|
|
@@ -18,60 +54,15 @@ const ExtraViews = ({ data }) => {
|
|
|
18
54
|
} = data;
|
|
19
55
|
return (
|
|
20
56
|
<div className="extra-eea-map-content">
|
|
21
|
-
{
|
|
22
|
-
<
|
|
23
|
-
style={{ display: 'flex', justifyContent: 'end', margin: '10px 0' }}
|
|
24
|
-
>
|
|
25
|
-
{show_viewer && (
|
|
26
|
-
<a
|
|
27
|
-
target="_blank"
|
|
28
|
-
rel="noreferrer"
|
|
29
|
-
href={
|
|
30
|
-
`https://www.arcgis.com/home/webmap/viewer.html?url=` +
|
|
31
|
-
`${map_data.layers.map_layers[0].map_layer.map_service_url}&source=sd`
|
|
32
|
-
}
|
|
33
|
-
>
|
|
34
|
-
<Button size="tiny">
|
|
35
|
-
<Button.Content>
|
|
36
|
-
<img
|
|
37
|
-
className="extra-view-external-button"
|
|
38
|
-
src={codeSVG}
|
|
39
|
-
alt=""
|
|
40
|
-
title="Show API link"
|
|
41
|
-
/>
|
|
42
|
-
</Button.Content>
|
|
43
|
-
</Button>
|
|
44
|
-
</a>
|
|
45
|
-
)}
|
|
46
|
-
</div>
|
|
57
|
+
{show_legend && map_data && (
|
|
58
|
+
<LegendWidget data={map_data} show_viewer={show_viewer} />
|
|
47
59
|
)}
|
|
48
|
-
{show_legend && map_data && <LegendWidget data={map_data} />}
|
|
49
60
|
{show_sources && (
|
|
50
61
|
<>
|
|
51
62
|
{data_provenance &&
|
|
52
63
|
data_provenance.data &&
|
|
53
64
|
data_provenance.data.length > 0 ? (
|
|
54
|
-
<
|
|
55
|
-
<h3>Sources:</h3>
|
|
56
|
-
<ul>
|
|
57
|
-
{data_provenance.data.map((param, i) => (
|
|
58
|
-
<li key={i}>
|
|
59
|
-
<div className="map_source_param_container">
|
|
60
|
-
<UniversalLink
|
|
61
|
-
className="map_source_title"
|
|
62
|
-
href={param.link}
|
|
63
|
-
>
|
|
64
|
-
{param.title}
|
|
65
|
-
</UniversalLink>
|
|
66
|
-
,
|
|
67
|
-
<span className="map_source_description">
|
|
68
|
-
{param.organisation}
|
|
69
|
-
</span>
|
|
70
|
-
</div>
|
|
71
|
-
</li>
|
|
72
|
-
))}
|
|
73
|
-
</ul>
|
|
74
|
-
</div>
|
|
65
|
+
<SourcesWidget data={data_provenance.data} />
|
|
75
66
|
) : (
|
|
76
67
|
<p>Data provenance is not set for visualization used or page</p>
|
|
77
68
|
)}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import { Grid } from 'semantic-ui-react';
|
|
2
|
+
import { Button, Grid } from 'semantic-ui-react';
|
|
3
3
|
import { fetchArcGISData, setLegendColumns } from '../../utils';
|
|
4
4
|
import { Icon } from '@plone/volto/components';
|
|
5
5
|
import { serializeNodes } from 'volto-slate/editor/render';
|
|
@@ -8,10 +8,13 @@ import rightKeySVG from '@plone/volto/icons/right-key.svg';
|
|
|
8
8
|
import downKeySVG from '@plone/volto/icons/down-key.svg';
|
|
9
9
|
import { withDeviceSize } from '../../hocs';
|
|
10
10
|
|
|
11
|
-
|
|
11
|
+
import codeSVG from '../../static/code-line.svg';
|
|
12
|
+
|
|
13
|
+
const LayerLegend = ({ data, show_viewer }) => {
|
|
12
14
|
const [legendRows, setLegendRows] = React.useState([]);
|
|
13
15
|
|
|
14
|
-
const {
|
|
16
|
+
const { map_service_url = '', layer = {} } = data;
|
|
17
|
+
const { id, name } = layer || {};
|
|
15
18
|
|
|
16
19
|
const fetchLegend = async (url, activeLayerID) => {
|
|
17
20
|
let legendData = await fetchArcGISData(url);
|
|
@@ -27,16 +30,46 @@ const LayerLegend = ({ data }) => {
|
|
|
27
30
|
}
|
|
28
31
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
29
32
|
}, [id, data.map_service_url]);
|
|
33
|
+
|
|
30
34
|
return (
|
|
31
35
|
<Grid.Column>
|
|
32
|
-
<
|
|
36
|
+
<div
|
|
33
37
|
style={{
|
|
34
|
-
|
|
35
|
-
|
|
38
|
+
display: 'flex',
|
|
39
|
+
alignItems: 'center',
|
|
40
|
+
justifyContent: 'space-between',
|
|
36
41
|
}}
|
|
37
42
|
>
|
|
38
|
-
|
|
39
|
-
|
|
43
|
+
<h5
|
|
44
|
+
style={{
|
|
45
|
+
marginTop: '15px',
|
|
46
|
+
marginBottom: '5px',
|
|
47
|
+
}}
|
|
48
|
+
>
|
|
49
|
+
{name}
|
|
50
|
+
</h5>
|
|
51
|
+
{show_viewer && map_service_url && (
|
|
52
|
+
<a
|
|
53
|
+
target="_blank"
|
|
54
|
+
rel="noreferrer"
|
|
55
|
+
title="Open ArcGIS Service location"
|
|
56
|
+
href={
|
|
57
|
+
`https://www.arcgis.com/home/webmap/viewer.html?url=` +
|
|
58
|
+
`${map_service_url}&source=sd`
|
|
59
|
+
}
|
|
60
|
+
>
|
|
61
|
+
<Button size="tiny" className="extra-view-external-button">
|
|
62
|
+
<Button.Content>
|
|
63
|
+
<img
|
|
64
|
+
className="extra-view-external-icon"
|
|
65
|
+
src={codeSVG}
|
|
66
|
+
alt=""
|
|
67
|
+
/>
|
|
68
|
+
</Button.Content>
|
|
69
|
+
</Button>
|
|
70
|
+
</a>
|
|
71
|
+
)}
|
|
72
|
+
</div>
|
|
40
73
|
{data.description && serializeNodes(data.description)}
|
|
41
74
|
<div style={{ display: 'flex', flexDirection: 'column' }}>
|
|
42
75
|
{legendRows.length > 0 &&
|
|
@@ -60,7 +93,7 @@ const LayerLegend = ({ data }) => {
|
|
|
60
93
|
|
|
61
94
|
const LegendWidget = (props) => {
|
|
62
95
|
const data = React.useMemo(() => props.data, [props.data]);
|
|
63
|
-
const { device = '' } = props;
|
|
96
|
+
const { device = '', show_viewer = false } = props;
|
|
64
97
|
|
|
65
98
|
const [expand, setExpand] = React.useState(true);
|
|
66
99
|
|
|
@@ -79,14 +112,14 @@ const LegendWidget = (props) => {
|
|
|
79
112
|
<>
|
|
80
113
|
<div className="legend-container">
|
|
81
114
|
<button className="legend-action" onClick={() => setExpand(!expand)}>
|
|
82
|
-
<
|
|
115
|
+
<h3 role="presentation" className="legend-title">
|
|
83
116
|
<Icon
|
|
84
117
|
name={expand ? downKeySVG : rightKeySVG}
|
|
85
118
|
title={expand ? 'Collapse' : 'Expand'}
|
|
86
119
|
size="17px"
|
|
87
120
|
/>
|
|
88
121
|
Legend:
|
|
89
|
-
</
|
|
122
|
+
</h3>
|
|
90
123
|
</button>
|
|
91
124
|
<Grid columns={legendColumns}>
|
|
92
125
|
{(!map_layers || map_layers.length === 0) && (
|
|
@@ -99,7 +132,11 @@ const LegendWidget = (props) => {
|
|
|
99
132
|
{map_layers &&
|
|
100
133
|
map_layers.length > 0 &&
|
|
101
134
|
map_layers.map((l, i) => (
|
|
102
|
-
<LayerLegend
|
|
135
|
+
<LayerLegend
|
|
136
|
+
key={i}
|
|
137
|
+
data={l.map_layer}
|
|
138
|
+
show_viewer={show_viewer}
|
|
139
|
+
/>
|
|
103
140
|
))}
|
|
104
141
|
</Grid.Row>
|
|
105
142
|
)}
|
package/src/styles/map.css
CHANGED
|
@@ -169,12 +169,17 @@
|
|
|
169
169
|
display: flex;
|
|
170
170
|
}
|
|
171
171
|
|
|
172
|
-
.extra-view-external-
|
|
172
|
+
.extra-view-external-icon {
|
|
173
173
|
color: inherit;
|
|
174
|
+
font-size: 10px;
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
.extra-view-external-button {
|
|
178
|
+
padding: 2px 15px !important;
|
|
174
179
|
}
|
|
175
180
|
|
|
176
181
|
.legend-action {
|
|
177
|
-
padding: 10px;
|
|
182
|
+
padding: 10px 0;
|
|
178
183
|
border: none;
|
|
179
184
|
background: transparent;
|
|
180
185
|
cursor: pointer;
|