@devgateway/dvz-ui-react 1.9.12 → 1.9.14

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.
@@ -6,136 +6,136 @@ import { injectIntl as X } from "react-intl";
6
6
  import Y from "../data/D3MapDataProvider.js";
7
7
  import Z from "../data/D3MapDataConsumer.js";
8
8
  import ee from "./GradientColors.js";
9
- import { Icon as G } from "semantic-ui-react";
10
- const U = ({ breaks: l, isPoint: o, numberFormat: d, intl: v }) => l.length > 0 && /* @__PURE__ */ e("div", { className: "legend-breaks", children: l.map((n, c) => n.type !== "graterThan" ? /* @__PURE__ */ a("div", { className: "break", children: [
9
+ import { Icon as V } from "semantic-ui-react";
10
+ const A = ({ breaks: l, isPoint: c, numberFormat: m, intl: C }) => l.length > 0 && /* @__PURE__ */ e("div", { className: "legend-breaks", children: l.map((s, u) => s.type !== "graterThan" ? /* @__PURE__ */ a("div", { className: "break", children: [
11
11
  /* @__PURE__ */ e(
12
12
  "div",
13
13
  {
14
- className: `break-item ${o ? "point" : ""}`,
14
+ className: `break-item ${c ? "point" : ""}`,
15
15
  style: {
16
- backgroundColor: n.color,
17
- border: `1px solid ${n.borderColor}`
16
+ backgroundColor: s.color,
17
+ border: `1px solid ${s.borderColor}`
18
18
  }
19
19
  }
20
20
  ),
21
21
  /* @__PURE__ */ a("div", { className: "break-label", children: [
22
22
  " < ",
23
- v.formatNumber(n.end, d)
23
+ C.formatNumber(s.end, m)
24
24
  ] })
25
25
  ] }) : /* @__PURE__ */ a("div", { className: "break", children: [
26
26
  /* @__PURE__ */ e(
27
27
  "div",
28
28
  {
29
- className: `break-item ${o ? "point" : ""}`,
29
+ className: `break-item ${c ? "point" : ""}`,
30
30
  style: {
31
- backgroundColor: n.color,
32
- border: `1px solid ${n.borderColor}`
31
+ backgroundColor: s.color,
32
+ border: `1px solid ${s.borderColor}`
33
33
  }
34
34
  }
35
35
  ),
36
36
  /* @__PURE__ */ a("div", { className: "break-label", children: [
37
37
  " > ",
38
- v.formatNumber(n.end, d)
38
+ C.formatNumber(s.end, m)
39
39
  ] })
40
40
  ] })) }), re = (l) => {
41
41
  const {
42
- name: o,
43
- breaks: d,
44
- pointStyleBy: v,
45
- dimension2: n,
46
- pointDimensionStyles: c = {},
47
- markFillColor: s,
48
- markBorderColor: m,
49
- measures: k,
50
- visible: h,
51
- format: g,
42
+ name: c,
43
+ breaks: m,
44
+ pointStyleBy: C,
45
+ dimension2: s,
46
+ pointDimensionStyles: u = {},
47
+ markFillColor: o,
48
+ markBorderColor: g,
49
+ measures: f,
50
+ visible: p,
51
+ format: h,
52
52
  intl: D,
53
53
  id: r,
54
- onItemClick: y,
55
- customMeasuresLabels: f
56
- } = l, u = {
57
- style: g.style === "compacted" ? "decimal" : g.style,
58
- notation: g.style === "compacted" ? "compact" : "standard",
59
- currency: g.currency,
60
- minimumFractionDigits: parseInt(g.minimumFractionDigits),
61
- maximumFractionDigits: parseInt(g.maximumFractionDigits)
54
+ onItemClick: v,
55
+ customMeasuresLabels: k
56
+ } = l, t = {
57
+ style: h.style === "compacted" ? "decimal" : h.style,
58
+ notation: h.style === "compacted" ? "compact" : "standard",
59
+ currency: h.currency,
60
+ minimumFractionDigits: parseInt(h.minimumFractionDigits),
61
+ maximumFractionDigits: parseInt(h.maximumFractionDigits)
62
62
  };
63
- let p = k[0];
64
- return f && (p = f[k[0]]), [...new Set(Object.keys(c).map((b) => b.split("_")[0]))], /* @__PURE__ */ e("div", { className: "legend", children: /* @__PURE__ */ a("div", { children: [
63
+ let d = f[0];
64
+ return k && (d = k[f[0]]), [...new Set(Object.keys(u).map((b) => b.split("_")[0]))], /* @__PURE__ */ e("div", { className: "legend", children: /* @__PURE__ */ a("div", { children: [
65
65
  /* @__PURE__ */ a("div", { className: "legend-item", children: [
66
66
  /* @__PURE__ */ e(
67
67
  "div",
68
68
  {
69
69
  className: "legend-color legend-check",
70
- onClick: (b) => y(r),
70
+ onClick: (b) => v(r),
71
71
  style: {
72
- backgroundColor: s,
73
- borderColor: m
72
+ backgroundColor: o,
73
+ borderColor: g
74
74
  },
75
- children: h != !1 && /* @__PURE__ */ e($, { children: "✓" })
75
+ children: p != !1 && /* @__PURE__ */ e($, { children: "✓" })
76
76
  }
77
77
  ),
78
78
  /* @__PURE__ */ a("div", { className: "legend-label", children: [
79
- o,
79
+ c,
80
80
  " (",
81
- p,
81
+ d,
82
82
  ")"
83
83
  ] })
84
84
  ] }),
85
- h != !1 && /* @__PURE__ */ e(U, { breaks: d, symbol: "arrow", numberFormat: u, intl: D })
85
+ p != !1 && /* @__PURE__ */ e(A, { breaks: m, symbol: "arrow", numberFormat: t, intl: D })
86
86
  ] }) });
87
87
  }, ae = (l) => {
88
88
  const {
89
- id: o,
90
- name: d,
91
- breaks: v,
92
- intl: n,
93
- pointStyleBy: c,
94
- format: s,
95
- dimension2: m,
96
- pointDimensionStyles: k = {},
97
- markFillColor: h,
98
- markBorderColor: g,
89
+ id: c,
90
+ name: m,
91
+ breaks: C,
92
+ intl: s,
93
+ pointStyleBy: u,
94
+ format: o,
95
+ dimension2: g,
96
+ pointDimensionStyles: f = {},
97
+ markFillColor: p,
98
+ markBorderColor: h,
99
99
  measures: D,
100
100
  visible: r,
101
- onItemClick: y,
102
- customMeasuresLabels: f,
103
- allCategories: u,
104
- showDim2OnLegends: p,
101
+ onItemClick: v,
102
+ customMeasuresLabels: k,
103
+ allCategories: t,
104
+ showDim2OnLegends: d,
105
105
  dim2LegendLabel: b,
106
106
  type: L,
107
107
  d2Click: x,
108
108
  selectedItem: F
109
- } = l, C = {
110
- style: s.style === "compacted" ? "decimal" : s.style,
111
- notation: s.style === "compacted" ? "compact" : "standard",
112
- currency: s.currency,
113
- minimumFractionDigits: parseInt(s.minimumFractionDigits),
114
- maximumFractionDigits: parseInt(s.maximumFractionDigits)
109
+ } = l, y = {
110
+ style: o.style === "compacted" ? "decimal" : o.style,
111
+ notation: o.style === "compacted" ? "compact" : "standard",
112
+ currency: o.currency,
113
+ minimumFractionDigits: parseInt(o.minimumFractionDigits),
114
+ maximumFractionDigits: parseInt(o.maximumFractionDigits)
115
115
  };
116
116
  let S = D[0];
117
- f && (S = f[D[0]]);
118
- const w = m && u ? u.filter((i) => i.type.toUpperCase() == m.toUpperCase()) : [], N = (w.length > 0 ? w[0].items : []).map((i) => i.value), P = c === "dimension" || p ? m : S;
117
+ k && (S = k[D[0]]);
118
+ const w = g && t ? t.filter((i) => i.type.toUpperCase() == g.toUpperCase()) : [], N = (w.length > 0 ? w[0].items : []).map((i) => i.value), P = u === "dimension" || d ? g : S;
119
119
  return /* @__PURE__ */ e("div", { className: "legend", children: /* @__PURE__ */ a("div", { children: [
120
120
  /* @__PURE__ */ a("div", { className: "legend-item", children: [
121
121
  /* @__PURE__ */ e(
122
122
  "div",
123
123
  {
124
124
  className: "legend-color legend-check",
125
- onClick: (i) => y(o),
126
- style: c === "measure" || p ? {} : {
127
- backgroundColor: h,
128
- borderColor: g
125
+ onClick: (i) => v(c),
126
+ style: u === "measure" || d ? {} : {
127
+ backgroundColor: p,
128
+ borderColor: h
129
129
  },
130
130
  children: r != !1 && /* @__PURE__ */ e($, { children: "✓" })
131
131
  }
132
132
  ),
133
133
  /* @__PURE__ */ a("div", { className: "legend-label", children: [
134
- d,
134
+ m,
135
135
  " "
136
136
  ] })
137
137
  ] }),
138
- c === "measure" && r != !1 && /* @__PURE__ */ e("div", { className: "legend-breaks", children: v.map((i, z) => /* @__PURE__ */ a("div", { className: "break", children: [
138
+ u === "measure" && r != !1 && /* @__PURE__ */ e("div", { className: "legend-breaks", children: C.map((i, z) => /* @__PURE__ */ a("div", { className: "break", children: [
139
139
  /* @__PURE__ */ e("div", { className: "break-item", style: {
140
140
  backgroundColor: i.color,
141
141
  border: `1px solid ${i.borderColor}`,
@@ -143,12 +143,12 @@ const U = ({ breaks: l, isPoint: o, numberFormat: d, intl: v }) => l.length > 0
143
143
  } }),
144
144
  /* @__PURE__ */ a("div", { className: "break-label", children: [
145
145
  " < ",
146
- n.formatNumber(i.end, C)
146
+ s.formatNumber(i.end, y)
147
147
  ] })
148
148
  ] })) }),
149
- r != !1 && p != !1 && /* @__PURE__ */ e("div", { className: "legend", children: /* @__PURE__ */ e("div", { className: "legend-item", children: /* @__PURE__ */ e("div", { className: "legend-label", children: b || P }) }) }),
150
- r != !1 && p != !1 && /* @__PURE__ */ e("div", { className: "legend-breaks", children: N.map((i) => /* @__PURE__ */ a("div", { className: "break", children: [
151
- c === "measure" ? /* @__PURE__ */ e(
149
+ r != !1 && d != !1 && /* @__PURE__ */ e("div", { className: "legend", children: /* @__PURE__ */ e("div", { className: "legend-item", children: /* @__PURE__ */ e("div", { className: "legend-label", children: b || P }) }) }),
150
+ r != !1 && d != !1 && /* @__PURE__ */ e("div", { className: "legend-breaks", children: N.map((i) => /* @__PURE__ */ a("div", { className: "break", children: [
151
+ u === "measure" ? /* @__PURE__ */ e(
152
152
  "span",
153
153
  {
154
154
  className: "break-item dim2-item"
@@ -158,8 +158,8 @@ const U = ({ breaks: l, isPoint: o, numberFormat: d, intl: v }) => l.length > 0
158
158
  {
159
159
  className: "break-item",
160
160
  style: {
161
- backgroundColor: k[i + "_color"] || h,
162
- border: `1px solid ${k[i + "_border"] || g}`,
161
+ backgroundColor: f[i + "_color"] || p,
162
+ border: `1px solid ${f[i + "_border"] || h}`,
163
163
  borderRadius: L == "dataPoints" ? "50%" : "0"
164
164
  }
165
165
  }
@@ -168,55 +168,55 @@ const U = ({ breaks: l, isPoint: o, numberFormat: d, intl: v }) => l.length > 0
168
168
  ] })) })
169
169
  ] }) });
170
170
  }, ie = (l) => {
171
- const { fillColor: o, borderColor: d, name: v, visible: n, id: c, onItemClick: s } = l;
171
+ const { fillColor: c, borderColor: m, name: C, visible: s, id: u, onItemClick: o } = l;
172
172
  return /* @__PURE__ */ e("div", { className: "legend", children: /* @__PURE__ */ a("div", { className: "legend-item", children: [
173
173
  /* @__PURE__ */ e(
174
174
  "div",
175
175
  {
176
176
  className: "legend-color legend-check",
177
- onClick: (m) => s(c),
178
- style: { backgroundColor: o, borderColor: d },
179
- children: n != !1 && /* @__PURE__ */ e($, { children: "✓" })
177
+ onClick: (g) => o(u),
178
+ style: { backgroundColor: c, borderColor: m },
179
+ children: s != !1 && /* @__PURE__ */ e($, { children: "✓" })
180
180
  }
181
181
  ),
182
- /* @__PURE__ */ e("div", { className: "legend-label", children: v })
182
+ /* @__PURE__ */ e("div", { className: "legend-label", children: C })
183
183
  ] }) });
184
184
  }, le = (l) => {
185
185
  const {
186
- markFillColor: o,
187
- fillColor: d,
188
- markSizeScale: v,
189
- markBorderColor: n,
190
- useCentroidPoint: c,
191
- name: s,
192
- useBreaks: m,
193
- useGradients: k,
194
- breaks: h,
195
- intl: g,
186
+ markFillColor: c,
187
+ fillColor: m,
188
+ markSizeScale: C,
189
+ markBorderColor: s,
190
+ useCentroidPoint: u,
191
+ name: o,
192
+ useBreaks: g,
193
+ useGradients: f,
194
+ breaks: p,
195
+ intl: h,
196
196
  usePattern: D,
197
197
  patternsData: r,
198
- patternDiscriminator: y,
199
- patternDiscriminatorLabel: f,
200
- measures: u,
201
- borderColor: p,
198
+ patternDiscriminator: v,
199
+ patternDiscriminatorLabel: k,
200
+ measures: t,
201
+ borderColor: d,
202
202
  data: b,
203
203
  app: L,
204
204
  customMeasuresLabels: x,
205
205
  divRef: F,
206
- id: C,
206
+ id: y,
207
207
  patternWidth: S = 0.35,
208
208
  patternHeight: w = 0.25,
209
- group: E,
209
+ group: j,
210
210
  format: N,
211
211
  csv: P,
212
212
  visible: i,
213
213
  onItemClick: z,
214
- gradientScheme: q,
215
- gradientReverse: A,
216
- toggleColorLayer: j,
214
+ gradientScheme: G,
215
+ gradientReverse: J,
216
+ toggleColorLayer: E,
217
217
  colorLayerVisible: B = !0,
218
- gradientStartColor: H,
219
- gradientEndColor: J
218
+ gradientStartColor: U,
219
+ gradientEndColor: q
220
220
  } = l;
221
221
  let I = "";
222
222
  const R = {
@@ -225,62 +225,62 @@ const U = ({ breaks: l, isPoint: o, numberFormat: d, intl: v }) => l.length > 0
225
225
  currency: N.currency,
226
226
  minimumFractionDigits: parseInt(N.minimumFractionDigits),
227
227
  maximumFractionDigits: parseInt(N.maximumFractionDigits)
228
- }, V = (t) => new ee({
229
- data: t.children,
230
- measure: u[0],
231
- defaultFillColor: o,
232
- gradientScheme: q,
233
- gradientReverse: A,
234
- gradientStartColor: H,
235
- gradientEndColor: J
228
+ }, T = (n) => new ee({
229
+ data: n.children,
230
+ measure: t[0],
231
+ defaultFillColor: c,
232
+ gradientScheme: G,
233
+ gradientReverse: J,
234
+ gradientStartColor: U,
235
+ gradientEndColor: q
236
236
  });
237
237
  if (L != "csv" && x)
238
- I = x[u[0]];
238
+ I = x[t[0]];
239
239
  else {
240
- const t = Q.parse(P, { header: !0, dynamicTyping: !0 });
241
- I = t.meta.fields.length > 0 ? t.meta.fields[1] : "";
240
+ const n = Q.parse(P, { header: !0, dynamicTyping: !0 });
241
+ I = n.meta.fields.length > 0 ? n.meta.fields[1] : "";
242
242
  }
243
- const M = (t) => t ? t.toString().replace(/ /g, "_").toLocaleLowerCase() : "";
243
+ const M = (n) => n ? n.toString().replace(/ /g, "_").toLocaleLowerCase() : "";
244
244
  if (F.current) {
245
- const t = F.current.querySelector(
246
- `.legend.layer_${M(C)} svg`
245
+ const n = F.current.querySelector(
246
+ `.legend.layer_${M(y)} svg`
247
247
  );
248
- t && (t.style.display = i === !1 ? "none" : "block");
248
+ n && (n.style.display = i === !1 ? "none" : "block");
249
249
  }
250
- const O = (t) => Math.min(...t.children.map((_) => _[u[0]])), T = (t) => Math.max(...t.children.map((_) => _[u[0]]));
251
- return /* @__PURE__ */ e("div", { className: `legend layer_${M(C)}`, id: M(`${E} ${s} ${C}`), children: /* @__PURE__ */ a("div", { children: [
250
+ const H = (n) => Math.min(...n.children.map((_) => _[t[0]])), O = (n) => Math.max(...n.children.map((_) => _[t[0]]));
251
+ return /* @__PURE__ */ e("div", { className: `legend layer_${M(y)}`, id: M(`${j} ${o} ${y}`), children: /* @__PURE__ */ a("div", { children: [
252
252
  /* @__PURE__ */ a("div", { className: "legend-item", children: [
253
253
  /* @__PURE__ */ e(
254
254
  "div",
255
255
  {
256
256
  className: "legend-color legend-check",
257
- onClick: (t) => z(C),
258
- style: { backgroundColor: d, borderColor: p },
257
+ onClick: (n) => z(y),
258
+ style: { backgroundColor: m, borderColor: d },
259
259
  children: i != !1 && /* @__PURE__ */ e($, { children: "✓" })
260
260
  }
261
261
  ),
262
- /* @__PURE__ */ e("div", { className: "legend-label", children: s })
262
+ /* @__PURE__ */ e("div", { className: "legend-label", children: o })
263
263
  ] }),
264
- c && !m && i != !1 && /* @__PURE__ */ e("div", { className: "legend-breaks", children: /* @__PURE__ */ a("div", { className: "break", children: [
264
+ u && !g && i != !1 && /* @__PURE__ */ e("div", { className: "legend-breaks", children: /* @__PURE__ */ a("div", { className: "break", children: [
265
265
  /* @__PURE__ */ e(
266
266
  "div",
267
267
  {
268
268
  className: `break-item point ${B ? "checked" : ""}`,
269
- onClick: (t) => j(C),
269
+ onClick: (n) => E(y),
270
270
  style: {
271
- backgroundColor: o,
272
- border: `1px solid ${n}`
271
+ backgroundColor: c,
272
+ border: `1px solid ${s}`
273
273
  }
274
274
  }
275
275
  ),
276
276
  I
277
277
  ] }) }),
278
- m && i != !1 && /* @__PURE__ */ a("div", { children: [
278
+ g && i != !1 && /* @__PURE__ */ a("div", { children: [
279
279
  /* @__PURE__ */ e("div", { className: "legend-breaks", children: /* @__PURE__ */ a(
280
280
  "div",
281
281
  {
282
282
  className: "legend-section-title",
283
- onClick: (t) => j(C),
283
+ onClick: (n) => E(y),
284
284
  children: [
285
285
  /* @__PURE__ */ e("div", { className: `legend-section-title-checkbox ${B ? "checked" : ""}` }),
286
286
  /* @__PURE__ */ e("span", { className: "measure-label", children: I })
@@ -288,25 +288,25 @@ const U = ({ breaks: l, isPoint: o, numberFormat: d, intl: v }) => l.length > 0
288
288
  }
289
289
  ) }),
290
290
  B && /* @__PURE__ */ e(
291
- U,
291
+ A,
292
292
  {
293
- isPoint: c,
293
+ isPoint: u,
294
294
  numberFormat: R,
295
- breaks: h,
295
+ breaks: p,
296
296
  visible: i,
297
- intl: g
297
+ intl: h
298
298
  }
299
299
  )
300
300
  ] }),
301
- k && b && b.children && b.children.length > 0 && i != !1 && /* @__PURE__ */ a("div", { className: "gradient-container", children: [
302
- /* @__PURE__ */ e("div", { className: "gradient-label", style: { float: "right" }, children: g.formatNumber(T(b), R) }),
303
- /* @__PURE__ */ e("div", { className: "gradient-label", style: { float: "left" }, children: g.formatNumber(O(b), R) }),
301
+ f && b && b.children && b.children.length > 0 && i != !1 && /* @__PURE__ */ a("div", { className: "gradient-container", children: [
302
+ /* @__PURE__ */ e("div", { className: "gradient-label", style: { float: "right" }, children: h.formatNumber(O(b), R) }),
303
+ /* @__PURE__ */ e("div", { className: "gradient-label", style: { float: "left" }, children: h.formatNumber(H(b), R) }),
304
304
  /* @__PURE__ */ e(
305
305
  "div",
306
306
  {
307
307
  className: "gradient-bar",
308
308
  style: {
309
- background: `linear-gradient(to right, ${V(b).getStartColor()}, ${V(b).getEndColor()})`,
309
+ background: `linear-gradient(to right, ${T(b).getStartColor()}, ${T(b).getEndColor()})`,
310
310
  width: "120px",
311
311
  height: "10px"
312
312
  }
@@ -315,42 +315,46 @@ const U = ({ breaks: l, isPoint: o, numberFormat: d, intl: v }) => l.length > 0
315
315
  ] })
316
316
  ] }) });
317
317
  }, te = (l) => {
318
- const o = W(null), [d, v] = K(!1), n = ({ size: r = 16, color: y = "currentColor" }) => /* @__PURE__ */ e(G, { name: "chevron down" }), c = ({ size: r = 16, color: y = "currentColor" }) => /* @__PURE__ */ e(G, { name: "chevron right" }), { layers: s = [], onItemClick: m, patternsData: k, group: h, intl: g, toggleColorLayer: D } = l;
319
- return /* @__PURE__ */ a("div", { className: `legends ${d ? "collapsed" : ""}`, ref: o, children: [
320
- /* @__PURE__ */ e("div", { className: "legend-collapsible-control", onClick: () => v(!d), children: d ? /* @__PURE__ */ a("div", { children: [
318
+ const c = W(null), [m, C] = K(!1), s = ({ size: r = 16, color: v = "currentColor" }) => /* @__PURE__ */ e(V, { name: "chevron down" }), u = ({ size: r = 16, color: v = "currentColor" }) => /* @__PURE__ */ e(V, { name: "chevron right" }), { layers: o = [], onItemClick: g, patternsData: f, group: p, intl: h, toggleColorLayer: D } = l;
319
+ return /* @__PURE__ */ a("div", { className: `legends ${m ? "collapsed" : ""}`, ref: c, children: [
320
+ /* @__PURE__ */ e("div", { className: "legend-collapsible-control", onClick: () => C(!m), children: m ? /* @__PURE__ */ a("div", { children: [
321
321
  " ",
322
- /* @__PURE__ */ e(c, { size: 14 }),
322
+ /* @__PURE__ */ e(u, { size: 14 }),
323
323
  " Show Legend"
324
324
  ] }) : /* @__PURE__ */ a("div", { children: [
325
- /* @__PURE__ */ e(n, { size: 14 }),
325
+ /* @__PURE__ */ e(s, { size: 14 }),
326
326
  "Hide Legend"
327
327
  ] }) }),
328
- /* @__PURE__ */ e("div", { className: "legends-content", children: s && s.map((r) => {
329
- const y = {}, f = r.filters || {};
330
- return f && f.forEach && f.forEach((u) => {
331
- u.value != null && u.value.filter((p) => p != null && p.toString().trim() != "").length > 0 && (y[u.param] = u.value);
332
- }), r.dvzProxyDatasetId && (y.dvzProxyDatasetId = r.dvzProxyDatasetId), /* @__PURE__ */ a("div", { children: [
333
- r.type == "base" && /* @__PURE__ */ e(ie, { ...r, group: h, onItemClick: m }),
328
+ /* @__PURE__ */ e("div", { className: "legends-content", children: o && o.map((r) => {
329
+ const v = {}, k = r.filters || {};
330
+ if (k && k.forEach && k.forEach((t) => {
331
+ t.value != null && t.value.filter((d) => d != null && d.toString().trim() != "").length > 0 && (v[t.param] = t.value);
332
+ }), r.dvzProxyDatasetId && (v.dvzProxyDatasetId = r.dvzProxyDatasetId), r.extraTooltipColumns && r.extraTooltipColumns.length > 0) {
333
+ const t = r.extraTooltipColumns.filter((d) => d && d !== r.apiJoinAttribute && d !== r.patternDiscriminator);
334
+ t.length > 0 && (v.includeColumns = t.join(","));
335
+ }
336
+ return /* @__PURE__ */ a("div", { children: [
337
+ r.type == "base" && /* @__PURE__ */ e(ie, { ...r, group: p, onItemClick: g }),
334
338
  r.type == "data" && r.apiJoinAttribute && /* @__PURE__ */ e(
335
339
  Y,
336
340
  {
337
341
  waitForFilters: !0,
338
342
  editing: r.editing,
339
- params: y,
343
+ params: v,
340
344
  app: r.app,
341
345
  verbose: !1,
342
346
  csv: decodeURIComponent(r.csv),
343
- group: h,
347
+ group: p,
344
348
  ignoreErrors: !0,
345
349
  isSvg: !0,
346
350
  mySelf: "Legends",
347
351
  store: [r.app, l.unique, r.id],
348
352
  source: r.apiJoinAttribute + (r.patternDiscriminator != "none" ? "/" + r.patternDiscriminator : ""),
349
- children: /* @__PURE__ */ e(Z, { children: /* @__PURE__ */ e(le, { group: h, patternsData: k ? k[r.id] : null, divRef: o, ...r, intl: l.intl, onItemClick: m, toggleColorLayer: D }) })
353
+ children: /* @__PURE__ */ e(Z, { children: /* @__PURE__ */ e(le, { group: p, patternsData: f ? f[r.id] : null, divRef: c, ...r, intl: l.intl, onItemClick: g, toggleColorLayer: D }) })
350
354
  }
351
355
  ),
352
- r.type == "dataPoints" && /* @__PURE__ */ e(ae, { selectedItem: l.selectedItem, d2Click: l.d2Click, intl: l.intl, group: h, ...r, onItemClick: m }),
353
- r.type == "flow" && /* @__PURE__ */ e(re, { group: h, ...r, onItemClick: m, intl: l.intl })
356
+ r.type == "dataPoints" && /* @__PURE__ */ e(ae, { selectedItem: l.selectedItem, d2Click: l.d2Click, intl: l.intl, group: p, ...r, onItemClick: g }),
357
+ r.type == "flow" && /* @__PURE__ */ e(re, { group: p, ...r, onItemClick: g, intl: l.intl })
354
358
  ] }, r.id);
355
359
  }) })
356
360
  ] });
@@ -1,28 +1,72 @@
1
- import { jsx as m } from "react/jsx-runtime";
1
+ import { jsx as d } from "react/jsx-runtime";
2
2
  import "react";
3
3
  import g from "string-template";
4
- const x = /(\+?\%)[\(]([A-z0-9,.,-]+)\)/gi, d = /(\+?\#)[\(]([A-z0-9,.,-]+)\)/gi, y = /(\+?\#C)[\(]([A-z0-9,.,-]+)\)/gi, a = (o, e, r, t, l, h) => {
5
- let n, s = e;
6
- for (; (n = o.exec(e)) !== null; ) {
7
- const p = n[2], c = n[1], u = ((i, f = 2) => l.formatNumber(t ? i / 100 : i, {
8
- maximumFractionDigits: f,
9
- ...r,
10
- signDisplay: c && c.startsWith("+") ? "never" : "auto"
11
- })).apply(void 0, p.split(","));
12
- s = s.replaceAll(n[0], u);
4
+ const b = /(\+?\%)[\(]([A-z0-9,.,-]+)\)/gi, h = /(\+?\#)[\(]([A-z0-9,.,-]+)\)/gi, x = /(\+?\#C)[\(]([A-z0-9,.,-]+)\)/gi, S = /(\$)[\(]([A-Za-z0-9,.]+)\)/gi, A = [
5
+ {
6
+ name: "USD Dollar",
7
+ code: "USD",
8
+ symbol: "$"
9
+ },
10
+ {
11
+ name: "Naira",
12
+ code: "NGN",
13
+ symbol: "₦"
14
+ },
15
+ {
16
+ name: "South Africa Rand",
17
+ code: "ZAR",
18
+ symbol: "R"
19
+ },
20
+ {
21
+ name: "Ethiopian Birr",
22
+ code: "ETB",
23
+ symbol: "Br"
24
+ },
25
+ {
26
+ name: "Zambian Kwacha",
27
+ code: "ZMW",
28
+ symbol: "ZK"
29
+ },
30
+ {
31
+ name: "Kenyan Shilling",
32
+ code: "KES",
33
+ symbol: "KSh"
13
34
  }
35
+ ], l = (t) => t && t.trim().toLowerCase(), E = (t, n) => {
36
+ let o, s = n;
37
+ for (; (o = t.exec(n)) !== null; )
38
+ if (o.length > 2) {
39
+ const a = o[0], c = o[2], e = A.find((r) => l(r.code) == l(c) || l(r.name) == l(c) || l(r.symbol) == l(c));
40
+ e && (s = s.replaceAll(a, e.symbol));
41
+ }
14
42
  return s;
15
- }, A = (o, e, r) => {
16
- let t = g(o, { ...e, ...e.meta }).replace(/(?:\r\n|\r|\n)/g, "<br>");
17
- return t = a(x, t, { style: "percent" }, !0, r), t = a(d, t, { style: "decimal" }, !1, r), t = a(y, t, { notation: "compact" }, !1, r), t;
18
- }, C = ({ tooltip: o, data: e, intl: r }) => {
19
- if (e) {
20
- const t = A(o, e, r);
21
- return /* @__PURE__ */ m("div", { dangerouslySetInnerHTML: { __html: t } });
43
+ }, p = (t, n, o, s, a, c) => {
44
+ let e, r = n;
45
+ for (; (e = t.exec(n)) !== null; ) {
46
+ const i = e[2], m = e[1], y = ((u, f = 2) => a.formatNumber(s ? u / 100 : u, {
47
+ maximumFractionDigits: f,
48
+ ...o,
49
+ signDisplay: m && m.startsWith("+") ? "never" : "auto"
50
+ })).apply(void 0, i.split(","));
51
+ r = r.replaceAll(e[0], y);
52
+ }
53
+ return r;
54
+ }, z = (t, n, o) => {
55
+ const s = { ...n, ...n.meta }, a = {};
56
+ Object.keys(s).forEach((r) => {
57
+ a[r] = s[r], a[r.replace(/\s+/g, "_")] = s[r];
58
+ });
59
+ const c = t.replace(/\{([^}]+)\}/g, (r, i) => `{${i.replace(/\s+/g, "_")}}`);
60
+ let e = g(c, a).replace(/(?:\r\n|\r|\n)/g, "<br>");
61
+ return e = p(b, e, { style: "percent" }, !0, o), e = p(h, e, { style: "decimal" }, !1, o), e = p(x, e, { notation: "compact" }, !1, o), e = E(S, e), e;
62
+ }, Z = ({ tooltip: t, data: n, intl: o }) => {
63
+ if (n) {
64
+ const s = z(t, n, o);
65
+ return /* @__PURE__ */ d("div", { dangerouslySetInnerHTML: { __html: s } });
22
66
  } else
23
- return /* @__PURE__ */ m("div", {});
67
+ return /* @__PURE__ */ d("div", {});
24
68
  };
25
69
  export {
26
- C as default,
27
- A as formatContent
70
+ Z as default,
71
+ z as formatContent
28
72
  };
@@ -1,15 +1,29 @@
1
- import * as a from "d3";
2
- const n = {}, o = {}, u = 3 * 60 * 1e3, r = (t) => JSON.parse(JSON.stringify(t)), l = (t) => {
3
- const i = Date.now(), e = t;
4
- if (n[e])
5
- return n[e].then(r);
6
- if (o[e] && i - o[e].timestamp < u)
7
- return Promise.resolve(r(o[e].data));
8
- const s = a.json(t).then((c) => (o[e] = { data: c, timestamp: Date.now() }, c)).finally(() => {
9
- delete n[e];
1
+ import * as l from "d3";
2
+ const u = "_Color_", i = ["value", "count", "type", "children", "label", "measure"], d = (e) => {
3
+ const n = {};
4
+ return e && (Object.keys(e).forEach((r) => {
5
+ i.includes(r) || (n[r] = e[r]);
6
+ }), e.type && e.value !== void 0 && (n[e.type] = e.value)), n;
7
+ }, f = (e) => {
8
+ let n = d(e);
9
+ return e && e.children && Array.isArray(e.children) && e.children.forEach((r) => {
10
+ n = { ...n, ...f(r) };
11
+ }), n;
12
+ }, v = (e, n) => !e || !n ? null : e[(u + n).trim()] || null, t = {}, o = {}, p = 3 * 60 * 1e3, s = (e) => JSON.parse(JSON.stringify(e)), h = (e) => {
13
+ const n = Date.now(), r = e;
14
+ if (t[r])
15
+ return t[r].then(s);
16
+ if (o[r] && n - o[r].timestamp < p)
17
+ return Promise.resolve(s(o[r].data));
18
+ const a = l.json(e).then((c) => (o[r] = { data: c, timestamp: Date.now() }, c)).finally(() => {
19
+ delete t[r];
10
20
  });
11
- return n[e] = s, s.then(r);
12
- }, m = (t) => l(t);
21
+ return t[r] = a, a.then(s);
22
+ }, y = (e) => h(e);
13
23
  export {
14
- m as loadJSON
24
+ u as COLOR_VARIABLE,
25
+ d as extractVariables,
26
+ f as extractVariablesDeep,
27
+ y as loadJSON,
28
+ v as resolveOverrideColor
15
29
  };