@eeacms/volto-eea-map 0.1.14 → 0.1.17

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,35 @@ 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.17](https://github.com/eea/volto-eea-map/compare/0.1.16...0.1.17)
8
+
9
+ - small fix embed updates on query [`7771f7e`](https://github.com/eea/volto-eea-map/commit/7771f7e417f23e9d5bfce64986fdd7634a916b64)
10
+
11
+ #### [0.1.16](https://github.com/eea/volto-eea-map/compare/0.1.15...0.1.16)
12
+
13
+ > 29 August 2022
14
+
15
+ - Develop [`#16`](https://github.com/eea/volto-eea-map/pull/16)
16
+ - faster update q params for view/edit [`a2d64fb`](https://github.com/eea/volto-eea-map/commit/a2d64fb1112bc129d3183403649a0e5dde822745)
17
+
18
+ #### [0.1.15](https://github.com/eea/volto-eea-map/compare/0.1.14...0.1.15)
19
+
20
+ > 26 August 2022
21
+
22
+ - Quick fix [`#15`](https://github.com/eea/volto-eea-map/pull/15)
23
+ - more space for button [`8fa6a3b`](https://github.com/eea/volto-eea-map/commit/8fa6a3b230cd835d0fbcc4881b14d51d318b91be)
24
+ - eslint happy [`30b41d2`](https://github.com/eea/volto-eea-map/commit/30b41d2d18fcf2d195cdd08a2b6b9c78e6a303bb)
25
+ - better update [`a1ca2f5`](https://github.com/eea/volto-eea-map/commit/a1ca2f51d1f24d932ad03fe61b5a4a564b491873)
26
+ - update deps [`c9d2f92`](https://github.com/eea/volto-eea-map/commit/c9d2f920c076e77f030cd841ca5a1e49cc1bc319)
27
+ - use only query params from qidget [`303793f`](https://github.com/eea/volto-eea-map/commit/303793f6f3af8c0cf8857e08a61cbf9e16c7d810)
28
+ - get map data from getContent [`40ae731`](https://github.com/eea/volto-eea-map/commit/40ae73135cd93e49ce0956d4ca0ef5e3425e3d19)
29
+ - use button on action [`86a090b`](https://github.com/eea/volto-eea-map/commit/86a090b17ccf3f951146cb8adcaf539fd8cf9faf)
30
+
7
31
  #### [0.1.14](https://github.com/eea/volto-eea-map/compare/0.1.13...0.1.14)
8
32
 
33
+ > 26 August 2022
34
+
35
+ - Develop [`#14`](https://github.com/eea/volto-eea-map/pull/14)
9
36
  - new sources styles, icons from remixicon [`c9cca2a`](https://github.com/eea/volto-eea-map/commit/c9cca2a5e41322cfdeca1865b47a1892514c1cfc)
10
37
  - reorganize & clean [`a902b89`](https://github.com/eea/volto-eea-map/commit/a902b8945389b19b388e85e00066b2c46a9e1a2e)
11
38
  - 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.17",
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]);
@@ -20,9 +22,12 @@ const Edit = (props) => {
20
22
  props.getContent(data.vis_url, null, id);
21
23
  // eslint-disable-next-line react-hooks/exhaustive-deps
22
24
  }, [data.vis_url]);
25
+
23
26
  React.useEffect(() => {
24
- const diffParams = props.data_query !== data.data_query_params;
25
- if (diffParams || !data.data_query_params) {
27
+ if (
28
+ !data.data_query_params ||
29
+ !_.isEqual(props.data_query, data.data_query_params)
30
+ ) {
26
31
  onChangeBlock(block, {
27
32
  ...data,
28
33
  data_query_params: props.data_query,
@@ -55,9 +60,8 @@ const Edit = (props) => {
55
60
  export default compose(
56
61
  connect(
57
62
  (state, props) => ({
63
+ block_data: state.content.data,
58
64
  data_query: state.content.data.data_query,
59
- data_provenance:
60
- state.content.subrequests?.[props.id]?.data?.data_provenance,
61
65
  }),
62
66
  {
63
67
  getContent,
@@ -6,34 +6,31 @@ 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;
33
27
  var altMapData = { ...map_visualization };
34
-
28
+ const query_params = isEdit
29
+ ? props.data?.data_query_params
30
+ : props?.data_query;
35
31
  if (
36
32
  enable_queries &&
33
+ map_visualization &&
37
34
  query_params &&
38
35
  query_params.length > 0 &&
39
36
  altMapData.layers &&
@@ -41,6 +38,7 @@ const View = (props) => {
41
38
  altMapData.layers.map_layers.length > 0
42
39
  ) {
43
40
  let rules = [];
41
+
44
42
  altMapData.layers.map_layers.forEach((l, j) => {
45
43
  query_params.forEach((param, i) => {
46
44
  const matchingFields =
@@ -72,14 +70,8 @@ const View = (props) => {
72
70
  });
73
71
  }
74
72
  setMapData(altMapData);
75
- }, [
76
- map_visualization,
77
- props.data,
78
- props.data_query,
79
- viz_content,
80
- isEdit,
81
- enable_queries,
82
- ]);
73
+ // eslint-disable-next-line react-hooks/exhaustive-deps
74
+ }, [map_visualization, props.data, props.data_query, isEdit, enable_queries]);
83
75
 
84
76
  return (
85
77
  <div>
@@ -108,14 +100,13 @@ export default compose(
108
100
  connect(
109
101
  (state, props) => ({
110
102
  data_query: state.content.data.data_query,
111
- state,
103
+ data_provenance:
104
+ state.content.subrequests?.[props.id]?.data?.data_provenance,
112
105
  map_visualization:
113
- state.map_visualizations?.data[props.data.vis_url]?.data,
114
- viz_content: state.content.subrequests?.[props.id]?.data,
106
+ state.content.subrequests?.[props.id]?.data?.map_visualization_data,
115
107
  }),
116
108
  {
117
109
  getContent,
118
- getVisualization,
119
110
  },
120
111
  ),
121
112
  )(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;