@eeacms/volto-eea-map 0.1.3 → 0.1.4

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,8 +4,17 @@ 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.4](https://github.com/eea/volto-eea-map/compare/0.1.3...0.1.4)
8
+
9
+ - Configure Privacy protection screenshot data [`49097c0`](https://github.com/eea/volto-eea-map/commit/49097c0b7aa8657e626d5a49dd0eed84f5e71e78)
10
+ - Expandable Legend [`6edda2f`](https://github.com/eea/volto-eea-map/commit/6edda2fafd8a2a61f3f1f10c47a9ca5bb35a0355)
11
+ - Catch for no data [`7cef4e6`](https://github.com/eea/volto-eea-map/commit/7cef4e641650ede23e37ca9116130db1ef0a18db)
12
+
7
13
  #### [0.1.3](https://github.com/eea/volto-eea-map/compare/0.1.2...0.1.3)
8
14
 
15
+ > 2 August 2022
16
+
17
+ - Center map on first layer [`#3`](https://github.com/eea/volto-eea-map/pull/3)
9
18
  - Icons & download/viewer change [`321f538`](https://github.com/eea/volto-eea-map/commit/321f538e9582f9a12db3f64beb26588616e867e2)
10
19
  - Inline inputs actions & styles [`1f4787e`](https://github.com/eea/volto-eea-map/commit/1f4787e3b3f0dc1328ff23cca2459db816188e3a)
11
20
  - more updates for cy10 [`4d5c6a1`](https://github.com/eea/volto-eea-map/commit/4d5c6a1925413b44acc70b5ad3753378830dba2d)
@@ -18,7 +27,6 @@ Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).
18
27
  - Clear schema [`4b22f0a`](https://github.com/eea/volto-eea-map/commit/4b22f0aee58cca2bbcd2a8bee9864a01d65e7738)
19
28
  - Center on extent control [`9e8b13d`](https://github.com/eea/volto-eea-map/commit/9e8b13dfd5bbfa5eb2419c54444a15fefa384de4)
20
29
  - Clear consoles [`798bc2f`](https://github.com/eea/volto-eea-map/commit/798bc2fbf6f77ffadcedcf1e4666b315bc71ea6c)
21
- - Center map on first layer [`8fbc1ca`](https://github.com/eea/volto-eea-map/commit/8fbc1ca711ceba09e38e841cd7f551c1a8787027)
22
30
 
23
31
  #### [0.1.2](https://github.com/eea/volto-eea-map/compare/0.1.1...0.1.2)
24
32
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@eeacms/volto-eea-map",
3
- "version": "0.1.3",
3
+ "version": "0.1.4",
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",
@@ -16,9 +16,10 @@ const ExtraViews = ({ data }) => {
16
16
  show_download,
17
17
  show_viewer,
18
18
  } = data;
19
+
19
20
  return (
20
21
  <>
21
- {(show_download || show_viewer) && (
22
+ {map_data.layers?.map_layers[0] && (show_download || show_viewer) && (
22
23
  <div
23
24
  style={{ display: 'flex', justifyContent: 'end', margin: '10px 0' }}
24
25
  >
@@ -1,19 +1,50 @@
1
1
  import React from 'react';
2
2
  import { Grid } from 'semantic-ui-react';
3
3
  import { fetchArcgisData } from '../../utils';
4
+ import { Icon } from '@plone/volto/components';
5
+
6
+ import rightKeySVG from '@plone/volto/icons/right-key.svg';
7
+ import downKeySVG from '@plone/volto/icons/down-key.svg';
8
+
9
+ const LayerLegend = ({ data, name }) => {
10
+ const [expand, setExpand] = React.useState(true);
4
11
 
5
- const LayerLegend = ({ data }) => {
6
12
  return (
7
13
  <div style={{ display: 'flex', flexDirection: 'column' }}>
8
- {data.length > 0 &&
9
- data.map((item, i) => {
10
- return (
11
- <span key={i} style={{ display: 'flex', alignItems: 'center' }}>
12
- <img alt="alt" src={`data:image/png;base64,${item.imageData}`} />
13
- <span style={{ fontSize: '13px' }}>{item.label}</span>
14
- </span>
15
- );
16
- })}
14
+ <h5
15
+ role="presentation"
16
+ onClick={() => setExpand(!expand)}
17
+ style={{
18
+ marginTop: '10px',
19
+ marginBottom: '5px',
20
+ cursor: 'pointer',
21
+ display: 'flex',
22
+ }}
23
+ >
24
+ <Icon
25
+ name={expand ? downKeySVG : rightKeySVG}
26
+ title={expand ? 'Collapse' : 'Expand'}
27
+ size="17px"
28
+ />
29
+ {name}
30
+ </h5>
31
+ <div style={{ display: 'flex', flexDirection: 'column' }}>
32
+ {expand &&
33
+ data.length > 0 &&
34
+ data.map((item, i) => {
35
+ return (
36
+ <span key={i} style={{ display: 'flex', alignItems: 'center' }}>
37
+ <img
38
+ alt="alt"
39
+ src={`data:image/png;base64,${item.imageData}`}
40
+ />
41
+ <span style={{ fontSize: '13px', marginLeft: '5px' }}>
42
+ {item.label}
43
+ </span>
44
+ </span>
45
+ );
46
+ })}
47
+ </div>
17
48
  </div>
18
49
  );
19
50
  };
@@ -37,10 +68,11 @@ const LegendWidget = (props) => {
37
68
  };
38
69
 
39
70
  React.useEffect(() => {
40
- fetchLegend(`${activeLayer.map_service_url}/legend`);
71
+ if (activeLayer) {
72
+ fetchLegend(`${activeLayer.map_service_url}/legend`);
73
+ }
41
74
  // eslint-disable-next-line react-hooks/exhaustive-deps
42
75
  }, [data, activeLayer.map_service_url]);
43
-
44
76
  return (
45
77
  <>
46
78
  <div style={{ margin: '10px 0' }}>
@@ -48,18 +80,19 @@ const LegendWidget = (props) => {
48
80
  <Grid.Row>
49
81
  <Grid.Column>
50
82
  <h3>Legend:</h3>
83
+ {!activeLayer && (
84
+ <p>
85
+ No layer found for legend. Please add a map layer from editor.
86
+ </p>
87
+ )}
51
88
  {legendLayers.length > 0 &&
52
89
  legendLayers.map((layer, i) => {
53
90
  return (
54
- <div
91
+ <LayerLegend
55
92
  key={i}
56
- style={{ display: 'flex', flexDirection: 'column' }}
57
- >
58
- <h5 style={{ marginTop: '10px', marginBottom: '5px' }}>
59
- {layer?.layerName}
60
- </h5>
61
- <LayerLegend data={layer.legend} />
62
- </div>
93
+ name={layer?.layerName}
94
+ data={layer?.legend}
95
+ />
63
96
  );
64
97
  })}
65
98
  </Grid.Column>
@@ -11,9 +11,16 @@ const MapEditorWidget = (props) => {
11
11
  const [intValue, setIntValue] = React.useState(value);
12
12
 
13
13
  const dataForm = { map_data: intValue };
14
-
15
14
  const handleApplyChanges = () => {
16
15
  onChange(id, intValue);
16
+
17
+ //set map data for screenshot
18
+ if (intValue.layers?.map_layers[0].map_layer?.map_service_url) {
19
+ onChange(
20
+ 'url',
21
+ `${intValue.layers?.map_layers[0].map_layer?.map_service_url}?f=jsapi`,
22
+ );
23
+ }
17
24
  setOpen(false);
18
25
  };
19
26