@eeacms/volto-arcgis-block 0.1.139 → 0.1.141

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,7 +4,16 @@ 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.139](https://github.com/eea/volto-arcgis-block/compare/0.1.138...0.1.139) - 9 May 2023
7
+ ### [0.1.141](https://github.com/eea/volto-arcgis-block/compare/0.1.140...0.1.141) - 11 May 2023
8
+
9
+ ### [0.1.140](https://github.com/eea/volto-arcgis-block/compare/0.1.139...0.1.140) - 11 May 2023
10
+
11
+ #### :hammer_and_wrench: Others
12
+
13
+ - CLMS-1953 (lint): Sets only one span with text. Can handle layers with no legends [ujbolivar - [`4335250`](https://github.com/eea/volto-arcgis-block/commit/433525063af14ac1e48d9a5bb646127769efb5e2)]
14
+ - CLMS-1953 (lint): Ran linting scripts [ujbolivar - [`b73661d`](https://github.com/eea/volto-arcgis-block/commit/b73661d000cda6629be6dd0b110d5acb96c1e1bf)]
15
+ - CLMS-1953 (chore): cleaned up and took out unecessary functions [ujbolivar - [`60cd5f8`](https://github.com/eea/volto-arcgis-block/commit/60cd5f87f7737bfda0ae801b3acf7627bfe2c182)]
16
+ ### [0.1.139](https://github.com/eea/volto-arcgis-block/compare/0.1.138...0.1.139) - 10 May 2023
8
17
 
9
18
  #### :hammer_and_wrench: Others
10
19
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@eeacms/volto-arcgis-block",
3
- "version": "0.1.139",
3
+ "version": "0.1.141",
4
4
  "description": "volto-arcgis-block: Volto add-on",
5
5
  "main": "src/index.js",
6
6
  "author": "European Environment Agency: CodeSyntax",
@@ -34,11 +34,15 @@ class LegendWidget extends React.Component {
34
34
 
35
35
  // If img src returns a broken link
36
36
  if (!(img.complete && img.naturalHeight !== 0)) {
37
- img.style.display = 'none';
37
+ if (img.style) {
38
+ img.style.display = 'none';
38
39
 
39
- let span = document.createElement('span');
40
- span.innerHTML = 'No legend available';
41
- element.parentNode.appendChild(span);
40
+ if (element.parentNode.querySelector('span')) return;
41
+
42
+ let span = document.createElement('span');
43
+ span.innerHTML = 'No legend available';
44
+ element.parentNode.appendChild(span);
45
+ }
42
46
  }
43
47
  });
44
48
  }
@@ -648,25 +648,6 @@ class MenuWidget extends React.Component {
648
648
  }, 1000);
649
649
  }
650
650
 
651
- setLegendOpacity = () => {
652
- const collection = document.getElementsByClassName('esri-legend__symbol');
653
-
654
- Array.prototype.forEach.call(collection, function (element) {
655
- let img = {};
656
-
657
- if (element.hasChildNodes()) {
658
- img = element.childNodes[0];
659
- } else {
660
- img = element;
661
- }
662
- // Set Legend opacity back to 1;
663
- img.setAttribute(
664
- 'style',
665
- 'opacity:1; -moz-opacity:1; filter:alpha(opacity=100)',
666
- );
667
- });
668
- };
669
-
670
651
  /**
671
652
  * This method is executed after the render method is executed
672
653
  */
@@ -2692,8 +2673,8 @@ class MenuWidget extends React.Component {
2692
2673
  if (
2693
2674
  this.map.findLayerById(layer) &&
2694
2675
  this.map.findLayerById(layer) !== null &&
2695
- this.map.findLayerById(layer).opacity &&
2696
- this.map.findLayerById(layer).opacity !== null
2676
+ (this.map.findLayerById(layer).opacity ||
2677
+ this.map.findLayerById(layer).opacity === 0)
2697
2678
  ) {
2698
2679
  this.map.findLayerById(layer).opacity = value / 100;
2699
2680
  }
@@ -2701,7 +2682,6 @@ class MenuWidget extends React.Component {
2701
2682
  '.active-layer[layer-id="' + layer + '"] .active-layer-opacity',
2702
2683
  ).dataset.opacity = value;
2703
2684
  // }
2704
- this.setLegendOpacity();
2705
2685
  }
2706
2686
 
2707
2687
  /**
@@ -2816,16 +2796,15 @@ class MenuWidget extends React.Component {
2816
2796
  if (this.visibleLayers[elem.id][1] === 'eye-slash') {
2817
2797
  this.map.findLayerById(elem.id).visible = false;
2818
2798
  } else {
2819
- let layerOpacityes = JSON.parse(
2799
+ let layerOpacities = JSON.parse(
2820
2800
  sessionStorage.getItem('layerOpacities'),
2821
2801
  );
2822
2802
  if (
2823
- layerOpacityes &&
2824
- layerOpacityes !== null &&
2825
- layerOpacityes[elem.id] &&
2826
- layerOpacityes[elem.id] !== null
2803
+ layerOpacities &&
2804
+ layerOpacities !== null &&
2805
+ (layerOpacities[elem.id] || layerOpacities[elem.id] === 0)
2827
2806
  ) {
2828
- this.map.findLayerById(elem.id).opacity = layerOpacityes[elem.id];
2807
+ this.map.findLayerById(elem.id).opacity = layerOpacities[elem.id];
2829
2808
  }
2830
2809
  }
2831
2810
  }