@eeacms/volto-eea-map 0.1.6 → 0.1.7
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 +10 -0
- package/package.json +1 -1
- package/src/components/Blocks/EEAMap/View.jsx +2 -3
- package/src/components/Blocks/EEAMap/components/widgets/VisualizationEditorWidget.jsx +94 -0
- package/src/components/Blocks/EEAMap/components/widgets/VisualizationView.jsx +16 -0
- package/src/index.js +7 -0
package/CHANGELOG.md
CHANGED
|
@@ -4,8 +4,18 @@ 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.7](https://github.com/eea/volto-eea-map/compare/0.1.6...0.1.7)
|
|
8
|
+
|
|
9
|
+
- fix height coming through in view [`39d4d28`](https://github.com/eea/volto-eea-map/commit/39d4d287a4fe86890f5fad8d9050130b496dfe70)
|
|
10
|
+
- Connected visualization view-edit [`52a8e21`](https://github.com/eea/volto-eea-map/commit/52a8e2187cb2e3a7db660ae4b6b5610c88be5083)
|
|
11
|
+
- map_view is map_editor_widget, add view component for content-type [`dc227f9`](https://github.com/eea/volto-eea-map/commit/dc227f9bbb259b59739a3694dc69f0fcca661137)
|
|
12
|
+
- Add map visualization widget [`affd84c`](https://github.com/eea/volto-eea-map/commit/affd84ca8753214c07f2f0756a13f08f5cf0a048)
|
|
13
|
+
|
|
7
14
|
#### [0.1.6](https://github.com/eea/volto-eea-map/compare/0.1.5...0.1.6)
|
|
8
15
|
|
|
16
|
+
> 5 August 2022
|
|
17
|
+
|
|
18
|
+
- Develop [`#6`](https://github.com/eea/volto-eea-map/pull/6)
|
|
9
19
|
- Lint fix [`f5561d1`](https://github.com/eea/volto-eea-map/commit/f5561d1581201bd635b4e53e8a46decaf684438f)
|
|
10
20
|
- Map improvements [`c75d16c`](https://github.com/eea/volto-eea-map/commit/c75d16c265136d9f676e194540e613bb742fb51b)
|
|
11
21
|
|
package/package.json
CHANGED
|
@@ -6,14 +6,13 @@ import { PrivacyProtection } from '@eeacms/volto-embed';
|
|
|
6
6
|
const View = (props) => {
|
|
7
7
|
const { data } = props || {};
|
|
8
8
|
|
|
9
|
-
const { map_data = {} } = data;
|
|
9
|
+
const { map_data = {}, height = '' } = data;
|
|
10
10
|
|
|
11
11
|
if (__SERVER__) return '';
|
|
12
|
-
|
|
13
12
|
return (
|
|
14
13
|
<div>
|
|
15
14
|
<PrivacyProtection data={data} {...props}>
|
|
16
|
-
<Webmap data={map_data} />
|
|
15
|
+
<Webmap data={map_data} height={height} />
|
|
17
16
|
<ExtraViews data={data} />
|
|
18
17
|
</PrivacyProtection>
|
|
19
18
|
</div>
|
|
@@ -0,0 +1,94 @@
|
|
|
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;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import Webmap from '../Webmap';
|
|
3
|
+
|
|
4
|
+
const VisualizationView = (props) => {
|
|
5
|
+
const { content = {} } = props;
|
|
6
|
+
|
|
7
|
+
const { map_editor_widget = {} } = content;
|
|
8
|
+
|
|
9
|
+
return (
|
|
10
|
+
<div>
|
|
11
|
+
<Webmap data={map_editor_widget} />
|
|
12
|
+
</div>
|
|
13
|
+
);
|
|
14
|
+
};
|
|
15
|
+
|
|
16
|
+
export default VisualizationView;
|
package/src/index.js
CHANGED
|
@@ -3,6 +3,8 @@ import world from '@plone/volto/icons/world.svg';
|
|
|
3
3
|
import LayerSelectWidget from './components/Blocks/EEAMap/components/widgets/LayerSelectWidget';
|
|
4
4
|
import MapEditorWidget from './components/Blocks/EEAMap/components/widgets/MapEditorWidget';
|
|
5
5
|
import ObjectTypesWidget from './components/Blocks/EEAMap/components/widgets/ObjectTypesWidget';
|
|
6
|
+
import VisualizationEditorWidget from './components/Blocks/EEAMap/components/widgets/VisualizationEditorWidget';
|
|
7
|
+
import VisualizationView from './components/Blocks/EEAMap/components/widgets/VisualizationView';
|
|
6
8
|
|
|
7
9
|
export default (config) => {
|
|
8
10
|
config.settings.allowed_cors_destinations = [
|
|
@@ -52,5 +54,10 @@ export default (config) => {
|
|
|
52
54
|
config.widgets.widget.map_layers_widget = LayerSelectWidget;
|
|
53
55
|
config.widgets.widget.object_types_widget = ObjectTypesWidget;
|
|
54
56
|
|
|
57
|
+
//map editor for the visualization(content-type)
|
|
58
|
+
config.widgets.id.map_editor_widget = VisualizationEditorWidget;
|
|
59
|
+
//map viewer for the visualization(content-type)
|
|
60
|
+
config.views.contentTypesViews.map_visualization = VisualizationView;
|
|
61
|
+
|
|
55
62
|
return config;
|
|
56
63
|
};
|