@devgateway/dvz-ui-react 1.9.1 → 1.9.3

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 (38) hide show
  1. package/dist/cjs/embeddable/big-number-trend/BigNumberTrendContainer.js +1 -1
  2. package/dist/cjs/embeddable/chart/Line.js +1 -1
  3. package/dist/cjs/embeddable/data-paragraph/index.js +1 -1
  4. package/dist/cjs/embeddable/filter/index.js +1 -1
  5. package/dist/cjs/embeddable/grouped-bars/GroupedBars.js +1 -1
  6. package/dist/cjs/embeddable/newsletter/index.js +1 -1
  7. package/dist/cjs/embeddable/sankeychart/index.js +1 -1
  8. package/dist/cjs/embeddable/showcase/index.js +1 -1
  9. package/dist/cjs/embeddable/tabbedposts/index.js +1 -1
  10. package/dist/cjs/embeddable/utils/parseUtils.js +1 -1
  11. package/dist/cjs/index.js +1 -1
  12. package/dist/cjs/tracker/InternalTrafficToggle.js +1 -1
  13. package/dist/cjs/tracker/InternalTrafficWatermark.js +1 -1
  14. package/dist/cjs/tracker/index.js +1 -1
  15. package/dist/cjs/tracker/internalTrafficUtils.js +1 -1
  16. package/dist/cjs/tracker/useInternalTrafficBypass.js +1 -1
  17. package/dist/esm/embeddable/big-number-trend/BigNumberTrendContainer.js +79 -79
  18. package/dist/esm/embeddable/chart/Line.js +209 -207
  19. package/dist/esm/embeddable/data-paragraph/index.js +119 -119
  20. package/dist/esm/embeddable/filter/index.js +113 -113
  21. package/dist/esm/embeddable/grouped-bars/GroupedBars.js +320 -316
  22. package/dist/esm/embeddable/newsletter/index.js +35 -38
  23. package/dist/esm/embeddable/sankeychart/index.js +145 -145
  24. package/dist/esm/embeddable/showcase/index.js +27 -27
  25. package/dist/esm/embeddable/tabbedposts/index.js +40 -39
  26. package/dist/esm/embeddable/utils/parseUtils.js +11 -3
  27. package/dist/esm/index.js +74 -73
  28. package/dist/esm/tracker/InternalTrafficToggle.js +30 -20
  29. package/dist/esm/tracker/InternalTrafficWatermark.js +42 -52
  30. package/dist/esm/tracker/index.js +9 -8
  31. package/dist/esm/tracker/internalTrafficUtils.js +18 -13
  32. package/dist/esm/tracker/useInternalTrafficBypass.js +13 -31
  33. package/dist/types/embeddable/chart/Line.d.ts +2 -0
  34. package/dist/types/tracker/InternalTrafficToggle.d.ts +1 -4
  35. package/dist/types/tracker/InternalTrafficWatermark.d.ts +0 -10
  36. package/dist/types/tracker/internalTrafficUtils.d.ts +1 -14
  37. package/dist/types/tracker/useInternalTrafficBypass.d.ts +4 -10
  38. package/package.json +1 -1
@@ -1,25 +1,25 @@
1
- import { jsx as m, jsxs as A, Fragment as ze } from "react/jsx-runtime";
1
+ import { jsx as m, jsxs as B, Fragment as Ae } from "react/jsx-runtime";
2
2
  import { useRef as be, useState as ve } from "react";
3
- import { Container as Ae } from "semantic-ui-react";
4
- import Be from "../data/DataProvider.js";
5
- import Le from "../data/DataConsumer.js";
6
- import { connect as Te } from "react-redux";
3
+ import { Container as Be } from "semantic-ui-react";
4
+ import Le from "../data/DataProvider.js";
5
+ import Te from "../data/DataConsumer.js";
6
+ import { connect as _e } from "react-redux";
7
7
  import { alphaSort as xe } from "../utils/common.js";
8
- import { formatContent as _e } from "../common/ChartTooltip.js";
9
- const He = "No data matches your selection", Re = "-", Ee = "#5a5d68", Ue = "none", $e = 14, ke = "#3182ce", Ve = "none", de = 24, R = (o, l) => l ? o : decodeURIComponent(o), ne = (o, l) => {
8
+ import { formatContent as Ee } from "../common/ChartTooltip.js";
9
+ const Re = "No data matches your selection", He = "-", Ue = "#5a5d68", $e = "none", ke = 14, Ve = "#3182ce", Oe = "none", de = 24, $ = (r, n) => n ? r : decodeURIComponent(r), le = (r, n) => {
10
10
  try {
11
- return JSON.parse(R(o, l));
11
+ return JSON.parse($(r, n));
12
12
  } catch (s) {
13
- return console.error("Error parsing value:", o, s), null;
13
+ return console.error("Error parsing value:", r, s), null;
14
14
  }
15
- }, we = (o) => o ? {
16
- style: o.style === "compacted" ? "decimal" : o.style,
17
- notation: o.style === "compacted" ? "compact" : "standard",
18
- currency: o.currency,
19
- minimumFractionDigits: parseInt(o.minimumFractionDigits, 10),
20
- maximumFractionDigits: parseInt(o.maximumFractionDigits, 10),
21
- prefix: o.prefix || "",
22
- suffix: o.suffix || ""
15
+ }, we = (r) => r ? {
16
+ style: r.style === "compacted" ? "decimal" : r.style,
17
+ notation: r.style === "compacted" ? "compact" : "standard",
18
+ currency: r.currency,
19
+ minimumFractionDigits: parseInt(r.minimumFractionDigits, 10),
20
+ maximumFractionDigits: parseInt(r.maximumFractionDigits, 10),
21
+ prefix: r.prefix || "",
22
+ suffix: r.suffix || ""
23
23
  } : {
24
24
  notation: "standard",
25
25
  currency: "USD",
@@ -27,120 +27,120 @@ const He = "No data matches your selection", Re = "-", Ee = "#5a5d68", Ue = "non
27
27
  maximumFractionDigits: 2,
28
28
  prefix: "",
29
29
  suffix: ""
30
- }, Oe = (o, l, s, b = !0) => {
30
+ }, Ge = (r, n, s, x = !0) => {
31
31
  const i = [];
32
- if (!o) return i;
33
- const f = o[s];
34
- if (f && typeof f == "object" && Object.entries(f).forEach(([p, w]) => {
35
- if (w && w.selected) {
36
- const E = b ? we(w.format || l) : l, I = w && typeof w.customLabel == "string" && w.customLabel.trim().length > 0 ? w.customLabel.trim() : p;
37
- i.push({ name: p, format: E, label: I });
32
+ if (!r) return i;
33
+ const f = r[s];
34
+ if (f && typeof f == "object" && Object.entries(f).forEach(([p, M]) => {
35
+ if (M && M.selected) {
36
+ const k = x ? we(M.format || n) : n, D = M && typeof M.customLabel == "string" && M.customLabel.trim().length > 0 ? M.customLabel.trim() : p;
37
+ i.push({ name: p, format: k, label: D });
38
38
  }
39
39
  }), i.length === 0) {
40
- const p = (Array.isArray(o), o[0]);
41
- p && i.push({ name: p, format: l, label: p });
40
+ const p = (Array.isArray(r), r[0]);
41
+ p && i.push({ name: p, format: n, label: p });
42
42
  }
43
43
  return i;
44
- }, Ge = (o, l) => {
45
- const s = {}, b = o || [];
46
- return b.forEach && b.forEach((i) => {
44
+ }, We = (r, n) => {
45
+ const s = {}, x = r || [];
46
+ return x.forEach && x.forEach((i) => {
47
47
  var f;
48
48
  ((f = i.value) == null ? void 0 : f.filter((p) => p != null && p.toString().trim() !== "").length) > 0 && (s[i.param] = i.value);
49
- }), l && (s.dvzProxyDatasetId = l), s;
50
- }, Pe = (o) => {
51
- const l = [];
52
- return o && o !== "none" && l.push(o), l;
49
+ }), n && (s.dvzProxyDatasetId = n), s;
50
+ }, Pe = (r) => {
51
+ const n = [];
52
+ return r && r !== "none" && n.push(r), n;
53
53
  }, Ze = ({
54
- lineColor: o,
55
- textColor: l = "#ffffff",
54
+ lineColor: r,
55
+ textColor: n = "#ffffff",
56
56
  fontSizePx: s = "14px",
57
- showLabel: b = !1,
57
+ showLabel: x = !1,
58
58
  label: i = "",
59
59
  showValue: f = !1,
60
60
  valueString: p = ""
61
- }) => /* @__PURE__ */ A("div", { style: { display: "flex", alignItems: "center", height: "100%" }, children: [
61
+ }) => /* @__PURE__ */ B("div", { style: { display: "flex", alignItems: "center", height: "100%" }, children: [
62
62
  /* @__PURE__ */ m(
63
63
  "div",
64
64
  {
65
65
  className: "grouped-bar-zero-line",
66
66
  style: {
67
67
  width: "2px",
68
- backgroundColor: o,
68
+ backgroundColor: r,
69
69
  height: "100%"
70
70
  }
71
71
  }
72
72
  ),
73
- b && /* @__PURE__ */ m("span", { style: {
74
- color: l,
73
+ x && /* @__PURE__ */ m("span", { style: {
74
+ color: n,
75
75
  fontSize: s,
76
76
  fontWeight: "500",
77
77
  whiteSpace: "nowrap",
78
78
  marginLeft: "8px"
79
79
  }, children: i }),
80
80
  f && /* @__PURE__ */ m("span", { style: {
81
- color: l,
81
+ color: n,
82
82
  fontSize: s,
83
83
  fontWeight: "500",
84
84
  whiteSpace: "nowrap",
85
- marginLeft: b ? "6px" : "8px"
85
+ marginLeft: x ? "6px" : "8px"
86
86
  }, children: p })
87
- ] }), We = ({ textColor: o, message: l = "No data to display" }) => /* @__PURE__ */ m("div", { className: "grouped-bars-data-frame", children: /* @__PURE__ */ m("div", { className: "no-data-text", style: { color: o }, children: l }) }), je = ({
88
- dimensionValue: o,
89
- measureEntries: l,
87
+ ] }), je = ({ textColor: r, message: n = "No data to display" }) => /* @__PURE__ */ m("div", { className: "grouped-bars-data-frame", children: /* @__PURE__ */ m("div", { className: "no-data-text", style: { color: r }, children: n }) }), Je = ({
88
+ dimensionValue: r,
89
+ measureEntries: n,
90
90
  mainEntry: s,
91
- barBackgroundColor: b,
91
+ barBackgroundColor: x,
92
92
  textColor: i,
93
93
  measureTextColor: f,
94
94
  fontSize: p,
95
- mainValueFontSize: w,
96
- labelPosition: E,
97
- labelWidth: I,
98
- labelHeight: U,
99
- labelFormat: $,
100
- vars: k,
101
- intl: B,
102
- valuePosition: L,
103
- format: y,
104
- showMeasureLabels: V = !1
95
+ mainValueFontSize: M,
96
+ labelPosition: k,
97
+ labelWidth: D,
98
+ labelHeight: N,
99
+ labelFormat: V,
100
+ vars: O,
101
+ intl: L,
102
+ valuePosition: _,
103
+ format: z,
104
+ showMeasureLabels: G = !1
105
105
  }) => {
106
- var S, j;
107
- const T = {
106
+ var F, T;
107
+ const E = {
108
108
  fontSize: p + "px",
109
109
  color: i,
110
- width: `${I}%`,
111
- flex: `0 0 ${I}%`,
110
+ width: `${D}%`,
111
+ flex: `0 0 ${D}%`,
112
112
  whiteSpace: "normal",
113
113
  wordBreak: "break-word",
114
114
  overflow: "hidden",
115
115
  lineHeight: "1.2",
116
116
  display: "flex",
117
117
  alignItems: "center",
118
- height: U + "px"
119
- }, W = decodeURIComponent($ || ""), _ = _e(W, k || { value: o }, B), O = Array.isArray(l) && l.length === 1 && !s, G = L === "top" && O ? /* @__PURE__ */ A(
118
+ height: N + "px"
119
+ }, J = decodeURIComponent(V || ""), R = Ee(J, O || { value: r }, L), W = Array.isArray(n) && n.length === 1 && !s, P = _ === "top" && W ? /* @__PURE__ */ B(
120
120
  "div",
121
121
  {
122
122
  className: "grouped-bar-measure",
123
123
  style: {
124
- fontSize: (w || de) + "px",
124
+ fontSize: (M || de) + "px",
125
125
  color: i,
126
126
  whiteSpace: "nowrap",
127
127
  flex: "1",
128
128
  textAlign: "right"
129
129
  },
130
130
  children: [
131
- y.prefix,
132
- new Intl.NumberFormat(B.locale, y).format(l[0].value),
133
- y.suffix
131
+ z.prefix,
132
+ new Intl.NumberFormat(L.locale, z).format(n[0].value),
133
+ z.suffix
134
134
  ]
135
135
  }
136
- ) : null, P = /* @__PURE__ */ m("div", { style: { flex: "1", display: "flex", flexDirection: "column", gap: "6px", minWidth: 0 }, children: l.map((c, Q) => {
137
- var Z, C, J, N;
136
+ ) : null, Z = /* @__PURE__ */ m("div", { style: { flex: "1", display: "flex", flexDirection: "column", gap: "6px", minWidth: 0 }, children: n.map((c, Y) => {
137
+ var j, y, K, I;
138
138
  return /* @__PURE__ */ m(
139
139
  "div",
140
140
  {
141
141
  className: "grouped-bar-bar-container",
142
142
  style: {
143
- backgroundColor: b,
143
+ backgroundColor: x,
144
144
  height: "28px",
145
145
  borderRadius: "8px",
146
146
  overflow: "hidden",
@@ -161,12 +161,12 @@ const He = "No data matches your selection", Re = "-", Ee = "#5a5d68", Ue = "non
161
161
  paddingLeft: "8px",
162
162
  paddingRight: "8px"
163
163
  },
164
- children: /* @__PURE__ */ A("span", { style: { color: f || "#ffffff", fontSize: p + "px", fontWeight: "500", whiteSpace: "nowrap" }, children: [
165
- V ? /* @__PURE__ */ A(ze, { children: [
164
+ children: /* @__PURE__ */ B("span", { style: { color: f || "#ffffff", fontSize: p + "px", fontWeight: "500", whiteSpace: "nowrap" }, children: [
165
+ G ? /* @__PURE__ */ B(Ae, { children: [
166
166
  c.label || c.name,
167
167
  c.label && c.label !== c.name ? " " : ": "
168
168
  ] }) : null,
169
- L === "bar" ? `${((Z = c.format) == null ? void 0 : Z.prefix) || ""}${new Intl.NumberFormat(B.locale, c.format || y).format(c.value)}${((C = c.format) == null ? void 0 : C.suffix) || ""}` : `${(c.width || 0).toFixed(1)}%`
169
+ _ === "bar" ? `${((j = c.format) == null ? void 0 : j.prefix) || ""}${new Intl.NumberFormat(L.locale, c.format || z).format(c.value)}${((y = c.format) == null ? void 0 : y.suffix) || ""}` : `${(c.width || 0).toFixed(1)}%`
170
170
  ] })
171
171
  }
172
172
  ) : /* @__PURE__ */ m(
@@ -175,22 +175,22 @@ const He = "No data matches your selection", Re = "-", Ee = "#5a5d68", Ue = "non
175
175
  lineColor: c.color,
176
176
  textColor: f || "#ffffff",
177
177
  fontSizePx: p + "px",
178
- showLabel: !!V,
178
+ showLabel: !!G,
179
179
  label: c.label || c.name,
180
180
  showValue: !0,
181
- valueString: `${((J = c.format) == null ? void 0 : J.prefix) || ""}${new Intl.NumberFormat(B.locale, c.format || y).format(c.value)}${((N = c.format) == null ? void 0 : N.suffix) || ""}`
181
+ valueString: `${((K = c.format) == null ? void 0 : K.prefix) || ""}${new Intl.NumberFormat(L.locale, c.format || z).format(c.value)}${((I = c.format) == null ? void 0 : I.suffix) || ""}`
182
182
  }
183
183
  )
184
184
  },
185
- `${o}-${c.name}-${Q}`
185
+ `${r}-${c.name}-${Y}`
186
186
  );
187
- }) }), H = s ? /* @__PURE__ */ A(
187
+ }) }), H = s ? /* @__PURE__ */ B(
188
188
  "div",
189
189
  {
190
190
  className: "grouped-bar-main",
191
191
  style: {
192
192
  flex: "0 0 140px",
193
- backgroundColor: s.color || b,
193
+ backgroundColor: s.color || x,
194
194
  borderRadius: "8px",
195
195
  padding: "10px",
196
196
  display: "flex",
@@ -200,16 +200,16 @@ const He = "No data matches your selection", Re = "-", Ee = "#5a5d68", Ue = "non
200
200
  minWidth: 0
201
201
  },
202
202
  children: [
203
- /* @__PURE__ */ A("span", { style: {
203
+ /* @__PURE__ */ B("span", { style: {
204
204
  color: f || i,
205
- fontSize: (w || de) + "px",
205
+ fontSize: (M || de) + "px",
206
206
  fontWeight: 600,
207
207
  lineHeight: 1,
208
208
  whiteSpace: "nowrap"
209
209
  }, children: [
210
- ((S = s.format) == null ? void 0 : S.prefix) || "",
211
- new Intl.NumberFormat(B.locale, s.format || y).format(s.value),
212
- ((j = s.format) == null ? void 0 : j.suffix) || ""
210
+ ((F = s.format) == null ? void 0 : F.prefix) || "",
211
+ new Intl.NumberFormat(L.locale, s.format || z).format(s.value),
212
+ ((T = s.format) == null ? void 0 : T.suffix) || ""
213
213
  ] }),
214
214
  /* @__PURE__ */ m("span", { style: {
215
215
  color: f || i,
@@ -223,315 +223,319 @@ const He = "No data matches your selection", Re = "-", Ee = "#5a5d68", Ue = "non
223
223
  ]
224
224
  }
225
225
  ) : null;
226
- return E === "left" ? /* @__PURE__ */ m("div", { className: "grouped-bar-item", style: { marginBottom: "12px" }, children: /* @__PURE__ */ A("div", { style: { display: "flex", alignItems: "flex-start", gap: "12px" }, children: [
227
- /* @__PURE__ */ m("div", { className: "grouped-bar-label", style: T, dangerouslySetInnerHTML: { __html: _ } }),
226
+ return k === "left" ? /* @__PURE__ */ m("div", { className: "grouped-bar-item", style: { marginBottom: "12px" }, children: /* @__PURE__ */ B("div", { style: { display: "flex", alignItems: "flex-start", gap: "12px" }, children: [
227
+ /* @__PURE__ */ m("div", { className: "grouped-bar-label", style: E, dangerouslySetInnerHTML: { __html: R } }),
228
228
  H,
229
- P
230
- ] }) }) : /* @__PURE__ */ A("div", { className: "grouped-bar-item", style: { marginBottom: "12px" }, children: [
231
- /* @__PURE__ */ A("div", { style: { display: "flex", alignItems: "flex-start", gap: "12px", marginBottom: "6px" }, children: [
232
- /* @__PURE__ */ m("div", { className: "grouped-bar-label", style: T, dangerouslySetInnerHTML: { __html: _ } }),
233
- G
229
+ Z
230
+ ] }) }) : /* @__PURE__ */ B("div", { className: "grouped-bar-item", style: { marginBottom: "12px" }, children: [
231
+ /* @__PURE__ */ B("div", { style: { display: "flex", alignItems: "flex-start", gap: "12px", marginBottom: "6px" }, children: [
232
+ /* @__PURE__ */ m("div", { className: "grouped-bar-label", style: E, dangerouslySetInnerHTML: { __html: R } }),
233
+ P
234
234
  ] }),
235
- /* @__PURE__ */ A("div", { style: { display: "flex", alignItems: "stretch", gap: "12px" }, children: [
235
+ /* @__PURE__ */ B("div", { style: { display: "flex", alignItems: "stretch", gap: "12px" }, children: [
236
236
  H,
237
- P
237
+ Z
238
238
  ] })
239
239
  ] });
240
- }, Je = (o) => {
240
+ }, Ke = (r) => {
241
241
  const {
242
- app: l,
242
+ app: n,
243
243
  measure: s,
244
- dimension1: b,
244
+ dimension1: x,
245
245
  data: i,
246
246
  format: f,
247
247
  textColor: p,
248
- measureTextColor: w,
249
- fontSize: E,
250
- mainValueFontSize: I,
251
- intl: U,
252
- manualColors: $,
253
- defaultBarColor: k,
254
- barBackgroundColor: B,
255
- labelPosition: L,
256
- valuePosition: y,
257
- labelWidth: V,
258
- labelHeight: T,
259
- labelFormat: W,
260
- sorting: _,
261
- sortDirection: O,
262
- topN: G,
263
- barSizeCriteria: P,
248
+ measureTextColor: M,
249
+ fontSize: k,
250
+ mainValueFontSize: D,
251
+ intl: N,
252
+ manualColors: V,
253
+ defaultBarColor: O,
254
+ barBackgroundColor: L,
255
+ labelPosition: _,
256
+ valuePosition: z,
257
+ labelWidth: G,
258
+ labelHeight: E,
259
+ labelFormat: J,
260
+ sorting: R,
261
+ sortDirection: W,
262
+ topN: P,
263
+ barSizeCriteria: Z,
264
264
  selectedMeasures: H,
265
- mainMeasureName: S,
266
- sortMeasureName: j,
265
+ mainMeasureName: F,
266
+ sortMeasureName: T,
267
267
  barSizeUseGroup: c = !1,
268
- showMeasureLabels: Q = !1,
269
- onHeightChange: Z
270
- } = o, C = be({ last: null, timer: null }), J = () => {
268
+ showMeasureLabels: Y = !1,
269
+ onHeightChange: j
270
+ } = r, y = be({ last: null, timer: null }), K = () => {
271
271
  if (!i) return { dataItems: [], measureField: null, dimensionField: null };
272
- if (l === "csv") {
273
- const { data: e, meta: { fields: t } } = i, r = t[0], a = t[1];
274
- return { dataItems: i.data.map((h) => ({
275
- value: h[r],
276
- [a]: h[a],
277
- [r]: h[r]
278
- })), measureField: a, dimensionField: r };
272
+ if (n === "csv") {
273
+ const { data: e, meta: { fields: t } } = i, o = t[0], a = t[1];
274
+ return { dataItems: i.data.map((C) => ({
275
+ value: C[o],
276
+ [a]: C[a],
277
+ [o]: C[o]
278
+ })), measureField: a, dimensionField: o };
279
279
  } else {
280
- const e = i.children || [], t = s, r = b;
280
+ const e = i.children || [], t = s, o = x;
281
281
  return { dataItems: e.map((u) => ({
282
282
  value: u.value,
283
283
  [t]: u[t],
284
- [r]: u.value,
284
+ [o]: u.value,
285
285
  vars: { ...u }
286
- })), measureField: t, dimensionField: r };
286
+ })), measureField: t, dimensionField: o };
287
287
  }
288
- }, { dataItems: N, measureField: K, dimensionField: D } = J(), g = H && H.length > 0 ? H : K ? [{ name: K, format: f }] : s ? [{ name: s, format: f }] : [];
289
- let x;
290
- if (_ === "measure") {
291
- const e = S || j || K || (g[0] ? g[0].name : null);
292
- x = N.sort((t, r) => {
293
- const a = e ? (t.vars && t.vars[e]) ?? t[e] ?? 0 : 0, u = e ? (r.vars && r.vars[e]) ?? r[e] ?? 0 : 0;
294
- return O === "asc" ? a - u : u - a;
288
+ }, { dataItems: I, measureField: X, dimensionField: A } = K(), h = H && H.length > 0 ? H : X ? [{ name: X, format: f }] : s ? [{ name: s, format: f }] : [];
289
+ let v;
290
+ if (R === "measure") {
291
+ const e = F || T || X || (h[0] ? h[0].name : null);
292
+ v = I.sort((t, o) => {
293
+ const a = e ? (t.vars && t.vars[e]) ?? t[e] ?? 0 : 0, u = e ? (o.vars && o.vars[e]) ?? o[e] ?? 0 : 0;
294
+ return W === "asc" ? a - u : u - a;
295
295
  });
296
- } else _ === "dimension" ? x = N.sort((e, t) => O === "asc" ? xe(!1, U.locale, e.value, t.value) : xe(!0, U.locale, e.value, t.value)) : x = N;
297
- if (G && !isNaN(parseInt(G))) {
298
- const e = parseInt(G);
296
+ } else R === "dimension" ? v = I.sort((e, t) => W === "asc" ? xe(!1, N.locale, e.value, t.value) : xe(!0, N.locale, e.value, t.value)) : v = I;
297
+ if (P && !isNaN(parseInt(P))) {
298
+ const e = parseInt(P);
299
299
  if (e > 0)
300
- if (g.length <= 1)
301
- x = x.slice(0, e);
302
- else if (S) {
303
- const t = [...N].sort((a, u) => {
304
- const h = ((a.vars && a.vars[S]) ?? a[S] ?? 0) || 0;
305
- return (((u.vars && u.vars[S]) ?? u[S] ?? 0) || 0) - h;
306
- }), r = new Set(
307
- t.slice(0, e).map((a) => a[D])
300
+ if (h.length <= 1)
301
+ v = v.slice(0, e);
302
+ else if (F) {
303
+ const t = [...I].sort((a, u) => {
304
+ const C = ((a.vars && a.vars[F]) ?? a[F] ?? 0) || 0;
305
+ return (((u.vars && u.vars[F]) ?? u[F] ?? 0) || 0) - C;
306
+ }), o = new Set(
307
+ t.slice(0, e).map((a) => a[A])
308
308
  );
309
- x = x.filter((a) => r.has(a[D]));
309
+ v = v.filter((a) => o.has(a[A]));
310
310
  } else {
311
- const t = [...N].sort((a, u) => {
312
- const h = g.reduce((n, v) => {
313
- const d = ((a.vars && a.vars[v.name]) ?? a[v.name] ?? 0) || 0;
314
- return n + d;
311
+ const t = [...I].sort((a, u) => {
312
+ const C = h.reduce((l, b) => {
313
+ const d = ((a.vars && a.vars[b.name]) ?? a[b.name] ?? 0) || 0;
314
+ return l + d;
315
315
  }, 0);
316
- return g.reduce((n, v) => {
317
- const d = ((u.vars && u.vars[v.name]) ?? u[v.name] ?? 0) || 0;
318
- return n + d;
319
- }, 0) - h;
320
- }), r = new Set(
321
- t.slice(0, e).map((a) => a[D])
316
+ return h.reduce((l, b) => {
317
+ const d = ((u.vars && u.vars[b.name]) ?? u[b.name] ?? 0) || 0;
318
+ return l + d;
319
+ }, 0) - C;
320
+ }), o = new Set(
321
+ t.slice(0, e).map((a) => a[A])
322
322
  );
323
- x = x.filter((a) => r.has(a[D]));
323
+ v = v.filter((a) => o.has(a[A]));
324
324
  }
325
325
  }
326
- const Y = {};
327
- g.forEach((e) => {
328
- Y[e.name] = x.reduce((t, r) => {
329
- const a = (r.vars && r.vars[e.name]) ?? r[e.name] ?? 0;
326
+ const ee = {};
327
+ h.forEach((e) => {
328
+ ee[e.name] = v.reduce((t, o) => {
329
+ const a = (o.vars && o.vars[e.name]) ?? o[e.name] ?? 0;
330
330
  return t + (a || 0);
331
331
  }, 0);
332
332
  });
333
- const X = Math.max(
333
+ const q = Math.max(
334
334
  0,
335
- ...g.flatMap((e) => x.map((t) => (t.vars && t.vars[e.name]) ?? t[e.name] ?? 0))
336
- ), se = Object.values(Y).reduce((e, t) => e + t, 0), ee = {};
337
- x.forEach((e) => {
338
- const t = e[D];
339
- ee[t] = 0, g.forEach((r) => {
340
- const a = (e.vars && e.vars[r.name]) ?? e[r.name] ?? 0;
341
- ee[t] += a || 0;
335
+ ...h.flatMap((e) => v.map((t) => (t.vars && t.vars[e.name]) ?? t[e.name] ?? 0))
336
+ ), se = Object.values(ee).reduce((e, t) => e + t, 0), ae = {};
337
+ v.forEach((e) => {
338
+ const t = e[A];
339
+ ae[t] = 0, h.forEach((o) => {
340
+ const a = (e.vars && e.vars[o.name]) ?? e[o.name] ?? 0;
341
+ ae[t] += a || 0;
342
342
  });
343
343
  });
344
- const oe = {};
345
- if (x.forEach((e) => {
346
- const t = e[D], r = g.map((a) => ((e.vars && e.vars[a.name]) ?? e[a.name] ?? 0) || 0);
347
- oe[t] = r.length > 0 ? Math.max(...r) : 0;
348
- }), x.length === 0 || !D || g.length === 0 && !K)
349
- return /* @__PURE__ */ m(We, { textColor: p });
344
+ const re = {};
345
+ if (v.forEach((e) => {
346
+ const t = e[A], o = h.map((a) => ((e.vars && e.vars[a.name]) ?? e[a.name] ?? 0) || 0);
347
+ re[t] = o.length > 0 ? Math.max(...o) : 0;
348
+ }), v.length === 0 || !A || h.length === 0 && !X)
349
+ return /* @__PURE__ */ m(je, { textColor: p });
350
350
  const ie = (e, t) => {
351
- const r = o.manualColorsMode || "dimension", a = ($ == null ? void 0 : $[l]) || {};
352
- return r === "measure" ? a.measures && a.measures[e] ? a.measures[e] : t && a[t] ? a[t] : k : t && a[t] ? a[t] : a.measures && a.measures[e] ? a.measures[e] : k;
353
- }, me = 28, fe = 6, re = 6 + (L === "left" ? 0 : 6), ce = T && parseInt(T, 10) || 0, le = (e) => {
354
- if (o.showZeroNullMeasures) return g.length;
351
+ const o = r.manualColorsMode || "dimension", a = (V == null ? void 0 : V[n]) || {};
352
+ return o === "measure" ? a.measures && a.measures[e] ? a.measures[e] : t && a[t] ? a[t] : O : t && a[t] ? a[t] : a.measures && a.measures[e] ? a.measures[e] : O;
353
+ }, me = 28, fe = 6, oe = 6 + (_ === "left" ? 0 : 6), ce = E && parseInt(E, 10) || 0, ne = (e) => {
354
+ if (r.showZeroNullMeasures) return h.length;
355
355
  let t = 0;
356
- return g.forEach((r) => {
357
- const a = (e.vars && e.vars[r.name]) ?? e[r.name] ?? null, u = typeof a == "number" ? a : a != null ? parseFloat(a) : null;
356
+ return h.forEach((o) => {
357
+ const a = (e.vars && e.vars[o.name]) ?? e[o.name] ?? null, u = typeof a == "number" ? a : a != null ? parseFloat(a) : null;
358
358
  u != null && u !== 0 && t++;
359
359
  }), t;
360
360
  };
361
- let q = 0;
362
- x.forEach((e) => {
363
- const t = Math.max(1, le(e)), r = me * t + fe * Math.max(0, t - 1), a = L === "left" ? Math.max(r, ce) + 12 : r + 12 + re;
364
- q += a;
361
+ let Q = 0;
362
+ v.forEach((e) => {
363
+ const t = Math.max(1, ne(e)), o = me * t + fe * Math.max(0, t - 1), a = _ === "left" ? Math.max(o, ce) + 12 : o + 12 + oe;
364
+ Q += a;
365
365
  });
366
- const ue = q + 40;
367
- if (typeof Z == "function") {
366
+ const ue = Q + 40;
367
+ if (typeof j == "function") {
368
368
  const e = Math.ceil(ue);
369
- C.current.timer && (clearTimeout(C.current.timer), C.current.timer = null), C.current.last !== e && (C.current.timer = setTimeout(() => {
370
- C.current.last !== e && (C.current.last = e, Z(e));
369
+ y.current.timer && (clearTimeout(y.current.timer), y.current.timer = null), y.current.last !== e && (y.current.timer = setTimeout(() => {
370
+ y.current.last !== e && (y.current.last = e, j(e));
371
371
  }, 100));
372
372
  }
373
- return /* @__PURE__ */ m("div", { className: "grouped-bars-data-frame", children: x.map((e, t) => {
374
- const r = e[D], a = g.map((n) => {
375
- const v = (e.vars && e.vars[n.name]) ?? e[n.name] ?? null, d = typeof v == "number" ? v : v != null ? parseFloat(v) : null;
376
- let M = 0;
377
- if (P === "percentage")
378
- if (g.length > 1)
373
+ return /* @__PURE__ */ m("div", { className: "grouped-bars-data-frame", children: v.map((e, t) => {
374
+ const o = e[A], a = h.map((l) => {
375
+ const b = (e.vars && e.vars[l.name]) ?? e[l.name] ?? null, d = typeof b == "number" ? b : b != null ? parseFloat(b) : null;
376
+ let g = 0;
377
+ if (Z === "percentage")
378
+ if (h.length > 1)
379
379
  if (c) {
380
- const F = ee[r] || 0;
381
- M = F > 0 && d != null ? d / F * 100 : 0;
380
+ const S = ae[o] || 0;
381
+ g = S > 0 && d != null ? d / S * 100 : 0;
382
382
  } else {
383
- const F = se || 0;
384
- M = F > 0 && d != null ? d / F * 100 : 0;
383
+ const S = se || 0;
384
+ g = S > 0 && d != null ? d / S * 100 : 0;
385
385
  }
386
386
  else {
387
- const F = Y[n.name] || 0;
388
- M = F > 0 && d != null ? d / F * 100 : 0;
387
+ const S = ee[l.name] || 0;
388
+ g = S > 0 && d != null ? d / S * 100 : 0;
389
389
  }
390
- else if (P === "relative_max")
391
- if (g.length > 1 && c) {
392
- const F = oe[r] || 0;
393
- M = F > 0 && d != null ? d / F * 100 : 0;
390
+ else if (Z === "relative_max")
391
+ if (h.length > 1 && c) {
392
+ const S = re[o] || 0;
393
+ g = S > 0 && d != null ? d / S * 100 : 0;
394
394
  } else
395
- M = X > 0 && d != null ? d / X * 100 : 0;
395
+ g = q > 0 && d != null ? d / q * 100 : 0;
396
396
  else
397
- M = X > 0 && d != null ? d / X * 100 : 0;
398
- (d == null || d === 0) && (M = 0), M = Math.max(0, Math.min(100, M));
399
- const ae = ie(n.name, r);
400
- return { name: n.name, label: n.label || n.name, value: d, width: M, color: ae, format: n.format || f };
401
- }), u = o.showZeroNullMeasures ? a : a.filter((n) => n.value != null && n.value !== 0);
402
- let h = null;
403
- if (S) {
404
- const n = u.find((v) => v.name === S);
405
- o.showZeroNullMeasures ? h = n || null : h = n && n.value != null && n.value !== 0 ? n : null;
397
+ g = q > 0 && d != null ? d / q * 100 : 0;
398
+ (d == null || d === 0) && (g = 0), g = Math.max(0, Math.min(100, g));
399
+ const U = ie(l.name, o);
400
+ return { name: l.name, label: l.label || l.name, value: d, width: g, color: U, format: l.format || f };
401
+ }), u = r.showZeroNullMeasures ? a : a.filter((l) => l.value != null && l.value !== 0);
402
+ let C = null;
403
+ if (F) {
404
+ const l = u.find((b) => b.name === F);
405
+ r.showZeroNullMeasures ? C = l || null : C = l && l.value != null && l.value !== 0 ? l : null;
406
406
  }
407
- let z = h ? u.filter((n) => n.name !== S) : u;
408
- return _ === "measure" && (z = [...z].sort(
409
- (n, v) => O === "asc" ? n.value - v.value : v.value - n.value
410
- )), /* @__PURE__ */ m(
411
- je,
407
+ let w = C ? u.filter((l) => l.name !== F) : u;
408
+ if (R === "measure") {
409
+ const l = T ? w.find((g) => g.name === T) : null, d = [...l ? w.filter((g) => g.name !== T) : w].sort(
410
+ (g, U) => W === "asc" ? g.value - U.value : U.value - g.value
411
+ );
412
+ w = l ? [l, ...d] : d;
413
+ }
414
+ return /* @__PURE__ */ m(
415
+ Je,
412
416
  {
413
- dimensionValue: r,
414
- measureEntries: z,
415
- mainEntry: h,
416
- barBackgroundColor: B,
417
+ dimensionValue: o,
418
+ measureEntries: w,
419
+ mainEntry: C,
420
+ barBackgroundColor: L,
417
421
  textColor: p,
418
- measureTextColor: w,
419
- fontSize: E,
420
- mainValueFontSize: I,
421
- labelPosition: L,
422
- valuePosition: y,
422
+ measureTextColor: M,
423
+ fontSize: k,
424
+ mainValueFontSize: D,
425
+ labelPosition: _,
426
+ valuePosition: z,
423
427
  format: f,
424
- labelWidth: V,
425
- labelHeight: T,
426
- labelFormat: W,
428
+ labelWidth: G,
429
+ labelHeight: E,
430
+ labelFormat: J,
427
431
  vars: e.vars,
428
- intl: U,
429
- showMeasureLabels: Q
432
+ intl: N,
433
+ showMeasureLabels: Y
430
434
  },
431
- `${r}-${t}`
435
+ `${o}-${t}`
432
436
  );
433
437
  }) });
434
- }, Ke = (o) => {
438
+ }, Xe = (r) => {
435
439
  var he;
436
440
  const {
437
- editing: l = !1,
441
+ editing: n = !1,
438
442
  unique: s,
439
- intl: b,
443
+ intl: x,
440
444
  "data-csv": i = "",
441
445
  "data-dvz-proxy-dataset-id": f,
442
- "data-no-data-message": p = He,
443
- "data-view-mode": w = "info",
444
- "data-height": E,
445
- "data-app": I,
446
- "data-measures": U = "{}",
447
- "data-format": $ = "{}",
448
- "data-group": k,
449
- "data-filters": B = "[]",
450
- "data-text-color": L = Ee,
451
- "data-measure-text-color": y = "#ffffff",
452
- "data-back-ground-color": V = Ue,
453
- "data-font-size": T = $e,
454
- "data-dimension1": W,
455
- "data-wait-for-filters": _ = "false",
456
- "data-no-data-text": O = Re,
457
- "data-manual-colors": G = "{}",
458
- "data-default-bar-color": P = ke,
459
- "data-bar-background-color": H = Ve,
460
- "data-label-position": S,
461
- "data-value-position": j,
446
+ "data-no-data-message": p = Re,
447
+ "data-view-mode": M = "info",
448
+ "data-height": k,
449
+ "data-app": D,
450
+ "data-measures": N = "{}",
451
+ "data-format": V = "{}",
452
+ "data-group": O,
453
+ "data-filters": L = "[]",
454
+ "data-text-color": _ = Ue,
455
+ "data-measure-text-color": z = "#ffffff",
456
+ "data-back-ground-color": G = $e,
457
+ "data-font-size": E = ke,
458
+ "data-dimension1": J,
459
+ "data-wait-for-filters": R = "false",
460
+ "data-no-data-text": W = He,
461
+ "data-manual-colors": P = "{}",
462
+ "data-default-bar-color": Z = Ve,
463
+ "data-bar-background-color": H = Oe,
464
+ "data-label-position": F,
465
+ "data-value-position": T,
462
466
  "data-label-width": c,
463
- "data-label-height": Q,
464
- "data-label-format": Z,
465
- "data-sorting": C,
466
- "data-sort-direction": J,
467
- "data-sort-measure": N,
468
- "data-top-n": K,
469
- "data-bar-size-criteria": D,
470
- "data-main-measure": g,
471
- "data-show-measure-labels": x,
472
- "data-bar-size-use-group": Y,
473
- "data-enable-manual-colors": X,
467
+ "data-label-height": Y,
468
+ "data-label-format": j,
469
+ "data-sorting": y,
470
+ "data-sort-direction": K,
471
+ "data-sort-measure": I,
472
+ "data-top-n": X,
473
+ "data-bar-size-criteria": A,
474
+ "data-main-measure": h,
475
+ "data-show-measure-labels": v,
476
+ "data-bar-size-use-group": ee,
477
+ "data-enable-manual-colors": q,
474
478
  "data-manual-colors-mode": se,
475
- "data-main-value-font-size": ee,
476
- "data-show-zero-null-measures": oe
477
- } = o, ie = be(null), [me, fe] = ve(w), [re, ce] = ve(null), le = parseInt(E || 0, 10) || 0, q = Math.max(le, re || 0), ue = l ? q - 80 : q - 40, e = ne($, l), t = we(e), r = ne(B, l), a = ne(U, l), u = ne(G, l), h = Oe(a, t, I, o["data-enable-custom-measure-formats"] === "true"), z = h.map((te) => te.name), n = typeof g == "string" && g.length > 0 ? R(g) : null, v = n && n.toLowerCase() === "none" ? null : n || null, d = h.length > 1 ? v === null ? null : z.includes(v) ? v : z[0] : null, M = typeof N == "string" && N.length > 0 ? R(N) : null, ae = M && M.toLowerCase() === "none" ? null : M || null, F = h.length > 1 ? ae === null ? null : z.includes(ae) ? ae : z[0] : null, Se = Ge(r, f), pe = Pe(W), Me = D, Fe = Y === "true", Ce = X === "true", Ne = se || "dimension", Ie = parseInt(ee || de, 10), ye = x === "true", De = oe === "true";
479
+ "data-main-value-font-size": ae,
480
+ "data-show-zero-null-measures": re
481
+ } = r, ie = be(null), [me, fe] = ve(M), [oe, ce] = ve(null), ne = parseInt(k || 0, 10) || 0, Q = Math.max(ne, oe || 0), ue = n ? Q - 80 : Q - 40, e = le(V, n), t = we(e), o = le(L, n), a = le(N, n), u = a !== null ? a : N && typeof N == "string" && !N.startsWith("{") && !N.startsWith("[") ? [N] : null, C = le(P, n), w = Ge(u, t, D, r["data-enable-custom-measure-formats"] === "true"), l = w.map((te) => te.name), b = typeof h == "string" && h.length > 0 ? $(h) : null, d = b && b.toLowerCase() === "none" ? null : b || null, g = w.length > 1 ? d === null ? null : l.includes(d) ? d : l[0] : null, U = typeof I == "string" && I.length > 0 ? $(I) : null, S = U && U.toLowerCase() === "none" ? null : U || null, Se = w.length > 1 ? S === null ? null : l.includes(S) ? S : l[0] : null, Me = We(o, f), pe = Pe(J), Fe = A, Ce = ee === "true", Ne = q === "true", ye = se || "dimension", Ie = parseInt(ae || de, 10), De = v === "true", ze = re === "true";
478
482
  return /* @__PURE__ */ m("div", { ref: ie, children: /* @__PURE__ */ m(
479
- Ae,
483
+ Be,
480
484
  {
481
- className: `chart container grouped-bars-container ${l ? "editing" : ""}`,
482
- style: { height: (q || le) + "px", backgroundColor: V },
485
+ className: `chart container grouped-bars-container ${n ? "editing" : ""}`,
486
+ style: { height: (Q || ne) + "px", backgroundColor: G },
483
487
  fluid: !0,
484
488
  children: /* @__PURE__ */ m(
485
- Be,
489
+ Le,
486
490
  {
487
491
  style: { height: `${ue}px` },
488
- params: Se,
489
- app: I,
490
- group: k,
492
+ params: Me,
493
+ app: D,
494
+ group: O,
491
495
  csv: i,
492
- editing: l,
493
- waitForFilters: _ === "true",
494
- store: [I, s, ...pe],
496
+ editing: n,
497
+ waitForFilters: R === "true",
498
+ store: [D, s, ...pe],
495
499
  source: pe.join("/"),
496
- children: /* @__PURE__ */ m(Le, { children: /* @__PURE__ */ m(
497
- Je,
500
+ children: /* @__PURE__ */ m(Te, { children: /* @__PURE__ */ m(
501
+ Ke,
498
502
  {
499
- editing: l,
500
- locale: b.locale,
501
- intl: b,
502
- app: I,
503
+ editing: n,
504
+ locale: x.locale,
505
+ intl: x,
506
+ app: D,
503
507
  format: t,
504
- dimension1: W,
505
- manualColors: Ce ? u : {},
506
- manualColorsMode: Ne,
507
- measure: h.length === 1 ? (he = h[0]) == null ? void 0 : he.name : null,
508
- fontSize: T,
509
- textColor: R(L),
510
- measureTextColor: R(y),
511
- backGroundColor: R(V),
512
- noDataText: O,
513
- defaultBarColor: R(P),
514
- barBackgroundColor: R(H),
515
- labelPosition: S,
516
- valuePosition: h.length > 1 ? "bar" : j,
508
+ dimension1: J,
509
+ manualColors: Ne ? C : {},
510
+ manualColorsMode: ye,
511
+ measure: w.length === 1 ? (he = w[0]) == null ? void 0 : he.name : null,
512
+ fontSize: E,
513
+ textColor: $(_),
514
+ measureTextColor: $(z),
515
+ backGroundColor: $(G),
516
+ noDataText: W,
517
+ defaultBarColor: $(Z),
518
+ barBackgroundColor: $(H),
519
+ labelPosition: F,
520
+ valuePosition: w.length > 1 ? "bar" : T,
517
521
  labelWidth: c,
518
- labelHeight: Q,
519
- labelFormat: Z,
520
- sorting: C,
521
- sortDirection: J,
522
- topN: K,
523
- barSizeCriteria: Me,
524
- barSizeUseGroup: Fe,
525
- selectedMeasures: h,
526
- mainMeasureName: d,
527
- sortMeasureName: F,
522
+ labelHeight: Y,
523
+ labelFormat: j,
524
+ sorting: y,
525
+ sortDirection: K,
526
+ topN: X,
527
+ barSizeCriteria: Fe,
528
+ barSizeUseGroup: Ce,
529
+ selectedMeasures: w,
530
+ mainMeasureName: g,
531
+ sortMeasureName: Se,
528
532
  mainValueFontSize: Ie,
529
- showMeasureLabels: ye,
530
- showZeroNullMeasures: De,
533
+ showMeasureLabels: De,
534
+ showZeroNullMeasures: ze,
531
535
  onHeightChange: (te) => {
532
536
  if (typeof te == "number" && te > 0) {
533
537
  const ge = Math.ceil(te);
534
- ge !== re && ce(ge);
538
+ ge !== oe && ce(ge);
535
539
  }
536
540
  }
537
541
  }
@@ -540,10 +544,10 @@ const He = "No data matches your selection", Re = "-", Ee = "#5a5d68", Ue = "non
540
544
  )
541
545
  }
542
546
  ) });
543
- }, Xe = (o, l) => {
544
- const { "data-app": s, "data-group": b } = l, i = o.getIn(["data", "measures", s, b]);
547
+ }, qe = (r, n) => {
548
+ const { "data-app": s, "data-group": x } = n, i = r.getIn(["data", "measures", s, x]);
545
549
  return i ? { injectedMeasures: i } : {};
546
- }, qe = {}, na = Te(Xe, qe)(Ke);
550
+ }, Qe = {}, sa = _e(qe, Qe)(Xe);
547
551
  export {
548
- na as default
552
+ sa as default
549
553
  };