@eeacms/volto-arcgis-block 0.1.404 → 0.1.406
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 +10 -0
- package/package.json +1 -1
- package/src/components/MapViewer/BookmarkWidget.jsx +120 -24
package/CHANGELOG.md
CHANGED
|
@@ -4,8 +4,18 @@ 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.406](https://github.com/eea/volto-arcgis-block/compare/0.1.405...0.1.406) - 19 November 2025
|
|
8
|
+
|
|
9
|
+
#### :hammer_and_wrench: Others
|
|
10
|
+
|
|
11
|
+
- CLMS-293307+CLMS-289791+CLMS-289790 (bug): Download button creation correction [Urkorue - [`d3684ca`](https://github.com/eea/volto-arcgis-block/commit/d3684ca9cb6ae617fa8c9fd1c1cf286f5fe8910f)]
|
|
12
|
+
### [0.1.405](https://github.com/eea/volto-arcgis-block/compare/0.1.404...0.1.405) - 12 November 2025
|
|
13
|
+
|
|
7
14
|
### [0.1.404](https://github.com/eea/volto-arcgis-block/compare/0.1.403...0.1.404) - 5 November 2025
|
|
8
15
|
|
|
16
|
+
#### :hammer_and_wrench: Others
|
|
17
|
+
|
|
18
|
+
- Merge pull request #1050 from eea/develop [Unai Bolivar - [`0708eba`](https://github.com/eea/volto-arcgis-block/commit/0708ebafa517a330ecc02ec7ad073b67cdb9f60d)]
|
|
9
19
|
### [0.1.403](https://github.com/eea/volto-arcgis-block/compare/0.1.402...0.1.403) - 4 November 2025
|
|
10
20
|
|
|
11
21
|
### [0.1.402](https://github.com/eea/volto-arcgis-block/compare/0.1.401...0.1.402) - 3 November 2025
|
package/package.json
CHANGED
|
@@ -253,15 +253,127 @@ class BookmarkWidget extends React.Component {
|
|
|
253
253
|
document
|
|
254
254
|
.querySelectorAll('.esri-bookmarks__bookmark')
|
|
255
255
|
.forEach((bookmark) => {
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
256
|
+
if (bookmark.childNodes.length < 4) {
|
|
257
|
+
let tooltip = document.createElement('div');
|
|
258
|
+
tooltip.setAttribute('tooltip', 'Download bookmark');
|
|
259
|
+
tooltip.setAttribute('direction', 'left');
|
|
260
|
+
tooltip.setAttribute('type', 'widget');
|
|
261
|
+
let download_button = document.createElement('div');
|
|
262
|
+
tooltip.appendChild(download_button);
|
|
263
|
+
download_button.className =
|
|
264
|
+
'esri-button download-bookmark-button';
|
|
265
|
+
download_button.innerText = '⭳';
|
|
266
|
+
download_button.bookmarkName = bookmark.innerText;
|
|
267
|
+
download_button.addEventListener('click', (e) => {
|
|
268
|
+
this.downloadBookmark(e.currentTarget.bookmarkName);
|
|
269
|
+
});
|
|
270
|
+
bookmark.insertBefore(tooltip, bookmark.childNodes[2]);
|
|
271
|
+
}
|
|
264
272
|
});
|
|
273
|
+
let bookmarkList = document.querySelector('.esri-bookmarks__list');
|
|
274
|
+
const config = { childList: true };
|
|
275
|
+
const callback = function (mutationList, observer) {
|
|
276
|
+
for (const mutation of mutationList) {
|
|
277
|
+
if (mutation.type === 'childList') {
|
|
278
|
+
document
|
|
279
|
+
.querySelectorAll('.esri-bookmarks__bookmark')
|
|
280
|
+
.forEach((bookmark) => {
|
|
281
|
+
if (bookmark.childNodes.length < 4) {
|
|
282
|
+
let tooltip = document.createElement('div');
|
|
283
|
+
tooltip.setAttribute('tooltip', 'Download bookmark');
|
|
284
|
+
tooltip.setAttribute('direction', 'left');
|
|
285
|
+
tooltip.setAttribute('type', 'widget');
|
|
286
|
+
let download_button = document.createElement('div');
|
|
287
|
+
tooltip.appendChild(download_button);
|
|
288
|
+
download_button.className =
|
|
289
|
+
'esri-button download-bookmark-button';
|
|
290
|
+
download_button.innerText = '⭳';
|
|
291
|
+
download_button.bookmarkName = bookmark.innerText;
|
|
292
|
+
download_button.addEventListener('click', (e) => {
|
|
293
|
+
const name = e.currentTarget.bookmarkName;
|
|
294
|
+
let storageKey;
|
|
295
|
+
if (document.querySelector('.fa-user')) {
|
|
296
|
+
storageKey =
|
|
297
|
+
'user_' +
|
|
298
|
+
document.querySelector('.fa-user').nextSibling
|
|
299
|
+
.textContent;
|
|
300
|
+
} else {
|
|
301
|
+
storageKey = 'user_anonymous';
|
|
302
|
+
}
|
|
303
|
+
let userObj;
|
|
304
|
+
try {
|
|
305
|
+
userObj =
|
|
306
|
+
JSON.parse(localStorage.getItem(storageKey)) || {};
|
|
307
|
+
} catch (e) {
|
|
308
|
+
userObj = {};
|
|
309
|
+
}
|
|
310
|
+
let bookmarks =
|
|
311
|
+
userObj &&
|
|
312
|
+
userObj.bookmarks &&
|
|
313
|
+
typeof userObj.bookmarks === 'object'
|
|
314
|
+
? userObj.bookmarks
|
|
315
|
+
: null;
|
|
316
|
+
if (!bookmarks) {
|
|
317
|
+
try {
|
|
318
|
+
bookmarks = JSON.parse(
|
|
319
|
+
localStorage.getItem(
|
|
320
|
+
storageKey + '_bookmarks_backup',
|
|
321
|
+
),
|
|
322
|
+
);
|
|
323
|
+
} catch (e) {
|
|
324
|
+
return;
|
|
325
|
+
}
|
|
326
|
+
}
|
|
327
|
+
if (!bookmarks) return;
|
|
328
|
+
let index = 0;
|
|
329
|
+
for (index; index < bookmarks.items.length; index++) {
|
|
330
|
+
if (bookmarks.items[index].name === name) {
|
|
331
|
+
break;
|
|
332
|
+
}
|
|
333
|
+
}
|
|
334
|
+
let selectedBookmark = {
|
|
335
|
+
items: Array.isArray(bookmarks.items)
|
|
336
|
+
? bookmarks.items[index]
|
|
337
|
+
: [],
|
|
338
|
+
layers: Array.isArray(bookmarks.layers)
|
|
339
|
+
? bookmarks.layers[index]
|
|
340
|
+
: [],
|
|
341
|
+
opacity: Array.isArray(bookmarks.opacity)
|
|
342
|
+
? bookmarks.opacity[index]
|
|
343
|
+
: [],
|
|
344
|
+
visible: Array.isArray(bookmarks.visible)
|
|
345
|
+
? bookmarks.visible[index]
|
|
346
|
+
: [],
|
|
347
|
+
hotspot: Array.isArray(bookmarks.hotspot)
|
|
348
|
+
? bookmarks.hotspot[index]
|
|
349
|
+
: [],
|
|
350
|
+
selectedHotspotFilter:
|
|
351
|
+
bookmarks.selectedHotspotFilter != null
|
|
352
|
+
? bookmarks.selectedHotspotFilter
|
|
353
|
+
: null,
|
|
354
|
+
};
|
|
355
|
+
let filename = 'bookmark_' + selectedBookmark.items.name;
|
|
356
|
+
const blob = new Blob(
|
|
357
|
+
[JSON.stringify(selectedBookmark)],
|
|
358
|
+
{
|
|
359
|
+
type: 'application/json',
|
|
360
|
+
},
|
|
361
|
+
);
|
|
362
|
+
const url = URL.createObjectURL(blob);
|
|
363
|
+
const a = document.createElement('a');
|
|
364
|
+
a.href = url;
|
|
365
|
+
a.download = `${filename}.json`;
|
|
366
|
+
a.click();
|
|
367
|
+
URL.revokeObjectURL(url);
|
|
368
|
+
});
|
|
369
|
+
bookmark.insertBefore(tooltip, bookmark.childNodes[2]);
|
|
370
|
+
}
|
|
371
|
+
});
|
|
372
|
+
}
|
|
373
|
+
}
|
|
374
|
+
};
|
|
375
|
+
const observer = new MutationObserver(callback);
|
|
376
|
+
observer.observe(bookmarkList, config);
|
|
265
377
|
}
|
|
266
378
|
this.arcgisEventHandles.push(
|
|
267
379
|
this.Bookmarks.bookmarks.on('change', (e) => {
|
|
@@ -808,22 +920,6 @@ class BookmarkWidget extends React.Component {
|
|
|
808
920
|
);
|
|
809
921
|
});
|
|
810
922
|
});
|
|
811
|
-
if (this.userID !== null) {
|
|
812
|
-
document
|
|
813
|
-
.querySelectorAll('.esri-bookmarks__bookmark')
|
|
814
|
-
.forEach((bookmark) => {
|
|
815
|
-
if (bookmark.childNodes.length < 4) {
|
|
816
|
-
let download_button = document.createElement('button');
|
|
817
|
-
download_button.className = 'esri-button download-bookmark-button';
|
|
818
|
-
download_button.innerText = '⭳';
|
|
819
|
-
download_button.bookmarkName = bookmark.innerText;
|
|
820
|
-
download_button.addEventListener('click', (e) => {
|
|
821
|
-
this.downloadBookmark(e.currentTarget.bookmarkName);
|
|
822
|
-
});
|
|
823
|
-
bookmark.insertBefore(download_button, bookmark.childNodes[2]);
|
|
824
|
-
}
|
|
825
|
-
});
|
|
826
|
-
}
|
|
827
923
|
}
|
|
828
924
|
componentWillUnmount() {
|
|
829
925
|
this._isMounted = false;
|