@devgateway/dvz-ui-react 1.6.19 → 1.7.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 (153) hide show
  1. package/dist/cjs/_virtual/_commonjsHelpers.js +1 -0
  2. package/dist/cjs/_virtual/debounce.js +1 -0
  3. package/dist/cjs/api/commons.js +1 -1
  4. package/dist/cjs/embeddable/big-filter/BigNumberGroup.js +1 -0
  5. package/dist/cjs/embeddable/big-filter/BigNumberItem.js +1 -0
  6. package/dist/cjs/embeddable/big-filter/DataProvider.js +1 -0
  7. package/dist/cjs/embeddable/big-filter/index.js +1 -0
  8. package/dist/cjs/embeddable/big-number/index.js +1 -1
  9. package/dist/cjs/embeddable/big-number-trend/Alternative.js +1 -0
  10. package/dist/cjs/embeddable/big-number-trend/Classic.js +1 -0
  11. package/dist/cjs/embeddable/big-number-trend/index.js +1 -1
  12. package/dist/cjs/embeddable/chart/Bar.js +1 -1
  13. package/dist/cjs/embeddable/chart/Line.js +1 -1
  14. package/dist/cjs/embeddable/chart/data/Bar.js +1 -1
  15. package/dist/cjs/embeddable/chart/index.js +1 -1
  16. package/dist/cjs/embeddable/d3Map/BaseLayer.js +1 -1
  17. package/dist/cjs/embeddable/d3Map/BreaksStyles.js +1 -1
  18. package/dist/cjs/embeddable/d3Map/DataLayer.js +1 -1
  19. package/dist/cjs/embeddable/d3Map/FlowLayer.js +1 -1
  20. package/dist/cjs/embeddable/d3Map/GradientColors.js +1 -1
  21. package/dist/cjs/embeddable/d3Map/LatLongLayer.js +1 -1
  22. package/dist/cjs/embeddable/d3Map/Layer.js +1 -1
  23. package/dist/cjs/embeddable/d3Map/Legends.js +1 -1
  24. package/dist/cjs/embeddable/d3Map/ProjectedContainer.js +1 -1
  25. package/dist/cjs/embeddable/d3Map/Utils.js +1 -1
  26. package/dist/cjs/embeddable/d3Map/ZoomControl.js +1 -1
  27. package/dist/cjs/embeddable/d3Map/index.js +1 -1
  28. package/dist/cjs/embeddable/data/CategoriesProvider.js +1 -1
  29. package/dist/cjs/embeddable/data/D3MapDataConsumer.js +1 -0
  30. package/dist/cjs/embeddable/data/D3MapDataProvider.js +1 -0
  31. package/dist/cjs/embeddable/data/DataContext.js +1 -1
  32. package/dist/cjs/embeddable/data/DataProvider.js +1 -1
  33. package/dist/cjs/embeddable/data-paragraph/index.js +1 -0
  34. package/dist/cjs/embeddable/download/dom-to-image.js +2 -2
  35. package/dist/cjs/embeddable/download/index.js +5 -5
  36. package/dist/cjs/embeddable/filter/index.js +1 -1
  37. package/dist/cjs/embeddable/grouped-bars/GroupedBars.js +1 -0
  38. package/dist/cjs/embeddable/grouped-bars/index.js +1 -0
  39. package/dist/cjs/embeddable/index.js +1 -1
  40. package/dist/cjs/embeddable/reducers/data-api.js +1 -1
  41. package/dist/cjs/embeddable/reducers/data.js +1 -1
  42. package/dist/cjs/embeddable/utils/common.js +1 -1
  43. package/dist/cjs/index.js +1 -1
  44. package/dist/cjs/layout/Customizer.js +1 -1
  45. package/dist/cjs/layout/PreviewComponent.js +1 -1
  46. package/dist/cjs/layout/containers/SlugPostContainer.js +1 -1
  47. package/dist/cjs/node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_Symbol.js +1 -0
  48. package/dist/cjs/node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_baseGetTag.js +1 -0
  49. package/dist/cjs/node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_baseTrim.js +1 -0
  50. package/dist/cjs/node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_freeGlobal.js +1 -0
  51. package/dist/cjs/node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_getRawTag.js +1 -0
  52. package/dist/cjs/node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_objectToString.js +1 -0
  53. package/dist/cjs/node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_root.js +1 -0
  54. package/dist/cjs/node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_trimmedEndIndex.js +1 -0
  55. package/dist/cjs/node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/debounce.js +1 -0
  56. package/dist/cjs/node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/isObject.js +1 -0
  57. package/dist/cjs/node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/isObjectLike.js +1 -0
  58. package/dist/cjs/node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/isSymbol.js +1 -0
  59. package/dist/cjs/node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/now.js +1 -0
  60. package/dist/cjs/node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/toNumber.js +1 -0
  61. package/dist/cjs/styles.css +1 -1
  62. package/dist/esm/_virtual/_commonjsHelpers.js +8 -0
  63. package/dist/esm/_virtual/debounce.js +7 -0
  64. package/dist/esm/api/commons.js +26 -17
  65. package/dist/esm/embeddable/big-filter/BigNumberGroup.js +129 -0
  66. package/dist/esm/embeddable/big-filter/BigNumberItem.js +107 -0
  67. package/dist/esm/embeddable/big-filter/DataProvider.js +53 -0
  68. package/dist/esm/embeddable/big-filter/index.js +130 -0
  69. package/dist/esm/embeddable/big-number/index.js +154 -102
  70. package/dist/esm/embeddable/big-number-trend/Alternative.js +227 -0
  71. package/dist/esm/embeddable/big-number-trend/Classic.js +190 -0
  72. package/dist/esm/embeddable/big-number-trend/index.js +12 -147
  73. package/dist/esm/embeddable/chart/Bar.js +450 -395
  74. package/dist/esm/embeddable/chart/Line.js +216 -184
  75. package/dist/esm/embeddable/chart/data/Bar.js +16 -18
  76. package/dist/esm/embeddable/chart/index.js +168 -162
  77. package/dist/esm/embeddable/d3Map/BaseLayer.js +25 -28
  78. package/dist/esm/embeddable/d3Map/BreaksStyles.js +17 -10
  79. package/dist/esm/embeddable/d3Map/DataLayer.js +290 -289
  80. package/dist/esm/embeddable/d3Map/FlowLayer.js +122 -136
  81. package/dist/esm/embeddable/d3Map/GradientColors.js +27 -20
  82. package/dist/esm/embeddable/d3Map/LatLongLayer.js +62 -62
  83. package/dist/esm/embeddable/d3Map/Layer.js +31 -27
  84. package/dist/esm/embeddable/d3Map/Legends.js +204 -190
  85. package/dist/esm/embeddable/d3Map/ProjectedContainer.js +1 -3
  86. package/dist/esm/embeddable/d3Map/Utils.js +12 -8
  87. package/dist/esm/embeddable/d3Map/ZoomControl.js +41 -41
  88. package/dist/esm/embeddable/d3Map/index.js +135 -117
  89. package/dist/esm/embeddable/data/CategoriesProvider.js +39 -26
  90. package/dist/esm/embeddable/data/D3MapDataConsumer.js +7 -0
  91. package/dist/esm/embeddable/data/D3MapDataProvider.js +83 -0
  92. package/dist/esm/embeddable/data/DataContext.js +2 -2
  93. package/dist/esm/embeddable/data/DataProvider.js +125 -56
  94. package/dist/esm/embeddable/data-paragraph/index.js +168 -0
  95. package/dist/esm/embeddable/download/dom-to-image.js +163 -148
  96. package/dist/esm/embeddable/download/index.js +102 -76
  97. package/dist/esm/embeddable/filter/index.js +335 -298
  98. package/dist/esm/embeddable/grouped-bars/GroupedBars.js +549 -0
  99. package/dist/esm/embeddable/grouped-bars/index.js +16 -0
  100. package/dist/esm/embeddable/index.js +33 -30
  101. package/dist/esm/embeddable/reducers/data-api.js +44 -35
  102. package/dist/esm/embeddable/reducers/data.js +141 -182
  103. package/dist/esm/embeddable/utils/common.js +3 -3
  104. package/dist/esm/index.js +111 -94
  105. package/dist/esm/layout/Customizer.js +10 -9
  106. package/dist/esm/layout/PreviewComponent.js +23 -26
  107. package/dist/esm/layout/containers/SlugPostContainer.js +9 -8
  108. package/dist/esm/node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_Symbol.js +11 -0
  109. package/dist/esm/node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_baseGetTag.js +16 -0
  110. package/dist/esm/node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_baseTrim.js +14 -0
  111. package/dist/esm/node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_freeGlobal.js +11 -0
  112. package/dist/esm/node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_getRawTag.js +21 -0
  113. package/dist/esm/node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_objectToString.js +13 -0
  114. package/dist/esm/node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_root.js +11 -0
  115. package/dist/esm/node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_trimmedEndIndex.js +15 -0
  116. package/dist/esm/node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/debounce.js +60 -0
  117. package/dist/esm/node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/isObject.js +13 -0
  118. package/dist/esm/node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/isObjectLike.js +12 -0
  119. package/dist/esm/node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/isSymbol.js +15 -0
  120. package/dist/esm/node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/now.js +13 -0
  121. package/dist/esm/node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/toNumber.js +28 -0
  122. package/dist/esm/styles.css +1 -1
  123. package/dist/types/api/commons.d.ts +4 -1
  124. package/dist/types/embeddable/big-filter/BigNumberGroup.d.ts +3 -0
  125. package/dist/types/embeddable/big-filter/BigNumberItem.d.ts +2 -0
  126. package/dist/types/embeddable/big-filter/DataProvider.d.ts +7 -0
  127. package/dist/types/embeddable/big-filter/index.d.ts +5 -0
  128. package/dist/types/embeddable/big-number-trend/Alternative.d.ts +5 -0
  129. package/dist/types/embeddable/big-number-trend/Classic.d.ts +5 -0
  130. package/dist/types/embeddable/big-number-trend/index.d.ts +2 -4
  131. package/dist/types/embeddable/chart/Bar.d.ts +3 -0
  132. package/dist/types/embeddable/chart/Line.d.ts +6 -0
  133. package/dist/types/embeddable/d3Map/GradientColors.d.ts +6 -2
  134. package/dist/types/embeddable/d3Map/Layer.d.ts +1 -1
  135. package/dist/types/embeddable/d3Map/Utils.d.ts +1 -1
  136. package/dist/types/embeddable/data/D3MapDataProvider.d.ts +7 -0
  137. package/dist/types/embeddable/data/index.d.ts +6 -0
  138. package/dist/types/embeddable/data-paragraph/index.d.ts +5 -0
  139. package/dist/types/embeddable/filter/index.d.ts +13 -1
  140. package/dist/types/embeddable/grouped-bars/GroupedBars.d.ts +5 -0
  141. package/dist/types/embeddable/grouped-bars/index.d.ts +3 -0
  142. package/dist/types/embeddable/reducers/data-api.d.ts +5 -0
  143. package/dist/types/embeddable/reducers/data.d.ts +16 -9
  144. package/dist/types/embeddable/utils/index.d.ts +1 -0
  145. package/dist/types/embeddable/utils/parseUtils.d.ts +0 -6
  146. package/dist/types/index.d.ts +6 -0
  147. package/dist/types/layout/Customizer.d.ts +1 -0
  148. package/dist/types/layout/containers/PageContainer.d.ts +8 -0
  149. package/dist/types/layout/containers/PostContainer.d.ts +0 -0
  150. package/dist/types/layout/index.d.ts +1 -0
  151. package/dist/types/utils/Logger.d.ts +1 -0
  152. package/package.json +4 -3
  153. /package/dist/types/embeddable/data/{DataConsumerMap.d.ts → D3MapDataConsumer.d.ts} +0 -0
@@ -1,136 +1,188 @@
1
- import { jsx as o, jsxs as E } from "react/jsx-runtime";
2
- import { useRef as V, useState as T, useEffect as O } from "react";
3
- import { Container as q } from "semantic-ui-react";
4
- import H from "../data/DataProvider.js";
5
- import J from "../data/DataConsumer.js";
1
+ import { jsx as a, jsxs as x } from "react/jsx-runtime";
2
+ import { useRef as H, useState as O, useEffect as J } from "react";
3
+ import { Container as K } from "semantic-ui-react";
4
+ import $ from "../data/DataProvider.js";
5
+ import Q from "../data/DataConsumer.js";
6
6
  import "@devgateway/wp-react-lib";
7
- import { connect as $ } from "react-redux";
8
- import { useSpring as k, animated as B } from "@react-spring/web";
9
- const G = (l) => {
7
+ import { connect as W } from "react-redux";
8
+ import { useSpring as X, animated as Y } from "@react-spring/web";
9
+ const Z = (r) => {
10
10
  const {
11
- editing: n = !1,
12
- unique: c,
11
+ editing: e = !1,
12
+ unique: n,
13
13
  intl: t,
14
- childContent: a,
15
- "data-csv": f = "",
16
- "data-dvz-proxy-dataset-id": g,
17
- "data-no-data-message": P = "No data matches your selection",
18
- "data-view-mode": y = "info",
19
- "data-height": m,
20
- "data-app": d,
21
- "data-measures": F = "{}",
22
- "data-format": b = "{}",
23
- "data-group": s,
24
- "data-filters": u = "[]",
25
- "data-number-font-size": r = 20,
26
- "data-label-font-size": v = 20,
27
- "data-number-color": D = "#000000",
28
- "data-label-color": S = "#000000",
29
- "data-label": C = "",
30
- "data-wait-for-filters": z = "false",
31
- "data-no-data-text": I = "-"
32
- } = l, h = t.locale, x = V(null), p = (e) => n ? e : decodeURIComponent(e), N = (e) => {
14
+ childContent: u,
15
+ "data-csv": D = "",
16
+ "data-dimension1": p = "none",
17
+ "data-dvz-proxy-dataset-id": v,
18
+ "data-no-data-message": F = "No data matches your selection",
19
+ "data-view-mode": z = "info",
20
+ "data-height": b,
21
+ "data-app": o,
22
+ "data-measures": l = "{}",
23
+ "data-format": S = "{}",
24
+ "data-group": f,
25
+ "data-filters": g = "[]",
26
+ "data-number-font-size": h = 20,
27
+ "data-label-font-size": i = 20,
28
+ "data-number-color": c = "#000000",
29
+ "data-label-color": d = "#000000",
30
+ "data-label": y = "",
31
+ "data-group-label": P = "",
32
+ "data-group-label-color": R = "",
33
+ "data-group-label-font-size": T = "",
34
+ "data-wait-for-filters": U = "false",
35
+ "data-no-data-text": A = "-"
36
+ } = r, E = t.locale, V = H(null), q = (s) => e ? s : decodeURIComponent(s), N = (s) => {
33
37
  try {
34
- return JSON.parse(p(e));
38
+ return JSON.parse(q(s));
35
39
  } catch {
36
- console.error("error parsing value:" + e);
40
+ console.error("error parsing value:" + s);
37
41
  }
38
42
  return null;
39
- }, i = N(b), U = i ? {
40
- style: i.style === "compacted" ? "decimal" : i.style,
41
- notation: i.style === "compacted" ? "compact" : "standard",
42
- currency: i.currency,
43
- minimumFractionDigits: parseInt(i.minimumFractionDigits),
44
- maximumFractionDigits: parseInt(i.maximumFractionDigits)
43
+ }, C = N(l), m = C && C[o] ? C[o].format : null;
44
+ console.log(m);
45
+ const B = m ? {
46
+ style: m.style === "compacted" ? "decimal" : m.style,
47
+ notation: m.style === "compacted" ? "compact" : "standard",
48
+ currency: m.currency,
49
+ minimumFractionDigits: parseInt(m.minimumFractionDigits),
50
+ maximumFractionDigits: parseInt(m.maximumFractionDigits)
45
51
  } : {
46
52
  notation: "standard",
47
53
  currency: "USD",
48
54
  minimumFractionDigits: 2,
49
55
  maximumFractionDigits: 2
50
- }, [W, X] = T(y), A = n ? m - 80 : m - 40, j = {}, w = N(u) || {};
51
- w && w.forEach && w.forEach((e) => {
52
- e.value != null && e.value.filter((M) => M != null && M.toString().trim() != "").length > 0 && (j[e.param] = e.value);
53
- }), g && (j.dvzProxyDatasetId = g);
54
- const R = [];
55
- return /* @__PURE__ */ o("div", { ref: x, children: /* @__PURE__ */ o(q, { className: "chart container big-number-container", style: { height: m + "px" }, fluid: !0, children: /* @__PURE__ */ o(
56
- H,
56
+ }, [te, ae] = O(z), G = e ? b - 80 : b - 40, L = {}, j = N(g) || {};
57
+ j && j.forEach && j.forEach((s) => {
58
+ s.value != null && s.value.filter((M) => M != null && M.toString().trim() != "").length > 0 && (L[s.param] = s.value);
59
+ }), v && (L.dvzProxyDatasetId = v);
60
+ const w = [];
61
+ return p != "none" && w.push(p), /* @__PURE__ */ a("div", { ref: V, children: /* @__PURE__ */ a(K, { className: "chart container big-number-container", style: { height: b + "px" }, fluid: !0, children: o && o != "none" && /* @__PURE__ */ a(
62
+ $,
57
63
  {
58
- style: { height: `${A}px` },
59
- params: j,
60
- app: d,
61
- group: s,
62
- csv: f,
63
- editing: n,
64
- waitForFilters: z === "true",
65
- store: [d, c, ...R],
66
- source: R.join("/"),
67
- children: /* @__PURE__ */ o(J, { children: /* @__PURE__ */ o(
68
- K,
64
+ style: { height: `${G}px` },
65
+ params: L,
66
+ app: o,
67
+ group: f,
68
+ source: w.join("/"),
69
+ csv: D,
70
+ editing: e,
71
+ waitForFilters: U === "true",
72
+ store: [o, n, ...w],
73
+ children: /* @__PURE__ */ a(Q, { children: /* @__PURE__ */ a(
74
+ _,
69
75
  {
70
- locale: h,
76
+ dimension: p,
77
+ locale: E,
71
78
  intl: t,
72
- app: d,
73
- format: U,
74
- measure: N(F)[0] || null,
75
- label: C,
76
- numberFontSize: r,
77
- numberColor: D,
78
- labelFontSize: v,
79
- labelColor: S,
80
- noDataText: I
79
+ app: o,
80
+ format: B,
81
+ measures: N(l),
82
+ label: y,
83
+ numberFontSize: h,
84
+ numberColor: c,
85
+ labelFontSize: i,
86
+ labelColor: d,
87
+ noDataText: A,
88
+ groupLabel: P,
89
+ groupLabelColor: R,
90
+ groupLabelFontSize: T
81
91
  }
82
92
  ) })
83
93
  }
84
94
  ) }) });
85
- }, K = (l) => {
86
- var h, x;
95
+ }, _ = (r) => {
87
96
  const {
88
- app: n,
89
- measure: c,
97
+ app: e,
98
+ measures: n,
90
99
  data: t,
91
- format: a,
92
- label: f,
93
- numberColor: g,
94
- numberFontSize: P,
95
- labelColor: y,
96
- labelFontSize: m,
97
- noDataText: d = "-",
98
- intl: F
99
- } = l;
100
- let b = c, s = t;
101
- n === "csv" && ((h = t == null ? void 0 : t.meta) != null && h.fields) && ((x = t == null ? void 0 : t.data) != null && x.length) && (b = t.meta.fields[0], s = t.data[0]);
102
- const u = (s == null ? void 0 : s[b]) ?? null, r = u ? (a == null ? void 0 : a.style) === "percent" ? u / 100 : u : null, [v, D] = T(r);
103
- O(() => {
104
- r != null && D(r);
105
- }, [r]);
106
- const { number: S } = k({
100
+ format: u,
101
+ label: D,
102
+ numberColor: p,
103
+ numberFontSize: v,
104
+ dimension: F,
105
+ labelColor: z,
106
+ labelFontSize: b,
107
+ noDataText: o = "-",
108
+ intl: l,
109
+ groupLabel: S,
110
+ groupLabelColor: f,
111
+ groupLabelFontSize: g
112
+ } = r, h = n && n[e] ? Object.keys(n[e]).filter((i) => n[e][i].selected) : [];
113
+ if (F != "none") {
114
+ const i = t.metadata.types.filter((c) => c.dimension === F)[0];
115
+ return t.children.map((c) => {
116
+ const d = i.items.filter((y) => y.code == c.value)[0].value;
117
+ return /* @__PURE__ */ x("div", { className: "big-number-group", style: { display: "flex", flexDirection: "column" }, children: [
118
+ /* @__PURE__ */ x(
119
+ "span",
120
+ {
121
+ className: "big-number-title",
122
+ style: { color: f, fontSize: g + "px" },
123
+ children: [
124
+ /* @__PURE__ */ a("span", { className: "dimension-text", children: d }),
125
+ /* @__PURE__ */ x("span", { className: "group-text", children: [
126
+ " ",
127
+ S
128
+ ] })
129
+ ]
130
+ }
131
+ ),
132
+ /* @__PURE__ */ a("div", { className: "big-number-row", style: { display: "flex", flexDirection: "row" }, children: h.map((y) => /* @__PURE__ */ a("div", { className: "big-number-parent", children: /* @__PURE__ */ a(
133
+ I,
134
+ {
135
+ showDimensionLabel: !0,
136
+ metadata: i,
137
+ dataItem: c,
138
+ measureField: y,
139
+ measure: n[e][y],
140
+ ...r
141
+ }
142
+ ) })) })
143
+ ] });
144
+ });
145
+ } else
146
+ return /* @__PURE__ */ x("div", { children: [
147
+ /* @__PURE__ */ x("span", { style: { color: f, fontSize: g + "px" }, children: [
148
+ " ",
149
+ S
150
+ ] }),
151
+ h.map((i) => /* @__PURE__ */ a(I, { dataItem: t, measureField: i, measure: n[e][i], ...r }))
152
+ ] });
153
+ }, I = ({ dataItem: r, format: e, measureField: n, measure: t, numberColor: u, numberFontSize: D, labelColor: p, labelFontSize: v, noDataText: F, label: z, intl: b }) => {
154
+ const o = (r == null ? void 0 : r[n]) ?? null, l = o ? (e == null ? void 0 : e.style) === "percent" ? o / 100 : o : null, [S, f] = O(l);
155
+ J(() => {
156
+ l != null && f(l);
157
+ }, [l]);
158
+ const { number: g } = X({
107
159
  from: { number: 0 },
108
- to: { number: v ?? 0 },
160
+ to: { number: S ?? 0 },
109
161
  // reset: true,
110
162
  config: {
111
163
  mass: 1,
112
164
  tension: 120,
113
165
  friction: 30
114
166
  }
115
- }), C = {
116
- color: decodeURIComponent(g),
117
- fontSize: P + "px",
167
+ }), h = {
168
+ color: decodeURIComponent(u),
169
+ fontSize: D + "px",
118
170
  textAlign: "center"
119
- }, z = {
120
- color: decodeURIComponent(y),
121
- fontSize: m + "px",
171
+ }, i = {
172
+ color: decodeURIComponent(p),
173
+ fontSize: v + "px",
122
174
  textAlign: "center"
123
- }, I = (p) => F.formatNumber(p, { ...a });
124
- return /* @__PURE__ */ E("div", { children: [
125
- /* @__PURE__ */ o("div", { style: C, className: "big-number", children: r === null ? d : /* @__PURE__ */ o(B.span, { children: S.to((p) => I(p)) }) }),
126
- f && /* @__PURE__ */ o("div", { style: z, className: "big-number-label", children: f })
175
+ }, c = (d) => b.formatNumber(d, { ...e });
176
+ return /* @__PURE__ */ x("div", { className: "big-number", children: [
177
+ /* @__PURE__ */ a("div", { style: h, className: "big-number-value", children: l === null ? F : /* @__PURE__ */ a(Y.span, { children: g.to((d) => c(d)) }) }),
178
+ (t == null ? void 0 : t.customLabel) && /* @__PURE__ */ a("div", { style: i, className: "big-number-label", children: t.customLabel })
127
179
  ] });
128
- }, L = (l, n) => {
129
- const { "data-app": c, "data-group": t } = n, a = l.getIn(["data", "measures", c, t]);
130
- return a ? {
131
- injectedMeasures: a
180
+ }, k = (r, e) => {
181
+ const { "data-app": n, "data-group": t } = e, u = r.getIn(["data", "measures", n, t]);
182
+ return u ? {
183
+ injectedMeasures: u
132
184
  } : {};
133
- }, Q = {}, nt = $(L, Q)(G);
185
+ }, ee = {}, de = W(k, ee)(Z);
134
186
  export {
135
- nt as default
187
+ de as default
136
188
  };
@@ -0,0 +1,227 @@
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) => {
11
+ 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,
190
+ {
191
+ content: P,
192
+ position: "top center",
193
+ inverted: t.tooltipStyle === "dark",
194
+ size: "small",
195
+ trigger: /* @__PURE__ */ y("div", { style: I, children: [
196
+ /* @__PURE__ */ y("div", { className: "percentage", style: N, children: [
197
+ " ",
198
+ l > 0 ? "+" : "",
199
+ l == 0 ? "=" : "",
200
+ x
201
+ ] }),
202
+ /* @__PURE__ */ n("div", { className: "percentage-yoy", style: z, children: "YoY" })
203
+ ] })
204
+ }
205
+ ) : /* @__PURE__ */ y("div", { style: I, children: [
206
+ /* @__PURE__ */ y("div", { className: "percentage", style: N, children: [
207
+ " ",
208
+ l > 0 ? "+" : "",
209
+ l == 0 ? "=" : "",
210
+ x
211
+ ] }),
212
+ /* @__PURE__ */ n("div", { className: "percentage-yoy", style: z, children: "YoY" })
213
+ ] }))
214
+ ] })
215
+ ] }),
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) }) }) })
218
+ ] });
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);
225
+ export {
226
+ ve as default
227
+ };