@eeacms/volto-arcgis-block 0.1.370 → 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 +5 -0
- package/package.json +1 -1
- package/src/components/MapViewer/MenuWidget.jsx +159 -95
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.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)]
|
|
7
12
|
### [0.1.370](https://github.com/eea/volto-arcgis-block/compare/0.1.369...0.1.370) - 19 June 2025
|
|
8
13
|
|
|
9
14
|
#### :hammer_and_wrench: Others
|
package/package.json
CHANGED
|
@@ -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
|
-
|
|
1276
|
-
|
|
1277
|
-
for (
|
|
1278
|
-
|
|
1279
|
-
|
|
1280
|
-
|
|
1281
|
-
|
|
1282
|
-
|
|
1283
|
-
|
|
1284
|
-
|
|
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
|
-
|
|
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
|
-
|
|
1307
|
-
|
|
1308
|
-
|
|
1309
|
-
|
|
1310
|
-
|
|
1311
|
-
|
|
1312
|
-
|
|
1313
|
-
|
|
1314
|
-
|
|
1315
|
-
|
|
1316
|
-
);
|
|
1317
|
-
|
|
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
|
-
|
|
1322
|
-
|
|
1323
|
-
|
|
1324
|
-
|
|
1325
|
-
|
|
1326
|
-
|
|
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
|
-
|
|
1337
|
-
|
|
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(
|
|
1415
|
-
|
|
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
|
-
|
|
1447
|
-
|
|
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
|
-
|
|
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={
|
|
1527
|
+
defcheck={familyDatasetDef}
|
|
1486
1528
|
onChange={(e) =>
|
|
1487
|
-
this.
|
|
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,
|
|
@@ -2867,9 +2896,10 @@ class MenuWidget extends React.Component {
|
|
|
2867
2896
|
? true
|
|
2868
2897
|
: false;
|
|
2869
2898
|
if (group) {
|
|
2870
|
-
elem.title =
|
|
2871
|
-
|
|
2872
|
-
|
|
2899
|
+
elem.title =
|
|
2900
|
+
this.layers[elem.id].type === 'map-image'
|
|
2901
|
+
? this.layers[elem.id].DatasetTitle
|
|
2902
|
+
: this.getLayerTitle(this.layers[elem.id]);
|
|
2873
2903
|
let groupLayers = this.getGroupLayers(group);
|
|
2874
2904
|
if (groupLayers.length > 0 && groupLayers[0] in this.activeLayersJSON) {
|
|
2875
2905
|
elem.hide = isMapServer;
|
|
@@ -3146,7 +3176,18 @@ class MenuWidget extends React.Component {
|
|
|
3146
3176
|
if (value) {
|
|
3147
3177
|
for (let i = 0; i < splitdefCheck.length; i++) {
|
|
3148
3178
|
selector = document.querySelector(`[id="${splitdefCheck[i]}"]`);
|
|
3149
|
-
|
|
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
|
+
}
|
|
3150
3191
|
}
|
|
3151
3192
|
} else {
|
|
3152
3193
|
layerChecks = document.querySelectorAll(`[parentid=${id}]`);
|
|
@@ -3189,6 +3230,29 @@ class MenuWidget extends React.Component {
|
|
|
3189
3230
|
});
|
|
3190
3231
|
}
|
|
3191
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
|
+
}
|
|
3192
3256
|
/**
|
|
3193
3257
|
* Method to toggle dropdown content (datasets and layers)
|
|
3194
3258
|
* @param {*} e
|