@eeacms/volto-arcgis-block 0.1.106 → 0.1.107
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 +140 -62
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.107](https://github.com/eea/volto-arcgis-block/compare/0.1.106...0.1.107) - 23 February 2023
|
|
8
|
+
|
|
9
|
+
#### :hammer_and_wrench: Others
|
|
10
|
+
|
|
11
|
+
- SPRINT-42 FIX: Display timeslider and calendar is user logs in after selecting a layer's timeslider function [ujbolivar - [`b554678`](https://github.com/eea/volto-arcgis-block/commit/b554678ed043043f50d4010424eacb709e91e80c)]
|
|
7
12
|
### [0.1.106](https://github.com/eea/volto-arcgis-block/compare/0.1.105...0.1.106) - 23 February 2023
|
|
8
13
|
|
|
9
14
|
#### :hammer_and_wrench: Others
|
package/package.json
CHANGED
|
@@ -394,76 +394,136 @@ class MenuWidget extends React.Component {
|
|
|
394
394
|
this.setState({ noServiceModal: true });
|
|
395
395
|
};
|
|
396
396
|
|
|
397
|
+
getCookie(name) {
|
|
398
|
+
var dc = document.cookie;
|
|
399
|
+
var prefix = name + '=';
|
|
400
|
+
var begin = dc.indexOf('; ' + prefix);
|
|
401
|
+
if (begin === -1) {
|
|
402
|
+
begin = dc.indexOf(prefix);
|
|
403
|
+
if (begin !== 0) return null;
|
|
404
|
+
} else {
|
|
405
|
+
begin += 2;
|
|
406
|
+
var end = document.cookie.indexOf(';', begin);
|
|
407
|
+
if (end === -1) {
|
|
408
|
+
end = dc.length;
|
|
409
|
+
}
|
|
410
|
+
}
|
|
411
|
+
return decodeURI(dc.substring(begin + prefix.length, end));
|
|
412
|
+
}
|
|
413
|
+
|
|
397
414
|
/**
|
|
398
415
|
* Method that will be invoked when the
|
|
399
416
|
* button is clicked. It controls the open
|
|
400
417
|
* and close actions of the component
|
|
401
418
|
*/
|
|
402
419
|
openMenu() {
|
|
403
|
-
|
|
404
|
-
this.
|
|
405
|
-
'
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
.
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
420
|
+
setTimeout(() => {
|
|
421
|
+
if (this.state.showMapMenu) {
|
|
422
|
+
this.container.current.querySelector('#tabcontainer').style.display =
|
|
423
|
+
'none';
|
|
424
|
+
this.container.current.querySelector('#paneles').style.display = 'none';
|
|
425
|
+
this.container.current
|
|
426
|
+
.querySelector('.esri-widget--button')
|
|
427
|
+
.classList.replace('esri-icon-close', 'esri-icon-drag-horizontal');
|
|
428
|
+
if (
|
|
429
|
+
document.contains(document.querySelector('.timeslider-container'))
|
|
430
|
+
) {
|
|
431
|
+
document.querySelector('.timeslider-container').style.display =
|
|
432
|
+
'none';
|
|
433
|
+
}
|
|
434
|
+
if (
|
|
435
|
+
document.querySelector('.opacity-panel').style.display === 'block'
|
|
436
|
+
) {
|
|
437
|
+
this.closeOpacity();
|
|
438
|
+
}
|
|
439
|
+
|
|
440
|
+
// By invoking the setState, we notify the state we want to reach
|
|
441
|
+
// and ensure that the component is rendered again
|
|
442
|
+
this.setState({ showMapMenu: false });
|
|
443
|
+
} else {
|
|
444
|
+
this.container.current.querySelector('#tabcontainer').style.display =
|
|
445
|
+
'block';
|
|
446
|
+
this.container.current.querySelector('#paneles').style.display =
|
|
447
|
+
'block';
|
|
448
|
+
this.container.current
|
|
449
|
+
.querySelector('.esri-widget--button')
|
|
450
|
+
.classList.replace('esri-icon-drag-horizontal', 'esri-icon-close');
|
|
451
|
+
if (document.contains(document.querySelector('.timeslider-container')))
|
|
452
|
+
document.querySelector('.timeslider-container').style.display =
|
|
453
|
+
'block';
|
|
454
|
+
|
|
455
|
+
// By invoking the setState, we notify the state we want to reach
|
|
456
|
+
// and ensure that the component is rendered again
|
|
457
|
+
this.setState({ showMapMenu: true });
|
|
412
458
|
}
|
|
413
|
-
if (
|
|
414
|
-
this.
|
|
459
|
+
if (this.loadFirst) {
|
|
460
|
+
this.checkUrl();
|
|
461
|
+
this.loadFirst = false;
|
|
462
|
+
this.zoomTooltips();
|
|
415
463
|
}
|
|
416
464
|
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
} else {
|
|
421
|
-
this.container.current.querySelector('#tabcontainer').style.display =
|
|
422
|
-
'block';
|
|
423
|
-
this.container.current.querySelector('#paneles').style.display = 'block';
|
|
424
|
-
this.container.current
|
|
425
|
-
.querySelector('.esri-widget--button')
|
|
426
|
-
.classList.replace('esri-icon-drag-horizontal', 'esri-icon-close');
|
|
427
|
-
if (document.contains(document.querySelector('.timeslider-container')))
|
|
428
|
-
document.querySelector('.timeslider-container').style.display = 'block';
|
|
429
|
-
|
|
430
|
-
// By invoking the setState, we notify the state we want to reach
|
|
431
|
-
// and ensure that the component is rendered again
|
|
432
|
-
this.setState({ showMapMenu: true });
|
|
433
|
-
}
|
|
434
|
-
if (this.loadFirst) {
|
|
435
|
-
this.checkUrl();
|
|
436
|
-
this.loadFirst = false;
|
|
437
|
-
this.zoomTooltips();
|
|
438
|
-
}
|
|
465
|
+
let authToken = this.getAuthToken();
|
|
466
|
+
let timeSliderTag = this.getTimeSliderTag();
|
|
467
|
+
let checkedLayers = JSON.parse(sessionStorage.getItem('checkedLayers'));
|
|
439
468
|
|
|
440
|
-
|
|
441
|
-
// "Active on map" section and the time slider opened by default if download and timeseries == true
|
|
442
|
-
if (this.layers)
|
|
443
|
-
if (this.props.download && this.layers) {
|
|
444
|
-
let layerid = Object.keys(this.layers)[0];
|
|
469
|
+
// "Active on map" section and the time slider opened by default if user is logged in and timeSliderTag is true
|
|
445
470
|
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
471
|
+
if (checkedLayers) {
|
|
472
|
+
if (authToken && timeSliderTag) {
|
|
473
|
+
for (let i = 0; i < checkedLayers.length; i++) {
|
|
474
|
+
let layerid = checkedLayers[i];
|
|
475
|
+
if (
|
|
476
|
+
layerid &&
|
|
477
|
+
this.layers[layerid].isTimeSeries &&
|
|
478
|
+
!this.container.current
|
|
479
|
+
.querySelector('.esri-widget')
|
|
480
|
+
.classList.contains('esri-icon-drag-horizontal')
|
|
481
|
+
) {
|
|
482
|
+
// select active on map tab
|
|
483
|
+
let event = new MouseEvent('click', {
|
|
484
|
+
view: window,
|
|
485
|
+
bubbles: true,
|
|
486
|
+
cancelable: false,
|
|
487
|
+
});
|
|
488
|
+
let el = document.getElementById('active_label');
|
|
489
|
+
el.dispatchEvent(event);
|
|
490
|
+
|
|
491
|
+
//open time slider
|
|
492
|
+
let layerElem = document.getElementById(layerid);
|
|
493
|
+
this.showTimeSlider(layerElem, true);
|
|
494
|
+
break;
|
|
495
|
+
}
|
|
496
|
+
}
|
|
465
497
|
}
|
|
466
498
|
}
|
|
499
|
+
// CLMS-1389
|
|
500
|
+
// "Active on map" section and the time slider opened by default if download and timeseries == true
|
|
501
|
+
|
|
502
|
+
if (this.layers)
|
|
503
|
+
if (this.props.download && this.layers) {
|
|
504
|
+
let layerid = Object.keys(this.layers)[0];
|
|
505
|
+
if (
|
|
506
|
+
layerid &&
|
|
507
|
+
this.layers[layerid].isTimeSeries &&
|
|
508
|
+
!this.container.current
|
|
509
|
+
.querySelector('.esri-widget')
|
|
510
|
+
.classList.contains('esri-icon-drag-horizontal')
|
|
511
|
+
) {
|
|
512
|
+
// select active on map tab
|
|
513
|
+
let event = new MouseEvent('click', {
|
|
514
|
+
view: window,
|
|
515
|
+
bubbles: true,
|
|
516
|
+
cancelable: false,
|
|
517
|
+
});
|
|
518
|
+
let el = document.getElementById('active_label');
|
|
519
|
+
el.dispatchEvent(event);
|
|
520
|
+
|
|
521
|
+
//open time slider
|
|
522
|
+
let layerElem = document.getElementById(layerid);
|
|
523
|
+
this.showTimeSlider(layerElem, true);
|
|
524
|
+
}
|
|
525
|
+
}
|
|
526
|
+
}, 1000);
|
|
467
527
|
}
|
|
468
528
|
|
|
469
529
|
/**
|
|
@@ -501,8 +561,26 @@ class MenuWidget extends React.Component {
|
|
|
501
561
|
|
|
502
562
|
setSliderTag(val) {
|
|
503
563
|
if (!sessionStorage.key('timeSliderTag'))
|
|
504
|
-
sessionStorage.setItem('timeSliderTag', '
|
|
505
|
-
sessionStorage.setItem('timeSliderTag', val);
|
|
564
|
+
sessionStorage.setItem('timeSliderTag', 'true');
|
|
565
|
+
else sessionStorage.setItem('timeSliderTag', val);
|
|
566
|
+
}
|
|
567
|
+
|
|
568
|
+
getAuthToken() {
|
|
569
|
+
let tokenResult = null;
|
|
570
|
+
if (this.getCookie('auth_token')) {
|
|
571
|
+
tokenResult = true;
|
|
572
|
+
} else {
|
|
573
|
+
tokenResult = false;
|
|
574
|
+
}
|
|
575
|
+
return tokenResult;
|
|
576
|
+
}
|
|
577
|
+
|
|
578
|
+
getTimeSliderTag() {
|
|
579
|
+
let tagResult = true;
|
|
580
|
+
if (!sessionStorage.key('timeSliderTag')) {
|
|
581
|
+
tagResult = false;
|
|
582
|
+
}
|
|
583
|
+
return tagResult;
|
|
506
584
|
}
|
|
507
585
|
|
|
508
586
|
/**
|
|
@@ -1882,10 +1960,10 @@ class MenuWidget extends React.Component {
|
|
|
1882
1960
|
showTimeSlider(elem, fromDownload) {
|
|
1883
1961
|
if (
|
|
1884
1962
|
sessionStorage.key('timeSliderTag') &&
|
|
1885
|
-
sessionStorage.getItem('timeSliderTag') === '
|
|
1963
|
+
sessionStorage.getItem('timeSliderTag') === 'true'
|
|
1886
1964
|
)
|
|
1887
|
-
this.setSliderTag(
|
|
1888
|
-
else this.setSliderTag(
|
|
1965
|
+
this.setSliderTag(false);
|
|
1966
|
+
else this.setSliderTag(true);
|
|
1889
1967
|
let activeLayers = document.querySelectorAll('.active-layer');
|
|
1890
1968
|
let group = this.getGroup(elem);
|
|
1891
1969
|
let groupLayers = this.getGroupLayers(group);
|