@eeacms/volto-arcgis-block 0.1.342 → 0.1.344

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,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.344](https://github.com/eea/volto-arcgis-block/compare/0.1.343...0.1.344) - 27 March 2025
8
+
9
+ #### :hammer_and_wrench: Others
10
+
11
+ - CLMS-282463 (feat): Multiselection added to toc menu [Urkorue - [`e09738d`](https://github.com/eea/volto-arcgis-block/commit/e09738d883a19157dd55ecfa0852e3aee9e29d04)]
12
+ - Merge pull request #914 from eea/CLMS-282463-Filters-multiselection [Unai Bolivar - [`f008130`](https://github.com/eea/volto-arcgis-block/commit/f008130605be4161309d9d6c40891fe083178d02)]
13
+ ### [0.1.343](https://github.com/eea/volto-arcgis-block/compare/0.1.342...0.1.343) - 20 March 2025
14
+
15
+ #### :hammer_and_wrench: Others
16
+
17
+ - Merge pull request #911 from eea/CLMS-DEMO-BUG-LAYERS-NOT-LOADING-AFTER-TOGGLING-CHECK [Unai Bolivar - [`0ab2532`](https://github.com/eea/volto-arcgis-block/commit/0ab25327fa4eea7b62035cd3ce6e5bee32eb6d01)]
18
+ - CLMS-DEMO (bug): Fixed lyers that didn't load on map view after toggleing their checks on [Unai Bolivar - [`a7eb001`](https://github.com/eea/volto-arcgis-block/commit/a7eb001979871dfce976dab786ed2d109bf41dfe)]
7
19
  ### [0.1.342](https://github.com/eea/volto-arcgis-block/compare/0.1.341...0.1.342) - 20 March 2025
8
20
 
9
21
  #### :hammer_and_wrench: Others
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@eeacms/volto-arcgis-block",
3
- "version": "0.1.342",
3
+ "version": "0.1.344",
4
4
  "description": "volto-arcgis-block: Volto add-on",
5
5
  "main": "src/index.js",
6
6
  "author": "European Environment Agency: CodeSyntax",
@@ -2432,8 +2432,7 @@ class MenuWidget extends React.Component {
2432
2432
  if (
2433
2433
  this.props.download ||
2434
2434
  this.location.search.includes('product=') ||
2435
- this.location.search.includes('dataset=') ||
2436
- !userService
2435
+ (this.location.search.includes('dataset=') && !userService)
2437
2436
  ) {
2438
2437
  if (
2439
2438
  this.extentInitiated === false &&
@@ -2446,8 +2445,8 @@ class MenuWidget extends React.Component {
2446
2445
  }
2447
2446
  }
2448
2447
  if (
2449
- ((elem.id.includes('all_lcc') || elem.id.includes('all_present')) &&
2450
- (this.layers['lc_filter'] || this.layers['lcc_filter'])) ||
2448
+ (elem.id.includes('all_lcc') || elem.id.includes('all_present')) &&
2449
+ (this.layers['lc_filter'] || this.layers['lcc_filter']) &&
2451
2450
  !userService
2452
2451
  ) {
2453
2452
  let bookmarkHotspotFilter = localStorage.getItem(
@@ -4099,7 +4098,7 @@ class MenuWidget extends React.Component {
4099
4098
  this.state.wmsUserServiceLayers.length > 0 &&
4100
4099
  prevState.wmsUserServiceLayers.length === 0
4101
4100
  ) {
4102
- // Close other tabs and open "My Services"
4101
+ // Close other tabs and open "My Services" tab
4103
4102
  let dropdownsMapMenu = document.querySelectorAll('.map-menu-dropdown');
4104
4103
  let i = dropdownsMapMenu.length - 1;
4105
4104
  // let j = 0;
@@ -4559,83 +4558,132 @@ class MenuWidget extends React.Component {
4559
4558
  };
4560
4559
 
4561
4560
  loadComponentFilters() {
4562
- var selectedComponent = document.getElementById('select-component');
4563
- selectedComponent.options.add(
4564
- new Option('Select a component', 'default', false, false),
4565
- );
4566
- selectedComponent.options[0].disabled = true;
4567
- var selectedProduct = document.getElementById('select-product');
4568
- selectedProduct.options.add(
4569
- new Option('Select a product', 'default', false, false),
4570
- );
4571
- selectedProduct.options[0].disabled = true;
4572
- document
4573
- .querySelector('.menu-family-filter')
4574
- .setAttribute('style', 'display: none;');
4561
+ var checkList = document.getElementById('select-component');
4562
+ checkList.getElementsByClassName('anchor')[0].onclick = function (evt) {
4563
+ if (checkList.classList.contains('visible'))
4564
+ checkList.classList.remove('visible');
4565
+ else checkList.classList.add('visible');
4566
+ };
4567
+ let list = document.querySelector('.component-items');
4575
4568
  this.compCfg.forEach((element) => {
4576
- selectedComponent.options.add(
4577
- new Option(
4578
- element.ComponentTitle,
4579
- element.ComponentPosition,
4580
- element.ComponentPosition,
4581
- ),
4582
- );
4569
+ let inputNode = document.createElement('input');
4570
+ let lavelNode = document.createElement('lavel');
4571
+ inputNode.setAttribute('type', 'checkbox');
4572
+ inputNode.classList.add('component_item');
4573
+ inputNode.setAttribute('value', element.ComponentPosition);
4574
+ lavelNode.innerText = element.ComponentTitle;
4575
+ let listNode = document.createElement('li');
4576
+ listNode.appendChild(inputNode);
4577
+ listNode.appendChild(lavelNode);
4578
+ list.appendChild(listNode);
4579
+ inputNode.onclick = () => {
4580
+ this.loadProductFilters();
4581
+ this.menuSearch();
4582
+ };
4583
4583
  });
4584
4584
  }
4585
4585
  loadProductFilters() {
4586
- var selectedComponent = document.getElementById('select-component');
4587
- var selectedProduct = document.getElementById('select-product');
4586
+ var checkList = document.getElementById('select-product');
4587
+ checkList.getElementsByClassName('anchor')[0].onclick = function (evt) {
4588
+ if (checkList.classList.contains('visible'))
4589
+ checkList.classList.remove('visible');
4590
+ else checkList.classList.add('visible');
4591
+ };
4592
+ let list = document.querySelector('.product-items');
4593
+ while (list.firstChild) {
4594
+ list.removeChild(list.lastChild);
4595
+ }
4596
+
4597
+ let componentList = document.getElementsByClassName('component_item');
4598
+ let componentFilter = [];
4599
+ for (let m = 0; m < componentList.length; m++) {
4600
+ if (componentList[m].checked) {
4601
+ componentFilter.push(componentList[m].value);
4602
+ }
4603
+ }
4588
4604
  if (
4589
4605
  document.querySelector('.clear-filters') &&
4590
- selectedComponent.value !== 'default'
4606
+ componentFilter.length !== 0
4591
4607
  ) {
4592
4608
  document
4593
4609
  .querySelector('.clear-filters')
4594
4610
  .setAttribute('style', 'display: block;');
4595
4611
  }
4596
- this.removeOptions(selectedProduct);
4597
- selectedProduct.options.add(
4598
- new Option('Select a product', 'default', false, false),
4599
- );
4600
- selectedProduct.options[0].disabled = true;
4601
- this.compCfg.forEach((component) => {
4602
- if (component.ComponentPosition.toString() === selectedComponent.value) {
4603
- component.Products.forEach((product) => {
4604
- selectedProduct.options.add(
4605
- new Option(
4606
- product.ProductTitle,
4607
- product.ProductId,
4608
- product.ProductId,
4609
- ),
4610
- );
4611
- });
4612
- }
4612
+ componentFilter.forEach((component) => {
4613
+ this.compCfg[component].Products.forEach((product) => {
4614
+ let inputNode = document.createElement('input');
4615
+ let lavelNode = document.createElement('lavel');
4616
+ inputNode.setAttribute('type', 'checkbox');
4617
+ inputNode.classList.add('product_item');
4618
+ inputNode.setAttribute('value', product.ProductId);
4619
+ lavelNode.innerText = product.ProductTitle;
4620
+ let listNode = document.createElement('li');
4621
+ listNode.appendChild(inputNode);
4622
+ listNode.appendChild(lavelNode);
4623
+ list.appendChild(listNode);
4624
+ inputNode.onclick = () => {
4625
+ this.loadFamilyFilters();
4626
+ this.menuSearch();
4627
+ };
4628
+ });
4613
4629
  });
4614
- let familyFilter = document.querySelector('.menu-family-filter');
4615
- if (familyFilter) {
4616
- familyFilter.setAttribute('style', 'display: none;');
4617
- }
4618
4630
  }
4619
4631
  async loadFamilyFilters() {
4620
- // var selectedFamily = document.getElementById('select-family');
4621
- // var selectedProduct = document.getElementById('select-product');
4622
- // this.removeOptions(selectedFamily);
4623
- //let tax = await this.getTaxonomy('collective.taxonomy.family');
4624
- //let hasFamily = false;
4625
- // selectedFamily.options.add(
4626
- // new Option('Select a family', 'default', false, false),
4627
- // );
4628
- //let text = selectedProduct.selectedOptions[0].text
4629
- // tax.tree.forEach((element) => {
4630
- // if (element.title === selectedProduct.selectedOptions[0].text) {
4631
- // //hasFamily = true;
4632
- // element.children.forEach((child) => {
4633
- // selectedFamily.options.add(
4634
- // new Option(child.title, child.key, child.key),
4635
- // );
4636
- // });
4632
+ // let tax = await this.getTaxonomy('collective.taxonomy.family');
4633
+ // var checkList = document.getElementById('select-family');
4634
+ // checkList.getElementsByClassName('anchor')[0].onclick = function(evt) {
4635
+ // if (checkList.classList.contains('visible'))
4636
+ // checkList.classList.remove('visible');
4637
+ // else
4638
+ // checkList.classList.add('visible');
4639
+ // }
4640
+ // let list = document.querySelector('.family-items');
4641
+ // while (list.firstChild) {
4642
+ // list.removeChild(list.lastChild);
4643
+ // }
4644
+ // let componentList = document.getElementsByClassName('component_item');
4645
+ // let componentFilter = [];
4646
+ // for (let m = 0; m < componentList.length; m++) {
4647
+ // if (componentList[m].checked) {
4648
+ // componentFilter.push(componentList[m].value)
4637
4649
  // }
4650
+ // }
4651
+ // componentFilter.forEach(component => {
4652
+ // this.compCfg[component].Products.forEach(product => {
4653
+ // let inputNode = document.createElement('input');
4654
+ // let lavelNode = document.createElement('lavel');
4655
+ // inputNode.setAttribute('type','checkbox');
4656
+ // inputNode.classList.add('product_item')
4657
+ // inputNode.setAttribute('value', product.ProductId)
4658
+ // lavelNode.innerText = product.ProductTitle;
4659
+ // let listNode = document.createElement('li');
4660
+ // listNode.appendChild(inputNode);
4661
+ // listNode.appendChild(lavelNode);
4662
+ // list.appendChild(listNode)
4663
+ // inputNode.onclick= () => {
4664
+ // this.loadFamilyFilters();
4665
+ // this.menuSearch();
4666
+ // };
4667
+ // })
4638
4668
  // });
4669
+ // // var selectedFamily = document.getElementById('select-family');
4670
+ // // var selectedProduct = document.getElementById('select-product');
4671
+ // // this.removeOptions(selectedFamily);
4672
+ // let hasFamily = false;
4673
+ // // selectedFamily.options.add(
4674
+ // // new Option('Select a family', 'default', false, false),
4675
+ // // );
4676
+ // // let text = selectedProduct.selectedOptions[0].text
4677
+ // // tax.tree.forEach((element) => {
4678
+ // // if (element.title === selectedProduct.selectedOptions[0].text) {
4679
+ // // //hasFamily = true;
4680
+ // // element.children.forEach((child) => {
4681
+ // // selectedFamily.options.add(
4682
+ // // new Option(child.title, child.key, child.key),
4683
+ // // );
4684
+ // // });
4685
+ // // }
4686
+ // // });
4639
4687
  // let familyFilter = document.querySelector('.menu-family-filter');
4640
4688
  // if (familyFilter) {
4641
4689
  // if (!hasFamily) {
@@ -4647,8 +4695,8 @@ class MenuWidget extends React.Component {
4647
4695
  }
4648
4696
  async menuSearch() {
4649
4697
  let searchText;
4650
- let componentFilter;
4651
- let productFilter;
4698
+ let componentFilter = [];
4699
+ let productFilter = [];
4652
4700
  //let familyFilter;
4653
4701
  let result = false;
4654
4702
  if (document.querySelector('#menu-searchtext')) {
@@ -4657,10 +4705,20 @@ class MenuWidget extends React.Component {
4657
4705
  .value?.toUpperCase();
4658
4706
  }
4659
4707
  if (document.getElementById('select-component')) {
4660
- componentFilter = document.getElementById('select-component').value;
4708
+ let componentList = document.getElementsByClassName('component_item');
4709
+ for (let m = 0; m < componentList.length; m++) {
4710
+ if (componentList[m].checked) {
4711
+ componentFilter.push(componentList[m].value);
4712
+ }
4713
+ }
4661
4714
  }
4662
4715
  if (document.getElementById('select-product')) {
4663
- productFilter = document.getElementById('select-product').value;
4716
+ let productList = document.getElementsByClassName('product_item');
4717
+ for (let n = 0; n < productList.length; n++) {
4718
+ if (productList[n].checked) {
4719
+ productFilter.push(productList[n].value);
4720
+ }
4721
+ }
4664
4722
  }
4665
4723
  // if (document.getElementById('select-family')) {
4666
4724
  // familyFilter = document.getElementById('select-family').text;
@@ -4696,8 +4754,8 @@ class MenuWidget extends React.Component {
4696
4754
  }
4697
4755
  if (
4698
4756
  searchText === '' &&
4699
- componentFilter === 'default' &&
4700
- productFilter === 'default'
4757
+ componentFilter.length === 0 &&
4758
+ productFilter.length === 0
4701
4759
  ) {
4702
4760
  this.filtersApplied = false;
4703
4761
  componentFound = true;
@@ -4721,11 +4779,12 @@ class MenuWidget extends React.Component {
4721
4779
  } else if (
4722
4780
  datasetChecked ||
4723
4781
  (dataset?.DatasetTitle?.toUpperCase().includes(searchText) &&
4724
- (product.ProductId === productFilter ||
4725
- productFilter === 'default') &&
4726
- (this.compCfg[index].ComponentPosition.toString() ===
4727
- componentFilter ||
4728
- componentFilter === 'default'))
4782
+ (productFilter.includes(product.ProductId) ||
4783
+ productFilter.length === 0) &&
4784
+ (componentFilter.includes(
4785
+ this.compCfg[index].ComponentPosition.toString(),
4786
+ ) ||
4787
+ componentFilter.length === 0))
4729
4788
  ) {
4730
4789
  this.filtersApplied = true;
4731
4790
  componentFound = true;
@@ -4792,22 +4851,13 @@ class MenuWidget extends React.Component {
4792
4851
  }
4793
4852
  }
4794
4853
  clearFilters() {
4795
- if (document.getElementById('select-component')) {
4796
- document.getElementById('select-component').value = 'default';
4854
+ let componentList = document.getElementsByClassName('component_item');
4855
+ for (let m = 0; m < componentList.length; m++) {
4856
+ componentList[m].checked = false;
4797
4857
  }
4798
- let selectedProduct = document.getElementById('select-product');
4799
- if (selectedProduct) {
4800
- this.removeOptions(selectedProduct);
4801
- selectedProduct.options.add(
4802
- new Option('Select a product', 'default', false, false),
4803
- );
4804
- }
4805
- if (document.getElementById('select-family')) {
4806
- document.getElementById('select-family').value = 'default';
4807
- }
4808
- let familyFilter = document.querySelector('.menu-family-filter');
4809
- if (familyFilter) {
4810
- familyFilter.setAttribute('style', 'display: none;');
4858
+ let list = document.querySelector('.product-items');
4859
+ while (list.firstChild) {
4860
+ list.removeChild(list.lastChild);
4811
4861
  }
4812
4862
  if (document.querySelector('.clear-filters')) {
4813
4863
  document
@@ -5031,7 +5081,11 @@ class MenuWidget extends React.Component {
5031
5081
  <div className="filters-panel">
5032
5082
  <span className="menu-filter">
5033
5083
  Component
5034
- <select
5084
+ <div id="select-component" class="dropdown-check-list">
5085
+ <span class="anchor">Select a Component</span>
5086
+ <ul class="items component-items"></ul>
5087
+ </div>
5088
+ {/* <select
5035
5089
  id="select-component"
5036
5090
  class="esri-select filter-select"
5037
5091
  onBlur={() => {}}
@@ -5039,11 +5093,15 @@ class MenuWidget extends React.Component {
5039
5093
  this.loadProductFilters();
5040
5094
  this.menuSearch();
5041
5095
  }}
5042
- ></select>
5096
+ ></select> */}
5043
5097
  </span>
5044
5098
  <span className="menu-filter">
5045
5099
  Product groups
5046
- <select
5100
+ <div id="select-product" class="dropdown-check-list">
5101
+ <span class="anchor">Select a Product</span>
5102
+ <ul class="items product-items"></ul>
5103
+ </div>
5104
+ {/* <select
5047
5105
  id="select-product"
5048
5106
  class="esri-select filter-select"
5049
5107
  onBlur={() => {}}
@@ -5051,15 +5109,20 @@ class MenuWidget extends React.Component {
5051
5109
  this.loadFamilyFilters();
5052
5110
  this.menuSearch();
5053
5111
  }}
5054
- ></select>
5112
+ ></select> */}
5055
5113
  </span>
5056
- <span className="menu-filter menu-family-filter">
5114
+ {/* <span className="menu-filter menu-family-filter">
5057
5115
  Family
5116
+ <div id="select-family" class="dropdown-check-list">
5117
+ <span class="anchor">Select a Family</span>
5118
+ <ul class="items family-items">
5119
+ </ul>
5120
+ </div>
5058
5121
  <select
5059
5122
  id="select-family"
5060
5123
  class="esri-select filter-select"
5061
- ></select>
5062
- </span>
5124
+ ></select>
5125
+ </span> */}
5063
5126
  </div>
5064
5127
  </div>
5065
5128
  </div>
@@ -1707,3 +1707,64 @@ div.map-container.popup-block {
1707
1707
  .filters-element.filter-logo.filters-header {
1708
1708
  justify-content: space-between;
1709
1709
  }
1710
+
1711
+ .select-component {
1712
+ height: 30px;
1713
+ }
1714
+
1715
+ .dropdown-check-list {
1716
+ display: inline-block;
1717
+ width: 280px;
1718
+ }
1719
+
1720
+ .dropdown-check-list .anchor {
1721
+ position: relative;
1722
+ display: inline-block;
1723
+ width: 280px;
1724
+ height: 22px;
1725
+ padding: 0px 50px 5px 10px;
1726
+ border: 1px solid #ccc;
1727
+ cursor: pointer;
1728
+ font-size: 15px;
1729
+ }
1730
+
1731
+ .dropdown-check-list .anchor:after {
1732
+ position: absolute;
1733
+ top: 20%;
1734
+ right: 10px;
1735
+ padding: 5px;
1736
+ border-top: 2px solid black;
1737
+ border-left: 2px solid black;
1738
+ content: '';
1739
+ -moz-transform: rotate(-135deg);
1740
+ -ms-transform: rotate(-135deg);
1741
+ -o-transform: rotate(-135deg);
1742
+ -webkit-transform: rotate(-135deg);
1743
+ transform: rotate(-135deg);
1744
+ }
1745
+
1746
+ .dropdown-check-list .anchor:active:after {
1747
+ top: 21%;
1748
+ right: 8px;
1749
+ }
1750
+
1751
+ .dropdown-check-list ul.items {
1752
+ display: none;
1753
+ padding: 2px;
1754
+ border: 1px solid #ccc;
1755
+ border-top: none;
1756
+ margin: 0;
1757
+ }
1758
+
1759
+ .dropdown-check-list ul.items li {
1760
+ font-size: 14px;
1761
+ list-style: none;
1762
+ }
1763
+
1764
+ .dropdown-check-list.visible .anchor {
1765
+ color: #a0b128;
1766
+ }
1767
+
1768
+ .dropdown-check-list.visible .items {
1769
+ display: block;
1770
+ }