@eeacms/volto-eea-map 0.1.13 → 0.1.16
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 +38 -0
- package/package.json +3 -2
- package/src/actionTypes.js +1 -0
- package/src/actions.js +1 -1
- package/src/components/Blocks/EEAMap/Edit.jsx +1 -1
- package/src/components/Blocks/EEAMap/Schema.js +3 -5
- package/src/components/Blocks/EEAMap/View.jsx +3 -2
- package/src/components/Blocks/EmbedEEAMap/Edit.jsx +7 -6
- package/src/components/Blocks/EmbedEEAMap/Schema.js +13 -7
- package/src/components/Blocks/EmbedEEAMap/View.jsx +54 -46
- package/src/components/ExtraViews.jsx +85 -0
- package/src/components/{Blocks/EEAMap/components/Webmap.jsx → Webmap.jsx} +33 -31
- package/src/components/index.js +6 -6
- package/src/components/visualization/VisualizationEditorWidget.jsx +121 -0
- package/src/components/{Blocks/EEAMap/components/widgets → visualization}/VisualizationView.jsx +0 -0
- package/src/components/{Blocks/EEAMap/components/widgets → visualization}/panelsSchema.js +0 -1
- package/src/components/widgets/DataQueryWidget.jsx +50 -0
- package/src/components/{Blocks/EEAMap/components/widgets → widgets}/LayerSelectWidget.jsx +102 -46
- package/src/components/{Blocks/EEAMap/components/widgets/LayersPanel.jsx → widgets/LayersPanelWidget.jsx} +2 -2
- package/src/components/{Blocks/EEAMap/components/widgets → widgets}/LegendWidget.jsx +43 -31
- package/src/components/{Blocks/EEAMap/components/widgets → widgets}/MapEditorWidget.jsx +1 -0
- package/src/components/{Blocks/EEAMap/components/widgets → widgets}/ObjectTypesWidget.jsx +1 -2
- package/src/components/widgets/panelsSchema.js +151 -0
- package/src/constants.js +29 -1
- package/src/index.js +41 -41
- package/src/middlewares/index.js +1 -1
- package/src/reducers/map_visualizations.js +1 -1
- package/src/static/code-line.svg +1 -0
- package/src/{components/Blocks/EEAMap/styles → styles}/map.css +66 -5
- package/src/{components/Blocks/EEAMap/utils.js → utils.js} +18 -2
- package/src/components/Blocks/EEAMap/components/widgets/DataQueryWidget.jsx +0 -46
- package/src/components/Blocks/EEAMap/components/widgets/ExtraViews.jsx +0 -86
- package/src/components/Blocks/EEAMap/components/widgets/VisualizationEditorWidget.jsx +0 -94
- package/src/components/Blocks/EEAMap/constants.js +0 -29
- package/src/components/Blocks/EmbedEEAMap/styles/map.css +0 -22
package/CHANGELOG.md
CHANGED
|
@@ -4,8 +4,46 @@ 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.16](https://github.com/eea/volto-eea-map/compare/0.1.15...0.1.16)
|
|
8
|
+
|
|
9
|
+
- faster update q params for view/edit [`a2d64fb`](https://github.com/eea/volto-eea-map/commit/a2d64fb1112bc129d3183403649a0e5dde822745)
|
|
10
|
+
|
|
11
|
+
#### [0.1.15](https://github.com/eea/volto-eea-map/compare/0.1.14...0.1.15)
|
|
12
|
+
|
|
13
|
+
> 26 August 2022
|
|
14
|
+
|
|
15
|
+
- Quick fix [`#15`](https://github.com/eea/volto-eea-map/pull/15)
|
|
16
|
+
- more space for button [`8fa6a3b`](https://github.com/eea/volto-eea-map/commit/8fa6a3b230cd835d0fbcc4881b14d51d318b91be)
|
|
17
|
+
- eslint happy [`30b41d2`](https://github.com/eea/volto-eea-map/commit/30b41d2d18fcf2d195cdd08a2b6b9c78e6a303bb)
|
|
18
|
+
- better update [`a1ca2f5`](https://github.com/eea/volto-eea-map/commit/a1ca2f51d1f24d932ad03fe61b5a4a564b491873)
|
|
19
|
+
- update deps [`c9d2f92`](https://github.com/eea/volto-eea-map/commit/c9d2f920c076e77f030cd841ca5a1e49cc1bc319)
|
|
20
|
+
- use only query params from qidget [`303793f`](https://github.com/eea/volto-eea-map/commit/303793f6f3af8c0cf8857e08a61cbf9e16c7d810)
|
|
21
|
+
- get map data from getContent [`40ae731`](https://github.com/eea/volto-eea-map/commit/40ae73135cd93e49ce0956d4ca0ef5e3425e3d19)
|
|
22
|
+
- use button on action [`86a090b`](https://github.com/eea/volto-eea-map/commit/86a090b17ccf3f951146cb8adcaf539fd8cf9faf)
|
|
23
|
+
|
|
24
|
+
#### [0.1.14](https://github.com/eea/volto-eea-map/compare/0.1.13...0.1.14)
|
|
25
|
+
|
|
26
|
+
> 26 August 2022
|
|
27
|
+
|
|
28
|
+
- Develop [`#14`](https://github.com/eea/volto-eea-map/pull/14)
|
|
29
|
+
- new sources styles, icons from remixicon [`c9cca2a`](https://github.com/eea/volto-eea-map/commit/c9cca2a5e41322cfdeca1865b47a1892514c1cfc)
|
|
30
|
+
- reorganize & clean [`a902b89`](https://github.com/eea/volto-eea-map/commit/a902b8945389b19b388e85e00066b2c46a9e1a2e)
|
|
31
|
+
- Layer widget improvements [`99abe57`](https://github.com/eea/volto-eea-map/commit/99abe5722590719ac7e640de44a69ee19fcecfdf)
|
|
32
|
+
- Change data queries cards [`8d3c742`](https://github.com/eea/volto-eea-map/commit/8d3c74239f62782737108c25e84683239e6ab12f)
|
|
33
|
+
- Set default settings [`2c26f57`](https://github.com/eea/volto-eea-map/commit/2c26f571618d289158c7d32fd9814edcd29a7c60)
|
|
34
|
+
- Add description to layer [`cccfd59`](https://github.com/eea/volto-eea-map/commit/cccfd598060c4228215a5add1da3e159312966b2)
|
|
35
|
+
- only embed viz for now [`6bb7daf`](https://github.com/eea/volto-eea-map/commit/6bb7daf458a47bd185870ec3627a542f8ba715bc)
|
|
36
|
+
- Visualization improvements [`2a77f8b`](https://github.com/eea/volto-eea-map/commit/2a77f8bba1f6fd840d41043ee41b1b3bd23807f3)
|
|
37
|
+
- Cleanup [`6d6ceb9`](https://github.com/eea/volto-eea-map/commit/6d6ceb99768ff477a727cf217e48099e6f2d1a59)
|
|
38
|
+
- Add all query parameters with all values [`2f8c617`](https://github.com/eea/volto-eea-map/commit/2f8c61711154953ec25e20614b4ad96ed2bf592b)
|
|
39
|
+
- Data query widget visual improvements [`7eb3144`](https://github.com/eea/volto-eea-map/commit/7eb3144ad58a839ccc96f22d58a441b245893ea7)
|
|
40
|
+
- Data query widget more responsive to changes [`bb86329`](https://github.com/eea/volto-eea-map/commit/bb863299d51627a28f02e2cda133fc0e3bf9ebe9)
|
|
41
|
+
|
|
7
42
|
#### [0.1.13](https://github.com/eea/volto-eea-map/compare/0.1.12...0.1.13)
|
|
8
43
|
|
|
44
|
+
> 22 August 2022
|
|
45
|
+
|
|
46
|
+
- Enable Embed EEA map access to data_query [`#13`](https://github.com/eea/volto-eea-map/pull/13)
|
|
9
47
|
- update embed map with data_query [`719c007`](https://github.com/eea/volto-eea-map/commit/719c00776dff7ba63bbd57761a2c86ec5345a911)
|
|
10
48
|
|
|
11
49
|
#### [0.1.12](https://github.com/eea/volto-eea-map/compare/0.1.11...0.1.12)
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@eeacms/volto-eea-map",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.16",
|
|
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": "
|
|
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
|
},
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export const GET_MAP_VISUALIZATION = 'GET_MAP_VISUALIZATION';
|
package/src/actions.js
CHANGED
|
@@ -11,7 +11,7 @@ import View from './View';
|
|
|
11
11
|
import { getContent } from '@plone/volto/actions';
|
|
12
12
|
|
|
13
13
|
import { addPrivacyProtectionToSchema } from '@eeacms/volto-embed';
|
|
14
|
-
import '
|
|
14
|
+
import '../../../styles/map.css';
|
|
15
15
|
|
|
16
16
|
const Edit = (props) => {
|
|
17
17
|
const { block, data, onChangeBlock, selected, id } = props;
|
|
@@ -39,16 +39,14 @@ export const Schema = (props) => {
|
|
|
39
39
|
title: 'Show legend',
|
|
40
40
|
type: 'boolean',
|
|
41
41
|
},
|
|
42
|
-
|
|
43
|
-
title: 'Show download',
|
|
44
|
-
type: 'boolean',
|
|
45
|
-
},
|
|
42
|
+
|
|
46
43
|
show_viewer: {
|
|
47
44
|
title: 'Show web viewer',
|
|
48
45
|
type: 'boolean',
|
|
49
46
|
},
|
|
50
47
|
data_query_params: {
|
|
51
|
-
title: '
|
|
48
|
+
title: 'Query parameters',
|
|
49
|
+
description: 'ddafdfas',
|
|
52
50
|
widget: 'data_query_widget',
|
|
53
51
|
},
|
|
54
52
|
},
|
|
@@ -3,8 +3,9 @@ import React from 'react';
|
|
|
3
3
|
import { connect } from 'react-redux';
|
|
4
4
|
import { compose } from 'redux';
|
|
5
5
|
|
|
6
|
-
import Webmap from '
|
|
7
|
-
import ExtraViews from '
|
|
6
|
+
import Webmap from '../../Webmap';
|
|
7
|
+
import ExtraViews from '../../ExtraViews';
|
|
8
|
+
|
|
8
9
|
import { PrivacyProtection } from '@eeacms/volto-embed';
|
|
9
10
|
import { getContent } from '@plone/volto/actions';
|
|
10
11
|
|
|
@@ -10,7 +10,9 @@ import BlockDataForm from '@plone/volto/components/manage/Form/BlockDataForm';
|
|
|
10
10
|
import View from './View';
|
|
11
11
|
import { Schema } from './Schema';
|
|
12
12
|
import { addPrivacyProtectionToSchema } from '@eeacms/volto-embed';
|
|
13
|
-
import '
|
|
13
|
+
import '../../../styles/map.css';
|
|
14
|
+
|
|
15
|
+
import _ from 'lodash';
|
|
14
16
|
|
|
15
17
|
const Edit = (props) => {
|
|
16
18
|
const { block, data, onChangeBlock, selected, id } = props;
|
|
@@ -24,7 +26,7 @@ const Edit = (props) => {
|
|
|
24
26
|
React.useEffect(() => {
|
|
25
27
|
if (
|
|
26
28
|
!data.data_query_params ||
|
|
27
|
-
props.data_query
|
|
29
|
+
!_.isEqual(props.data_query, data.data_query_params)
|
|
28
30
|
) {
|
|
29
31
|
onChangeBlock(block, {
|
|
30
32
|
...data,
|
|
@@ -32,11 +34,11 @@ const Edit = (props) => {
|
|
|
32
34
|
});
|
|
33
35
|
}
|
|
34
36
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
35
|
-
}, [props.data_query, block, data]);
|
|
37
|
+
}, [props.data_query, block, data.data_query_params]);
|
|
36
38
|
|
|
37
39
|
return (
|
|
38
40
|
<div>
|
|
39
|
-
<View data={data} id={id} />
|
|
41
|
+
<View data={data} id={id} isEdit={true} />
|
|
40
42
|
<SidebarPortal selected={selected}>
|
|
41
43
|
<BlockDataForm
|
|
42
44
|
block={block}
|
|
@@ -58,9 +60,8 @@ const Edit = (props) => {
|
|
|
58
60
|
export default compose(
|
|
59
61
|
connect(
|
|
60
62
|
(state, props) => ({
|
|
63
|
+
block_data: state.content.data,
|
|
61
64
|
data_query: state.content.data.data_query,
|
|
62
|
-
data_provenance:
|
|
63
|
-
state.content.subrequests?.[props.id]?.data?.data_provenance,
|
|
64
65
|
}),
|
|
65
66
|
{
|
|
66
67
|
getContent,
|
|
@@ -10,10 +10,10 @@ export const Schema = (props) => {
|
|
|
10
10
|
'description',
|
|
11
11
|
'height',
|
|
12
12
|
'show_legend',
|
|
13
|
-
'show_download',
|
|
14
13
|
'show_viewer',
|
|
15
14
|
'show_sources',
|
|
16
|
-
'
|
|
15
|
+
'enable_queries',
|
|
16
|
+
...(props.data.enable_queries ? ['data_query_params'] : []),
|
|
17
17
|
],
|
|
18
18
|
},
|
|
19
19
|
],
|
|
@@ -32,22 +32,28 @@ export const Schema = (props) => {
|
|
|
32
32
|
},
|
|
33
33
|
show_sources: {
|
|
34
34
|
title: 'Show sources',
|
|
35
|
+
description: 'Will show sources set in this page Data provenance',
|
|
35
36
|
type: 'boolean',
|
|
36
37
|
},
|
|
37
38
|
show_legend: {
|
|
38
39
|
title: 'Show legend',
|
|
39
40
|
type: 'boolean',
|
|
40
41
|
},
|
|
41
|
-
|
|
42
|
-
title: 'Show
|
|
42
|
+
show_viewer: {
|
|
43
|
+
title: 'Show API link',
|
|
44
|
+
description: 'Open the map on ArcGIS js service',
|
|
43
45
|
type: 'boolean',
|
|
44
46
|
},
|
|
45
|
-
|
|
46
|
-
title: '
|
|
47
|
+
enable_queries: {
|
|
48
|
+
title: 'Enable queries',
|
|
49
|
+
description:
|
|
50
|
+
'Will import Criteria from content-type and try to query map layer fields.',
|
|
47
51
|
type: 'boolean',
|
|
48
52
|
},
|
|
49
53
|
data_query_params: {
|
|
50
|
-
title: '
|
|
54
|
+
title: 'Query parameters',
|
|
55
|
+
description:
|
|
56
|
+
'When using page level parameters to filter the map, please map those to the corresponding field name from the ArcGIS service',
|
|
51
57
|
widget: 'data_query_widget',
|
|
52
58
|
},
|
|
53
59
|
},
|
|
@@ -4,85 +4,90 @@ import { connect } from 'react-redux';
|
|
|
4
4
|
import { compose } from 'redux';
|
|
5
5
|
|
|
6
6
|
import { PrivacyProtection } from '@eeacms/volto-embed';
|
|
7
|
-
|
|
8
|
-
import ExtraViews from '../EEAMap/components/widgets/ExtraViews';
|
|
7
|
+
|
|
9
8
|
import { getContent } from '@plone/volto/actions';
|
|
9
|
+
import Webmap from '../../Webmap';
|
|
10
|
+
import ExtraViews from '../../ExtraViews';
|
|
10
11
|
|
|
11
12
|
const View = (props) => {
|
|
12
|
-
const { data,
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
const { map_visualization_data = '', data_provenance = {} } =
|
|
16
|
-
viz_content || {};
|
|
13
|
+
const { data, id, isEdit, map_visualization = {}, data_provenance = {} } =
|
|
14
|
+
props || {};
|
|
15
|
+
const { height = '', vis_url = '', enable_queries } = data;
|
|
17
16
|
|
|
18
|
-
const [mapData, setMapData] = React.useState(
|
|
17
|
+
const [mapData, setMapData] = React.useState(map_visualization);
|
|
19
18
|
|
|
20
19
|
React.useEffect(() => {
|
|
21
|
-
if (vis_url
|
|
20
|
+
if (vis_url) {
|
|
22
21
|
props.getContent(vis_url, null, id);
|
|
23
22
|
}
|
|
24
23
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
25
|
-
}, [vis_url]);
|
|
24
|
+
}, [vis_url, enable_queries]);
|
|
26
25
|
|
|
27
26
|
React.useEffect(() => {
|
|
27
|
+
const query_params = isEdit
|
|
28
|
+
? props.data?.data_query_params
|
|
29
|
+
: props?.data_query;
|
|
30
|
+
var altMapData = { ...map_visualization };
|
|
31
|
+
|
|
28
32
|
if (
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
33
|
+
enable_queries &&
|
|
34
|
+
query_params &&
|
|
35
|
+
query_params.length > 0 &&
|
|
36
|
+
altMapData.layers &&
|
|
37
|
+
altMapData.layers.map_layers &&
|
|
38
|
+
altMapData.layers.map_layers.length > 0
|
|
32
39
|
) {
|
|
33
|
-
let
|
|
40
|
+
let rules = [];
|
|
41
|
+
altMapData.layers.map_layers.forEach((l, j) => {
|
|
42
|
+
query_params.forEach((param, i) => {
|
|
43
|
+
const matchingFields =
|
|
44
|
+
l.map_layer && l.map_layer.fields && l.map_layer.fields.length > 0
|
|
45
|
+
? l.map_layer.fields.filter(
|
|
46
|
+
(field, k) =>
|
|
47
|
+
field.name === param.alias || field.name === param.i,
|
|
48
|
+
)
|
|
49
|
+
: [];
|
|
34
50
|
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
map_visualization_data.layers.map_layers &&
|
|
39
|
-
map_visualization_data.layers.map_layers.length > 0
|
|
40
|
-
) {
|
|
41
|
-
map_visualization_data.layers.map_layers.forEach((l, j) => {
|
|
42
|
-
if (
|
|
43
|
-
l.map_layer &&
|
|
44
|
-
l.map_layer.fields &&
|
|
45
|
-
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
|
-
).length > 0
|
|
50
|
-
) {
|
|
51
|
-
let autoQuery = {
|
|
52
|
-
combinator: 'or',
|
|
53
|
-
rules: props.data_query.map((q, i) => {
|
|
51
|
+
matchingFields.forEach((m, i) => {
|
|
52
|
+
const newRules = param.v
|
|
53
|
+
? param.v.map((paramVal, i) => {
|
|
54
54
|
return {
|
|
55
|
-
field:
|
|
55
|
+
field: m.name,
|
|
56
56
|
operator: '=',
|
|
57
|
-
value:
|
|
57
|
+
value: paramVal,
|
|
58
58
|
};
|
|
59
|
-
})
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
}
|
|
59
|
+
})
|
|
60
|
+
: [];
|
|
61
|
+
rules = rules.concat(newRules);
|
|
63
62
|
});
|
|
64
|
-
}
|
|
63
|
+
});
|
|
64
|
+
let autoQuery = {
|
|
65
|
+
combinator: 'or',
|
|
66
|
+
rules,
|
|
67
|
+
};
|
|
68
|
+
altMapData.layers.map_layers[j].map_layer.query = autoQuery;
|
|
65
69
|
});
|
|
66
|
-
setMapData(altMapData);
|
|
67
70
|
}
|
|
68
|
-
|
|
71
|
+
setMapData(altMapData);
|
|
72
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
73
|
+
}, [map_visualization, props.data, props.data_query, isEdit, enable_queries]);
|
|
69
74
|
|
|
70
75
|
return (
|
|
71
76
|
<div>
|
|
72
77
|
<PrivacyProtection data={data} {...props}>
|
|
73
|
-
{
|
|
78
|
+
{mapData && (
|
|
74
79
|
<div>
|
|
75
80
|
<Webmap data={mapData} height={height} />
|
|
76
81
|
<ExtraViews
|
|
77
82
|
data={{
|
|
78
83
|
...data,
|
|
79
84
|
data_provenance,
|
|
80
|
-
map_data:
|
|
85
|
+
map_data: map_visualization,
|
|
81
86
|
}}
|
|
82
87
|
/>
|
|
83
88
|
</div>
|
|
84
89
|
)}
|
|
85
|
-
{!
|
|
90
|
+
{!mapData && (
|
|
86
91
|
<p>No map view to show. Set visualization in block configuration.</p>
|
|
87
92
|
)}
|
|
88
93
|
</PrivacyProtection>
|
|
@@ -94,7 +99,10 @@ export default compose(
|
|
|
94
99
|
connect(
|
|
95
100
|
(state, props) => ({
|
|
96
101
|
data_query: state.content.data.data_query,
|
|
97
|
-
|
|
102
|
+
data_provenance:
|
|
103
|
+
state.content.subrequests?.[props.id]?.data?.data_provenance,
|
|
104
|
+
map_visualization:
|
|
105
|
+
state.content.subrequests?.[props.id]?.data?.map_visualization_data,
|
|
98
106
|
}),
|
|
99
107
|
{
|
|
100
108
|
getContent,
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { Button } from 'semantic-ui-react';
|
|
3
|
+
import { UniversalLink } from '@plone/volto/components';
|
|
4
|
+
|
|
5
|
+
import LegendWidget from './widgets/LegendWidget';
|
|
6
|
+
import { serializeNodes } from 'volto-slate/editor/render';
|
|
7
|
+
|
|
8
|
+
import codeSVG from '../static/code-line.svg';
|
|
9
|
+
|
|
10
|
+
const ExtraViews = ({ data }) => {
|
|
11
|
+
const {
|
|
12
|
+
map_data = {},
|
|
13
|
+
description,
|
|
14
|
+
show_legend,
|
|
15
|
+
show_viewer,
|
|
16
|
+
show_sources,
|
|
17
|
+
data_provenance = {},
|
|
18
|
+
} = data;
|
|
19
|
+
return (
|
|
20
|
+
<div className="extra-eea-map-content">
|
|
21
|
+
{map_data && map_data.layers?.map_layers[0] && show_viewer && (
|
|
22
|
+
<div
|
|
23
|
+
style={{ display: 'flex', justifyContent: 'end', margin: '10px 0' }}
|
|
24
|
+
>
|
|
25
|
+
{show_viewer && (
|
|
26
|
+
<a
|
|
27
|
+
target="_blank"
|
|
28
|
+
rel="noreferrer"
|
|
29
|
+
href={
|
|
30
|
+
`https://www.arcgis.com/home/webmap/viewer.html?url=` +
|
|
31
|
+
`${map_data.layers.map_layers[0].map_layer.map_service_url}&source=sd`
|
|
32
|
+
}
|
|
33
|
+
>
|
|
34
|
+
<Button size="tiny">
|
|
35
|
+
<Button.Content>
|
|
36
|
+
<img
|
|
37
|
+
className="extra-view-external-button"
|
|
38
|
+
src={codeSVG}
|
|
39
|
+
alt=""
|
|
40
|
+
title="Show API link"
|
|
41
|
+
/>
|
|
42
|
+
</Button.Content>
|
|
43
|
+
</Button>
|
|
44
|
+
</a>
|
|
45
|
+
)}
|
|
46
|
+
</div>
|
|
47
|
+
)}
|
|
48
|
+
{show_legend && map_data && <LegendWidget data={map_data} />}
|
|
49
|
+
{show_sources && (
|
|
50
|
+
<>
|
|
51
|
+
{data_provenance &&
|
|
52
|
+
data_provenance.data &&
|
|
53
|
+
data_provenance.data.length > 0 ? (
|
|
54
|
+
<div>
|
|
55
|
+
<h3>Sources:</h3>
|
|
56
|
+
<ul>
|
|
57
|
+
{data_provenance.data.map((param, i) => (
|
|
58
|
+
<li key={i}>
|
|
59
|
+
<div className="map_source_param_container">
|
|
60
|
+
<UniversalLink
|
|
61
|
+
className="map_source_title"
|
|
62
|
+
href={param.link}
|
|
63
|
+
>
|
|
64
|
+
{param.title}
|
|
65
|
+
</UniversalLink>
|
|
66
|
+
,
|
|
67
|
+
<span className="map_source_description">
|
|
68
|
+
{param.organisation}
|
|
69
|
+
</span>
|
|
70
|
+
</div>
|
|
71
|
+
</li>
|
|
72
|
+
))}
|
|
73
|
+
</ul>
|
|
74
|
+
</div>
|
|
75
|
+
) : (
|
|
76
|
+
<p>Data provenance is not set for visualization used or page</p>
|
|
77
|
+
)}
|
|
78
|
+
</>
|
|
79
|
+
)}
|
|
80
|
+
{description && serializeNodes(description)}
|
|
81
|
+
</div>
|
|
82
|
+
);
|
|
83
|
+
};
|
|
84
|
+
|
|
85
|
+
export default ExtraViews;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/* eslint-disable */
|
|
2
2
|
import React from 'react';
|
|
3
|
-
import { withDeviceSize } from '
|
|
3
|
+
import { withDeviceSize } from '../hocs';
|
|
4
4
|
import { loadModules } from 'esri-loader';
|
|
5
5
|
import { formatQuery } from 'react-querybuilder';
|
|
6
6
|
|
|
@@ -20,8 +20,8 @@ const Webmap = (props) => {
|
|
|
20
20
|
const { editMode, height, id } = props;
|
|
21
21
|
|
|
22
22
|
const data = React.useMemo(() => props.data || {}, [props.data]);
|
|
23
|
-
const device = React.useMemo(() => props.device || {}, [props.device]);
|
|
24
23
|
|
|
24
|
+
const device = React.useMemo(() => props.device || {}, [props.device]);
|
|
25
25
|
const { base = {}, layers = {}, legend = {}, general = {} } = data;
|
|
26
26
|
|
|
27
27
|
const { base_layer = '' } = base;
|
|
@@ -32,6 +32,7 @@ const Webmap = (props) => {
|
|
|
32
32
|
layers.map_layers
|
|
33
33
|
.filter(({ map_layer }) => map_layer)
|
|
34
34
|
.map((l, i) => l.map_layer);
|
|
35
|
+
|
|
35
36
|
const options = {
|
|
36
37
|
css: true,
|
|
37
38
|
};
|
|
@@ -86,34 +87,35 @@ const Webmap = (props) => {
|
|
|
86
87
|
Zoom,
|
|
87
88
|
} = modules;
|
|
88
89
|
let layers =
|
|
89
|
-
map_layers &&
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
90
|
+
map_layers && map_layers.length > 0
|
|
91
|
+
? map_layers
|
|
92
|
+
.filter(({ map_service_url, layer }) => map_service_url && layer)
|
|
93
|
+
.map(({ map_service_url, layer, query = '' }) => {
|
|
94
|
+
const url = `${map_service_url}/${layer}`;
|
|
95
|
+
let mapLayer;
|
|
96
|
+
switch (layer.type) {
|
|
97
|
+
case 'Raster Layer':
|
|
98
|
+
mapLayer = new MapImageLayer({
|
|
99
|
+
url: map_service_url,
|
|
100
|
+
});
|
|
101
|
+
break;
|
|
102
|
+
case 'Feature Layer':
|
|
103
|
+
mapLayer = new FeatureLayer({
|
|
104
|
+
url,
|
|
105
|
+
definitionExpression: query
|
|
106
|
+
? formatQuery(query, 'sql')
|
|
107
|
+
: '',
|
|
108
|
+
});
|
|
109
|
+
break;
|
|
110
|
+
case 'Group Layer':
|
|
111
|
+
mapLayer = new GroupLayer({ url });
|
|
112
|
+
break;
|
|
113
|
+
default:
|
|
114
|
+
break;
|
|
115
|
+
}
|
|
116
|
+
return mapLayer;
|
|
117
|
+
})
|
|
118
|
+
: [];
|
|
117
119
|
const map = new Map({
|
|
118
120
|
basemap: base_layer || 'hybrid',
|
|
119
121
|
layers,
|
|
@@ -193,7 +195,7 @@ const Webmap = (props) => {
|
|
|
193
195
|
});
|
|
194
196
|
}
|
|
195
197
|
return { view, map };
|
|
196
|
-
}, [modules,
|
|
198
|
+
}, [modules, data, data.layers, map_layers]);
|
|
197
199
|
|
|
198
200
|
return (
|
|
199
201
|
<div>
|
package/src/components/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
export EEAMapView from './Blocks/EEAMap/View';
|
|
2
|
+
export EEAMapEdit from './Blocks/EEAMap/Edit';
|
|
3
|
+
export Webmap from './Webmap';
|
|
4
|
+
export ExtraViews from './ExtraViews';
|
|
3
5
|
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
export { EEAMapEdit, EEAMapView, EmbedMapView, EmbedMapEdit };
|
|
6
|
+
export EmbedMapView from './Blocks/EmbedEEAMap/View';
|
|
7
|
+
export EmbedMapEdit from './Blocks/EmbedEEAMap/Edit';
|