@eeacms/volto-arcgis-block 0.1.37 → 0.1.38

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,8 +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.38](https://github.com/eea/volto-arcgis-block/compare/0.1.37...0.1.38)
8
+
9
+ - Bugs n improvements [`#114`](https://github.com/eea/volto-arcgis-block/pull/114)
10
+ - change clms-utils version [`029f7af`](https://github.com/eea/volto-arcgis-block/commit/029f7afae5aa03dd732ea8b6e01f59eceec5c281)
11
+ - ESLint fix [`dcdd9e7`](https://github.com/eea/volto-arcgis-block/commit/dcdd9e7b9fa206def9ff3f8173632c548ae83c59)
12
+ - ESLint fix [`6e0cba5`](https://github.com/eea/volto-arcgis-block/commit/6e0cba5ecc450deec0deded854f7ad46c6eb7cf8)
13
+ - Info widget table [`65da92c`](https://github.com/eea/volto-arcgis-block/commit/65da92c048bd363a7070c9e63f3c199f5be61721)
14
+
7
15
  #### [0.1.37](https://github.com/eea/volto-arcgis-block/compare/0.1.36...0.1.37)
8
16
 
17
+ > 15 March 2022
18
+
19
+ - Develop [`#113`](https://github.com/eea/volto-arcgis-block/pull/113)
9
20
  - Download flow [`#112`](https://github.com/eea/volto-arcgis-block/pull/112)
10
21
 
11
22
  #### [0.1.36](https://github.com/eea/volto-arcgis-block/compare/0.1.35...0.1.36)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@eeacms/volto-arcgis-block",
3
- "version": "0.1.37",
3
+ "version": "0.1.38",
4
4
  "description": "volto-arcgis-block: Volto add-on",
5
5
  "main": "src/index.js",
6
6
  "author": "European Environment Agency: CodeSyntax",
@@ -40,7 +40,7 @@
40
40
  "@fortawesome/fontawesome-svg-core": "1.2.35",
41
41
  "@fortawesome/free-solid-svg-icons": "5.15.3",
42
42
  "@fortawesome/react-fontawesome": "0.1.14",
43
- "@eeacms/volto-clms-utils": "0.1.1",
43
+ "@eeacms/volto-clms-utils": "*",
44
44
  "highcharts": "^9.3.2",
45
45
  "highcharts-react-official": "^3.1.0"
46
46
  },
@@ -81,7 +81,7 @@ class AreaWidget extends React.Component {
81
81
  'none';
82
82
  this.container.current
83
83
  .querySelector('.esri-widget--button')
84
- .classList.replace('esri-icon-right-arrow', 'esri-icon-cursor-marquee');
84
+ .classList.replace('esri-icon-close', 'esri-icon-cursor-marquee');
85
85
  // By invoking the setState, we notify the state we want to reach
86
86
  // and ensure that the component is rendered again
87
87
  this.setState({ showMapMenu: false });
@@ -95,7 +95,7 @@ class AreaWidget extends React.Component {
95
95
  'block';
96
96
  this.container.current
97
97
  .querySelector('.esri-widget--button')
98
- .classList.replace('esri-icon-cursor-marquee', 'esri-icon-right-arrow');
98
+ .classList.replace('esri-icon-cursor-marquee', 'esri-icon-close');
99
99
  // By invoking the setState, we notify the state we want to reach
100
100
  // and ensure that the component is rendered again
101
101
  this.setState({ showMapMenu: true });
@@ -65,7 +65,7 @@ class BasemapWidget extends React.Component {
65
65
  this.basemapGallery.domNode.style.display = 'none';
66
66
  this.container.current
67
67
  .querySelector('.esri-widget--button')
68
- .classList.replace('esri-icon-right-arrow', 'esri-icon-basemap');
68
+ .classList.replace('esri-icon-close', 'esri-icon-basemap');
69
69
  // By invoking the setState, we notify the state we want to reach
70
70
  // and ensure that the component is rendered again
71
71
  this.setState({ showMapMenu: false });
@@ -75,7 +75,7 @@ class BasemapWidget extends React.Component {
75
75
  this.basemapGallery.domNode.style.display = 'block';
76
76
  this.container.current
77
77
  .querySelector('.esri-widget--button')
78
- .classList.replace('esri-icon-basemap', 'esri-icon-right-arrow');
78
+ .classList.replace('esri-icon-basemap', 'esri-icon-close');
79
79
  // By invoking the setState, we notify the state we want to reach
80
80
  // and ensure that the component is rendered again
81
81
  this.setState({ showMapMenu: true });
@@ -50,7 +50,7 @@ class InfoWidget extends React.Component {
50
50
  'none';
51
51
  this.container.current
52
52
  .querySelector('.esri-widget--button')
53
- .classList.replace('esri-icon-right-arrow', 'esri-icon-description');
53
+ .classList.replace('esri-icon-close', 'esri-icon-description');
54
54
  // By invoking the setState, we notify the state we want to reach
55
55
  // and ensure that the component is rendered again
56
56
  this.setState({
@@ -64,7 +64,7 @@ class InfoWidget extends React.Component {
64
64
  this.props.mapViewer.setActiveWidget(this);
65
65
  this.container.current
66
66
  .querySelector('.esri-widget--button')
67
- .classList.replace('esri-icon-description', 'esri-icon-right-arrow');
67
+ .classList.replace('esri-icon-description', 'esri-icon-close');
68
68
  this.container.current.querySelector('.info-panel').style.display =
69
69
  'block';
70
70
  // By invoking the setState, we notify the state we want to reach
@@ -433,13 +433,17 @@ class InfoWidget extends React.Component {
433
433
  }
434
434
 
435
435
  transformWmsData(obj) {
436
- let values = { timeFields: {}, data: {}, variables: {} };
436
+ let values = { timeFields: {}, data: {}, variables: {}, tableData: {} };
437
437
  let startField = Object.keys(obj[0]).find(
438
438
  (a, i) =>
439
439
  a.toUpperCase().includes('DATE') &&
440
440
  !isNaN(parseInt(Object.values(obj[0])[i])),
441
441
  );
442
442
  values.timeFields['start'] = startField;
443
+ values.tableData['fields'] = Object.keys(obj[0]);
444
+ values.tableData['values'] = obj.map((a) => {
445
+ return Object.entries(a);
446
+ });
443
447
  let fields = Object.keys(obj[0]).filter((a, i) => {
444
448
  return (
445
449
  !isNaN(parseInt(Object.values(obj[0])[i])) &&
@@ -510,10 +514,13 @@ class InfoWidget extends React.Component {
510
514
  }
511
515
 
512
516
  identify(layer, evt) {
513
- let values = { timeFields: {}, data: {}, variables: {} };
517
+ let values = { timeFields: {}, data: {}, variables: {}, tableData: {} };
514
518
  //Complete time data
515
519
  values.timeFields['start'] = layer.timeInfo.startField;
516
520
  values.timeFields['end'] = layer.timeInfo.endField;
521
+ values.tableData['fields'] = layer.fields.map((a) => {
522
+ return a.name;
523
+ });
517
524
  let timeQuery = layer.createQuery();
518
525
  timeQuery.outFields = [layer.timeInfo.startField];
519
526
  let fields = layer.fields
@@ -552,7 +559,7 @@ class InfoWidget extends React.Component {
552
559
  query.units = 'meters';
553
560
  query.spatialRelationship = 'intersects'; // this is the default
554
561
  query.returnGeometry = true;
555
- query.outFields = [fields.toString()]; // Information to be returned
562
+ query.outFields = [values.tableData.fields.toString()]; // Information to be returned
556
563
  values.data['outFields'] = [fields.toString()];
557
564
 
558
565
  let p2 = layer.queryFeatures(query).then((response) => {
@@ -579,8 +586,16 @@ class InfoWidget extends React.Component {
579
586
  e.geometry.latitude === point.latitude &&
580
587
  e.geometry.longitude === point.longitude,
581
588
  );
589
+ values.tableData['values'] = values.data['values'] = info.map((e) => {
590
+ return Object.entries(e.attributes);
591
+ });
582
592
  values.data['values'] = info.map((e) => {
583
- return e.attributes;
593
+ let attributes = e.attributes;
594
+ return Object.fromEntries(
595
+ Object.entries(attributes).filter(([key]) =>
596
+ values.data.outFields[0].split(',').includes(key),
597
+ ),
598
+ );
584
599
  });
585
600
  });
586
601
 
@@ -695,6 +710,27 @@ class InfoWidget extends React.Component {
695
710
  );
696
711
  }
697
712
 
713
+ loadTimeInfoTable(index) {
714
+ let properties = this.infoData[index].data.tableData.values;
715
+ let table = properties.map((item) => {
716
+ let rows = item.map((row) => {
717
+ return (
718
+ <tr key={row}>
719
+ {Object.values(row).map((val) => (
720
+ <td key={val}>{val}</td>
721
+ ))}
722
+ </tr>
723
+ );
724
+ });
725
+ return (
726
+ <table className="info-table">
727
+ <tbody>{rows}</tbody>
728
+ </table>
729
+ );
730
+ });
731
+ return <>{table}</>;
732
+ }
733
+
698
734
  loadVariableSelector(index) {
699
735
  let response = this.infoData[index].data;
700
736
  let variables = response.variables.options;
@@ -913,6 +949,7 @@ class InfoWidget extends React.Component {
913
949
  options={this.loadInfoChart(this.state.layerIndex)}
914
950
  />
915
951
  {this.loadStatisticsSelector(this.state.layerIndex)}
952
+ {this.loadTimeInfoTable(this.state.layerIndex)}
916
953
  </>
917
954
  )}
918
955
  {this.state.popup &&
@@ -38,7 +38,7 @@ class LegendWidget extends React.Component {
38
38
  'none';
39
39
  this.container.current
40
40
  .querySelector('.esri-widget--button')
41
- .classList.replace('esri-icon-right-arrow', 'esri-icon-legend');
41
+ .classList.replace('esri-icon-close', 'esri-icon-legend');
42
42
  // By invoking the setState, we notify the state we want to reach
43
43
  // and ensure that the component is rendered again
44
44
  this.setState({ showMapMenu: false });
@@ -46,7 +46,7 @@ class LegendWidget extends React.Component {
46
46
  this.props.mapViewer.setActiveWidget(this);
47
47
  this.container.current
48
48
  .querySelector('.esri-widget--button')
49
- .classList.replace('esri-icon-legend', 'esri-icon-right-arrow');
49
+ .classList.replace('esri-icon-legend', 'esri-icon-close');
50
50
  this.container.current.querySelector('.legend-panel').style.display =
51
51
  'block';
52
52
  // By invoking the setState, we notify the state we want to reach
@@ -38,7 +38,7 @@ class MeasurementWidget extends React.Component {
38
38
  'none';
39
39
  this.container.current
40
40
  .querySelector('.esri-widget--button')
41
- .classList.replace('esri-icon-right-arrow', 'esri-icon-measure');
41
+ .classList.replace('esri-icon-close', 'esri-icon-measure');
42
42
  // By invoking the setState, we notify the state we want to reach
43
43
  // and ensure that the component is rendered again
44
44
  this.setState({ showMapMenu: false });
@@ -56,7 +56,7 @@ class MeasurementWidget extends React.Component {
56
56
  'block';
57
57
  this.container.current
58
58
  .querySelector('.esri-widget--button')
59
- .classList.replace('esri-icon-measure', 'esri-icon-right-arrow');
59
+ .classList.replace('esri-icon-measure', 'esri-icon-close');
60
60
  // By invoking the setState, we notify the state we want to reach
61
61
  // and ensure that the component is rendered again
62
62
  this.setState({ showMapMenu: true });
@@ -111,7 +111,7 @@ class MeasurementWidget extends React.Component {
111
111
 
112
112
  showCoordinates(pt) {
113
113
  this.setState({
114
- latlong: pt.latitude.toFixed(3) + ' ' + pt.longitude.toFixed(3),
114
+ latlong: pt.latitude.toFixed(4) + ' ' + pt.longitude.toFixed(4),
115
115
  });
116
116
  }
117
117
 
@@ -360,7 +360,7 @@ class MenuWidget extends React.Component {
360
360
  this.container.current.querySelector('#paneles').style.display = 'none';
361
361
  this.container.current
362
362
  .querySelector('.esri-widget--button')
363
- .classList.replace('esri-icon-left-arrow', 'esri-icon-drag-horizontal');
363
+ .classList.replace('esri-icon-close', 'esri-icon-drag-horizontal');
364
364
  if (document.contains(document.querySelector('.timeslider-container')))
365
365
  document.querySelector('.timeslider-container').style.display = 'none';
366
366
 
@@ -373,7 +373,7 @@ class MenuWidget extends React.Component {
373
373
  this.container.current.querySelector('#paneles').style.display = 'block';
374
374
  this.container.current
375
375
  .querySelector('.esri-widget--button')
376
- .classList.replace('esri-icon-drag-horizontal', 'esri-icon-left-arrow');
376
+ .classList.replace('esri-icon-drag-horizontal', 'esri-icon-close');
377
377
  if (document.contains(document.querySelector('.timeslider-container')))
378
378
  document.querySelector('.timeslider-container').style.display = 'block';
379
379
 
@@ -43,7 +43,7 @@ class PrintWidget extends React.Component {
43
43
  this.print.domNode.style.display = 'none';
44
44
  this.container.current
45
45
  .querySelector('.esri-widget--button')
46
- .classList.replace('esri-icon-right-arrow', 'esri-icon-printer');
46
+ .classList.replace('esri-icon-close', 'esri-icon-printer');
47
47
  // By invoking the setState, we notify the state we want to reach
48
48
  // and ensure that the component is rendered again
49
49
  this.setState({ showMapMenu: false });
@@ -52,7 +52,7 @@ class PrintWidget extends React.Component {
52
52
  this.print.domNode.style.display = 'block';
53
53
  this.container.current
54
54
  .querySelector('.esri-widget--button')
55
- .classList.replace('esri-icon-printer', 'esri-icon-right-arrow');
55
+ .classList.replace('esri-icon-printer', 'esri-icon-close');
56
56
  // By invoking the setState, we notify the state we want to reach
57
57
  // and ensure that the component is rendered again
58
58
  this.setState({ showMapMenu: true });
@@ -647,6 +647,7 @@
647
647
 
648
648
  .info-table {
649
649
  width: 100%;
650
+ margin-bottom: 1rem;
650
651
  table-layout: fixed;
651
652
  }
652
653
 
@@ -666,6 +667,10 @@
666
667
  background-color: #ebebeb;
667
668
  }
668
669
 
670
+ .info-statistics-panel {
671
+ margin-bottom: 1rem;
672
+ }
673
+
669
674
  /* Time slider*/
670
675
  .esri-ui-bottom-right.esri-ui-corner {
671
676
  width: 100%;
@@ -35,14 +35,14 @@ class LegendWidget extends React.Component {
35
35
  'none';
36
36
  this.container.current
37
37
  .querySelector('.esri-widget--button')
38
- .classList.replace('esri-icon-right-arrow', 'esri-icon-legend');
38
+ .classList.replace('esri-icon-close', 'esri-icon-legend');
39
39
  // By invoking the setState, we notify the state we want to reach
40
40
  // and ensure that the component is rendered again
41
41
  this.mapViewer.setState({ showMapMenu: false });
42
42
  } else {
43
43
  this.container.current
44
44
  .querySelector('.esri-widget--button')
45
- .classList.replace('esri-icon-legend', 'esri-icon-right-arrow');
45
+ .classList.replace('esri-icon-legend', 'esri-icon-close');
46
46
  this.container.current.querySelector('.legend-panel').style.display =
47
47
  'block';
48
48