@devgateway/dvz-ui-react 1.9.10 → 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/embeddable/tabbedposts/index.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/embeddable/tabbedposts/index.js +77 -77
- package/dist/esm/styles.css +1 -1
- package/dist/types/embeddable/map/mapHelpers.d.ts +0 -2
- package/package.json +2 -2
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import { jsx as c } from "react/jsx-runtime";
|
|
2
|
-
import { useMemo as
|
|
3
|
-
import { connect as
|
|
4
|
-
import
|
|
5
|
-
import
|
|
6
|
-
import { getCategories as
|
|
7
|
-
import
|
|
8
|
-
import
|
|
9
|
-
import
|
|
10
|
-
const
|
|
2
|
+
import { useMemo as Xe, useEffect as ea } from "react";
|
|
3
|
+
import { connect as aa, useDispatch as oa, useSelector as ta } from "react-redux";
|
|
4
|
+
import la from "../data/DataProvider.js";
|
|
5
|
+
import ra from "../data/DataConsumer.js";
|
|
6
|
+
import { getCategories as na } from "../reducers/data.js";
|
|
7
|
+
import sa from "./map.js";
|
|
8
|
+
import ia from "./MapDataFrame.js";
|
|
9
|
+
import da from "./MapCSVDataFrame.js";
|
|
10
|
+
const ma = [
|
|
11
11
|
{ label: "KENYA", value: "KEN", center: [35.8166634, 0.1], scale: 2e3 },
|
|
12
12
|
{ label: "Nigeria", value: "NGA", center: [7.491302, 9.072264], scale: 2e3 },
|
|
13
13
|
{ label: "South Africa", value: "ZAF", center: [24.676997, -28.48322], scale: 2e3 },
|
|
@@ -17,7 +17,7 @@ const da = [
|
|
|
17
17
|
{ label: "Zambia", value: "ZMB", center: [26.459455, -14.668135], scale: 2e3 },
|
|
18
18
|
{ label: "Democratic Republic of the Congo", value: "DRC", center: [23.174338, -5.837475], scale: 1250 },
|
|
19
19
|
{ label: "World", value: "World", center: [0, 20.050043], scale: 150 }
|
|
20
|
-
],
|
|
20
|
+
], ca = (s) => /* @__PURE__ */ c(ua, { ...s }), ua = (s) => {
|
|
21
21
|
var V;
|
|
22
22
|
const {
|
|
23
23
|
unique: f,
|
|
@@ -37,35 +37,35 @@ const da = [
|
|
|
37
37
|
"data-national-average-label": q = "National Average",
|
|
38
38
|
"data-legend-title": Y = "Legend Title",
|
|
39
39
|
"data-legend-breaks": Q = "[]",
|
|
40
|
-
"data-zoom-enabled":
|
|
41
|
-
"data-show-legend-labels":
|
|
40
|
+
"data-zoom-enabled": L = !1,
|
|
41
|
+
"data-show-legend-labels": w = !1,
|
|
42
42
|
"data-map-file": X,
|
|
43
43
|
"data-mapping-field": ee = "zone",
|
|
44
44
|
"data-map-label-field": ae = "admin",
|
|
45
|
-
"data-has-multiple-measures":
|
|
45
|
+
"data-has-multiple-measures": F = "false",
|
|
46
46
|
topoJSONField: oe = "collection",
|
|
47
47
|
"data-map-center": te = "NGA",
|
|
48
48
|
//country
|
|
49
|
-
"data-map-label-show-value":
|
|
50
|
-
"data-show-tooltip":
|
|
49
|
+
"data-map-label-show-value": S = "false",
|
|
50
|
+
"data-show-tooltip": D = "true",
|
|
51
51
|
"data-measure-selector-label": le = "",
|
|
52
52
|
"data-value-format": re = "",
|
|
53
|
-
"data-show-overall-value":
|
|
54
|
-
"data-auto-generate-breaks":
|
|
53
|
+
"data-show-overall-value": I = "false",
|
|
54
|
+
"data-auto-generate-breaks": N = "false",
|
|
55
55
|
"data-number-of-breaks": ne = 5,
|
|
56
56
|
"data-scheme": se = "reds",
|
|
57
|
-
"data-show-no-data-label":
|
|
58
|
-
"data-group":
|
|
57
|
+
"data-show-no-data-label": z = "false",
|
|
58
|
+
"data-group": T = "default",
|
|
59
59
|
"data-map-symbols": ie = "[]",
|
|
60
60
|
"data-tooltip-theme": de = "map-tooltip-dark",
|
|
61
|
-
"data-label-font-size": me =
|
|
61
|
+
"data-label-font-size": me = 14,
|
|
62
62
|
"data-label-font-weight": ce = "normal",
|
|
63
63
|
"data-label-font-color": ue = "#595959",
|
|
64
64
|
"data-legend-font-size": pe = 12,
|
|
65
65
|
"data-legend-font-weight": fe = "normal",
|
|
66
66
|
"data-custom-tooltips": ge = "[]",
|
|
67
67
|
"data-format-style": b = "decimal",
|
|
68
|
-
"data-decimals":
|
|
68
|
+
"data-decimals": x = "2",
|
|
69
69
|
"data-currency": he = "",
|
|
70
70
|
"data-tooltip-font-size": be = 14,
|
|
71
71
|
"data-show-admin-unit-label": Ce = "showAll",
|
|
@@ -75,21 +75,21 @@ const da = [
|
|
|
75
75
|
"data-highlighted-location": we = "",
|
|
76
76
|
"data-tooltip-format": Fe = `{locationName} %({value},2)
|
|
77
77
|
{label}: %({value},2)`,
|
|
78
|
-
"data-show-no-data-tooltip":
|
|
78
|
+
"data-show-no-data-tooltip": A = "false",
|
|
79
79
|
"data-map-container-bg-color": Se = "#fff",
|
|
80
80
|
"data-map-position": De = "{}",
|
|
81
81
|
"data-main-layer-id": Ie = "",
|
|
82
82
|
"data-enabled-layers": Ne,
|
|
83
83
|
"data-point-label-color": ze = "#fff",
|
|
84
84
|
"data-point-label-format": Te = "{locationName} %({value},2)",
|
|
85
|
-
"data-show-no-data-legend-item":
|
|
85
|
+
"data-show-no-data-legend-item": B = !1,
|
|
86
86
|
"data-highlighted-loc-label-format": xe = "{locationName} - Score: #({value},2)",
|
|
87
|
-
"data-enable-summary-view":
|
|
88
|
-
"data-map-type":
|
|
87
|
+
"data-enable-summary-view": ga = "false",
|
|
88
|
+
"data-map-type": U = "DEFAULT",
|
|
89
89
|
"data-default-point-color": Ae = "#FFFF00",
|
|
90
90
|
"data-aggregation-formula": Be = "COUNT",
|
|
91
91
|
"data-zoom-level-to-show-points": Ue = 2,
|
|
92
|
-
"data-zoom-on-filter":
|
|
92
|
+
"data-zoom-on-filter": P = "false",
|
|
93
93
|
"data-zoom-on-filter-field": Pe = "",
|
|
94
94
|
"data-no-data-text": Re = "No Data",
|
|
95
95
|
"data-labels-exclusion-list": Ee = "",
|
|
@@ -97,16 +97,16 @@ const da = [
|
|
|
97
97
|
"data-show-shading-layer-labels": Ve = "ifUnitHasData",
|
|
98
98
|
"data-dvz-proxy-dataset-id": n,
|
|
99
99
|
"data-recently-toggled-layer-id": ke = null,
|
|
100
|
-
intl:
|
|
101
|
-
settings:
|
|
100
|
+
intl: ha,
|
|
101
|
+
settings: ba
|
|
102
102
|
} = s;
|
|
103
103
|
console.log("MapWrapper props", s);
|
|
104
|
-
const Oe = (e) => u ? e : decodeURIComponent(e),
|
|
104
|
+
const Oe = (e) => u ? e : decodeURIComponent(e), R = (e) => e == null ? "" : String(e).trim().toLowerCase().replace(/[^a-z0-9]+/g, "_").replace(/^_+|_+$/g, ""), We = (e, a) => {
|
|
105
105
|
if (!e || !a)
|
|
106
106
|
return;
|
|
107
107
|
if (Object.prototype.hasOwnProperty.call(e, a))
|
|
108
108
|
return e[a];
|
|
109
|
-
const o =
|
|
109
|
+
const o = R(a), r = Object.keys(e).find((k) => R(k) === o);
|
|
110
110
|
return r ? e[r] : void 0;
|
|
111
111
|
}, l = (e) => {
|
|
112
112
|
try {
|
|
@@ -129,19 +129,19 @@ const da = [
|
|
|
129
129
|
style: b === "compacted" ? "decimal" : b,
|
|
130
130
|
notation: b === "compacted" ? "compact" : "standard",
|
|
131
131
|
currency: he,
|
|
132
|
-
minimumFractionDigits: parseInt(
|
|
133
|
-
maximumFractionDigits: parseInt(
|
|
132
|
+
minimumFractionDigits: parseInt(x),
|
|
133
|
+
maximumFractionDigits: parseInt(x)
|
|
134
134
|
};
|
|
135
135
|
let C = l(Ne) || [];
|
|
136
136
|
C = C.map((e) => (e.bgColor = decodeURIComponent(e.bgColor), e.fontColor = decodeURIComponent(e.fontColor), e));
|
|
137
|
-
const
|
|
137
|
+
const v = ma.find((e) => e.value === te), E = F == !0 || F == "true";
|
|
138
138
|
let i = [J, Z].filter((e) => e !== "none" && e !== null).join("/");
|
|
139
|
-
const d = g && g !== "none" ? g : null, p = {
|
|
139
|
+
const d = g && g !== "none" ? g : null, _e = v ? v.scale : 2e3, p = {
|
|
140
140
|
unique: f,
|
|
141
141
|
editing: u,
|
|
142
142
|
source: `/${X}`,
|
|
143
|
-
center:
|
|
144
|
-
scale:
|
|
143
|
+
center: v.center,
|
|
144
|
+
scale: _e,
|
|
145
145
|
measures: h,
|
|
146
146
|
legendTitle: Y,
|
|
147
147
|
height: j,
|
|
@@ -153,20 +153,20 @@ const da = [
|
|
|
153
153
|
nationalAverageLabel: q,
|
|
154
154
|
legendBreaks: Ge(Q),
|
|
155
155
|
mapLabelField: ae,
|
|
156
|
-
zoomEnabled:
|
|
157
|
-
showLegendLabels:
|
|
156
|
+
zoomEnabled: L == !0 || L == "true",
|
|
157
|
+
showLegendLabels: w == !0 || w == "true",
|
|
158
158
|
multipleMeasures: E,
|
|
159
159
|
app: t,
|
|
160
|
-
mapLabelShowValue:
|
|
161
|
-
showTooltip:
|
|
162
|
-
showOverallValue:
|
|
160
|
+
mapLabelShowValue: S == !0 || S == "true",
|
|
161
|
+
showTooltip: D == !0 || D == "true",
|
|
162
|
+
showOverallValue: I == !0 || I == "true",
|
|
163
163
|
measureSelectorLabel: le,
|
|
164
164
|
valueFormat: re,
|
|
165
|
-
autoGenerateBreaks:
|
|
166
|
-
showNoDataLabel:
|
|
165
|
+
autoGenerateBreaks: N == !0 || N == "true",
|
|
166
|
+
showNoDataLabel: z == !0 || z == "true",
|
|
167
167
|
numberOfBreaks: ne,
|
|
168
168
|
colorScheme: se,
|
|
169
|
-
group:
|
|
169
|
+
group: T,
|
|
170
170
|
symbols: l(ie) || [],
|
|
171
171
|
tooltipTheme: de,
|
|
172
172
|
labelFontSize: me,
|
|
@@ -183,7 +183,7 @@ const da = [
|
|
|
183
183
|
mapFocusBoundaryColor: decodeURIComponent(Le),
|
|
184
184
|
highlightedLocation: we,
|
|
185
185
|
tooltipFormat: Fe,
|
|
186
|
-
showNoDataTooltip:
|
|
186
|
+
showNoDataTooltip: A == !0 || A == "true",
|
|
187
187
|
fields: i.split("/"),
|
|
188
188
|
mapContainerBgColor: decodeURIComponent(Se),
|
|
189
189
|
mapPosition: l(De),
|
|
@@ -191,12 +191,12 @@ const da = [
|
|
|
191
191
|
enabledLayers: C,
|
|
192
192
|
pointLabelColor: decodeURIComponent(ze),
|
|
193
193
|
pointLabelFormat: Te,
|
|
194
|
-
showNoDataLegendItem:
|
|
194
|
+
showNoDataLegendItem: B == !0 || B == "true",
|
|
195
195
|
highlightedLocLabelFormat: xe,
|
|
196
|
-
mapType:
|
|
196
|
+
mapType: U,
|
|
197
197
|
defaultPointColor: decodeURIComponent(Ae),
|
|
198
198
|
zoomLevelToShowPoints: Ue,
|
|
199
|
-
zoomOnFilter:
|
|
199
|
+
zoomOnFilter: P == !0 || P == "true",
|
|
200
200
|
zoomOnFilterField: Pe,
|
|
201
201
|
noDataText: Re,
|
|
202
202
|
labelsExclusionList: Ee.split(",").map((e) => e.trim()),
|
|
@@ -208,44 +208,44 @@ const da = [
|
|
|
208
208
|
const e = p.enabledLayers.find((a) => String(a.id) === String(p.recentlyToggledLayerId));
|
|
209
209
|
e && (e != null && e.apiField) && (i = (V = e.apiField) == null ? void 0 : V.toLowerCase());
|
|
210
210
|
}
|
|
211
|
-
const
|
|
211
|
+
const je = l(Me) || {}, He = t === "csv" ? da : ia, Ke = u ? (l(h) || []).join(",") : h, m = Je(W);
|
|
212
212
|
if (d) {
|
|
213
213
|
const e = We(m, d);
|
|
214
214
|
e != null && e !== "" && (m[d] = e);
|
|
215
215
|
}
|
|
216
|
-
const
|
|
216
|
+
const $e = (l(_) || []).filter((e) => e && e !== "none"), M = Array.from(new Set([d, ...$e].filter(Boolean)));
|
|
217
217
|
M.length > 0 && (m.includeColumns = M.join(",")), n && (m.dvzProxyDatasetId = n);
|
|
218
|
-
const
|
|
219
|
-
return
|
|
220
|
-
t && t !== "csv" &&
|
|
218
|
+
const qe = oa(), Ye = ["data", "categories", t, ...n ? [n] : [], "items"], y = ta((e) => e.getIn(Ye)), Qe = Xe(() => y ? y.toJS() : [], [y]);
|
|
219
|
+
return ea(() => {
|
|
220
|
+
t && t !== "csv" && qe(na({ app: t, dvzProxyDatasetId: n }));
|
|
221
221
|
}, [t, n]), /* @__PURE__ */ c(
|
|
222
|
-
|
|
222
|
+
la,
|
|
223
223
|
{
|
|
224
224
|
params: m,
|
|
225
225
|
app: t,
|
|
226
226
|
csv: decodeURIComponent(G),
|
|
227
|
-
group:
|
|
227
|
+
group: T,
|
|
228
228
|
editing: u,
|
|
229
229
|
store: [t, f, ...i.split("/")],
|
|
230
230
|
source: i,
|
|
231
|
-
children: /* @__PURE__ */ c(
|
|
232
|
-
|
|
231
|
+
children: /* @__PURE__ */ c(ra, { children: /* @__PURE__ */ c(
|
|
232
|
+
He,
|
|
233
233
|
{
|
|
234
|
-
measures:
|
|
234
|
+
measures: Ke,
|
|
235
235
|
multipleMeasures: E,
|
|
236
|
-
mapType:
|
|
236
|
+
mapType: U,
|
|
237
237
|
aggregationFormula: Be,
|
|
238
|
-
customMeasureLabels:
|
|
238
|
+
customMeasureLabels: je,
|
|
239
239
|
source: i,
|
|
240
240
|
extraDimension: d,
|
|
241
|
-
allDimensions:
|
|
242
|
-
children: /* @__PURE__ */ c(
|
|
241
|
+
allDimensions: Qe,
|
|
242
|
+
children: /* @__PURE__ */ c(sa, { ...p })
|
|
243
243
|
}
|
|
244
244
|
) })
|
|
245
245
|
}
|
|
246
246
|
);
|
|
247
|
-
},
|
|
248
|
-
},
|
|
247
|
+
}, pa = (s, f) => {
|
|
248
|
+
}, fa = {}, Ta = aa(pa, fa)(ca);
|
|
249
249
|
export {
|
|
250
|
-
|
|
250
|
+
Ta as default
|
|
251
251
|
};
|