@devgateway/dvz-ui-react 1.8.8 → 1.9.0

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 (50) hide show
  1. package/dist/cjs/common.css +1 -1
  2. package/dist/cjs/embeddable/big-number-trend/Alternative.js +1 -1
  3. package/dist/cjs/embeddable/big-number-trend/BigNumberTrendContainer.js +1 -0
  4. package/dist/cjs/embeddable/big-number-trend/Classic.js +1 -1
  5. package/dist/cjs/embeddable/big-number-trend/useBigNumberTrendData.js +1 -0
  6. package/dist/cjs/embeddable/chart/Bar.js +1 -1
  7. package/dist/cjs/embeddable/chart/Messages.js +2 -2
  8. package/dist/cjs/embeddable/chart/data/Line.js +1 -1
  9. package/dist/cjs/embeddable/chart/data/Utils.js +1 -1
  10. package/dist/cjs/embeddable/chart/index.js +1 -1
  11. package/dist/cjs/embeddable/d3Map/index.js +1 -1
  12. package/dist/cjs/embeddable/data/CategoriesProvider.js +1 -1
  13. package/dist/cjs/embeddable/data/DataConsumer.js +1 -1
  14. package/dist/cjs/embeddable/data/DataProvider.js +1 -1
  15. package/dist/cjs/embeddable/featuredtabs/index.js +1 -1
  16. package/dist/cjs/embeddable/map/index.js +2 -2
  17. package/dist/cjs/embeddable/reducers/data.js +1 -1
  18. package/dist/cjs/index.js +1 -1
  19. package/dist/cjs/layout/FlexWrapDetector.js +1 -1
  20. package/dist/cjs/styles.css +1 -1
  21. package/dist/esm/common.css +1 -1
  22. package/dist/esm/embeddable/big-number-trend/Alternative.js +62 -211
  23. package/dist/esm/embeddable/big-number-trend/BigNumberTrendContainer.js +125 -0
  24. package/dist/esm/embeddable/big-number-trend/Classic.js +51 -181
  25. package/dist/esm/embeddable/big-number-trend/index.js +8 -8
  26. package/dist/esm/embeddable/big-number-trend/useBigNumberTrendData.js +49 -0
  27. package/dist/esm/embeddable/chart/Bar.js +464 -471
  28. package/dist/esm/embeddable/chart/Messages.js +18 -15
  29. package/dist/esm/embeddable/chart/data/Line.js +1 -4
  30. package/dist/esm/embeddable/chart/data/Utils.js +0 -1
  31. package/dist/esm/embeddable/chart/index.js +363 -359
  32. package/dist/esm/embeddable/d3Map/index.js +129 -125
  33. package/dist/esm/embeddable/data/CategoriesProvider.js +31 -38
  34. package/dist/esm/embeddable/data/DataConsumer.js +12 -8
  35. package/dist/esm/embeddable/data/DataProvider.js +62 -124
  36. package/dist/esm/embeddable/featuredtabs/index.js +64 -61
  37. package/dist/esm/embeddable/map/index.js +42 -42
  38. package/dist/esm/embeddable/reducers/data.js +46 -44
  39. package/dist/esm/index.js +74 -73
  40. package/dist/esm/layout/FlexWrapDetector.js +10 -10
  41. package/dist/esm/styles.css +1 -1
  42. package/dist/types/embeddable/big-number-trend/Alternative.d.ts +2 -4
  43. package/dist/types/embeddable/big-number-trend/BigNumberTrendContainer.d.ts +5 -0
  44. package/dist/types/embeddable/big-number-trend/Classic.d.ts +2 -4
  45. package/dist/types/embeddable/big-number-trend/useBigNumberTrendData.d.ts +21 -0
  46. package/dist/types/embeddable/chart/Bar.d.ts +1 -2
  47. package/dist/types/embeddable/data/DataConsumer.d.ts +5 -2
  48. package/dist/types/embeddable/data/DataProvider.d.ts +18 -3
  49. package/dist/types/layout/FlexWrapDetector.d.ts +2 -1
  50. package/package.json +2 -2
@@ -1,227 +1,78 @@
1
- import { jsx as n, jsxs as y } from "react/jsx-runtime";
2
- import { useRef as L, useState as Q } from "react";
3
- import { Container as W, Grid as g, Popup as X } from "semantic-ui-react";
4
- import Z from "../data/DataProvider.js";
5
- import ee from "../data/DataConsumer.js";
6
- import "@devgateway/wp-react-lib";
7
- import { connect as te } from "react-redux";
8
- import { alphaSort as ne } from "../utils/common.js";
9
- import B from "string-template";
10
- const oe = (t) => {
1
+ import { jsx as t, jsxs as i } from "react/jsx-runtime";
2
+ import "react";
3
+ import { Grid as n, Popup as R } from "semantic-ui-react";
4
+ import h from "string-template";
5
+ import D from "./BigNumberTrendContainer.js";
6
+ import B from "./useBigNumberTrendData.js";
7
+ const U = (e) => {
11
8
  const {
12
- editing: u = !1,
13
- unique: C,
14
- intl: v,
15
- childContent: F,
16
- "data-csv": p = "",
17
- "data-dvz-proxy-dataset-id": d,
18
- "data-no-data-message": q = "No data matches your selection",
19
- "data-view-mode": U = "info",
20
- "data-height": w,
21
- "data-app": b,
22
- "data-measures": Y = "{}",
23
- "data-format": k = "{}",
24
- "data-group": f,
25
- "data-filters": M = "[]",
26
- "data-text-color": e = "#5a5d68",
27
- "data-number-color": o = "#5a5d68",
28
- "data-percent-color": a = "#5a5d68",
29
- "data-back-ground-color": i = "#5a5d68",
30
- "data-big-number-font-size": m = 20,
31
- "data-label-font-size": l = 20,
32
- "data-percent-font-size": x = 20,
33
- "data-label": S = "",
34
- "data-dimension1": D,
35
- "data-show-percentage-change": N = "false",
36
- "data-wait-for-filters": z = "false",
37
- "data-no-data-text": I = "-",
38
- "data-icon-image": _ = "",
39
- "data-icon-up": T = "",
40
- "data-icon-down": V = "",
41
- "data-show-tooltip": R = "false",
42
- "data-tooltip-text": $ = "",
43
- "data-tooltip-style": A = "light"
44
- } = t, j = v.locale, P = L(null), r = (s) => u ? s : decodeURIComponent(s), h = (s) => {
45
- try {
46
- return JSON.parse(r(s));
47
- } catch {
48
- console.error("error parsing value:" + s);
49
- }
50
- return null;
51
- }, c = h(k), J = c ? {
52
- style: c.style === "compacted" ? "decimal" : c.style,
53
- notation: c.style === "compacted" ? "compact" : "standard",
54
- currency: c.currency,
55
- minimumFractionDigits: parseInt(c.minimumFractionDigits),
56
- maximumFractionDigits: parseInt(c.maximumFractionDigits)
57
- } : {
58
- notation: "standard",
59
- currency: "USD",
60
- minimumFractionDigits: 2,
61
- maximumFractionDigits: 2
62
- }, [le, ce] = Q(U), K = u ? w - 80 : w - 40, E = {}, G = h(M) || {};
63
- G && G.forEach && G.forEach((s) => {
64
- s.value != null && s.value.filter((O) => O != null && O.toString().trim() != "").length > 0 && (E[s.param] = s.value);
65
- }), d && (E.dvzProxyDatasetId = d);
66
- const H = [];
67
- return D != "none" && H.push(D), /* @__PURE__ */ n("div", { ref: P, children: /* @__PURE__ */ n(
68
- W,
69
- {
70
- className: `alternative big number container ${u ? "editing" : ""}`,
71
- style: { height: w + "px", backgroundColor: i },
72
- fluid: !0,
73
- children: /* @__PURE__ */ n(
74
- Z,
75
- {
76
- style: { height: `${K}px` },
77
- params: E,
78
- app: b,
79
- group: f,
80
- csv: p,
81
- editing: u,
82
- waitForFilters: z === "true",
83
- store: [b, C, ...H],
84
- source: H.join("/"),
85
- children: /* @__PURE__ */ n(ee, { children: /* @__PURE__ */ n(
86
- ae,
87
- {
88
- iconImage: _,
89
- iconUp: T,
90
- iconDown: V,
91
- editing: u,
92
- locale: j,
93
- intl: v,
94
- app: b,
95
- format: J,
96
- dimension1: D,
97
- measure: h(Y)[0] || null,
98
- label: S,
99
- bigNumberFontSize: m,
100
- textColor: e,
101
- numberColor: o,
102
- percentColor: a,
103
- backGroundColor: i,
104
- labelFontSize: l,
105
- percentFontSize: x,
106
- showPercentageChange: N == "true" || N == !0,
107
- noDataText: I,
108
- showTooltip: R == "true" || R === !0,
109
- tooltipText: r($),
110
- tooltipStyle: A
111
- }
112
- ) })
113
- }
114
- )
115
- }
116
- ) });
117
- }, ae = (t) => {
118
- const {
119
- editing: u,
120
- app: C,
121
- measure: v,
122
- dimension1: F,
123
- data: p,
124
- format: d,
125
- label: q,
126
- textColor: U,
127
- bigNumberFontSize: w,
128
- percentFontSize: b,
129
- labelFontSize: Y,
130
- showPercentageChange: k,
131
- intl: f,
132
- noDataText: M
133
- } = t;
134
- let e = [], o, a;
135
- if (C == "csv") {
136
- const { data: r, meta: { fields: h } } = p;
137
- o = h[0], a = h[1], e = p.data.map((c) => ({
138
- value: c[o],
139
- [a]: c[a],
140
- [o]: c[o]
141
- }));
142
- } else if (a = v, o = F, o == null || o == "none") {
143
- let r = {};
144
- r[a] = p[a], e = [r];
145
- } else
146
- e = !p.children || p.children.length == 0 ? [] : p.children, e = e.map((r) => ({
147
- value: r.value,
148
- [a]: r[a],
149
- [o]: r.value
150
- }));
151
- let i = null, m = null, l, x, S;
152
- e.length > 0 && (e = e.sort((r, h) => ne(!1, f.locale, r.value, h.value)), i = e[e.length - 1][a], e.length > 1 && (m = e[e.length - 2][a]), S = f.formatNumber(d.style === "percent" ? i / 100 : i, { ...d }), m && (l = (i - m) / m, x = f.formatNumber(l, {
153
- style: "percent",
154
- minimumFractionDigits: 2,
155
- maximumFractionDigits: 2
156
- }))), i == null && (S = M);
157
- const D = {
158
- color: decodeURIComponent(t.numberColor),
159
- fontSize: w + "px"
160
- }, N = {
161
- color: decodeURIComponent(t.percentColor),
162
- fontSize: b + "px"
163
- }, z = {
164
- color: decodeURIComponent(t.percentColor),
165
- fontSize: b + "px",
166
- lineHeight: 1.1
167
- }, I = {
168
- display: "inline-flex",
169
- flexDirection: "column",
170
- alignItems: "center"
171
- }, _ = {
172
- color: decodeURIComponent(U),
173
- fontSize: Y + "px"
174
- }, T = e.length > 0 ? e[e.length - 1] : {}, V = e.length > 0 ? T[o] : null, R = e.length > 1 ? e[e.length - 2][o] : null, $ = i != null ? f.formatNumber(d.style === "percent" ? i / 100 : i, { ...d }) : null, A = m != null ? f.formatNumber(d.style === "percent" ? m / 100 : m, { ...d }) : null, j = {
175
- ...T,
176
- current_year: V,
177
- previous_year: R,
178
- current_value: $,
179
- previous_value: A,
180
- percent_change: x
181
- }, P = t.showTooltip && t.tooltipText ? B(t.tooltipText, j) : void 0;
182
- return /* @__PURE__ */ y(g, { padded: !0, children: [
183
- /* @__PURE__ */ y(g.Row, { children: [
184
- /* @__PURE__ */ n(g.Column, { width: 4, children: t.iconImage && t.iconImage != "" && /* @__PURE__ */ n("img", { className: "icon main", src: t.iconImage }) }),
185
- /* @__PURE__ */ y(g.Column, { textAlign: "right", width: 12, children: [
186
- /* @__PURE__ */ n("img", { className: `icon up ${l > 0 ? "visible" : "hidden"}`, src: t.iconUp }),
187
- /* @__PURE__ */ n("img", { className: `icon up ${l < 0 ? "visible" : "hidden"}`, s: !0, src: t.iconDown }),
188
- k && l != null && (t.showTooltip && P ? /* @__PURE__ */ n(
189
- X,
9
+ app: g,
10
+ measure: u,
11
+ dimension1: p,
12
+ data: y,
13
+ format: C,
14
+ percentChangeFormat: b,
15
+ label: f,
16
+ textColor: x,
17
+ bigNumberFontSize: N,
18
+ percentFontSize: l,
19
+ labelFontSize: S,
20
+ showPercentageChange: v,
21
+ intl: w,
22
+ noDataText: T
23
+ } = e, {
24
+ percentChange: o,
25
+ percentChangeFormatted: r,
26
+ formattedNumber: z,
27
+ templateContext: c
28
+ } = B({ data: y, app: g, measure: u, dimension1: p, format: C, percentChangeFormat: b, intl: w, noDataText: T }), I = { color: decodeURIComponent(e.numberColor), fontSize: N + "px" }, a = { color: decodeURIComponent(e.percentColor), fontSize: l + "px" }, d = { color: decodeURIComponent(e.percentColor), fontSize: l + "px", lineHeight: 1.1 }, m = { display: "inline-flex", flexDirection: "column", alignItems: "center" }, F = { color: decodeURIComponent(x), fontSize: S + "px" }, s = e.showTooltip && e.tooltipText ? h(e.tooltipText, c) : void 0;
29
+ return /* @__PURE__ */ i(n, { padded: !0, children: [
30
+ /* @__PURE__ */ i(n.Row, { children: [
31
+ /* @__PURE__ */ t(n.Column, { width: 4, children: e.iconImage && e.iconImage != "" && /* @__PURE__ */ t("img", { className: "icon main", src: e.iconImage }) }),
32
+ /* @__PURE__ */ i(n.Column, { textAlign: "right", width: 12, children: [
33
+ /* @__PURE__ */ t("img", { className: `icon up ${o > 0 ? "visible" : "hidden"}`, src: e.iconUp }),
34
+ /* @__PURE__ */ t("img", { className: `icon up ${o < 0 ? "visible" : "hidden"}`, s: !0, src: e.iconDown }),
35
+ v && o != null && (e.showTooltip && s ? /* @__PURE__ */ t(
36
+ R,
190
37
  {
191
- content: P,
38
+ content: s,
192
39
  position: "top center",
193
- inverted: t.tooltipStyle === "dark",
40
+ inverted: e.tooltipStyle === "dark",
194
41
  size: "small",
195
- trigger: /* @__PURE__ */ y("div", { style: I, children: [
196
- /* @__PURE__ */ y("div", { className: "percentage", style: N, children: [
42
+ trigger: /* @__PURE__ */ i("div", { style: m, children: [
43
+ /* @__PURE__ */ i("div", { className: "percentage", style: a, children: [
197
44
  " ",
198
- l > 0 ? "+" : "",
199
- l == 0 ? "=" : "",
200
- x
45
+ o > 0 ? "+" : "",
46
+ o == 0 ? "=" : "",
47
+ r
201
48
  ] }),
202
- /* @__PURE__ */ n("div", { className: "percentage-yoy", style: z, children: "YoY" })
49
+ /* @__PURE__ */ t("div", { className: "percentage-yoy", style: d, children: "YoY" })
203
50
  ] })
204
51
  }
205
- ) : /* @__PURE__ */ y("div", { style: I, children: [
206
- /* @__PURE__ */ y("div", { className: "percentage", style: N, children: [
52
+ ) : /* @__PURE__ */ i("div", { style: m, children: [
53
+ /* @__PURE__ */ i("div", { className: "percentage", style: a, children: [
207
54
  " ",
208
- l > 0 ? "+" : "",
209
- l == 0 ? "=" : "",
210
- x
55
+ o > 0 ? "+" : "",
56
+ o == 0 ? "=" : "",
57
+ r
211
58
  ] }),
212
- /* @__PURE__ */ n("div", { className: "percentage-yoy", style: z, children: "YoY" })
59
+ /* @__PURE__ */ t("div", { className: "percentage-yoy", style: d, children: "YoY" })
213
60
  ] }))
214
61
  ] })
215
62
  ] }),
216
- /* @__PURE__ */ n(g.Row, { children: /* @__PURE__ */ n(g.Column, { width: 16, children: /* @__PURE__ */ n("span", { className: "number", style: D, children: S }) }) }),
217
- /* @__PURE__ */ n(g.Row, { children: /* @__PURE__ */ n(g.Column, { children: /* @__PURE__ */ n("div", { className: "label", style: _, children: B(q, j) }) }) })
63
+ /* @__PURE__ */ t(n.Row, { children: /* @__PURE__ */ t(n.Column, { width: 16, children: /* @__PURE__ */ t("span", { className: "number", style: I, children: z }) }) }),
64
+ /* @__PURE__ */ t(n.Row, { children: /* @__PURE__ */ t(n.Column, { children: /* @__PURE__ */ t("div", { className: "label", style: F, children: h(f, c) }) }) })
218
65
  ] });
219
- }, re = (t, u) => {
220
- const { "data-app": C, "data-group": v } = u, F = t.getIn(["data", "measures", C, v]);
221
- return F ? {
222
- injectedMeasures: F
223
- } : {};
224
- }, ie = {}, ve = te(re, ie)(oe);
66
+ }, G = (e) => /* @__PURE__ */ t(
67
+ D,
68
+ {
69
+ DataFrameComponent: U,
70
+ containerClassName: "alternative big number container",
71
+ defaultBackgroundColor: "#5a5d68",
72
+ decodeTooltip: !0,
73
+ ...e
74
+ }
75
+ );
225
76
  export {
226
- ve as default
77
+ G as default
227
78
  };
@@ -0,0 +1,125 @@
1
+ import { jsx as o } from "react/jsx-runtime";
2
+ import { useRef as Y, useState as Z } from "react";
3
+ import { Container as _ } from "semantic-ui-react";
4
+ import tt from "../data/DataProvider.js";
5
+ import et from "../data/DataConsumer.js";
6
+ import { connect as at } from "react-redux";
7
+ const ot = (r) => {
8
+ const {
9
+ DataFrameComponent: s,
10
+ containerClassName: c,
11
+ defaultBackgroundColor: d = "none",
12
+ decodeTooltip: n = !1,
13
+ editing: a = !1,
14
+ unique: v,
15
+ intl: b,
16
+ "data-csv": z = "",
17
+ "data-dvz-proxy-dataset-id": x,
18
+ "data-view-mode": S = "info",
19
+ "data-height": l,
20
+ "data-app": m,
21
+ "data-measures": I = "{}",
22
+ "data-format": j = "{}",
23
+ "data-group": N,
24
+ "data-filters": P = "[]",
25
+ "data-text-color": k = "#5a5d68",
26
+ "data-number-color": O = "#5a5d68",
27
+ "data-percent-color": $ = "#5a5d68",
28
+ "data-big-number-font-size": B = 20,
29
+ "data-label-font-size": M = 20,
30
+ "data-percent-font-size": R = 20,
31
+ "data-label": U = "",
32
+ "data-dimension1": u,
33
+ "data-show-percentage-change": C = "false",
34
+ "data-wait-for-filters": E = "false",
35
+ "data-no-data-text": q = "-",
36
+ "data-icon-image": G = "",
37
+ "data-icon-up": H = "",
38
+ "data-icon-down": J = "",
39
+ "data-show-tooltip": y = "false",
40
+ "data-tooltip-text": D = "",
41
+ "data-tooltip-style": A = "light",
42
+ "data-percent-change-format": K = "{}"
43
+ } = r, w = r["data-back-ground-color"] || d, L = Y(null), T = (t) => a ? t : decodeURIComponent(t), i = (t) => {
44
+ try {
45
+ return JSON.parse(T(t));
46
+ } catch {
47
+ console.error("error parsing value:" + t);
48
+ }
49
+ return null;
50
+ }, p = i(K), Q = p && Object.keys(p).length > 0 ? p : { style: "percent", minimumFractionDigits: 2, maximumFractionDigits: 2 }, e = i(j), V = e ? {
51
+ style: e.style === "compacted" ? "decimal" : e.style,
52
+ notation: e.style === "compacted" ? "compact" : "standard",
53
+ currency: e.currency,
54
+ minimumFractionDigits: parseInt(e.minimumFractionDigits),
55
+ maximumFractionDigits: parseInt(e.maximumFractionDigits)
56
+ } : {
57
+ notation: "standard",
58
+ currency: "USD",
59
+ minimumFractionDigits: 2,
60
+ maximumFractionDigits: 2
61
+ }, [nt, it] = Z(S), W = a ? l - 80 : l - 40, g = {}, f = i(P) || {};
62
+ f && f.forEach && f.forEach((t) => {
63
+ t.value != null && t.value.filter((F) => F != null && F.toString().trim() != "").length > 0 && (g[t.param] = t.value);
64
+ }), x && (g.dvzProxyDatasetId = x);
65
+ const h = [];
66
+ u !== "none" && h.push(u);
67
+ const X = n ? T(D) : D;
68
+ return /* @__PURE__ */ o("div", { ref: L, children: /* @__PURE__ */ o(
69
+ _,
70
+ {
71
+ className: `${c} ${a ? "editing" : ""}`,
72
+ style: { height: l + "px", backgroundColor: w },
73
+ fluid: !0,
74
+ children: /* @__PURE__ */ o(
75
+ tt,
76
+ {
77
+ style: { height: `${W}px` },
78
+ params: g,
79
+ app: m,
80
+ group: N,
81
+ csv: z,
82
+ editing: a,
83
+ waitForFilters: E === "true",
84
+ store: [m, v, ...h],
85
+ source: h.join("/"),
86
+ children: /* @__PURE__ */ o(et, { children: /* @__PURE__ */ o(
87
+ s,
88
+ {
89
+ iconImage: G,
90
+ iconUp: H,
91
+ iconDown: J,
92
+ editing: a,
93
+ locale: b.locale,
94
+ intl: b,
95
+ app: m,
96
+ format: V,
97
+ dimension1: u,
98
+ measure: i(I)[0] || null,
99
+ label: U,
100
+ bigNumberFontSize: B,
101
+ textColor: k,
102
+ numberColor: O,
103
+ percentColor: $,
104
+ backGroundColor: w,
105
+ labelFontSize: M,
106
+ percentFontSize: R,
107
+ showPercentageChange: C == "true" || C == !0,
108
+ noDataText: q,
109
+ showTooltip: y == "true" || y === !0,
110
+ tooltipText: X,
111
+ tooltipStyle: A,
112
+ percentChangeFormat: Q
113
+ }
114
+ ) })
115
+ }
116
+ )
117
+ }
118
+ ) });
119
+ }, rt = (r, s) => {
120
+ const { "data-app": c, "data-group": d } = s, n = r.getIn(["data", "measures", c, d]);
121
+ return n ? { injectedMeasures: n } : {};
122
+ }, pt = at(rt, {})(ot);
123
+ export {
124
+ pt as default
125
+ };
@@ -1,190 +1,60 @@
1
- import { jsx as a, jsxs as G } from "react/jsx-runtime";
2
- import { useRef as K, useState as L } from "react";
3
- import { Container as Q, Popup as W } from "semantic-ui-react";
4
- import X from "../data/DataProvider.js";
5
- import Z from "../data/DataConsumer.js";
6
- import "@devgateway/wp-react-lib";
7
- import { connect as ee } from "react-redux";
8
- import { alphaSort as te } from "../utils/common.js";
9
- import H from "string-template";
10
- const ae = (t) => {
1
+ import { jsx as t, jsxs as c } from "react/jsx-runtime";
2
+ import "react";
3
+ import { Popup as z } from "semantic-ui-react";
4
+ import l from "string-template";
5
+ import D from "./BigNumberTrendContainer.js";
6
+ import F from "./useBigNumberTrendData.js";
7
+ const U = (e) => {
11
8
  const {
12
- editing: u = !1,
13
- unique: v,
14
- intl: h,
15
- childContent: y,
16
- "data-csv": r = "",
17
- "data-dvz-proxy-dataset-id": s,
18
- "data-no-data-message": A = "No data matches your selection",
19
- "data-view-mode": U = "info",
20
- "data-height": x,
21
- "data-app": F,
22
- "data-measures": j = "{}",
23
- "data-format": P = "{}",
24
- "data-group": p,
25
- "data-filters": M = "[]",
26
- "data-text-color": e = "#5a5d68",
27
- "data-number-color": n = "#5a5d68",
28
- "data-percent-color": o = "#5a5d68",
29
- "data-back-ground-color": i = "none",
30
- "data-big-number-font-size": d = 20,
31
- "data-label-font-size": m = 20,
32
- "data-percent-font-size": f = 20,
33
- "data-label": C = "",
34
- "data-dimension1": w,
35
- "data-show-percentage-change": D = "false",
36
- "data-wait-for-filters": R = "false",
37
- "data-no-data-text": N = "-",
38
- "data-icon-image": _ = "",
39
- "data-icon-up": k = "",
40
- "data-icon-down": V = "",
41
- "data-show-tooltip": z = "false",
42
- "data-tooltip-text": I = "",
43
- "data-tooltip-style": T = "light"
44
- } = t, l = h.locale, b = K(null), S = (c) => u ? c : decodeURIComponent(c), E = (c) => {
45
- try {
46
- return JSON.parse(S(c));
47
- } catch {
48
- console.error("error parsing value:" + c);
49
- }
50
- return null;
51
- }, g = E(P), J = g ? {
52
- style: g.style === "compacted" ? "decimal" : g.style,
53
- notation: g.style === "compacted" ? "compact" : "standard",
54
- currency: g.currency,
55
- minimumFractionDigits: parseInt(g.minimumFractionDigits),
56
- maximumFractionDigits: parseInt(g.maximumFractionDigits)
57
- } : {
58
- notation: "standard",
59
- currency: "USD",
60
- minimumFractionDigits: 2,
61
- maximumFractionDigits: 2
62
- }, [ie, le] = L(U), B = u ? x - 80 : x - 40, O = {}, Y = E(M) || {};
63
- Y && Y.forEach && Y.forEach((c) => {
64
- c.value != null && c.value.filter((q) => q != null && q.toString().trim() != "").length > 0 && (O[c.param] = c.value);
65
- }), s && (O.dvzProxyDatasetId = s);
66
- const $ = [];
67
- return w != "none" && $.push(w), /* @__PURE__ */ a("div", { ref: b, children: /* @__PURE__ */ a(Q, { className: `chart container big-number-trend-container ${u ? "editing" : ""}`, style: { height: x + "px", backgroundColor: i }, fluid: !0, children: /* @__PURE__ */ a(
68
- X,
69
- {
70
- style: { height: `${B}px` },
71
- params: O,
72
- app: F,
73
- group: p,
74
- csv: r,
75
- editing: u,
76
- waitForFilters: R === "true",
77
- store: [F, v, ...$],
78
- source: $.join("/"),
79
- children: /* @__PURE__ */ a(Z, { children: /* @__PURE__ */ a(
80
- ne,
81
- {
82
- iconImage: _,
83
- iconDown: V,
84
- iconUp: k,
85
- editing: u,
86
- locale: l,
87
- intl: h,
88
- app: F,
89
- format: J,
90
- dimension1: w,
91
- measure: E(j)[0] || null,
92
- label: C,
93
- bigNumberFontSize: d,
94
- textColor: e,
95
- numberColor: n,
96
- percentColor: o,
97
- backGroundColor: i,
98
- labelFontSize: m,
99
- percentFontSize: f,
100
- showPercentageChange: D == "true" || D == !0,
101
- noDataText: N,
102
- showTooltip: z == "true" || z === !0,
103
- tooltipText: I,
104
- tooltipStyle: T
105
- }
106
- ) })
107
- }
108
- ) }) });
109
- }, ne = (t) => {
110
- const {
111
- editing: u,
112
- app: v,
113
- measure: h,
114
- dimension1: y,
115
- data: r,
116
- format: s,
117
- label: A,
118
- textColor: U,
119
- bigNumberFontSize: x,
120
- percentFontSize: F,
121
- labelFontSize: j,
122
- showPercentageChange: P,
123
- intl: p,
124
- noDataText: M
125
- } = t;
126
- let e = [], n, o;
127
- if (v == "csv") {
128
- const { data: l, meta: { fields: b } } = r;
129
- n = b[0], o = b[1], e = r.data.map((S) => ({
130
- value: S[n],
131
- [o]: S[o],
132
- [n]: S[n]
133
- }));
134
- } else if (e = !r.children || r.children.length == 0 ? [] : r.children, o = h, n = y, n == null || n == "none") {
135
- let l = {};
136
- l[o] = r[o], e = [l];
137
- } else
138
- e = !r.children || r.children.length == 0 ? [] : r.children, e = e.map((l) => ({
139
- value: l.value,
140
- [o]: l[o],
141
- [n]: l.value
142
- }));
143
- let i = null, d = null, m, f, C;
144
- e.length > 0 && (e = e.sort((l, b) => te(!1, p.locale, l.value, b.value)), i = e[e.length - 1][o], e.length > 1 && (d = e[e.length - 2][o]), C = p.formatNumber(s.style === "percent" ? i / 100 : i, { ...s }), d && (m = (i - d) / d, f = p.formatNumber(m, { style: "percent", minimumFractionDigits: 2, maximumFractionDigits: 2 }))), i == null && (C = M);
145
- const w = {
146
- color: decodeURIComponent(t.numberColor),
147
- fontSize: x + "px"
148
- }, D = {
149
- color: decodeURIComponent(t.percentColor),
150
- fontSize: F + "px"
151
- }, R = {
152
- color: decodeURIComponent(U),
153
- fontSize: j + "px"
154
- }, N = e.length > 0 ? e[e.length - 1] : {}, _ = e.length > 0 ? N[n] : null, k = e.length > 1 ? e[e.length - 2][n] : null, V = i != null ? p.formatNumber(s.style === "percent" ? i / 100 : i, { ...s }) : null, z = d != null ? p.formatNumber(s.style === "percent" ? d / 100 : d, { ...s }) : null, I = {
155
- ...N,
156
- current_year: _,
157
- previous_year: k,
158
- current_value: V,
159
- previous_value: z,
160
- percent_change: f
161
- }, T = t.showTooltip && t.tooltipText ? H(t.tooltipText, I) : void 0;
162
- return /* @__PURE__ */ G("div", { className: "trend", children: [
163
- /* @__PURE__ */ a("div", { className: "label", style: R, children: H(A, I) }),
164
- /* @__PURE__ */ G("div", { className: "number-and-icon", children: [
165
- /* @__PURE__ */ a("span", { className: "number", style: w, children: C }),
166
- m > 0 && t.iconUp != "" && /* @__PURE__ */ a("img", { src: t.iconUp }),
167
- m < 0 && t.iconDown != "" && /* @__PURE__ */ a("img", { src: t.iconDown }),
168
- m > 0 && t.iconUp == "" && /* @__PURE__ */ a("div", { className: "icon trend arrow up" }),
169
- m < 0 && t.iconDown == "" && /* @__PURE__ */ a("div", { className: "icon trend arrow down" })
9
+ app: m,
10
+ measure: d,
11
+ dimension1: s,
12
+ data: u,
13
+ format: g,
14
+ percentChangeFormat: b,
15
+ label: p,
16
+ textColor: C,
17
+ bigNumberFontSize: h,
18
+ percentFontSize: N,
19
+ labelFontSize: f,
20
+ showPercentageChange: x,
21
+ intl: S,
22
+ noDataText: v
23
+ } = e, {
24
+ percentChange: n,
25
+ percentChangeFormatted: o,
26
+ formattedNumber: w,
27
+ templateContext: a
28
+ } = F({ data: u, app: m, measure: d, dimension1: s, format: g, percentChangeFormat: b, intl: S, noDataText: v }), y = { color: decodeURIComponent(e.numberColor), fontSize: h + "px" }, r = { color: decodeURIComponent(e.percentColor), fontSize: N + "px" }, T = { color: decodeURIComponent(C), fontSize: f + "px" }, i = e.showTooltip && e.tooltipText ? l(e.tooltipText, a) : void 0;
29
+ return /* @__PURE__ */ c("div", { className: "trend", children: [
30
+ /* @__PURE__ */ t("div", { className: "label", style: T, children: l(p, a) }),
31
+ /* @__PURE__ */ c("div", { className: "number-and-icon", children: [
32
+ /* @__PURE__ */ t("span", { className: "number", style: y, children: w }),
33
+ n > 0 && e.iconUp != "" && /* @__PURE__ */ t("img", { src: e.iconUp }),
34
+ n < 0 && e.iconDown != "" && /* @__PURE__ */ t("img", { src: e.iconDown }),
35
+ n > 0 && e.iconUp == "" && /* @__PURE__ */ t("div", { className: "icon trend arrow up" }),
36
+ n < 0 && e.iconDown == "" && /* @__PURE__ */ t("div", { className: "icon trend arrow down" })
170
37
  ] }),
171
- P && m && (t.showTooltip && T ? /* @__PURE__ */ a(
172
- W,
38
+ x && n && (e.showTooltip && i ? /* @__PURE__ */ t(
39
+ z,
173
40
  {
174
- content: T,
41
+ content: i,
175
42
  position: "top center",
176
- inverted: t.tooltipStyle === "dark",
43
+ inverted: e.tooltipStyle === "dark",
177
44
  size: "small",
178
- trigger: /* @__PURE__ */ a("div", { className: "percentage", style: D, children: f })
45
+ trigger: /* @__PURE__ */ t("div", { className: "percentage", style: r, children: o })
179
46
  }
180
- ) : /* @__PURE__ */ a("div", { className: "percentage", style: D, children: f }))
47
+ ) : /* @__PURE__ */ t("div", { className: "percentage", style: r, children: o }))
181
48
  ] });
182
- }, oe = (t, u) => {
183
- const { "data-app": v, "data-group": h } = u, y = t.getIn(["data", "measures", v, h]);
184
- return y ? {
185
- injectedMeasures: y
186
- } : {};
187
- }, re = {}, be = ee(oe, re)(ae);
49
+ }, q = (e) => /* @__PURE__ */ t(
50
+ D,
51
+ {
52
+ DataFrameComponent: U,
53
+ containerClassName: "chart container big-number-trend-container",
54
+ defaultBackgroundColor: "none",
55
+ ...e
56
+ }
57
+ );
188
58
  export {
189
- be as default
59
+ q as default
190
60
  };