@eeacms/volto-arcgis-block 0.1.358 → 0.1.360

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,13 @@ 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.360](https://github.com/eea/volto-arcgis-block/compare/0.1.359...0.1.360) - 19 May 2025
8
+
9
+ #### :hammer_and_wrench: Others
10
+
11
+ - CLMS-287785 (bug): all bookmark data updated on order shift [Unai Bolivar - [`ebc49f7`](https://github.com/eea/volto-arcgis-block/commit/ebc49f73a4bae9bd29d0ee1c4706b0e1ce42c5c8)]
12
+ ### [0.1.359](https://github.com/eea/volto-arcgis-block/compare/0.1.358...0.1.359) - 16 May 2025
13
+
7
14
  ### [0.1.358](https://github.com/eea/volto-arcgis-block/compare/0.1.357...0.1.358) - 14 May 2025
8
15
 
9
16
  #### :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.358",
3
+ "version": "0.1.360",
4
4
  "description": "volto-arcgis-block: Volto add-on",
5
5
  "main": "src/index.js",
6
6
  "author": "European Environment Agency: CodeSyntax",
@@ -27,6 +27,7 @@ class BookmarkWidget extends React.Component {
27
27
  this.menuClass =
28
28
  'esri-icon-bookmark esri-widget--button esri-widget esri-interactive';
29
29
  this.sessionBookmarks = [];
30
+ this.sessionBookmarkIndexLinkUid = [];
30
31
  this.sessionBookmarkLayers = [];
31
32
  this.sessionBookmarkOpacity = [];
32
33
  this.sessionBookmarkVisible = [];
@@ -200,6 +201,7 @@ class BookmarkWidget extends React.Component {
200
201
  }
201
202
  });
202
203
  this.sessionBookmarks.push(e.added[0]);
204
+ this.sessionBookmarkIndexLinkUid.push(e.added[0].uid);
203
205
  this.sessionBookmarkLayers.push(check);
204
206
  this.sessionBookmarkOpacity.push(opacity);
205
207
  this.sessionBookmarkVisible.push(visible);
@@ -237,55 +239,92 @@ class BookmarkWidget extends React.Component {
237
239
  this.sessionBookmarkLayers.splice(index, 1);
238
240
  this.sessionBookmarkOpacity.splice(index, 1);
239
241
  this.sessionBookmarkVisible.splice(index, 1);
240
- this.sessionBookmarkHotspot.splice(index, 1);
242
+ if (
243
+ this.sessionBookmarkHotspot &&
244
+ Array.isArray(this.sessionBookmarkHotspot)
245
+ ) {
246
+ this.sessionBookmarkHotspot.splice(index, 1);
247
+ }
241
248
  shouldUpdate = true;
242
249
  break;
243
250
  }
244
251
  }
245
- } else {
246
- let newSessionBookmark = [];
252
+ } else if (e.moved) {
253
+ let newSessionBookmarks = [];
254
+ let newSessionBookmarkIndexLinkUid = [];
247
255
  let newSessionBookmarkLayers = [];
248
256
  let newSessionBookmarkOpacity = [];
249
257
  let newSessionBookmarkVisible = [];
250
258
  let newSessionBookmarkHotspot = [];
251
- for (let i = 0; i < this.Bookmarks.bookmarks.items.length; i++) {
252
- for (let j = 0; j < this.sessionBookmarks.length; j++) {
253
- if (
254
- this.Bookmarks.bookmarks.items[i] === this.sessionBookmarks[j]
255
- ) {
256
- newSessionBookmark.push(this.sessionBookmarks[j]);
257
- newSessionBookmarkLayers.push(this.sessionBookmarkLayers[j]);
258
- newSessionBookmarkOpacity.push(
259
- this.sessionBookmarkOpacity[j],
260
- );
261
- newSessionBookmarkVisible.push(
262
- this.sessionBookmarkVisible[j],
263
- );
264
- newSessionBookmarkHotspot.push(
265
- this.sessionBookmarkHotspot[j],
266
- );
267
- }
268
- }
269
- }
270
- if (
271
- newSessionBookmark.length !== this.sessionBookmarks.length ||
272
- newSessionBookmarkLayers.length !==
273
- this.sessionBookmarkLayers.length ||
274
- newSessionBookmarkOpacity.length !==
275
- this.sessionBookmarkOpacity.length ||
276
- newSessionBookmarkVisible.length !==
277
- this.sessionBookmarkVisible.length ||
278
- newSessionBookmarkHotspot.length !==
279
- this.sessionBookmarkHotspot.length
280
- ) {
281
- this.sessionBookmarks = newSessionBookmark;
282
- this.sessionBookmarkLayers = newSessionBookmarkLayers;
283
- this.sessionBookmarkOpacity = newSessionBookmarkOpacity;
284
- this.sessionBookmarkVisible = newSessionBookmarkVisible;
285
- this.sessionBookmarkHotspot = newSessionBookmarkHotspot;
286
- shouldUpdate = true;
287
- }
259
+ e.moved.forEach((bookmark) => {
260
+ let index = this.sessionBookmarkIndexLinkUid.indexOf(
261
+ bookmark.uid,
262
+ );
263
+ newSessionBookmarks.push(bookmark);
264
+ newSessionBookmarkIndexLinkUid.push(bookmark.uid);
265
+ newSessionBookmarkLayers.push(this.sessionBookmarkLayers[index]);
266
+ newSessionBookmarkOpacity.push(
267
+ this.sessionBookmarkOpacity[index],
268
+ );
269
+ newSessionBookmarkVisible.push(
270
+ this.sessionBookmarkVisible[index],
271
+ );
272
+ newSessionBookmarkHotspot.push(
273
+ this.sessionBookmarkHotspot[index],
274
+ );
275
+ });
276
+ this.sessionBookmarks = newSessionBookmarks;
277
+ this.sessionBookmarkIndexLinkUid = newSessionBookmarkIndexLinkUid;
278
+ this.sessionBookmarkLayers = newSessionBookmarkLayers;
279
+ this.sessionBookmarkOpacity = newSessionBookmarkOpacity;
280
+ this.sessionBookmarkVisible = newSessionBookmarkVisible;
281
+ this.sessionBookmarkHotspot = newSessionBookmarkHotspot;
282
+ shouldUpdate = true;
288
283
  }
284
+ // } else {
285
+ // let newSessionBookmark = [];
286
+ // let newSessionBookmarkLayers = [];
287
+ // let newSessionBookmarkOpacity = [];
288
+ // let newSessionBookmarkVisible = [];
289
+ // let newSessionBookmarkHotspot = [];
290
+ // for (let i = 0; i < this.Bookmarks.bookmarks.items.length; i++) {
291
+ // for (let j = 0; j < this.sessionBookmarks.length; j++) {
292
+ // if (
293
+ // this.Bookmarks.bookmarks.items[i] === this.sessionBookmarks[j]
294
+ // ) {
295
+ // newSessionBookmark.push(this.sessionBookmarks[j]);
296
+ // newSessionBookmarkLayers.push(this.sessionBookmarkLayers[j]);
297
+ // newSessionBookmarkOpacity.push(
298
+ // this.sessionBookmarkOpacity[j],
299
+ // );
300
+ // newSessionBookmarkVisible.push(
301
+ // this.sessionBookmarkVisible[j],
302
+ // );
303
+ // newSessionBookmarkHotspot.push(
304
+ // this.sessionBookmarkHotspot[j],
305
+ // );
306
+ // }
307
+ // }
308
+ // }
309
+ // }
310
+ // if (
311
+ // newSessionBookmark.length !== this.sessionBookmarks.length ||
312
+ // newSessionBookmarkLayers.length !==
313
+ // this.sessionBookmarkLayers.length ||
314
+ // newSessionBookmarkOpacity.length !==
315
+ // this.sessionBookmarkOpacity.length ||
316
+ // newSessionBookmarkVisible.length !==
317
+ // this.sessionBookmarkVisible.length ||
318
+ // newSessionBookmarkHotspot.length !==
319
+ // this.sessionBookmarkHotspot.length
320
+ // ) {
321
+ // this.sessionBookmarks = newSessionBookmark;
322
+ // this.sessionBookmarkLayers = newSessionBookmarkLayers;
323
+ // this.sessionBookmarkOpacity = newSessionBookmarkOpacity;
324
+ // this.sessionBookmarkVisible = newSessionBookmarkVisible;
325
+ // this.sessionBookmarkHotspot = newSessionBookmarkHotspot;
326
+ // shouldUpdate = true;
327
+ // }
289
328
  if (shouldUpdate && this.userID != null) {
290
329
  localStorage.setItem(
291
330
  BOOKMARK_SESSION_KEY + '_' + this.userID,
@@ -431,6 +470,13 @@ class BookmarkWidget extends React.Component {
431
470
  );
432
471
  }
433
472
  }
473
+ if (
474
+ !Array.isArray(selectLayers) ||
475
+ !Array.isArray(selectOpacity) ||
476
+ !Array.isArray(selectVisible)
477
+ ) {
478
+ return;
479
+ }
434
480
  let layerOpacities = {};
435
481
  const layerKeys = {
436
482
  lcc_filter: 'all_lcc',
@@ -4500,9 +4500,13 @@ class MenuWidget extends React.Component {
4500
4500
  });
4501
4501
  }, 0);
4502
4502
  }
4503
+ let url = new URL(window.location.href);
4504
+ let product = url.searchParams.get('product');
4505
+ let dataset = url.searchParams.get('dataset');
4503
4506
  if (
4504
4507
  this.state.wmsUserServiceLayers.length > 0 &&
4505
- prevState.wmsUserServiceLayers.length === 0
4508
+ prevState.wmsUserServiceLayers.length === 0 &&
4509
+ !(product || dataset)
4506
4510
  ) {
4507
4511
  // Close other tabs and open "My Services" tab
4508
4512
  let dropdownsMapMenu = document.querySelectorAll('.map-menu-dropdown');