@eeacms/volto-eea-map 0.1.34 → 1.0.0

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,11 +4,43 @@ 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.34](https://github.com/eea/volto-eea-map/compare/0.1.33...0.1.34) - 12 June 2023
7
+ ### [1.0.0](https://github.com/eea/volto-eea-map/compare/0.1.35...1.0.0) - 15 June 2023
8
+
9
+ #### :bug: Bug Fixes
10
+
11
+ - fix: fix style #254131 [Andrei Grigore - [`e0d1bf6`](https://github.com/eea/volto-eea-map/commit/e0d1bf6092d07ac0d2f98ff6febc9c01d97ce654)]
12
+ - fix: fix style #254131 [Andrei Grigore - [`2361110`](https://github.com/eea/volto-eea-map/commit/2361110243bc42d15ebcde736a811ad9260b92cb)]
13
+ - fix: fix style #254131 [Andrei Grigore - [`c846eb9`](https://github.com/eea/volto-eea-map/commit/c846eb9cbe1376f3c8c11b77a70dc123230bb6ec)]
14
+ - fix: fix style #254131 [Andrei Grigore - [`a6b962d`](https://github.com/eea/volto-eea-map/commit/a6b962d007d0d32c1ca8e7304ac75ce58e41c173)]
8
15
 
9
16
  #### :house: Internal changes
10
17
 
11
- - chore: enable alpha [Andrei Grigore - [`e016e46`](https://github.com/eea/volto-eea-map/commit/e016e4631a4332f07895f6077308235c41a6702c)]
18
+ - chore: increase version #254131 [Andrei Grigore - [`ec022cc`](https://github.com/eea/volto-eea-map/commit/ec022cc3b3d0c5e4b9158e7f28cf35edc5654600)]
19
+
20
+ ### [0.1.35](https://github.com/eea/volto-eea-map/compare/0.1.34...0.1.35) - 14 June 2023
21
+
22
+ #### :rocket: New Features
23
+
24
+ - feat: webmap update faster #254131 [Andrei Grigore - [`b1d6d25`](https://github.com/eea/volto-eea-map/commit/b1d6d25c94987b6c7f7ec548f36960f5912ebee6)]
25
+ - feat: colorpicker can set transparency #254131 [Andrei Grigore - [`aa13f63`](https://github.com/eea/volto-eea-map/commit/aa13f63c2123368d53e4ded81e2ebc7f6044c1f0)]
26
+
27
+ #### :bug: Bug Fixes
28
+
29
+ - fix: apply/remove queries more simple #254131 [Andrei Grigore - [`ec442c0`](https://github.com/eea/volto-eea-map/commit/ec442c0f6aaffada095f6722f23faebe93b0f9da)]
30
+ - fix: clearup map data on viz_url delete #254131 [Andrei Grigore - [`f14b2d0`](https://github.com/eea/volto-eea-map/commit/f14b2d038379bc6170dfaaa8c34f265c6516cb18)]
31
+ - fix: colorpicker with submit #254131 [Andrei Grigore - [`3fac753`](https://github.com/eea/volto-eea-map/commit/3fac75391758ad6b24b6e54bb5f7d19c373f9fba)]
32
+
33
+ #### :house: Internal changes
34
+
35
+ - chore: cleanup unused #254131 [Andrei Grigore - [`5245fd4`](https://github.com/eea/volto-eea-map/commit/5245fd46912214ae3cbaac29c338497f0649c919)]
36
+ - chore: cleanup, more reusable helper function #254131 [Andrei Grigore - [`1d83848`](https://github.com/eea/volto-eea-map/commit/1d83848fd965a165df57632c3b23229b411cc674)]
37
+ - chore: cleanup, creater reusable helper function #254131 [Andrei Grigore - [`8be34bf`](https://github.com/eea/volto-eea-map/commit/8be34bfbb40936c5dfccc674ef1e95e6f5b165a0)]
38
+
39
+ #### :hammer_and_wrench: Others
40
+
41
+ - wip: better queries keep #254131 [Andrei Grigore - [`88c9d48`](https://github.com/eea/volto-eea-map/commit/88c9d489d02780e1b03237c78db196f5dcabea06)]
42
+ - wip: init branch #254131 [Andrei Grigore - [`f841ecd`](https://github.com/eea/volto-eea-map/commit/f841ecdee3ef1018679c14706e1e0962ea4b3286)]
43
+ ### [0.1.34](https://github.com/eea/volto-eea-map/compare/0.1.33...0.1.34) - 12 June 2023
12
44
 
13
45
  ### [0.1.33](https://github.com/eea/volto-eea-map/compare/0.1.32...0.1.33) - 12 June 2023
14
46
 
@@ -22,7 +54,6 @@ Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).
22
54
 
23
55
  - chore: clear unused #254131 [andreiggr - [`ccec2ea`](https://github.com/eea/volto-eea-map/commit/ccec2eaab173c905cd4ea0190a9c6cfd630250f9)]
24
56
  - chore: clear block style #254131 [andreiggr - [`af500bc`](https://github.com/eea/volto-eea-map/commit/af500bc10a5f280eff0335f45bae1596d66a7e6b)]
25
- - chore: [JENKINS] Remove alpha testing version [valentinab25 - [`76b29e5`](https://github.com/eea/volto-eea-map/commit/76b29e510f5156590723831a524bc39dfba6deba)]
26
57
 
27
58
  #### :hammer_and_wrench: Others
28
59
 
@@ -32,7 +63,6 @@ Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).
32
63
  - * versions [andreiggr - [`6d9ff2b`](https://github.com/eea/volto-eea-map/commit/6d9ff2b26a236b6445678e3d84698d1c3c0826f4)]
33
64
  - add razzle-plugin-scss dep [andreiggr - [`d74cee5`](https://github.com/eea/volto-eea-map/commit/d74cee51d30c866afe55730e5b25e0bf11d2caea)]
34
65
  - volto-object-widget [andreiggr - [`18d0ed7`](https://github.com/eea/volto-eea-map/commit/18d0ed72c1ba7b0f7159a0eefc09ccea9acee5cb)]
35
- - Add Sonarqube tag using bise-frontend addons list [EEA Jenkins - [`5911d01`](https://github.com/eea/volto-eea-map/commit/5911d01f7f3bc79a2c834fab75a9a4ac05d2d042)]
36
66
  ### [0.1.32](https://github.com/eea/volto-eea-map/compare/0.1.31...0.1.32) - 20 February 2023
37
67
 
38
68
  #### :hammer_and_wrench: Others
@@ -40,7 +70,6 @@ Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).
40
70
  - remove console.log [tedw87 - [`3aeb3e8`](https://github.com/eea/volto-eea-map/commit/3aeb3e8ec5474387f3cd22eb9b387c6681e17120)]
41
71
  - refactor code [tedw87 - [`6d7830e`](https://github.com/eea/volto-eea-map/commit/6d7830eb934f56c255eea5642bdefba30d892946)]
42
72
  - add Blossom basemap layer [tedw87 - [`5226ee2`](https://github.com/eea/volto-eea-map/commit/5226ee218df3401cf467afbc7a4d720dc30719e1)]
43
- - Add Sonarqube tag using cca-frontend addons list [EEA Jenkins - [`1dad5c6`](https://github.com/eea/volto-eea-map/commit/1dad5c6617096ff85223165a6dd2b1d5d7deea6a)]
44
73
  ### [0.1.31](https://github.com/eea/volto-eea-map/compare/0.1.30...0.1.31) - 11 November 2022
45
74
 
46
75
  #### :hammer_and_wrench: Others
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@eeacms/volto-eea-map",
3
- "version": "0.1.34",
3
+ "version": "1.0.0",
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",
@@ -7,15 +7,27 @@ import { compose } from 'redux';
7
7
  import { getContent } from '@plone/volto/actions';
8
8
 
9
9
  import BlockDataForm from '@plone/volto/components/manage/Form/BlockDataForm';
10
- import View from './View';
11
- import { Schema } from './Schema';
12
- import '../../../styles/map.css';
10
+ import Webmap from '@eeacms/volto-eea-map/components/Webmap';
11
+ import ExtraViews from '@eeacms/volto-eea-map/components/ExtraViews';
13
12
 
14
- import _ from 'lodash';
13
+ import { Schema } from './Schema';
14
+ import {
15
+ applyQueriesToMapLayers,
16
+ updateBlockQueryFromPageQuery,
17
+ } from '@eeacms/volto-eea-map/utils';
15
18
 
16
19
  const Edit = (props) => {
17
- const { block, data, onChangeBlock, selected, id } = props;
18
- const schema = React.useMemo(() => Schema(props), [props]);
20
+ const {
21
+ block,
22
+ data,
23
+ onChangeBlock,
24
+ selected,
25
+ id,
26
+ data_provenance = {},
27
+ } = props;
28
+ const { height = '' } = data;
29
+ const schema = Schema(props);
30
+ const [mapData, setMapData] = React.useState('');
19
31
 
20
32
  React.useEffect(() => {
21
33
  if (!Object.hasOwn(data, 'show_legend')) {
@@ -36,30 +48,68 @@ const Edit = (props) => {
36
48
  dataprotection: { enabled: true },
37
49
  });
38
50
  }
39
-
40
- // eslint-disable-next-line react-hooks/exhaustive-deps
41
- }, [data]);
51
+ // eslint-disable-next-line react-hooks/exhaustive-deps
52
+ }, [data.show_legend, data.show_sources, data.dataprotection]);
42
53
 
43
54
  React.useEffect(() => {
44
- props.getContent(data.vis_url, null, id);
45
- // eslint-disable-next-line react-hooks/exhaustive-deps
46
- }, [data.vis_url]);
55
+ props.getContent(props.data.vis_url, null, id);
56
+ // eslint-disable-next-line react-hooks/exhaustive-deps
57
+ }, [props.data.vis_url]);
47
58
 
48
59
  React.useEffect(() => {
49
- if (
50
- !data.data_query_params ||
51
- !_.isEqual(props.data_query, data.data_query_params)
52
- ) {
53
- onChangeBlock(block, {
54
- ...data,
55
- data_query_params: props.data_query,
56
- });
60
+ if (props.data_query) {
61
+ //if block data_query_params do not exist, init them
62
+ if (!props?.data?.data_query_params) {
63
+ onChangeBlock(block, {
64
+ ...props.data,
65
+ data_query_params: [...props.data_query],
66
+ });
67
+ }
68
+
69
+ //if block data_query_params exist, deep check them then change them in block data
70
+ if (props?.data_query && data?.data_query_params) {
71
+ const newDataQuery = updateBlockQueryFromPageQuery(
72
+ props?.data_query,
73
+ data?.data_query_params,
74
+ );
75
+
76
+ onChangeBlock(block, {
77
+ ...data,
78
+ data_query_params: [...newDataQuery],
79
+ });
80
+ }
57
81
  }
58
82
  // eslint-disable-next-line react-hooks/exhaustive-deps
59
- }, [props.block, props.data_query, data.data_query_params]);
83
+ }, [props.data_query]);
84
+
85
+ React.useEffect(() => {
86
+ const updatedMapData = applyQueriesToMapLayers(
87
+ props.map_visualization,
88
+ props.data.data_query_params,
89
+ props.data.enable_queries,
90
+ );
91
+ setMapData(updatedMapData);
92
+
93
+ // eslint-disable-next-line react-hooks/exhaustive-deps
94
+ }, [props.map_visualization, props.data]);
95
+
60
96
  return (
61
97
  <>
62
- <View data={data} id={id} isEdit={true} />
98
+ {mapData && (
99
+ <div>
100
+ <Webmap data={mapData} height={height} isEdit={true} />
101
+ <ExtraViews
102
+ data={{
103
+ ...data,
104
+ data_provenance,
105
+ map_data: props.map_visualization,
106
+ }}
107
+ />
108
+ </div>
109
+ )}
110
+ {!mapData && (
111
+ <p>No map view to show. Set visualization in block configuration.</p>
112
+ )}
63
113
  <SidebarPortal selected={selected}>
64
114
  <BlockDataForm
65
115
  block={block}
@@ -81,8 +131,11 @@ const Edit = (props) => {
81
131
  export default compose(
82
132
  connect(
83
133
  (state, props) => ({
84
- block_data: state.content.data,
85
134
  data_query: state.content.data.data_query,
135
+ data_provenance:
136
+ state.content.subrequests?.[props.id]?.data?.data_provenance,
137
+ map_visualization:
138
+ state.content.subrequests?.[props.id]?.data?.map_visualization_data,
86
139
  }),
87
140
  {
88
141
  getContent,
@@ -6,72 +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 Webmap from '../../Webmap';
10
- import ExtraViews from '../../ExtraViews';
9
+ import Webmap from '@eeacms/volto-eea-map/components/Webmap';
10
+ import ExtraViews from '@eeacms/volto-eea-map/components/ExtraViews';
11
+ import { applyQueriesToMapLayers } from '@eeacms/volto-eea-map/utils';
11
12
 
12
13
  const View = (props) => {
13
- const { data, id, isEdit, map_visualization = '', data_provenance = {} } =
14
- props || {};
15
- const { height = '', vis_url = '', enable_queries } = data;
14
+ const { data, id, data_provenance = {} } = props || {};
15
+ const { height = '' } = data;
16
16
 
17
- const [mapData, setMapData] = React.useState(map_visualization);
17
+ const [mapData, setMapData] = React.useState('');
18
18
 
19
19
  React.useEffect(() => {
20
- if (vis_url) {
21
- props.getContent(vis_url, null, id);
22
- }
20
+ props.getContent(props.data.vis_url, null, id);
23
21
  // eslint-disable-next-line react-hooks/exhaustive-deps
24
- }, [vis_url, enable_queries]);
22
+ }, [props.data.vis_url]);
25
23
 
26
24
  React.useEffect(() => {
27
- var altMapData = { ...map_visualization };
28
- const query_params = isEdit
29
- ? props.data?.data_query_params
30
- : props?.data_query;
31
- if (
32
- enable_queries &&
33
- map_visualization &&
34
- query_params &&
35
- query_params.length > 0 &&
36
- altMapData.layers &&
37
- altMapData.layers.map_layers &&
38
- altMapData.layers.map_layers.length > 0
39
- ) {
40
- let rules = [];
25
+ const updatedMapData = applyQueriesToMapLayers(
26
+ props.map_visualization,
27
+ props.data.data_query_params,
28
+ props.data.enable_queries,
29
+ );
41
30
 
42
- altMapData.layers.map_layers.forEach((l, j) => {
43
- query_params.forEach((param, i) => {
44
- const matchingFields =
45
- l.map_layer && l.map_layer.fields && l.map_layer.fields.length > 0
46
- ? l.map_layer.fields.filter(
47
- (field, k) =>
48
- field.name === param.alias || field.name === param.i,
49
- )
50
- : [];
51
-
52
- matchingFields.forEach((m, i) => {
53
- const newRules = param.v
54
- ? param.v.map((paramVal, i) => {
55
- return {
56
- field: m.name,
57
- operator: '=',
58
- value: paramVal,
59
- };
60
- })
61
- : [];
62
- rules = rules.concat(newRules);
63
- });
64
- });
65
- let autoQuery = {
66
- combinator: 'or',
67
- rules,
68
- };
69
- altMapData.layers.map_layers[j].map_layer.query = autoQuery;
70
- });
71
- }
72
- setMapData(altMapData);
31
+ setMapData(updatedMapData);
73
32
  // eslint-disable-next-line react-hooks/exhaustive-deps
74
- }, [map_visualization, props.data, props.data_query, isEdit, enable_queries]);
33
+ }, [props.map_visualization, props.data]);
75
34
 
76
35
  return (
77
36
  <PrivacyProtection data={data} height={height} {...props}>
@@ -82,7 +41,7 @@ const View = (props) => {
82
41
  data={{
83
42
  ...data,
84
43
  data_provenance,
85
- map_data: map_visualization,
44
+ map_data: props.map_visualization,
86
45
  }}
87
46
  />
88
47
  </div>
@@ -97,7 +56,6 @@ const View = (props) => {
97
56
  export default compose(
98
57
  connect(
99
58
  (state, props) => ({
100
- data_query: state.content.data.data_query,
101
59
  data_provenance:
102
60
  state.content.subrequests?.[props.id]?.data?.data_provenance,
103
61
  map_visualization:
@@ -1,47 +1,7 @@
1
1
  import React from 'react';
2
- import { UniversalLink, Icon } from '@plone/volto/components';
3
-
4
- import LegendWidget from './widgets/LegendWidget';
5
2
  import { serializeNodes } from '@plone/volto-slate/editor/render';
6
-
7
- import rightKeySVG from '@plone/volto/icons/right-key.svg';
8
- import downKeySVG from '@plone/volto/icons/down-key.svg';
9
-
10
- const SourcesWidget = ({ data }) => {
11
- const [expand, setExpand] = React.useState(true);
12
-
13
- return (
14
- <div>
15
- <button className="legend-action" onClick={() => setExpand(!expand)}>
16
- <h3>
17
- <Icon
18
- name={expand ? downKeySVG : rightKeySVG}
19
- title={expand ? 'Collapse' : 'Expand'}
20
- size="17px"
21
- />
22
- Sources:
23
- </h3>
24
- </button>
25
- {expand && (
26
- <ul>
27
- {data.map((param, i) => (
28
- <li key={i}>
29
- <div className="map_source_param_container">
30
- <UniversalLink className="map_source_title" href={param.link}>
31
- {param.title}
32
- </UniversalLink>
33
- ,
34
- <span className="map_source_description">
35
- {param.organisation}
36
- </span>
37
- </div>
38
- </li>
39
- ))}
40
- </ul>
41
- )}
42
- </div>
43
- );
44
- };
3
+ import LegendView from '@eeacms/volto-eea-map/components/LegendView';
4
+ import Sources from './Sources';
45
5
 
46
6
  const ExtraViews = ({ data }) => {
47
7
  const {
@@ -56,19 +16,9 @@ const ExtraViews = ({ data }) => {
56
16
  return (
57
17
  <div className="extra-eea-map-content">
58
18
  {show_legend && map_data && (
59
- <LegendWidget data={map_data} show_viewer={show_viewer} />
60
- )}
61
- {show_sources && (
62
- <>
63
- {data_provenance &&
64
- data_provenance.data &&
65
- data_provenance.data.length > 0 ? (
66
- <SourcesWidget data={data_provenance.data} />
67
- ) : (
68
- <p>Data provenance is not set for visualization used or page</p>
69
- )}
70
- </>
19
+ <LegendView data={map_data} show_viewer={show_viewer} />
71
20
  )}
21
+ {show_sources && <Sources sources={data_provenance?.data} />}
72
22
  {description && serializeNodes(description)}
73
23
  </div>
74
24
  );
@@ -1,14 +1,14 @@
1
1
  import React from 'react';
2
2
  import { Button, Grid } from 'semantic-ui-react';
3
- import { fetchArcGISData, setLegendColumns } from '../../utils';
3
+ import { fetchArcGISData, setLegendColumns } from '../utils';
4
4
  import { Icon } from '@plone/volto/components';
5
5
  import { serializeNodes } from '@plone/volto-slate/editor/render';
6
6
 
7
7
  import rightKeySVG from '@plone/volto/icons/right-key.svg';
8
8
  import downKeySVG from '@plone/volto/icons/down-key.svg';
9
- import { withDeviceSize } from '../../hocs';
9
+ import { withDeviceSize } from '@eeacms/volto-eea-map/hocs';
10
10
 
11
- import codeSVG from '../../static/code-line.svg';
11
+ import codeSVG from '@eeacms/volto-eea-map/static/code-line.svg';
12
12
 
13
13
  const LayerLegend = ({ data, show_viewer }) => {
14
14
  const [legendRows, setLegendRows] = React.useState([]);
@@ -92,7 +92,7 @@ const LayerLegend = ({ data, show_viewer }) => {
92
92
  );
93
93
  };
94
94
 
95
- const LegendWidget = (props) => {
95
+ const LegendView = (props) => {
96
96
  const data = React.useMemo(() => props.data, [props.data]);
97
97
  const { device = '', show_viewer = false } = props;
98
98
 
@@ -116,14 +116,14 @@ const LegendWidget = (props) => {
116
116
  <>
117
117
  <div className="legend-container">
118
118
  <button className="legend-action" onClick={() => setExpand(!expand)}>
119
- <h3 role="presentation" className="legend-title">
120
- <Icon
121
- name={expand ? downKeySVG : rightKeySVG}
122
- title={expand ? 'Collapse' : 'Expand'}
123
- size="17px"
124
- />
125
- Legend:
126
- </h3>
119
+ {/* <h3 role="presentation" className="legend-title"> */}
120
+ <Icon
121
+ name={expand ? downKeySVG : rightKeySVG}
122
+ title={expand ? 'Collapse' : 'Expand'}
123
+ size="17px"
124
+ />
125
+ Legend:
126
+ {/* </h3> */}
127
127
  </button>
128
128
  <Grid columns={legendColumns}>
129
129
  {(!map_layers || map_layers.length === 0) && (
@@ -150,4 +150,4 @@ const LegendWidget = (props) => {
150
150
  );
151
151
  };
152
152
 
153
- export default withDeviceSize(React.memo(LegendWidget));
153
+ export default withDeviceSize(React.memo(LegendView));
@@ -0,0 +1,69 @@
1
+ import React from 'react';
2
+ import cx from 'classnames';
3
+ import { Popup } from 'semantic-ui-react';
4
+ import { UniversalLink } from '@plone/volto/components';
5
+
6
+ const Link = ({ children, ...props }) => {
7
+ if (props.href) {
8
+ return <UniversalLink {...props}>{children}</UniversalLink>;
9
+ }
10
+ return <span {...props}>{children}</span>;
11
+ };
12
+
13
+ const Source = ({ source }) => {
14
+ if (source.chart_source_link && source.chart_source) {
15
+ return <Link href={source.chart_source_link}>{source.chart_source}</Link>;
16
+ }
17
+ if (source.chart_source) {
18
+ return <span>{source.chart_source}</span>;
19
+ }
20
+ return (
21
+ <>
22
+ <Link className="embed-sources-param-title" href={source.link}>
23
+ {source.title}
24
+ </Link>
25
+ ,<span style={{ marginLeft: '5px' }}>{source.organisation}</span>
26
+ </>
27
+ );
28
+ };
29
+
30
+ const SourcesWidget = ({ sources }) => {
31
+ const [expanded, setExpanded] = React.useState(false);
32
+ return (
33
+ <div className="eea-map-sources-container">
34
+ <Popup
35
+ content={
36
+ sources?.length ? (
37
+ <ol className="eea-map-sources-list">
38
+ {sources?.map((source, index) => {
39
+ return (
40
+ <li key={index}>
41
+ <Source source={source} />
42
+ </li>
43
+ );
44
+ })}
45
+ </ol>
46
+ ) : (
47
+ <p>Data provenance is not set for this visualization.</p>
48
+ )
49
+ }
50
+ position="bottom left"
51
+ popper={{ id: 'eea-map-sources-popup' }}
52
+ trigger={
53
+ <button className={cx('eea-map-sources-button', { expanded })}>
54
+ Sources
55
+ </button>
56
+ }
57
+ on="click"
58
+ onClose={() => {
59
+ setExpanded(false);
60
+ }}
61
+ onOpen={() => {
62
+ setExpanded(true);
63
+ }}
64
+ />
65
+ </div>
66
+ );
67
+ };
68
+
69
+ export default SourcesWidget;
@@ -22,16 +22,23 @@ const MODULES = [
22
22
  const Webmap = (props) => {
23
23
  const { editMode, height, id } = props;
24
24
 
25
+ const device = React.useMemo(() => props.device || {}, [props.device]);
26
+
25
27
  const data = React.useMemo(() => props.data || {}, [props.data]);
26
28
 
27
- const device = React.useMemo(() => props.device || {}, [props.device]);
28
- const {
29
- base = {},
30
- layers = {},
31
- legend = {},
32
- general = {},
33
- styles = {},
34
- } = data;
29
+ const layers = React.useMemo(() => props?.data?.layers || {}, [
30
+ props.data.layers,
31
+ ]);
32
+ const base = React.useMemo(() => props?.data?.base || {}, [props.data.base]);
33
+ const legend = React.useMemo(() => props?.data?.legend || {}, [
34
+ props.data.legend,
35
+ ]);
36
+ const general = React.useMemo(() => props?.data?.general || {}, [
37
+ props.data.general,
38
+ ]);
39
+ const styles = React.useMemo(() => props?.data?.styles || {}, [
40
+ props.data.styles,
41
+ ]);
35
42
 
36
43
  const { base_layer = '' } = base;
37
44
 
@@ -91,11 +98,26 @@ const Webmap = (props) => {
91
98
  type: 'simple', // autocasts as new SimpleRenderer()
92
99
  symbol: {
93
100
  type: 'simple-fill', // autocasts as new SimpleFillSymbol()
94
- color: styles?.symbol_color ? styles?.symbol_color : 'black',
101
+ color: styles?.symbol_color
102
+ ? styles?.symbol_color?.rgb
103
+ : {
104
+ r: 0,
105
+ g: 0,
106
+ b: 0,
107
+ a: 1,
108
+ },
109
+ //color: 'rgba(255,255,255,0.4)',
95
110
  style: 'solid',
96
111
  outline: {
97
112
  // autocasts as new SimpleLineSymbol()
98
- color: styles?.outline_color ? styles?.outline_color : 'white',
113
+ color: styles?.outline_color
114
+ ? styles?.outline_color?.rgb
115
+ : {
116
+ r: 0,
117
+ g: 0,
118
+ b: 0,
119
+ a: 1,
120
+ },
99
121
  width: styles?.outline_width ? styles?.outline_width : 1,
100
122
  },
101
123
  },
@@ -1,7 +1,6 @@
1
- export EEAMapView from './Blocks/EEAMap/View';
2
- export EEAMapEdit from './Blocks/EEAMap/Edit';
3
1
  export Webmap from './Webmap';
4
2
  export ExtraViews from './ExtraViews';
3
+ export LegendView from './LegendView';
5
4
 
6
5
  export EmbedMapView from './Blocks/EmbedEEAMap/View';
7
6
  export EmbedMapEdit from './Blocks/EmbedEEAMap/Edit';
@@ -114,7 +114,7 @@ const VisualizationEditorWidget = (props) => {
114
114
  </Modal.Actions>
115
115
  </Modal>
116
116
  )}
117
- <Webmap data={value} editMode={true} />
117
+ {!open && <Webmap data={value} editMode={true} />}
118
118
  </FormFieldWrapper>
119
119
  );
120
120
  };
@@ -78,6 +78,8 @@ const MapLayersSchema = {
78
78
  required: [],
79
79
  };
80
80
 
81
+ //style changes work only for Feature layers atm
82
+ // TODO: apply style for individual layers
81
83
  const StylesLayersSchema = ({ data = {} }) => {
82
84
  return {
83
85
  title: 'Styles Layers',