@eeacms/volto-arcgis-block 0.1.302 → 0.1.303

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,7 +4,9 @@ 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.302](https://github.com/eea/volto-arcgis-block/compare/0.1.301...0.1.302) - 5 September 2024
7
+ ### [0.1.303](https://github.com/eea/volto-arcgis-block/compare/0.1.302...0.1.303) - 10 September 2024
8
+
9
+ ### [0.1.302](https://github.com/eea/volto-arcgis-block/compare/0.1.301...0.1.302) - 6 September 2024
8
10
 
9
11
  ### [0.1.301](https://github.com/eea/volto-arcgis-block/compare/0.1.300...0.1.301) - 21 August 2024
10
12
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@eeacms/volto-arcgis-block",
3
- "version": "0.1.302",
3
+ "version": "0.1.303",
4
4
  "description": "volto-arcgis-block: Volto add-on",
5
5
  "main": "src/index.js",
6
6
  "author": "European Environment Agency: CodeSyntax",
@@ -948,7 +948,9 @@ class HotspotWidget extends React.Component {
948
948
  async componentDidMount() {
949
949
  await this.getLayerParameters();
950
950
  await this.loader();
951
- this.props.view.ui.add(this.container.current, 'top-right');
951
+ if (this.props.mapDiv.current) {
952
+ this.props.view.ui.add(this.container.current, 'top-right');
953
+ }
952
954
  this.layerModelInit();
953
955
  this.getBBoxData();
954
956
  this.props.view.when(() => {
@@ -90,7 +90,9 @@ class InfoWidget extends React.Component {
90
90
  * This method is executed after the rener method is executed
91
91
  */ async componentDidMount() {
92
92
  await this.loader();
93
- this.props.view.ui.add(this.container.current, 'top-right');
93
+ if (this.props.mapDiv.current) {
94
+ this.props.view.ui.add(this.container.current, 'top-right');
95
+ }
94
96
  this.props.view.on('click', (e) => {
95
97
  let screenPoint = {
96
98
  x: e.x,
@@ -232,7 +232,9 @@ class LegendWidget extends React.Component {
232
232
  */
233
233
  async componentDidMount() {
234
234
  await this.loader();
235
- this.props.view.ui.add(this.container.current, 'top-right');
235
+ if (this.props.mapDiv.current) {
236
+ this.props.view.ui.add(this.container.current, 'top-right');
237
+ }
236
238
  this.LegendWidget = new Legend({
237
239
  view: this.props.view,
238
240
  viewModel: new LegendViewModel({
@@ -55,7 +55,9 @@ class LoadingSpinner extends React.Component {
55
55
 
56
56
  async componentDidMount() {
57
57
  this.props.view.when(() => {
58
- this.props.view.ui.add(this.container.current, 'manual');
58
+ if (this.props.mapDiv.current) {
59
+ this.props.view.ui.add(this.container.current, 'manual');
60
+ }
59
61
  this.listenForLayerChanges();
60
62
  });
61
63
  }
@@ -182,89 +182,91 @@ class MapViewer extends React.Component {
182
182
  // ],
183
183
  });
184
184
 
185
- this.map = new Map({
186
- // basemap: 'topo',
187
- basemap: this.positronCompositeBasemap,
188
- logo: false,
189
- });
190
-
191
- mapStatus = this.recoverState();
192
-
193
- if (
194
- mapStatus === null ||
195
- (mapStatus.zoom === null && mapStatus.center === null) ||
196
- Object.entries(mapStatus).length === 0
197
- ) {
198
- mapStatus = {};
199
- mapStatus.zoom = this.mapCfg.zoom;
200
- mapStatus.center = this.mapCfg.center;
201
- mapStatus.activeLayers = this.mapCfg.activeLayers;
202
- this.setCenterState(this.mapCfg.center);
203
- this.setZoomState(this.mapCfg.zoom);
204
- this.activeLayersHandler(this.mapCfg.activeLayers);
205
- }
185
+ if (this.mapdiv.current) {
186
+ this.map = new Map({
187
+ // basemap: 'topo',
188
+ basemap: this.positronCompositeBasemap,
189
+ logo: false,
190
+ });
206
191
 
207
- this.view = new MapView({
208
- container: this.mapdiv.current,
209
- map: this.map,
210
- center: mapStatus.center,
211
- zoom: mapStatus.zoom,
212
- constraints: {
213
- minZoom: this.mapCfg.minZoom,
214
- maxZoom: this.mapCfg.maxZoom,
215
- rotationEnabled: false,
216
- geometry: this.mapCfg.geometry,
217
- },
218
- ui: {
219
- components: ['attribution'],
220
- },
221
- });
222
- this.zoom = new Zoom({
223
- view: this.view,
224
- });
225
- this.view.ui.add(this.zoom, {
226
- position: 'top-right',
227
- });
192
+ mapStatus = this.recoverState();
193
+
194
+ if (
195
+ mapStatus === null ||
196
+ (mapStatus.zoom === null && mapStatus.center === null) ||
197
+ Object.entries(mapStatus).length === 0
198
+ ) {
199
+ mapStatus = {};
200
+ mapStatus.zoom = this.mapCfg.zoom;
201
+ mapStatus.center = this.mapCfg.center;
202
+ mapStatus.activeLayers = this.mapCfg.activeLayers;
203
+ this.setCenterState(this.mapCfg.center);
204
+ this.setZoomState(this.mapCfg.zoom);
205
+ this.activeLayersHandler(this.mapCfg.activeLayers);
206
+ }
228
207
 
229
- this.view.when(() => {
230
- this.view.watch('center', (newValue, oldValue, property, object) => {
231
- this.setCenterState(newValue);
208
+ this.view = new MapView({
209
+ container: this.mapdiv.current,
210
+ map: this.map,
211
+ center: mapStatus.center,
212
+ zoom: mapStatus.zoom,
213
+ constraints: {
214
+ minZoom: this.mapCfg.minZoom,
215
+ maxZoom: this.mapCfg.maxZoom,
216
+ rotationEnabled: false,
217
+ geometry: this.mapCfg.geometry,
218
+ },
219
+ ui: {
220
+ components: ['attribution'],
221
+ },
222
+ });
223
+ this.zoom = new Zoom({
224
+ view: this.view,
225
+ });
226
+ this.view.ui.add(this.zoom, {
227
+ position: 'top-right',
232
228
  });
233
229
 
234
- let constraintExtent = null;
235
- this.view.watch('zoom', (newValue, oldValue, property, object) => {
236
- this.setZoomState(newValue);
237
- if (mapStatus.zoom <= this.mapCfg.minZoom) {
238
- constraintExtent = new Extent({
239
- xmin: this.mapCfg.geometry.xmin,
240
- ymin: this.mapCfg.geometry.ymin,
241
- xmax: this.mapCfg.geometry.xmax,
242
- ymax: this.mapCfg.geometry.ymax,
243
- spatialReference: 4326,
244
- });
245
- } else {
246
- constraintExtent = new Extent({
247
- xmin: this.mapCfg.geometryZoomIn.xmin,
248
- ymin: this.mapCfg.geometryZoomIn.ymin,
249
- xmax: this.mapCfg.geometryZoomIn.xmax,
250
- ymax: this.mapCfg.geometryZoomIn.ymax,
251
- spatialReference: 4326,
252
- });
253
- }
254
- this.view.constraints.geometry = constraintExtent;
230
+ this.view.when(() => {
231
+ this.view.watch('center', (newValue, oldValue, property, object) => {
232
+ this.setCenterState(newValue);
233
+ });
234
+
235
+ let constraintExtent = null;
236
+ this.view.watch('zoom', (newValue, oldValue, property, object) => {
237
+ this.setZoomState(newValue);
238
+ if (mapStatus.zoom <= this.mapCfg.minZoom) {
239
+ constraintExtent = new Extent({
240
+ xmin: this.mapCfg.geometry.xmin,
241
+ ymin: this.mapCfg.geometry.ymin,
242
+ xmax: this.mapCfg.geometry.xmax,
243
+ ymax: this.mapCfg.geometry.ymax,
244
+ spatialReference: 4326,
245
+ });
246
+ } else {
247
+ constraintExtent = new Extent({
248
+ xmin: this.mapCfg.geometryZoomIn.xmin,
249
+ ymin: this.mapCfg.geometryZoomIn.ymin,
250
+ xmax: this.mapCfg.geometryZoomIn.xmax,
251
+ ymax: this.mapCfg.geometryZoomIn.ymax,
252
+ spatialReference: 4326,
253
+ });
254
+ }
255
+ this.view.constraints.geometry = constraintExtent;
256
+ });
257
+ this.view.popup.autoOpenEnabled = false;
258
+ // After launching the MapViewerConfig action
259
+ // we will have stored the json response here:
260
+ // this.props.mapviewer_config
261
+ this.props.MapViewerConfig(flattenToAppURL(this.props.url));
262
+ //Once we have created the MapView, we need to ensure that the map div
263
+ //is refreshed in order to show the map on it. To do so, we need to
264
+ //trigger the renderization again, and to trigger the renderization
265
+ //we invoke the setState method, that changes the state and forces a
266
+ //react component to render itself again
267
+ //this.setState({});
255
268
  });
256
- this.view.popup.autoOpenEnabled = false;
257
- // After launching the MapViewerConfig action
258
- // we will have stored the json response here:
259
- // this.props.mapviewer_config
260
- this.props.MapViewerConfig(flattenToAppURL(this.props.url));
261
- //Once we have created the MapView, we need to ensure that the map div
262
- //is refreshed in order to show the map on it. To do so, we need to
263
- //trigger the renderization again, and to trigger the renderization
264
- //we invoke the setState method, that changes the state and forces a
265
- //react component to render itself again
266
- //this.setState({});
267
- });
269
+ }
268
270
  }
269
271
 
270
272
  componentDidUpdate(prevProps, prevState) {
@@ -319,7 +321,12 @@ class MapViewer extends React.Component {
319
321
  if (this.props.mapviewer_config.Download) return;
320
322
  if (this.view)
321
323
  return (
322
- <BasemapWidget view={this.view} mapViewer={this} urls={this.cfgUrls} />
324
+ <BasemapWidget
325
+ view={this.view}
326
+ mapViewer={this}
327
+ urls={this.cfgUrls}
328
+ mapDiv={this.mapdiv}
329
+ />
323
330
  );
324
331
  }
325
332
 
@@ -334,6 +341,7 @@ class MapViewer extends React.Component {
334
341
  layerLoading={this.state.layerLoading}
335
342
  hotspotData={this.state.hotspotData}
336
343
  hotspotDataHandler={this.hotspotDataHandler}
344
+ mapDiv={this.mapdiv}
337
345
  />
338
346
  );
339
347
  }
@@ -341,12 +349,21 @@ class MapViewer extends React.Component {
341
349
  renderMeasurement() {
342
350
  if (this.props.mapviewer_config.Download) return;
343
351
  if (this.view)
344
- return <MeasurementWidget view={this.view} mapViewer={this} />;
352
+ return (
353
+ <MeasurementWidget
354
+ view={this.view}
355
+ mapViewer={this}
356
+ mapDiv={this.mapdiv}
357
+ />
358
+ );
345
359
  }
346
360
 
347
361
  renderPrint() {
348
362
  if (this.props.mapviewer_config.Download) return;
349
- if (this.view) return <PrintWidget view={this.view} mapViewer={this} />;
363
+ if (this.view)
364
+ return (
365
+ <PrintWidget view={this.view} mapViewer={this} mapDiv={this.mapdiv} />
366
+ );
350
367
  }
351
368
 
352
369
  renderSwipe() {
@@ -358,6 +375,7 @@ class MapViewer extends React.Component {
358
375
  mapViewer={this}
359
376
  map={this.map}
360
377
  layers={this.state.layers}
378
+ mapDiv={this.mapdiv}
361
379
  />
362
380
  );
363
381
  }
@@ -365,12 +383,17 @@ class MapViewer extends React.Component {
365
383
  renderArea() {
366
384
  if (this.props.mapviewer_config.Download) return;
367
385
  if (this.view) {
368
- return <CheckLogin reference={this} urls={this.cfgUrls} />;
386
+ return (
387
+ <CheckLogin reference={this} urls={this.cfgUrls} mapDiv={this.mapdiv} />
388
+ );
369
389
  }
370
390
  }
371
391
 
372
392
  renderScale() {
373
- if (this.view) return <ScaleWidget view={this.view} mapViewer={this} />;
393
+ if (this.view)
394
+ return (
395
+ <ScaleWidget view={this.view} mapViewer={this} mapDiv={this.mapdiv} />
396
+ );
374
397
  }
375
398
 
376
399
  renderInfo() {
@@ -381,13 +404,21 @@ class MapViewer extends React.Component {
381
404
  map={this.map}
382
405
  mapViewer={this}
383
406
  hotspotData={this.state.hotspotData}
407
+ mapDiv={this.mapdiv}
384
408
  />
385
409
  );
386
410
  }
387
411
 
388
412
  renderPan() {
389
413
  if (this.view)
390
- return <PanWidget view={this.view} map={this.map} mapViewer={this} />;
414
+ return (
415
+ <PanWidget
416
+ view={this.view}
417
+ map={this.map}
418
+ mapViewer={this}
419
+ mapDiv={this.mapdiv}
420
+ />
421
+ );
391
422
  }
392
423
 
393
424
  renderHotspot() {
@@ -406,6 +437,7 @@ class MapViewer extends React.Component {
406
437
  hotspotDataHandler={this.hotspotDataHandler}
407
438
  mapLayersHandler={this.mapLayersHandler}
408
439
  bookmarkData={this.state.bookmarkData}
440
+ mapDiv={this.mapdiv}
409
441
  />
410
442
  );
411
443
  }
@@ -435,12 +467,13 @@ class MapViewer extends React.Component {
435
467
  prepackageHandler={this.prepackageHandler}
436
468
  uploadedFile={this.state.uploadedFile}
437
469
  uploadFileHandler={this.uploadFileHandler}
470
+ mapDiv={this.mapdiv}
438
471
  />
439
472
  ); //call conf
440
473
  }
441
474
 
442
475
  renderBookmark() {
443
- if (this.view) return <CheckUserID reference={this} />;
476
+ if (this.view) return <CheckUserID reference={this} mapDiv={this.mapdiv} />;
444
477
  }
445
478
 
446
479
  appLanguage() {
@@ -449,7 +482,11 @@ class MapViewer extends React.Component {
449
482
 
450
483
  renderLoadingSpinner() {
451
484
  return (
452
- <LoadingSpinner view={this.view} layerLoading={this.state.layerLoading} />
485
+ <LoadingSpinner
486
+ view={this.view}
487
+ layerLoading={this.state.layerLoading}
488
+ mapDiv={this.mapdiv}
489
+ />
453
490
  );
454
491
  }
455
492
 
@@ -180,11 +180,13 @@ class MeasurementWidget extends React.Component {
180
180
  */
181
181
  async componentDidMount() {
182
182
  await this.loader();
183
- this.props.view.ui.add(this.container.current, 'top-right');
184
- this.measurement = new Measurement({
185
- view: this.props.view,
186
- container: this.container.current.querySelector('.measurement-area'),
187
- });
183
+ if (this.props.mapDiv.current) {
184
+ this.props.view.ui.add(this.container.current, 'top-right');
185
+ this.measurement = new Measurement({
186
+ view: this.props.view,
187
+ container: this.container.current.querySelector('.measurement-area'),
188
+ });
189
+ }
188
190
  }
189
191
  /**
190
192
  * This method renders the component
@@ -799,11 +799,13 @@ class MenuWidget extends React.Component {
799
799
  loadCss();
800
800
  await this.loader();
801
801
  await this.getTMSLayersJSON();
802
- if (!this.props.download) {
803
- this.prepareHotspotLayers();
804
- this.getHotspotLayerIds();
802
+ if (this.props.mapDiv.current) {
803
+ if (!this.props.download) {
804
+ this.prepareHotspotLayers();
805
+ this.getHotspotLayerIds();
806
+ }
807
+ this.props.view.ui.add(this.container.current, 'top-left');
805
808
  }
806
- this.props.view.ui.add(this.container.current, 'top-left');
807
809
  if (this.props.download) {
808
810
  setTimeout(() => {
809
811
  document.querySelector('.area-panel input:checked').click();
@@ -20,11 +20,13 @@ class PanWidget extends React.Component {
20
20
  * This method is executed after the rener method is executed
21
21
  */
22
22
  async componentDidMount() {
23
- this.props.view.ui.add({
24
- component: this.container.current,
25
- position: 'top-right',
26
- index: 0,
27
- });
23
+ if (this.props.mapDiv.current) {
24
+ this.props.view.ui.add({
25
+ component: this.container.current,
26
+ position: 'top-right',
27
+ index: 0,
28
+ });
29
+ }
28
30
  }
29
31
 
30
32
  togglePan() {
@@ -71,11 +71,13 @@ class PrintWidget extends React.Component {
71
71
  */
72
72
  async componentDidMount() {
73
73
  await this.loader();
74
- this.props.view.ui.add(this.container.current, 'top-right');
75
- this.print = new Print({
76
- view: this.props.view,
77
- container: this.container.current.querySelector('.print-panel'),
78
- });
74
+ if (this.props.mapDiv.current) {
75
+ this.props.view.ui.add(this.container.current, 'top-right');
76
+ this.print = new Print({
77
+ view: this.props.view,
78
+ container: this.container.current.querySelector('.print-panel'),
79
+ });
80
+ }
79
81
  }
80
82
 
81
83
  componentDidUpdate() {
@@ -35,7 +35,9 @@ class ScaleWidget extends React.Component {
35
35
  view: this.props.view,
36
36
  unit: 'dual',
37
37
  });
38
- this.props.view.ui.add(this.scaleBar, 'bottom-left');
38
+ if (this.props.mapDiv.current) {
39
+ this.props.view.ui.add(this.scaleBar, 'bottom-left');
40
+ }
39
41
  }
40
42
  /**
41
43
  * This method renders the component
@@ -91,7 +91,9 @@ class SwipeWidget extends React.Component {
91
91
  * This method is executed after the rener method is executed
92
92
  */
93
93
  async componentDidMount() {
94
- this.props.view.ui.add(this.container.current, 'top-right');
94
+ if (this.props.mapDiv.current) {
95
+ this.props.view.ui.add(this.container.current, 'top-right');
96
+ }
95
97
  await this.loader();
96
98
  this.swipe = new Swipe({
97
99
  view: this.props.view,
@@ -262,12 +262,14 @@ class TimesliderWidget extends React.Component {
262
262
  }
263
263
  },
264
264
  });
265
- this.props.view.ui.add(this.container.current, 'bottom-right');
266
- this.container.current.insertAdjacentHTML(
267
- 'beforeend',
268
- '<div class="esri-icon-close" id="timeslider_close" role="button"></div>',
269
- );
270
- this.container.current.style.display = 'block';
265
+ if (this.props.mapDiv.current) {
266
+ this.props.view.ui.add(this.container.current, 'bottom-right');
267
+ this.container.current.insertAdjacentHTML(
268
+ 'beforeend',
269
+ '<div class="esri-icon-close" id="timeslider_close" role="button"></div>',
270
+ );
271
+ this.container.current.style.display = 'block';
272
+ }
271
273
  this.setState({ showDatePanel: true });
272
274
 
273
275
  document