@eeacms/volto-arcgis-block 0.1.369 → 0.1.371

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,8 +4,21 @@ 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.371](https://github.com/eea/volto-arcgis-block/compare/0.1.370...0.1.371) - 25 June 2025
8
+
9
+ #### :hammer_and_wrench: Others
10
+
11
+ - (bug): Fixed families, and fixed active layer elements for rest map image layers [Unai Bolivar - [`9b0018e`](https://github.com/eea/volto-arcgis-block/commit/9b0018ed0f03d272945ce5f0f2bc4e1f581cf917)]
12
+ ### [0.1.370](https://github.com/eea/volto-arcgis-block/compare/0.1.369...0.1.370) - 19 June 2025
13
+
14
+ #### :hammer_and_wrench: Others
15
+
16
+ - CLMS-287480 (bug): Implement the regrouping of layers when REST services exist [Unai Bolivar - [`0e9ed21`](https://github.com/eea/volto-arcgis-block/commit/0e9ed218e0fbe691773220afd7cbd4f2a948c33d)]
7
17
  ### [0.1.369](https://github.com/eea/volto-arcgis-block/compare/0.1.368...0.1.369) - 18 June 2025
8
18
 
19
+ #### :hammer_and_wrench: Others
20
+
21
+ - Merge pull request #978 from eea/develop [Unai Bolivar - [`32cddf9`](https://github.com/eea/volto-arcgis-block/commit/32cddf9f880a50082094cf73e10316848555d792)]
9
22
  ### [0.1.368](https://github.com/eea/volto-arcgis-block/compare/0.1.367...0.1.368) - 17 June 2025
10
23
 
11
24
  ### [0.1.367](https://github.com/eea/volto-arcgis-block/compare/0.1.366...0.1.367) - 17 June 2025
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@eeacms/volto-arcgis-block",
3
- "version": "0.1.369",
3
+ "version": "0.1.371",
4
4
  "description": "volto-arcgis-block: Volto add-on",
5
5
  "main": "src/index.js",
6
6
  "author": "European Environment Agency: CodeSyntax",
@@ -434,6 +434,7 @@ class MenuWidget extends React.Component {
434
434
  this.activeLayersToHotspotData = this.activeLayersToHotspotData.bind(this);
435
435
  this.getLimitScale = this.getLimitScale.bind(this);
436
436
  this.handleOpenPopup = this.handleOpenPopup.bind(this);
437
+ this.datasetFamilies = {};
437
438
  this.filtersApplied = false;
438
439
  this.filtersApplied = false;
439
440
  // add zoomend listener to map to show/hide zoom in message
@@ -1263,6 +1264,7 @@ class MenuWidget extends React.Component {
1263
1264
  var dataset_def = [];
1264
1265
  var datasets = [];
1265
1266
  var families = [];
1267
+ this.DatasetFamilies = {};
1266
1268
  var index = 0;
1267
1269
  var inheritedIndexProduct = inheritedIndex + '_' + prodIndex;
1268
1270
  var checkProduct = 'map_product_' + inheritedIndexProduct;
@@ -1272,69 +1274,117 @@ class MenuWidget extends React.Component {
1272
1274
  : product.ProductDescription;
1273
1275
 
1274
1276
  if (product.Datasets && Array.isArray(product.Datasets)) {
1275
- let familiesMap = new Map();
1276
- familiesMap['noFamily'] = [];
1277
- for (let index = 0; index < product.Datasets.length; index++) {
1278
- if (familiesMap[product.Datasets[index].FamilyTitle]) {
1279
- familiesMap[product.Datasets[index].FamilyTitle].push(
1280
- product.Datasets[index],
1281
- );
1282
- } else if (product.Datasets[index].FamilyTitle) {
1283
- familiesMap[product.Datasets[index].FamilyTitle] = [
1284
- product.Datasets[index],
1285
- ];
1277
+ var familyIndex = 0;
1278
+ var firstChildAdded = false;
1279
+ for (
1280
+ let datasetIndex = 0;
1281
+ datasetIndex < product.Datasets.length;
1282
+ datasetIndex++
1283
+ ) {
1284
+ const dataset = product.Datasets[datasetIndex];
1285
+
1286
+ if (dataset.FamilyTitle) {
1287
+ if (!this.DatasetFamilies[dataset.FamilyTitle]) {
1288
+ this.DatasetFamilies[dataset.FamilyTitle] = [];
1289
+ }
1290
+ this.DatasetFamilies[dataset.FamilyTitle].push(dataset);
1286
1291
  } else {
1287
- familiesMap['noFamily'].push(product.Datasets[index]);
1292
+ if (this.filtersApplied) {
1293
+ dataset_def = document
1294
+ .querySelector('#' + checkProduct)
1295
+ ?.getAttribute('defcheck');
1296
+ } else if (
1297
+ dataset &&
1298
+ dataset.Default_active === true &&
1299
+ !firstChildAdded
1300
+ ) {
1301
+ var idDataset =
1302
+ 'map_dataset_' + inheritedIndexProduct + '_' + index;
1303
+ dataset_def.push(idDataset);
1304
+ firstChildAdded = true;
1305
+ }
1306
+
1307
+ if (dataset) {
1308
+ datasets.push(
1309
+ this.metodProcessDataset(
1310
+ dataset,
1311
+ index,
1312
+ inheritedIndexProduct,
1313
+ checkProduct,
1314
+ ),
1315
+ );
1316
+ index++;
1317
+ }
1288
1318
  }
1289
1319
  }
1290
- for (var j in familiesMap) {
1291
- if (j === 'noFamily') {
1292
- for (var i in familiesMap[j]) {
1293
- if (this.filtersApplied) {
1294
- dataset_def = document
1295
- .querySelector('#' + checkProduct)
1296
- ?.getAttribute('defcheck');
1297
- } else if (
1298
- product.Datasets[i] &&
1299
- product.Datasets[i].Default_active === true
1300
- ) {
1301
- var idDataset =
1302
- 'map_dataset_' + inheritedIndexProduct + '_' + index;
1303
- dataset_def.push(idDataset);
1304
- }
1305
1320
 
1306
- // CLMS-1545
1307
- // if (!product.Datasets[i].MarkAsDownloadableNoServiceToVisualize) {
1308
- if (product.Datasets[i]) {
1309
- datasets.push(
1310
- this.metodProcessDataset(
1311
- product.Datasets[i],
1312
- index,
1313
- inheritedIndexProduct,
1314
- checkProduct,
1315
- ),
1316
- );
1317
- index++;
1318
- }
1319
- // }
1321
+ Object.keys(this.DatasetFamilies).forEach((familyTitle) => {
1322
+ var inheritedIndexFamily = inheritedIndexProduct + '_' + familyIndex;
1323
+ var checkFamily = 'map_family_' + inheritedIndexFamily;
1324
+ var familyDatasets = [];
1325
+ var familyDatasetDef = [];
1326
+
1327
+ this.DatasetFamilies[familyTitle].forEach((dataset) => {
1328
+ if (this.filtersApplied) {
1329
+ familyDatasetDef = document
1330
+ .querySelector('#' + checkFamily)
1331
+ ?.getAttribute('defcheck');
1332
+ } else if (dataset && dataset.Default_active === true) {
1333
+ var idDataset = 'map_dataset_' + inheritedIndexFamily + '_' + index;
1334
+ familyDatasetDef.push(idDataset);
1320
1335
  }
1321
- } else {
1322
- families.push(
1323
- this.metodProcessFamily(
1324
- familiesMap[j],
1325
- j,
1326
- inheritedIndexProduct,
1327
- checkProduct,
1336
+ familyDatasets.push(
1337
+ this.metodProcessDataset(
1338
+ dataset,
1339
+ index,
1340
+ inheritedIndexFamily,
1341
+ checkFamily,
1328
1342
  ),
1329
1343
  );
1344
+ index++;
1345
+ });
1346
+
1347
+ if (familyDatasets.length > 0) {
1348
+ var firstFamilyDatasetId =
1349
+ 'map_dataset_' +
1350
+ inheritedIndexFamily +
1351
+ '_' +
1352
+ (index - familyDatasets.length);
1353
+
1354
+ if (!familyDatasetDef.length) {
1355
+ familyDatasetDef.push(firstFamilyDatasetId);
1356
+ }
1357
+
1358
+ if (!firstChildAdded) {
1359
+ dataset_def.push(checkFamily);
1360
+ firstChildAdded = true;
1361
+ }
1330
1362
  }
1331
- }
1363
+
1364
+ families.push(
1365
+ this.metodProcessFamily(
1366
+ familyTitle,
1367
+ familyDatasets,
1368
+ inheritedIndexFamily,
1369
+ checkFamily,
1370
+ checkProduct,
1371
+ familyDatasetDef,
1372
+ ),
1373
+ );
1374
+
1375
+ familyIndex++;
1376
+ });
1332
1377
  }
1333
1378
 
1334
1379
  // Empty vector, add the first dataset
1335
1380
  if (!dataset_def.length) {
1336
- var idDatasetB = 'map_dataset_' + inheritedIndexProduct + '_0';
1337
- dataset_def.push(idDatasetB);
1381
+ if (families.length > 0) {
1382
+ var firstFamilyId = 'map_family_' + inheritedIndexProduct + '_0';
1383
+ dataset_def.push(firstFamilyId);
1384
+ } else {
1385
+ var idDatasetB = 'map_dataset_' + inheritedIndexProduct + '_0';
1386
+ dataset_def.push(idDatasetB);
1387
+ }
1338
1388
  }
1339
1389
  let style = this.props.download ? { display: 'none' } : {};
1340
1390
 
@@ -1411,15 +1461,18 @@ class MenuWidget extends React.Component {
1411
1461
  );
1412
1462
  }
1413
1463
 
1414
- metodProcessFamily(family, familyTitle, inheritedIndex, checkFamily) {
1415
- var dataset_def = [];
1464
+ metodProcessFamily(
1465
+ familyTitle,
1466
+ familyDatasets,
1467
+ inheritedIndexFamily,
1468
+ checkFamily,
1469
+ checkProduct,
1470
+ familyDatasetDef,
1471
+ ) {
1416
1472
  var datasets = [];
1417
- var index = 0;
1418
1473
  var familyId = familyTitle.replace(/\s+/g, '');
1419
- var inheritedIndexFamily = inheritedIndex + '_' + familyId;
1420
- checkFamily = 'map_family_' + inheritedIndexFamily;
1421
- var checkProduct = 'map_product_' + inheritedIndex;
1422
1474
  var familyTitleName = '';
1475
+
1423
1476
  this.tax.tree.forEach((element) => {
1424
1477
  element.children.forEach((element) => {
1425
1478
  if (element.key === familyTitle) {
@@ -1427,27 +1480,16 @@ class MenuWidget extends React.Component {
1427
1480
  }
1428
1481
  });
1429
1482
  });
1430
- if (family && Array.isArray(family)) {
1431
- for (var i in family) {
1432
- if (family[i]) {
1433
- datasets.push(
1434
- this.metodProcessDataset(
1435
- family[i],
1436
- index,
1437
- inheritedIndex,
1438
- checkFamily,
1439
- ),
1440
- );
1441
- index++;
1442
- }
1443
- }
1444
- }
1445
1483
 
1446
- // Empty vector, add the first dataset
1447
- if (!dataset_def.length) {
1484
+ familyDatasets.forEach((dataset) => {
1485
+ datasets.push(dataset);
1486
+ });
1487
+
1488
+ if (!familyDatasetDef.length && familyDatasets.length > 0) {
1448
1489
  var idDatasetB = 'map_dataset_' + inheritedIndexFamily + '_0';
1449
- dataset_def.push(idDatasetB);
1490
+ familyDatasetDef.push(idDatasetB);
1450
1491
  }
1492
+
1451
1493
  let style = this.props.download ? { display: 'none' } : {};
1452
1494
 
1453
1495
  return (
@@ -1482,9 +1524,9 @@ class MenuWidget extends React.Component {
1482
1524
  value="name"
1483
1525
  className="ccl-checkbox ccl-required ccl-form-check-input"
1484
1526
  key={'h' + familyId}
1485
- defcheck={dataset_def}
1527
+ defcheck={familyDatasetDef}
1486
1528
  onChange={(e) =>
1487
- this.toggleProduct(e.target.checked, checkProduct, e)
1529
+ this.toggleFamily(e.target.checked, checkFamily, e)
1488
1530
  }
1489
1531
  ></input>
1490
1532
  <label
@@ -1493,19 +1535,7 @@ class MenuWidget extends React.Component {
1493
1535
  key={'f' + familyId}
1494
1536
  >
1495
1537
  <legend className="ccl-form-legend">
1496
- {
1497
- /* {description ? (
1498
- <Popup
1499
- trigger={<span>{familyTitle}</span>}
1500
- content={description}
1501
- basic
1502
- className="custom"
1503
- style={{ transform: 'translateX(-4rem)' }}
1504
- />
1505
- ) : (*/
1506
- <span>{familyTitleName}</span>
1507
- /*)} */
1508
- }
1538
+ {<span>{familyTitleName}</span>}
1509
1539
  </legend>
1510
1540
  </label>
1511
1541
  </div>
@@ -2267,7 +2297,6 @@ class MenuWidget extends React.Component {
2267
2297
 
2268
2298
  this.saveCheckedLayer(layerId);
2269
2299
 
2270
- // Update state to include the new layer, which will trigger componentDidUpdate
2271
2300
  this.setState((prevState) => {
2272
2301
  const updatedLayers = [
2273
2302
  ...prevState.wmsUserServiceLayers,
@@ -2862,11 +2891,18 @@ class MenuWidget extends React.Component {
2862
2891
  }
2863
2892
  this.visibleLayers[elem.id] = ['fas', 'eye'];
2864
2893
  this.timeLayers[elem.id] = ['far', 'clock'];
2894
+ let layer = this.layers[elem.id];
2895
+ let isMapServer = layer?.url.toLowerCase().endsWith('mapserver')
2896
+ ? true
2897
+ : false;
2865
2898
  if (group) {
2866
- elem.title = this.getLayerTitle(this.layers[elem.id]);
2899
+ elem.title =
2900
+ this.layers[elem.id].type === 'map-image'
2901
+ ? this.layers[elem.id].DatasetTitle
2902
+ : this.getLayerTitle(this.layers[elem.id]);
2867
2903
  let groupLayers = this.getGroupLayers(group);
2868
2904
  if (groupLayers.length > 0 && groupLayers[0] in this.activeLayersJSON) {
2869
- elem.hide = true;
2905
+ elem.hide = isMapServer;
2870
2906
  }
2871
2907
  this.activeLayersJSON[elem.id] = this.addActiveLayer(
2872
2908
  elem,
@@ -3140,7 +3176,18 @@ class MenuWidget extends React.Component {
3140
3176
  if (value) {
3141
3177
  for (let i = 0; i < splitdefCheck.length; i++) {
3142
3178
  selector = document.querySelector(`[id="${splitdefCheck[i]}"]`);
3143
- layerChecks.push(selector);
3179
+ if (selector) {
3180
+ const layer = this.layers[splitdefCheck[i]];
3181
+ if (
3182
+ layer?.url?.toLowerCase().includes('/rest/') &&
3183
+ layer?.type === 'map-image'
3184
+ ) {
3185
+ layerChecks.push(selector);
3186
+ break;
3187
+ } else {
3188
+ layerChecks.push(selector);
3189
+ }
3190
+ }
3144
3191
  }
3145
3192
  } else {
3146
3193
  layerChecks = document.querySelectorAll(`[parentid=${id}]`);
@@ -3183,6 +3230,29 @@ class MenuWidget extends React.Component {
3183
3230
  });
3184
3231
  }
3185
3232
 
3233
+ toggleFamily(value, id, element) {
3234
+ let familyDefCheck = element.target.getAttribute('defcheck');
3235
+ let splitdefCheck = familyDefCheck.split(',');
3236
+
3237
+ let datasetChecks = [];
3238
+ let selector = [];
3239
+
3240
+ if (value) {
3241
+ for (let i = 0; i < splitdefCheck.length; i++) {
3242
+ selector = document.querySelector(`[id="${splitdefCheck[i]}"]`);
3243
+ datasetChecks.push(selector);
3244
+ }
3245
+ } else {
3246
+ datasetChecks = document.querySelectorAll(`[parentid=${id}]`);
3247
+ }
3248
+
3249
+ datasetChecks.forEach((element) => {
3250
+ if (element) {
3251
+ element.checked = value;
3252
+ this.toggleDataset(value, element.id, element);
3253
+ }
3254
+ });
3255
+ }
3186
3256
  /**
3187
3257
  * Method to toggle dropdown content (datasets and layers)
3188
3258
  * @param {*} e
@@ -3757,7 +3827,7 @@ class MenuWidget extends React.Component {
3757
3827
  layer-id={elem.id}
3758
3828
  layer-order={order}
3759
3829
  draggable="true"
3760
- // {...(elem.hide && { style: { display: 'none' } })}
3830
+ {...(elem.hide && { style: { display: 'none' } })}
3761
3831
  onDrop={(e) => this.onDrop(e)}
3762
3832
  onDragOver={(e) => this.onDragOver(e)}
3763
3833
  onDragStart={(e) => this.onDragStart(e)}