@eeacms/volto-eea-map 0.1.14 → 0.1.15

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,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.15](https://github.com/eea/volto-eea-map/compare/0.1.14...0.1.15)
8
+
9
+ - more space for button [`8fa6a3b`](https://github.com/eea/volto-eea-map/commit/8fa6a3b230cd835d0fbcc4881b14d51d318b91be)
10
+ - eslint happy [`30b41d2`](https://github.com/eea/volto-eea-map/commit/30b41d2d18fcf2d195cdd08a2b6b9c78e6a303bb)
11
+ - better update [`a1ca2f5`](https://github.com/eea/volto-eea-map/commit/a1ca2f51d1f24d932ad03fe61b5a4a564b491873)
12
+ - update deps [`c9d2f92`](https://github.com/eea/volto-eea-map/commit/c9d2f920c076e77f030cd841ca5a1e49cc1bc319)
13
+ - use only query params from qidget [`303793f`](https://github.com/eea/volto-eea-map/commit/303793f6f3af8c0cf8857e08a61cbf9e16c7d810)
14
+ - get map data from getContent [`40ae731`](https://github.com/eea/volto-eea-map/commit/40ae73135cd93e49ce0956d4ca0ef5e3425e3d19)
15
+ - use button on action [`86a090b`](https://github.com/eea/volto-eea-map/commit/86a090b17ccf3f951146cb8adcaf539fd8cf9faf)
16
+
7
17
  #### [0.1.14](https://github.com/eea/volto-eea-map/compare/0.1.13...0.1.14)
8
18
 
19
+ > 26 August 2022
20
+
21
+ - Develop [`#14`](https://github.com/eea/volto-eea-map/pull/14)
9
22
  - new sources styles, icons from remixicon [`c9cca2a`](https://github.com/eea/volto-eea-map/commit/c9cca2a5e41322cfdeca1865b47a1892514c1cfc)
10
23
  - reorganize & clean [`a902b89`](https://github.com/eea/volto-eea-map/commit/a902b8945389b19b388e85e00066b2c46a9e1a2e)
11
24
  - Layer widget improvements [`99abe57`](https://github.com/eea/volto-eea-map/commit/99abe5722590719ac7e640de44a69ee19fcecfdf)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@eeacms/volto-eea-map",
3
- "version": "0.1.14",
3
+ "version": "0.1.15",
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",
@@ -21,9 +21,10 @@
21
21
  "volto-slate"
22
22
  ],
23
23
  "dependencies": {
24
- "@eeacms/volto-embed": "^2.0.1",
24
+ "@eeacms/volto-embed": "4.0.2",
25
25
  "@plone/scripts": "*",
26
26
  "esri-loader": "3.5.0",
27
+ "lodash": "4.17.21",
27
28
  "react-querybuilder": "4.2.3",
28
29
  "volto-slate": "*"
29
30
  },
@@ -12,6 +12,8 @@ import { Schema } from './Schema';
12
12
  import { addPrivacyProtectionToSchema } from '@eeacms/volto-embed';
13
13
  import '../../../styles/map.css';
14
14
 
15
+ import _ from 'lodash';
16
+
15
17
  const Edit = (props) => {
16
18
  const { block, data, onChangeBlock, selected, id } = props;
17
19
  const schema = React.useMemo(() => Schema(props), [props]);
@@ -21,15 +23,17 @@ const Edit = (props) => {
21
23
  // eslint-disable-next-line react-hooks/exhaustive-deps
22
24
  }, [data.vis_url]);
23
25
  React.useEffect(() => {
24
- const diffParams = props.data_query !== data.data_query_params;
25
- if (diffParams || !data.data_query_params) {
26
+ if (
27
+ !data.data_query_params ||
28
+ !_.isEqual(props.data_query, data.data_query_params)
29
+ ) {
26
30
  onChangeBlock(block, {
27
31
  ...data,
28
32
  data_query_params: props.data_query,
29
33
  });
30
34
  }
31
35
  // eslint-disable-next-line react-hooks/exhaustive-deps
32
- }, [props.data_query, block, data]);
36
+ }, [props.data_query, block, data.data_query_params]);
33
37
 
34
38
  return (
35
39
  <div>
@@ -55,9 +59,8 @@ const Edit = (props) => {
55
59
  export default compose(
56
60
  connect(
57
61
  (state, props) => ({
62
+ block_data: state.content.data,
58
63
  data_query: state.content.data.data_query,
59
- data_provenance:
60
- state.content.subrequests?.[props.id]?.data?.data_provenance,
61
64
  }),
62
65
  {
63
66
  getContent,
@@ -6,30 +6,25 @@ import { compose } from 'redux';
6
6
  import { PrivacyProtection } from '@eeacms/volto-embed';
7
7
 
8
8
  import { getContent } from '@plone/volto/actions';
9
- import { getVisualization } from '../../../actions';
10
9
  import Webmap from '../../Webmap';
11
10
  import ExtraViews from '../../ExtraViews';
12
11
 
13
12
  const View = (props) => {
14
- const { data, viz_content = {}, id, isEdit, map_visualization } = props || {};
13
+ const { data, id, isEdit, map_visualization = {}, data_provenance = {} } =
14
+ props || {};
15
15
  const { height = '', vis_url = '', enable_queries } = data;
16
16
 
17
- const { data_provenance = {} } = viz_content || {};
18
-
19
17
  const [mapData, setMapData] = React.useState(map_visualization);
20
18
 
21
19
  React.useEffect(() => {
22
20
  if (vis_url) {
23
21
  props.getContent(vis_url, null, id);
24
- props.getVisualization(vis_url);
25
22
  }
26
23
  // eslint-disable-next-line react-hooks/exhaustive-deps
27
24
  }, [vis_url, enable_queries]);
28
25
 
29
26
  React.useEffect(() => {
30
- const query_params = isEdit
31
- ? props.data.data_query_params
32
- : props.data_query;
27
+ const query_params = props?.data?.data_query_params;
33
28
  var altMapData = { ...map_visualization };
34
29
 
35
30
  if (
@@ -72,14 +67,8 @@ const View = (props) => {
72
67
  });
73
68
  }
74
69
  setMapData(altMapData);
75
- }, [
76
- map_visualization,
77
- props.data,
78
- props.data_query,
79
- viz_content,
80
- isEdit,
81
- enable_queries,
82
- ]);
70
+ // eslint-disable-next-line react-hooks/exhaustive-deps
71
+ }, [map_visualization, props.data, props.data_query, isEdit, enable_queries]);
83
72
 
84
73
  return (
85
74
  <div>
@@ -108,14 +97,13 @@ export default compose(
108
97
  connect(
109
98
  (state, props) => ({
110
99
  data_query: state.content.data.data_query,
111
- state,
100
+ data_provenance:
101
+ state.content.subrequests?.[props.id]?.data?.data_provenance,
112
102
  map_visualization:
113
- state.map_visualizations?.data[props.data.vis_url]?.data,
114
- viz_content: state.content.subrequests?.[props.id]?.data,
103
+ state.content.subrequests?.[props.id]?.data?.map_visualization_data,
115
104
  }),
116
105
  {
117
106
  getContent,
118
- getVisualization,
119
107
  },
120
108
  ),
121
109
  )(View);
@@ -32,7 +32,7 @@ const VisualizationEditorWidget = (props) => {
32
32
  let schema = PanelsSchema({ data: dataForm });
33
33
 
34
34
  React.useEffect(() => {
35
- if (!intValue.general) {
35
+ if (!intValue?.general) {
36
36
  setIntValue({
37
37
  ...intValue,
38
38
  general: {
@@ -42,7 +42,7 @@ const VisualizationEditorWidget = (props) => {
42
42
  },
43
43
  });
44
44
  }
45
- if (!intValue.base) {
45
+ if (!intValue?.base) {
46
46
  setIntValue({
47
47
  ...intValue,
48
48
  base: {
@@ -50,6 +50,7 @@ const VisualizationEditorWidget = (props) => {
50
50
  },
51
51
  });
52
52
  }
53
+ // eslint-disable-next-line react-hooks/exhaustive-deps
53
54
  }, [intValue]);
54
55
 
55
56
  return (
@@ -78,18 +78,16 @@ const LegendWidget = (props) => {
78
78
  return (
79
79
  <>
80
80
  <div className="legend-container">
81
- <h4
82
- role="presentation"
83
- className="legend-title"
84
- onClick={() => setExpand(!expand)}
85
- >
86
- <Icon
87
- name={expand ? downKeySVG : rightKeySVG}
88
- title={expand ? 'Collapse' : 'Expand'}
89
- size="17px"
90
- />
91
- Legend:
92
- </h4>
81
+ <button className="legend-action" onClick={() => setExpand(!expand)}>
82
+ <h4 role="presentation" className="legend-title">
83
+ <Icon
84
+ name={expand ? downKeySVG : rightKeySVG}
85
+ title={expand ? 'Collapse' : 'Expand'}
86
+ size="17px"
87
+ />
88
+ Legend:
89
+ </h4>
90
+ </button>
93
91
  <Grid columns={legendColumns}>
94
92
  {(!map_layers || map_layers.length === 0) && (
95
93
  <p>
@@ -127,7 +127,6 @@
127
127
  width: fit-content;
128
128
  align-items: center;
129
129
  margin: 0 !important;
130
- cursor: pointer;
131
130
  }
132
131
 
133
132
  .data-param-title {
@@ -174,6 +173,13 @@
174
173
  color: inherit;
175
174
  }
176
175
 
176
+ .legend-action {
177
+ padding: 10px;
178
+ border: none;
179
+ background: transparent;
180
+ cursor: pointer;
181
+ }
182
+
177
183
  @keyframes fadeDown {
178
184
  from {
179
185
  opacity: 0;