@eeacms/volto-eea-map 0.1.18 → 0.1.19
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,11 @@ 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.19](https://github.com/eea/volto-eea-map/compare/0.1.18...0.1.19) - 31 August 2022
|
|
8
|
+
|
|
9
|
+
#### :hammer_and_wrench: Others
|
|
10
|
+
|
|
11
|
+
- Api link updates [andreiggr - [`50c28c9`](https://github.com/eea/volto-eea-map/commit/50c28c93341fcd36bdf3328e194672526ad23408)]
|
|
7
12
|
### [0.1.18](https://github.com/eea/volto-eea-map/compare/0.1.17...0.1.18) - 30 August 2022
|
|
8
13
|
|
|
9
14
|
#### :hammer_and_wrench: Others
|
package/package.json
CHANGED
|
@@ -1,12 +1,9 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import { Button } from 'semantic-ui-react';
|
|
3
2
|
import { UniversalLink } 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 codeSVG from '../static/code-line.svg';
|
|
9
|
-
|
|
10
7
|
const ExtraViews = ({ data }) => {
|
|
11
8
|
const {
|
|
12
9
|
map_data = {},
|
|
@@ -18,34 +15,9 @@ const ExtraViews = ({ data }) => {
|
|
|
18
15
|
} = data;
|
|
19
16
|
return (
|
|
20
17
|
<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>
|
|
18
|
+
{show_legend && map_data && (
|
|
19
|
+
<LegendWidget data={map_data} show_viewer={show_viewer} />
|
|
47
20
|
)}
|
|
48
|
-
{show_legend && map_data && <LegendWidget data={map_data} />}
|
|
49
21
|
{show_sources && (
|
|
50
22
|
<>
|
|
51
23
|
{data_provenance &&
|
|
@@ -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,40 @@ 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
|
-
<
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
36
|
+
<div style={{ display: 'flex', alignItems: 'center' }}>
|
|
37
|
+
<h5
|
|
38
|
+
style={{
|
|
39
|
+
marginTop: '15px',
|
|
40
|
+
marginBottom: '5px',
|
|
41
|
+
}}
|
|
42
|
+
>
|
|
43
|
+
{name}
|
|
44
|
+
</h5>
|
|
45
|
+
{show_viewer && map_service_url && (
|
|
46
|
+
<a
|
|
47
|
+
target="_blank"
|
|
48
|
+
rel="noreferrer"
|
|
49
|
+
title="Open ArcGIS Service location"
|
|
50
|
+
href={
|
|
51
|
+
`https://www.arcgis.com/home/webmap/viewer.html?url=` +
|
|
52
|
+
`${map_service_url}&source=sd`
|
|
53
|
+
}
|
|
54
|
+
>
|
|
55
|
+
<Button size="tiny" className="extra-view-external-button">
|
|
56
|
+
<Button.Content>
|
|
57
|
+
<img
|
|
58
|
+
className="extra-view-external-icon"
|
|
59
|
+
src={codeSVG}
|
|
60
|
+
alt=""
|
|
61
|
+
/>
|
|
62
|
+
</Button.Content>
|
|
63
|
+
</Button>
|
|
64
|
+
</a>
|
|
65
|
+
)}
|
|
66
|
+
</div>
|
|
40
67
|
{data.description && serializeNodes(data.description)}
|
|
41
68
|
<div style={{ display: 'flex', flexDirection: 'column' }}>
|
|
42
69
|
{legendRows.length > 0 &&
|
|
@@ -60,7 +87,7 @@ const LayerLegend = ({ data }) => {
|
|
|
60
87
|
|
|
61
88
|
const LegendWidget = (props) => {
|
|
62
89
|
const data = React.useMemo(() => props.data, [props.data]);
|
|
63
|
-
const { device = '' } = props;
|
|
90
|
+
const { device = '', show_viewer = false } = props;
|
|
64
91
|
|
|
65
92
|
const [expand, setExpand] = React.useState(true);
|
|
66
93
|
|
|
@@ -79,14 +106,14 @@ const LegendWidget = (props) => {
|
|
|
79
106
|
<>
|
|
80
107
|
<div className="legend-container">
|
|
81
108
|
<button className="legend-action" onClick={() => setExpand(!expand)}>
|
|
82
|
-
<
|
|
109
|
+
<h3 role="presentation" className="legend-title">
|
|
83
110
|
<Icon
|
|
84
111
|
name={expand ? downKeySVG : rightKeySVG}
|
|
85
112
|
title={expand ? 'Collapse' : 'Expand'}
|
|
86
113
|
size="17px"
|
|
87
114
|
/>
|
|
88
115
|
Legend:
|
|
89
|
-
</
|
|
116
|
+
</h3>
|
|
90
117
|
</button>
|
|
91
118
|
<Grid columns={legendColumns}>
|
|
92
119
|
{(!map_layers || map_layers.length === 0) && (
|
|
@@ -99,7 +126,11 @@ const LegendWidget = (props) => {
|
|
|
99
126
|
{map_layers &&
|
|
100
127
|
map_layers.length > 0 &&
|
|
101
128
|
map_layers.map((l, i) => (
|
|
102
|
-
<LayerLegend
|
|
129
|
+
<LayerLegend
|
|
130
|
+
key={i}
|
|
131
|
+
data={l.map_layer}
|
|
132
|
+
show_viewer={show_viewer}
|
|
133
|
+
/>
|
|
103
134
|
))}
|
|
104
135
|
</Grid.Row>
|
|
105
136
|
)}
|
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;
|