@eeacms/volto-eea-map 0.1.5 → 0.1.6

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,16 @@ 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.6](https://github.com/eea/volto-eea-map/compare/0.1.5...0.1.6)
8
+
9
+ - Lint fix [`f5561d1`](https://github.com/eea/volto-eea-map/commit/f5561d1581201bd635b4e53e8a46decaf684438f)
10
+ - Map improvements [`c75d16c`](https://github.com/eea/volto-eea-map/commit/c75d16c265136d9f676e194540e613bb742fb51b)
11
+
7
12
  #### [0.1.5](https://github.com/eea/volto-eea-map/compare/0.1.4...0.1.5)
8
13
 
14
+ > 4 August 2022
15
+
16
+ - Develop [`#5`](https://github.com/eea/volto-eea-map/pull/5)
9
17
  - Center on extent only on map load [`b63f586`](https://github.com/eea/volto-eea-map/commit/b63f586e0df68faa755bb0d25e297530e36ef7c9)
10
18
  - Configure proxy for all map subdomains [`0f19030`](https://github.com/eea/volto-eea-map/commit/0f19030569e1f77b1ff7657669e876519712840f)
11
19
  - Prevent unnecessary rerenders of ma [`8752384`](https://github.com/eea/volto-eea-map/commit/8752384b3bbd7b564a25b3e4347c47692106f556)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@eeacms/volto-eea-map",
3
- "version": "0.1.5",
3
+ "version": "0.1.6",
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",
@@ -2,26 +2,18 @@ import React from 'react';
2
2
  import { SidebarPortal } from '@plone/volto/components';
3
3
  import BlockDataForm from '@plone/volto/components/manage/Form/BlockDataForm';
4
4
  import { Schema } from './Schema';
5
- import Webmap from './components/Webmap';
5
+ import View from './View';
6
+ import { addPrivacyProtectionToSchema } from '@eeacms/volto-embed';
6
7
  import './styles/map.css';
7
- import ExtraViews from './components/widgets/ExtraViews';
8
- import {
9
- PrivacyProtection,
10
- addPrivacyProtectionToSchema,
11
- } from '@eeacms/volto-embed';
12
8
 
13
9
  const Edit = (props) => {
14
10
  const { block, data, onChangeBlock, selected } = props;
15
11
  const schema = React.useMemo(() => Schema(props), [props]);
16
12
 
17
- const { map_data = {}, height } = data;
18
13
  if (__SERVER__) return '';
19
14
  return (
20
15
  <div>
21
- <PrivacyProtection data={data} {...props}>
22
- <Webmap data={map_data} height={height} />
23
- <ExtraViews data={data} />
24
- </PrivacyProtection>
16
+ <View data={data} />
25
17
  <SidebarPortal selected={selected}>
26
18
  <BlockDataForm
27
19
  block={block}
@@ -19,7 +19,7 @@ const Webmap = (props) => {
19
19
 
20
20
  const data = React.useMemo(() => props.data || {}, [props.data]);
21
21
 
22
- const { base = {}, layers = {}, id, legend = {}, general = {} } = data;
22
+ const { base = {}, layers = {}, legend = {}, general = {} } = data;
23
23
 
24
24
  const { base_layer = '' } = base;
25
25
 
@@ -68,6 +68,7 @@ const Webmap = (props) => {
68
68
  }
69
69
  }, [setModules, options]);
70
70
 
71
+ // eslint-disable-next-line no-unused-vars
71
72
  const esri = React.useMemo(() => {
72
73
  if (Object.keys(modules).length === 0) return {};
73
74
  const {
@@ -156,7 +157,7 @@ const Webmap = (props) => {
156
157
  const legendWidget = new Expand({
157
158
  content: new Legend({
158
159
  view: view,
159
- style: 'classic', // other styles include 'classic'
160
+ style: 'classic',
160
161
  }),
161
162
  view: view,
162
163
  expanded: false,
@@ -190,9 +191,8 @@ const Webmap = (props) => {
190
191
  });
191
192
  }
192
193
  return { view, map };
193
- }, [modules, base_layer, map_layers]);
194
+ }, [modules, base_layer, map_layers, general, legend]);
194
195
 
195
- const currentLayerView = esri.view?.layerViews?.items?.[0];
196
196
  return (
197
197
  <div>
198
198
  <div
@@ -18,7 +18,7 @@ const ExtraViews = ({ data }) => {
18
18
  } = data;
19
19
 
20
20
  return (
21
- <>
21
+ <div className="extra-eea-map-content">
22
22
  {map_data.layers?.map_layers[0] && (show_download || show_viewer) && (
23
23
  <div
24
24
  style={{ display: 'flex', justifyContent: 'end', margin: '10px 0' }}
@@ -56,7 +56,7 @@ const ExtraViews = ({ data }) => {
56
56
  )}
57
57
  {show_legend && <LegendWidget data={map_data} />}
58
58
  {description && serializeNodes(description)}
59
- </>
59
+ </div>
60
60
  );
61
61
  };
62
62
 
@@ -50,12 +50,13 @@ const LayerLegend = ({ data, name }) => {
50
50
  };
51
51
 
52
52
  const LegendWidget = (props) => {
53
- const { data = {} } = props;
53
+ const data = React.useMemo(() => props.data, [props.data]);
54
54
  const { layers = {} } = data;
55
55
  const { map_layers = [] } = layers;
56
56
  const [legendLayers, setLegendLayers] = React.useState([]);
57
57
 
58
58
  const activeLayer = map_layers.length > 0 ? map_layers[0]?.map_layer : '';
59
+
59
60
  const fetchLegend = async (url) => {
60
61
  let legendData = await fetchArcgisData(url);
61
62
 
@@ -7,7 +7,10 @@ import PanelsSchema from './panelsSchema';
7
7
 
8
8
  const MapEditorWidget = (props) => {
9
9
  const [open, setOpen] = React.useState(false);
10
- const { onChange = {}, block = {}, value = {}, id } = props;
10
+ const { onChange = {}, id } = props;
11
+ const block = React.useMemo(() => props.block, [props.block]);
12
+ const value = React.useMemo(() => props.value, [props.value]);
13
+
11
14
  const [intValue, setIntValue] = React.useState(value);
12
15
 
13
16
  const dataForm = { map_data: intValue };