@devgateway/dvz-ui-react 1.9.11 → 1.9.12
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/dist/cjs/embeddable/map/index.js +2 -2
- package/dist/cjs/embeddable/map/map.js +4 -4
- package/dist/cjs/embeddable/map/mapHelpers.js +1 -1
- package/dist/cjs/styles.css +1 -1
- package/dist/esm/embeddable/map/index.js +65 -65
- package/dist/esm/embeddable/map/map.js +436 -453
- package/dist/esm/embeddable/map/mapHelpers.js +88 -104
- package/dist/esm/styles.css +1 -1
- package/dist/types/embeddable/map/mapHelpers.d.ts +0 -2
- package/package.json +1 -1
|
@@ -1,163 +1,161 @@
|
|
|
1
|
-
import { jsxs as b, Fragment as
|
|
2
|
-
import { injectIntl as
|
|
3
|
-
import * as
|
|
4
|
-
import { Icon as te, Popup as or, Message as
|
|
5
|
-
import { useState as re, useRef as
|
|
6
|
-
import
|
|
7
|
-
import { formatContent as
|
|
8
|
-
import
|
|
9
|
-
import {
|
|
10
|
-
import { Config as
|
|
11
|
-
const
|
|
12
|
-
|
|
13
|
-
),
|
|
14
|
-
function
|
|
1
|
+
import { jsxs as b, Fragment as qe, jsx as p } from "react/jsx-runtime";
|
|
2
|
+
import { injectIntl as rr, FormattedMessage as lr } from "react-intl";
|
|
3
|
+
import * as u from "d3";
|
|
4
|
+
import { Icon as te, Popup as or, Message as Le, Container as Ke, Segment as nr, Dimmer as ar, Loader as sr, Grid as xe } from "semantic-ui-react";
|
|
5
|
+
import { useState as re, useRef as M, useEffect as Qe } from "react";
|
|
6
|
+
import ir from "./legend.js";
|
|
7
|
+
import { formatContent as T } from "../common/MapTooltip.js";
|
|
8
|
+
import O from "../../utils/deviceType.js";
|
|
9
|
+
import { getFilters as Fe, deviceMapHeight as cr, getHighlightedLocationColor as ur, getTranslatedItemLabel as pr, SHOW_ALL as et, SHOW_IF_HAS_DATA as tt, LOCATION as rt, generateBreaks as dr, fillColor as mr, classColor as fr, getTranslatedLocationName as we, getLabelBoxWidth as gr, getLabelBoxHeight as hr, createLabel as yr, extractFeatures as br } from "./mapHelpers.js";
|
|
10
|
+
import { Config as vr } from "../../conf/index.js";
|
|
11
|
+
const Lr = ["mobile", "tablet", "midTablet"].includes(
|
|
12
|
+
O()
|
|
13
|
+
), lt = ["mobile", "tablet"].includes(O());
|
|
14
|
+
function xr(_) {
|
|
15
15
|
const {
|
|
16
|
-
unique:
|
|
16
|
+
unique: Ae,
|
|
17
17
|
editing: j,
|
|
18
|
-
source:
|
|
18
|
+
source: Me,
|
|
19
19
|
center: le,
|
|
20
|
-
scale:
|
|
21
|
-
height:
|
|
20
|
+
scale: Te,
|
|
21
|
+
height: ke,
|
|
22
22
|
width: ot,
|
|
23
|
-
topoJSONField:
|
|
24
|
-
mappingField:
|
|
25
|
-
transformedData:
|
|
23
|
+
topoJSONField: nt,
|
|
24
|
+
mappingField: h,
|
|
25
|
+
transformedData: c,
|
|
26
26
|
legendBreaks: Ee,
|
|
27
|
-
mapLabelField:
|
|
28
|
-
mapLabelShowValue:
|
|
29
|
-
showOverallValue:
|
|
30
|
-
measureSelectorLabel:
|
|
31
|
-
valueFormat:
|
|
32
|
-
autoGenerateBreaks:
|
|
33
|
-
showNoDataLabel:
|
|
34
|
-
numberOfBreaks:
|
|
35
|
-
colorScheme:
|
|
27
|
+
mapLabelField: v,
|
|
28
|
+
mapLabelShowValue: oe,
|
|
29
|
+
showOverallValue: Ne,
|
|
30
|
+
measureSelectorLabel: ze,
|
|
31
|
+
valueFormat: De,
|
|
32
|
+
autoGenerateBreaks: Ie,
|
|
33
|
+
showNoDataLabel: Ce,
|
|
34
|
+
numberOfBreaks: at,
|
|
35
|
+
colorScheme: st,
|
|
36
36
|
symbols: Se,
|
|
37
|
-
tooltipTheme:
|
|
38
|
-
labelFontSize:
|
|
37
|
+
tooltipTheme: it,
|
|
38
|
+
labelFontSize: J,
|
|
39
39
|
labelFontColor: Oe,
|
|
40
|
-
labelFontWeight:
|
|
41
|
-
legendFontSize:
|
|
42
|
-
customTooltips:
|
|
43
|
-
tooltipFontSize:
|
|
44
|
-
showAdminUnitLabel:
|
|
45
|
-
mapNoDataColor:
|
|
46
|
-
mapBoundaryColor:
|
|
47
|
-
mapFocusBoundaryColor:
|
|
48
|
-
highlightedLocation:
|
|
40
|
+
labelFontWeight: ct,
|
|
41
|
+
legendFontSize: ut,
|
|
42
|
+
customTooltips: pt,
|
|
43
|
+
tooltipFontSize: dt,
|
|
44
|
+
showAdminUnitLabel: ne,
|
|
45
|
+
mapNoDataColor: Pe,
|
|
46
|
+
mapBoundaryColor: mt,
|
|
47
|
+
mapFocusBoundaryColor: ft,
|
|
48
|
+
highlightedLocation: D,
|
|
49
49
|
tooltipFormat: Re,
|
|
50
|
-
showNoDataTooltip:
|
|
51
|
-
fields:
|
|
52
|
-
mapContainerBgColor:
|
|
53
|
-
mapPosition:
|
|
54
|
-
mainLayerId:
|
|
55
|
-
enabledLayers:
|
|
56
|
-
pointLabelColor:
|
|
57
|
-
pointLabelFormat:
|
|
58
|
-
highlightedLocLabelFormat:
|
|
59
|
-
mapType:
|
|
60
|
-
defaultPointColor:
|
|
61
|
-
zoomOnFilter:
|
|
62
|
-
zoomOnFilterField:
|
|
63
|
-
noDataText:
|
|
64
|
-
labelsExclusionList:
|
|
65
|
-
showShadingLayerLabels:
|
|
50
|
+
showNoDataTooltip: gt,
|
|
51
|
+
fields: ht,
|
|
52
|
+
mapContainerBgColor: yt,
|
|
53
|
+
mapPosition: L,
|
|
54
|
+
mainLayerId: P,
|
|
55
|
+
enabledLayers: I,
|
|
56
|
+
pointLabelColor: bt,
|
|
57
|
+
pointLabelFormat: vt,
|
|
58
|
+
highlightedLocLabelFormat: Lt,
|
|
59
|
+
mapType: X,
|
|
60
|
+
defaultPointColor: We,
|
|
61
|
+
zoomOnFilter: xt,
|
|
62
|
+
zoomOnFilterField: C,
|
|
63
|
+
noDataText: Ft,
|
|
64
|
+
labelsExclusionList: ae,
|
|
65
|
+
showShadingLayerLabels: Be,
|
|
66
66
|
appliedFilters: m,
|
|
67
|
-
intl:
|
|
68
|
-
legendTitle:
|
|
69
|
-
nationalAverageLabel:
|
|
67
|
+
intl: x,
|
|
68
|
+
legendTitle: wt,
|
|
69
|
+
nationalAverageLabel: At,
|
|
70
70
|
zoomEnabled: se,
|
|
71
71
|
showTooltip: ie
|
|
72
|
-
} =
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
function ge() {
|
|
78
|
-
return pe.current ? pe.current.offsetWidth : ot;
|
|
72
|
+
} = _, [R, Mt] = re(
|
|
73
|
+
() => c && c.measures && c.measures.length > 1 ? c.measures[0] : null
|
|
74
|
+
), [H, Tt] = re(null), [_e, ce] = re(!1), [W, ue] = re(null), F = M(null), y = M(null), $ = M(null), k = M(null), E = M(null), je = M(!1), pe = M(null), de = M(null), w = M({}), me = M(null), Z = (c == null ? void 0 : c.types) || [];
|
|
75
|
+
function fe() {
|
|
76
|
+
return ot;
|
|
79
77
|
}
|
|
80
|
-
function
|
|
81
|
-
return
|
|
78
|
+
function ge() {
|
|
79
|
+
return ke - 100;
|
|
82
80
|
}
|
|
83
|
-
|
|
84
|
-
function
|
|
85
|
-
return ".map.wrapper." +
|
|
81
|
+
k.current === null && (k.current = u.zoom().scaleExtent([1, 16]).on("zoom", (e) => w.current.zoomed(e)).on("end", (e) => w.current.zoomEnd(e))), y.current === null && (y.current = u.geoMercator().scale(Te).center(le).translate([fe() / 2, ge() / 2]), $.current = u.geoPath().projection(y.current));
|
|
82
|
+
function f() {
|
|
83
|
+
return ".map.wrapper." + Ae;
|
|
86
84
|
}
|
|
87
|
-
function
|
|
85
|
+
function N() {
|
|
88
86
|
let e = R;
|
|
89
|
-
return !e &&
|
|
87
|
+
return !e && c && c.measures && c.measures.length > 1 && (e = c.measures[0]), e;
|
|
90
88
|
}
|
|
91
|
-
function
|
|
92
|
-
return
|
|
93
|
-
const
|
|
94
|
-
return t.index =
|
|
95
|
-
}).sort((t,
|
|
89
|
+
function He() {
|
|
90
|
+
return W && W.length > 0 ? W.map((t) => {
|
|
91
|
+
const a = I.find((l) => l.id == t.id);
|
|
92
|
+
return t.index = a ? a.index : 0, t;
|
|
93
|
+
}).sort((t, a) => parseInt(t.index) < parseInt(a.index) ? 1 : parseInt(t.index) > parseInt(a.index) ? -1 : 0) : [];
|
|
96
94
|
}
|
|
97
|
-
function
|
|
98
|
-
const e =
|
|
95
|
+
function kt() {
|
|
96
|
+
const e = He();
|
|
99
97
|
let t;
|
|
100
|
-
return e && (t = e.filter((
|
|
98
|
+
return e && (t = e.filter((a) => a.id == P || a.id == null)[0] || e[0]), t ? t.data : null;
|
|
101
99
|
}
|
|
102
|
-
function
|
|
103
|
-
return
|
|
100
|
+
function $e(e) {
|
|
101
|
+
return br(e, nt);
|
|
104
102
|
}
|
|
105
|
-
function
|
|
106
|
-
const e =
|
|
103
|
+
function Y() {
|
|
104
|
+
const e = kt(), t = He();
|
|
107
105
|
if (e) {
|
|
108
|
-
let
|
|
106
|
+
let a = [];
|
|
109
107
|
try {
|
|
110
|
-
|
|
111
|
-
|
|
108
|
+
a = $e(e), a.map((o) => {
|
|
109
|
+
o.properties.layerId = P;
|
|
112
110
|
const r = t.find(
|
|
113
|
-
(
|
|
111
|
+
(n) => String(n.id) === String(P)
|
|
114
112
|
);
|
|
115
|
-
return r && (
|
|
116
|
-
String(
|
|
117
|
-
|
|
113
|
+
return r && (o.properties.layerMappingField = r.layerMappingField, o.properties.layerDatasource = r.layerDatasource, o.properties.layerApiField = r.layerApiField, o.properties.layerLocale = r.layerLocale, o.properties.displayLayerLabels = r.displayLayerLabels), I.forEach((n) => {
|
|
114
|
+
String(n.id) == P && Object.keys(n || {}).forEach((s) => {
|
|
115
|
+
o.properties[s] = n[s];
|
|
118
116
|
});
|
|
119
|
-
}),
|
|
120
|
-
}), t && t.forEach((
|
|
121
|
-
if (
|
|
122
|
-
let r =
|
|
123
|
-
r = r.map((
|
|
117
|
+
}), o;
|
|
118
|
+
}), t && t.forEach((o) => {
|
|
119
|
+
if (o.id != P) {
|
|
120
|
+
let r = $e(o.data);
|
|
121
|
+
r = r.map((n) => (n.properties.layerId = o.id, n.properties.layerMappingField = o.layerMappingField, n.properties.layerDatasource = o.layerDatasource, n.properties.layerApiField = o.layerApiField, n.properties.layerLocale = o.layerLocale, n.properties.displayLayerLabels = o.displayLayerLabels, n)), a = [...r, ...a];
|
|
124
122
|
}
|
|
125
123
|
});
|
|
126
|
-
} catch (
|
|
127
|
-
console.log("error updating features .." +
|
|
124
|
+
} catch (o) {
|
|
125
|
+
console.log("error updating features .." + o);
|
|
128
126
|
}
|
|
129
|
-
const
|
|
130
|
-
let i =
|
|
131
|
-
return
|
|
132
|
-
(
|
|
133
|
-
)),
|
|
127
|
+
const l = a.filter((o) => o.properties != null);
|
|
128
|
+
let i = c.locationsData;
|
|
129
|
+
return c.measures && c.measures.length > 1 && (i = c.locationsData.filter(
|
|
130
|
+
(o) => o.measure === N()
|
|
131
|
+
)), l.map((o) => {
|
|
134
132
|
if (i) {
|
|
135
|
-
const r = i.find((
|
|
136
|
-
const s =
|
|
133
|
+
const r = i.find((n) => {
|
|
134
|
+
const s = n.label ? ("" + n.label).toLowerCase() : "", d = o.properties[h] ? o.properties[h].toLowerCase() : "";
|
|
137
135
|
return s === d;
|
|
138
136
|
});
|
|
139
137
|
if (r) {
|
|
140
|
-
let
|
|
141
|
-
|
|
142
|
-
|
|
138
|
+
let n = r.measure;
|
|
139
|
+
c.measureLabelMap && r.measure && c.measureLabelMap[r.measure] && (n = c.measureLabelMap[r.measure]), o.properties.value = r.value, o.properties.measure = r.measure, o.properties.measureLabel = n, o.properties.children = r.children, o.properties.variables = r.variables, o.properties.hasDataRow = !0, Object.keys(r).forEach((s) => {
|
|
140
|
+
o.properties[s] = r[s];
|
|
143
141
|
});
|
|
144
142
|
} else
|
|
145
|
-
|
|
143
|
+
o.properties.value = null, o.properties.measure = null, o.properties.children = null, o.properties.measureLabel = null, o.properties.hasDataRow = !1;
|
|
146
144
|
}
|
|
147
|
-
}),
|
|
145
|
+
}), l;
|
|
148
146
|
}
|
|
149
147
|
return [];
|
|
150
148
|
}
|
|
151
|
-
function
|
|
152
|
-
if (ue([]), ce(!0),
|
|
149
|
+
function Ue() {
|
|
150
|
+
if (ue([]), ce(!0), I && I.length > 0) {
|
|
153
151
|
const e = [];
|
|
154
|
-
|
|
152
|
+
I.forEach((t) => {
|
|
155
153
|
e.push(
|
|
156
|
-
new Promise((
|
|
157
|
-
|
|
158
|
-
|
|
154
|
+
new Promise((a) => {
|
|
155
|
+
u.json(vr.REACT_APP_WP_API + "/wp/v2/media/" + t.id).then((l) => {
|
|
156
|
+
a({
|
|
159
157
|
id: t.id,
|
|
160
|
-
url:
|
|
158
|
+
url: l.source_url,
|
|
161
159
|
index: t.index,
|
|
162
160
|
layerMappingField: t.layerMappingField,
|
|
163
161
|
layerDatasource: t.datasource,
|
|
@@ -166,7 +164,7 @@ function Ar(O) {
|
|
|
166
164
|
displayLayerLabels: t.displayLayerLabels
|
|
167
165
|
});
|
|
168
166
|
}).catch(function() {
|
|
169
|
-
|
|
167
|
+
a({
|
|
170
168
|
id: t.id,
|
|
171
169
|
url: null,
|
|
172
170
|
index: t.index,
|
|
@@ -180,34 +178,34 @@ function Ar(O) {
|
|
|
180
178
|
})
|
|
181
179
|
);
|
|
182
180
|
}), Promise.all(e).then((t) => {
|
|
183
|
-
const
|
|
184
|
-
t.forEach((
|
|
185
|
-
|
|
181
|
+
const a = [];
|
|
182
|
+
t.forEach((l) => {
|
|
183
|
+
l.url && a.push(
|
|
186
184
|
new Promise((i) => {
|
|
187
|
-
|
|
185
|
+
u.json(l.url).then((o) => {
|
|
188
186
|
i({
|
|
189
|
-
id:
|
|
190
|
-
data:
|
|
191
|
-
index:
|
|
192
|
-
layerMappingField:
|
|
193
|
-
layerDatasource:
|
|
194
|
-
layerApiField:
|
|
195
|
-
layerLocale:
|
|
196
|
-
displayLayerLabels:
|
|
187
|
+
id: l.id,
|
|
188
|
+
data: o,
|
|
189
|
+
index: l.index,
|
|
190
|
+
layerMappingField: l.layerMappingField,
|
|
191
|
+
layerDatasource: l.layerDatasource,
|
|
192
|
+
layerApiField: l.layerApiField,
|
|
193
|
+
layerLocale: l.layerLocale,
|
|
194
|
+
displayLayerLabels: l.displayLayerLabels
|
|
197
195
|
});
|
|
198
196
|
});
|
|
199
197
|
})
|
|
200
198
|
);
|
|
201
|
-
}), Promise.all(
|
|
202
|
-
ue(
|
|
199
|
+
}), Promise.all(a).then((l) => {
|
|
200
|
+
ue(l), ce(!1);
|
|
203
201
|
});
|
|
204
202
|
});
|
|
205
203
|
} else
|
|
206
|
-
|
|
204
|
+
u.json(Me).then((e) => {
|
|
207
205
|
ue([
|
|
208
206
|
{
|
|
209
207
|
id: null,
|
|
210
|
-
url:
|
|
208
|
+
url: Me,
|
|
211
209
|
data: e,
|
|
212
210
|
index: 0,
|
|
213
211
|
layerMappingField: null,
|
|
@@ -219,86 +217,86 @@ function Ar(O) {
|
|
|
219
217
|
]), ce(!1);
|
|
220
218
|
});
|
|
221
219
|
}
|
|
222
|
-
function
|
|
223
|
-
|
|
220
|
+
function Et(e) {
|
|
221
|
+
u.select(f()).select("svg").selectAll("circle").attr("r", e.k > 1 ? 6 / e.k : 6);
|
|
224
222
|
}
|
|
225
|
-
function
|
|
226
|
-
return
|
|
223
|
+
function B(e) {
|
|
224
|
+
return gr(e, v);
|
|
227
225
|
}
|
|
228
|
-
function
|
|
229
|
-
return
|
|
226
|
+
function ee() {
|
|
227
|
+
return hr(oe);
|
|
230
228
|
}
|
|
231
|
-
function
|
|
232
|
-
return e.properties.LABEL_LATITUDE && e.properties.LABEL_LONGITUDE ?
|
|
229
|
+
function he(e) {
|
|
230
|
+
return e.properties.LABEL_LATITUDE && e.properties.LABEL_LONGITUDE ? y.current([
|
|
233
231
|
e.properties.LABEL_LONGITUDE,
|
|
234
232
|
e.properties.LABEL_LATITUDE
|
|
235
|
-
]) :
|
|
236
|
-
}
|
|
237
|
-
function
|
|
238
|
-
|
|
239
|
-
const i =
|
|
240
|
-
|
|
241
|
-
const
|
|
242
|
-
i.attr("x",
|
|
233
|
+
]) : $.current.centroid(e);
|
|
234
|
+
}
|
|
235
|
+
function Nt(e) {
|
|
236
|
+
u.select(f()).selectAll(".map-labels-container").each((t, a, l) => {
|
|
237
|
+
const i = u.select(l[a]), o = i.select("div"), r = O() === "mobile" || O() === "tablet", n = e.k > 1 ? e.k : 1, s = r ? J * 0.6 : J / n, d = r ? 1 : n;
|
|
238
|
+
o.style("font-size", `${s}px`);
|
|
239
|
+
const g = he(t), A = B(t) / d, S = g[0] - A / 2, V = r ? 10 : e.k > 1 ? 10 / e.k : 10, Ye = g[1] - V;
|
|
240
|
+
i.attr("x", S).attr("y", Ye).attr("width", B(t) / d).attr("height", ee() / d);
|
|
243
241
|
});
|
|
244
242
|
}
|
|
245
|
-
function
|
|
246
|
-
|
|
247
|
-
const i =
|
|
248
|
-
|
|
249
|
-
const s =
|
|
243
|
+
function zt(e) {
|
|
244
|
+
u.select(f()).selectAll(".point-labels-container").each((t, a, l) => {
|
|
245
|
+
const i = u.select(l[a]), o = i.select("div"), r = e.k > 1 ? e.k : 1, n = J / r;
|
|
246
|
+
o.style("font-size", `${n}px`);
|
|
247
|
+
const s = y.current([
|
|
250
248
|
t.geometry.coordinates[1],
|
|
251
249
|
t.geometry.coordinates[0]
|
|
252
|
-
]), d = (
|
|
253
|
-
i.attr("x",
|
|
250
|
+
]), d = (B(t) + 20) / r, g = ee() / r, A = s[0] - d / 2, S = s[1] - g / 2;
|
|
251
|
+
i.attr("x", A).attr("y", S).attr("width", d).attr("height", g);
|
|
254
252
|
});
|
|
255
253
|
}
|
|
256
254
|
function Dt(e) {
|
|
257
|
-
|
|
255
|
+
F.current.style("visibility", "hidden");
|
|
258
256
|
const t = e.transform;
|
|
259
|
-
|
|
257
|
+
u.select(f()).select("svg").select("g").attr("transform", t), Et(t), Nt(t), zt(t);
|
|
260
258
|
}
|
|
261
|
-
function
|
|
259
|
+
function It(e) {
|
|
262
260
|
const t = e.transform;
|
|
263
261
|
E.current = { k: t.k, x: t.x, y: t.y }, j && window.parent.postMessage(
|
|
264
262
|
{ type: "map", value: JSON.stringify(E.current) },
|
|
265
263
|
"*"
|
|
266
264
|
);
|
|
267
265
|
}
|
|
268
|
-
function
|
|
269
|
-
const e =
|
|
266
|
+
function Ct() {
|
|
267
|
+
const e = u.select(f()).select("svg");
|
|
270
268
|
e.select("g").selectAll(".active").attr("class", function() {
|
|
271
|
-
return
|
|
269
|
+
return u.select(this).attr("class").replace(/background/gi, "");
|
|
272
270
|
});
|
|
273
|
-
let
|
|
274
|
-
|
|
271
|
+
let a = u.zoomIdentity;
|
|
272
|
+
L && !j ? a = a.translate(L.x, L.y).scale(L.k) : a = a.translate(0, 0).scale(1), e.transition().duration(300).call(k.current.transform, a);
|
|
275
273
|
}
|
|
276
|
-
function
|
|
277
|
-
E.current = null,
|
|
274
|
+
function Ge() {
|
|
275
|
+
E.current = null, F.current.style("visibility", "hidden"), Ct();
|
|
276
|
+
}
|
|
277
|
+
function St() {
|
|
278
|
+
u.select(f()).select("svg").transition().call(k.current.scaleBy, 1.5);
|
|
278
279
|
}
|
|
279
280
|
function Ot() {
|
|
280
|
-
|
|
281
|
-
}
|
|
282
|
-
function
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
autoGenerateBreaks: De,
|
|
290
|
-
numberOfBreaks: it,
|
|
291
|
-
colorScheme: ct
|
|
281
|
+
u.select(f()).select("svg").transition().call(k.current.scaleBy, 0.6667);
|
|
282
|
+
}
|
|
283
|
+
function q() {
|
|
284
|
+
if (Ie) {
|
|
285
|
+
const e = Y();
|
|
286
|
+
return dr(e, {
|
|
287
|
+
autoGenerateBreaks: Ie,
|
|
288
|
+
numberOfBreaks: at,
|
|
289
|
+
colorScheme: st
|
|
292
290
|
});
|
|
293
291
|
} else {
|
|
294
292
|
let e = Ee;
|
|
295
|
-
return
|
|
293
|
+
return N() && (e = Ee.filter((t) => t.measure === N()).filter((t) => {
|
|
296
294
|
if (t.filters && t.filters.length > 0 && m && JSON.stringify(m) !== "{}") {
|
|
297
|
-
const
|
|
298
|
-
return t.filters.filter((
|
|
299
|
-
if (
|
|
300
|
-
const r = m[
|
|
301
|
-
return r.join(",").indexOf(
|
|
295
|
+
const l = Object.keys(m);
|
|
296
|
+
return t.filters.filter((o) => {
|
|
297
|
+
if (l.indexOf(o.field) != -1) {
|
|
298
|
+
const r = m[o.field], n = o.values;
|
|
299
|
+
return r.join(",").indexOf(n) != -1;
|
|
302
300
|
}
|
|
303
301
|
return !1;
|
|
304
302
|
}).length > 0;
|
|
@@ -307,431 +305,416 @@ function Ar(O) {
|
|
|
307
305
|
})), e;
|
|
308
306
|
}
|
|
309
307
|
}
|
|
310
|
-
function
|
|
311
|
-
return
|
|
312
|
-
mapNoDataColor:
|
|
313
|
-
mainLayerId:
|
|
314
|
-
enabledLayers:
|
|
308
|
+
function ye(e, t) {
|
|
309
|
+
return mr(e, t, {
|
|
310
|
+
mapNoDataColor: Pe,
|
|
311
|
+
mainLayerId: P,
|
|
312
|
+
enabledLayers: I,
|
|
315
313
|
selectedMeasure: R
|
|
316
314
|
});
|
|
317
315
|
}
|
|
318
|
-
function
|
|
319
|
-
return
|
|
316
|
+
function Pt(e) {
|
|
317
|
+
return yr(
|
|
320
318
|
e,
|
|
321
319
|
{
|
|
322
|
-
mapLabelField:
|
|
323
|
-
mapLabelShowValue:
|
|
324
|
-
intl:
|
|
325
|
-
valueFormat:
|
|
326
|
-
showNoDataLabel:
|
|
327
|
-
showAdminUnitLabel:
|
|
328
|
-
noDataText:
|
|
329
|
-
selectedMeasure:
|
|
320
|
+
mapLabelField: v,
|
|
321
|
+
mapLabelShowValue: oe,
|
|
322
|
+
intl: x,
|
|
323
|
+
valueFormat: De,
|
|
324
|
+
showNoDataLabel: Ce,
|
|
325
|
+
showAdminUnitLabel: ne,
|
|
326
|
+
noDataText: Ft,
|
|
327
|
+
selectedMeasure: N()
|
|
330
328
|
},
|
|
331
|
-
|
|
332
|
-
|
|
329
|
+
Z,
|
|
330
|
+
T
|
|
333
331
|
);
|
|
334
332
|
}
|
|
335
|
-
function
|
|
336
|
-
const
|
|
337
|
-
...e.filter((
|
|
338
|
-
...e.filter((
|
|
333
|
+
function Ve(e, t) {
|
|
334
|
+
const a = [
|
|
335
|
+
...e.filter((l) => D != l.properties[v]),
|
|
336
|
+
...e.filter((l) => D == l.properties[v])
|
|
339
337
|
];
|
|
340
|
-
|
|
338
|
+
Wt(a), Rt(a), Bt(a, t), Se.length > 0 && _t(Se, a);
|
|
341
339
|
}
|
|
342
|
-
function
|
|
343
|
-
const t =
|
|
340
|
+
function Rt(e) {
|
|
341
|
+
const t = u.select(f()).select("svg").select("g");
|
|
344
342
|
if (t.selectAll(".map-labels-container").size() > 0) {
|
|
345
343
|
console.log("Labels already exist, skipping redraw...");
|
|
346
344
|
return;
|
|
347
345
|
}
|
|
348
346
|
t.selectAll(".map-labels").data(
|
|
349
|
-
e.filter((
|
|
350
|
-
).enter().append("foreignObject").attr("class", "map-labels-container").attr("x", (
|
|
351
|
-
const i =
|
|
352
|
-
if (
|
|
353
|
-
const
|
|
354
|
-
return i[0] -
|
|
347
|
+
e.filter((l) => ae && ae.length > 0 ? !ae.includes(l.properties[v]) : !0)
|
|
348
|
+
).enter().append("foreignObject").attr("class", "map-labels-container").attr("x", (l) => {
|
|
349
|
+
const i = he(l);
|
|
350
|
+
if (l.properties[v]) {
|
|
351
|
+
const o = B(l);
|
|
352
|
+
return i[0] - o / 2;
|
|
355
353
|
}
|
|
356
354
|
return i[0];
|
|
357
|
-
}).attr("y", (
|
|
355
|
+
}).attr("y", (l) => he(l)[1] - 10).attr("width", (l) => B(l)).attr("height", (l) => ee()).attr("font-size", () => `${J}px`).attr("overflow", "visible").attr("opacity", 1).style("display", (l) => ne === et || ne === tt && l.properties.hasDataRow || l.properties.displayLayerLabels ? "block" : "none").attr("pointer-events", X == "POINTS_MAP" ? "none" : "all").on("mouseover", U).on("mousemove", K).on("mouseout", G).append("xhtml:div").style("font-size", () => `${J}px`).style("color", () => Oe).style("font-weight", () => ct).style("background-color", (l) => l.properties.hasDataRow && oe && (l.properties.value != null || l.properties.value == null && Ce) ? "#fff6e1" : "none").style("border-radius", () => "4px").style("line-height", "95%").style("text-align", "center").html((l) => Pt(l));
|
|
358
356
|
}
|
|
359
|
-
function
|
|
360
|
-
const t =
|
|
357
|
+
function Wt(e) {
|
|
358
|
+
const t = q(), a = u.select(f()).select("svg").select("g"), l = e.filter(
|
|
361
359
|
(i) => i.geometry && i.geometry && (i.geometry.type == "Polygon" || i.geometry.type == "MultiPolygon")
|
|
362
360
|
);
|
|
363
|
-
|
|
364
|
-
}
|
|
365
|
-
function
|
|
366
|
-
const
|
|
367
|
-
let
|
|
368
|
-
if (
|
|
369
|
-
let r =
|
|
370
|
-
t && m && m[
|
|
361
|
+
l.length > 0 && a.selectAll("path").data(l).join("path").attr("d", $.current).attr("fill", (i) => ye(i, t)).attr("stroke-width", (i) => D == i.properties[v] ? 1.2 : 0.4).attr("stroke", (i) => D == i.properties[v] ? ft : mt).on("click", Ht);
|
|
362
|
+
}
|
|
363
|
+
function Bt(e, t) {
|
|
364
|
+
const a = u.select(f()).select("svg").select("g");
|
|
365
|
+
let l = [];
|
|
366
|
+
if (c.pointsData) {
|
|
367
|
+
let r = H;
|
|
368
|
+
t && m && m[C] && (r = m[C]), l = c.pointsData.filter((n) => n.lat && n.lng && n.label == r).map((n) => ({
|
|
371
369
|
properties: {
|
|
372
|
-
label:
|
|
373
|
-
lat:
|
|
374
|
-
lng:
|
|
375
|
-
value:
|
|
376
|
-
variables:
|
|
370
|
+
label: n.label,
|
|
371
|
+
lat: n.lat,
|
|
372
|
+
lng: n.lng,
|
|
373
|
+
value: n.value,
|
|
374
|
+
variables: n.variables
|
|
377
375
|
}
|
|
378
|
-
})),
|
|
376
|
+
})), a.selectAll(".circle").data(l).enter().append("circle").attr("id", (n, s) => "circle" + s).attr("cx", (n) => y.current([n.properties.lng, n.properties.lat])[0]).attr("cy", (n) => y.current([n.properties.lng, n.properties.lat])[1]).attr("r", () => 2).style("stroke-width", 0.5).style("fill", () => We).on("mouseover", (n, s) => jt(n, s)).on("mouseout", G);
|
|
379
377
|
}
|
|
380
|
-
const i =
|
|
381
|
-
let
|
|
382
|
-
|
|
378
|
+
const i = q();
|
|
379
|
+
let o = [];
|
|
380
|
+
Be == et ? o = e.filter((r) => r.geometry && r.geometry.type == "Point") : Be == tt && (o = e.filter(
|
|
383
381
|
(r) => r.geometry && r.geometry.type == "Point" && r.properties.hasDataRow
|
|
384
|
-
)),
|
|
385
|
-
const
|
|
386
|
-
return
|
|
382
|
+
)), o.length > 0 && a.selectAll(".point-labels").data(o).enter().append("foreignObject").attr("id", (r, n) => "point-label" + n).attr("class", "point-labels-container").attr("x", (r) => {
|
|
383
|
+
const n = B(r) + 20;
|
|
384
|
+
return y.current([
|
|
387
385
|
r.geometry.coordinates[1],
|
|
388
386
|
r.geometry.coordinates[0]
|
|
389
|
-
])[0] -
|
|
390
|
-
}).attr("y", (r) =>
|
|
387
|
+
])[0] - n / 2;
|
|
388
|
+
}).attr("y", (r) => y.current([
|
|
391
389
|
r.geometry.coordinates[1],
|
|
392
390
|
r.geometry.coordinates[0]
|
|
393
|
-
])[1] -
|
|
394
|
-
(r) =>
|
|
395
|
-
|
|
391
|
+
])[1] - ee() / 2).attr("width", (r) => B(r) + 20).attr("height", () => "1px").attr("overflow", "visible").attr("font-size", "12px").style("opacity", 1).append("xhtml:div").style("color", () => bt).style("font-weight", () => "bold").style("background-color", (r) => ye(r, i)).style("padding", () => "5px 3px 5px 3px").style("border-radius", () => "4px").style("line-height", "100%").style("text-align", "center").html(
|
|
392
|
+
(r) => T(
|
|
393
|
+
vt,
|
|
396
394
|
{
|
|
397
395
|
value: r.properties.value,
|
|
398
|
-
locationName: r.properties[
|
|
396
|
+
locationName: r.properties[v]
|
|
399
397
|
},
|
|
400
|
-
|
|
398
|
+
x
|
|
401
399
|
)
|
|
402
|
-
).on("mouseover", (r,
|
|
403
|
-
|
|
404
|
-
}).on("mousemove",
|
|
405
|
-
}
|
|
406
|
-
function
|
|
407
|
-
const
|
|
408
|
-
e.forEach((
|
|
409
|
-
if (
|
|
400
|
+
).on("mouseover", (r, n, s) => {
|
|
401
|
+
u.select(f()).select("svg").select("g").select("#point-label" + s).raise(), U(r, n);
|
|
402
|
+
}).on("mousemove", K).on("mouseout", G);
|
|
403
|
+
}
|
|
404
|
+
function _t(e, t) {
|
|
405
|
+
const a = u.select(f()).select("svg").select("g");
|
|
406
|
+
e.forEach((l) => {
|
|
407
|
+
if (l.field && l.image && l.values) {
|
|
410
408
|
const i = t.filter((r) => {
|
|
411
|
-
const
|
|
412
|
-
return r.properties.LATITUDE && r.properties.LONGITUDE &&
|
|
413
|
-
(
|
|
409
|
+
const n = rt == l.field ? h : "value", s = (r.properties[n] || (r.properties.variables ? r.properties.variables[n] : "")) + "", g = (l.values + "").split(",");
|
|
410
|
+
return r.properties.LATITUDE && r.properties.LONGITUDE && g.filter(
|
|
411
|
+
(A) => A.trim().toLowerCase() == s.trim().toLowerCase()
|
|
414
412
|
).length > 0;
|
|
415
|
-
}),
|
|
416
|
-
const
|
|
417
|
-
return !r.properties.LATITUDE && !r.properties.LONGITUDE &&
|
|
418
|
-
(
|
|
413
|
+
}), o = t.filter((r) => {
|
|
414
|
+
const n = rt == l.field ? h : "value", s = (r.properties[n] || (r.properties.variables ? r.properties.variables[n] : "")) + "", g = (l.values + "").split(",");
|
|
415
|
+
return !r.properties.LATITUDE && !r.properties.LONGITUDE && g.filter(
|
|
416
|
+
(A) => A.trim().toLowerCase() == s.trim().toLowerCase()
|
|
419
417
|
).length > 0;
|
|
420
418
|
});
|
|
421
|
-
|
|
419
|
+
a.selectAll("image").data(i).enter().append("image").attr("width", 40).attr("height", 40).attr("class", "map-symbol").attr("xlink:href", "/" + l.image).attr(
|
|
422
420
|
"transform",
|
|
423
|
-
(r) => "translate(" +
|
|
424
|
-
).on("mouseover",
|
|
421
|
+
(r) => "translate(" + y.current([r.properties.LONGITUDE, r.properties.LATITUDE]) + ")"
|
|
422
|
+
).on("mouseover", U).on("mousemove", K).on("mouseout", G), a.selectAll("image").data(o).enter().append("image").attr("width", 40).attr("height", 40).attr("class", "map-symbol").attr("xlink:href", "/" + l.image).attr("x", (r) => $.current.centroid(r)[0] - 20).attr("y", (r) => $.current.centroid(r)[1]).on("mouseover", U).on("mousemove", K).on("mouseout", G);
|
|
425
423
|
}
|
|
426
424
|
});
|
|
427
425
|
}
|
|
428
|
-
function
|
|
426
|
+
function U(e, t) {
|
|
429
427
|
console.log("Showing tooltip for data:", t);
|
|
430
|
-
const
|
|
431
|
-
|
|
428
|
+
const a = ["mobile", "tablet", "midTablet"].includes(
|
|
429
|
+
O()
|
|
432
430
|
);
|
|
433
|
-
if (ie && t.properties.value !== null || ie &&
|
|
434
|
-
|
|
435
|
-
const
|
|
436
|
-
{label}: %({value},2)`, r = t.properties.variables || {},
|
|
431
|
+
if (ie && t.properties.value !== null || ie && gt) {
|
|
432
|
+
u.select(f()).select("svg").select("g").selectAll(".active").attr("class", (s) => s.properties[h] === t.properties[h] ? "focus" + (a ? " zoom-enabled" : "") : "active" + (a ? " zoom-enabled" : ""));
|
|
433
|
+
const o = Re || `{locationName} %({value},2)
|
|
434
|
+
{label}: %({value},2)`, r = t.properties.variables || {}, n = {
|
|
437
435
|
...t.properties,
|
|
438
436
|
value: t.properties.value,
|
|
439
|
-
measure:
|
|
437
|
+
measure: N(),
|
|
440
438
|
measureLabel: t.properties.measureLabel,
|
|
441
|
-
locationName:
|
|
442
|
-
label:
|
|
439
|
+
locationName: we(t, h, Z),
|
|
440
|
+
label: we(t, h, Z),
|
|
443
441
|
...r,
|
|
444
|
-
...
|
|
442
|
+
...Fe(m)
|
|
445
443
|
// expose applied filter params (e.g. {year}) to the tooltip
|
|
446
444
|
};
|
|
447
|
-
|
|
448
|
-
let s = `<div style='font-size:${
|
|
445
|
+
F.current.attr("class", it).style("position", "absolute").style("visibility", "hidden").style("visibility", "visible").html(() => {
|
|
446
|
+
let s = `<div style='font-size:${dt}px;' class='tooltip-content' >`;
|
|
449
447
|
if (t.properties.value != null) {
|
|
450
|
-
const d =
|
|
451
|
-
`),
|
|
452
|
-
let S = 1,
|
|
453
|
-
|
|
454
|
-
const
|
|
455
|
-
value:
|
|
456
|
-
label:
|
|
457
|
-
measure:
|
|
448
|
+
const d = o.split(`
|
|
449
|
+
`), g = d[0], A = d.length > 1 ? d[1] : null;
|
|
450
|
+
let S = 1, V;
|
|
451
|
+
ht.length > 1 && X != "POINTS_MAP" ? (S = d.length > 2 ? 2 : 1, V = d[S]) : V = null, g && (s += T(g, n, x)), A && (s.endsWith("<hr>") || (s += "<hr>"), s += T(A, n, x)), V && t.properties.children && t.properties.children.forEach((z) => {
|
|
452
|
+
const ve = {
|
|
453
|
+
value: z.value,
|
|
454
|
+
label: z.label,
|
|
455
|
+
measure: N(),
|
|
458
456
|
measureLabel: t.properties.measureLabel,
|
|
459
457
|
...r,
|
|
460
|
-
...
|
|
461
|
-
...
|
|
458
|
+
...z.variables,
|
|
459
|
+
...Fe(m)
|
|
462
460
|
};
|
|
463
|
-
s.endsWith("<hr>") || (s += "<hr>"), s +=
|
|
464
|
-
}), d.length > S + 1 && (s.endsWith("<hr>") || (s += "<hr>"), d.forEach((
|
|
465
|
-
|
|
466
|
-
})),
|
|
467
|
-
(
|
|
468
|
-
).forEach((
|
|
469
|
-
s.endsWith("<hr>") || (s += "<hr>"), s +=
|
|
461
|
+
s.endsWith("<hr>") || (s += "<hr>"), s += T(V, ve, x);
|
|
462
|
+
}), d.length > S + 1 && (s.endsWith("<hr>") || (s += "<hr>"), d.forEach((z, ve) => {
|
|
463
|
+
ve > S && (s.endsWith("<hr>") || (s += "<hr>"), s += T(z, n, x));
|
|
464
|
+
})), pt.filter(
|
|
465
|
+
(z) => z.location === t.properties[h]
|
|
466
|
+
).forEach((z) => {
|
|
467
|
+
s.endsWith("<hr>") || (s += "<hr>"), s += z.tooltip;
|
|
470
468
|
});
|
|
471
469
|
} else {
|
|
472
470
|
const d = Re || `{locationName} %({value},2)
|
|
473
|
-
{label}: %({value},2)`,
|
|
471
|
+
{label}: %({value},2)`, g = {
|
|
474
472
|
value: null,
|
|
475
|
-
measure:
|
|
473
|
+
measure: N(),
|
|
476
474
|
measureLabel: t.properties.measureLabel,
|
|
477
|
-
locationName:
|
|
475
|
+
locationName: we(t, h, Z),
|
|
478
476
|
...r
|
|
479
477
|
};
|
|
480
|
-
s +=
|
|
478
|
+
s += T(d, g, x), s += "</div>";
|
|
481
479
|
}
|
|
482
480
|
return s;
|
|
483
481
|
});
|
|
484
482
|
}
|
|
485
483
|
}
|
|
486
|
-
function
|
|
487
|
-
const
|
|
488
|
-
let
|
|
489
|
-
|
|
484
|
+
function Je(e) {
|
|
485
|
+
const a = F.current.node(), l = a ? a.offsetWidth : 0, i = window.scrollX + document.documentElement.clientWidth;
|
|
486
|
+
let o = e.pageX;
|
|
487
|
+
l && o + l > i && (o = e.pageX - l, o < window.scrollX && (o = window.scrollX)), F.current.style("top", e.pageY + "px").style("left", o + "px").style("margin-left", "8px");
|
|
490
488
|
}
|
|
491
|
-
function
|
|
492
|
-
|
|
489
|
+
function K(e) {
|
|
490
|
+
Je(e);
|
|
493
491
|
}
|
|
494
492
|
function G() {
|
|
495
|
-
ie && (
|
|
493
|
+
ie && (u.select(f()).select("svg").select("g").selectAll(".focus").attr("class", "active"), F.current.style("visibility", "hidden"));
|
|
496
494
|
}
|
|
497
|
-
function
|
|
498
|
-
|
|
499
|
-
const
|
|
500
|
-
|
|
495
|
+
function jt(e, t, a) {
|
|
496
|
+
U(e, t), F.current.style("visibility", "visible"), Je(e);
|
|
497
|
+
const l = u.select(f()).select("svg").select("g");
|
|
498
|
+
l.selectAll("circle").style("fill", We).style("stroke", "none"), l.select("#circle" + a).raise().style("fill", "#fff");
|
|
501
499
|
}
|
|
502
|
-
function
|
|
503
|
-
|
|
500
|
+
function Ht(e, t) {
|
|
501
|
+
H !== t.properties[h] && t.properties.value !== null && Tt(t.properties[h]);
|
|
504
502
|
}
|
|
505
|
-
function
|
|
506
|
-
const t = e && e.appliedFilters || {},
|
|
507
|
-
return t[
|
|
503
|
+
function $t(e) {
|
|
504
|
+
const t = e && e.appliedFilters || {}, a = m || {};
|
|
505
|
+
return t[C] != a[C];
|
|
508
506
|
}
|
|
509
|
-
function
|
|
510
|
-
let
|
|
511
|
-
if (
|
|
512
|
-
let
|
|
513
|
-
t && m && m[
|
|
507
|
+
function Ut(e, t) {
|
|
508
|
+
let a = null;
|
|
509
|
+
if (xt && C) {
|
|
510
|
+
let l = H;
|
|
511
|
+
t && m && m[C] && (l = m[C]);
|
|
514
512
|
const i = e.filter(
|
|
515
|
-
(
|
|
513
|
+
(o) => o.properties != null && o.properties[h] == l
|
|
516
514
|
)[0];
|
|
517
|
-
i && i.properties != null && i.properties.value && (
|
|
515
|
+
i && i.properties != null && i.properties.value && (a = i);
|
|
518
516
|
}
|
|
519
|
-
return
|
|
520
|
-
}
|
|
521
|
-
function
|
|
522
|
-
return
|
|
523
|
-
}
|
|
524
|
-
function
|
|
525
|
-
let
|
|
526
|
-
|
|
527
|
-
const
|
|
528
|
-
let
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
const f = {
|
|
539
|
-
mobile: 100,
|
|
540
|
-
tablet: 0,
|
|
541
|
-
midTablet: 0,
|
|
542
|
-
desktop: 0,
|
|
543
|
-
laptop: 0,
|
|
544
|
-
wide: 0
|
|
545
|
-
}[N()];
|
|
546
|
-
l.transition().duration(300).call(
|
|
547
|
-
A.current.transform,
|
|
548
|
-
c.zoomIdentity.translate(h.x + f, h.y).scale(h.k)
|
|
549
|
-
);
|
|
550
|
-
}
|
|
551
|
-
o || j ? l.call(A.current) : l.on("dblclick.zoom", null);
|
|
552
|
-
const s = Gt(e, t);
|
|
517
|
+
return a;
|
|
518
|
+
}
|
|
519
|
+
function Gt() {
|
|
520
|
+
return fr(se);
|
|
521
|
+
}
|
|
522
|
+
function Vt(e, t) {
|
|
523
|
+
let a = se;
|
|
524
|
+
a || (a = ["mobile", "tablet"].includes(O()));
|
|
525
|
+
const l = q(), i = u.select(f());
|
|
526
|
+
let o = i.select("svg");
|
|
527
|
+
const r = fe(), n = ge();
|
|
528
|
+
o.empty() ? o = i.append("svg") : o.selectAll("*").remove(), o.attr("style", `background-color:${yt};`).attr("viewBox", `0 0 ${r} ${n}`).attr("preserveAspectRatio", "xMidYMid meet"), o.append("g").selectAll("path").data(e).enter().append("path").attr("fill", (d) => ye(d, l)).attr("d", u.geoPath().projection(y.current)).attr("class", () => Gt()).on("mouseover", X !== "POINTS_MAP" ? U : null).on("mousemove", X !== "POINTS_MAP" ? K : null).on("mouseout", X !== "POINTS_MAP" ? G : null), E.current && o.transition().duration(300).call(
|
|
529
|
+
k.current.transform,
|
|
530
|
+
u.zoomIdentity.translate(E.current.x, E.current.y).scale(E.current.k)
|
|
531
|
+
), !E.current && L && L.x && L.y && L.k && o.transition().duration(300).call(
|
|
532
|
+
k.current.transform,
|
|
533
|
+
u.zoomIdentity.translate(L.x, L.y).scale(L.k)
|
|
534
|
+
), a || j ? o.call(k.current) : o.on("dblclick.zoom", null);
|
|
535
|
+
const s = Ut(e, t);
|
|
553
536
|
if (s) {
|
|
554
|
-
const d =
|
|
537
|
+
const d = $.current.bounds(s), g = [
|
|
555
538
|
(d[0][0] + d[1][0]) / 2,
|
|
556
539
|
(d[0][1] + d[1][1]) / 2
|
|
557
540
|
];
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
541
|
+
o.transition().duration(750).call(
|
|
542
|
+
k.current.transform,
|
|
543
|
+
u.zoomIdentity.translate(r / 2, n / 2).scale(12).translate(-g[0], -g[1])
|
|
561
544
|
);
|
|
562
545
|
}
|
|
563
546
|
}
|
|
564
|
-
function
|
|
565
|
-
return
|
|
547
|
+
function Jt() {
|
|
548
|
+
return c.nationalData.value;
|
|
566
549
|
}
|
|
567
|
-
function
|
|
568
|
-
R != e &&
|
|
550
|
+
function Xt(e) {
|
|
551
|
+
R != e && Mt(e);
|
|
569
552
|
}
|
|
570
|
-
function
|
|
571
|
-
let e =
|
|
572
|
-
return
|
|
573
|
-
(t) => t.measure ===
|
|
574
|
-
)), e.find((t) => t.label ===
|
|
553
|
+
function Zt() {
|
|
554
|
+
let e = c.locationsData;
|
|
555
|
+
return c.measures && c.measures.length > 1 && (e = c.locationsData.filter(
|
|
556
|
+
(t) => t.measure === N()
|
|
557
|
+
)), e.find((t) => t.label === D);
|
|
575
558
|
}
|
|
576
|
-
function
|
|
577
|
-
if (!
|
|
559
|
+
function Yt() {
|
|
560
|
+
if (!D)
|
|
578
561
|
return null;
|
|
579
|
-
const t =
|
|
580
|
-
(
|
|
562
|
+
const t = Y().find(
|
|
563
|
+
(a) => a.properties[v] === D
|
|
581
564
|
);
|
|
582
565
|
if (t && t.properties.displayLayerLabels && t.properties.layerLocale) {
|
|
583
|
-
const
|
|
584
|
-
return
|
|
585
|
-
|
|
586
|
-
|
|
566
|
+
const a = t.properties.layerMappingField || v, l = t.properties[a];
|
|
567
|
+
return pr(
|
|
568
|
+
Z,
|
|
569
|
+
l,
|
|
587
570
|
t.properties.layerLocale
|
|
588
571
|
);
|
|
589
572
|
}
|
|
590
|
-
return
|
|
573
|
+
return D;
|
|
591
574
|
}
|
|
592
|
-
function
|
|
593
|
-
return
|
|
575
|
+
function qt(e) {
|
|
576
|
+
return ur(e, q(), Pe);
|
|
594
577
|
}
|
|
595
|
-
function
|
|
596
|
-
return /* @__PURE__ */ p(
|
|
578
|
+
function Kt() {
|
|
579
|
+
return /* @__PURE__ */ p(Ke, { className: "loading", children: /* @__PURE__ */ p(nr, { basic: !0, padded: !0, textAlign: "center", style: { margin: "30px" }, children: /* @__PURE__ */ p(ar, { active: !0, inverted: !0, children: /* @__PURE__ */ p(sr, { size: "medium" }) }) }) });
|
|
597
580
|
}
|
|
598
|
-
function
|
|
599
|
-
return /* @__PURE__ */ b(
|
|
581
|
+
function Qt() {
|
|
582
|
+
return /* @__PURE__ */ b(Le, { icon: !0, warning: !0, children: [
|
|
600
583
|
/* @__PURE__ */ p(te, { name: "map outline" }),
|
|
601
|
-
/* @__PURE__ */ b(
|
|
602
|
-
/* @__PURE__ */ p(
|
|
584
|
+
/* @__PURE__ */ b(Le.Content, { children: [
|
|
585
|
+
/* @__PURE__ */ p(Le.Header, { children: "No map selected" }),
|
|
603
586
|
"Pick one from the list in the ",
|
|
604
587
|
/* @__PURE__ */ p("strong", { children: "Map Layers" }),
|
|
605
588
|
" section."
|
|
606
589
|
] })
|
|
607
590
|
] });
|
|
608
591
|
}
|
|
609
|
-
|
|
592
|
+
w.current.zoomed = Dt, w.current.zoomEnd = It, w.current.getFeatures = Y, w.current.updateFeatures = Ve, w.current.getMapId = f, me.current || (me.current = () => {
|
|
610
593
|
let e = null;
|
|
611
594
|
clearTimeout(e), e = setTimeout(() => {
|
|
612
|
-
|
|
595
|
+
u.select(w.current.getMapId()).selectAll(".map-labels-container").size() > 0 || w.current.updateFeatures(w.current.getFeatures(), !1);
|
|
613
596
|
}, 300);
|
|
614
|
-
}),
|
|
615
|
-
const e =
|
|
616
|
-
return window.addEventListener("scroll", e, { passive: !0 }), window.addEventListener("touchmove", e, { passive: !0 }),
|
|
597
|
+
}), Qe(() => {
|
|
598
|
+
const e = me.current;
|
|
599
|
+
return window.addEventListener("scroll", e, { passive: !0 }), window.addEventListener("touchmove", e, { passive: !0 }), Ue(), F.current = u.select("body").append("div").style("position", "absolute").style("visibility", "hidden").style("pointer-events", "none"), () => {
|
|
617
600
|
var t;
|
|
618
|
-
window.removeEventListener("scroll", e), window.removeEventListener("touchmove", e), (t =
|
|
601
|
+
window.removeEventListener("scroll", e), window.removeEventListener("touchmove", e), (t = F.current) == null || t.remove();
|
|
619
602
|
};
|
|
620
|
-
}, []),
|
|
621
|
-
if (
|
|
622
|
-
|
|
603
|
+
}, []), Qe(() => {
|
|
604
|
+
if (!je.current) {
|
|
605
|
+
je.current = !0, pe.current = _, de.current = { selectedMeasure: R, layers: W, selectedPolygon: H };
|
|
623
606
|
return;
|
|
624
607
|
}
|
|
625
|
-
const e =
|
|
626
|
-
if (
|
|
627
|
-
const i = [],
|
|
628
|
-
r && Object.keys(r).forEach((
|
|
629
|
-
r[
|
|
630
|
-
...r[
|
|
608
|
+
const e = pe.current, t = de.current;
|
|
609
|
+
if (C) {
|
|
610
|
+
const i = [], o = [], r = e.appliedFilters;
|
|
611
|
+
r && Object.keys(r).forEach((n) => {
|
|
612
|
+
r[n] != null && r[n] instanceof Array && i.push(
|
|
613
|
+
...r[n].filter((s) => s != Number.MIN_SAFE_INTEGER)
|
|
631
614
|
);
|
|
632
|
-
}), m && Object.keys(m).forEach((
|
|
633
|
-
m[
|
|
634
|
-
...m[
|
|
615
|
+
}), m && Object.keys(m).forEach((n) => {
|
|
616
|
+
m[n] != null && m[n] instanceof Array && o.push(
|
|
617
|
+
...m[n].filter((s) => s != Number.MIN_SAFE_INTEGER)
|
|
635
618
|
);
|
|
636
|
-
}), i.length > 0 &&
|
|
619
|
+
}), i.length > 0 && o.length == 0 && Ge();
|
|
637
620
|
}
|
|
638
|
-
|
|
639
|
-
const
|
|
640
|
-
e.center !== le && (E.current = null,
|
|
641
|
-
const
|
|
642
|
-
|
|
621
|
+
F.current.style("visibility", "hidden"), e.enabledLayers.length != I.length && Ue();
|
|
622
|
+
const a = Y();
|
|
623
|
+
e.center !== le && (E.current = null, y.current.scale(Te).center(le).translate([fe() / 2, ge() / 2]));
|
|
624
|
+
const l = $t(e);
|
|
625
|
+
Vt(a, l), W && c && (c != e.transformedData || W != t.layers || R != t.selectedMeasure || H != t.selectedPolygon || e.mainLayerId !== P || JSON.stringify(e.enabledLayers) != JSON.stringify(I)) && Ve(Y(), l), pe.current = _, de.current = { selectedMeasure: R, layers: W, selectedPolygon: H };
|
|
643
626
|
});
|
|
644
627
|
let be = se;
|
|
645
628
|
be || (be = !!["mobile", "tablet", "midTablet"].includes(
|
|
646
|
-
|
|
629
|
+
O()
|
|
647
630
|
));
|
|
648
|
-
const
|
|
649
|
-
backgroundColor:
|
|
631
|
+
const er = Jt(), tr = Fe(m), Q = Zt(), Xe = {
|
|
632
|
+
backgroundColor: qt(Q),
|
|
650
633
|
color: Oe,
|
|
651
|
-
fontSize:
|
|
634
|
+
fontSize: ut + "px"
|
|
652
635
|
};
|
|
653
|
-
j && (
|
|
654
|
-
const
|
|
655
|
-
/* @__PURE__ */ b(
|
|
656
|
-
|
|
657
|
-
/* @__PURE__ */ p("span", { className: "national-avg-label", children:
|
|
658
|
-
/* @__PURE__ */ p("span", { className: "national-avg-value", children:
|
|
636
|
+
j && (Xe.marginTop = "25px");
|
|
637
|
+
const Ze = () => /* @__PURE__ */ b(Ke, { fluid: !0, className: "footnote ", children: [
|
|
638
|
+
/* @__PURE__ */ b(xe, { columns: 2, children: [
|
|
639
|
+
_.app !== "csv" && Ne && /* @__PURE__ */ p(xe.Column, { textAlign: "left", width: 4, children: /* @__PURE__ */ b("div", { className: "national-average-div", children: [
|
|
640
|
+
/* @__PURE__ */ p("span", { className: "national-avg-label", children: At }),
|
|
641
|
+
/* @__PURE__ */ p("span", { className: "national-avg-value", children: T(De, { value: er }, x) })
|
|
659
642
|
] }) }),
|
|
660
643
|
/* @__PURE__ */ p(
|
|
661
|
-
|
|
644
|
+
xe.Column,
|
|
662
645
|
{
|
|
663
646
|
textAlign: "right",
|
|
664
|
-
width:
|
|
647
|
+
width: _.app !== "csv" && Ne ? 12 : 16,
|
|
665
648
|
children: /* @__PURE__ */ p(
|
|
666
|
-
|
|
649
|
+
ir,
|
|
667
650
|
{
|
|
668
|
-
filteredBreaks:
|
|
669
|
-
formattedLegendTitle:
|
|
651
|
+
filteredBreaks: q(),
|
|
652
|
+
formattedLegendTitle: T(wt, { ...tr }, x),
|
|
670
653
|
selectedMeasure: R,
|
|
671
|
-
...
|
|
654
|
+
..._
|
|
672
655
|
}
|
|
673
656
|
)
|
|
674
657
|
}
|
|
675
658
|
)
|
|
676
659
|
] }),
|
|
677
660
|
/* @__PURE__ */ p("div", { className: "measure-selector", children: /* @__PURE__ */ b("ul", { children: [
|
|
678
|
-
|
|
679
|
-
|
|
661
|
+
ze && /* @__PURE__ */ p("li", { children: /* @__PURE__ */ p("span", { className: "label", children: ze }) }),
|
|
662
|
+
c && c.measures && c.measures.length > 1 && c.measures.map((e) => /* @__PURE__ */ b("li", { onClick: () => Xt(e), children: [
|
|
680
663
|
/* @__PURE__ */ p(
|
|
681
664
|
"input",
|
|
682
665
|
{
|
|
683
|
-
checked:
|
|
666
|
+
checked: N() === e,
|
|
684
667
|
type: "radio",
|
|
685
668
|
value: e,
|
|
686
669
|
readOnly: !0
|
|
687
670
|
}
|
|
688
671
|
),
|
|
689
|
-
/* @__PURE__ */ p("label", { children:
|
|
672
|
+
/* @__PURE__ */ p("label", { children: c.measureLabelMap[e] || e })
|
|
690
673
|
] }, e))
|
|
691
674
|
] }) })
|
|
692
675
|
] });
|
|
693
|
-
return /* @__PURE__ */ b("div", { className: "map component wp-data-viz-map",
|
|
694
|
-
|
|
695
|
-
!
|
|
696
|
-
!
|
|
676
|
+
return /* @__PURE__ */ b("div", { className: "map component wp-data-viz-map", children: [
|
|
677
|
+
_e && (j ? Qt() : Kt()),
|
|
678
|
+
!_e && /* @__PURE__ */ b(qe, { children: [
|
|
679
|
+
!lt && /* @__PURE__ */ p(Ze, {}),
|
|
697
680
|
/* @__PURE__ */ b(
|
|
698
681
|
"div",
|
|
699
682
|
{
|
|
700
|
-
className: "map wrapper scaling-svg-container " +
|
|
701
|
-
style: { height:
|
|
683
|
+
className: "map wrapper scaling-svg-container " + Ae,
|
|
684
|
+
style: { height: ke - cr[O()] + "px" },
|
|
702
685
|
children: [
|
|
703
|
-
|
|
686
|
+
Q ? /* @__PURE__ */ p("div", { className: "highlighted-loc-info", style: Xe, children: /* @__PURE__ */ b("span", { children: [
|
|
704
687
|
" ",
|
|
705
|
-
|
|
706
|
-
|
|
688
|
+
T(
|
|
689
|
+
Lt,
|
|
707
690
|
{
|
|
708
|
-
value:
|
|
709
|
-
locationName:
|
|
710
|
-
measureName:
|
|
691
|
+
value: Q.value,
|
|
692
|
+
locationName: Yt() || Q.label,
|
|
693
|
+
measureName: Q.measure
|
|
711
694
|
},
|
|
712
|
-
|
|
695
|
+
x
|
|
713
696
|
)
|
|
714
|
-
] }) }) : /* @__PURE__ */ p(
|
|
715
|
-
(j || be) && !
|
|
716
|
-
/* @__PURE__ */ p("div", { className: "zoom plus", onClick:
|
|
717
|
-
/* @__PURE__ */ p("div", { className: "zoom minus", onClick:
|
|
697
|
+
] }) }) : /* @__PURE__ */ p(qe, { children: " " }),
|
|
698
|
+
(j || be) && !Lr && /* @__PURE__ */ b("div", { className: "control panel ignore", children: [
|
|
699
|
+
/* @__PURE__ */ p("div", { className: "zoom plus", onClick: St, children: /* @__PURE__ */ p(te, { name: "plus", size: "large" }) }),
|
|
700
|
+
/* @__PURE__ */ p("div", { className: "zoom minus", onClick: Ot, children: /* @__PURE__ */ p(te, { name: "minus", size: "large" }) }),
|
|
718
701
|
/* @__PURE__ */ p(
|
|
719
702
|
or,
|
|
720
703
|
{
|
|
721
|
-
content: /* @__PURE__ */ p(
|
|
722
|
-
trigger: /* @__PURE__ */ p("div", { className: "reset", onClick:
|
|
704
|
+
content: /* @__PURE__ */ p(lr, { id: "map.reset.tooltip", defaultMessage: "Reset zoom" }),
|
|
705
|
+
trigger: /* @__PURE__ */ p("div", { className: "reset", onClick: Ge, children: /* @__PURE__ */ p(te, { name: "repeat", size: "large" }) })
|
|
723
706
|
}
|
|
724
707
|
)
|
|
725
708
|
] })
|
|
726
709
|
]
|
|
727
710
|
}
|
|
728
711
|
),
|
|
729
|
-
|
|
712
|
+
lt && /* @__PURE__ */ p(Ze, {})
|
|
730
713
|
] })
|
|
731
714
|
] });
|
|
732
715
|
}
|
|
733
|
-
const
|
|
716
|
+
const Dr = rr(xr);
|
|
734
717
|
export {
|
|
735
|
-
|
|
736
|
-
|
|
718
|
+
Dr as default,
|
|
719
|
+
pr as getTranslatedItemLabel
|
|
737
720
|
};
|