@eeacms/volto-arcgis-block 0.1.324 → 0.1.325

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,13 @@ 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.325](https://github.com/eea/volto-arcgis-block/compare/0.1.324...0.1.325) - 20 December 2024
8
+
9
+ #### :hammer_and_wrench: Others
10
+
11
+ - CLMS-280068 (Feat): Removed taxonomy [Urkorue - [`21170b2`](https://github.com/eea/volto-arcgis-block/commit/21170b2390eb7f30b32f8668a0c23578e68a1869)]
12
+ - CLMS-280068 (Feat): Added missing lines [Urkorue - [`311b2d2`](https://github.com/eea/volto-arcgis-block/commit/311b2d29fd21ebbaf66475710d36d995af6bb644)]
13
+ - CLMS-280068 (Bug): Redesigned TOC menu [Urkorue - [`e045954`](https://github.com/eea/volto-arcgis-block/commit/e04595466dff5198a3b0dbdf4b615d1705077090)]
7
14
  ### [0.1.324](https://github.com/eea/volto-arcgis-block/compare/0.1.323...0.1.324) - 11 December 2024
8
15
 
9
16
  ### [0.1.323](https://github.com/eea/volto-arcgis-block/compare/0.1.322...0.1.323) - 10 December 2024
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@eeacms/volto-arcgis-block",
3
- "version": "0.1.324",
3
+ "version": "0.1.325",
4
4
  "description": "volto-arcgis-block: Volto add-on",
5
5
  "main": "src/index.js",
6
6
  "author": "European Environment Agency: CodeSyntax",
@@ -22,6 +22,7 @@ import PanWidget from './PanWidget';
22
22
  import BookmarkWidget from './BookmarkWidget';
23
23
  import LoadingSpinner from './LoadingSpinner';
24
24
  import { injectLazyLibs } from '@plone/volto/helpers/Loadable';
25
+ //import { getTaxonomy } from '@eeacms/volto-taxonomy/actions';
25
26
 
26
27
  //import "isomorphic-fetch"; <-- Necessary to use fetch?
27
28
  var Map, MapView, Zoom, intl, Basemap, WebTileLayer, Extent;
@@ -70,6 +71,7 @@ class MapViewer extends React.Component {
70
71
  this.bookmarkHandler = this.bookmarkHandler.bind(this);
71
72
  this.prepackageHandler = this.prepackageHandler.bind(this);
72
73
  this.uploadFileHandler = this.uploadFileHandler.bind(this);
74
+ //this.getTaxonomy = this.props.getTaxonomy.bind(this);
73
75
  }
74
76
 
75
77
  mapLayersHandler(newLayers) {
@@ -429,6 +431,7 @@ class MapViewer extends React.Component {
429
431
  prepackageHandler={this.prepackageHandler}
430
432
  uploadedFile={this.state.uploadedFile}
431
433
  uploadFileHandler={this.uploadFileHandler}
434
+ //getTaxonomy={this.getTaxonomy}
432
435
  />
433
436
  ); //call conf
434
437
  }
@@ -527,6 +530,11 @@ export const CheckUserID = ({ reference }) => {
527
530
  </>
528
531
  );
529
532
  };
533
+ // const mapDispatchToProps = (dispatch) => {
534
+ // return {
535
+ // getTaxonomy: (name) => dispatch(getTaxonomy(name)),
536
+ // };
537
+ // };
530
538
 
531
539
  export default compose(
532
540
  connect(
@@ -535,5 +543,6 @@ export default compose(
535
543
  }),
536
544
  { MapViewerConfig },
537
545
  ),
546
+ //connect(null, mapDispatchToProps),
538
547
  injectLazyLibs('highcharts'),
539
- )(MapViewer);
548
+ )(MapViewer, MenuWidget);
@@ -401,6 +401,7 @@ class MenuWidget extends React.Component {
401
401
  TMSLayerObj: null,
402
402
  draggedElements: [],
403
403
  popup: false,
404
+ filterArrow: 'chevron-down',
404
405
  };
405
406
  this.menuClass =
406
407
  'esri-icon-drag-horizontal esri-widget--button esri-widget esri-interactive';
@@ -480,6 +481,7 @@ class MenuWidget extends React.Component {
480
481
  });
481
482
 
482
483
  this.activeLayersHandler = this.props.activeLayersHandler;
484
+ //this.getTaxonomy = this.props.getTaxonomy;
483
485
  }
484
486
 
485
487
  loader() {
@@ -878,6 +880,7 @@ class MenuWidget extends React.Component {
878
880
  //to watch the component
879
881
  //this.setState({});
880
882
  this.openMenu();
883
+ this.loadComponentFilters();
881
884
  this.expandDropdowns();
882
885
  this.loadLayers();
883
886
  this.loadOpacity();
@@ -4100,6 +4103,228 @@ class MenuWidget extends React.Component {
4100
4103
  clearTimeout(this.timeout);
4101
4104
  };
4102
4105
 
4106
+ loadComponentFilters() {
4107
+ var selectedComponent = document.getElementById('select-component');
4108
+ selectedComponent.options.add(
4109
+ new Option('Select a component', 'default', false, false),
4110
+ );
4111
+ selectedComponent.options[0].disabled = true;
4112
+ var selectedProduct = document.getElementById('select-product');
4113
+ selectedProduct.options.add(
4114
+ new Option('Select a product', 'default', false, false),
4115
+ );
4116
+ selectedProduct.options[0].disabled = true;
4117
+ document
4118
+ .querySelector('.menu-family-filter')
4119
+ .setAttribute('style', 'display: none;');
4120
+ this.compCfg.forEach((element) => {
4121
+ selectedComponent.options.add(
4122
+ new Option(
4123
+ element.ComponentTitle,
4124
+ element.ComponentPosition,
4125
+ element.ComponentPosition,
4126
+ ),
4127
+ );
4128
+ });
4129
+ }
4130
+ loadProductFilters() {
4131
+ var selectedComponent = document.getElementById('select-component');
4132
+ var selectedProduct = document.getElementById('select-product');
4133
+ if (
4134
+ document.querySelector('.clear-filters') &&
4135
+ selectedComponent.value !== 'default'
4136
+ ) {
4137
+ document
4138
+ .querySelector('.clear-filters')
4139
+ .setAttribute('style', 'display: block;');
4140
+ }
4141
+ this.removeOptions(selectedProduct);
4142
+ selectedProduct.options.add(
4143
+ new Option('Select a product', 'default', false, false),
4144
+ );
4145
+ selectedProduct.options[0].disabled = true;
4146
+ this.compCfg.forEach((component) => {
4147
+ if (component.ComponentPosition.toString() === selectedComponent.value) {
4148
+ component.Products.forEach((product) => {
4149
+ selectedProduct.options.add(
4150
+ new Option(
4151
+ product.ProductTitle,
4152
+ product.ProductId,
4153
+ product.ProductId,
4154
+ ),
4155
+ );
4156
+ });
4157
+ }
4158
+ });
4159
+ let familyFilter = document.querySelector('.menu-family-filter');
4160
+ if (familyFilter) {
4161
+ familyFilter.setAttribute('style', 'display: none;');
4162
+ }
4163
+ }
4164
+ async loadFamilyFilters() {
4165
+ // var selectedFamily = document.getElementById('select-family');
4166
+ // var selectedProduct = document.getElementById('select-product');
4167
+ // this.removeOptions(selectedFamily);
4168
+ //let tax = await this.getTaxonomy('collective.taxonomy.family');
4169
+ //let hasFamily = false;
4170
+ // selectedFamily.options.add(
4171
+ // new Option('Select a family', 'default', false, false),
4172
+ // );
4173
+ //let text = selectedProduct.selectedOptions[0].text
4174
+ // tax.tree.forEach((element) => {
4175
+ // if (element.title === selectedProduct.selectedOptions[0].text) {
4176
+ // //hasFamily = true;
4177
+ // element.children.forEach((child) => {
4178
+ // selectedFamily.options.add(
4179
+ // new Option(child.title, child.key, child.key),
4180
+ // );
4181
+ // });
4182
+ // }
4183
+ // });
4184
+ // let familyFilter = document.querySelector('.menu-family-filter');
4185
+ // if (familyFilter) {
4186
+ // if (!hasFamily) {
4187
+ // familyFilter.setAttribute('style','display: none;');
4188
+ // }else{
4189
+ // familyFilter.setAttribute('style','display: flex;');
4190
+ // }
4191
+ // }
4192
+ }
4193
+ async menuSearch() {
4194
+ let searchText;
4195
+ let componentFilter;
4196
+ let productFilter;
4197
+ //let familyFilter;
4198
+ if (document.querySelector('#menu-searchtext')) {
4199
+ searchText = document
4200
+ .querySelector('#menu-searchtext')
4201
+ .value?.toUpperCase();
4202
+ }
4203
+ if (document.getElementById('select-component')) {
4204
+ componentFilter = document.getElementById('select-component').value;
4205
+ }
4206
+ if (document.getElementById('select-product')) {
4207
+ productFilter = document.getElementById('select-product').value;
4208
+ }
4209
+ // if (document.getElementById('select-family')) {
4210
+ // familyFilter = document.getElementById('select-family').text;
4211
+ // }
4212
+ for (let index = 0; index < this.compCfg.length; index++) {
4213
+ let componentFound = false;
4214
+ if (
4215
+ index.toString() === componentFilter ||
4216
+ componentFilter === 'default'
4217
+ ) {
4218
+ this.compCfg[index].Products.forEach((product) => {
4219
+ let productFound = false;
4220
+ if (
4221
+ product.ProductId === productFilter ||
4222
+ productFilter === 'default'
4223
+ ) {
4224
+ product.Datasets.forEach((dataset) => {
4225
+ if (dataset?.DatasetTitle?.toUpperCase().includes(searchText)) {
4226
+ componentFound = true;
4227
+ productFound = true;
4228
+ let componentElem = document.querySelector(
4229
+ '#component_' + index,
4230
+ );
4231
+ componentElem
4232
+ .querySelector('.ccl-expandable__button')
4233
+ .setAttribute('aria-expanded', 'true');
4234
+
4235
+ let productElem = document.querySelector(
4236
+ '[productid="' + product.ProductId + '"]',
4237
+ );
4238
+ productElem
4239
+ .querySelector('.ccl-expandable__button')
4240
+ .setAttribute('aria-expanded', 'true');
4241
+ let datasetElem = document.querySelector(
4242
+ '[datasetid="' + dataset.DatasetId + '"]',
4243
+ );
4244
+ datasetElem.removeAttribute('style');
4245
+ productElem.removeAttribute('style');
4246
+ componentElem.removeAttribute('style');
4247
+ } else {
4248
+ let datasetElem = document.querySelector(
4249
+ '[datasetid="' + dataset.DatasetId + '"]',
4250
+ );
4251
+ datasetElem.setAttribute('style', 'display: none;');
4252
+ }
4253
+ });
4254
+ }
4255
+ if (!productFound) {
4256
+ let productElem = document.querySelector(
4257
+ '[productid="' + product.ProductId + '"]',
4258
+ );
4259
+ productElem.setAttribute('style', 'display: none;');
4260
+ }
4261
+ });
4262
+ }
4263
+ if (!componentFound) {
4264
+ let componentElem = document.querySelector('#component_' + index);
4265
+ componentElem.setAttribute('style', 'display: none;');
4266
+ }
4267
+ }
4268
+ }
4269
+ clearMenuText() {
4270
+ if (document.querySelector('#menu-searchtext')) {
4271
+ document.querySelector('#menu-searchtext').value = null;
4272
+ }
4273
+ }
4274
+ openClearButton() {
4275
+ if (document.querySelector('#menu-searchtext').value.length > 0) {
4276
+ document.querySelector('.clearsearch').style.display = 'block';
4277
+ } else {
4278
+ document.querySelector('.clearsearch').style.display = 'none';
4279
+ }
4280
+ }
4281
+ clearFilters() {
4282
+ if (document.getElementById('select-component')) {
4283
+ document.getElementById('select-component').value = 'default';
4284
+ }
4285
+ let selectedProduct = document.getElementById('select-product');
4286
+ if (selectedProduct) {
4287
+ this.removeOptions(selectedProduct);
4288
+ selectedProduct.options.add(
4289
+ new Option('Select a product', 'default', false, false),
4290
+ );
4291
+ }
4292
+ if (document.getElementById('select-family')) {
4293
+ document.getElementById('select-family').value = 'default';
4294
+ }
4295
+ let familyFilter = document.querySelector('.menu-family-filter');
4296
+ if (familyFilter) {
4297
+ familyFilter.setAttribute('style', 'display: none;');
4298
+ }
4299
+ if (document.querySelector('.clear-filters')) {
4300
+ document
4301
+ .querySelector('.clear-filters')
4302
+ .setAttribute('style', 'display: none;');
4303
+ }
4304
+ }
4305
+ closeFilters() {
4306
+ if (document.querySelector('.filters-panel').style.display === 'block') {
4307
+ document
4308
+ .querySelector('.filters-panel')
4309
+ .setAttribute('style', 'display: none;');
4310
+ this.setState({ filterArrow: 'chevron-down' });
4311
+ } else {
4312
+ document
4313
+ .querySelector('.filters-panel')
4314
+ .setAttribute('style', 'display: block;');
4315
+ this.setState({ filterArrow: 'chevron-up' });
4316
+ }
4317
+ }
4318
+
4319
+ removeOptions(selectElement) {
4320
+ if (selectElement.options.length > 0) {
4321
+ var i,
4322
+ L = selectElement.options.length - 1;
4323
+ for (i = L; i >= 0; i--) {
4324
+ selectElement.remove(i);
4325
+ }
4326
+ }
4327
+ }
4103
4328
  /**
4104
4329
  * This method renders the component
4105
4330
  * @returns jsx
@@ -4161,6 +4386,154 @@ class MenuWidget extends React.Component {
4161
4386
  </span>
4162
4387
  )}
4163
4388
  </div>
4389
+ <div className="search-panel">
4390
+ <div className="menu-searchpanel">
4391
+ <div class="search-input menu-search-input">
4392
+ <input
4393
+ type="text"
4394
+ id="menu-searchtext"
4395
+ maxlength="200"
4396
+ placeholder="Search products and datasets"
4397
+ onChange={() => this.openClearButton()}
4398
+ />
4399
+ <div class="search-input-actions">
4400
+ <button
4401
+ class="ui basic icon button search-input-clear-icon-button clearsearch"
4402
+ onClick={() => this.clearMenuText()}
4403
+ onKeyDown={(e) => {
4404
+ if (
4405
+ !e.altKey &&
4406
+ e.code !== 'Tab' &&
4407
+ !e.ctrlKey &&
4408
+ e.code !== 'Delete' &&
4409
+ !e.shiftKey &&
4410
+ !e.code.startsWith('F')
4411
+ ) {
4412
+ this.clearMenuText();
4413
+ }
4414
+ }}
4415
+ >
4416
+ <svg
4417
+ xmlns="http://www.w3.org/2000/svg"
4418
+ viewBox="0 0 26 26"
4419
+ class="icon"
4420
+ >
4421
+ <path
4422
+ fill-rule="evenodd"
4423
+ d="M27.899 9.515L26.485 8.101 18 16.586 9.514 8.101 8.1 9.515 16.586 18 8.1 26.486 9.514 27.9 18 19.414 26.485 27.9 27.899 26.486 19.414 18z"
4424
+ ></path>
4425
+ </svg>
4426
+ </button>
4427
+ </div>
4428
+ <button
4429
+ aria-label="Search"
4430
+ class="button menu-search-button"
4431
+ onClick={() => this.menuSearch()}
4432
+ onKeyDown={(e) => {
4433
+ if (
4434
+ !e.altKey &&
4435
+ e.code !== 'Tab' &&
4436
+ !e.ctrlKey &&
4437
+ e.code !== 'Delete' &&
4438
+ !e.shiftKey &&
4439
+ !e.code.startsWith('F')
4440
+ ) {
4441
+ this.menuSearch();
4442
+ }
4443
+ }}
4444
+ >
4445
+ <span class="ccl-icon-zoom search-menu-icon"></span>
4446
+ </button>
4447
+ </div>
4448
+ <div class="filters-element filter-logo filters-header">
4449
+ <div class="filters-title">
4450
+ <svg
4451
+ xmlns="http://www.w3.org/2000/svg"
4452
+ viewBox="0 0 36 36"
4453
+ class="icon ui"
4454
+ >
4455
+ <path
4456
+ fill-rule="evenodd"
4457
+ d="M5.0916,5.0002 L14.9996,19.3132 L14.9996,34.0002 L20.9996,29.5002 L20.9996,19.3132 L30.9086,5.0002 L5.0916,5.0002 Z M17.0006,18.6872 L8.9086,7.0002 L27.0916,7.0002 L19.0006,18.6872 L19.0006,28.5002 L17.0006,30.0002 L17.0006,18.6872 Z"
4458
+ ></path>
4459
+ </svg>
4460
+ <span class="filters-title-bold">Filters</span>
4461
+ <div
4462
+ className="clear-filters"
4463
+ tabIndex="0"
4464
+ role="button"
4465
+ onClick={() => this.clearFilters()}
4466
+ onKeyDown={(e) => {
4467
+ if (
4468
+ !e.altKey &&
4469
+ e.code !== 'Tab' &&
4470
+ !e.ctrlKey &&
4471
+ e.code !== 'Delete' &&
4472
+ !e.shiftKey &&
4473
+ !e.code.startsWith('F')
4474
+ ) {
4475
+ this.clearFilters();
4476
+ }
4477
+ }}
4478
+ >
4479
+ Clear filters
4480
+ </div>
4481
+ </div>
4482
+
4483
+ <div
4484
+ className="dropdown-icon close-filters-icon"
4485
+ role="button"
4486
+ tabIndex="0"
4487
+ onClick={() => this.closeFilters()}
4488
+ onKeyDown={(e) => {
4489
+ if (
4490
+ !e.altKey &&
4491
+ e.code !== 'Tab' &&
4492
+ !e.ctrlKey &&
4493
+ e.code !== 'Delete' &&
4494
+ !e.shiftKey &&
4495
+ !e.code.startsWith('F')
4496
+ ) {
4497
+ this.closeFilters();
4498
+ }
4499
+ }}
4500
+ >
4501
+ <FontAwesomeIcon icon={['fas', this.state.filterArrow]} />
4502
+ </div>
4503
+ </div>
4504
+ <div className="filters-panel">
4505
+ <span className="menu-filter">
4506
+ Component
4507
+ <select
4508
+ id="select-component"
4509
+ class="esri-select filter-select"
4510
+ onBlur={() => {}}
4511
+ onChange={() => {
4512
+ this.loadProductFilters();
4513
+ }}
4514
+ ></select>
4515
+ </span>
4516
+ <span className="menu-filter">
4517
+ Product
4518
+ <select
4519
+ id="select-product"
4520
+ class="esri-select filter-select"
4521
+ onBlur={() => {}}
4522
+ onChange={() => {
4523
+ this.loadFamilyFilters();
4524
+ }}
4525
+ ></select>
4526
+ </span>
4527
+ <span className="menu-filter menu-family-filter">
4528
+ Family
4529
+ <select
4530
+ id="select-family"
4531
+ class="esri-select filter-select"
4532
+ ></select>
4533
+ </span>
4534
+ </div>
4535
+ </div>
4536
+ </div>
4164
4537
  <div
4165
4538
  className="panels"
4166
4539
  id="paneles"
@@ -1571,3 +1571,91 @@ div.map-container.popup-block {
1571
1571
  .esri-swipe div {
1572
1572
  outline: none !important;
1573
1573
  }
1574
+
1575
+ .search-panel {
1576
+ background-color: white;
1577
+ }
1578
+
1579
+ .menu-searchpanel {
1580
+ padding: 0.6rem;
1581
+ padding-right: 1rem;
1582
+ padding-left: 1rem;
1583
+ background-color: rgba(160, 177, 40, 0.1);
1584
+ }
1585
+
1586
+ .search-input.menu-search-input {
1587
+ display: flex;
1588
+ }
1589
+
1590
+ #menu-searchtext {
1591
+ width: 23.5rem;
1592
+ height: 2rem;
1593
+ padding-left: 0.3rem;
1594
+ border-width: 1px;
1595
+ border-color: rgba(110, 110, 110, 0.3);
1596
+ }
1597
+
1598
+ .menu-search-button {
1599
+ width: 2rem;
1600
+ height: 2rem;
1601
+ border-width: 1px;
1602
+ border-color: rgba(110, 110, 110, 0.3);
1603
+ margin-left: 0.5rem;
1604
+ background-color: #a0b128;
1605
+ border-radius: 0;
1606
+ color: white;
1607
+ }
1608
+
1609
+ .search-menu-icon {
1610
+ width: 2rem;
1611
+ height: 2rem;
1612
+ }
1613
+
1614
+ .search-input-clear-icon-button {
1615
+ height: 1.5rem;
1616
+ }
1617
+
1618
+ .filter-logo {
1619
+ margin-top: 0.5rem;
1620
+ margin-bottom: 0.5rem;
1621
+ margin-left: 0 !important;
1622
+ }
1623
+
1624
+ .menu-filter {
1625
+ display: flex;
1626
+ justify-content: space-between;
1627
+ padding-top: 0.5rem;
1628
+ padding-bottom: 0.5rem;
1629
+ }
1630
+
1631
+ .filter-select {
1632
+ max-width: 19rem;
1633
+ height: 1.5rem !important;
1634
+ }
1635
+
1636
+ .clear-filters {
1637
+ display: none;
1638
+ margin-left: 16rem;
1639
+ font-size: small;
1640
+ text-decoration: underline;
1641
+ }
1642
+
1643
+ .clearsearch.search-input-clear-icon-button.button {
1644
+ position: absolute;
1645
+ top: 4.3rem;
1646
+ left: 23rem;
1647
+ display: none;
1648
+ }
1649
+
1650
+ .close-filters-icon {
1651
+ padding-left: 0.8rem;
1652
+ color: #a0b128;
1653
+ }
1654
+
1655
+ .filters-panel {
1656
+ display: none;
1657
+ }
1658
+
1659
+ .filters-element.filter-logo.filters-header {
1660
+ justify-content: space-between;
1661
+ }