@eeacms/volto-arcgis-block 0.1.343 → 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,12 @@ 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)]
7
13
  ### [0.1.343](https://github.com/eea/volto-arcgis-block/compare/0.1.342...0.1.343) - 20 March 2025
8
14
 
9
15
  #### :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.343",
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",
@@ -4558,83 +4558,132 @@ class MenuWidget extends React.Component {
4558
4558
  };
4559
4559
 
4560
4560
  loadComponentFilters() {
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;');
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');
4574
4568
  this.compCfg.forEach((element) => {
4575
- selectedComponent.options.add(
4576
- new Option(
4577
- element.ComponentTitle,
4578
- element.ComponentPosition,
4579
- element.ComponentPosition,
4580
- ),
4581
- );
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
+ };
4582
4583
  });
4583
4584
  }
4584
4585
  loadProductFilters() {
4585
- var selectedComponent = document.getElementById('select-component');
4586
- 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
+ }
4587
4604
  if (
4588
4605
  document.querySelector('.clear-filters') &&
4589
- selectedComponent.value !== 'default'
4606
+ componentFilter.length !== 0
4590
4607
  ) {
4591
4608
  document
4592
4609
  .querySelector('.clear-filters')
4593
4610
  .setAttribute('style', 'display: block;');
4594
4611
  }
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
- }
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
+ });
4612
4629
  });
4613
- let familyFilter = document.querySelector('.menu-family-filter');
4614
- if (familyFilter) {
4615
- familyFilter.setAttribute('style', 'display: none;');
4616
- }
4617
4630
  }
4618
4631
  async loadFamilyFilters() {
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
- // });
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)
4636
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
+ // })
4637
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
+ // // });
4638
4687
  // let familyFilter = document.querySelector('.menu-family-filter');
4639
4688
  // if (familyFilter) {
4640
4689
  // if (!hasFamily) {
@@ -4646,8 +4695,8 @@ class MenuWidget extends React.Component {
4646
4695
  }
4647
4696
  async menuSearch() {
4648
4697
  let searchText;
4649
- let componentFilter;
4650
- let productFilter;
4698
+ let componentFilter = [];
4699
+ let productFilter = [];
4651
4700
  //let familyFilter;
4652
4701
  let result = false;
4653
4702
  if (document.querySelector('#menu-searchtext')) {
@@ -4656,10 +4705,20 @@ class MenuWidget extends React.Component {
4656
4705
  .value?.toUpperCase();
4657
4706
  }
4658
4707
  if (document.getElementById('select-component')) {
4659
- 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
+ }
4660
4714
  }
4661
4715
  if (document.getElementById('select-product')) {
4662
- 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
+ }
4663
4722
  }
4664
4723
  // if (document.getElementById('select-family')) {
4665
4724
  // familyFilter = document.getElementById('select-family').text;
@@ -4695,8 +4754,8 @@ class MenuWidget extends React.Component {
4695
4754
  }
4696
4755
  if (
4697
4756
  searchText === '' &&
4698
- componentFilter === 'default' &&
4699
- productFilter === 'default'
4757
+ componentFilter.length === 0 &&
4758
+ productFilter.length === 0
4700
4759
  ) {
4701
4760
  this.filtersApplied = false;
4702
4761
  componentFound = true;
@@ -4720,11 +4779,12 @@ class MenuWidget extends React.Component {
4720
4779
  } else if (
4721
4780
  datasetChecked ||
4722
4781
  (dataset?.DatasetTitle?.toUpperCase().includes(searchText) &&
4723
- (product.ProductId === productFilter ||
4724
- productFilter === 'default') &&
4725
- (this.compCfg[index].ComponentPosition.toString() ===
4726
- componentFilter ||
4727
- 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))
4728
4788
  ) {
4729
4789
  this.filtersApplied = true;
4730
4790
  componentFound = true;
@@ -4791,22 +4851,13 @@ class MenuWidget extends React.Component {
4791
4851
  }
4792
4852
  }
4793
4853
  clearFilters() {
4794
- if (document.getElementById('select-component')) {
4795
- 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;
4796
4857
  }
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;');
4858
+ let list = document.querySelector('.product-items');
4859
+ while (list.firstChild) {
4860
+ list.removeChild(list.lastChild);
4810
4861
  }
4811
4862
  if (document.querySelector('.clear-filters')) {
4812
4863
  document
@@ -5030,7 +5081,11 @@ class MenuWidget extends React.Component {
5030
5081
  <div className="filters-panel">
5031
5082
  <span className="menu-filter">
5032
5083
  Component
5033
- <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
5034
5089
  id="select-component"
5035
5090
  class="esri-select filter-select"
5036
5091
  onBlur={() => {}}
@@ -5038,11 +5093,15 @@ class MenuWidget extends React.Component {
5038
5093
  this.loadProductFilters();
5039
5094
  this.menuSearch();
5040
5095
  }}
5041
- ></select>
5096
+ ></select> */}
5042
5097
  </span>
5043
5098
  <span className="menu-filter">
5044
5099
  Product groups
5045
- <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
5046
5105
  id="select-product"
5047
5106
  class="esri-select filter-select"
5048
5107
  onBlur={() => {}}
@@ -5050,15 +5109,20 @@ class MenuWidget extends React.Component {
5050
5109
  this.loadFamilyFilters();
5051
5110
  this.menuSearch();
5052
5111
  }}
5053
- ></select>
5112
+ ></select> */}
5054
5113
  </span>
5055
- <span className="menu-filter menu-family-filter">
5114
+ {/* <span className="menu-filter menu-family-filter">
5056
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>
5057
5121
  <select
5058
5122
  id="select-family"
5059
5123
  class="esri-select filter-select"
5060
- ></select>
5061
- </span>
5124
+ ></select>
5125
+ </span> */}
5062
5126
  </div>
5063
5127
  </div>
5064
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
+ }