@eeacms/volto-arcgis-block 0.1.415 → 0.1.416

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.416](https://github.com/eea/volto-arcgis-block/compare/0.1.415...0.1.416) - 3 December 2025
8
+
9
+ #### :hammer_and_wrench: Others
10
+
11
+ - (lint): lint and prettified [Unai Bolivar - [`f9f26fc`](https://github.com/eea/volto-arcgis-block/commit/f9f26fcd4bacea6e822ad9ae1236403ae2789719)]
12
+ - (bug): TOC Menu loads with open selections if user has previous localstorage data for TOC menu [Unai Bolivar - [`6feaa72`](https://github.com/eea/volto-arcgis-block/commit/6feaa7296f27813391ab63510d3291cc437b69e5)]
7
13
  ### [0.1.415](https://github.com/eea/volto-arcgis-block/compare/0.1.414...0.1.415) - 3 December 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.415",
3
+ "version": "0.1.416",
4
4
  "description": "volto-arcgis-block: Volto add-on",
5
5
  "main": "src/index.js",
6
6
  "author": "European Environment Agency: CodeSyntax",
@@ -1097,6 +1097,18 @@ class MenuWidget extends React.Component {
1097
1097
  let checkedLayers = sessionStorage.getItem('checkedLayers');
1098
1098
  if (expandedDropdowns) {
1099
1099
  sessionStorage.setItem('expandedDropdowns', JSON.stringify([]));
1100
+ const userKey = this.userID ? 'user_' + this.userID : 'user_anonymous';
1101
+ const existing = localStorage.getItem(userKey);
1102
+ let storeObj = {};
1103
+ if (existing) {
1104
+ try {
1105
+ storeObj = JSON.parse(existing) || {};
1106
+ } catch (e) {
1107
+ storeObj = {};
1108
+ }
1109
+ }
1110
+ storeObj.expandedDropdowns = [];
1111
+ localStorage.setItem(userKey, JSON.stringify(storeObj));
1100
1112
  }
1101
1113
  if (checkedLayers) {
1102
1114
  sessionStorage.setItem('checkedLayers', JSON.stringify([]));
@@ -3299,14 +3311,17 @@ class MenuWidget extends React.Component {
3299
3311
  if (productDropdown) {
3300
3312
  let btn = productDropdown.querySelector('.ccl-expandable__button');
3301
3313
  if (btn) btn.setAttribute('aria-expanded', 'true');
3314
+ if (btn) this.addExpandedDropdown(btn.id);
3302
3315
  }
3303
3316
  if (familyDropdown) {
3304
3317
  let btn = familyDropdown.querySelector('.ccl-expandable__button');
3305
3318
  if (btn) btn.setAttribute('aria-expanded', 'true');
3319
+ if (btn) this.addExpandedDropdown(btn.id);
3306
3320
  }
3307
3321
  if (datasetDropdown) {
3308
3322
  let btn = datasetDropdown.querySelector('.ccl-expandable__button');
3309
3323
  if (btn) btn.setAttribute('aria-expanded', 'true');
3324
+ if (btn) this.addExpandedDropdown(btn.id);
3310
3325
  }
3311
3326
  }
3312
3327
  if (value) {
@@ -3377,6 +3392,7 @@ class MenuWidget extends React.Component {
3377
3392
  if (productContainer) {
3378
3393
  let btn = productContainer.querySelector('.ccl-expandable__button');
3379
3394
  if (btn) btn.setAttribute('aria-expanded', 'true');
3395
+ if (btn) this.addExpandedDropdown(btn.id);
3380
3396
  }
3381
3397
  for (let i = 0; i < splitdefCheck.length; i++) {
3382
3398
  selector = document.querySelector(`[id="${splitdefCheck[i]}"]`);
@@ -3386,6 +3402,7 @@ class MenuWidget extends React.Component {
3386
3402
  if (datasetDropdown) {
3387
3403
  let btn = datasetDropdown.querySelector('.ccl-expandable__button');
3388
3404
  if (btn) btn.setAttribute('aria-expanded', 'true');
3405
+ if (btn) this.addExpandedDropdown(btn.id);
3389
3406
  }
3390
3407
  }
3391
3408
  }
@@ -3413,6 +3430,7 @@ class MenuWidget extends React.Component {
3413
3430
  if (familyContainer) {
3414
3431
  let btn = familyContainer.querySelector('.ccl-expandable__button');
3415
3432
  if (btn) btn.setAttribute('aria-expanded', 'true');
3433
+ if (btn) this.addExpandedDropdown(btn.id);
3416
3434
  }
3417
3435
  for (let i = 0; i < splitdefCheck.length; i++) {
3418
3436
  selector = document.querySelector(`[id="${splitdefCheck[i]}"]`);
@@ -3422,6 +3440,7 @@ class MenuWidget extends React.Component {
3422
3440
  if (datasetDropdown) {
3423
3441
  let btn = datasetDropdown.querySelector('.ccl-expandable__button');
3424
3442
  if (btn) btn.setAttribute('aria-expanded', 'true');
3443
+ if (btn) this.addExpandedDropdown(btn.id);
3425
3444
  }
3426
3445
  }
3427
3446
  }
@@ -3477,6 +3496,47 @@ class MenuWidget extends React.Component {
3477
3496
  JSON.stringify(expandedDropdowns),
3478
3497
  );
3479
3498
  }
3499
+ const userKey = this.userID ? 'user_' + this.userID : 'user_anonymous';
3500
+ const existing = localStorage.getItem(userKey);
3501
+ let storeObj = {};
3502
+ if (existing) {
3503
+ try {
3504
+ storeObj = JSON.parse(existing) || {};
3505
+ } catch (e) {
3506
+ storeObj = {};
3507
+ }
3508
+ }
3509
+ storeObj.expandedDropdowns = expandedDropdowns;
3510
+ localStorage.setItem(userKey, JSON.stringify(storeObj));
3511
+ }
3512
+
3513
+ addExpandedDropdown(id) {
3514
+ if (!id || this.props.download) return;
3515
+ try {
3516
+ let expandedDropdowns = JSON.parse(
3517
+ sessionStorage.getItem('expandedDropdowns'),
3518
+ );
3519
+ if (!Array.isArray(expandedDropdowns)) expandedDropdowns = [];
3520
+ if (!expandedDropdowns.includes(id)) {
3521
+ expandedDropdowns.push(id);
3522
+ sessionStorage.setItem(
3523
+ 'expandedDropdowns',
3524
+ JSON.stringify(expandedDropdowns),
3525
+ );
3526
+ const userKey = this.userID ? 'user_' + this.userID : 'user_anonymous';
3527
+ const existing = localStorage.getItem(userKey);
3528
+ let storeObj = {};
3529
+ if (existing) {
3530
+ try {
3531
+ storeObj = JSON.parse(existing) || {};
3532
+ } catch (e) {
3533
+ storeObj = {};
3534
+ }
3535
+ }
3536
+ storeObj.expandedDropdowns = expandedDropdowns;
3537
+ localStorage.setItem(userKey, JSON.stringify(storeObj));
3538
+ }
3539
+ } catch (e) {}
3480
3540
  }
3481
3541
  findCheckedDatasetNoServiceToVisualize(elem) {
3482
3542
  let parentId = elem.getAttribute('parentid');
@@ -5648,10 +5708,31 @@ class MenuWidget extends React.Component {
5648
5708
  */
5649
5709
  expandDropdowns() {
5650
5710
  if (this.props.download) return;
5651
- let expandedDropdowns = JSON.parse(
5652
- sessionStorage.getItem('expandedDropdowns'),
5653
- );
5654
- if (expandedDropdowns) {
5711
+ let expandedDropdowns = null;
5712
+ const userKey = this.userID ? 'user_' + this.userID : 'user_anonymous';
5713
+ const existing = localStorage.getItem(userKey);
5714
+ if (existing) {
5715
+ try {
5716
+ const storeObj = JSON.parse(existing) || {};
5717
+ const stored = storeObj ? storeObj.expandedDropdowns : null;
5718
+ if (Array.isArray(stored)) {
5719
+ expandedDropdowns = stored;
5720
+ } else if (typeof stored === 'string') {
5721
+ const parsed = JSON.parse(stored);
5722
+ if (Array.isArray(parsed)) expandedDropdowns = parsed;
5723
+ }
5724
+ } catch (e) {}
5725
+ }
5726
+ if (!Array.isArray(expandedDropdowns)) {
5727
+ try {
5728
+ const fromSession = sessionStorage.getItem('expandedDropdowns');
5729
+ if (fromSession) {
5730
+ const parsed = JSON.parse(fromSession);
5731
+ if (Array.isArray(parsed)) expandedDropdowns = parsed;
5732
+ }
5733
+ } catch (e) {}
5734
+ }
5735
+ if (Array.isArray(expandedDropdowns)) {
5655
5736
  expandedDropdowns.forEach((id) => {
5656
5737
  let dd = document.getElementById(id);
5657
5738
  if (dd) {