@eeacms/volto-arcgis-block 0.1.205 → 0.1.207

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,10 @@ 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.207](https://github.com/eea/volto-arcgis-block/compare/0.1.206...0.1.207) - 27 September 2023
8
+
9
+ ### [0.1.206](https://github.com/eea/volto-arcgis-block/compare/0.1.205...0.1.206) - 26 September 2023
10
+
7
11
  ### [0.1.205](https://github.com/eea/volto-arcgis-block/compare/0.1.204...0.1.205) - 25 September 2023
8
12
 
9
13
  #### :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.205",
3
+ "version": "0.1.207",
4
4
  "description": "volto-arcgis-block: Volto add-on",
5
5
  "main": "src/index.js",
6
6
  "author": "European Environment Agency: CodeSyntax",
@@ -192,6 +192,17 @@ class AreaWidget extends React.Component {
192
192
  });
193
193
  return index;
194
194
  }
195
+
196
+ checkExtent(extent) {
197
+ if (
198
+ extent.xmin < -31.27 &&
199
+ extent.xmax > 44.82 &&
200
+ extent.ymin < 27.64 &&
201
+ extent.ymax > 80.83
202
+ )
203
+ return true;
204
+ }
205
+
195
206
  rectanglehandler() {
196
207
  this.clearWidget();
197
208
  window.document.querySelector('.pan-container').style.display = 'flex';
@@ -212,10 +223,17 @@ class AreaWidget extends React.Component {
212
223
  if (e.action === 'start') {
213
224
  if (extentGraphic) this.props.view.graphics.remove(extentGraphic);
214
225
  origin = this.props.view.toMap(e);
215
- this.setState({
216
- showInfoPopup: true,
217
- infoPopupType: 'download',
218
- });
226
+ if (extentGraphic && this.checkExtent(extentGraphic.geometry)) {
227
+ this.setState({
228
+ showInfoPopup: true,
229
+ infoPopupType: 'fullDataset',
230
+ });
231
+ } else {
232
+ this.setState({
233
+ showInfoPopup: true,
234
+ infoPopupType: 'download',
235
+ });
236
+ }
219
237
  if (this.props.download) {
220
238
  document.querySelector('.drawRectanglePopup-block').style.display =
221
239
  'none';
@@ -233,6 +251,17 @@ class AreaWidget extends React.Component {
233
251
  }),
234
252
  symbol: fillSymbol,
235
253
  });
254
+ if (extentGraphic && this.checkExtent(extentGraphic.geometry)) {
255
+ this.setState({
256
+ showInfoPopup: true,
257
+ infoPopupType: 'fullDataset',
258
+ });
259
+ } else {
260
+ this.setState({
261
+ showInfoPopup: true,
262
+ infoPopupType: 'download',
263
+ });
264
+ }
236
265
  this.props.updateArea({
237
266
  origin: { x: origin.longitude, y: origin.latitude },
238
267
  end: { x: p.longitude, y: p.latitude },
@@ -530,6 +559,17 @@ class AreaWidget extends React.Component {
530
559
  </div>
531
560
  </>
532
561
  )}
562
+ {this.state.infoPopupType === 'fullDataset' && (
563
+ <>
564
+ <span className="drawRectanglePopup-icon">
565
+ <FontAwesomeIcon icon={['fas', 'info-circle']} />
566
+ </span>
567
+ <div className="drawRectanglePopupWarning-text">
568
+ Full dataset's only downloadable through the M2M API,
569
+ AOI isn't sent to cart
570
+ </div>
571
+ </>
572
+ )}
533
573
  </div>
534
574
  </div>
535
575
  </div>
@@ -125,21 +125,27 @@ export const AddCartItem = ({
125
125
  (isLoggedIn ? ' logged' : '')
126
126
  }
127
127
  onClick={(e) => {
128
- if (!areaData) {
129
- if (
130
- !mapViewer.activeWidget ||
131
- !mapViewer.activeWidget.container.current.classList.contains(
132
- 'area-container',
133
- )
134
- ) {
135
- document.querySelector('#map_area_button').click();
128
+ if (
129
+ !document.getElementsByClassName(
130
+ 'drawRectanglePopupWarning-text',
131
+ ).length > 0
132
+ ) {
133
+ if (!areaData) {
134
+ if (
135
+ !mapViewer.activeWidget ||
136
+ !mapViewer.activeWidget.container.current.classList.contains(
137
+ 'area-container',
138
+ )
139
+ ) {
140
+ document.querySelector('#map_area_button').click();
141
+ }
142
+ } else {
143
+ checkArea(e);
136
144
  }
137
- } else {
138
- checkArea(e);
139
145
  }
140
146
  }}
141
147
  onKeyDown={(e) => {
142
- if (!areaData) {
148
+ /* if (!areaData) {
143
149
  if (
144
150
  !mapViewer.activeWidget ||
145
151
  !mapViewer.activeWidget.container.current.classList.contains(
@@ -150,16 +156,26 @@ export const AddCartItem = ({
150
156
  }
151
157
  } else {
152
158
  checkArea(e);
153
- }
159
+ } */
154
160
  }}
155
161
  tabIndex="0"
156
162
  role="button"
157
163
  >
158
164
  <FontAwesomeIcon
159
- className={isLoggedIn ? '' : ' locked'}
165
+ className={
166
+ isLoggedIn &&
167
+ !document.getElementsByClassName(
168
+ 'drawRectanglePopupWarning-text',
169
+ ).length > 0
170
+ ? ''
171
+ : ' locked'
172
+ }
160
173
  icon={['fas', 'download']}
161
174
  />
162
- {!isLoggedIn && <FontAwesomeIcon icon={['fas', 'lock']} />}
175
+ {!isLoggedIn ||
176
+ (document.getElementsByClassName(
177
+ 'drawRectanglePopupWarning-text',
178
+ ).length > 0 && <FontAwesomeIcon icon={['fas', 'lock']} />)}
163
179
  </span>
164
180
  }
165
181
  content="Download"
@@ -1434,7 +1450,6 @@ class MenuWidget extends React.Component {
1434
1450
  let selectedUrl;
1435
1451
  let zoom = this.view.get('zoom');
1436
1452
  if (layer.LayerUrl && Object.keys(layer.LayerUrl).length > 0) {
1437
- // replace testingUrl with layer.LayerUrl
1438
1453
  zoom < 10
1439
1454
  ? (selectedUrl = layer.LayerUrl['longZoom'])
1440
1455
  : (selectedUrl = layer.LayerUrl['shortZoom']);
@@ -1510,7 +1525,7 @@ class MenuWidget extends React.Component {
1510
1525
  selectedUrl,
1511
1526
  );
1512
1527
  if (customTileLayer === null || customTileLayer === undefined) return;
1513
- if (this.layers[checkboxId]) {
1528
+ if (this.layers[checkboxId] && this.activeLayersJSON[checkboxId]) {
1514
1529
  if (customTileLayer.urlTemplate !== this.layers[checkboxId].urlTemplate) {
1515
1530
  this.map.remove(this.layers[checkboxId]);
1516
1531
  this.layers[checkboxId] = customTileLayer;
@@ -3007,7 +3022,10 @@ class MenuWidget extends React.Component {
3007
3022
  */
3008
3023
  eyeLayer(elem) {
3009
3024
  this.findCheckedDataset(elem);
3010
- if (this.visibleLayers[elem.id][1] === 'eye') {
3025
+ if (
3026
+ this.visibleLayers[elem.id] &&
3027
+ this.visibleLayers[elem.id][1] === 'eye'
3028
+ ) {
3011
3029
  this.layers[elem.id].visible = false;
3012
3030
  this.visibleLayers[elem.id] = ['fas', 'eye-slash'];
3013
3031
  if (this.layers['lcc_filter'] && elem.id.includes('all_lcc')) {