@eeacms/volto-eea-map 4.1.0 → 5.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 +29 -0
- package/package.json +5 -2
- package/src/Arcgis/Editor/Editor.jsx +130 -0
- package/src/Arcgis/Editor/EditorContext.jsx +2 -0
- package/src/Arcgis/Editor/Fold/Fold.jsx +56 -0
- package/src/Arcgis/Editor/Panels/Panel.jsx +8 -0
- package/src/Arcgis/Editor/Panels/SettingsGeneralPanel.jsx +217 -0
- package/src/Arcgis/Editor/Panels/SettingsLayersPanel.jsx +216 -0
- package/src/Arcgis/Editor/Panels/StructureBaseLayerPanel.jsx +60 -0
- package/src/Arcgis/Editor/Panels/StructureLayersPanel.jsx +394 -0
- package/src/Arcgis/Editor/Panels/StructureWidgetsPanel.jsx +181 -0
- package/src/Arcgis/Editor/Panels/index.js +6 -0
- package/src/Arcgis/Editor/SidebarGroup.jsx +62 -0
- package/src/Arcgis/Layer/Layer.jsx +247 -0
- package/src/Arcgis/Map/Map.jsx +287 -0
- package/src/Arcgis/Map/MapBuilder.jsx +111 -0
- package/src/Arcgis/Map/MapContext.jsx +3 -0
- package/src/Arcgis/Widget/Widget.jsx +170 -0
- package/src/Arcgis/helpers.js +140 -0
- package/src/Blocks/EmbedEEAMap/Edit.jsx +40 -0
- package/src/Blocks/EmbedEEAMap/View.jsx +122 -0
- package/src/Blocks/EmbedEEAMap/helpers.js +12 -0
- package/src/Blocks/EmbedEEAMap/schema.js +126 -0
- package/src/{components → Toolbar}/Share.jsx +1 -1
- package/src/{components/ExtraViews.jsx → Toolbar/Toolbar.jsx} +14 -16
- package/src/{components/visualization → Views}/VisualizationView.jsx +8 -9
- package/src/Widgets/ArcgisColorPickerWidget.jsx +95 -0
- package/src/Widgets/ArcgisRendererWidget/ArcgisRendererWidget.jsx +106 -0
- package/src/Widgets/ArcgisRendererWidget/RendererEditor/ClassBreaks.jsx +8 -0
- package/src/Widgets/ArcgisRendererWidget/RendererEditor/Dictionary.jsx +8 -0
- package/src/Widgets/ArcgisRendererWidget/RendererEditor/DotDensity.jsx +8 -0
- package/src/Widgets/ArcgisRendererWidget/RendererEditor/Heatmap.jsx +8 -0
- package/src/Widgets/ArcgisRendererWidget/RendererEditor/PieChart.jsx +8 -0
- package/src/Widgets/ArcgisRendererWidget/RendererEditor/Simple.jsx +109 -0
- package/src/Widgets/ArcgisRendererWidget/RendererEditor/UniqueValue.jsx +8 -0
- package/src/Widgets/ArcgisRendererWidget/RendererEditor/_Editor.jsx +29 -0
- package/src/Widgets/ArcgisRendererWidget/RendererEditor/_EditorModal.jsx +88 -0
- package/src/Widgets/ArcgisRendererWidget/RendererEditor/_defaults.js +30 -0
- package/src/Widgets/ArcgisSliderWidget.jsx +79 -0
- package/src/Widgets/ArcgisViewpointWidget.jsx +112 -0
- package/src/{components/visualization → Widgets}/VisualizationViewWidget.jsx +9 -10
- package/src/Widgets/VisualizationWidget.jsx +200 -0
- package/src/arcgis.js +48 -0
- package/src/constants.js +225 -7
- package/src/hocs/withArcgis.jsx +27 -0
- package/src/hooks/useChangedProps.jsx +24 -0
- package/src/hooks/useClass.jsx +17 -0
- package/src/hooks/useCopyToClipboard.jsx +25 -0
- package/src/index.js +16 -16
- package/src/jsoneditor.js +72 -0
- package/src/styles/editor.less +446 -0
- package/src/styles/map.less +3 -0
- package/src/components/Blocks/EmbedEEAMap/Edit.jsx +0 -161
- package/src/components/Blocks/EmbedEEAMap/Schema.js +0 -161
- package/src/components/Blocks/EmbedEEAMap/View.jsx +0 -79
- package/src/components/Blocks/EmbedEEAMap/helpers.js +0 -45
- package/src/components/LegendView.jsx +0 -150
- package/src/components/Webmap.jsx +0 -371
- package/src/components/index.js +0 -6
- package/src/components/visualization/VisualizationEditorWidget.jsx +0 -122
- package/src/components/visualization/panelsSchema.js +0 -229
- package/src/components/widgets/DataQueryWidget.jsx +0 -51
- package/src/components/widgets/LayerSelectWidget.jsx +0 -463
- package/src/components/widgets/LayersPanelWidget.jsx +0 -59
- package/src/components/widgets/SimpleColorPickerWidget.jsx +0 -121
- package/src/hocs/index.js +0 -3
- package/src/hocs/withDeviceSize.jsx +0 -45
- package/src/less/global.less +0 -253
- package/src/less/variables.less +0 -5
- package/src/utils.js +0 -151
- /package/src/{components → Toolbar}/FigureNote.jsx +0 -0
- /package/src/{components → Toolbar}/MoreInfoLink.jsx +0 -0
- /package/src/{components → Toolbar}/Sources.jsx +0 -0
|
@@ -1,371 +0,0 @@
|
|
|
1
|
-
/* eslint-disable */
|
|
2
|
-
import React from 'react';
|
|
3
|
-
import { withDeviceSize } from '../hocs';
|
|
4
|
-
import { loadModules } from 'esri-loader';
|
|
5
|
-
|
|
6
|
-
const MODULES = [
|
|
7
|
-
'esri/Map',
|
|
8
|
-
'esri/views/MapView',
|
|
9
|
-
'esri/layers/FeatureLayer',
|
|
10
|
-
'esri/layers/MapImageLayer',
|
|
11
|
-
'esri/layers/GroupLayer',
|
|
12
|
-
'esri/layers/WebTileLayer',
|
|
13
|
-
'esri/Basemap',
|
|
14
|
-
'esri/widgets/Legend',
|
|
15
|
-
'esri/widgets/Expand',
|
|
16
|
-
'esri/widgets/Print',
|
|
17
|
-
'esri/widgets/Zoom',
|
|
18
|
-
'esri/widgets/ScaleBar',
|
|
19
|
-
'esri/widgets/Fullscreen',
|
|
20
|
-
];
|
|
21
|
-
|
|
22
|
-
const Webmap = (props) => {
|
|
23
|
-
const editMode = props && props.editMode ? props.editMode : false;
|
|
24
|
-
const height = props && props.height ? props.height : '';
|
|
25
|
-
const id = props && props.id ? props.id : '';
|
|
26
|
-
const device = props && props.device ? props.device : {};
|
|
27
|
-
const data = props && props.data ? props.data : {};
|
|
28
|
-
|
|
29
|
-
const layers =
|
|
30
|
-
props && props.data && props.data.layers ? props.data.layers : {};
|
|
31
|
-
const base = props && props.data && props.data.base ? props.data.base : {};
|
|
32
|
-
const general =
|
|
33
|
-
props && props.data && props.data.general ? props.data.general : {};
|
|
34
|
-
const styles =
|
|
35
|
-
props && props.data && props.data.styles ? props.data.styles : {};
|
|
36
|
-
const base_layer = base && base.base_layer ? base.base_layer : '';
|
|
37
|
-
|
|
38
|
-
const map_layers =
|
|
39
|
-
layers &&
|
|
40
|
-
layers.map_layers &&
|
|
41
|
-
layers.map_layers
|
|
42
|
-
.filter(({ map_layer }) => map_layer)
|
|
43
|
-
.map((l, i) => l.map_layer);
|
|
44
|
-
|
|
45
|
-
const mapRef = React.useRef();
|
|
46
|
-
const [modules, setModules] = React.useState({});
|
|
47
|
-
const [reactQueryBuilder, setReactQueryBuilder] = React.useState(null);
|
|
48
|
-
|
|
49
|
-
const modules_loaded = React.useRef(false);
|
|
50
|
-
|
|
51
|
-
React.useEffect(() => {
|
|
52
|
-
if (!modules_loaded.current) {
|
|
53
|
-
modules_loaded.current = true;
|
|
54
|
-
import(
|
|
55
|
-
/* webpackChunkName: "react-querybuilder" */ 'react-querybuilder'
|
|
56
|
-
).then((module) => {
|
|
57
|
-
setReactQueryBuilder(module);
|
|
58
|
-
});
|
|
59
|
-
|
|
60
|
-
loadModules(MODULES, {
|
|
61
|
-
css: true,
|
|
62
|
-
}).then((modules) => {
|
|
63
|
-
const [
|
|
64
|
-
MapBlock,
|
|
65
|
-
MapView,
|
|
66
|
-
FeatureLayer,
|
|
67
|
-
MapImageLayer,
|
|
68
|
-
GroupLayer,
|
|
69
|
-
WebTileLayer,
|
|
70
|
-
Basemap,
|
|
71
|
-
Legend,
|
|
72
|
-
Expand,
|
|
73
|
-
Print,
|
|
74
|
-
Zoom,
|
|
75
|
-
ScaleBar,
|
|
76
|
-
Fullscreen,
|
|
77
|
-
] = modules;
|
|
78
|
-
setModules({
|
|
79
|
-
MapBlock,
|
|
80
|
-
MapView,
|
|
81
|
-
FeatureLayer,
|
|
82
|
-
MapImageLayer,
|
|
83
|
-
GroupLayer,
|
|
84
|
-
WebTileLayer,
|
|
85
|
-
Basemap,
|
|
86
|
-
Legend,
|
|
87
|
-
Expand,
|
|
88
|
-
Print,
|
|
89
|
-
Zoom,
|
|
90
|
-
ScaleBar,
|
|
91
|
-
Fullscreen,
|
|
92
|
-
});
|
|
93
|
-
});
|
|
94
|
-
}
|
|
95
|
-
}, [setModules]);
|
|
96
|
-
|
|
97
|
-
var customFeatureLayerRenderer = {
|
|
98
|
-
type: 'simple', // autocasts as new SimpleRenderer()
|
|
99
|
-
symbol: {
|
|
100
|
-
type: 'simple-fill', // autocasts as new SimpleFillSymbol()
|
|
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)',
|
|
110
|
-
style: 'solid',
|
|
111
|
-
outline: {
|
|
112
|
-
// autocasts as new SimpleLineSymbol()
|
|
113
|
-
color: styles?.outline_color
|
|
114
|
-
? styles?.outline_color?.rgb
|
|
115
|
-
: {
|
|
116
|
-
r: 0,
|
|
117
|
-
g: 0,
|
|
118
|
-
b: 0,
|
|
119
|
-
a: 1,
|
|
120
|
-
},
|
|
121
|
-
width: styles?.outline_width ? styles?.outline_width : 1,
|
|
122
|
-
},
|
|
123
|
-
},
|
|
124
|
-
};
|
|
125
|
-
//eslint-disable-next-line no-unused-vars
|
|
126
|
-
const esri = React.useMemo(() => {
|
|
127
|
-
if (Object.keys(modules).length === 0) return {};
|
|
128
|
-
const {
|
|
129
|
-
MapBlock,
|
|
130
|
-
MapView,
|
|
131
|
-
FeatureLayer,
|
|
132
|
-
MapImageLayer,
|
|
133
|
-
GroupLayer,
|
|
134
|
-
WebTileLayer,
|
|
135
|
-
Basemap,
|
|
136
|
-
Legend,
|
|
137
|
-
Expand,
|
|
138
|
-
Print,
|
|
139
|
-
Zoom,
|
|
140
|
-
ScaleBar,
|
|
141
|
-
Fullscreen,
|
|
142
|
-
} = modules;
|
|
143
|
-
let layers =
|
|
144
|
-
map_layers && map_layers.length > 0
|
|
145
|
-
? map_layers
|
|
146
|
-
.filter(({ map_service_url, layer }) => map_service_url && layer)
|
|
147
|
-
.map(
|
|
148
|
-
(
|
|
149
|
-
{
|
|
150
|
-
map_service_url = '',
|
|
151
|
-
layer,
|
|
152
|
-
fullLayer,
|
|
153
|
-
query = '',
|
|
154
|
-
opacity = 1,
|
|
155
|
-
maxScaleOverride = '',
|
|
156
|
-
minScaleOverride = '',
|
|
157
|
-
},
|
|
158
|
-
index,
|
|
159
|
-
) => {
|
|
160
|
-
const url = `${map_service_url}/${layer?.id}`;
|
|
161
|
-
let mapLayer;
|
|
162
|
-
switch (layer.type) {
|
|
163
|
-
case 'Raster Layer':
|
|
164
|
-
mapLayer = new MapImageLayer({
|
|
165
|
-
url: map_service_url,
|
|
166
|
-
sublayers: [
|
|
167
|
-
{
|
|
168
|
-
id: layer.id,
|
|
169
|
-
minScale: minScaleOverride
|
|
170
|
-
? minScaleOverride
|
|
171
|
-
: layer?.minScale,
|
|
172
|
-
maxScale: maxScaleOverride
|
|
173
|
-
? maxScaleOverride
|
|
174
|
-
: layer?.maxScale,
|
|
175
|
-
opacity: opacity ? parseFloat(opacity) : 1,
|
|
176
|
-
definitionExpression: query
|
|
177
|
-
? reactQueryBuilder.formatQuery(query, 'sql')
|
|
178
|
-
: '',
|
|
179
|
-
},
|
|
180
|
-
],
|
|
181
|
-
});
|
|
182
|
-
break;
|
|
183
|
-
case 'Feature Layer':
|
|
184
|
-
mapLayer = new FeatureLayer({
|
|
185
|
-
layerId: layer.id,
|
|
186
|
-
url,
|
|
187
|
-
definitionExpression: query
|
|
188
|
-
? reactQueryBuilder.formatQuery(query, 'sql')
|
|
189
|
-
: '',
|
|
190
|
-
minScale: minScaleOverride
|
|
191
|
-
? minScaleOverride
|
|
192
|
-
: layer?.minScale,
|
|
193
|
-
maxScale: maxScaleOverride
|
|
194
|
-
? maxScaleOverride
|
|
195
|
-
: layer?.maxScale,
|
|
196
|
-
opacity: opacity ? parseFloat(opacity) : 1,
|
|
197
|
-
...(styles?.override_styles && {
|
|
198
|
-
renderer: customFeatureLayerRenderer,
|
|
199
|
-
}),
|
|
200
|
-
});
|
|
201
|
-
break;
|
|
202
|
-
default:
|
|
203
|
-
break;
|
|
204
|
-
}
|
|
205
|
-
return mapLayer;
|
|
206
|
-
},
|
|
207
|
-
)
|
|
208
|
-
: [];
|
|
209
|
-
|
|
210
|
-
const generateMapBaselayer = (compositeType) => {
|
|
211
|
-
return new WebTileLayer({
|
|
212
|
-
urlTemplate: `https://gisco-services.ec.europa.eu/maps/tiles/OSM${compositeType}Composite/EPSG3857/{level}/{col}/{row}.png`,
|
|
213
|
-
});
|
|
214
|
-
};
|
|
215
|
-
|
|
216
|
-
// Create a Basemap with the WebTileLayer.
|
|
217
|
-
|
|
218
|
-
const positronCompositeBasemap = new Basemap({
|
|
219
|
-
baseLayers: [generateMapBaselayer('Positron')],
|
|
220
|
-
title: 'Positron Composite',
|
|
221
|
-
id: 'positron-composite',
|
|
222
|
-
thumbnailUrl:
|
|
223
|
-
'https://gisco-services.ec.europa.eu/maps/tiles/OSMPositronComposite/EPSG3857/0/0/0.png',
|
|
224
|
-
});
|
|
225
|
-
|
|
226
|
-
const blossomCompositeBasemap = new Basemap({
|
|
227
|
-
baseLayers: [generateMapBaselayer('Blossom')],
|
|
228
|
-
title: 'Blossom Composite',
|
|
229
|
-
id: 'blossom-composite',
|
|
230
|
-
thumbnailUrl:
|
|
231
|
-
'https://gisco-services.ec.europa.eu/maps/tiles/OSMBlossomComposite/EPSG3857/0/0/0.png',
|
|
232
|
-
});
|
|
233
|
-
|
|
234
|
-
const setBasemap = (basemap) => {
|
|
235
|
-
if (basemap === 'positron-composite') {
|
|
236
|
-
return positronCompositeBasemap;
|
|
237
|
-
}
|
|
238
|
-
if (basemap === 'blossom-composite') {
|
|
239
|
-
return blossomCompositeBasemap;
|
|
240
|
-
}
|
|
241
|
-
if (!basemap) {
|
|
242
|
-
return 'hybrid';
|
|
243
|
-
}
|
|
244
|
-
return basemap;
|
|
245
|
-
};
|
|
246
|
-
|
|
247
|
-
const setCustomBasemap = (urlTemplate) => {
|
|
248
|
-
const mapBaseLayer = new WebTileLayer({
|
|
249
|
-
urlTemplate,
|
|
250
|
-
});
|
|
251
|
-
|
|
252
|
-
// Create a Basemap with the WebTileLayer.
|
|
253
|
-
const customBase = new Basemap({
|
|
254
|
-
baseLayers: [mapBaseLayer],
|
|
255
|
-
title: 'Custom Base Layer',
|
|
256
|
-
id: 'custom-base',
|
|
257
|
-
});
|
|
258
|
-
return customBase;
|
|
259
|
-
};
|
|
260
|
-
|
|
261
|
-
const map = new MapBlock({
|
|
262
|
-
basemap:
|
|
263
|
-
data?.base?.use_custom_base && data?.base?.custom_base_layer
|
|
264
|
-
? setCustomBasemap(data?.base?.custom_base_layer)
|
|
265
|
-
: setBasemap(base_layer),
|
|
266
|
-
layers,
|
|
267
|
-
});
|
|
268
|
-
const view = new MapView({
|
|
269
|
-
container: mapRef.current,
|
|
270
|
-
map,
|
|
271
|
-
center:
|
|
272
|
-
general?.long && general?.lat ? [general.long, general.lat] : [0, 40],
|
|
273
|
-
zoom: general?.zoom_level ? general?.zoom_level : 2,
|
|
274
|
-
ui: {
|
|
275
|
-
components: ['attribution'],
|
|
276
|
-
},
|
|
277
|
-
});
|
|
278
|
-
if (general && general.scalebar) {
|
|
279
|
-
const scaleBarWidget = new ScaleBar({
|
|
280
|
-
view: view,
|
|
281
|
-
unit: general.scalebar,
|
|
282
|
-
});
|
|
283
|
-
|
|
284
|
-
view.ui.add(scaleBarWidget, {
|
|
285
|
-
position: 'bottom-left',
|
|
286
|
-
});
|
|
287
|
-
}
|
|
288
|
-
|
|
289
|
-
const fullscreenWidget = new Fullscreen({
|
|
290
|
-
view: view,
|
|
291
|
-
});
|
|
292
|
-
|
|
293
|
-
view.ui.add(fullscreenWidget, 'top-right');
|
|
294
|
-
|
|
295
|
-
//detect when fullscreen is on
|
|
296
|
-
|
|
297
|
-
if (layers && layers[0] && general && general.centerOnExtent) {
|
|
298
|
-
const firstLayer = layers[0];
|
|
299
|
-
if (firstLayer.type === 'feature') {
|
|
300
|
-
firstLayer
|
|
301
|
-
.when(() => {
|
|
302
|
-
return firstLayer.queryExtent();
|
|
303
|
-
})
|
|
304
|
-
.then((response) => {
|
|
305
|
-
view.goTo(response.extent);
|
|
306
|
-
});
|
|
307
|
-
}
|
|
308
|
-
if (firstLayer.type === 'map-image') {
|
|
309
|
-
firstLayer.when(() => {
|
|
310
|
-
view.goTo(firstLayer.fullExtent);
|
|
311
|
-
});
|
|
312
|
-
}
|
|
313
|
-
}
|
|
314
|
-
|
|
315
|
-
const zoomPosition =
|
|
316
|
-
general && general.zoom_position ? general.zoom_position : '';
|
|
317
|
-
|
|
318
|
-
if (zoomPosition) {
|
|
319
|
-
const zoomWidget = new Zoom({
|
|
320
|
-
view: view,
|
|
321
|
-
});
|
|
322
|
-
view.ui.add(zoomWidget, zoomPosition);
|
|
323
|
-
}
|
|
324
|
-
const printPosition =
|
|
325
|
-
general && general.print_position ? general.print_position : '';
|
|
326
|
-
|
|
327
|
-
if (printPosition) {
|
|
328
|
-
const printWidget = new Expand({
|
|
329
|
-
content: new Print({
|
|
330
|
-
view: view,
|
|
331
|
-
}),
|
|
332
|
-
view: view,
|
|
333
|
-
expanded: false,
|
|
334
|
-
expandIconClass: 'esri-icon-printer',
|
|
335
|
-
expandTooltip: 'Print',
|
|
336
|
-
});
|
|
337
|
-
view.ui.add(printWidget, printPosition);
|
|
338
|
-
}
|
|
339
|
-
|
|
340
|
-
if (layers && layers.length > 0) {
|
|
341
|
-
layers.forEach((layer) => {
|
|
342
|
-
view.whenLayerView(layer).then((layerView) => {
|
|
343
|
-
layerView.watch('updating', (val) => {});
|
|
344
|
-
});
|
|
345
|
-
});
|
|
346
|
-
}
|
|
347
|
-
return { view, map };
|
|
348
|
-
}, [modules, data, data.layers, map_layers]);
|
|
349
|
-
|
|
350
|
-
const heightPx =
|
|
351
|
-
height && !editMode
|
|
352
|
-
? `${height}px`
|
|
353
|
-
: device === 'tablet' || device === 'mobile'
|
|
354
|
-
? '300px'
|
|
355
|
-
: '500px';
|
|
356
|
-
|
|
357
|
-
const dynamicStyle = `
|
|
358
|
-
.esri-map {
|
|
359
|
-
height: ${heightPx} !important
|
|
360
|
-
}
|
|
361
|
-
`;
|
|
362
|
-
|
|
363
|
-
return (
|
|
364
|
-
<div className="esri-map-wrapper">
|
|
365
|
-
<style>{dynamicStyle}</style>
|
|
366
|
-
<div ref={mapRef} className="esri-map"></div>
|
|
367
|
-
</div>
|
|
368
|
-
);
|
|
369
|
-
};
|
|
370
|
-
|
|
371
|
-
export default withDeviceSize(React.memo(Webmap));
|
package/src/components/index.js
DELETED
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
export { default as Webmap } from './Webmap';
|
|
2
|
-
export { default as ExtraViews } from './ExtraViews';
|
|
3
|
-
export { default as LegendView } from './LegendView';
|
|
4
|
-
|
|
5
|
-
export { default as EmbedMapView } from './Blocks/EmbedEEAMap/View';
|
|
6
|
-
export { default as EmbedMapEdit } from './Blocks/EmbedEEAMap/Edit';
|
|
@@ -1,122 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { Modal, Button, Grid } from 'semantic-ui-react';
|
|
3
|
-
|
|
4
|
-
import { FormFieldWrapper, InlineForm } from '@plone/volto/components';
|
|
5
|
-
|
|
6
|
-
import PanelsSchema from './panelsSchema';
|
|
7
|
-
import Webmap from '../Webmap';
|
|
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 = (val) => {
|
|
29
|
-
setIntValue(val);
|
|
30
|
-
};
|
|
31
|
-
|
|
32
|
-
let schema = PanelsSchema({ data: dataForm });
|
|
33
|
-
|
|
34
|
-
React.useEffect(() => {
|
|
35
|
-
if (!intValue?.general) {
|
|
36
|
-
setIntValue({
|
|
37
|
-
...intValue,
|
|
38
|
-
general: {
|
|
39
|
-
print_position: 'top-right',
|
|
40
|
-
zoom_position: 'top-right',
|
|
41
|
-
centerOnExtent: true,
|
|
42
|
-
scalebar: 'metric',
|
|
43
|
-
},
|
|
44
|
-
});
|
|
45
|
-
}
|
|
46
|
-
if (!intValue?.base) {
|
|
47
|
-
setIntValue({
|
|
48
|
-
...intValue,
|
|
49
|
-
base: {
|
|
50
|
-
base_layer: 'gray-vector',
|
|
51
|
-
},
|
|
52
|
-
});
|
|
53
|
-
}
|
|
54
|
-
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
55
|
-
}, [intValue]);
|
|
56
|
-
|
|
57
|
-
return (
|
|
58
|
-
<FormFieldWrapper {...props}>
|
|
59
|
-
<div className="wrapper">
|
|
60
|
-
<Button
|
|
61
|
-
floated="right"
|
|
62
|
-
size="tiny"
|
|
63
|
-
onClick={(e) => {
|
|
64
|
-
e.preventDefault();
|
|
65
|
-
e.stopPropagation();
|
|
66
|
-
setOpen(true);
|
|
67
|
-
}}
|
|
68
|
-
>
|
|
69
|
-
Open Map Editor
|
|
70
|
-
</Button>
|
|
71
|
-
</div>
|
|
72
|
-
|
|
73
|
-
{open && (
|
|
74
|
-
<Modal
|
|
75
|
-
id="map-editor-modal"
|
|
76
|
-
style={{ width: '95% !important' }}
|
|
77
|
-
open={true}
|
|
78
|
-
>
|
|
79
|
-
<Modal.Content scrolling>
|
|
80
|
-
<Grid stackable reversed="mobile vertically tablet vertically">
|
|
81
|
-
<Grid.Column
|
|
82
|
-
mobile={12}
|
|
83
|
-
tablet={12}
|
|
84
|
-
computer={5}
|
|
85
|
-
className="map-editor-column"
|
|
86
|
-
>
|
|
87
|
-
<InlineForm
|
|
88
|
-
block={block}
|
|
89
|
-
schema={schema}
|
|
90
|
-
onChangeField={(id, value) => {
|
|
91
|
-
handleChangeField(value);
|
|
92
|
-
}}
|
|
93
|
-
formData={dataForm}
|
|
94
|
-
/>
|
|
95
|
-
</Grid.Column>
|
|
96
|
-
<Grid.Column mobile={12} tablet={12} computer={7}>
|
|
97
|
-
<div className="webmap-container">
|
|
98
|
-
<Webmap data={intValue} editMode={true} />
|
|
99
|
-
</div>
|
|
100
|
-
</Grid.Column>
|
|
101
|
-
</Grid>
|
|
102
|
-
</Modal.Content>
|
|
103
|
-
<Modal.Actions>
|
|
104
|
-
<Grid>
|
|
105
|
-
<Grid.Row>
|
|
106
|
-
<div className="map-edit-actions-container">
|
|
107
|
-
<Button onClick={handleClose}>Close</Button>
|
|
108
|
-
<Button color="green" onClick={handleApplyChanges}>
|
|
109
|
-
Apply changes
|
|
110
|
-
</Button>
|
|
111
|
-
</div>
|
|
112
|
-
</Grid.Row>
|
|
113
|
-
</Grid>
|
|
114
|
-
</Modal.Actions>
|
|
115
|
-
</Modal>
|
|
116
|
-
)}
|
|
117
|
-
{!open && <Webmap data={value} editMode={true} />}
|
|
118
|
-
</FormFieldWrapper>
|
|
119
|
-
);
|
|
120
|
-
};
|
|
121
|
-
|
|
122
|
-
export default VisualizationEditorWidget;
|