@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
|
@@ -0,0 +1,151 @@
|
|
|
1
|
+
import { base_layers } from '../../constants';
|
|
2
|
+
|
|
3
|
+
const BaseLayerSchema = {
|
|
4
|
+
title: 'Base Layer',
|
|
5
|
+
fieldsets: [
|
|
6
|
+
{
|
|
7
|
+
id: 'base',
|
|
8
|
+
title: 'Base Layer',
|
|
9
|
+
fields: ['base_layer'],
|
|
10
|
+
},
|
|
11
|
+
],
|
|
12
|
+
properties: {
|
|
13
|
+
base_layer: {
|
|
14
|
+
title: 'Base Layer',
|
|
15
|
+
choices: base_layers,
|
|
16
|
+
},
|
|
17
|
+
},
|
|
18
|
+
required: [],
|
|
19
|
+
};
|
|
20
|
+
|
|
21
|
+
const LayerSchema = {
|
|
22
|
+
title: 'Layer',
|
|
23
|
+
fieldsets: [
|
|
24
|
+
{
|
|
25
|
+
id: 'default',
|
|
26
|
+
title: 'Layer',
|
|
27
|
+
fields: ['map_layer'],
|
|
28
|
+
},
|
|
29
|
+
],
|
|
30
|
+
properties: {
|
|
31
|
+
map_layer: {
|
|
32
|
+
title: 'Map layer configuration',
|
|
33
|
+
widget: 'map_layers_widget',
|
|
34
|
+
},
|
|
35
|
+
},
|
|
36
|
+
required: [],
|
|
37
|
+
};
|
|
38
|
+
|
|
39
|
+
const MapLayersSchema = {
|
|
40
|
+
title: 'Map Layers',
|
|
41
|
+
fieldsets: [
|
|
42
|
+
{
|
|
43
|
+
id: 'default',
|
|
44
|
+
title: 'Map Data',
|
|
45
|
+
fields: ['map_layers'],
|
|
46
|
+
},
|
|
47
|
+
],
|
|
48
|
+
properties: {
|
|
49
|
+
map_layers: {
|
|
50
|
+
title: 'Map Layers',
|
|
51
|
+
description: 'Add/Edit Map Layers',
|
|
52
|
+
widget: 'object_list',
|
|
53
|
+
schema: LayerSchema,
|
|
54
|
+
},
|
|
55
|
+
},
|
|
56
|
+
required: [],
|
|
57
|
+
};
|
|
58
|
+
|
|
59
|
+
const GeneralSchema = ({ data = {} }) => {
|
|
60
|
+
const centerOnExtent = data?.map_data?.general?.centerOnExtent;
|
|
61
|
+
|
|
62
|
+
return {
|
|
63
|
+
title: 'General',
|
|
64
|
+
fieldsets: [
|
|
65
|
+
{
|
|
66
|
+
id: 'default',
|
|
67
|
+
title: 'Zoom',
|
|
68
|
+
fields: [
|
|
69
|
+
'print_position',
|
|
70
|
+
'zoom_position',
|
|
71
|
+
'centerOnExtent',
|
|
72
|
+
...(!centerOnExtent ? ['zoom_level', 'long', 'lat'] : []),
|
|
73
|
+
],
|
|
74
|
+
},
|
|
75
|
+
],
|
|
76
|
+
properties: {
|
|
77
|
+
centerOnExtent: {
|
|
78
|
+
title: 'Center on extent',
|
|
79
|
+
type: 'boolean',
|
|
80
|
+
description:
|
|
81
|
+
'This will override latitude/longitude/zoom level and will lock zoom/moving the map.',
|
|
82
|
+
},
|
|
83
|
+
zoom_position: {
|
|
84
|
+
title: 'Zoom position',
|
|
85
|
+
choices: ['bottom-right', 'bottom-left', 'top-right', 'top-left'].map(
|
|
86
|
+
(n) => {
|
|
87
|
+
return [n, n];
|
|
88
|
+
},
|
|
89
|
+
),
|
|
90
|
+
},
|
|
91
|
+
zoom_level: {
|
|
92
|
+
title: 'Zoom level',
|
|
93
|
+
type: 'number',
|
|
94
|
+
},
|
|
95
|
+
long: {
|
|
96
|
+
title: 'Longitude',
|
|
97
|
+
type: 'number',
|
|
98
|
+
},
|
|
99
|
+
lat: {
|
|
100
|
+
title: 'Latitude',
|
|
101
|
+
type: 'number',
|
|
102
|
+
},
|
|
103
|
+
|
|
104
|
+
print_position: {
|
|
105
|
+
title: 'Print position',
|
|
106
|
+
choices: ['bottom-right', 'bottom-left', 'top-right', 'top-left'].map(
|
|
107
|
+
(n) => {
|
|
108
|
+
return [n, n];
|
|
109
|
+
},
|
|
110
|
+
),
|
|
111
|
+
},
|
|
112
|
+
},
|
|
113
|
+
required: [],
|
|
114
|
+
};
|
|
115
|
+
};
|
|
116
|
+
|
|
117
|
+
export default ({ data = {} }) => {
|
|
118
|
+
const generalSchema = GeneralSchema({ data });
|
|
119
|
+
|
|
120
|
+
return {
|
|
121
|
+
title: 'Map Editor',
|
|
122
|
+
fieldsets: [
|
|
123
|
+
{
|
|
124
|
+
id: 'default',
|
|
125
|
+
title: 'Map Editor Sections',
|
|
126
|
+
fields: ['map_data'],
|
|
127
|
+
},
|
|
128
|
+
],
|
|
129
|
+
properties: {
|
|
130
|
+
map_data: {
|
|
131
|
+
title: 'Panels',
|
|
132
|
+
widget: 'object_types_widget',
|
|
133
|
+
schemas: [
|
|
134
|
+
{
|
|
135
|
+
id: 'general',
|
|
136
|
+
schema: generalSchema,
|
|
137
|
+
},
|
|
138
|
+
{
|
|
139
|
+
id: 'base',
|
|
140
|
+
schema: BaseLayerSchema,
|
|
141
|
+
},
|
|
142
|
+
{
|
|
143
|
+
id: 'layers',
|
|
144
|
+
schema: MapLayersSchema,
|
|
145
|
+
},
|
|
146
|
+
],
|
|
147
|
+
},
|
|
148
|
+
},
|
|
149
|
+
required: [],
|
|
150
|
+
};
|
|
151
|
+
};
|
package/src/constants.js
CHANGED
|
@@ -1 +1,29 @@
|
|
|
1
|
-
|
|
1
|
+
const positions = ['bottom-right', 'bottom-left', 'top-right', 'top-left'].map(
|
|
2
|
+
(n) => {
|
|
3
|
+
return { key: n, value: n, text: n };
|
|
4
|
+
},
|
|
5
|
+
);
|
|
6
|
+
|
|
7
|
+
const base_layers = [
|
|
8
|
+
'dark-gray',
|
|
9
|
+
'dark-gray-vector',
|
|
10
|
+
'gray',
|
|
11
|
+
'gray-vector',
|
|
12
|
+
'hybrid',
|
|
13
|
+
'national-geographic',
|
|
14
|
+
'oceans',
|
|
15
|
+
'osm',
|
|
16
|
+
'satellite',
|
|
17
|
+
'streets',
|
|
18
|
+
'streets-navigation-vector',
|
|
19
|
+
'streets-night-vector',
|
|
20
|
+
'streets-relief-vector',
|
|
21
|
+
'streets-vector',
|
|
22
|
+
'terrain',
|
|
23
|
+
'topo',
|
|
24
|
+
'topo-vector',
|
|
25
|
+
].map((n) => {
|
|
26
|
+
return [n, n];
|
|
27
|
+
});
|
|
28
|
+
|
|
29
|
+
export { positions, base_layers };
|
package/src/index.js
CHANGED
|
@@ -1,16 +1,13 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
EmbedMapView,
|
|
5
|
-
EmbedMapEdit,
|
|
6
|
-
} from '@eeacms/volto-eea-map/components';
|
|
1
|
+
import EmbedMapView from './components/Blocks/EmbedEEAMap/View';
|
|
2
|
+
import EmbedMapEdit from './components/Blocks/EmbedEEAMap/Edit';
|
|
3
|
+
|
|
7
4
|
import world from '@plone/volto/icons/world.svg';
|
|
8
|
-
import DataQueryWidget from './components/
|
|
9
|
-
import LayerSelectWidget from './components/
|
|
10
|
-
import MapEditorWidget from './components/
|
|
11
|
-
import ObjectTypesWidget from './components/
|
|
12
|
-
import VisualizationEditorWidget from './components/
|
|
13
|
-
import VisualizationView from './components/
|
|
5
|
+
import DataQueryWidget from './components/widgets/DataQueryWidget';
|
|
6
|
+
import LayerSelectWidget from './components/widgets/LayerSelectWidget';
|
|
7
|
+
import MapEditorWidget from './components/widgets/MapEditorWidget';
|
|
8
|
+
import ObjectTypesWidget from './components/widgets/ObjectTypesWidget';
|
|
9
|
+
import VisualizationEditorWidget from './components/visualization/VisualizationEditorWidget';
|
|
10
|
+
import VisualizationView from './components/visualization/VisualizationView';
|
|
14
11
|
|
|
15
12
|
import { data_visualizations } from './middlewares';
|
|
16
13
|
import * as addonReducers from './reducers';
|
|
@@ -31,33 +28,36 @@ export default (config) => {
|
|
|
31
28
|
'noise.discomap.eea.europa.eu',
|
|
32
29
|
'copernicus.discomap.eea.europa.eu',
|
|
33
30
|
];
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
31
|
+
|
|
32
|
+
// EEA MAP BLOCK
|
|
33
|
+
|
|
34
|
+
// config.blocks.blocksConfig.eea_map_block = {
|
|
35
|
+
// id: 'eea_map_block', // The name (id) of the block
|
|
36
|
+
// title: 'EEA Map', // The display name of the block
|
|
37
|
+
// icon: world, // The icon used in the block chooser
|
|
38
|
+
// group: 'common', //The group (blocks can be grouped, displayed in the chooser)
|
|
39
|
+
// view: EEAMapView, //The view mode component
|
|
40
|
+
// edit: EEAMapEdit, // The edit mode component
|
|
41
|
+
// sidebarTab: 1, // The sidebar tab you want to be selected when selecting the block
|
|
42
|
+
// security: {
|
|
43
|
+
// addPermission: [], // Future proof (not implemented yet) add user permission role(s)
|
|
44
|
+
// view: [], //Future proof (not implemented yet) view user role(s)
|
|
45
|
+
// },
|
|
46
|
+
// variations: [
|
|
47
|
+
// {
|
|
48
|
+
// id: 'default',
|
|
49
|
+
// title: 'EEA Map (default)',
|
|
50
|
+
// isDefault: true,
|
|
51
|
+
// view: EEAMapView,
|
|
52
|
+
// },
|
|
53
|
+
// {
|
|
54
|
+
// id: 'extra',
|
|
55
|
+
// title: 'Extra variation (expand if needed)',
|
|
56
|
+
// isDefault: true,
|
|
57
|
+
// view: EEAMapView,
|
|
58
|
+
// },
|
|
59
|
+
// ],
|
|
60
|
+
// };
|
|
61
61
|
|
|
62
62
|
config.blocks.blocksConfig.embed_eea_map_block = {
|
|
63
63
|
id: 'embed_eea_map_block', // The name (id) of the block
|
|
@@ -76,13 +76,13 @@ export default (config) => {
|
|
|
76
76
|
id: 'default',
|
|
77
77
|
title: 'EEA Map (default)',
|
|
78
78
|
isDefault: true,
|
|
79
|
-
view:
|
|
79
|
+
view: EmbedMapView,
|
|
80
80
|
},
|
|
81
81
|
{
|
|
82
82
|
id: 'extra',
|
|
83
83
|
title: 'Extra variation (expand if needed)',
|
|
84
84
|
isDefault: true,
|
|
85
|
-
view:
|
|
85
|
+
view: EmbedMapView,
|
|
86
86
|
},
|
|
87
87
|
],
|
|
88
88
|
};
|
package/src/middlewares/index.js
CHANGED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" width="24" height="24"><path fill="none" d="M0 0h24v24H0z"/><path d="M23 12l-7.071 7.071-1.414-1.414L20.172 12l-5.657-5.657 1.414-1.414L23 12zM3.828 12l5.657 5.657-1.414 1.414L1 12l7.071-7.071 1.414 1.414L3.828 12z"/></svg>
|
|
@@ -104,21 +104,82 @@
|
|
|
104
104
|
}
|
|
105
105
|
|
|
106
106
|
.map_source_title {
|
|
107
|
-
margin-top: 15px !important;
|
|
108
|
-
margin-bottom: 5px !important;
|
|
109
|
-
font-size: 18px;
|
|
110
107
|
font-weight: bold;
|
|
111
108
|
}
|
|
112
109
|
|
|
113
110
|
.map_source_description {
|
|
114
|
-
margin: 5px
|
|
115
|
-
font-size: 14px;
|
|
111
|
+
margin-left: 5px;
|
|
116
112
|
}
|
|
117
113
|
|
|
118
114
|
.data-query-widget-field {
|
|
119
115
|
margin: 10px 0;
|
|
120
116
|
}
|
|
121
117
|
|
|
118
|
+
.spaced-row {
|
|
119
|
+
width: 100%;
|
|
120
|
+
/* border-bottom: 1px solid lightgray; */
|
|
121
|
+
|
|
122
|
+
padding-bottom: 10px;
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
.legend-title {
|
|
126
|
+
display: flex;
|
|
127
|
+
width: fit-content;
|
|
128
|
+
align-items: center;
|
|
129
|
+
margin: 0 !important;
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
.data-param-title {
|
|
133
|
+
padding-bottom: 15px;
|
|
134
|
+
border-bottom: 1px solid lightgray;
|
|
135
|
+
font-size: 16px;
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
.data-param-values {
|
|
139
|
+
padding-bottom: 15px;
|
|
140
|
+
border-bottom: 1px solid lightgray;
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
.map-layer-description-field {
|
|
144
|
+
width: 100%;
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
.map-layer-description-field
|
|
148
|
+
> .slate_wysiwyg
|
|
149
|
+
> .grid
|
|
150
|
+
> .stretched.row
|
|
151
|
+
> .four.wide.column {
|
|
152
|
+
display: none !important;
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
.map-layer-description-field
|
|
156
|
+
> .slate_wysiwyg
|
|
157
|
+
> .grid
|
|
158
|
+
> .stretched.row
|
|
159
|
+
> .eight.wide.column {
|
|
160
|
+
width: 100% !important;
|
|
161
|
+
padding: 10px 0 !important;
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
.legend-container {
|
|
165
|
+
margin: 15px 0;
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
.map_source_param_container {
|
|
169
|
+
display: flex;
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
.extra-view-external-button {
|
|
173
|
+
color: inherit;
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
.legend-action {
|
|
177
|
+
padding: 10px;
|
|
178
|
+
border: none;
|
|
179
|
+
background: transparent;
|
|
180
|
+
cursor: pointer;
|
|
181
|
+
}
|
|
182
|
+
|
|
122
183
|
@keyframes fadeDown {
|
|
123
184
|
from {
|
|
124
185
|
opacity: 0;
|
|
@@ -1,7 +1,23 @@
|
|
|
1
1
|
/* eslint-disable no-throw-literal */
|
|
2
2
|
import { getBaseUrl } from '@plone/volto/helpers';
|
|
3
|
+
const setLegendColumns = (legendsNo, device) => {
|
|
4
|
+
switch (device) {
|
|
5
|
+
case 'widescreen':
|
|
6
|
+
return legendsNo ? legendsNo : 1;
|
|
7
|
+
case 'large':
|
|
8
|
+
return legendsNo ? legendsNo : 1;
|
|
9
|
+
case 'computer':
|
|
10
|
+
return legendsNo ? legendsNo : 1;
|
|
11
|
+
case 'tablet':
|
|
12
|
+
return 1;
|
|
13
|
+
case 'mobile':
|
|
14
|
+
return 1;
|
|
15
|
+
default:
|
|
16
|
+
return 1;
|
|
17
|
+
}
|
|
18
|
+
};
|
|
3
19
|
|
|
4
|
-
const
|
|
20
|
+
const fetchArcGISData = async (url) => {
|
|
5
21
|
const res = await fetch(`${getBaseUrl('')}/cors-proxy/${url}?f=json`);
|
|
6
22
|
if (res.status !== 200) {
|
|
7
23
|
const error = await res.json();
|
|
@@ -14,4 +30,4 @@ const fetchArcgisData = async (url) => {
|
|
|
14
30
|
return data;
|
|
15
31
|
};
|
|
16
32
|
|
|
17
|
-
export {
|
|
33
|
+
export { setLegendColumns, fetchArcGISData };
|
|
@@ -1,46 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { FormFieldWrapper, Field } from '@plone/volto/components';
|
|
3
|
-
|
|
4
|
-
const DataQueryWidget = (props) => {
|
|
5
|
-
const { value, onChange, id } = props;
|
|
6
|
-
|
|
7
|
-
const onChangeAlias = (fieldId, fieldValue) => {
|
|
8
|
-
let altValue = value;
|
|
9
|
-
value[fieldId] = { ...value[fieldId], alias: fieldValue };
|
|
10
|
-
onChange(id, altValue);
|
|
11
|
-
};
|
|
12
|
-
|
|
13
|
-
return (
|
|
14
|
-
<div>
|
|
15
|
-
<FormFieldWrapper {...props} noForInFieldLabel></FormFieldWrapper>
|
|
16
|
-
<div className="data-query-widget-field">
|
|
17
|
-
{value && value.length > 0 ? (
|
|
18
|
-
value.map((param, i) => (
|
|
19
|
-
<div key={i}>
|
|
20
|
-
<h5 style={{ fontWeight: 'bold' }}>{param.i}</h5>
|
|
21
|
-
<Field
|
|
22
|
-
id={i}
|
|
23
|
-
title="Alias"
|
|
24
|
-
type="string"
|
|
25
|
-
description="Data connector parameter alias for matchings. Default is {Key}"
|
|
26
|
-
onChange={onChangeAlias}
|
|
27
|
-
value={param?.alias}
|
|
28
|
-
/>
|
|
29
|
-
<Field
|
|
30
|
-
id={param.i}
|
|
31
|
-
title="Values"
|
|
32
|
-
type="string"
|
|
33
|
-
description="Parameter value/s"
|
|
34
|
-
value={param.v.join(',')}
|
|
35
|
-
/>
|
|
36
|
-
</div>
|
|
37
|
-
))
|
|
38
|
-
) : (
|
|
39
|
-
<p style={{ textAlign: 'center' }}>No parameters set</p>
|
|
40
|
-
)}
|
|
41
|
-
</div>
|
|
42
|
-
</div>
|
|
43
|
-
);
|
|
44
|
-
};
|
|
45
|
-
|
|
46
|
-
export default DataQueryWidget;
|
|
@@ -1,86 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { Button } from 'semantic-ui-react';
|
|
3
|
-
import { Icon, UniversalLink } from '@plone/volto/components';
|
|
4
|
-
|
|
5
|
-
import LegendWidget from './LegendWidget';
|
|
6
|
-
import { serializeNodes } from 'volto-slate/editor/render';
|
|
7
|
-
|
|
8
|
-
import worldSVG from '@plone/volto/icons/world.svg';
|
|
9
|
-
import downloadSVG from '@plone/volto/icons/download.svg';
|
|
10
|
-
|
|
11
|
-
const ExtraViews = ({ data }) => {
|
|
12
|
-
const {
|
|
13
|
-
map_data = {},
|
|
14
|
-
description,
|
|
15
|
-
show_legend,
|
|
16
|
-
show_download,
|
|
17
|
-
show_viewer,
|
|
18
|
-
show_sources,
|
|
19
|
-
data_provenance = {},
|
|
20
|
-
} = data;
|
|
21
|
-
return (
|
|
22
|
-
<div className="extra-eea-map-content">
|
|
23
|
-
{map_data &&
|
|
24
|
-
map_data.layers?.map_layers[0] &&
|
|
25
|
-
(show_download || show_viewer) && (
|
|
26
|
-
<div
|
|
27
|
-
style={{ display: 'flex', justifyContent: 'end', margin: '10px 0' }}
|
|
28
|
-
>
|
|
29
|
-
{show_download && (
|
|
30
|
-
<a
|
|
31
|
-
target="_blank"
|
|
32
|
-
rel="noreferrer"
|
|
33
|
-
href={`${map_data.layers.map_layers[0].map_layer.map_service_url}?f=lyr&v=9.3`}
|
|
34
|
-
>
|
|
35
|
-
<Button size="tiny">
|
|
36
|
-
<Button.Content>
|
|
37
|
-
<Icon name={downloadSVG} title="Download" size="25px" />
|
|
38
|
-
</Button.Content>
|
|
39
|
-
</Button>
|
|
40
|
-
</a>
|
|
41
|
-
)}
|
|
42
|
-
{show_viewer && (
|
|
43
|
-
<a
|
|
44
|
-
target="_blank"
|
|
45
|
-
rel="noreferrer"
|
|
46
|
-
href={
|
|
47
|
-
`https://www.arcgis.com/home/webmap/viewer.html?url=` +
|
|
48
|
-
`${map_data.layers.map_layers[0].map_layer.map_service_url}&source=sd`
|
|
49
|
-
}
|
|
50
|
-
>
|
|
51
|
-
<Button size="tiny">
|
|
52
|
-
<Button.Content>
|
|
53
|
-
<Icon name={worldSVG} title="View map" size="25px" />
|
|
54
|
-
</Button.Content>
|
|
55
|
-
</Button>
|
|
56
|
-
</a>
|
|
57
|
-
)}
|
|
58
|
-
</div>
|
|
59
|
-
)}
|
|
60
|
-
{show_legend && map_data && <LegendWidget data={map_data} />}
|
|
61
|
-
{show_sources && (
|
|
62
|
-
<>
|
|
63
|
-
{data_provenance &&
|
|
64
|
-
data_provenance.data &&
|
|
65
|
-
data_provenance.data.length > 0 ? (
|
|
66
|
-
<div>
|
|
67
|
-
<h3>Sources:</h3>
|
|
68
|
-
{data_provenance.data.map((data, i) => (
|
|
69
|
-
<div key={i}>
|
|
70
|
-
<p className="map_source_title">{data.title}</p>
|
|
71
|
-
<p className="map_source_description">{data.organisation}</p>
|
|
72
|
-
<UniversalLink href={data.link}>{data.link} </UniversalLink>
|
|
73
|
-
</div>
|
|
74
|
-
))}
|
|
75
|
-
</div>
|
|
76
|
-
) : (
|
|
77
|
-
<p>Data provenance is not set for visualization used or page</p>
|
|
78
|
-
)}
|
|
79
|
-
</>
|
|
80
|
-
)}
|
|
81
|
-
{description && serializeNodes(description)}
|
|
82
|
-
</div>
|
|
83
|
-
);
|
|
84
|
-
};
|
|
85
|
-
|
|
86
|
-
export default ExtraViews;
|
|
@@ -1,94 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { Modal, Button, Grid } from 'semantic-ui-react';
|
|
3
|
-
import Webmap from '../Webmap';
|
|
4
|
-
import { FormFieldWrapper, InlineForm } from '@plone/volto/components';
|
|
5
|
-
import { VisibilitySensor } from '@eeacms/volto-datablocks/components';
|
|
6
|
-
|
|
7
|
-
import PanelsSchema from './panelsSchema';
|
|
8
|
-
|
|
9
|
-
const VisualizationEditorWidget = (props) => {
|
|
10
|
-
const [open, setOpen] = React.useState(false);
|
|
11
|
-
const { onChange = {}, id } = props;
|
|
12
|
-
const block = React.useMemo(() => props.block, [props.block]);
|
|
13
|
-
const value = React.useMemo(() => props.value, [props.value]);
|
|
14
|
-
|
|
15
|
-
const [intValue, setIntValue] = React.useState(value);
|
|
16
|
-
|
|
17
|
-
const dataForm = { map_data: intValue };
|
|
18
|
-
const handleApplyChanges = () => {
|
|
19
|
-
onChange(id, intValue);
|
|
20
|
-
setOpen(false);
|
|
21
|
-
};
|
|
22
|
-
|
|
23
|
-
const handleClose = () => {
|
|
24
|
-
setIntValue(value);
|
|
25
|
-
setOpen(false);
|
|
26
|
-
};
|
|
27
|
-
|
|
28
|
-
const handleChangeField = (id, fieldVal) => {
|
|
29
|
-
setIntValue(fieldVal);
|
|
30
|
-
};
|
|
31
|
-
|
|
32
|
-
let schema = PanelsSchema({ data: dataForm });
|
|
33
|
-
|
|
34
|
-
return (
|
|
35
|
-
<FormFieldWrapper {...props}>
|
|
36
|
-
<Button
|
|
37
|
-
floated="right"
|
|
38
|
-
size="tiny"
|
|
39
|
-
onClick={(e) => {
|
|
40
|
-
e.preventDefault();
|
|
41
|
-
e.stopPropagation();
|
|
42
|
-
setOpen(true);
|
|
43
|
-
}}
|
|
44
|
-
>
|
|
45
|
-
Open Map Editor
|
|
46
|
-
</Button>
|
|
47
|
-
{open && (
|
|
48
|
-
<Modal
|
|
49
|
-
id="map-editor-modal"
|
|
50
|
-
style={{ width: '95% !important' }}
|
|
51
|
-
open={true}
|
|
52
|
-
>
|
|
53
|
-
<Modal.Content scrolling>
|
|
54
|
-
<Grid>
|
|
55
|
-
<Grid.Row>
|
|
56
|
-
<Grid.Column width={4}>
|
|
57
|
-
<InlineForm
|
|
58
|
-
block={block}
|
|
59
|
-
title={schema.title}
|
|
60
|
-
schema={schema}
|
|
61
|
-
onChangeField={(id, value) => {
|
|
62
|
-
handleChangeField(id, value);
|
|
63
|
-
}}
|
|
64
|
-
formData={dataForm}
|
|
65
|
-
/>
|
|
66
|
-
</Grid.Column>
|
|
67
|
-
<Grid.Column width={8}>
|
|
68
|
-
<VisibilitySensor>
|
|
69
|
-
<Webmap data={intValue} editMode={true} />
|
|
70
|
-
</VisibilitySensor>
|
|
71
|
-
</Grid.Column>
|
|
72
|
-
</Grid.Row>
|
|
73
|
-
</Grid>
|
|
74
|
-
</Modal.Content>
|
|
75
|
-
<Modal.Actions>
|
|
76
|
-
<Grid>
|
|
77
|
-
<Grid.Row>
|
|
78
|
-
<Grid.Column width={8}></Grid.Column>
|
|
79
|
-
<Grid.Column width={4}>
|
|
80
|
-
<Button onClick={() => handleClose()}>Close</Button>
|
|
81
|
-
<Button color="green" onClick={() => handleApplyChanges()}>
|
|
82
|
-
Apply changes
|
|
83
|
-
</Button>
|
|
84
|
-
</Grid.Column>
|
|
85
|
-
</Grid.Row>
|
|
86
|
-
</Grid>
|
|
87
|
-
</Modal.Actions>
|
|
88
|
-
</Modal>
|
|
89
|
-
)}
|
|
90
|
-
</FormFieldWrapper>
|
|
91
|
-
);
|
|
92
|
-
};
|
|
93
|
-
|
|
94
|
-
export default VisualizationEditorWidget;
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
const positions = ['bottom-right', 'bottom-left', 'top-right', 'top-left'].map(
|
|
2
|
-
(n) => {
|
|
3
|
-
return { key: n, value: n, text: n };
|
|
4
|
-
},
|
|
5
|
-
);
|
|
6
|
-
|
|
7
|
-
const base_layers = [
|
|
8
|
-
'dark-gray',
|
|
9
|
-
'dark-gray-vector',
|
|
10
|
-
'gray',
|
|
11
|
-
'gray-vector',
|
|
12
|
-
'hybrid',
|
|
13
|
-
'national-geographic',
|
|
14
|
-
'oceans',
|
|
15
|
-
'osm',
|
|
16
|
-
'satellite',
|
|
17
|
-
'streets',
|
|
18
|
-
'streets-navigation-vector',
|
|
19
|
-
'streets-night-vector',
|
|
20
|
-
'streets-relief-vector',
|
|
21
|
-
'streets-vector',
|
|
22
|
-
'terrain',
|
|
23
|
-
'topo',
|
|
24
|
-
'topo-vector',
|
|
25
|
-
].map((n) => {
|
|
26
|
-
return [n, n];
|
|
27
|
-
});
|
|
28
|
-
|
|
29
|
-
export { positions, base_layers };
|