@eeacms/volto-arcgis-block 0.1.25 → 0.1.26
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 +16 -0
- package/package.json +1 -1
- package/src/components/MapViewer/BasemapWidget.jsx +1 -1
- package/src/components/MapViewer/InfoWidget.jsx +0 -1
- package/src/components/MapViewer/MapViewer.jsx +9 -1
- package/src/components/MapViewer/MenuWidget.jsx +2 -17
- package/src/components/MapViewer/TimesliderWidget.jsx +53 -2
- package/src/components/MapViewer/css/ArcgisMap.css +25 -1
- package/src/components/UseCasesMapViewer/InfoWidget.jsx +8 -4
- package/src/components/UseCasesMapViewer/LayerControl.jsx +12 -6
package/CHANGELOG.md
CHANGED
|
@@ -4,8 +4,24 @@ 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.26](https://github.com/eea/volto-arcgis-block/compare/0.1.25...0.1.26)
|
|
8
|
+
|
|
9
|
+
- Bug fixing [`#88`](https://github.com/eea/volto-arcgis-block/pull/88)
|
|
10
|
+
- Bugs n improvements [`#87`](https://github.com/eea/volto-arcgis-block/pull/87)
|
|
11
|
+
- Develop [`#86`](https://github.com/eea/volto-arcgis-block/pull/86)
|
|
12
|
+
- Time slider drag/drop [`#85`](https://github.com/eea/volto-arcgis-block/pull/85)
|
|
13
|
+
- Use cases [`#84`](https://github.com/eea/volto-arcgis-block/pull/84)
|
|
14
|
+
- Develop [`#81`](https://github.com/eea/volto-arcgis-block/pull/81)
|
|
15
|
+
- Downloadable dataset [`c48eea9`](https://github.com/eea/volto-arcgis-block/commit/c48eea93b0f71134f9aa8fee1f5d6b4cf7e1368b)
|
|
16
|
+
- add flattenToAppURL to send the correct url to the MapViewerConfig action [`ca5f684`](https://github.com/eea/volto-arcgis-block/commit/ca5f684ae683e0df249d3fab3534f579583f03a8)
|
|
17
|
+
- ESLint fix [`7f43112`](https://github.com/eea/volto-arcgis-block/commit/7f4311224483fb599e7cecfe65096166ed5f2026)
|
|
18
|
+
- Use case highlight [`2279a5a`](https://github.com/eea/volto-arcgis-block/commit/2279a5ad669172545588e9030e3cf49ca4e30dfa)
|
|
19
|
+
|
|
7
20
|
#### [0.1.25](https://github.com/eea/volto-arcgis-block/compare/0.1.24...0.1.25)
|
|
8
21
|
|
|
22
|
+
> 5 January 2022
|
|
23
|
+
|
|
24
|
+
- Develop [`#83`](https://github.com/eea/volto-arcgis-block/pull/83)
|
|
9
25
|
- Bugs n improvements [`#82`](https://github.com/eea/volto-arcgis-block/pull/82)
|
|
10
26
|
- ESLint fix [`c129348`](https://github.com/eea/volto-arcgis-block/commit/c129348ee3886e0419029dd2bfe835c28878444c)
|
|
11
27
|
- Filter by product and dataset [`c89711a`](https://github.com/eea/volto-arcgis-block/commit/c89711acf4f46c8426c7e34add2baf4debe67697)
|
package/package.json
CHANGED
|
@@ -15,7 +15,7 @@ class BasemapWidget extends React.Component {
|
|
|
15
15
|
//not be showing the basemap panel
|
|
16
16
|
this.state = { showMapMenu: false };
|
|
17
17
|
this.menuClass =
|
|
18
|
-
'esri-icon-basemap esri-widget--button esri-widget esri-interactive
|
|
18
|
+
'esri-icon-basemap esri-widget--button esri-widget esri-interactive';
|
|
19
19
|
this.loadFirst = true;
|
|
20
20
|
}
|
|
21
21
|
|
|
@@ -8,10 +8,12 @@ import PrintWidget from './PrintWidget';
|
|
|
8
8
|
import AreaWidget from './AreaWidget';
|
|
9
9
|
import ScaleWidget from './ScaleWidget';
|
|
10
10
|
import LegendWidget from './LegendWidget';
|
|
11
|
+
import InfoWidget from './InfoWidget';
|
|
11
12
|
import MenuWidget from './MenuWidget';
|
|
12
13
|
import { MapViewerConfig } from '../../actions';
|
|
13
14
|
import { compose } from 'redux';
|
|
14
15
|
import { connect } from 'react-redux';
|
|
16
|
+
import { flattenToAppURL } from '@plone/volto/helpers/Url/Url';
|
|
15
17
|
|
|
16
18
|
//import "isomorphic-fetch"; <-- Necessary to use fetch?
|
|
17
19
|
var Map, MapView, Zoom;
|
|
@@ -87,7 +89,7 @@ class MapViewer extends React.Component {
|
|
|
87
89
|
// After launching the MapViewerConfig action
|
|
88
90
|
// we will have stored the json response here:
|
|
89
91
|
// this.props.mapviewer_config
|
|
90
|
-
this.props.MapViewerConfig(this.props.url);
|
|
92
|
+
this.props.MapViewerConfig(flattenToAppURL(this.props.url));
|
|
91
93
|
|
|
92
94
|
//Once we have created the MapView, we need to ensure that the map div
|
|
93
95
|
//is refreshed in order to show the map on it. To do so, we need to
|
|
@@ -156,6 +158,11 @@ class MapViewer extends React.Component {
|
|
|
156
158
|
if (this.view) return <ScaleWidget view={this.view} mapViewer={this} />;
|
|
157
159
|
}
|
|
158
160
|
|
|
161
|
+
renderInfo() {
|
|
162
|
+
if (this.view)
|
|
163
|
+
return <InfoWidget view={this.view} map={this.map} mapViewer={this} />;
|
|
164
|
+
}
|
|
165
|
+
|
|
159
166
|
renderMenu() {
|
|
160
167
|
if (this.view)
|
|
161
168
|
return (
|
|
@@ -188,6 +195,7 @@ class MapViewer extends React.Component {
|
|
|
188
195
|
{this.renderPrint()}
|
|
189
196
|
{this.renderArea()}
|
|
190
197
|
{this.renderScale()}
|
|
198
|
+
{this.renderInfo()}
|
|
191
199
|
{this.renderMenu()}
|
|
192
200
|
</div>
|
|
193
201
|
</div>
|
|
@@ -8,7 +8,6 @@ import { useIntl } from 'react-intl';
|
|
|
8
8
|
import { Message, Modal } from 'semantic-ui-react';
|
|
9
9
|
import AreaWidget from './AreaWidget';
|
|
10
10
|
import TimesliderWidget from './TimesliderWidget';
|
|
11
|
-
import InfoWidget from './InfoWidget';
|
|
12
11
|
var WMSLayer, WMTSLayer, FeatureLayer;
|
|
13
12
|
|
|
14
13
|
export const AddCartItem = ({
|
|
@@ -572,7 +571,7 @@ class MenuWidget extends React.Component {
|
|
|
572
571
|
>
|
|
573
572
|
<span>{dataset.DatasetTitle}</span>
|
|
574
573
|
</label>
|
|
575
|
-
{!this.props.download && (
|
|
574
|
+
{!this.props.download && dataset.Downloadable && (
|
|
576
575
|
<AddCartItem
|
|
577
576
|
cartData={this.compCfg}
|
|
578
577
|
props={this.props}
|
|
@@ -738,21 +737,7 @@ class MenuWidget extends React.Component {
|
|
|
738
737
|
this.map.layers.items.filter((a) => a.isTimeSeries && a.visible)
|
|
739
738
|
.length > 0
|
|
740
739
|
) {
|
|
741
|
-
|
|
742
|
-
let div = document.createElement('div');
|
|
743
|
-
document.querySelector('.esri-ui-top-right').appendChild(div);
|
|
744
|
-
ReactDOM.render(
|
|
745
|
-
<InfoWidget
|
|
746
|
-
view={this.props.view}
|
|
747
|
-
map={this.map}
|
|
748
|
-
mapViewer={this.props.mapViewer}
|
|
749
|
-
/>,
|
|
750
|
-
div,
|
|
751
|
-
);
|
|
752
|
-
div.remove();
|
|
753
|
-
} else {
|
|
754
|
-
document.querySelector('.info-container').style.display = '';
|
|
755
|
-
}
|
|
740
|
+
document.querySelector('.info-container').style.display = 'flex';
|
|
756
741
|
}
|
|
757
742
|
} else {
|
|
758
743
|
this.map.remove(this.layers[elem.id]);
|
|
@@ -13,9 +13,13 @@ class TimesliderWidget extends React.Component {
|
|
|
13
13
|
this.container = createRef();
|
|
14
14
|
//Initially, we set the state of the component to
|
|
15
15
|
//not be showing the basemap panel
|
|
16
|
-
this.state = {
|
|
16
|
+
this.state = {
|
|
17
|
+
showMapMenu: false,
|
|
18
|
+
styles: { bottom: '0', right: '0' },
|
|
19
|
+
};
|
|
17
20
|
this.map = this.props.map;
|
|
18
21
|
this.layer = this.props.layer;
|
|
22
|
+
this.drag = {};
|
|
19
23
|
}
|
|
20
24
|
|
|
21
25
|
loader() {
|
|
@@ -71,6 +75,42 @@ class TimesliderWidget extends React.Component {
|
|
|
71
75
|
});
|
|
72
76
|
}
|
|
73
77
|
|
|
78
|
+
/**
|
|
79
|
+
* Needed to get the desired drag-and-drop behavior
|
|
80
|
+
* @param {*} e
|
|
81
|
+
*/
|
|
82
|
+
onDragStart(e) {
|
|
83
|
+
this.drag.frame = document.getElementById('slide_frame');
|
|
84
|
+
this.drag.frame.style.visibility = 'visible';
|
|
85
|
+
document.querySelector(
|
|
86
|
+
'.esri-ui-bottom-right.esri-ui-corner',
|
|
87
|
+
).style.pointerEvents = 'auto';
|
|
88
|
+
this.drag.x = e.screenX - e.currentTarget.getBoundingClientRect().left;
|
|
89
|
+
this.drag.y = e.screenY - e.currentTarget.getBoundingClientRect().top;
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
onDragOver(e) {
|
|
93
|
+
e.preventDefault();
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
onDrop(e) {
|
|
97
|
+
let left =
|
|
98
|
+
e.screenX -
|
|
99
|
+
this.drag.x -
|
|
100
|
+
e.currentTarget.getBoundingClientRect().left +
|
|
101
|
+
'px';
|
|
102
|
+
let top =
|
|
103
|
+
e.screenY -
|
|
104
|
+
this.drag.y -
|
|
105
|
+
e.currentTarget.getBoundingClientRect().top +
|
|
106
|
+
'px';
|
|
107
|
+
this.setState({ styles: { left: left, top: top } });
|
|
108
|
+
this.drag.frame.style.visibility = 'hidden';
|
|
109
|
+
document.querySelector(
|
|
110
|
+
'.esri-ui-bottom-right.esri-ui-corner',
|
|
111
|
+
).style.pointerEvents = '';
|
|
112
|
+
}
|
|
113
|
+
|
|
74
114
|
/**
|
|
75
115
|
* This method renders the component
|
|
76
116
|
* @returns jsx
|
|
@@ -78,7 +118,18 @@ class TimesliderWidget extends React.Component {
|
|
|
78
118
|
render() {
|
|
79
119
|
return (
|
|
80
120
|
<>
|
|
81
|
-
<div
|
|
121
|
+
<div
|
|
122
|
+
id="slide_frame"
|
|
123
|
+
onDrop={(e) => this.onDrop(e)}
|
|
124
|
+
onDragOver={(e) => this.onDragOver(e)}
|
|
125
|
+
></div>
|
|
126
|
+
<div
|
|
127
|
+
ref={this.container}
|
|
128
|
+
className="timeslider-container"
|
|
129
|
+
draggable="true"
|
|
130
|
+
onDragStart={(e) => this.onDragStart(e)}
|
|
131
|
+
style={this.state.styles}
|
|
132
|
+
>
|
|
82
133
|
<div className="timeslider-panel"></div>
|
|
83
134
|
</div>
|
|
84
135
|
</>
|
|
@@ -597,7 +597,7 @@
|
|
|
597
597
|
|
|
598
598
|
/* Pixel info */
|
|
599
599
|
.info-container {
|
|
600
|
-
display:
|
|
600
|
+
display: none;
|
|
601
601
|
box-shadow: none !important;
|
|
602
602
|
}
|
|
603
603
|
|
|
@@ -615,6 +615,30 @@
|
|
|
615
615
|
margin-bottom: 1rem;
|
|
616
616
|
}
|
|
617
617
|
|
|
618
|
+
/* Time slider*/
|
|
619
|
+
.esri-ui-bottom-right.esri-ui-corner {
|
|
620
|
+
width: 100%;
|
|
621
|
+
height: 100%;
|
|
622
|
+
}
|
|
623
|
+
|
|
624
|
+
.timeslider-container {
|
|
625
|
+
position: absolute;
|
|
626
|
+
z-index: 1;
|
|
627
|
+
margin-left: 0 !important;
|
|
628
|
+
}
|
|
629
|
+
|
|
630
|
+
.timeslider-container .timeslider-panel {
|
|
631
|
+
cursor: move;
|
|
632
|
+
}
|
|
633
|
+
|
|
634
|
+
#slide_frame {
|
|
635
|
+
position: absolute;
|
|
636
|
+
z-index: 1;
|
|
637
|
+
width: 100%;
|
|
638
|
+
height: 100%;
|
|
639
|
+
visibility: hidden;
|
|
640
|
+
}
|
|
641
|
+
|
|
618
642
|
/* Modal */
|
|
619
643
|
.map-download-modal.ui.modal {
|
|
620
644
|
margin: 0 !important;
|
|
@@ -5,6 +5,7 @@ let layerControl,
|
|
|
5
5
|
view,
|
|
6
6
|
mapViewer,
|
|
7
7
|
layerSpatial,
|
|
8
|
+
layerHighlight,
|
|
8
9
|
processedData = [];
|
|
9
10
|
class InfoWidget extends React.Component {
|
|
10
11
|
constructor(props) {
|
|
@@ -14,6 +15,7 @@ class InfoWidget extends React.Component {
|
|
|
14
15
|
navigationControl = props.navigationControl;
|
|
15
16
|
layerControl = props.layerControl;
|
|
16
17
|
layerSpatial = props.layerSpatial;
|
|
18
|
+
layerHighlight = props.layerHighlight;
|
|
17
19
|
this.container = createRef();
|
|
18
20
|
}
|
|
19
21
|
|
|
@@ -97,20 +99,22 @@ class InfoWidget extends React.Component {
|
|
|
97
99
|
key={val.Use_case_title}
|
|
98
100
|
className="use-case-element"
|
|
99
101
|
aria-hidden="true"
|
|
100
|
-
onClick={() =>
|
|
102
|
+
onClick={() => {
|
|
103
|
+
layerControl.getGeometry(val.Spatial_coverage, layerHighlight);
|
|
104
|
+
layerControl.showLayer(layerHighlight.id);
|
|
101
105
|
mapViewer.setState((prevState) => ({
|
|
102
106
|
useCaseLevel: 4,
|
|
103
107
|
selectedUseCase: val,
|
|
104
108
|
previousState: prevState.useCaseLevel,
|
|
105
|
-
}))
|
|
106
|
-
}
|
|
109
|
+
}));
|
|
110
|
+
}}
|
|
107
111
|
id={`use_case_${val.OBJECTID}`}
|
|
108
112
|
>
|
|
109
113
|
<div className="use-case-element-title">{val.Use_case_title}</div>
|
|
110
114
|
<div className="use-case-element-description">
|
|
111
115
|
<span>{val.Use_case_topics}</span>
|
|
112
116
|
<span>{val.Use_case_submitting_production_year}</span>
|
|
113
|
-
<span>{val.Spatial_coverage}</span>
|
|
117
|
+
<span className="use-case-coverage">{val.Spatial_coverage}</span>
|
|
114
118
|
<span>{responsibleOrganizationOrPerson}</span>
|
|
115
119
|
</div>
|
|
116
120
|
</div>
|
|
@@ -191,19 +191,25 @@ class LayerControl {
|
|
|
191
191
|
) {
|
|
192
192
|
mapViewer.popupOnce = false;
|
|
193
193
|
document.querySelector('.map').style.cursor = 'pointer';
|
|
194
|
+
let country_code =
|
|
195
|
+
response.results[0].graphic.attributes.Spatial_coverage;
|
|
194
196
|
document
|
|
195
|
-
.
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
197
|
+
.querySelectorAll('.use-case-element-description .use-case-coverage')
|
|
198
|
+
.forEach((element) => {
|
|
199
|
+
if (element.innerText === country_code) {
|
|
200
|
+
element.closest('.use-case-element').classList.add('selected');
|
|
201
|
+
}
|
|
202
|
+
});
|
|
199
203
|
}
|
|
200
204
|
} else {
|
|
201
205
|
mapViewer.popupOnce = true;
|
|
202
206
|
document.querySelector('.map').style.cursor = '';
|
|
203
207
|
if (document.querySelector('.use-case-element.selected'))
|
|
204
208
|
document
|
|
205
|
-
.
|
|
206
|
-
.
|
|
209
|
+
.querySelectorAll('.use-case-element.selected')
|
|
210
|
+
.forEach((element) => {
|
|
211
|
+
element.closest('.use-case-element').classList.remove('selected');
|
|
212
|
+
});
|
|
207
213
|
}
|
|
208
214
|
}
|
|
209
215
|
|