@eeacms/volto-arcgis-block 0.1.407 → 0.1.408

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,12 @@ 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.408](https://github.com/eea/volto-arcgis-block/compare/0.1.407...0.1.408) - 19 November 2025
8
+
9
+ #### :hammer_and_wrench: Others
10
+
11
+ - (bug): Fixed child node dissappearing errors that crash the data viewer [Unai Bolivar - [`d2d3503`](https://github.com/eea/volto-arcgis-block/commit/d2d3503371e90f50668964d0771be7de7ca3e447)]
12
+ - (feat): redid the titles produced for the error report [Unai Bolivar - [`08cd2bc`](https://github.com/eea/volto-arcgis-block/commit/08cd2bc75843b7313c54cffecd1b1c637ee2ab23)]
7
13
  ### [0.1.407](https://github.com/eea/volto-arcgis-block/compare/0.1.406...0.1.407) - 19 November 2025
8
14
 
9
15
  #### :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.407",
3
+ "version": "0.1.408",
4
4
  "description": "volto-arcgis-block: Volto add-on",
5
5
  "main": "src/index.js",
6
6
  "author": "European Environment Agency: CodeSyntax",
@@ -5,6 +5,7 @@ class ErrorReport extends React.Component {
5
5
  constructor(props) {
6
6
  super(props);
7
7
  this.container = createRef();
8
+ this.originalParent = null;
8
9
  this.state = {
9
10
  showMapMenu: false,
10
11
  latlong: null,
@@ -96,6 +97,7 @@ class ErrorReport extends React.Component {
96
97
  }
97
98
 
98
99
  getCheckedDatasets() {
100
+ let checked = [];
99
101
  try {
100
102
  let uid = sessionStorage.getItem('mv_hydrated_for');
101
103
  let key = uid ? 'user_' + uid : 'user_anonymous';
@@ -109,24 +111,130 @@ class ErrorReport extends React.Component {
109
111
  } catch {}
110
112
  }
111
113
  if (Array.isArray(cl)) {
112
- return [...new Set(cl)].filter((v) => v);
114
+ checked = [...new Set(cl)].filter((v) => v);
113
115
  }
114
116
  }
115
117
  } catch {}
116
- try {
117
- let ss = sessionStorage.getItem('checkedLayers');
118
- if (ss) {
119
- let cl = ss;
120
- if (typeof ss === 'string') {
118
+ if (!checked.length) {
119
+ try {
120
+ let ss = sessionStorage.getItem('checkedLayers');
121
+ if (ss) {
122
+ let cl = ss;
123
+ if (typeof ss === 'string') {
124
+ try {
125
+ cl = JSON.parse(ss);
126
+ } catch {}
127
+ }
128
+ if (Array.isArray(cl)) {
129
+ checked = [...new Set(cl)].filter((v) => v);
130
+ }
131
+ }
132
+ } catch {}
133
+ }
134
+ if (checked.length) {
135
+ let titles = [];
136
+ try {
137
+ let esc = function (s) {
138
+ try {
139
+ return CSS && CSS.escape
140
+ ? CSS.escape(s)
141
+ : String(s).replace(/[^a-zA-Z0-9_-]/g, '\\$&');
142
+ } catch {
143
+ return String(s).replace(/[^a-zA-Z0-9_-]/g, '\\$&');
144
+ }
145
+ };
146
+ let findTitleFor = function (val) {
147
+ let v = String(val);
148
+ let e = null;
121
149
  try {
122
- cl = JSON.parse(ss);
150
+ e = document.querySelector('[data-layer-id="' + esc(v) + '"]');
123
151
  } catch {}
152
+ if (!e) {
153
+ try {
154
+ e = document.querySelector('[data-id="' + esc(v) + '"]');
155
+ } catch {}
156
+ }
157
+ if (!e) {
158
+ try {
159
+ let sel1 = 'input[type="checkbox"][value="' + esc(v) + '"]';
160
+ e = document.querySelector(sel1);
161
+ } catch {}
162
+ }
163
+ if (!e) {
164
+ try {
165
+ let sel2 = 'input[type="checkbox"][id*="' + esc(v) + '"]';
166
+ e = document.querySelector(sel2);
167
+ } catch {}
168
+ }
169
+ if (e && e.tagName && e.tagName.toLowerCase() === 'input') {
170
+ let id = e.id;
171
+ if (id) {
172
+ try {
173
+ let selLab = 'label[for="' + esc(id) + '"]';
174
+ let lab = document.querySelector(selLab);
175
+ if (lab && lab.textContent) return lab.textContent.trim();
176
+ } catch {}
177
+ }
178
+ try {
179
+ let cont = e.closest('.toc-item,.ccl-tree__item,.layer-item');
180
+ if (cont) {
181
+ let selT =
182
+ '.toc-item-title,.ccl-tree__label,.layer-title,.title';
183
+
184
+ let lab = cont.querySelector(selT);
185
+ if (lab && lab.textContent) return lab.textContent.trim();
186
+ }
187
+ } catch {}
188
+ }
189
+ if (e) {
190
+ try {
191
+ let sel3 = '.toc-item-title,.ccl-tree__label,.layer-title,.title';
192
+ let lab = e.querySelector(sel3);
193
+ if (lab && lab.textContent) return lab.textContent.trim();
194
+ } catch {}
195
+ try {
196
+ let t = e.getAttribute('data-title');
197
+ if (t) return t;
198
+ } catch {}
199
+ try {
200
+ if (e.textContent) return e.textContent.trim();
201
+ } catch {}
202
+ }
203
+ return null;
204
+ };
205
+ checked.forEach(function (v) {
206
+ let t = findTitleFor(v);
207
+ if (t) titles.push(t);
208
+ });
209
+ } catch {}
210
+ if (titles.length) return [...new Set(titles)];
211
+ let all = [];
212
+ try {
213
+ let coll =
214
+ this.props.view &&
215
+ this.props.view.map &&
216
+ this.props.view.map.allLayers;
217
+ if (coll && coll.items) {
218
+ all = coll.items;
219
+ } else if (coll && coll.toArray) {
220
+ all = coll.toArray();
124
221
  }
125
- if (Array.isArray(cl)) {
126
- return [...new Set(cl)].filter((v) => v);
127
- }
128
- }
129
- } catch {}
222
+ } catch {}
223
+ let byId = {};
224
+ let byTitle = {};
225
+ try {
226
+ all.forEach(function (l) {
227
+ if (l && l.id) byId[l.id] = l.title || l.id;
228
+ if (l && l.title) byTitle[l.title] = l.title;
229
+ });
230
+ } catch {}
231
+ let titles2 = [];
232
+ checked.forEach(function (v) {
233
+ if (byTitle[v]) titles2.push(byTitle[v]);
234
+ else if (byId[v]) titles2.push(byId[v]);
235
+ });
236
+ if (titles2.length) return [...new Set(titles2)];
237
+ }
130
238
  let layers = [];
131
239
  this.props.view.map.layers.forEach(function (l) {
132
240
  if (l.visible) {
@@ -182,6 +290,9 @@ class ErrorReport extends React.Component {
182
290
  async componentDidMount() {
183
291
  await this.loader();
184
292
  if (!this.container.current) return;
293
+ try {
294
+ this.originalParent = this.container.current.parentNode;
295
+ } catch {}
185
296
  this.props.view.when(() => {
186
297
  if (!this.container.current) return;
187
298
  var group = document.querySelector('.esri-ui-top-right.esri-ui-corner');
@@ -207,6 +318,24 @@ class ErrorReport extends React.Component {
207
318
  });
208
319
  }
209
320
 
321
+ componentWillUnmount() {
322
+ try {
323
+ if (this.state && this.state.selecting) {
324
+ this.state.selecting.remove();
325
+ }
326
+ } catch {}
327
+ try {
328
+ if (
329
+ this.container &&
330
+ this.container.current &&
331
+ this.originalParent &&
332
+ this.container.current.parentNode !== this.originalParent
333
+ ) {
334
+ this.originalParent.appendChild(this.container.current);
335
+ }
336
+ } catch {}
337
+ }
338
+
210
339
  render() {
211
340
  return (
212
341
  <>