@eeacms/volto-arcgis-block 0.1.344 → 0.1.345

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,11 @@ 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.345](https://github.com/eea/volto-arcgis-block/compare/0.1.344...0.1.345) - 28 March 2025
8
+
9
+ #### :hammer_and_wrench: Others
10
+
11
+ - Revert "Develop" [Urkorue - [`912673e`](https://github.com/eea/volto-arcgis-block/commit/912673ec966b3d8a3dc6937b0db475ed0901fb15)]
7
12
  ### [0.1.344](https://github.com/eea/volto-arcgis-block/compare/0.1.343...0.1.344) - 27 March 2025
8
13
 
9
14
  #### :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.344",
3
+ "version": "0.1.345",
4
4
  "description": "volto-arcgis-block: Volto add-on",
5
5
  "main": "src/index.js",
6
6
  "author": "European Environment Agency: CodeSyntax",
@@ -4558,132 +4558,83 @@ class MenuWidget extends React.Component {
4558
4558
  };
4559
4559
 
4560
4560
  loadComponentFilters() {
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');
4561
+ var selectedComponent = document.getElementById('select-component');
4562
+ selectedComponent.options.add(
4563
+ new Option('Select a component', 'default', false, false),
4564
+ );
4565
+ selectedComponent.options[0].disabled = true;
4566
+ var selectedProduct = document.getElementById('select-product');
4567
+ selectedProduct.options.add(
4568
+ new Option('Select a product', 'default', false, false),
4569
+ );
4570
+ selectedProduct.options[0].disabled = true;
4571
+ document
4572
+ .querySelector('.menu-family-filter')
4573
+ .setAttribute('style', 'display: none;');
4568
4574
  this.compCfg.forEach((element) => {
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
- };
4575
+ selectedComponent.options.add(
4576
+ new Option(
4577
+ element.ComponentTitle,
4578
+ element.ComponentPosition,
4579
+ element.ComponentPosition,
4580
+ ),
4581
+ );
4583
4582
  });
4584
4583
  }
4585
4584
  loadProductFilters() {
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
- }
4585
+ var selectedComponent = document.getElementById('select-component');
4586
+ var selectedProduct = document.getElementById('select-product');
4604
4587
  if (
4605
4588
  document.querySelector('.clear-filters') &&
4606
- componentFilter.length !== 0
4589
+ selectedComponent.value !== 'default'
4607
4590
  ) {
4608
4591
  document
4609
4592
  .querySelector('.clear-filters')
4610
4593
  .setAttribute('style', 'display: block;');
4611
4594
  }
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
- });
4595
+ this.removeOptions(selectedProduct);
4596
+ selectedProduct.options.add(
4597
+ new Option('Select a product', 'default', false, false),
4598
+ );
4599
+ selectedProduct.options[0].disabled = true;
4600
+ this.compCfg.forEach((component) => {
4601
+ if (component.ComponentPosition.toString() === selectedComponent.value) {
4602
+ component.Products.forEach((product) => {
4603
+ selectedProduct.options.add(
4604
+ new Option(
4605
+ product.ProductTitle,
4606
+ product.ProductId,
4607
+ product.ProductId,
4608
+ ),
4609
+ );
4610
+ });
4611
+ }
4629
4612
  });
4613
+ let familyFilter = document.querySelector('.menu-family-filter');
4614
+ if (familyFilter) {
4615
+ familyFilter.setAttribute('style', 'display: none;');
4616
+ }
4630
4617
  }
4631
4618
  async loadFamilyFilters() {
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)
4619
+ // var selectedFamily = document.getElementById('select-family');
4620
+ // var selectedProduct = document.getElementById('select-product');
4621
+ // this.removeOptions(selectedFamily);
4622
+ //let tax = await this.getTaxonomy('collective.taxonomy.family');
4623
+ //let hasFamily = false;
4624
+ // selectedFamily.options.add(
4625
+ // new Option('Select a family', 'default', false, false),
4626
+ // );
4627
+ //let text = selectedProduct.selectedOptions[0].text
4628
+ // tax.tree.forEach((element) => {
4629
+ // if (element.title === selectedProduct.selectedOptions[0].text) {
4630
+ // //hasFamily = true;
4631
+ // element.children.forEach((child) => {
4632
+ // selectedFamily.options.add(
4633
+ // new Option(child.title, child.key, child.key),
4634
+ // );
4635
+ // });
4649
4636
  // }
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
- // })
4668
4637
  // });
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
- // // });
4687
4638
  // let familyFilter = document.querySelector('.menu-family-filter');
4688
4639
  // if (familyFilter) {
4689
4640
  // if (!hasFamily) {
@@ -4695,8 +4646,8 @@ class MenuWidget extends React.Component {
4695
4646
  }
4696
4647
  async menuSearch() {
4697
4648
  let searchText;
4698
- let componentFilter = [];
4699
- let productFilter = [];
4649
+ let componentFilter;
4650
+ let productFilter;
4700
4651
  //let familyFilter;
4701
4652
  let result = false;
4702
4653
  if (document.querySelector('#menu-searchtext')) {
@@ -4705,20 +4656,10 @@ class MenuWidget extends React.Component {
4705
4656
  .value?.toUpperCase();
4706
4657
  }
4707
4658
  if (document.getElementById('select-component')) {
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
- }
4659
+ componentFilter = document.getElementById('select-component').value;
4714
4660
  }
4715
4661
  if (document.getElementById('select-product')) {
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
- }
4662
+ productFilter = document.getElementById('select-product').value;
4722
4663
  }
4723
4664
  // if (document.getElementById('select-family')) {
4724
4665
  // familyFilter = document.getElementById('select-family').text;
@@ -4754,8 +4695,8 @@ class MenuWidget extends React.Component {
4754
4695
  }
4755
4696
  if (
4756
4697
  searchText === '' &&
4757
- componentFilter.length === 0 &&
4758
- productFilter.length === 0
4698
+ componentFilter === 'default' &&
4699
+ productFilter === 'default'
4759
4700
  ) {
4760
4701
  this.filtersApplied = false;
4761
4702
  componentFound = true;
@@ -4779,12 +4720,11 @@ class MenuWidget extends React.Component {
4779
4720
  } else if (
4780
4721
  datasetChecked ||
4781
4722
  (dataset?.DatasetTitle?.toUpperCase().includes(searchText) &&
4782
- (productFilter.includes(product.ProductId) ||
4783
- productFilter.length === 0) &&
4784
- (componentFilter.includes(
4785
- this.compCfg[index].ComponentPosition.toString(),
4786
- ) ||
4787
- componentFilter.length === 0))
4723
+ (product.ProductId === productFilter ||
4724
+ productFilter === 'default') &&
4725
+ (this.compCfg[index].ComponentPosition.toString() ===
4726
+ componentFilter ||
4727
+ componentFilter === 'default'))
4788
4728
  ) {
4789
4729
  this.filtersApplied = true;
4790
4730
  componentFound = true;
@@ -4851,13 +4791,22 @@ class MenuWidget extends React.Component {
4851
4791
  }
4852
4792
  }
4853
4793
  clearFilters() {
4854
- let componentList = document.getElementsByClassName('component_item');
4855
- for (let m = 0; m < componentList.length; m++) {
4856
- componentList[m].checked = false;
4794
+ if (document.getElementById('select-component')) {
4795
+ document.getElementById('select-component').value = 'default';
4857
4796
  }
4858
- let list = document.querySelector('.product-items');
4859
- while (list.firstChild) {
4860
- list.removeChild(list.lastChild);
4797
+ let selectedProduct = document.getElementById('select-product');
4798
+ if (selectedProduct) {
4799
+ this.removeOptions(selectedProduct);
4800
+ selectedProduct.options.add(
4801
+ new Option('Select a product', 'default', false, false),
4802
+ );
4803
+ }
4804
+ if (document.getElementById('select-family')) {
4805
+ document.getElementById('select-family').value = 'default';
4806
+ }
4807
+ let familyFilter = document.querySelector('.menu-family-filter');
4808
+ if (familyFilter) {
4809
+ familyFilter.setAttribute('style', 'display: none;');
4861
4810
  }
4862
4811
  if (document.querySelector('.clear-filters')) {
4863
4812
  document
@@ -5081,11 +5030,7 @@ class MenuWidget extends React.Component {
5081
5030
  <div className="filters-panel">
5082
5031
  <span className="menu-filter">
5083
5032
  Component
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
5033
+ <select
5089
5034
  id="select-component"
5090
5035
  class="esri-select filter-select"
5091
5036
  onBlur={() => {}}
@@ -5093,15 +5038,11 @@ class MenuWidget extends React.Component {
5093
5038
  this.loadProductFilters();
5094
5039
  this.menuSearch();
5095
5040
  }}
5096
- ></select> */}
5041
+ ></select>
5097
5042
  </span>
5098
5043
  <span className="menu-filter">
5099
5044
  Product groups
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
5045
+ <select
5105
5046
  id="select-product"
5106
5047
  class="esri-select filter-select"
5107
5048
  onBlur={() => {}}
@@ -5109,20 +5050,15 @@ class MenuWidget extends React.Component {
5109
5050
  this.loadFamilyFilters();
5110
5051
  this.menuSearch();
5111
5052
  }}
5112
- ></select> */}
5053
+ ></select>
5113
5054
  </span>
5114
- {/* <span className="menu-filter menu-family-filter">
5055
+ <span className="menu-filter menu-family-filter">
5115
5056
  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>
5121
5057
  <select
5122
5058
  id="select-family"
5123
5059
  class="esri-select filter-select"
5124
- ></select>
5125
- </span> */}
5060
+ ></select>
5061
+ </span>
5126
5062
  </div>
5127
5063
  </div>
5128
5064
  </div>
@@ -1707,64 +1707,3 @@ 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
- }