@eeacms/volto-arcgis-block 0.1.194 → 0.1.196

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,19 @@ 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.196](https://github.com/eea/volto-arcgis-block/compare/0.1.195...0.1.196) - 14 September 2023
8
+
9
+ #### :hammer_and_wrench: Others
10
+
11
+ - Lint [masanchez85 - [`c6d79ad`](https://github.com/eea/volto-arcgis-block/commit/c6d79ad1b6d19cb5a43112f9ced774519b441c8c)]
12
+ - CLMS-2279, 1952 [masanchez85 - [`e5b42da`](https://github.com/eea/volto-arcgis-block/commit/e5b42daca404a70aa327018db260b59fcd37fb21)]
13
+ ### [0.1.195](https://github.com/eea/volto-arcgis-block/compare/0.1.194...0.1.195) - 14 September 2023
14
+
15
+ #### :hammer_and_wrench: Others
16
+
17
+ - CLMS-LEGEND-BUGS: opened modular request for reference land cover petition and ran linting scripts [ujbolivar - [`d58526b`](https://github.com/eea/volto-arcgis-block/commit/d58526b426430743ca468382db2713cc17bd2732)]
18
+ - corrected console warnings for incorrect classNames in components [ujbolivar - [`9841c75`](https://github.com/eea/volto-arcgis-block/commit/9841c7554c76e51ea6af70bba8b8970c08eb170e)]
19
+ - CLMS-1795 (fix): Improvements on loading spinner. [ujbolivar - [`f6248d3`](https://github.com/eea/volto-arcgis-block/commit/f6248d347fba01d5987da8fddaedeea379ad75de)]
7
20
  ### [0.1.194](https://github.com/eea/volto-arcgis-block/compare/0.1.193...0.1.194) - 13 September 2023
8
21
 
9
22
  ### [0.1.193](https://github.com/eea/volto-arcgis-block/compare/0.1.192...0.1.193) - 13 September 2023
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@eeacms/volto-arcgis-block",
3
- "version": "0.1.194",
3
+ "version": "0.1.196",
4
4
  "description": "volto-arcgis-block: Volto add-on",
5
5
  "main": "src/index.js",
6
6
  "author": "European Environment Agency: CodeSyntax",
@@ -239,7 +239,6 @@ class HotspotWidget extends React.Component {
239
239
  }
240
240
  }
241
241
  typeFilter.forEach((type) => {
242
- filterId = type + '_filter';
243
242
  if (type === 'lcc') {
244
243
  let selectLccBoxTime = document.getElementById('select-klc-lccTime')
245
244
  .value;
@@ -248,11 +247,17 @@ class HotspotWidget extends React.Component {
248
247
  .getElementById('select-klc-lccTime')
249
248
  .value.match(/\d+/g)
250
249
  .map(Number)[0];
251
- this.state.activeLayers.forEach((layer) => {
252
- layer.includes('all_lcc_a_pol')
253
- ? (typeLegend = 'all_lcc_a_pol')
254
- : (typeLegend = 'all_lcc_b_pol');
255
- });
250
+
251
+ for (let i = 0; i < this.state.activeLayers.length; i++) {
252
+ let layer = this.state.activeLayers[i];
253
+ if (layer.includes('all_lcc_a_pol')) {
254
+ typeLegend = 'all_lcc_a_pol';
255
+ break;
256
+ } else {
257
+ typeLegend = 'all_lcc_b_pol';
258
+ }
259
+ }
260
+
256
261
  if (this.esriLayer_lcc !== null) {
257
262
  if (this.esriLayer_lcc2 !== null) {
258
263
  this.props.map.remove(this.esriLayer_lcc2);
@@ -279,11 +284,16 @@ class HotspotWidget extends React.Component {
279
284
  }
280
285
  }
281
286
  if (type === 'lc') {
282
- this.state.activeLayers.forEach((layer) => {
283
- layer.includes('all_present_lc_a_pol')
284
- ? (typeLegend = 'all_present_lc_a_pol')
285
- : (typeLegend = 'all_present_lc_b_pol');
286
- });
287
+ for (let i = 0; i < this.state.activeLayers.length; i++) {
288
+ let layer = this.state.activeLayers[i];
289
+ if (layer.includes('all_present_lc_a_pol')) {
290
+ typeLegend = 'all_present_lc_a_pol';
291
+ break;
292
+ } else {
293
+ typeLegend = 'all_present_lc_b_pol';
294
+ }
295
+ }
296
+
287
297
  let selectLcBoxTime = document.getElementById('select-klc-lcTime')
288
298
  .value;
289
299
  this.lcYear = selectLcBoxTime;
@@ -291,6 +301,7 @@ class HotspotWidget extends React.Component {
291
301
  .getElementById('select-klc-lcTime')
292
302
  .value.match(/\d+/g)
293
303
  .map(Number)[0];
304
+
294
305
  if (this.esriLayer_lc !== null) {
295
306
  if (this.esriLayer_lc2 !== null) {
296
307
  this.props.map.remove(this.esriLayer_lc2);
@@ -312,7 +323,6 @@ class HotspotWidget extends React.Component {
312
323
  this.props.selectedLayers['lc_filter'] = this.esriLayer_lc;
313
324
  this.props.selectedLayers['lc_filter'].visible = true;
314
325
  this.esriLayer_lc2 = this.esriLayer_lc;
315
- //this.layerModelInit();
316
326
  }
317
327
  }
318
328
  this.esriLayer_klc.customLayerParameters['CQL_FILTER'] =
@@ -340,6 +350,7 @@ class HotspotWidget extends React.Component {
340
350
  this.props.map.add(this.esriLayer_pa);
341
351
  this.props.selectedLayers['pa_filter'].visible = true;
342
352
  this.esriLayer_pa2 = this.esriLayer_pa;
353
+ //this.layerModelInit();
343
354
  }
344
355
  }
345
356
  this.layerModelInit();
@@ -1,6 +1,7 @@
1
1
  import React, { createRef } from 'react';
2
2
  import './css/ArcgisMap.css';
3
3
  import { loadModules } from 'esri-loader';
4
+ var watchUtils;
4
5
  class LoadingSpinner extends React.Component {
5
6
  constructor(props) {
6
7
  super(props);
@@ -12,7 +13,9 @@ class LoadingSpinner extends React.Component {
12
13
  }
13
14
 
14
15
  loader() {
15
- return loadModules().then(() => {});
16
+ return loadModules(['esri/core/watchUtils']).then(([_watchUtils]) => {
17
+ watchUtils = _watchUtils;
18
+ });
16
19
  }
17
20
 
18
21
  showLoading() {
@@ -28,8 +31,10 @@ class LoadingSpinner extends React.Component {
28
31
  await this.loader();
29
32
  this.props.view.when(() => {
30
33
  this.props.view.ui.add(this.container.current, 'manual');
34
+ watchUtils.watch(this.props.view, 'updating', () => {
35
+ return;
36
+ });
31
37
  });
32
- this.showLoading();
33
38
  }
34
39
 
35
40
  componentDidUpdate(prevProps) {
@@ -50,8 +55,8 @@ class LoadingSpinner extends React.Component {
50
55
  >
51
56
  <div>
52
57
  <svg
53
- width="50"
54
- height="50"
58
+ width="80"
59
+ height="80"
55
60
  viewBox="0 0 24 24"
56
61
  xmlns="http://www.w3.org/2000/svg"
57
62
  >
@@ -59,7 +64,7 @@ class LoadingSpinner extends React.Component {
59
64
  {`.spinner_ajPY {
60
65
  transform-origin: center;
61
66
  animation: spinner_AtaB .75s infinite linear;
62
- fill: #a0b128;
67
+ fill: #a0b128; stroke-width: 3px; filter: drop-shadow(0 0 1px rgba(0, 0, 0, 0.1));
63
68
  }
64
69
  @keyframes spinner_AtaB {
65
70
  100% {
@@ -73,7 +78,7 @@ class LoadingSpinner extends React.Component {
73
78
  />
74
79
  <path
75
80
  d="M10.14,1.16a11,11,0,0,0-9,8.92A1.59,1.59,0,0,0,2.46,12,1.52,1.52,0,0,0,4.11,10.7a8,8,0,0,1,6.66-6.61A1.42,1.42,0,0,0,12,2.69h0A1.57,1.57,0,0,0,10.14,1.16Z"
76
- class="spinner_ajPY"
81
+ className="spinner_ajPY"
77
82
  />
78
83
  </svg>
79
84
  </div>
@@ -300,6 +300,8 @@ class MenuWidget extends React.Component {
300
300
  });
301
301
  }
302
302
  }
303
+ if (!this.visibleLayers) this.visibleLayers = {};
304
+ this.handleRasterVectorLegend();
303
305
  }
304
306
  });
305
307
 
@@ -902,10 +904,10 @@ class MenuWidget extends React.Component {
902
904
  product.ProductId ===
903
905
  '8474c3b080fa42cc837f1d2338fcf096' ||
904
906
  product.ProductTitle === 'Snow and Ice Parameters' ? (
905
- <div class="zoom-in-message-container">
907
+ <div className="zoom-in-message-container">
906
908
  <span>{product.ProductTitle}</span>
907
909
  <div
908
- class="zoom-in-message"
910
+ className="zoom-in-message"
909
911
  id="snow-and-ice-zoom-message"
910
912
  >
911
913
  Zoom in to view on map
@@ -924,9 +926,9 @@ class MenuWidget extends React.Component {
924
926
  '8474c3b080fa42cc837f1d2338fcf096' ||
925
927
  product.ProductTitle ===
926
928
  'High Resolution Snow and Ice Parameters' ? (
927
- <div class="zoom-in-message-container">
929
+ <div className="zoom-in-message-container">
928
930
  <span>{product.ProductTitle}</span>
929
- <div class="zoom-in-message">
931
+ <div className="zoom-in-message">
930
932
  Zoom in to view on map
931
933
  </div>
932
934
  </div>
@@ -1144,9 +1146,9 @@ class MenuWidget extends React.Component {
1144
1146
  trigger={
1145
1147
  dataset.ProductId ===
1146
1148
  '8474c3b080fa42cc837f1d2338fcf096' ? (
1147
- <div class="zoom-in-message-container">
1149
+ <div className="zoom-in-message-container">
1148
1150
  <span>{dataset.DatasetTitle}</span>
1149
- <div class="zoom-in-message zoom-in-message-dataset">
1151
+ <div className="zoom-in-message zoom-in-message-dataset">
1150
1152
  Zoom in to view on map
1151
1153
  </div>
1152
1154
  </div>
@@ -1161,9 +1163,9 @@ class MenuWidget extends React.Component {
1161
1163
  />
1162
1164
  ) : dataset.ProductId ===
1163
1165
  '8474c3b080fa42cc837f1d2338fcf096' ? (
1164
- <div class="zoom-in-message-container">
1166
+ <div className="zoom-in-message-container">
1165
1167
  <span>{dataset.DatasetTitle}</span>
1166
- <div class="zoom-in-message">
1168
+ <div className="zoom-in-message">
1167
1169
  Zoom in to view on map
1168
1170
  </div>
1169
1171
  </div>
@@ -1635,6 +1637,31 @@ class MenuWidget extends React.Component {
1635
1637
  this.setState({});
1636
1638
  }
1637
1639
 
1640
+ /**
1641
+ * Method to show/hide a legend if the layer is active or not in the view
1642
+ */
1643
+ handleRasterVectorLegend() {
1644
+ let zoom = this.view.get('zoom');
1645
+ Object.keys(this.activeLayersJSON).forEach((key) => {
1646
+ let activeLayer = this.activeLayersJSON[key];
1647
+ let layerTitle = activeLayer.props.children[0].props.children;
1648
+ if (layerTitle.includes('raster')) {
1649
+ if (zoom > 6) {
1650
+ this.layers[key].visible = false;
1651
+ } else {
1652
+ this.layers[key].visible = true;
1653
+ }
1654
+ } else if (layerTitle.includes('vector')) {
1655
+ if (zoom >= 12) {
1656
+ this.layers[key].visible = true;
1657
+ } else {
1658
+ this.layers[key].visible = false;
1659
+ }
1660
+ }
1661
+ this.setState({});
1662
+ });
1663
+ }
1664
+
1638
1665
  async toggleLayer(elem) {
1639
1666
  if (!this.visibleLayers) this.visibleLayers = {};
1640
1667
  if (!this.timeLayers) this.timeLayers = {};
@@ -1643,10 +1670,10 @@ class MenuWidget extends React.Component {
1643
1670
  .getElementById(parentId)
1644
1671
  .closest('.map-menu-product-dropdown')
1645
1672
  .getAttribute('productid');
1646
- let modularLC;
1673
+ /*let modularLC;
1647
1674
  if (elem.id.includes('all_present_lc_b_pol')) {
1648
1675
  modularLC = elem.id;
1649
- }
1676
+ }*/
1650
1677
 
1651
1678
  let group = this.getGroup(elem);
1652
1679
  if (elem.checked) {
@@ -1672,13 +1699,13 @@ class MenuWidget extends React.Component {
1672
1699
  } else {
1673
1700
  this.map.add(this.layers[elem.id]);
1674
1701
  }
1675
- } else if (this.layers[modularLC]) {
1702
+ } /*else if (this.layers[modularLC]) {
1676
1703
  let previousElem = document
1677
1704
  .getElementById(elem.id)
1678
1705
  .closest('.ccl-form-group')
1679
1706
  .previousElementSibling.querySelector('input');
1680
1707
  this.map.add(this.layers[previousElem.id]);
1681
- } else {
1708
+ } */ else {
1682
1709
  this.map.add(this.layers[elem.id]);
1683
1710
  }
1684
1711
  this.layers[elem.id].visible = true; //layer id
@@ -1694,6 +1721,7 @@ class MenuWidget extends React.Component {
1694
1721
  elem,
1695
1722
  Object.keys(this.activeLayersJSON).length,
1696
1723
  );
1724
+ this.handleRasterVectorLegend();
1697
1725
  } else {
1698
1726
  this.activeLayersJSON[elem.id] = this.addActiveLayer(
1699
1727
  elem,
@@ -105,7 +105,7 @@ class PanWidget extends React.Component {
105
105
  <span
106
106
  aria-hidden="true"
107
107
  role="presentation"
108
- class="esri-widget--button esri-icon esri-icon-pan"
108
+ className="esri-widget--button esri-icon esri-icon-pan"
109
109
  ></span>
110
110
  </div>
111
111
  <div
@@ -192,11 +192,14 @@ class TimesliderWidget extends React.Component {
192
192
  */
193
193
  async componentDidMount() {
194
194
  await this.loader();
195
+ let playRateValue =
196
+ this.layer.ProductId === '8474c3b080fa42cc837f1d2338fcf096' ? 4000 : 1000;
195
197
  this.TimesliderWidget = new TimeSlider({
196
198
  view: this.props.view,
197
199
  container: document.querySelector('.timeslider-panel'),
198
200
  timeVisible: true,
199
201
  mode: 'instant',
202
+ playRate: playRateValue,
200
203
  loop: false,
201
204
  labelFormatFunction: (value, type, element, layout) => {
202
205
  if (!this.TimesliderWidget.fullTimeExtent) {