@devgateway/dvz-ui-react 1.9.11 → 1.9.13

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.
Files changed (29) hide show
  1. package/dist/cjs/embeddable/d3Map/DataLayer.js +1 -1
  2. package/dist/cjs/embeddable/d3Map/FlowLayer.js +1 -1
  3. package/dist/cjs/embeddable/d3Map/LatLongLayer.js +1 -1
  4. package/dist/cjs/embeddable/d3Map/Legends.js +1 -1
  5. package/dist/cjs/embeddable/d3Map/Tooltip.js +1 -1
  6. package/dist/cjs/embeddable/d3Map/Utils.js +1 -1
  7. package/dist/cjs/embeddable/data/D3MapDataProvider.js +1 -1
  8. package/dist/cjs/embeddable/filter/index.js +1 -1
  9. package/dist/cjs/embeddable/map/index.js +2 -2
  10. package/dist/cjs/embeddable/map/map.js +4 -4
  11. package/dist/cjs/embeddable/map/mapHelpers.js +1 -1
  12. package/dist/cjs/embeddable/tabbedposts/index.js +1 -1
  13. package/dist/cjs/styles.css +1 -1
  14. package/dist/esm/embeddable/d3Map/DataLayer.js +322 -311
  15. package/dist/esm/embeddable/d3Map/FlowLayer.js +105 -99
  16. package/dist/esm/embeddable/d3Map/LatLongLayer.js +106 -100
  17. package/dist/esm/embeddable/d3Map/Legends.js +151 -147
  18. package/dist/esm/embeddable/d3Map/Tooltip.js +64 -20
  19. package/dist/esm/embeddable/d3Map/Utils.js +26 -12
  20. package/dist/esm/embeddable/data/D3MapDataProvider.js +31 -30
  21. package/dist/esm/embeddable/filter/index.js +123 -123
  22. package/dist/esm/embeddable/map/index.js +77 -77
  23. package/dist/esm/embeddable/map/map.js +436 -453
  24. package/dist/esm/embeddable/map/mapHelpers.js +88 -104
  25. package/dist/esm/embeddable/tabbedposts/index.js +12 -12
  26. package/dist/esm/styles.css +1 -1
  27. package/dist/types/embeddable/d3Map/Utils.d.ts +4 -0
  28. package/dist/types/embeddable/map/mapHelpers.d.ts +0 -2
  29. package/package.json +1 -1
@@ -1,13 +1,13 @@
1
1
  import { jsx as c } from "react/jsx-runtime";
2
- import { useMemo as Qe, useEffect as Xe } from "react";
3
- import { connect as ea, useDispatch as aa, useSelector as oa } from "react-redux";
4
- import ta from "../data/DataProvider.js";
5
- import la from "../data/DataConsumer.js";
6
- import { getCategories as ra } from "../reducers/data.js";
7
- import na from "./map.js";
8
- import sa from "./MapDataFrame.js";
9
- import ia from "./MapCSVDataFrame.js";
10
- const da = [
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,16 +17,16 @@ 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
- ], ma = (s) => /* @__PURE__ */ c(ca, { ...s }), ca = (s) => {
21
- var V;
20
+ ], ca = (s) => /* @__PURE__ */ c(ua, { ...s }), ua = (s) => {
21
+ var O;
22
22
  const {
23
23
  unique: f,
24
24
  editing: u,
25
- "data-filters": W = "{}",
25
+ "data-filters": J = "{}",
26
26
  "data-app": t = "csv",
27
- "data-csv": G = "",
28
- "data-dimension1": J = "",
29
- "data-dimension2": Z = "",
27
+ "data-csv": Z = "",
28
+ "data-dimension1": L = "",
29
+ "data-dimension2": w = "",
30
30
  "data-dimension3": g = "",
31
31
  "data-extra-tooltip-columns": _ = "[]",
32
32
  "data-measures": h = "[]",
@@ -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": y = !1,
41
- "data-show-legend-labels": L = !1,
40
+ "data-zoom-enabled": F = !1,
41
+ "data-show-legend-labels": S = !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": w = "false",
45
+ "data-has-multiple-measures": D = "false",
46
46
  topoJSONField: oe = "collection",
47
47
  "data-map-center": te = "NGA",
48
48
  //country
49
- "data-map-label-show-value": F = "false",
50
- "data-show-tooltip": S = "true",
49
+ "data-map-label-show-value": I = "false",
50
+ "data-show-tooltip": N = "true",
51
51
  "data-measure-selector-label": le = "",
52
52
  "data-value-format": re = "",
53
- "data-show-overall-value": D = "false",
54
- "data-auto-generate-breaks": I = "false",
53
+ "data-show-overall-value": z = "false",
54
+ "data-auto-generate-breaks": T = "false",
55
55
  "data-number-of-breaks": ne = 5,
56
56
  "data-scheme": se = "reds",
57
- "data-show-no-data-label": N = "false",
58
- "data-group": z = "default",
57
+ "data-show-no-data-label": x = "false",
58
+ "data-group": A = "default",
59
59
  "data-map-symbols": ie = "[]",
60
60
  "data-tooltip-theme": de = "map-tooltip-dark",
61
- "data-label-font-size": me = 12,
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": T = "2",
68
+ "data-decimals": B = "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": x = "false",
78
+ "data-show-no-data-tooltip": U = "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": A = !1,
85
+ "data-show-no-data-legend-item": P = !1,
86
86
  "data-highlighted-loc-label-format": xe = "{locationName} - Score: #({value},2)",
87
- "data-enable-summary-view": fa = "false",
88
- "data-map-type": B = "DEFAULT",
87
+ "data-enable-summary-view": ga = "false",
88
+ "data-map-type": R = "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": U = "false",
92
+ "data-zoom-on-filter": E = "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: ga,
101
- settings: ha
100
+ intl: ha,
101
+ settings: ba
102
102
  } = s;
103
103
  console.log("MapWrapper props", s);
104
- const Oe = (e) => u ? e : decodeURIComponent(e), P = (e) => e == null ? "" : String(e).trim().toLowerCase().replace(/[^a-z0-9]+/g, "_").replace(/^_+|_+$/g, ""), We = (e, a) => {
104
+ const Oe = (e) => u ? e : decodeURIComponent(e), M = (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 = P(a), r = Object.keys(e).find((k) => P(k) === o);
109
+ const o = M(a), r = Object.keys(e).find((W) => M(W) === o);
110
110
  return r ? e[r] : void 0;
111
111
  }, l = (e) => {
112
112
  try {
@@ -123,25 +123,25 @@ const da = [
123
123
  const a = l(e) || [];
124
124
  let o = {};
125
125
  return a && a.forEach ? a.forEach((r) => {
126
- (Array.isArray(r.value) ? r.value : [r.value]).filter((O) => O != null && O.toString().trim() != "").length > 0 && (o[r.param] = r.value);
126
+ (Array.isArray(r.value) ? r.value : [r.value]).filter((G) => G != null && G.toString().trim() != "").length > 0 && (o[r.param] = r.value);
127
127
  }) : o = a, o;
128
128
  }, Ze = {
129
129
  style: b === "compacted" ? "decimal" : b,
130
130
  notation: b === "compacted" ? "compact" : "standard",
131
131
  currency: he,
132
- minimumFractionDigits: parseInt(T),
133
- maximumFractionDigits: parseInt(T)
132
+ minimumFractionDigits: parseInt(B),
133
+ maximumFractionDigits: parseInt(B)
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 R = da.find((e) => e.value === te), E = w == !0 || w == "true";
138
- let i = [J, Z].filter((e) => e !== "none" && e !== null).join("/");
139
- const d = g && g !== "none" ? g : null, p = {
137
+ const v = ma.find((e) => e.value === te), V = D == !0 || D == "true";
138
+ let i = [L, w].filter((e) => e !== "none" && e !== null).join("/");
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: R.center,
144
- scale: R.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: y == !0 || y == "true",
157
- showLegendLabels: L == !0 || L == "true",
158
- multipleMeasures: E,
156
+ zoomEnabled: F == !0 || F == "true",
157
+ showLegendLabels: S == !0 || S == "true",
158
+ multipleMeasures: V,
159
159
  app: t,
160
- mapLabelShowValue: F == !0 || F == "true",
161
- showTooltip: S == !0 || S == "true",
162
- showOverallValue: D == !0 || D == "true",
160
+ mapLabelShowValue: I == !0 || I == "true",
161
+ showTooltip: N == !0 || N == "true",
162
+ showOverallValue: z == !0 || z == "true",
163
163
  measureSelectorLabel: le,
164
164
  valueFormat: re,
165
- autoGenerateBreaks: I == !0 || I == "true",
166
- showNoDataLabel: N == !0 || N == "true",
165
+ autoGenerateBreaks: T == !0 || T == "true",
166
+ showNoDataLabel: x == !0 || x == "true",
167
167
  numberOfBreaks: ne,
168
168
  colorScheme: se,
169
- group: z,
169
+ group: A,
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: x == !0 || x == "true",
186
+ showNoDataTooltip: U == !0 || U == "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: A == !0 || A == "true",
194
+ showNoDataLegendItem: P == !0 || P == "true",
195
195
  highlightedLocLabelFormat: xe,
196
- mapType: B,
196
+ mapType: R,
197
197
  defaultPointColor: decodeURIComponent(Ae),
198
198
  zoomLevelToShowPoints: Ue,
199
- zoomOnFilter: U == !0 || U == "true",
199
+ zoomOnFilter: E == !0 || E == "true",
200
200
  zoomOnFilterField: Pe,
201
201
  noDataText: Re,
202
202
  labelsExclusionList: Ee.split(",").map((e) => e.trim()),
@@ -206,46 +206,46 @@ const da = [
206
206
  };
207
207
  if (p.recentlyToggledLayerId) {
208
208
  const e = p.enabledLayers.find((a) => String(a.id) === String(p.recentlyToggledLayerId));
209
- e && (e != null && e.apiField) && (i = (V = e.apiField) == null ? void 0 : V.toLowerCase());
209
+ e && (e != null && e.apiField) && (i = (O = e.apiField) == null ? void 0 : O.toLowerCase());
210
210
  }
211
- const _e = l(Me) || {}, je = t === "csv" ? ia : sa, He = u ? (l(h) || []).join(",") : h, m = Je(W);
211
+ const je = l(Me) || {}, He = t === "csv" ? da : ia, Ke = u ? (l(h) || []).join(",") : h, m = Je(J);
212
212
  if (d) {
213
213
  const e = We(m, d);
214
214
  e != null && e !== "" && (m[d] = e);
215
215
  }
216
- const Ke = (l(_) || []).filter((e) => e && e !== "none"), M = Array.from(new Set([d, ...Ke].filter(Boolean)));
217
- M.length > 0 && (m.includeColumns = M.join(",")), n && (m.dvzProxyDatasetId = n);
218
- const $e = aa(), qe = ["data", "categories", t, ...n ? [n] : [], "items"], v = oa((e) => e.getIn(qe)), Ye = Qe(() => v ? v.toJS() : [], [v]);
219
- return Xe(() => {
220
- t && t !== "csv" && $e(ra({ app: t, dvzProxyDatasetId: n }));
216
+ const $e = (l(_) || []).filter((e) => e && e !== "none" && e !== L && e !== w), k = Array.from(new Set([d, ...$e].filter(Boolean)));
217
+ k.length > 0 && (m.includeColumns = k.join(",")), n && (m.dvzProxyDatasetId = n);
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
- ta,
222
+ la,
223
223
  {
224
224
  params: m,
225
225
  app: t,
226
- csv: decodeURIComponent(G),
227
- group: z,
226
+ csv: decodeURIComponent(Z),
227
+ group: A,
228
228
  editing: u,
229
229
  store: [t, f, ...i.split("/")],
230
230
  source: i,
231
- children: /* @__PURE__ */ c(la, { children: /* @__PURE__ */ c(
232
- je,
231
+ children: /* @__PURE__ */ c(ra, { children: /* @__PURE__ */ c(
232
+ He,
233
233
  {
234
- measures: He,
235
- multipleMeasures: E,
236
- mapType: B,
234
+ measures: Ke,
235
+ multipleMeasures: V,
236
+ mapType: R,
237
237
  aggregationFormula: Be,
238
- customMeasureLabels: _e,
238
+ customMeasureLabels: je,
239
239
  source: i,
240
240
  extraDimension: d,
241
- allDimensions: Ye,
242
- children: /* @__PURE__ */ c(na, { ...p })
241
+ allDimensions: Qe,
242
+ children: /* @__PURE__ */ c(sa, { ...p })
243
243
  }
244
244
  ) })
245
245
  }
246
246
  );
247
- }, ua = (s, f) => {
248
- }, pa = {}, za = ea(ua, pa)(ma);
247
+ }, pa = (s, f) => {
248
+ }, fa = {}, Ta = aa(pa, fa)(ca);
249
249
  export {
250
- za as default
250
+ Ta as default
251
251
  };