@eeacms/volto-arcgis-block 0.1.267 → 0.1.269
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,19 @@ 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.269](https://github.com/eea/volto-arcgis-block/compare/0.1.268...0.1.269) - 21 March 2024
|
|
8
|
+
|
|
9
|
+
#### :hammer_and_wrench: Others
|
|
10
|
+
|
|
11
|
+
- CLMS-2383-3050 (bug): commented unused var [Unai Bolivar - [`a8e696b`](https://github.com/eea/volto-arcgis-block/commit/a8e696bdf0252c3a8401c822e1b2bf56246dafba)]
|
|
12
|
+
- CLMS-2383-3050 (bug): implemented file upload form cache cleaning, disabled geojson process, centered NUTS icon [Unai Bolivar - [`84c5677`](https://github.com/eea/volto-arcgis-block/commit/84c5677ef8af6568151ae2a9ce1dd0eaff966466)]
|
|
13
|
+
### [0.1.268](https://github.com/eea/volto-arcgis-block/compare/0.1.267...0.1.268) - 21 March 2024
|
|
14
|
+
|
|
15
|
+
#### :hammer_and_wrench: Others
|
|
16
|
+
|
|
17
|
+
- CLMS-2383-3050 (bug): allowed file size limit alert corrected. alerts text centered [Unai Bolivar - [`0666ab3`](https://github.com/eea/volto-arcgis-block/commit/0666ab320382db18367bf1076db91e6fe2f6145e)]
|
|
18
|
+
- CLMS-2383-3050 (chore): commented logs [Unai Bolivar - [`f68b1a9`](https://github.com/eea/volto-arcgis-block/commit/f68b1a90d4b77b73446cfd7b45ee310a6eb3dee1)]
|
|
19
|
+
- CLMS-2383-3050 (bug): corrected graphic overlay. corrected add to cart bug. CSV fileu upload disabled [Unai Bolivar - [`4f43430`](https://github.com/eea/volto-arcgis-block/commit/4f434304f4013725b86d302991d826cf861c9c57)]
|
|
7
20
|
### [0.1.267](https://github.com/eea/volto-arcgis-block/compare/0.1.266...0.1.267) - 20 March 2024
|
|
8
21
|
|
|
9
22
|
#### :hammer_and_wrench: Others
|
package/package.json
CHANGED
|
@@ -212,7 +212,7 @@ class AreaWidget extends React.Component {
|
|
|
212
212
|
//definitionExpression: 'LEVL_CODE=' + level,
|
|
213
213
|
});
|
|
214
214
|
|
|
215
|
-
this.removeFileUploadedLayer();
|
|
215
|
+
//this.removeFileUploadedLayer();
|
|
216
216
|
|
|
217
217
|
this.nutsGroupLayer.add(layer);
|
|
218
218
|
|
|
@@ -236,7 +236,7 @@ class AreaWidget extends React.Component {
|
|
|
236
236
|
popupEnabled: false,
|
|
237
237
|
});
|
|
238
238
|
|
|
239
|
-
this.removeFileUploadedLayer();
|
|
239
|
+
//this.removeFileUploadedLayer();
|
|
240
240
|
|
|
241
241
|
this.nutsGroupLayer.add(layer);
|
|
242
242
|
|
|
@@ -254,26 +254,28 @@ class AreaWidget extends React.Component {
|
|
|
254
254
|
};
|
|
255
255
|
|
|
256
256
|
handleFileUpload = (e) => {
|
|
257
|
-
//Store the file as Blob
|
|
258
|
-
let fileBlob = e.target.files[0];
|
|
259
257
|
//Get the file name
|
|
260
258
|
const fileName = e.target.value.toLowerCase();
|
|
261
259
|
//console.log('file name: ', fileName);
|
|
262
260
|
|
|
261
|
+
//Get the file size
|
|
262
|
+
const fileSize = e.target.files[0].size;
|
|
263
263
|
//Get the file from the form
|
|
264
264
|
const file = document.getElementById('uploadForm');
|
|
265
265
|
//console.log('uploaded file from form: ', file);
|
|
266
266
|
|
|
267
267
|
//List allowed file extensions
|
|
268
|
-
|
|
268
|
+
|
|
269
|
+
//let fileExtensions = ['zip', 'geojson'];
|
|
269
270
|
|
|
270
271
|
// Get the file extension
|
|
271
272
|
let fileExtension = fileName.split('.').pop();
|
|
272
273
|
|
|
273
274
|
//console.log('file extension: ', fileExtension);
|
|
274
|
-
|
|
275
275
|
//Check if the file format is not supported
|
|
276
|
-
|
|
276
|
+
|
|
277
|
+
// if (fileExtensions.indexOf(fileExtension) === -1) {
|
|
278
|
+
if (fileExtension !== 'zip') {
|
|
277
279
|
this.setState({
|
|
278
280
|
showInfoPopup: true,
|
|
279
281
|
infoPopupType: 'fileFormat',
|
|
@@ -281,65 +283,47 @@ class AreaWidget extends React.Component {
|
|
|
281
283
|
return;
|
|
282
284
|
}
|
|
283
285
|
|
|
284
|
-
//Check if the file size is over the 10mb file size limit
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
286
|
+
// Check if the file is a geojson or CSV and the file size is over the 10mb file size limit
|
|
287
|
+
// or file is a shape file and the file size is over the 2mb file size limit
|
|
288
|
+
|
|
289
|
+
//if (fileSize > 10485760 && fileExtension === 'geojson') {
|
|
290
|
+
// this.setState({
|
|
291
|
+
// showInfoPopup: true,
|
|
292
|
+
// infoPopupType: 'fileLimit',
|
|
293
|
+
// });
|
|
294
|
+
// return;
|
|
295
|
+
//}
|
|
296
|
+
|
|
297
|
+
if (fileSize > 2097152 && fileExtension === 'zip') {
|
|
290
298
|
this.setState({
|
|
291
299
|
showInfoPopup: true,
|
|
292
|
-
infoPopupType: '
|
|
300
|
+
infoPopupType: 'shapefileLimit',
|
|
293
301
|
});
|
|
294
302
|
return;
|
|
295
303
|
}
|
|
296
304
|
|
|
297
|
-
//Read the file
|
|
298
|
-
let reader = new FileReader();
|
|
299
|
-
|
|
300
|
-
reader.onload = (event) => {
|
|
301
|
-
switch (fileExtension) {
|
|
302
|
-
// case 'zip':
|
|
303
|
-
// this.handleShp(event.target.result);
|
|
304
|
-
// break;
|
|
305
|
-
// case 'geojson':
|
|
306
|
-
// let parsedData;
|
|
307
|
-
// try {
|
|
308
|
-
// parsedData = JSON.parse(event.target.result);
|
|
309
|
-
// } catch (e) {
|
|
310
|
-
// console.error('Failed to parse JSON', e);
|
|
311
|
-
// return;
|
|
312
|
-
// }
|
|
313
|
-
// this.handleGeoJson(parsedData);
|
|
314
|
-
// break;
|
|
315
|
-
case 'csv':
|
|
316
|
-
this.handleCsv(event.target.result);
|
|
317
|
-
break;
|
|
318
|
-
default:
|
|
319
|
-
break;
|
|
320
|
-
}
|
|
321
|
-
};
|
|
322
|
-
|
|
323
305
|
switch (fileExtension) {
|
|
324
306
|
case 'zip':
|
|
325
307
|
this.generateFeatureCollection(fileName, file, 'shapefile');
|
|
326
|
-
//reader.readAsArrayBuffer(file);
|
|
327
|
-
break;
|
|
328
|
-
case 'geojson':
|
|
329
|
-
this.generateFeatureCollection(fileName, file, 'geojson');
|
|
330
|
-
//reader.readAsText(file);
|
|
331
|
-
break;
|
|
332
|
-
case 'csv':
|
|
333
|
-
//this.generateFeatureCollection(
|
|
334
|
-
// fileName,
|
|
335
|
-
// file,
|
|
336
|
-
// 'csv',
|
|
337
|
-
//);
|
|
338
|
-
reader.readAsText(fileBlob);
|
|
339
308
|
break;
|
|
309
|
+
//case 'geojson':
|
|
310
|
+
// this.generateFeatureCollection(fileName, file, 'geojson');
|
|
311
|
+
// //reader.readAsText(file);
|
|
312
|
+
// break;
|
|
313
|
+
//case 'csv':
|
|
314
|
+
//this.generateFeatureCollection(
|
|
315
|
+
// fileName,
|
|
316
|
+
// file,
|
|
317
|
+
// 'csv',
|
|
318
|
+
//);
|
|
319
|
+
// reader.readAsText(fileBlob);
|
|
320
|
+
// break;
|
|
340
321
|
default:
|
|
341
322
|
break;
|
|
342
323
|
}
|
|
324
|
+
setTimeout(() => {
|
|
325
|
+
e.target.value = null;
|
|
326
|
+
}, 2000);
|
|
343
327
|
};
|
|
344
328
|
|
|
345
329
|
generateFeatureCollection(fileName, file, inputFormat) {
|
|
@@ -384,6 +368,8 @@ class AreaWidget extends React.Component {
|
|
|
384
368
|
return;
|
|
385
369
|
//Create a feature layer from the feature collection
|
|
386
370
|
this.addFeatureCollectionToMap(response.data.featureCollection);
|
|
371
|
+
//console.log(data);
|
|
372
|
+
//this.loadFileUploadService(response.data.featureCollection);
|
|
387
373
|
} else {
|
|
388
374
|
//console.error('Unexpected response structure:', response);
|
|
389
375
|
}
|
|
@@ -392,15 +378,24 @@ class AreaWidget extends React.Component {
|
|
|
392
378
|
//console.error('Failed to generate feature collection:', error);
|
|
393
379
|
});
|
|
394
380
|
}
|
|
395
|
-
|
|
396
381
|
// add the feature collection to the map and zoom to the feature collection extent
|
|
397
382
|
// if you want to persist the feature collection when you reload browser, you could store the
|
|
398
383
|
// collection in local storage by serializing the layer using featureLayer.toJson()
|
|
399
384
|
// see the 'Feature Collection in Local Storage' sample for an example of how to work with local storage
|
|
400
385
|
addFeatureCollectionToMap(featureCollection) {
|
|
386
|
+
//console.log('feature collection: ', featureCollection);
|
|
401
387
|
let sourceGraphics = [];
|
|
388
|
+
const symbol = new SimpleFillSymbol({
|
|
389
|
+
//type: 'simple-fill',
|
|
390
|
+
color: [255, 255, 255, 0.5],
|
|
391
|
+
outline: {
|
|
392
|
+
color: [0, 0, 0],
|
|
393
|
+
width: 1,
|
|
394
|
+
},
|
|
395
|
+
});
|
|
402
396
|
const layers = featureCollection.layers.map((layer) => {
|
|
403
397
|
const graphics = layer.featureSet.features.map((feature) => {
|
|
398
|
+
feature.symbol = symbol;
|
|
404
399
|
return Graphic.fromJSON(feature);
|
|
405
400
|
});
|
|
406
401
|
sourceGraphics = sourceGraphics.concat(graphics);
|
|
@@ -417,12 +412,43 @@ class AreaWidget extends React.Component {
|
|
|
417
412
|
// outFields: ['*'],
|
|
418
413
|
// popupEnabled: false,
|
|
419
414
|
});
|
|
415
|
+
//featureLayer.renderer = {
|
|
416
|
+
// type: 'simple-fill',
|
|
417
|
+
// color: [255, 255, 255, 0.5],
|
|
418
|
+
// outline: {
|
|
419
|
+
// color: [0, 0, 0],
|
|
420
|
+
// width: 1,
|
|
421
|
+
// },
|
|
422
|
+
//}
|
|
423
|
+
//featureLayer.renderer = {
|
|
424
|
+
// type: "simple", // autocasts as new SimpleRenderer()
|
|
425
|
+
// symbol: {
|
|
426
|
+
// type: "simple-fill", // autocasts as new SimpleMarkerSymbol()
|
|
427
|
+
// //size: 20,
|
|
428
|
+
// color: [255, 255, 255, 0.5],
|
|
429
|
+
// outline: { // autocasts as new SimpleLineSymbol()
|
|
430
|
+
// width: 1,
|
|
431
|
+
// color: [0, 0, 0]
|
|
432
|
+
// }
|
|
433
|
+
// }
|
|
434
|
+
//};
|
|
435
|
+
//featureLayer.renderer = {
|
|
436
|
+
// type: "simple", // autocasts as new SimpleRenderer()
|
|
437
|
+
// symbol: {
|
|
438
|
+
// type: "simple-fill", // autocasts as new SimpleMarkerSymbol()
|
|
439
|
+
// size: 20,
|
|
440
|
+
// color: "green",
|
|
441
|
+
// outline: { // autocasts as new SimpleLineSymbol()
|
|
442
|
+
// width: 4.5,
|
|
443
|
+
// color: "blue"
|
|
444
|
+
// }
|
|
445
|
+
// }
|
|
446
|
+
//};
|
|
420
447
|
return featureLayer;
|
|
421
448
|
});
|
|
422
|
-
|
|
423
449
|
//Check for the correct spatial reference
|
|
424
|
-
//console.log(
|
|
425
|
-
if (this.checkWkid(layers[0]?.spatialReference) === false) return;
|
|
450
|
+
//console.log('layer: ', layers);
|
|
451
|
+
//if (this.checkWkid(layers[0]?.spatialReference) === false) return;
|
|
426
452
|
|
|
427
453
|
let geometry = new Extent(
|
|
428
454
|
featureCollection.layers[0].layerDefinition.extent,
|
|
@@ -442,15 +468,14 @@ class AreaWidget extends React.Component {
|
|
|
442
468
|
this.removeNutsLayers();
|
|
443
469
|
|
|
444
470
|
//Add uploaded layer to the map and zoom to the extent
|
|
445
|
-
this.props.map.addMany(layers);
|
|
471
|
+
//this.props.map.addMany(layers);
|
|
472
|
+
this.props.view.graphics.addMany(sourceGraphics);
|
|
446
473
|
this.props.view.goTo(sourceGraphics).catch((error) => {
|
|
447
474
|
//console.error('From addFeatureCollectionToMap function', error);
|
|
448
475
|
});
|
|
476
|
+
//console.log('source graphics: ', sourceGraphics);
|
|
449
477
|
//Send the area to the parent component
|
|
450
|
-
this.props.updateArea(
|
|
451
|
-
origin: { x: geometry.extent.xmin, y: geometry.extent.ymin },
|
|
452
|
-
end: { x: geometry.extent.xmax, y: geometry.extent.ymax },
|
|
453
|
-
});
|
|
478
|
+
this.props.updateArea(sourceGraphics[0]);
|
|
454
479
|
//Order the layer in the map
|
|
455
480
|
let index = this.getHighestIndex();
|
|
456
481
|
this.props.map.reorder(this.fileUploadLayer, index + 1);
|
|
@@ -597,9 +622,10 @@ class AreaWidget extends React.Component {
|
|
|
597
622
|
|
|
598
623
|
removeFileUploadedLayer() {
|
|
599
624
|
if (this.fileUploadLayer !== null) {
|
|
600
|
-
this.props.map.removeMany(this.fileUploadLayer.layers);
|
|
601
|
-
//this.props.view.graphics.removeMany(this.fileUploadLayer.sourceGraphics);
|
|
602
|
-
this.fileUploadLayer = null;
|
|
625
|
+
// this.props.map.removeMany(this.fileUploadLayer.layers);
|
|
626
|
+
// //this.props.view.graphics.removeMany(this.fileUploadLayer.sourceGraphics);
|
|
627
|
+
// this.fileUploadLayer = null;
|
|
628
|
+
this.clearWidget();
|
|
603
629
|
}
|
|
604
630
|
}
|
|
605
631
|
|
|
@@ -783,7 +809,7 @@ class AreaWidget extends React.Component {
|
|
|
783
809
|
let graphic = response.results.filter((result) => {
|
|
784
810
|
let layer;
|
|
785
811
|
if (
|
|
786
|
-
'nuts0 nuts1 nuts2 nuts3 countries'.includes(
|
|
812
|
+
'nuts0 nuts1 nuts2 nuts3 countries upload'.includes(
|
|
787
813
|
result.graphic.layer.id,
|
|
788
814
|
)
|
|
789
815
|
) {
|
|
@@ -1062,9 +1088,7 @@ class AreaWidget extends React.Component {
|
|
|
1062
1088
|
>
|
|
1063
1089
|
<div className="field">
|
|
1064
1090
|
<label className="file-upload">
|
|
1065
|
-
<span>
|
|
1066
|
-
File formats supported: shp(zip), geojson, csv
|
|
1067
|
-
</span>
|
|
1091
|
+
<span>File formats supported: shp(zip)</span>
|
|
1068
1092
|
<input
|
|
1069
1093
|
type="file"
|
|
1070
1094
|
name="file"
|
|
@@ -1149,7 +1173,19 @@ class AreaWidget extends React.Component {
|
|
|
1149
1173
|
<FontAwesomeIcon icon={['fas', 'info-circle']} />
|
|
1150
1174
|
</span>
|
|
1151
1175
|
<div className="drawRectanglePopup-text">
|
|
1152
|
-
Uploading files larger than 10MB is not
|
|
1176
|
+
Uploading geojson or csv files larger than 10MB is not
|
|
1177
|
+
allowed.
|
|
1178
|
+
</div>
|
|
1179
|
+
</>
|
|
1180
|
+
)}
|
|
1181
|
+
{this.state.infoPopupType === 'shapefileLimit' && (
|
|
1182
|
+
<>
|
|
1183
|
+
<span className="drawRectanglePopup-icon">
|
|
1184
|
+
<FontAwesomeIcon icon={['fas', 'info-circle']} />
|
|
1185
|
+
</span>
|
|
1186
|
+
<div className="drawRectanglePopup-text">
|
|
1187
|
+
Uploading shapefiles files larger than 2MB is not
|
|
1188
|
+
allowed.
|
|
1153
1189
|
</div>
|
|
1154
1190
|
</>
|
|
1155
1191
|
)}
|
|
@@ -31,7 +31,7 @@ export const AddCartItem = ({
|
|
|
31
31
|
const { addCartItem, isLoggedIn } = useCartState();
|
|
32
32
|
|
|
33
33
|
const checkArea = (e) => {
|
|
34
|
-
let check = document.querySelector('.area-panel input:checked')
|
|
34
|
+
let check = document.querySelector('.area-panel input:checked')?.value;
|
|
35
35
|
let area = {};
|
|
36
36
|
if (check === 'area') {
|
|
37
37
|
let graphics = mapViewer.view.graphics;
|
|
@@ -77,7 +77,7 @@ export const AddCartItem = ({
|
|
|
77
77
|
const checkExtent = (e) => {
|
|
78
78
|
let intersection = false;
|
|
79
79
|
let areaExtent = null;
|
|
80
|
-
let check = document.querySelector('.area-panel input:checked')
|
|
80
|
+
let check = document.querySelector('.area-panel input:checked')?.value;
|
|
81
81
|
if (check === 'area') {
|
|
82
82
|
areaExtent = new Extent({
|
|
83
83
|
xmin: Math.min(areaData.end.x, areaData.origin.x),
|
|
@@ -349,8 +349,14 @@ div.esri-popover
|
|
|
349
349
|
margin-left: 2rem;
|
|
350
350
|
}
|
|
351
351
|
|
|
352
|
+
div.area-container .ccl-form .ccl-form-check-input + .ccl-form-radio-label {
|
|
353
|
+
display: flex;
|
|
354
|
+
justify-content: space-between;
|
|
355
|
+
padding-left: 1.75rem;
|
|
356
|
+
}
|
|
357
|
+
|
|
352
358
|
label.ccl-form-radio-label span.nuts-menu-icon {
|
|
353
|
-
|
|
359
|
+
max-width: 30px;
|
|
354
360
|
}
|
|
355
361
|
|
|
356
362
|
.area-container .esri-button {
|
|
@@ -1396,7 +1402,8 @@ input[type='range']::-ms-track {
|
|
|
1396
1402
|
}
|
|
1397
1403
|
|
|
1398
1404
|
.drawRectanglePopup-text {
|
|
1399
|
-
|
|
1405
|
+
align-content: center;
|
|
1406
|
+
/* flex: auto; */
|
|
1400
1407
|
font-family: 'Lato', sans-serif;
|
|
1401
1408
|
font-size: 0.875rem;
|
|
1402
1409
|
}
|