@eeacms/volto-arcgis-block 0.1.368 → 0.1.369
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,8 @@ 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.369](https://github.com/eea/volto-arcgis-block/compare/0.1.368...0.1.369) - 18 June 2025
|
|
8
|
+
|
|
7
9
|
### [0.1.368](https://github.com/eea/volto-arcgis-block/compare/0.1.367...0.1.368) - 17 June 2025
|
|
8
10
|
|
|
9
11
|
### [0.1.367](https://github.com/eea/volto-arcgis-block/compare/0.1.366...0.1.367) - 17 June 2025
|
package/package.json
CHANGED
|
@@ -27,7 +27,6 @@ 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 = [];
|
|
31
30
|
this.sessionBookmarkLayers = [];
|
|
32
31
|
this.sessionBookmarkOpacity = [];
|
|
33
32
|
this.sessionBookmarkVisible = [];
|
|
@@ -93,6 +92,72 @@ class BookmarkWidget extends React.Component {
|
|
|
93
92
|
}
|
|
94
93
|
}
|
|
95
94
|
|
|
95
|
+
processReorder(newOrder) {
|
|
96
|
+
const oldBookmarks = this.sessionBookmarks;
|
|
97
|
+
const reorderedBookmarks = newOrder.map((uid) => {
|
|
98
|
+
const index = oldBookmarks.findIndex(
|
|
99
|
+
(bookmark) => bookmark && bookmark.uid === uid,
|
|
100
|
+
);
|
|
101
|
+
return index !== -1 ? oldBookmarks[index] : null;
|
|
102
|
+
});
|
|
103
|
+
|
|
104
|
+
const hasEqualLength =
|
|
105
|
+
oldBookmarks.length === newOrder.length &&
|
|
106
|
+
newOrder.length === reorderedBookmarks.length;
|
|
107
|
+
const hasNullValues = reorderedBookmarks.some((item) => item === null);
|
|
108
|
+
|
|
109
|
+
if (hasEqualLength && !hasNullValues) {
|
|
110
|
+
return reorderedBookmarks;
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
let missingBookmark = null;
|
|
114
|
+
let missingIndex = -1;
|
|
115
|
+
|
|
116
|
+
for (let i = 0; i < oldBookmarks.length; i++) {
|
|
117
|
+
const oldBookmark = oldBookmarks[i];
|
|
118
|
+
const newUid = i < newOrder.length ? newOrder[i] : null;
|
|
119
|
+
|
|
120
|
+
if (
|
|
121
|
+
oldBookmark &&
|
|
122
|
+
newUid &&
|
|
123
|
+
oldBookmark.uid === newUid &&
|
|
124
|
+
!reorderedBookmarks.includes(oldBookmark)
|
|
125
|
+
) {
|
|
126
|
+
missingBookmark = oldBookmark;
|
|
127
|
+
missingIndex = i;
|
|
128
|
+
break;
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
if (missingBookmark && missingIndex !== -1) {
|
|
133
|
+
if (reorderedBookmarks.length !== oldBookmarks.length) {
|
|
134
|
+
const finalBookmarks = [];
|
|
135
|
+
let reorderIndex = 0;
|
|
136
|
+
|
|
137
|
+
for (let i = 0; i < oldBookmarks.length; i++) {
|
|
138
|
+
if (i === missingIndex) {
|
|
139
|
+
finalBookmarks[i] = missingBookmark;
|
|
140
|
+
} else {
|
|
141
|
+
finalBookmarks[i] =
|
|
142
|
+
reorderIndex < reorderedBookmarks.length
|
|
143
|
+
? reorderedBookmarks[reorderIndex]
|
|
144
|
+
: null;
|
|
145
|
+
reorderIndex++;
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
return finalBookmarks;
|
|
149
|
+
} else if (hasNullValues) {
|
|
150
|
+
const nullIndex = reorderedBookmarks.findIndex((item) => item === null);
|
|
151
|
+
if (nullIndex === missingIndex) {
|
|
152
|
+
reorderedBookmarks[nullIndex] = missingBookmark;
|
|
153
|
+
}
|
|
154
|
+
return reorderedBookmarks;
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
return reorderedBookmarks;
|
|
159
|
+
}
|
|
160
|
+
|
|
96
161
|
async componentDidMount() {
|
|
97
162
|
this._isMounted = true;
|
|
98
163
|
await this.loader();
|
|
@@ -201,7 +266,6 @@ class BookmarkWidget extends React.Component {
|
|
|
201
266
|
}
|
|
202
267
|
});
|
|
203
268
|
this.sessionBookmarks.push(e.added[0]);
|
|
204
|
-
this.sessionBookmarkIndexLinkUid.push(e.added[0].uid);
|
|
205
269
|
this.sessionBookmarkLayers.push(check);
|
|
206
270
|
this.sessionBookmarkOpacity.push(opacity);
|
|
207
271
|
this.sessionBookmarkVisible.push(visible);
|
|
@@ -250,35 +314,37 @@ class BookmarkWidget extends React.Component {
|
|
|
250
314
|
}
|
|
251
315
|
}
|
|
252
316
|
} else if (e.moved) {
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
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],
|
|
317
|
+
const newOrder = e.target?.items.map((bookmark) => bookmark.uid);
|
|
318
|
+
const reorderedBookmarks = this.processReorder(newOrder);
|
|
319
|
+
|
|
320
|
+
const reorderedLayers = [];
|
|
321
|
+
const reorderedOpacity = [];
|
|
322
|
+
const reorderedVisible = [];
|
|
323
|
+
const reorderedHotspot = [];
|
|
324
|
+
|
|
325
|
+
reorderedBookmarks.forEach((bookmark) => {
|
|
326
|
+
const originalIndex = this.sessionBookmarks.findIndex(
|
|
327
|
+
(original) => original && original.uid === bookmark.uid,
|
|
274
328
|
);
|
|
329
|
+
if (originalIndex !== -1) {
|
|
330
|
+
reorderedLayers.push(this.sessionBookmarkLayers[originalIndex]);
|
|
331
|
+
reorderedOpacity.push(
|
|
332
|
+
this.sessionBookmarkOpacity[originalIndex],
|
|
333
|
+
);
|
|
334
|
+
reorderedVisible.push(
|
|
335
|
+
this.sessionBookmarkVisible[originalIndex],
|
|
336
|
+
);
|
|
337
|
+
reorderedHotspot.push(
|
|
338
|
+
this.sessionBookmarkHotspot[originalIndex],
|
|
339
|
+
);
|
|
340
|
+
}
|
|
275
341
|
});
|
|
276
|
-
|
|
277
|
-
this.
|
|
278
|
-
this.sessionBookmarkLayers =
|
|
279
|
-
this.sessionBookmarkOpacity =
|
|
280
|
-
this.sessionBookmarkVisible =
|
|
281
|
-
this.sessionBookmarkHotspot =
|
|
342
|
+
|
|
343
|
+
this.sessionBookmarks = reorderedBookmarks;
|
|
344
|
+
this.sessionBookmarkLayers = reorderedLayers;
|
|
345
|
+
this.sessionBookmarkOpacity = reorderedOpacity;
|
|
346
|
+
this.sessionBookmarkVisible = reorderedVisible;
|
|
347
|
+
this.sessionBookmarkHotspot = reorderedHotspot;
|
|
282
348
|
shouldUpdate = true;
|
|
283
349
|
}
|
|
284
350
|
// } else {
|