@eeacms/volto-arcgis-block 0.1.107 → 0.1.108

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,14 @@ 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.108](https://github.com/eea/volto-arcgis-block/compare/0.1.107...0.1.108) - 27 February 2023
8
+
9
+ #### :hammer_and_wrench: Others
10
+
11
+ - Delete comment [Amanda Rodriguez - [`873a594`](https://github.com/eea/volto-arcgis-block/commit/873a594332908ee6d39dfbbc2239a06455a9ebc6)]
12
+ - CLMS-1831 [Amanda Rodriguez - [`0df846a`](https://github.com/eea/volto-arcgis-block/commit/0df846a7fce73e2d6b395b26677175702cc49b36)]
13
+ - CLMS-1843 [Amanda Rodriguez - [`839a331`](https://github.com/eea/volto-arcgis-block/commit/839a331049cf47d396300c2825eef6666e159609)]
14
+ - Time slider bug fix [Amanda Rodriguez - [`d383ee3`](https://github.com/eea/volto-arcgis-block/commit/d383ee38625ee2a528e07babf65340717aab9034)]
7
15
  ### [0.1.107](https://github.com/eea/volto-arcgis-block/compare/0.1.106...0.1.107) - 23 February 2023
8
16
 
9
17
  #### :hammer_and_wrench: Others
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@eeacms/volto-arcgis-block",
3
- "version": "0.1.107",
3
+ "version": "0.1.108",
4
4
  "description": "volto-arcgis-block: Volto add-on",
5
5
  "main": "src/index.js",
6
6
  "author": "European Environment Agency: CodeSyntax",
@@ -78,9 +78,7 @@ export const AddCartItem = ({
78
78
  if (hasTimeStart) {
79
79
  let datasetInput = document.querySelector(
80
80
  '#active_' +
81
- datasetElem
82
- .querySelector('.map-dataset-checkbox input')
83
- .getAttribute('defcheck'),
81
+ datasetElem.querySelector('.map-menu-layer input:checked').id,
84
82
  );
85
83
  let time = {
86
84
  start: parseInt(datasetInput.getAttribute('time-start')),
@@ -117,9 +115,7 @@ export const AddCartItem = ({
117
115
  let datasetElem = document.querySelector('[datasetid="' + id + '"]');
118
116
  let datasetActive = document.querySelector(
119
117
  '#active_' +
120
- datasetElem
121
- .querySelector('.map-dataset-checkbox input')
122
- .getAttribute('defcheck'),
118
+ datasetElem.querySelector('.map-menu-layer input:checked').id,
123
119
  );
124
120
  return datasetActive ? datasetActive.hasAttribute('time-start') : false;
125
121
  };
@@ -139,11 +135,11 @@ export const AddCartItem = ({
139
135
  if (dataset.IsTimeSeries && !checkTimeData(dataset)) {
140
136
  document.getElementById('active_label').click();
141
137
  if (!document.querySelector('.timeslider-container')) {
142
- let layerId = document
143
- .querySelector(
144
- '[datasetid="' + dataset.DatasetId + '"] input',
145
- )
146
- .getAttribute('defcheck');
138
+ let layerId = document.querySelector(
139
+ '[datasetid="' +
140
+ dataset.DatasetId +
141
+ '"] .map-menu-layer input:checked',
142
+ ).id;
147
143
  document
148
144
  .querySelector(
149
145
  "[layer-id='" + layerId + "'] .active-layer-time",
@@ -177,11 +173,11 @@ export const AddCartItem = ({
177
173
  if (dataset.IsTimeSeries && !checkTimeData(dataset)) {
178
174
  document.getElementById('active_label').click();
179
175
  if (!document.querySelector('.timeslider-container')) {
180
- let layerId = document
181
- .querySelector(
182
- '[datasetid="' + dataset.DatasetId + '"] input',
183
- )
184
- .getAttribute('defcheck');
176
+ let layerId = document.querySelector(
177
+ '[datasetid="' +
178
+ dataset.DatasetId +
179
+ '"] .map-menu-layer input:checked',
180
+ ).id;
185
181
  document
186
182
  .querySelector(
187
183
  "[layer-id='" + layerId + "'] .active-layer-time",
@@ -205,11 +201,11 @@ export const AddCartItem = ({
205
201
  if (dataset.IsTimeSeries && !checkTimeData(dataset)) {
206
202
  document.getElementById('active_label').click();
207
203
  if (!document.querySelector('.timeslider-container')) {
208
- let layerId = document
209
- .querySelector(
210
- '[datasetid="' + dataset.DatasetId + '"] input',
211
- )
212
- .getAttribute('defcheck');
204
+ let layerId = document.querySelector(
205
+ '[datasetid="' +
206
+ dataset.DatasetId +
207
+ '"] .map-menu-layer input:checked',
208
+ ).id;
213
209
  document
214
210
  .querySelector(
215
211
  "[layer-id='" + layerId + "'] .active-layer-time",
@@ -928,7 +924,7 @@ class MenuWidget extends React.Component {
928
924
  */
929
925
  updateCheckProduct(productid) {
930
926
  let datasetChecks = Array.from(
931
- document.querySelectorAll('[parentid=' + productid + ']'),
927
+ document.querySelectorAll('[parentid="' + productid + '"]'),
932
928
  );
933
929
  let productCheck = document.querySelector('#' + productid);
934
930
  let trueCheck = datasetChecks.filter((elem) => elem.checked).length;
@@ -1180,7 +1176,7 @@ class MenuWidget extends React.Component {
1180
1176
  updateCheckDataset(id) {
1181
1177
  let datasetCheck = document.querySelector('#' + id);
1182
1178
  let layerChecks = Array.from(
1183
- document.querySelectorAll('[parentid=' + id + ']'),
1179
+ document.querySelectorAll('[parentid="' + id + '"]'),
1184
1180
  );
1185
1181
 
1186
1182
  let trueChecks = layerChecks.filter((elem) => elem.checked).length;
@@ -2058,6 +2054,9 @@ class MenuWidget extends React.Component {
2058
2054
  ReactDOM.unmountComponentAtNode(
2059
2055
  document.querySelector('.esri-ui-bottom-right'),
2060
2056
  );
2057
+ if (document.querySelector('.drawRectanglePopup-block'))
2058
+ document.querySelector('.drawRectanglePopup-block').style.display =
2059
+ 'block';
2061
2060
  } else {
2062
2061
  if (this.visibleLayers[layerId][1] === 'eye-slash') {
2063
2062
  this.layers[layerId].visible = true;
@@ -2484,7 +2483,14 @@ class MenuWidget extends React.Component {
2484
2483
  hotspotLayers.length === 0 &&
2485
2484
  document.querySelector('.hotspot-container')
2486
2485
  ) {
2487
- this.props.mapViewer.closeActiveWidget();
2486
+ if (
2487
+ this.props.mapViewer.activeWidget &&
2488
+ this.props.mapViewer.activeWidget.container.current.classList.contains(
2489
+ 'hotspot-container',
2490
+ )
2491
+ ) {
2492
+ this.props.mapViewer.closeActiveWidget();
2493
+ }
2488
2494
  document.querySelector('.hotspot-container').style.display = 'none';
2489
2495
  } else if (this.props.view && hotspotLayers.length > 0) {
2490
2496
  document.querySelector('.hotspot-container').style.display = 'flex';
@@ -2516,14 +2522,12 @@ class MenuWidget extends React.Component {
2516
2522
  time.start = parseInt(activeLayer.getAttribute('time-start'));
2517
2523
  time.end = parseInt(activeLayer.getAttribute('time-end'));
2518
2524
  }
2519
- let isLoggedIn = document
2520
- .querySelector('[defcheck=' + elem.id + ']')
2521
- .parentElement.querySelector('.map-menu-icon-login')
2522
- .classList.contains('logged');
2525
+ let isLoggedIn = document.querySelector('.map-menu-icon-login.logged');
2523
2526
  ReactDOM.render(
2524
2527
  <TimesliderWidget
2525
2528
  view={this.props.view}
2526
2529
  map={this.map}
2530
+ mapViewer={this.props.mapViewer}
2527
2531
  layer={layer}
2528
2532
  download={this.props.download}
2529
2533
  time={time}
@@ -24,7 +24,8 @@ class TimesliderWidget extends React.Component {
24
24
  timeSelectedValuesC: [], //To compare time slider stored values with new selected values
25
25
  showDatePanel: false,
26
26
  lockDatePanel: true,
27
- showCalendar: false,
27
+ showCalendar:
28
+ this.props.fromDownload || this.props.download ? true : false,
28
29
  dateStart: this.props.time.start ? new Date(this.props.time.start) : null,
29
30
  dateEnd: this.props.time.end ? new Date(this.props.time.end) : null,
30
31
  periodicity: null,
@@ -43,6 +44,13 @@ class TimesliderWidget extends React.Component {
43
44
  this.layerName = this.layer.activeLayer.id; //WMTS
44
45
  }
45
46
  this.drag = {};
47
+ if (
48
+ this.props.fromDownload &&
49
+ document.querySelector('.drawRectanglePopup-block')
50
+ ) {
51
+ document.querySelector('.drawRectanglePopup-block').style.display =
52
+ 'none';
53
+ }
46
54
  }
47
55
 
48
56
  loader() {
@@ -244,8 +252,6 @@ class TimesliderWidget extends React.Component {
244
252
  }
245
253
  this.setState({
246
254
  lockDatePanel: false,
247
- showCalendar:
248
- this.props.fromDownload || this.props.download ? true : false,
249
255
  });
250
256
  }
251
257
  },
@@ -297,6 +303,7 @@ class TimesliderWidget extends React.Component {
297
303
 
298
304
  this.getCapabilities(this.layer.url, serviceType).then((xml) => {
299
305
  let times = {};
306
+ let periodicity;
300
307
  if (this.layer.type === 'wms') {
301
308
  times = this.parseTimeWMS(xml);
302
309
  } else if (this.layer.type === 'wmts') {
@@ -326,6 +333,8 @@ class TimesliderWidget extends React.Component {
326
333
  unit: 'minutes',
327
334
  },
328
335
  };
336
+
337
+ periodicity = times[this.layerName].period;
329
338
  } else if (times[this.layerName].hasOwnProperty('array')) {
330
339
  // Dates array
331
340
  this.TimesliderWidget.fullTimeExtent = new TimeExtent({
@@ -350,19 +359,20 @@ class TimesliderWidget extends React.Component {
350
359
  timeDict[time[i]] = times[this.layerName].array[i];
351
360
  }
352
361
  }
353
- }
354
362
 
355
- let periodicity = Math.floor(
356
- (Date.parse(times[this.layerName].array[1]) -
357
- Date.parse(times[this.layerName].array[0])) /
358
- 86400000,
359
- );
360
- if (periodicity === 0) {
361
- periodicity =
362
- (new Date(times[this.layerName].array[1]).getHours() -
363
- new Date(times[this.layerName].array[0]).getHours()) /
364
- 24;
363
+ periodicity = Math.floor(
364
+ (Date.parse(times[this.layerName].array[1]) -
365
+ Date.parse(times[this.layerName].array[0])) /
366
+ 86400000,
367
+ );
368
+ if (periodicity === 0) {
369
+ periodicity =
370
+ (new Date(times[this.layerName].array[1]).getHours() -
371
+ new Date(times[this.layerName].array[0]).getHours()) /
372
+ 24;
373
+ }
365
374
  }
375
+
366
376
  this.setState({ periodicity: periodicity });
367
377
 
368
378
  this.TimesliderWidget.watch('timeExtent', (timeExtent) => {
@@ -415,17 +425,17 @@ class TimesliderWidget extends React.Component {
415
425
 
416
426
  getPeriodicity() {
417
427
  let period = this.state.periodicity;
418
- if (period === 1 / 24) {
428
+ if (period === 1 / 24 || period === 'PT1H') {
419
429
  return 'hourly';
420
- } else if (period === 1) {
430
+ } else if (period === 1 || period === 'P1D') {
421
431
  return 'daily';
422
- } else if (period === 7) {
432
+ } else if (period === 7 || period === 'P7D' || period === 'P1W') {
423
433
  return 'weekly';
424
- } else if (period === 10) {
434
+ } else if (period === 10 || period === 'P10D') {
425
435
  return '10-daily';
426
- } else if (period >= 28 && period <= 31) {
436
+ } else if ((period >= 28 && period <= 31) || period === 'P1M') {
427
437
  return 'monthly';
428
- } else if (period === 365 || period === 366) {
438
+ } else if (period === 365 || period === 366 || period === 'P1Y') {
429
439
  return 'yearly';
430
440
  } else {
431
441
  return 'not regular';
@@ -490,6 +500,18 @@ class TimesliderWidget extends React.Component {
490
500
  dateEnd: end,
491
501
  showCalendar: false,
492
502
  });
503
+ if (this.props.fromDownload) {
504
+ this.props.time.elem.querySelector('.active-layer-time').click();
505
+ document.getElementById('products_label').click();
506
+ if (
507
+ this.props.mapViewer.activeWidget &&
508
+ !this.props.mapViewer.activeWidget.container.current.classList.contains(
509
+ 'area-container',
510
+ )
511
+ ) {
512
+ document.getElementById('map_area_button').click();
513
+ }
514
+ }
493
515
  }
494
516
 
495
517
  handleInputChange(e) {
@@ -513,7 +535,7 @@ class TimesliderWidget extends React.Component {
513
535
  let inputEnd;
514
536
  let timeStart;
515
537
  let timeEnd;
516
- if (this.state.showCalendar) {
538
+ if (!this.state.lockDatePanel && this.state.showCalendar) {
517
539
  inputStart = this.formatDate(
518
540
  this.state.inputStart
519
541
  ? this.state.inputStart
@@ -573,7 +595,7 @@ class TimesliderWidget extends React.Component {
573
595
  )}
574
596
  </div>
575
597
  )}
576
- {this.state.showCalendar && (
598
+ {!this.state.lockDatePanel && this.state.showCalendar && (
577
599
  <div className="timeslider-calendar-container">
578
600
  <div className="timeslider-calendar-header">
579
601
  <b>Select temporal interval to download</b>