@devgateway/dvz-ui-react 1.9.4 → 1.9.6

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.
@@ -1,8 +1,8 @@
1
1
  var X = Object.defineProperty;
2
- var Y = (w, F, e) => F in w ? X(w, F, { enumerable: !0, configurable: !0, writable: !0, value: e }) : w[F] = e;
3
- var H = (w, F, e) => Y(w, typeof F != "symbol" ? F + "" : F, e);
2
+ var q = (w, F, e) => F in w ? X(w, F, { enumerable: !0, configurable: !0, writable: !0, value: e }) : w[F] = e;
3
+ var H = (w, F, e) => q(w, typeof F != "symbol" ? F + "" : F, e);
4
4
  import { jsx as b, jsxs as M, Fragment as R } from "react/jsx-runtime";
5
- import { injectIntl as q, FormattedMessage as K } from "react-intl";
5
+ import { injectIntl as Y, FormattedMessage as K } from "react-intl";
6
6
  import * as g from "d3";
7
7
  import { Container as U, Segment as Q, Dimmer as ee, Loader as te, Message as N, Icon as E, Popup as se, Grid as S } from "semantic-ui-react";
8
8
  import V from "react";
@@ -15,12 +15,12 @@ import { Config as re } from "../../conf/index.js";
15
15
  function O(w, F, e) {
16
16
  var l;
17
17
  if (!(w != null && w.length)) return F;
18
- const s = ((l = w[0]) == null ? void 0 : l.items) ?? [], i = (a) => (a == null ? void 0 : a.trim().toLowerCase()) ?? "", o = i(F), t = i(e).toUpperCase(), r = s.find(
19
- (a) => i(a.value) === o || a.code.trim().toLowerCase() === o
18
+ const s = ((l = w[0]) == null ? void 0 : l.items) ?? [], i = (r) => (r == null ? void 0 : r.trim().toLowerCase()) ?? "", o = i(F), t = i(e).toUpperCase(), a = s.find(
19
+ (r) => i(r.value) === o || r.code.trim().toLowerCase() === o
20
20
  ) ?? null;
21
- if (!r) return F;
22
- const n = t && r.labels && r.labels[t] ? r.labels[t] : r.value;
23
- return (n == null ? void 0 : n.trim()) || r.value.trim();
21
+ if (!a) return F;
22
+ const n = t && a.labels && a.labels[t] ? a.labels[t] : a.value;
23
+ return (n == null ? void 0 : n.trim()) || a.value.trim();
24
24
  }
25
25
  const le = "_Color_", G = "location", j = "showAll", B = "ifUnitHasData", ne = 10, pe = {
26
26
  mobile: 4,
@@ -137,7 +137,7 @@ class ue extends V.Component {
137
137
  }, this.metadataTypes = ((s = e.transformedData) == null ? void 0 : s.types) || [];
138
138
  }
139
139
  componentDidMount() {
140
- window.addEventListener("scroll", this.handleScroll, { passive: !0 }), window.addEventListener("touchmove", this.handleScroll, { passive: !0 }), this.loadLayers(), this.tooltip = g.select("body").append("div").style("position", "absolute").style("visibility", "hidden"), console.log("Map props", this.metadataTypes);
140
+ window.addEventListener("scroll", this.handleScroll, { passive: !0 }), window.addEventListener("touchmove", this.handleScroll, { passive: !0 }), this.loadLayers(), this.tooltip = g.select("body").append("div").style("position", "absolute").style("visibility", "hidden").style("pointer-events", "none"), console.log("Map props", this.metadataTypes);
141
141
  }
142
142
  componentDidCatch(e, s) {
143
143
  console.log(e);
@@ -154,9 +154,9 @@ class ue extends V.Component {
154
154
  const o = [];
155
155
  i.forEach((t) => {
156
156
  o.push(
157
- new Promise((r, n) => {
157
+ new Promise((a, n) => {
158
158
  g.json(re.REACT_APP_WP_API + "/wp/v2/media/" + t.id).then((l) => {
159
- r({
159
+ a({
160
160
  id: t.id,
161
161
  url: l.source_url,
162
162
  index: t.index,
@@ -167,7 +167,7 @@ class ue extends V.Component {
167
167
  displayLayerLabels: t.displayLayerLabels
168
168
  });
169
169
  }).catch(function(l) {
170
- r({
170
+ a({
171
171
  id: t.id,
172
172
  url: null,
173
173
  index: t.index,
@@ -181,10 +181,10 @@ class ue extends V.Component {
181
181
  })
182
182
  );
183
183
  }), Promise.all(o).then((t) => {
184
- const r = [];
184
+ const a = [];
185
185
  t.forEach((n) => {
186
- n.url && r.push(
187
- new Promise((l, a) => {
186
+ n.url && a.push(
187
+ new Promise((l, r) => {
188
188
  g.json(n.url).then((h) => {
189
189
  l({
190
190
  id: n.id,
@@ -199,7 +199,7 @@ class ue extends V.Component {
199
199
  });
200
200
  })
201
201
  );
202
- }), Promise.all(r).then((n) => {
202
+ }), Promise.all(a).then((n) => {
203
203
  this.setState({
204
204
  layers: n,
205
205
  layersLoading: !1
@@ -234,7 +234,7 @@ class ue extends V.Component {
234
234
  )[0] || e[0]), o ? o.data : null;
235
235
  }
236
236
  componentDidUpdate(e, s, i) {
237
- const { selectedMeasure: o, layers: t, selectedPolygon: r } = this.state, n = this.getMainLayer(), { transformedData: l, intl: a, zoomOnFilterField: h, appliedFilters: p } = this.props, { appliedFilters: d } = e;
237
+ const { selectedMeasure: o, layers: t, selectedPolygon: a } = this.state, n = this.getMainLayer(), { transformedData: l, intl: r, zoomOnFilterField: h, appliedFilters: p } = this.props, { appliedFilters: d } = e;
238
238
  if (h) {
239
239
  const v = [], c = [];
240
240
  d && Object.keys(d).forEach((f) => {
@@ -253,7 +253,7 @@ class ue extends V.Component {
253
253
  const u = this.getFeatures();
254
254
  e.center !== this.props.center && (this.mapPosition = null, this.projection.scale(this.props.scale).center(this.props.center).translate([this.getWidth() / 2, this.getHeight() / 2]));
255
255
  const m = this.filterUpdated(e, s);
256
- this.d3Map(u, m), t && l && (l != e.transformedData || t != s.layers || o != s.selectedMeasure || r != s.selectedPolygon || n != s.mainLayer || e.mainLayerId !== this.props.mainLayerId || JSON.stringify(e.enabledLayers) != JSON.stringify(this.props.enabledLayers)) && this.updateFeatures(this.getFeatures(), m);
256
+ this.d3Map(u, m), t && l && (l != e.transformedData || t != s.layers || o != s.selectedMeasure || a != s.selectedPolygon || n != s.mainLayer || e.mainLayerId !== this.props.mainLayerId || JSON.stringify(e.enabledLayers) != JSON.stringify(this.props.enabledLayers)) && this.updateFeatures(this.getFeatures(), m);
257
257
  }
258
258
  getHeight() {
259
259
  return this.props.height;
@@ -263,9 +263,9 @@ class ue extends V.Component {
263
263
  }
264
264
  boundingExtent(e) {
265
265
  let s, i, o, t;
266
- for (const r in e) {
267
- const [[n, l], [a, h]] = this.path.bounds(e[r]);
268
- (n < s || s == null) && (s = n), (a > i || i == null) && (i = a), (l < o || o == null) && (o = l), (h > t || t == null) && (t = h);
266
+ for (const a in e) {
267
+ const [[n, l], [r, h]] = this.path.bounds(e[a]);
268
+ (n < s || s == null) && (s = n), (r > i || i == null) && (i = r), (l < o || o == null) && (o = l), (h > t || t == null) && (t = h);
269
269
  }
270
270
  return [
271
271
  [s, o],
@@ -277,23 +277,23 @@ class ue extends V.Component {
277
277
  }
278
278
  resizeLabels(e) {
279
279
  const { labelFontSize: s, mapLabelField: i } = this.props;
280
- g.select(this.getMapId()).selectAll(".map-labels-container").each((o, t, r) => {
281
- const n = g.select(r[t]), l = n.select("div"), a = e.k > 1 ? e.k : 1, h = s / a;
280
+ g.select(this.getMapId()).selectAll(".map-labels-container").each((o, t, a) => {
281
+ const n = g.select(a[t]), l = n.select("div"), r = e.k > 1 ? e.k : 1, h = s / r;
282
282
  l.style("font-size", `${h}px`);
283
- const p = this.getLabelPosition(o), d = this.getLabelBoxWidth(o) / a, u = p[0] - d / 2, m = e.k > 1 ? 10 / e.k : 10, v = p[1] - m;
284
- n.attr("x", u).attr("y", v).attr("width", this.getLabelBoxWidth(o) / a).attr("height", this.getLabelBoxHeight(o) / a);
283
+ const p = this.getLabelPosition(o), d = this.getLabelBoxWidth(o) / r, u = p[0] - d / 2, m = e.k > 1 ? 10 / e.k : 10, v = p[1] - m;
284
+ n.attr("x", u).attr("y", v).attr("width", this.getLabelBoxWidth(o) / r).attr("height", this.getLabelBoxHeight(o) / r);
285
285
  });
286
286
  }
287
287
  resizePointLabels(e) {
288
288
  const { labelFontSize: s } = this.props;
289
289
  g.select(this.getMapId()).selectAll(".point-labels-container").each((i, o, t) => {
290
- const r = g.select(t[o]), n = r.select("div"), l = e.k > 1 ? e.k : 1, a = s / l;
291
- n.style("font-size", `${a}px`);
290
+ const a = g.select(t[o]), n = a.select("div"), l = e.k > 1 ? e.k : 1, r = s / l;
291
+ n.style("font-size", `${r}px`);
292
292
  const h = this.projection([
293
293
  i.geometry.coordinates[1],
294
294
  i.geometry.coordinates[0]
295
295
  ]), p = (this.getLabelBoxWidth(i) + 20) / l, d = this.getLabelBoxHeight(i) / l, u = h[0] - p / 2, m = h[1] - d / 2;
296
- r.attr("x", u).attr("y", m).attr("width", p).attr("height", d);
296
+ a.attr("x", u).attr("y", m).attr("width", p).attr("height", d);
297
297
  });
298
298
  }
299
299
  resizeCircles(e) {
@@ -320,19 +320,19 @@ class ue extends V.Component {
320
320
  generateBreaks(e) {
321
321
  const { autoGenerateBreaks: s, numberOfBreaks: i, colorScheme: o } = this.props, t = [];
322
322
  if (s && e && e.length > 0) {
323
- const r = e.filter((a) => a.properties && a.properties.value != null).map((a) => a.properties.value.toFixed(2)), n = [];
324
- r.forEach((a) => {
325
- if (a > 0) {
326
- const h = a * 0.99, p = a * 1.01;
323
+ const a = e.filter((r) => r.properties && r.properties.value != null).map((r) => r.properties.value.toFixed(2)), n = [];
324
+ a.forEach((r) => {
325
+ if (r > 0) {
326
+ const h = r * 0.99, p = r * 1.01;
327
327
  n.indexOf(h) === -1 && n.push(h), n.indexOf(p) === -1 && n.push(p);
328
328
  }
329
329
  });
330
330
  const l = he[o];
331
331
  if (n.length > 0) {
332
- const a = new ae(n);
333
- a.setPrecision(2);
332
+ const r = new ae(n);
333
+ r.setPrecision(2);
334
334
  const h = n.length > 1 ? n.length - 1 : n.length;
335
- return a.getJenks(Math.min(i, h)), a.ranges.forEach((p, d) => {
335
+ return r.getJenks(Math.min(i, h)), r.ranges.forEach((p, d) => {
336
336
  const u = {};
337
337
  u.min = parseFloat(p.substr(0, p.indexOf("-") - 1)) + (d > 0 ? 0.01 : 0), u.max = parseFloat(
338
338
  p.substr(p.indexOf("-") + 2, p.length)
@@ -351,11 +351,11 @@ class ue extends V.Component {
351
351
  let i = e;
352
352
  return this.getSelectedMeasure() && (i = e.filter((o) => o.measure === this.getSelectedMeasure()).filter((o) => {
353
353
  if (o.filters && o.filters.length > 0 && this.props.appliedFilters && JSON.stringify(this.props.appliedFilters) !== "{}") {
354
- const r = Object.keys(this.props.appliedFilters);
354
+ const a = Object.keys(this.props.appliedFilters);
355
355
  return o.filters.filter((l) => {
356
- if (r.indexOf(l.field) != -1) {
357
- const a = this.props.appliedFilters[l.field], h = l.values;
358
- return a.join(",").indexOf(h) != -1;
356
+ if (a.indexOf(l.field) != -1) {
357
+ const r = this.props.appliedFilters[l.field], h = l.values;
358
+ return r.join(",").indexOf(h) != -1;
359
359
  }
360
360
  return !1;
361
361
  }).length > 0;
@@ -383,10 +383,10 @@ class ue extends V.Component {
383
383
  });
384
384
  return n && n.color ? n.color : i;
385
385
  }
386
- const r = this.props.enabledLayers.filter(
386
+ const a = this.props.enabledLayers.filter(
387
387
  (n) => n.id === e.properties.layerId
388
388
  )[0];
389
- return r && r.bgColor && r.bgColor != "undefined" ? r.bgColor : i;
389
+ return a && a.bgColor && a.bgColor != "undefined" ? a.bgColor : i;
390
390
  }
391
391
  setValues() {
392
392
  const e = this.getFeatures();
@@ -399,11 +399,11 @@ class ue extends V.Component {
399
399
  ]) : this.path.centroid(e);
400
400
  }
401
401
  updateFeatures(e, s) {
402
- const { mapLabelField: i, symbols: o, highlightedLocation: t } = this.props, r = [
402
+ const { mapLabelField: i, symbols: o, highlightedLocation: t } = this.props, a = [
403
403
  ...e.filter((n) => t != n.properties[i]),
404
404
  ...e.filter((n) => t == n.properties[i])
405
405
  ];
406
- this.drawPolygons(r), this.drawLabels(r), this.drawPoints(r, s), o.length > 0 && this.addSymbols(o, r);
406
+ this.drawPolygons(a), this.drawLabels(a), this.drawPoints(a, s), o.length > 0 && this.addSymbols(o, a);
407
407
  }
408
408
  drawLabels(e) {
409
409
  const {
@@ -411,10 +411,10 @@ class ue extends V.Component {
411
411
  mapLabelShowValue: i,
412
412
  intl: o,
413
413
  valueFormat: t,
414
- showNoDataLabel: r,
414
+ showNoDataLabel: a,
415
415
  labelFontColor: n,
416
416
  labelFontWeight: l,
417
- labelFontSize: a,
417
+ labelFontSize: r,
418
418
  showAdminUnitLabel: h,
419
419
  mapType: p,
420
420
  noDataText: d,
@@ -433,7 +433,7 @@ class ue extends V.Component {
433
433
  return f[0] - y / 2;
434
434
  }
435
435
  return f[0];
436
- }).attr("y", (c) => this.getLabelPosition(c)[1] - 10).attr("width", (c) => this.getLabelBoxWidth(c)).attr("height", (c) => this.getLabelBoxHeight(c)).attr("font-size", (c, f) => `${a}px`).attr("overflow", "visible").attr("opacity", 1).style("display", (c) => h === j || h === B && c.properties.hasDataRow || c.properties.displayLayerLabels ? "block" : "none").attr("pointer-events", p == "POINTS_MAP" ? "none" : "all").on("mouseover", this.showTooltip).on("mousemove", this.mousemove).on("mouseout", this.mouseout).append("xhtml:div").style("font-size", (c) => `${a}px`).style("color", (c, f) => n).style("font-weight", (c) => l).style("background-color", (c) => c.properties.hasDataRow && i && (c.properties.value != null || c.properties.value == null && r) ? "#fff6e1" : "none").style("border-radius", (c) => "4px").style("line-height", "95%").style("text-align", "center").html((c, f) => this.createLabel(c));
436
+ }).attr("y", (c) => this.getLabelPosition(c)[1] - 10).attr("width", (c) => this.getLabelBoxWidth(c)).attr("height", (c) => this.getLabelBoxHeight(c)).attr("font-size", (c, f) => `${r}px`).attr("overflow", "visible").attr("opacity", 1).style("display", (c) => h === j || h === B && c.properties.hasDataRow || c.properties.displayLayerLabels ? "block" : "none").attr("pointer-events", p == "POINTS_MAP" ? "none" : "all").on("mouseover", this.showTooltip).on("mousemove", this.mousemove).on("mouseout", this.mouseout).append("xhtml:div").style("font-size", (c) => `${r}px`).style("color", (c, f) => n).style("font-weight", (c) => l).style("background-color", (c) => c.properties.hasDataRow && i && (c.properties.value != null || c.properties.value == null && a) ? "#fff6e1" : "none").style("border-radius", (c) => "4px").style("line-height", "95%").style("text-align", "center").html((c, f) => this.createLabel(c));
437
437
  }
438
438
  getTranslatedLocationName(e, s, i) {
439
439
  if (e.properties.displayLayerLabels && e.properties.layerLocale) {
@@ -448,19 +448,19 @@ class ue extends V.Component {
448
448
  mapLabelShowValue: i,
449
449
  intl: o,
450
450
  valueFormat: t,
451
- showNoDataLabel: r,
451
+ showNoDataLabel: a,
452
452
  showAdminUnitLabel: n,
453
453
  noDataText: l
454
454
  } = this.props;
455
- let a = "";
455
+ let r = "";
456
456
  if (n == j || n == B && e.properties.hasDataRow || e.properties.displayLayerLabels) {
457
457
  const h = e.properties.displayLayerLabels && e.properties.layerMappingField ? e.properties.layerMappingField : s, p = e.properties[h], d = e.properties.layerLocale || (o == null ? void 0 : o.locale);
458
- a = O(this.metadataTypes, p, d);
458
+ r = O(this.metadataTypes, p, d);
459
459
  const u = e.properties.abbrev;
460
- if (a && a.length > ne && u && (a = u), i)
460
+ if (r && r.length > ne && u && (r = u), i)
461
461
  if (e.properties.value != null) {
462
462
  const m = e.properties.variables || {};
463
- a += "<br><span class='map-label-value'>" + k(
463
+ r += "<br><span class='map-label-value'>" + k(
464
464
  t,
465
465
  {
466
466
  value: e.properties.value,
@@ -470,9 +470,9 @@ class ue extends V.Component {
470
470
  o
471
471
  ) + "</span>";
472
472
  } else
473
- r == !0 && e.properties.value == null && e.properties.hasDataRow && (a += "<br><span class='map-label-value'>" + l + "</span>");
473
+ a == !0 && e.properties.value == null && e.properties.hasDataRow && (r += "<br><span class='map-label-value'>" + l + "</span>");
474
474
  }
475
- return a;
475
+ return r;
476
476
  }
477
477
  drawPolygons(e) {
478
478
  const {
@@ -480,27 +480,27 @@ class ue extends V.Component {
480
480
  mapBoundaryColor: i,
481
481
  mapFocusBoundaryColor: o,
482
482
  highlightedLocation: t
483
- } = this.props, r = this.getBreaks(), n = g.select(this.getMapId()).select("svg").select("g"), l = e.filter(
484
- (a) => a.geometry && a.geometry && (a.geometry.type == "Polygon" || a.geometry.type == "MultiPolygon")
483
+ } = this.props, a = this.getBreaks(), n = g.select(this.getMapId()).select("svg").select("g"), l = e.filter(
484
+ (r) => r.geometry && r.geometry && (r.geometry.type == "Polygon" || r.geometry.type == "MultiPolygon")
485
485
  );
486
- l.length > 0 && n.selectAll("path").data(l).join("path").attr("d", this.path).attr("fill", (a) => this.fillColor(a, r)).attr("stroke-width", (a) => t == a.properties[s] ? 1.2 : 0.4).attr("stroke", (a) => t == a.properties[s] ? o : i).on("click", this.onPolygonClick);
486
+ l.length > 0 && n.selectAll("path").data(l).join("path").attr("d", this.path).attr("fill", (r) => this.fillColor(r, a)).attr("stroke-width", (r) => t == r.properties[s] ? 1.2 : 0.4).attr("stroke", (r) => t == r.properties[s] ? o : i).on("click", this.onPolygonClick);
487
487
  }
488
488
  drawPoints(e, s) {
489
489
  const {
490
490
  intl: i,
491
491
  pointLabelColor: o,
492
492
  pointLabelFormat: t,
493
- transformedData: r,
493
+ transformedData: a,
494
494
  defaultPointColor: n,
495
495
  appliedFilters: l,
496
- zoomOnFilterField: a,
496
+ zoomOnFilterField: r,
497
497
  noDataText: h,
498
498
  showShadingLayerLabels: p
499
499
  } = this.props, d = g.select(this.getMapId()).select("svg").select("g");
500
500
  let u = [];
501
- if (r.pointsData) {
501
+ if (a.pointsData) {
502
502
  let c = this.state.selectedPolygon;
503
- s && l && l[a] && (c = l[a]), u = r.pointsData.filter((f) => f.lat && f.lng && f.label == c).map((f) => ({
503
+ s && l && l[r] && (c = l[r]), u = a.pointsData.filter((f) => f.lat && f.lng && f.label == c).map((f) => ({
504
504
  properties: {
505
505
  label: f.label,
506
506
  lat: f.lat,
@@ -546,18 +546,18 @@ class ue extends V.Component {
546
546
  const { mappingField: i } = this.props, o = g.select(this.getMapId()).select("svg").select("g");
547
547
  e.forEach((t) => {
548
548
  if (t.field && t.image && t.values) {
549
- const r = s.filter((l) => {
550
- const a = G == t.field ? i : "value", h = (l.properties[a] || (l.properties.variables ? l.properties.variables[a] : "")) + "", d = (t.values + "").split(",");
549
+ const a = s.filter((l) => {
550
+ const r = G == t.field ? i : "value", h = (l.properties[r] || (l.properties.variables ? l.properties.variables[r] : "")) + "", d = (t.values + "").split(",");
551
551
  return l.properties.LATITUDE && l.properties.LONGITUDE && d.filter(
552
552
  (u) => u.trim().toLowerCase() == h.trim().toLowerCase()
553
553
  ).length > 0;
554
554
  }), n = s.filter((l) => {
555
- const a = G == t.field ? i : "value", h = (l.properties[a] || (l.properties.variables ? l.properties.variables[a] : "")) + "", d = (t.values + "").split(",");
555
+ const r = G == t.field ? i : "value", h = (l.properties[r] || (l.properties.variables ? l.properties.variables[r] : "")) + "", d = (t.values + "").split(",");
556
556
  return !l.properties.LATITUDE && !l.properties.LONGITUDE && d.filter(
557
557
  (u) => u.trim().toLowerCase() == h.trim().toLowerCase()
558
558
  ).length > 0;
559
559
  });
560
- o.selectAll("image").data(r).enter().append("image").attr("width", 40).attr("height", 40).attr("class", "map-symbol").attr("xlink:href", "/" + t.image).attr("transform", (l) => "translate(" + this.projection([l.properties.LONGITUDE, l.properties.LATITUDE]) + ")").on("mouseover", this.showTooltip).on("mousemove", this.mousemove).on("mouseout", this.mouseout), o.selectAll("image").data(n).enter().append("image").attr("width", 40).attr("height", 40).attr("class", "map-symbol").attr("xlink:href", "/" + t.image).attr("x", (l) => this.path.centroid(l)[0] - 20).attr("y", (l) => this.path.centroid(l)[1]).on("mouseover", this.showTooltip).on("mousemove", this.mousemove).on("mouseout", this.mouseout);
560
+ o.selectAll("image").data(a).enter().append("image").attr("width", 40).attr("height", 40).attr("class", "map-symbol").attr("xlink:href", "/" + t.image).attr("transform", (l) => "translate(" + this.projection([l.properties.LONGITUDE, l.properties.LATITUDE]) + ")").on("mouseover", this.showTooltip).on("mousemove", this.mousemove).on("mouseout", this.mouseout), o.selectAll("image").data(n).enter().append("image").attr("width", 40).attr("height", 40).attr("class", "map-symbol").attr("xlink:href", "/" + t.image).attr("x", (l) => this.path.centroid(l)[0] - 20).attr("y", (l) => this.path.centroid(l)[1]).on("mouseover", this.showTooltip).on("mousemove", this.mousemove).on("mouseout", this.mouseout);
561
561
  }
562
562
  });
563
563
  }
@@ -574,10 +574,10 @@ class ue extends V.Component {
574
574
  return 0;
575
575
  }
576
576
  featuresZoom(e, s, i) {
577
- const o = g.select(this.getMapId()).select("svg"), t = this.boundingExtent(e), [[r, n], [l, a]] = t, h = this.getWidth(), p = this.getHeight(), d = Math.min(
577
+ const o = g.select(this.getMapId()).select("svg"), t = this.boundingExtent(e), [[a, n], [l, r]] = t, h = this.getWidth(), p = this.getHeight(), d = Math.min(
578
578
  8,
579
- 0.9 / Math.max((l - r) / h, (a - n) / p)
580
- ), u = [h / 2 - (r + l) / 2, p / 2 - (n + a) / 2];
579
+ 0.9 / Math.max((l - a) / h, (r - n) / p)
580
+ ), u = [h / 2 - (a + l) / 2, p / 2 - (n + r) / 2];
581
581
  s ? o.call(
582
582
  this.zoom.transform,
583
583
  g.zoomIdentity.translate(u[0], u[1]).scale(d)
@@ -599,10 +599,10 @@ class ue extends V.Component {
599
599
  showTooltip: i,
600
600
  zoomEnabled: o,
601
601
  tooltipTheme: t,
602
- customTooltips: r,
602
+ customTooltips: a,
603
603
  tooltipFontSize: n,
604
604
  tooltipFormat: l,
605
- intl: a,
605
+ intl: r,
606
606
  mappingField: h,
607
607
  showNoDataTooltip: p,
608
608
  fields: d,
@@ -619,8 +619,8 @@ class ue extends V.Component {
619
619
  value: s.properties.value,
620
620
  measure: this.getSelectedMeasure(),
621
621
  measureLabel: s.properties.measureLabel,
622
- locationName: this.getTranslatedLocationName(s, h, a),
623
- label: this.getTranslatedLocationName(s, h, a),
622
+ locationName: this.getTranslatedLocationName(s, h, r),
623
+ label: this.getTranslatedLocationName(s, h, r),
624
624
  ...y
625
625
  };
626
626
  this.tooltip.attr("class", t).style("position", "absolute").style("visibility", "hidden").style("visibility", "visible").html((A) => {
@@ -629,7 +629,7 @@ class ue extends V.Component {
629
629
  const x = f.split(`
630
630
  `), D = x[0], W = x.length > 1 ? x[1] : null;
631
631
  let z = 1, P;
632
- d.length > 1 && u != "POINTS_MAP" ? (z = x.length > 2 ? 2 : 1, P = x[z]) : P = null, D && (L += k(D, I, a)), W && (L.endsWith("<hr>") || (L += "<hr>"), L += k(W, I, a)), P && s.properties.children && s.properties.children.forEach((C, _) => {
632
+ d.length > 1 && u != "POINTS_MAP" ? (z = x.length > 2 ? 2 : 1, P = x[z]) : P = null, D && (L += k(D, I, r)), W && (L.endsWith("<hr>") || (L += "<hr>"), L += k(W, I, r)), P && s.properties.children && s.properties.children.forEach((C, _) => {
633
633
  const J = {
634
634
  value: C.value,
635
635
  label: C.label,
@@ -640,11 +640,11 @@ class ue extends V.Component {
640
640
  L.endsWith("<hr>") || (L += "<hr>"), L += k(
641
641
  P,
642
642
  J,
643
- a
643
+ r
644
644
  );
645
645
  }), x.length > z + 1 && (L.endsWith("<hr>") || (L += "<hr>"), x.forEach((C, _) => {
646
- _ > z && (L.endsWith("<hr>") || (L += "<hr>"), L += k(C, I, a));
647
- })), r.filter(
646
+ _ > z && (L.endsWith("<hr>") || (L += "<hr>"), L += k(C, I, r));
647
+ })), a.filter(
648
648
  (C) => C.location === s.properties[h]
649
649
  ).forEach((C) => {
650
650
  L.endsWith("<hr>") || (L += "<hr>"), L += C.tooltip;
@@ -655,27 +655,32 @@ class ue extends V.Component {
655
655
  value: null,
656
656
  measure: this.getSelectedMeasure(),
657
657
  measureLabel: s.properties.measureLabel,
658
- locationName: this.getTranslatedLocationName(s, h, a),
658
+ locationName: this.getTranslatedLocationName(s, h, r),
659
659
  ...y
660
660
  };
661
- L += k(x, D, a), L += "</div>";
661
+ L += k(x, D, r), L += "</div>";
662
662
  }
663
663
  return L;
664
664
  });
665
665
  }
666
666
  }
667
+ positionTooltip(e) {
668
+ const i = this.tooltip.node(), o = i ? i.offsetWidth : 0, t = window.scrollX + document.documentElement.clientWidth;
669
+ let a = e.pageX;
670
+ o && a + o > t && (a = e.pageX - o, a < window.scrollX && (a = window.scrollX)), this.tooltip.style("top", e.pageY + "px").style("left", a + "px").style("margin-left", "8px");
671
+ }
667
672
  mousemove(e, s) {
668
- this.tooltip.style("top", e.pageY + "px").style("left", e.pageX + 5 + "px");
673
+ this.positionTooltip(e);
669
674
  }
670
675
  mouseout(e, s) {
671
676
  const { showTooltip: i } = this.props;
672
677
  i && (g.select(this.getMapId()).select("svg").select("g").selectAll(".focus").attr("class", "active"), this.tooltip.style("visibility", "hidden"));
673
678
  }
674
679
  onClick(e, s) {
675
- s.properties && this.tooltip.style("visibility", "visible").style("top", e.pageY + "px").style("left", e.pageX + 5 + "px"), e.stopPropagation(), e.preventDefault();
680
+ s.properties && (this.tooltip.style("visibility", "visible"), this.positionTooltip(e)), e.stopPropagation(), e.preventDefault();
676
681
  }
677
682
  onPointClick(e, s, i) {
678
- this.showTooltip(e, s), this.tooltip.style("visibility", "visible").style("top", e.pageY + "px").style("left", e.pageX + 5 + "px");
683
+ this.showTooltip(e, s), this.tooltip.style("visibility", "visible"), this.positionTooltip(e);
679
684
  const o = g.select(this.getMapId()).select("svg").select("g");
680
685
  o.selectAll("circle").style("fill", this.props.defaultPointColor).style("stroke", "none"), o.select("#circle" + i).raise().style("fill", "#fff");
681
686
  }
@@ -712,26 +717,26 @@ class ue extends V.Component {
712
717
  getLayers() {
713
718
  const { layers: e } = this.state, { enabledLayers: s } = this.props;
714
719
  return e && e.length > 0 ? e.map((o) => {
715
- const t = s.find((r) => r.id == o.id);
720
+ const t = s.find((a) => a.id == o.id);
716
721
  return o.index = t ? t.index : 0, o;
717
722
  }).sort((o, t) => parseInt(o.index) < parseInt(t.index) ? 1 : parseInt(o.index) > parseInt(t.index) ? -1 : 0) : [];
718
723
  }
719
724
  getFeatures() {
720
725
  const e = this.getMainLayer(), s = this.getLayers();
721
726
  if (e) {
722
- const { transformedData: i, mappingField: o, app: t, mainLayerId: r, enabledLayers: n } = this.props;
727
+ const { transformedData: i, mappingField: o, app: t, mainLayerId: a, enabledLayers: n } = this.props;
723
728
  let l = [];
724
729
  try {
725
730
  l = this.extractFeatures(e), l.map((p) => {
726
- p.properties.layerId = r;
727
- const d = s.find((u) => String(u.id) === String(r));
731
+ p.properties.layerId = a;
732
+ const d = s.find((u) => String(u.id) === String(a));
728
733
  return d && (p.properties.layerMappingField = d.layerMappingField, p.properties.layerDatasource = d.layerDatasource, p.properties.layerApiField = d.layerApiField, p.properties.layerLocale = d.layerLocale, p.properties.displayLayerLabels = d.displayLayerLabels), n.forEach((u) => {
729
- String(u.id) == r && Object.keys(u || {}).forEach((m) => {
734
+ String(u.id) == a && Object.keys(u || {}).forEach((m) => {
730
735
  p.properties[m] = u[m];
731
736
  });
732
737
  }), p;
733
738
  }), s && s.forEach((p) => {
734
- if (p.id != r) {
739
+ if (p.id != a) {
735
740
  let d = this.extractFeatures(p.data);
736
741
  d = d.map((u) => (u.properties.layerId = p.id, u.properties.layerMappingField = p.layerMappingField, u.properties.layerDatasource = p.layerDatasource, u.properties.layerApiField = p.layerApiField, u.properties.layerLocale = p.layerLocale, u.properties.displayLayerLabels = p.displayLayerLabels, u)), l = [...d, ...l];
737
742
  }
@@ -739,11 +744,11 @@ class ue extends V.Component {
739
744
  } catch (p) {
740
745
  console.log("error updating features .." + p);
741
746
  }
742
- const a = l.filter((p) => p.properties != null);
747
+ const r = l.filter((p) => p.properties != null);
743
748
  let h = i.locationsData;
744
749
  return i.measures && i.measures.length > 1 && (h = i.locationsData.filter(
745
750
  (p) => p.measure === this.getSelectedMeasure()
746
- )), a.map((p) => {
751
+ )), r.map((p) => {
747
752
  if (h) {
748
753
  const d = h.find((u) => {
749
754
  const m = u.label ? ("" + u.label).toLowerCase() : "", v = p.properties[o] ? p.properties[o].toLowerCase() : "";
@@ -757,7 +762,7 @@ class ue extends V.Component {
757
762
  } else
758
763
  p.properties.value = null, p.properties.measure = null, p.properties.children = null, p.properties.measureLabel = null, p.properties.hasDataRow = !1;
759
764
  }
760
- }), a;
765
+ }), r;
761
766
  }
762
767
  return [];
763
768
  }
@@ -767,19 +772,19 @@ class ue extends V.Component {
767
772
  }
768
773
  filterUpdated(e, s) {
769
774
  const { zoomOnFilterField: i } = this.props, o = e && e.appliedFilters || {}, t = this.props.appliedFilters || {};
770
- let r = !1;
771
- return o[i] != t[i] && (r = !0), r;
775
+ let a = !1;
776
+ return o[i] != t[i] && (a = !0), a;
772
777
  }
773
778
  getCenter(e, s) {
774
- const { zoomOnFilter: i, zoomOnFilterField: o, mappingField: t, appliedFilters: r } = this.props;
779
+ const { zoomOnFilter: i, zoomOnFilterField: o, mappingField: t, appliedFilters: a } = this.props;
775
780
  let n = null;
776
781
  if (i && o) {
777
782
  let l = this.state.selectedPolygon;
778
- s && r && r[o] && (l = r[o]);
779
- const a = e.filter(
783
+ s && a && a[o] && (l = a[o]);
784
+ const r = e.filter(
780
785
  (h) => h.properties != null && h.properties[t] == l
781
786
  )[0];
782
- a && a.properties != null && a.properties.value && (n = a);
787
+ r && r.properties != null && r.properties.value && (n = r);
783
788
  }
784
789
  return n;
785
790
  }
@@ -798,13 +803,13 @@ class ue extends V.Component {
798
803
  return s[0] /= o * 6, s[1] /= o * 6, s;
799
804
  }
800
805
  d3Map(e, s) {
801
- let { zoomEnabled: i, mapContainerBgColor: o, mapPosition: t, editing: r, mapType: n } = this.props;
806
+ let { zoomEnabled: i, mapContainerBgColor: o, mapPosition: t, editing: a, mapType: n } = this.props;
802
807
  i || (i = !!["mobile", "tablet"].includes(T()));
803
- const l = this.getBreaks(), a = g.select(this.getMapId());
804
- let h = a.select("svg"), p = this.getWidth();
808
+ const l = this.getBreaks(), r = g.select(this.getMapId());
809
+ let h = r.select("svg"), p = this.getWidth();
805
810
  p === 0 ? p = window.innerWidth + Z[T()] : p += Z[T()];
806
811
  const d = this.getHeight() - 100;
807
- if (h.empty() ? h = a.append("svg") : h.selectAll("*").remove(), h.attr("style", `background-color:${o};`).attr("viewBox", `0 0 ${p} ${d}`).attr("preserveAspectRatio", "xMidYMid meet"), h.append("g").selectAll("path").data(e).enter().append("path").attr("fill", (m) => this.fillColor(m, l)).attr("d", g.geoPath().projection(this.projection)).attr("class", (m) => this.classColor(m)).on("mouseover", n !== "POINTS_MAP" ? this.showTooltip : null).on("mousemove", n !== "POINTS_MAP" ? this.mousemove : null).on("mouseout", n !== "POINTS_MAP" ? this.mouseout : null), this.mapPosition && h.transition().duration(300).call(
812
+ if (h.empty() ? h = r.append("svg") : h.selectAll("*").remove(), h.attr("style", `background-color:${o};`).attr("viewBox", `0 0 ${p} ${d}`).attr("preserveAspectRatio", "xMidYMid meet"), h.append("g").selectAll("path").data(e).enter().append("path").attr("fill", (m) => this.fillColor(m, l)).attr("d", g.geoPath().projection(this.projection)).attr("class", (m) => this.classColor(m)).on("mouseover", n !== "POINTS_MAP" ? this.showTooltip : null).on("mousemove", n !== "POINTS_MAP" ? this.mousemove : null).on("mouseout", n !== "POINTS_MAP" ? this.mouseout : null), this.mapPosition && h.transition().duration(300).call(
808
813
  this.zoom.transform,
809
814
  g.zoomIdentity.translate(this.mapPosition.x, this.mapPosition.y).scale(this.mapPosition.k)
810
815
  ), !this.mapPosition && t && t.x && t.y && t.k && (h.transition().duration(300).call(
@@ -824,7 +829,7 @@ class ue extends V.Component {
824
829
  g.zoomIdentity.translate(t.x + v, t.y).scale(t.k)
825
830
  );
826
831
  }
827
- i || r ? h.call(this.zoom) : h.on("dblclick.zoom", null);
832
+ i || a ? h.call(this.zoom) : h.on("dblclick.zoom", null);
828
833
  const u = this.getCenter(e, s);
829
834
  if (u) {
830
835
  const m = this.path.bounds(u), v = [
@@ -865,10 +870,10 @@ class ue extends V.Component {
865
870
  if (!e)
866
871
  return null;
867
872
  const t = this.getFeatures().find(
868
- (r) => r.properties[s] === e
873
+ (a) => a.properties[s] === e
869
874
  );
870
875
  if (t && t.properties.displayLayerLabels && t.properties.layerLocale) {
871
- const r = t.properties.layerMappingField || s, n = t.properties[r];
876
+ const a = t.properties.layerMappingField || s, n = t.properties[a];
872
877
  return O(this.metadataTypes, n, t.properties.layerLocale);
873
878
  }
874
879
  return e;
@@ -876,13 +881,13 @@ class ue extends V.Component {
876
881
  getHighlightedLocationColor(e) {
877
882
  const s = this.getBreaks(), { mapNoDataColor: i } = this.props, o = e ? e.value : null;
878
883
  if (o != null) {
879
- const t = s.find((r) => {
880
- if (r.min != null && r.max != null)
881
- return o >= r.min && o <= r.max;
882
- if (r.min != null)
883
- return o >= r.min;
884
- if (r.max != null)
885
- return o <= r.max;
884
+ const t = s.find((a) => {
885
+ if (a.min != null && a.max != null)
886
+ return o >= a.min && o <= a.max;
887
+ if (a.min != null)
888
+ return o >= a.min;
889
+ if (a.max != null)
890
+ return o <= a.max;
886
891
  });
887
892
  return t && t.color ? t.color : i;
888
893
  }
@@ -918,10 +923,10 @@ class ue extends V.Component {
918
923
  nationalAverageLabel: i,
919
924
  intl: o,
920
925
  zoomEnabled: t,
921
- transformedData: r,
926
+ transformedData: a,
922
927
  measureSelectorLabel: n,
923
928
  valueFormat: l,
924
- showOverallValue: a,
929
+ showOverallValue: r,
925
930
  unique: h,
926
931
  highlightedLocation: p,
927
932
  labelFontColor: d,
@@ -941,7 +946,7 @@ class ue extends V.Component {
941
946
  m && (A.marginTop = "25px");
942
947
  const L = () => /* @__PURE__ */ M(U, { fluid: !0, className: "footnote ", children: [
943
948
  /* @__PURE__ */ M(S, { columns: 2, children: [
944
- e !== "csv" && a && /* @__PURE__ */ b(S.Column, { textAlign: "left", width: 4, children: /* @__PURE__ */ M("div", { className: "national-average-div", children: [
949
+ e !== "csv" && r && /* @__PURE__ */ b(S.Column, { textAlign: "left", width: 4, children: /* @__PURE__ */ M("div", { className: "national-average-div", children: [
945
950
  /* @__PURE__ */ b("span", { className: "national-avg-label", children: i }),
946
951
  /* @__PURE__ */ b("span", { className: "national-avg-value", children: k(
947
952
  l,
@@ -953,7 +958,7 @@ class ue extends V.Component {
953
958
  S.Column,
954
959
  {
955
960
  textAlign: "right",
956
- width: e !== "csv" && a ? 12 : 16,
961
+ width: e !== "csv" && r ? 12 : 16,
957
962
  children: /* @__PURE__ */ b(
958
963
  oe,
959
964
  {
@@ -972,7 +977,7 @@ class ue extends V.Component {
972
977
  ] }),
973
978
  /* @__PURE__ */ b("div", { className: "measure-selector", children: /* @__PURE__ */ M("ul", { children: [
974
979
  n && /* @__PURE__ */ b("li", { children: /* @__PURE__ */ b("span", { className: "label", children: n }) }),
975
- r && r.measures && r.measures.length > 1 && r.measures.map((x) => /* @__PURE__ */ M("li", { onClick: this.selectedMeasureChanged.bind(this, x), children: [
980
+ a && a.measures && a.measures.length > 1 && a.measures.map((x) => /* @__PURE__ */ M("li", { onClick: this.selectedMeasureChanged.bind(this, x), children: [
976
981
  /* @__PURE__ */ b(
977
982
  "input",
978
983
  {
@@ -981,7 +986,7 @@ class ue extends V.Component {
981
986
  value: x
982
987
  }
983
988
  ),
984
- /* @__PURE__ */ b("label", { children: r.measureLabelMap[x] || x })
989
+ /* @__PURE__ */ b("label", { children: a.measureLabelMap[x] || x })
985
990
  ] }))
986
991
  ] }) })
987
992
  ] });
@@ -1041,7 +1046,7 @@ class ue extends V.Component {
1041
1046
  ] });
1042
1047
  }
1043
1048
  }
1044
- const Te = q(ue);
1049
+ const Te = Y(ue);
1045
1050
  export {
1046
1051
  Te as default,
1047
1052
  O as getTranslatedItemLabel