@eeacms/volto-arcgis-block 0.1.376 → 0.1.378

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 CHANGED
@@ -4,6 +4,13 @@ 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.378](https://github.com/eea/volto-arcgis-block/compare/0.1.377...0.1.378) - 11 August 2025
8
+
9
+ ### [0.1.377](https://github.com/eea/volto-arcgis-block/compare/0.1.376...0.1.377) - 30 July 2025
10
+
11
+ #### :hammer_and_wrench: Others
12
+
13
+ - Merge pull request #995 from eea/develop [Unai Bolivar - [`194ef38`](https://github.com/eea/volto-arcgis-block/commit/194ef385764f9d153fb46ac121bdc0f55d75ce20)]
7
14
  ### [0.1.376](https://github.com/eea/volto-arcgis-block/compare/0.1.375...0.1.376) - 17 July 2025
8
15
 
9
16
  ### [0.1.375](https://github.com/eea/volto-arcgis-block/compare/0.1.374...0.1.375) - 14 July 2025
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@eeacms/volto-arcgis-block",
3
- "version": "0.1.376",
3
+ "version": "0.1.378",
4
4
  "description": "volto-arcgis-block: Volto add-on",
5
5
  "main": "src/index.js",
6
6
  "author": "European Environment Agency: CodeSyntax",
@@ -34,6 +34,12 @@ class AreaWidget extends React.Component {
34
34
  showMapMenu: false,
35
35
  showInfoPopup: this.props.download ? true : false,
36
36
  infoPopupType: 'area',
37
+ coordinates: {
38
+ north: '',
39
+ south: '',
40
+ east: '',
41
+ west: '',
42
+ },
37
43
  };
38
44
  this.menuClass =
39
45
  'esri-icon-cursor-marquee esri-widget--button esri-widget esri-interactive';
@@ -156,6 +162,11 @@ class AreaWidget extends React.Component {
156
162
  this.props.uploadFileHandler(true);
157
163
  this.clearWidget();
158
164
  document.querySelector('.coordinateWindow').style.display = 'none';
165
+ document.querySelector('.coordinateContainer').style.display = 'block';
166
+ document.querySelector('.coordinateWindow').style.height = '13rem';
167
+ document
168
+ .querySelector('.closeCoordinates')
169
+ .classList.replace('esri-icon-up-arrow', 'esri-icon-close');
159
170
  this.removeFileUploadedLayer();
160
171
  this.container.current.querySelector(
161
172
  '#download_area_select_nuts0',
@@ -235,18 +246,19 @@ class AreaWidget extends React.Component {
235
246
  document.querySelector('.coordinateWindow').style.display = 'block';
236
247
  } else {
237
248
  document.querySelector('.coordinateWindow').style.display = 'none';
238
- if (document.getElementById('menu-north')) {
239
- document.getElementById('menu-north').value = null;
240
- }
241
- if (document.getElementById('menu-south')) {
242
- document.getElementById('menu-south').value = null;
243
- }
244
- if (document.getElementById('menu-east')) {
245
- document.getElementById('menu-east').value = null;
246
- }
247
- if (document.getElementById('menu-west')) {
248
- document.getElementById('menu-west').value = null;
249
- }
249
+ document.querySelector('.coordinateContainer').style.display = 'block';
250
+ document.querySelector('.coordinateWindow').style.height = '13rem';
251
+ document
252
+ .querySelector('.closeCoordinates')
253
+ .classList.replace('esri-icon-up-arrow', 'esri-icon-close');
254
+ this.setState({
255
+ coordinates: {
256
+ north: '',
257
+ south: '',
258
+ east: '',
259
+ west: '',
260
+ },
261
+ });
250
262
  }
251
263
  }
252
264
  nuts0handler(e) {
@@ -1009,80 +1021,109 @@ class AreaWidget extends React.Component {
1009
1021
  }
1010
1022
  addCoordinates() {
1011
1023
  this.clearWidget();
1012
- let pointNorth = document.getElementById('menu-north');
1013
- if (pointNorth.value > 90) {
1014
- pointNorth.value = 90;
1015
- } else if (pointNorth.value < -90) {
1016
- pointNorth.value = -90;
1024
+ let valid = true;
1025
+ let pointNorth = this.state.coordinates.north;
1026
+ if (
1027
+ pointNorth > 90 ||
1028
+ pointNorth < -90 ||
1029
+ pointNorth === null ||
1030
+ pointNorth === ''
1031
+ ) {
1032
+ valid = false;
1017
1033
  }
1018
- let pointSouth = document.getElementById('menu-south');
1019
- if (pointSouth.value > 90) {
1020
- pointSouth.value = 90;
1021
- } else if (pointSouth.value < -90) {
1022
- pointSouth.value = -90;
1034
+ let pointSouth = this.state.coordinates.south;
1035
+ if (
1036
+ pointSouth > 90 ||
1037
+ pointSouth < -90 ||
1038
+ pointSouth === null ||
1039
+ pointSouth === ''
1040
+ ) {
1041
+ valid = false;
1023
1042
  }
1024
- let pointEast = document.getElementById('menu-east');
1025
- if (pointEast.value > 180) {
1026
- pointEast.value = 180;
1027
- } else if (pointEast.value < -180) {
1028
- pointEast.value = -180;
1043
+ let pointEast = this.state.coordinates.east;
1044
+ if (
1045
+ pointEast > 180 ||
1046
+ pointEast < -180 ||
1047
+ pointEast === null ||
1048
+ pointEast === ''
1049
+ ) {
1050
+ valid = false;
1029
1051
  }
1030
- let pointWest = document.getElementById('menu-west');
1031
- if (pointWest.value > 180) {
1032
- pointWest.value = 180;
1033
- } else if (pointWest.value < -180) {
1034
- pointWest.value = -180;
1052
+ let pointWest = this.state.coordinates.west;
1053
+ if (
1054
+ pointWest > 180 ||
1055
+ pointWest < -180 ||
1056
+ pointWest === null ||
1057
+ pointWest === ''
1058
+ ) {
1059
+ valid = false;
1035
1060
  }
1036
- let pointNW = [pointNorth.value, pointWest.value];
1037
- let pointSE = [pointSouth.value, pointEast.value];
1038
- var fillSymbol = {
1039
- type: 'simple-fill',
1040
- color: [255, 255, 255, 0.5],
1041
- outline: {
1042
- color: [0, 0, 0],
1043
- width: 1,
1044
- },
1045
- };
1046
- let extentGraphic = new Graphic({
1047
- geometry: new Extent({
1048
- xmin: Math.min(pointNW[1], pointSE[1]),
1049
- xmax: Math.max(pointNW[1], pointSE[1]),
1050
- ymin: Math.min(pointNW[0], pointSE[0]),
1051
- ymax: Math.max(pointNW[0], pointSE[0]),
1052
- spatialReference: { wkid: 4326 },
1053
- }),
1054
- symbol: fillSymbol,
1055
- });
1056
- let outSpatialReference = new SpatialReference({
1057
- wkid: 102100,
1058
- });
1059
- let graphicProjection = projection.project(
1060
- extentGraphic.geometry,
1061
- outSpatialReference,
1062
- );
1063
- if (extentGraphic && this.checkExtent(graphicProjection)) {
1064
- this.setState({
1065
- showInfoPopup: true,
1066
- infoPopupType: 'fullDataset',
1061
+ if (valid) {
1062
+ let pointNW = [pointNorth, pointWest];
1063
+ let pointSE = [pointSouth, pointEast];
1064
+ var fillSymbol = {
1065
+ type: 'simple-fill',
1066
+ color: [255, 255, 255, 0.5],
1067
+ outline: {
1068
+ color: [0, 0, 0],
1069
+ width: 1,
1070
+ },
1071
+ };
1072
+ let extentGraphic = new Graphic({
1073
+ geometry: new Extent({
1074
+ xmin: Math.min(pointNW[1], pointSE[1]),
1075
+ xmax: Math.max(pointNW[1], pointSE[1]),
1076
+ ymin: Math.min(pointNW[0], pointSE[0]),
1077
+ ymax: Math.max(pointNW[0], pointSE[0]),
1078
+ spatialReference: { wkid: 4326 },
1079
+ }),
1080
+ symbol: fillSymbol,
1067
1081
  });
1068
- this.props.uploadFileHandler(true);
1082
+ let outSpatialReference = new SpatialReference({
1083
+ wkid: 102100,
1084
+ });
1085
+ let graphicProjection = projection.project(
1086
+ extentGraphic.geometry,
1087
+ outSpatialReference,
1088
+ );
1089
+ if (this.checkExtent(graphicProjection)) {
1090
+ this.setState({
1091
+ showInfoPopup: true,
1092
+ infoPopupType: 'fullDataset',
1093
+ });
1094
+ } else {
1095
+ this.setState({
1096
+ showInfoPopup: true,
1097
+ infoPopupType: 'download',
1098
+ });
1099
+ this.closeCoordinates();
1100
+ }
1101
+ this.props.updateArea({
1102
+ origin: {
1103
+ x: extentGraphic.geometry.xmin,
1104
+ y: extentGraphic.geometry.ymax,
1105
+ },
1106
+ end: { x: extentGraphic.geometry.xmax, y: extentGraphic.geometry.ymin },
1107
+ });
1108
+ this.props.view.graphics.add(extentGraphic);
1069
1109
  } else {
1070
1110
  this.setState({
1071
1111
  showInfoPopup: true,
1072
- infoPopupType: 'download',
1112
+ infoPopupType: 'invalidCoordinates',
1073
1113
  });
1074
- this.props.uploadFileHandler(true);
1075
- this.closeCoordinates();
1076
1114
  }
1077
- this.props.updateArea({
1078
- origin: {
1079
- x: extentGraphic.geometry.xmin,
1080
- y: extentGraphic.geometry.ymax,
1081
- },
1082
- end: { x: extentGraphic.geometry.xmax, y: extentGraphic.geometry.ymin },
1083
- });
1084
- this.props.view.graphics.add(extentGraphic);
1085
1115
  }
1116
+ handleCoordinateChange = (e) => {
1117
+ const { id, value } = e.target;
1118
+ // id will be "menu-north", "menu-south", "menu-east", or "menu-west"
1119
+ const key = id.replace('menu-', ''); // gives you 'north', 'south', etc.
1120
+ this.setState((prevState) => ({
1121
+ coordinates: {
1122
+ ...prevState.coordinates,
1123
+ [key]: value,
1124
+ },
1125
+ }));
1126
+ };
1086
1127
  openCoordinates(event) {
1087
1128
  this.clearWidget();
1088
1129
  this.nutsRadioButton(event.target.value);
@@ -1761,6 +1802,16 @@ class AreaWidget extends React.Component {
1761
1802
  </div>
1762
1803
  </>
1763
1804
  )}
1805
+ {this.state.infoPopupType === 'invalidCoordinates' && (
1806
+ <>
1807
+ <span className="drawRectanglePopup-icon">
1808
+ <FontAwesomeIcon icon={['fas', 'info-circle']} />
1809
+ </span>
1810
+ <div className="drawRectanglePopup-text">
1811
+ Invalid coordinates.
1812
+ </div>
1813
+ </>
1814
+ )}
1764
1815
  </div>
1765
1816
  </div>
1766
1817
  </div>
@@ -1789,6 +1840,8 @@ class AreaWidget extends React.Component {
1789
1840
  max="90"
1790
1841
  placeholder="00.000000"
1791
1842
  className="coordinateInput"
1843
+ value={this.state.coordinates.north}
1844
+ onChange={this.handleCoordinateChange}
1792
1845
  />
1793
1846
  </div>
1794
1847
  <div>
@@ -1800,6 +1853,8 @@ class AreaWidget extends React.Component {
1800
1853
  max="180"
1801
1854
  placeholder="00.000000"
1802
1855
  className="coordinateInput"
1856
+ value={this.state.coordinates.west}
1857
+ onChange={this.handleCoordinateChange}
1803
1858
  />
1804
1859
  </div>
1805
1860
  </div>
@@ -1814,6 +1869,8 @@ class AreaWidget extends React.Component {
1814
1869
  max="90"
1815
1870
  placeholder="00.000000"
1816
1871
  className="coordinateInput"
1872
+ value={this.state.coordinates.south}
1873
+ onChange={this.handleCoordinateChange}
1817
1874
  />
1818
1875
  </div>
1819
1876
  <div>
@@ -1825,6 +1882,8 @@ class AreaWidget extends React.Component {
1825
1882
  max="180"
1826
1883
  placeholder="00.000000"
1827
1884
  className="coordinateInput"
1885
+ value={this.state.coordinates.east}
1886
+ onChange={this.handleCoordinateChange}
1828
1887
  />
1829
1888
  </div>
1830
1889
  </div>
@@ -1093,6 +1093,7 @@ class MenuWidget extends React.Component {
1093
1093
  let button = familyDropdown.querySelector(
1094
1094
  '.ccl-expandable__button',
1095
1095
  );
1096
+ scrollPosition = familyDropdown.offsetTop;
1096
1097
  if (button) {
1097
1098
  button.setAttribute('aria-expanded', 'true');
1098
1099
  }