@oanda/labs-currency-power-balance-widget 1.0.49 → 1.0.51
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.
- package/CHANGELOG.md +412 -0
- package/dist/main/CurrencyPowerBalanceWidget/ChartWithData.js +7 -6
- package/dist/main/CurrencyPowerBalanceWidget/ChartWithData.js.map +1 -1
- package/dist/main/CurrencyPowerBalanceWidget/CurrencyPowerBalance.js +6 -1
- package/dist/main/CurrencyPowerBalanceWidget/CurrencyPowerBalance.js.map +1 -1
- package/dist/main/CurrencyPowerBalanceWidget/Main.js +42 -3
- package/dist/main/CurrencyPowerBalanceWidget/Main.js.map +1 -1
- package/dist/main/CurrencyPowerBalanceWidget/components/Chart/Chart.js +9 -2
- package/dist/main/CurrencyPowerBalanceWidget/components/Chart/Chart.js.map +1 -1
- package/dist/main/CurrencyPowerBalanceWidget/components/Chart/options/constants.js +3 -1
- package/dist/main/CurrencyPowerBalanceWidget/components/Chart/options/constants.js.map +1 -1
- package/dist/main/CurrencyPowerBalanceWidget/components/Chart/options/formatters.js +17 -1
- package/dist/main/CurrencyPowerBalanceWidget/components/Chart/options/formatters.js.map +1 -1
- package/dist/main/CurrencyPowerBalanceWidget/components/Chart/options/getOption.js +3 -8
- package/dist/main/CurrencyPowerBalanceWidget/components/Chart/options/getOption.js.map +1 -1
- package/dist/main/CurrencyPowerBalanceWidget/components/Chart/types.js.map +1 -1
- package/dist/main/CurrencyPowerBalanceWidget/render.js +5 -1
- package/dist/main/CurrencyPowerBalanceWidget/render.js.map +1 -1
- package/dist/main/CurrencyPowerBalanceWidget/types.js.map +1 -1
- package/dist/module/CurrencyPowerBalanceWidget/ChartWithData.js +7 -6
- package/dist/module/CurrencyPowerBalanceWidget/ChartWithData.js.map +1 -1
- package/dist/module/CurrencyPowerBalanceWidget/CurrencyPowerBalance.js +6 -1
- package/dist/module/CurrencyPowerBalanceWidget/CurrencyPowerBalance.js.map +1 -1
- package/dist/module/CurrencyPowerBalanceWidget/Main.js +43 -4
- package/dist/module/CurrencyPowerBalanceWidget/Main.js.map +1 -1
- package/dist/module/CurrencyPowerBalanceWidget/components/Chart/Chart.js +9 -2
- package/dist/module/CurrencyPowerBalanceWidget/components/Chart/Chart.js.map +1 -1
- package/dist/module/CurrencyPowerBalanceWidget/components/Chart/options/constants.js +3 -1
- package/dist/module/CurrencyPowerBalanceWidget/components/Chart/options/constants.js.map +1 -1
- package/dist/module/CurrencyPowerBalanceWidget/components/Chart/options/formatters.js +17 -2
- package/dist/module/CurrencyPowerBalanceWidget/components/Chart/options/formatters.js.map +1 -1
- package/dist/module/CurrencyPowerBalanceWidget/components/Chart/options/getOption.js +4 -9
- package/dist/module/CurrencyPowerBalanceWidget/components/Chart/options/getOption.js.map +1 -1
- package/dist/module/CurrencyPowerBalanceWidget/components/Chart/types.js.map +1 -1
- package/dist/module/CurrencyPowerBalanceWidget/render.js +5 -1
- package/dist/module/CurrencyPowerBalanceWidget/render.js.map +1 -1
- package/dist/module/CurrencyPowerBalanceWidget/types.js.map +1 -1
- package/dist/types/CurrencyPowerBalanceWidget/ChartWithData.d.ts +1 -1
- package/dist/types/CurrencyPowerBalanceWidget/CurrencyPowerBalance.d.ts +1 -1
- package/dist/types/CurrencyPowerBalanceWidget/Main.d.ts +2 -1
- package/dist/types/CurrencyPowerBalanceWidget/components/Chart/Chart.d.ts +1 -1
- package/dist/types/CurrencyPowerBalanceWidget/components/Chart/options/constants.d.ts +13 -2
- package/dist/types/CurrencyPowerBalanceWidget/components/Chart/options/formatters.d.ts +8 -2
- package/dist/types/CurrencyPowerBalanceWidget/components/Chart/options/getOption.d.ts +2 -2
- package/dist/types/CurrencyPowerBalanceWidget/components/Chart/types.d.ts +1 -0
- package/dist/types/CurrencyPowerBalanceWidget/types.d.ts +7 -0
- package/package.json +3 -3
- package/src/CurrencyPowerBalanceWidget/ChartWithData.tsx +5 -5
- package/src/CurrencyPowerBalanceWidget/CurrencyPowerBalance.tsx +2 -2
- package/src/CurrencyPowerBalanceWidget/Main.tsx +40 -4
- package/src/CurrencyPowerBalanceWidget/components/Chart/Chart.tsx +6 -2
- package/src/CurrencyPowerBalanceWidget/components/Chart/options/constants.tsx +14 -1
- package/src/CurrencyPowerBalanceWidget/components/Chart/options/formatters.ts +18 -2
- package/src/CurrencyPowerBalanceWidget/components/Chart/options/getOption.ts +6 -9
- package/src/CurrencyPowerBalanceWidget/components/Chart/types.ts +1 -0
- package/src/CurrencyPowerBalanceWidget/render.tsx +3 -1
- package/src/CurrencyPowerBalanceWidget/types.ts +8 -0
- package/test/Main.test.tsx +56 -2
- package/dist/main/CurrencyPowerBalanceWidget/Tool.js +0 -28
- package/dist/main/CurrencyPowerBalanceWidget/Tool.js.map +0 -1
- package/dist/module/CurrencyPowerBalanceWidget/Tool.js +0 -20
- package/dist/module/CurrencyPowerBalanceWidget/Tool.js.map +0 -1
- package/dist/types/CurrencyPowerBalanceWidget/Tool.d.ts +0 -3
- package/src/CurrencyPowerBalanceWidget/Tool.tsx +0 -27
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,418 @@
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
5
|
|
|
6
|
+
## 1.0.51 (2024-04-15)
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
## 1.0.111 (2024-04-11)
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
## 1.0.110 (2024-04-05)
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
## 1.0.109 (2024-04-05)
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
## 1.0.108 (2024-04-04)
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
## 1.0.107 (2024-04-03)
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
## 1.0.106 (2024-03-29)
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
## 1.0.105 (2024-03-28)
|
|
35
|
+
|
|
36
|
+
|
|
37
|
+
|
|
38
|
+
## 1.0.104 (2024-03-21)
|
|
39
|
+
|
|
40
|
+
|
|
41
|
+
|
|
42
|
+
## 1.0.103 (2024-03-20)
|
|
43
|
+
|
|
44
|
+
|
|
45
|
+
|
|
46
|
+
## 1.0.102 (2024-03-20)
|
|
47
|
+
|
|
48
|
+
|
|
49
|
+
|
|
50
|
+
## 1.0.101 (2024-03-13)
|
|
51
|
+
|
|
52
|
+
|
|
53
|
+
|
|
54
|
+
## 1.0.100 (2024-03-12)
|
|
55
|
+
|
|
56
|
+
|
|
57
|
+
|
|
58
|
+
## 1.0.99 (2024-03-11)
|
|
59
|
+
|
|
60
|
+
|
|
61
|
+
|
|
62
|
+
## 1.0.98 (2024-03-07)
|
|
63
|
+
|
|
64
|
+
|
|
65
|
+
|
|
66
|
+
## 1.0.97 (2024-03-06)
|
|
67
|
+
|
|
68
|
+
|
|
69
|
+
|
|
70
|
+
## 1.0.96 (2024-03-06)
|
|
71
|
+
|
|
72
|
+
|
|
73
|
+
|
|
74
|
+
## 1.0.95 (2024-03-04)
|
|
75
|
+
|
|
76
|
+
|
|
77
|
+
|
|
78
|
+
## 1.0.94 (2024-02-29)
|
|
79
|
+
|
|
80
|
+
|
|
81
|
+
|
|
82
|
+
## 1.0.93 (2024-02-28)
|
|
83
|
+
|
|
84
|
+
|
|
85
|
+
|
|
86
|
+
## 1.0.92 (2024-02-28)
|
|
87
|
+
|
|
88
|
+
|
|
89
|
+
|
|
90
|
+
## 1.0.91 (2024-02-23)
|
|
91
|
+
|
|
92
|
+
|
|
93
|
+
|
|
94
|
+
## 1.0.90 (2024-02-23)
|
|
95
|
+
|
|
96
|
+
|
|
97
|
+
|
|
98
|
+
## 1.0.89 (2024-02-21)
|
|
99
|
+
|
|
100
|
+
|
|
101
|
+
|
|
102
|
+
## 1.0.88 (2024-02-21)
|
|
103
|
+
|
|
104
|
+
|
|
105
|
+
|
|
106
|
+
## 1.0.87 (2024-02-20)
|
|
107
|
+
|
|
108
|
+
|
|
109
|
+
|
|
110
|
+
## 1.0.86 (2024-02-20)
|
|
111
|
+
|
|
112
|
+
|
|
113
|
+
|
|
114
|
+
## 1.0.85 (2024-02-13)
|
|
115
|
+
|
|
116
|
+
|
|
117
|
+
|
|
118
|
+
## 1.0.84 (2024-02-13)
|
|
119
|
+
|
|
120
|
+
|
|
121
|
+
|
|
122
|
+
## 1.0.83 (2024-02-09)
|
|
123
|
+
|
|
124
|
+
|
|
125
|
+
|
|
126
|
+
## 1.0.82 (2024-02-05)
|
|
127
|
+
|
|
128
|
+
|
|
129
|
+
|
|
130
|
+
## 1.0.81 (2024-02-05)
|
|
131
|
+
|
|
132
|
+
|
|
133
|
+
|
|
134
|
+
## 1.0.80 (2024-02-05)
|
|
135
|
+
|
|
136
|
+
|
|
137
|
+
|
|
138
|
+
## 1.0.79 (2024-02-05)
|
|
139
|
+
|
|
140
|
+
|
|
141
|
+
|
|
142
|
+
## 1.0.78 (2024-01-30)
|
|
143
|
+
|
|
144
|
+
|
|
145
|
+
|
|
146
|
+
## 1.0.77 (2024-01-25)
|
|
147
|
+
|
|
148
|
+
|
|
149
|
+
|
|
150
|
+
## 1.0.76 (2024-01-25)
|
|
151
|
+
|
|
152
|
+
|
|
153
|
+
|
|
154
|
+
## 1.0.75 (2024-01-22)
|
|
155
|
+
|
|
156
|
+
|
|
157
|
+
|
|
158
|
+
## 1.0.74 (2024-01-22)
|
|
159
|
+
|
|
160
|
+
|
|
161
|
+
|
|
162
|
+
## 1.0.73 (2024-01-22)
|
|
163
|
+
|
|
164
|
+
|
|
165
|
+
|
|
166
|
+
## 1.0.72 (2024-01-19)
|
|
167
|
+
|
|
168
|
+
|
|
169
|
+
|
|
170
|
+
## 1.0.71 (2024-01-18)
|
|
171
|
+
|
|
172
|
+
|
|
173
|
+
|
|
174
|
+
## 1.0.70 (2024-01-17)
|
|
175
|
+
|
|
176
|
+
|
|
177
|
+
|
|
178
|
+
## 1.0.69 (2024-01-17)
|
|
179
|
+
|
|
180
|
+
|
|
181
|
+
|
|
182
|
+
## 1.0.68 (2024-01-15)
|
|
183
|
+
|
|
184
|
+
|
|
185
|
+
|
|
186
|
+
## 1.0.67 (2024-01-15)
|
|
187
|
+
|
|
188
|
+
|
|
189
|
+
|
|
190
|
+
## 1.0.66 (2024-01-12)
|
|
191
|
+
|
|
192
|
+
|
|
193
|
+
|
|
194
|
+
## 1.0.65 (2024-01-11)
|
|
195
|
+
|
|
196
|
+
|
|
197
|
+
|
|
198
|
+
## 1.0.64 (2024-01-11)
|
|
199
|
+
|
|
200
|
+
|
|
201
|
+
|
|
202
|
+
## 1.0.63 (2024-01-11)
|
|
203
|
+
|
|
204
|
+
|
|
205
|
+
|
|
206
|
+
## 1.0.62 (2024-01-10)
|
|
207
|
+
|
|
208
|
+
**Note:** Version bump only for package @oanda/labs-currency-power-balance-widget
|
|
209
|
+
|
|
210
|
+
|
|
211
|
+
|
|
212
|
+
|
|
213
|
+
|
|
214
|
+
## 1.0.50 (2024-04-11)
|
|
215
|
+
|
|
216
|
+
|
|
217
|
+
|
|
218
|
+
## 1.0.110 (2024-04-05)
|
|
219
|
+
|
|
220
|
+
|
|
221
|
+
|
|
222
|
+
## 1.0.109 (2024-04-05)
|
|
223
|
+
|
|
224
|
+
|
|
225
|
+
|
|
226
|
+
## 1.0.108 (2024-04-04)
|
|
227
|
+
|
|
228
|
+
|
|
229
|
+
|
|
230
|
+
## 1.0.107 (2024-04-03)
|
|
231
|
+
|
|
232
|
+
|
|
233
|
+
|
|
234
|
+
## 1.0.106 (2024-03-29)
|
|
235
|
+
|
|
236
|
+
|
|
237
|
+
|
|
238
|
+
## 1.0.105 (2024-03-28)
|
|
239
|
+
|
|
240
|
+
|
|
241
|
+
|
|
242
|
+
## 1.0.104 (2024-03-21)
|
|
243
|
+
|
|
244
|
+
|
|
245
|
+
|
|
246
|
+
## 1.0.103 (2024-03-20)
|
|
247
|
+
|
|
248
|
+
|
|
249
|
+
|
|
250
|
+
## 1.0.102 (2024-03-20)
|
|
251
|
+
|
|
252
|
+
|
|
253
|
+
|
|
254
|
+
## 1.0.101 (2024-03-13)
|
|
255
|
+
|
|
256
|
+
|
|
257
|
+
|
|
258
|
+
## 1.0.100 (2024-03-12)
|
|
259
|
+
|
|
260
|
+
|
|
261
|
+
|
|
262
|
+
## 1.0.99 (2024-03-11)
|
|
263
|
+
|
|
264
|
+
|
|
265
|
+
|
|
266
|
+
## 1.0.98 (2024-03-07)
|
|
267
|
+
|
|
268
|
+
|
|
269
|
+
|
|
270
|
+
## 1.0.97 (2024-03-06)
|
|
271
|
+
|
|
272
|
+
|
|
273
|
+
|
|
274
|
+
## 1.0.96 (2024-03-06)
|
|
275
|
+
|
|
276
|
+
|
|
277
|
+
|
|
278
|
+
## 1.0.95 (2024-03-04)
|
|
279
|
+
|
|
280
|
+
|
|
281
|
+
|
|
282
|
+
## 1.0.94 (2024-02-29)
|
|
283
|
+
|
|
284
|
+
|
|
285
|
+
|
|
286
|
+
## 1.0.93 (2024-02-28)
|
|
287
|
+
|
|
288
|
+
|
|
289
|
+
|
|
290
|
+
## 1.0.92 (2024-02-28)
|
|
291
|
+
|
|
292
|
+
|
|
293
|
+
|
|
294
|
+
## 1.0.91 (2024-02-23)
|
|
295
|
+
|
|
296
|
+
|
|
297
|
+
|
|
298
|
+
## 1.0.90 (2024-02-23)
|
|
299
|
+
|
|
300
|
+
|
|
301
|
+
|
|
302
|
+
## 1.0.89 (2024-02-21)
|
|
303
|
+
|
|
304
|
+
|
|
305
|
+
|
|
306
|
+
## 1.0.88 (2024-02-21)
|
|
307
|
+
|
|
308
|
+
|
|
309
|
+
|
|
310
|
+
## 1.0.87 (2024-02-20)
|
|
311
|
+
|
|
312
|
+
|
|
313
|
+
|
|
314
|
+
## 1.0.86 (2024-02-20)
|
|
315
|
+
|
|
316
|
+
|
|
317
|
+
|
|
318
|
+
## 1.0.85 (2024-02-13)
|
|
319
|
+
|
|
320
|
+
|
|
321
|
+
|
|
322
|
+
## 1.0.84 (2024-02-13)
|
|
323
|
+
|
|
324
|
+
|
|
325
|
+
|
|
326
|
+
## 1.0.83 (2024-02-09)
|
|
327
|
+
|
|
328
|
+
|
|
329
|
+
|
|
330
|
+
## 1.0.82 (2024-02-05)
|
|
331
|
+
|
|
332
|
+
|
|
333
|
+
|
|
334
|
+
## 1.0.81 (2024-02-05)
|
|
335
|
+
|
|
336
|
+
|
|
337
|
+
|
|
338
|
+
## 1.0.80 (2024-02-05)
|
|
339
|
+
|
|
340
|
+
|
|
341
|
+
|
|
342
|
+
## 1.0.79 (2024-02-05)
|
|
343
|
+
|
|
344
|
+
|
|
345
|
+
|
|
346
|
+
## 1.0.78 (2024-01-30)
|
|
347
|
+
|
|
348
|
+
|
|
349
|
+
|
|
350
|
+
## 1.0.77 (2024-01-25)
|
|
351
|
+
|
|
352
|
+
|
|
353
|
+
|
|
354
|
+
## 1.0.76 (2024-01-25)
|
|
355
|
+
|
|
356
|
+
|
|
357
|
+
|
|
358
|
+
## 1.0.75 (2024-01-22)
|
|
359
|
+
|
|
360
|
+
|
|
361
|
+
|
|
362
|
+
## 1.0.74 (2024-01-22)
|
|
363
|
+
|
|
364
|
+
|
|
365
|
+
|
|
366
|
+
## 1.0.73 (2024-01-22)
|
|
367
|
+
|
|
368
|
+
|
|
369
|
+
|
|
370
|
+
## 1.0.72 (2024-01-19)
|
|
371
|
+
|
|
372
|
+
|
|
373
|
+
|
|
374
|
+
## 1.0.71 (2024-01-18)
|
|
375
|
+
|
|
376
|
+
|
|
377
|
+
|
|
378
|
+
## 1.0.70 (2024-01-17)
|
|
379
|
+
|
|
380
|
+
|
|
381
|
+
|
|
382
|
+
## 1.0.69 (2024-01-17)
|
|
383
|
+
|
|
384
|
+
|
|
385
|
+
|
|
386
|
+
## 1.0.68 (2024-01-15)
|
|
387
|
+
|
|
388
|
+
|
|
389
|
+
|
|
390
|
+
## 1.0.67 (2024-01-15)
|
|
391
|
+
|
|
392
|
+
|
|
393
|
+
|
|
394
|
+
## 1.0.66 (2024-01-12)
|
|
395
|
+
|
|
396
|
+
|
|
397
|
+
|
|
398
|
+
## 1.0.65 (2024-01-11)
|
|
399
|
+
|
|
400
|
+
|
|
401
|
+
|
|
402
|
+
## 1.0.64 (2024-01-11)
|
|
403
|
+
|
|
404
|
+
|
|
405
|
+
|
|
406
|
+
## 1.0.63 (2024-01-11)
|
|
407
|
+
|
|
408
|
+
|
|
409
|
+
|
|
410
|
+
## 1.0.62 (2024-01-10)
|
|
411
|
+
|
|
412
|
+
**Note:** Version bump only for package @oanda/labs-currency-power-balance-widget
|
|
413
|
+
|
|
414
|
+
|
|
415
|
+
|
|
416
|
+
|
|
417
|
+
|
|
6
418
|
## 1.0.49 (2024-04-05)
|
|
7
419
|
|
|
8
420
|
|
|
@@ -13,9 +13,10 @@ var _getCurrencyPowerBalance = require("../gql/getCurrencyPowerBalance");
|
|
|
13
13
|
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
|
|
14
14
|
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
|
15
15
|
const ChartWithData = _ref => {
|
|
16
|
-
var _data$currencyPowerBa
|
|
16
|
+
var _data$currencyPowerBa;
|
|
17
17
|
let {
|
|
18
|
-
timeUnit
|
|
18
|
+
timeUnit,
|
|
19
|
+
currencies
|
|
19
20
|
} = _ref;
|
|
20
21
|
const {
|
|
21
22
|
size
|
|
@@ -31,15 +32,15 @@ const ChartWithData = _ref => {
|
|
|
31
32
|
},
|
|
32
33
|
fetchPolicy: 'cache-and-network'
|
|
33
34
|
});
|
|
34
|
-
const
|
|
35
|
-
const showError = (data === null || data === void 0 || (_data$currencyPowerBa2 = data.currencyPowerBalance) === null || _data$currencyPowerBa2 === void 0 ? void 0 : _data$currencyPowerBa2.length) === 0 || error;
|
|
35
|
+
const showError = (data === null || data === void 0 || (_data$currencyPowerBa = data.currencyPowerBalance) === null || _data$currencyPowerBa === void 0 ? void 0 : _data$currencyPowerBa.length) === 0 || error || currencies && (currencies.length === 0 || currencies.length === 1);
|
|
36
36
|
return _react.default.createElement(_react.default.Fragment, null, loading && _react.default.createElement("div", {
|
|
37
37
|
className: "lw-mb-[50px] lw-flex lw-h-[375px] lw-w-full lw-items-center lw-border lw-border-solid lw-border-border-primary"
|
|
38
38
|
}, _react.default.createElement(_labsWidgetCommon.Spinner, {
|
|
39
39
|
size: _labsWidgetCommon.SpinnerSize.lg
|
|
40
|
-
})), !loading &&
|
|
40
|
+
})), !loading && !showError && _react.default.createElement(_Chart.Chart, {
|
|
41
41
|
values: data === null || data === void 0 ? void 0 : data.currencyPowerBalance,
|
|
42
|
-
timeUnit: timeUnit
|
|
42
|
+
timeUnit: timeUnit,
|
|
43
|
+
currencies: currencies
|
|
43
44
|
}), !loading && showError && _react.default.createElement("div", {
|
|
44
45
|
className: "lw-flex lw-h-[375px] lw-w-full lw-items-center lw-border lw-border-solid lw-border-border-primary"
|
|
45
46
|
}, _react.default.createElement(_labsWidgetCommon.ChartError, null)), isDesktop && _react.default.createElement(_labsWidgetCommon.Tooltip, {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ChartWithData.js","names":["_react","_interopRequireWildcard","require","_client","_labsWidgetCommon","_Chart","_constants","_getCurrencyPowerBalance","_getRequireWildcardCache","e","WeakMap","r","t","__esModule","default","has","get","n","__proto__","a","Object","defineProperty","getOwnPropertyDescriptor","u","hasOwnProperty","call","i","set","ChartWithData","_ref","_data$currencyPowerBa","
|
|
1
|
+
{"version":3,"file":"ChartWithData.js","names":["_react","_interopRequireWildcard","require","_client","_labsWidgetCommon","_Chart","_constants","_getCurrencyPowerBalance","_getRequireWildcardCache","e","WeakMap","r","t","__esModule","default","has","get","n","__proto__","a","Object","defineProperty","getOwnPropertyDescriptor","u","hasOwnProperty","call","i","set","ChartWithData","_ref","_data$currencyPowerBa","timeUnit","currencies","size","useContext","ThemeContext","isDesktop","Size","DESKTOP","loading","data","error","useQuery","getCurrencyPowerBalance","variables","fetchPolicy","showError","currencyPowerBalance","length","createElement","Fragment","className","Spinner","SpinnerSize","lg","Chart","values","ChartError","Tooltip","id","CURRENCY_POWER_BALANCE_TOOLTIP_ID","exports"],"sources":["../../../src/CurrencyPowerBalanceWidget/ChartWithData.tsx"],"sourcesContent":["import React, { useContext } from 'react';\nimport { useQuery } from '@apollo/client';\nimport {\n ChartError, Spinner, SpinnerSize, ThemeContext, Tooltip, Size,\n} from '@oanda/labs-widget-common';\nimport { Chart } from './components/Chart';\nimport { CURRENCY_POWER_BALANCE_TOOLTIP_ID } from './constants';\nimport { getCurrencyPowerBalance } from '../gql/getCurrencyPowerBalance';\nimport { ChartWithDataProps } from './types';\nimport { GetCurrencyPowerBalanceQuery, GetCurrencyPowerBalanceQueryVariables } from '../gql/types/graphql';\n\nconst ChartWithData = ({ timeUnit, currencies }: ChartWithDataProps) => {\n const { size } = useContext(ThemeContext);\n const isDesktop = size === Size.DESKTOP;\n const { loading, data, error } = useQuery<\n GetCurrencyPowerBalanceQuery,\n GetCurrencyPowerBalanceQueryVariables\n >(getCurrencyPowerBalance, {\n variables: {\n timeUnit,\n },\n fetchPolicy: 'cache-and-network',\n });\n\n const showError = data?.currencyPowerBalance?.length === 0 || error\n || (currencies && (currencies.length === 0 || currencies.length === 1));\n\n return (\n <>\n {loading\n && (\n <div className=\"lw-mb-[50px] lw-flex lw-h-[375px] lw-w-full lw-items-center lw-border lw-border-solid lw-border-border-primary\">\n <Spinner size={SpinnerSize.lg} />\n </div>\n )}\n {!loading && !showError && (\n <Chart values={data?.currencyPowerBalance!} timeUnit={timeUnit} currencies={currencies} />\n )}\n {!loading && showError && (\n <div className=\"lw-flex lw-h-[375px] lw-w-full lw-items-center lw-border lw-border-solid lw-border-border-primary\">\n <ChartError />\n </div>\n )}\n {isDesktop && <Tooltip id={CURRENCY_POWER_BALANCE_TOOLTIP_ID} />}\n </>\n );\n};\n\nexport { ChartWithData };\n"],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAAC,uBAAA,CAAAC,OAAA;AACA,IAAAC,OAAA,GAAAD,OAAA;AACA,IAAAE,iBAAA,GAAAF,OAAA;AAGA,IAAAG,MAAA,GAAAH,OAAA;AACA,IAAAI,UAAA,GAAAJ,OAAA;AACA,IAAAK,wBAAA,GAAAL,OAAA;AAAyE,SAAAM,yBAAAC,CAAA,6BAAAC,OAAA,mBAAAC,CAAA,OAAAD,OAAA,IAAAE,CAAA,OAAAF,OAAA,YAAAF,wBAAA,YAAAA,CAAAC,CAAA,WAAAA,CAAA,GAAAG,CAAA,GAAAD,CAAA,KAAAF,CAAA;AAAA,SAAAR,wBAAAQ,CAAA,EAAAE,CAAA,SAAAA,CAAA,IAAAF,CAAA,IAAAA,CAAA,CAAAI,UAAA,SAAAJ,CAAA,eAAAA,CAAA,uBAAAA,CAAA,yBAAAA,CAAA,WAAAK,OAAA,EAAAL,CAAA,QAAAG,CAAA,GAAAJ,wBAAA,CAAAG,CAAA,OAAAC,CAAA,IAAAA,CAAA,CAAAG,GAAA,CAAAN,CAAA,UAAAG,CAAA,CAAAI,GAAA,CAAAP,CAAA,OAAAQ,CAAA,KAAAC,SAAA,UAAAC,CAAA,GAAAC,MAAA,CAAAC,cAAA,IAAAD,MAAA,CAAAE,wBAAA,WAAAC,CAAA,IAAAd,CAAA,oBAAAc,CAAA,OAAAC,cAAA,CAAAC,IAAA,CA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AAA,CAAAmC,aAAA;IAAKE,SAAS,EAAC;EAAgH,GAC7HnD,MAAA,CAAAc,OAAA,CAAAmC,aAAA,CAAC7C,iBAAA,CAAAgD,OAAO;IAACnB,IAAI,EAAEoB,6BAAW,CAACC;EAAG,CAAE,CAC7B,CACJ,EACA,CAACf,OAAO,IAAI,CAACO,SAAS,IACrB9C,MAAA,CAAAc,OAAA,CAAAmC,aAAA,CAAC5C,MAAA,CAAAkD,KAAK;IAACC,MAAM,EAAEhB,IAAI,aAAJA,IAAI,uBAAJA,IAAI,CAAEO,oBAAsB;IAAChB,QAAQ,EAAEA,QAAS;IAACC,UAAU,EAAEA;EAAW,CAAE,CAC1F,EACA,CAACO,OAAO,IAAIO,SAAS,IACpB9C,MAAA,CAAAc,OAAA,CAAAmC,aAAA;IAAKE,SAAS,EAAC;EAAmG,GAChHnD,MAAA,CAAAc,OAAA,CAAAmC,aAAA,CAAC7C,iBAAA,CAAAqD,UAAU,MAAE,CACV,CACN,EACArB,SAAS,IAAIpC,MAAA,CAAAc,OAAA,CAAAmC,aAAA,CAAC7C,iBAAA,CAAAsD,OAAO;IAACC,EAAE,EAAEC;EAAkC,CAAE,CAC/D,CAAC;AAEP,CAAC;AAACC,OAAA,CAAAjC,aAAA,GAAAA,aAAA","ignoreList":[]}
|
|
@@ -16,6 +16,8 @@ const CurrencyPowerBalance = _ref => {
|
|
|
16
16
|
graphqlUrl,
|
|
17
17
|
theme,
|
|
18
18
|
locale,
|
|
19
|
+
timeUnit,
|
|
20
|
+
currencies,
|
|
19
21
|
isParamError
|
|
20
22
|
} = _ref;
|
|
21
23
|
const client = new _client.ApolloClient({
|
|
@@ -31,7 +33,10 @@ const CurrencyPowerBalance = _ref => {
|
|
|
31
33
|
client: client
|
|
32
34
|
}, isParamError ? _react.default.createElement("div", {
|
|
33
35
|
className: "lw-flex lw-h-[425px] lw-w-full lw-items-center lw-border lw-border-solid lw-border-border-primary"
|
|
34
|
-
}, _react.default.createElement(_labsWidgetCommon.ChartError, null)) : _react.default.createElement(_Main.Main,
|
|
36
|
+
}, _react.default.createElement(_labsWidgetCommon.ChartError, null)) : _react.default.createElement(_Main.Main, {
|
|
37
|
+
timeUnit: timeUnit,
|
|
38
|
+
currencies: currencies
|
|
39
|
+
}))));
|
|
35
40
|
};
|
|
36
41
|
exports.CurrencyPowerBalance = CurrencyPowerBalance;
|
|
37
42
|
//# sourceMappingURL=CurrencyPowerBalance.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CurrencyPowerBalance.js","names":["_react","_interopRequireDefault","require","_client","_labsWidgetCommon","_monoI18n","_Main","_translations","obj","__esModule","default","CurrencyPowerBalance","_ref","graphqlUrl","theme","locale","isParamError","client","ApolloClient","uri","cache","InMemoryCache","createElement","ThemeProvider","LocaleProvider","getLocale","translations","ApolloProvider","className","ChartError","Main","exports"],"sources":["../../../src/CurrencyPowerBalanceWidget/CurrencyPowerBalance.tsx"],"sourcesContent":["import React from 'react';\nimport { ApolloClient, InMemoryCache, ApolloProvider } from '@apollo/client';\nimport { ChartError, ThemeProvider, getLocale } from '@oanda/labs-widget-common';\nimport { LocaleProvider } from '@oanda/mono-i18n';\nimport { Main } from './Main';\nimport { CurrencyPowerBalanceConfig } from './types';\nimport { translations } from '../translations';\n\nconst CurrencyPowerBalance = ({\n graphqlUrl, theme, locale, isParamError,\n}: CurrencyPowerBalanceConfig) => {\n const client = new ApolloClient({\n uri: graphqlUrl,\n cache: new InMemoryCache(),\n });\n\n return (\n <ThemeProvider theme={theme}>\n <LocaleProvider locale={getLocale(locale)} translations={translations}>\n <ApolloProvider client={client}>\n {isParamError ? (\n <div className=\"lw-flex lw-h-[425px] lw-w-full lw-items-center lw-border lw-border-solid lw-border-border-primary\">\n <ChartError />\n </div>\n ) : <Main />}\n </ApolloProvider>\n </LocaleProvider>\n </ThemeProvider>\n );\n};\n\nexport { CurrencyPowerBalance };\n"],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,OAAA,GAAAD,OAAA;AACA,IAAAE,iBAAA,GAAAF,OAAA;AACA,IAAAG,SAAA,GAAAH,OAAA;AACA,IAAAI,KAAA,GAAAJ,OAAA;AAEA,IAAAK,aAAA,GAAAL,OAAA;AAA+C,SAAAD,uBAAAO,GAAA,WAAAA,GAAA,IAAAA,GAAA,CAAAC,UAAA,GAAAD,GAAA,KAAAE,OAAA,EAAAF,GAAA;AAE/C,MAAMG,oBAAoB,GAAGC,IAAA,IAEK;EAAA,IAFJ;IAC5BC,UAAU;IAAEC,KAAK;IAAEC,MAAM;IAAEC;
|
|
1
|
+
{"version":3,"file":"CurrencyPowerBalance.js","names":["_react","_interopRequireDefault","require","_client","_labsWidgetCommon","_monoI18n","_Main","_translations","obj","__esModule","default","CurrencyPowerBalance","_ref","graphqlUrl","theme","locale","timeUnit","currencies","isParamError","client","ApolloClient","uri","cache","InMemoryCache","createElement","ThemeProvider","LocaleProvider","getLocale","translations","ApolloProvider","className","ChartError","Main","exports"],"sources":["../../../src/CurrencyPowerBalanceWidget/CurrencyPowerBalance.tsx"],"sourcesContent":["import React from 'react';\nimport { ApolloClient, InMemoryCache, ApolloProvider } from '@apollo/client';\nimport { ChartError, ThemeProvider, getLocale } from '@oanda/labs-widget-common';\nimport { LocaleProvider } from '@oanda/mono-i18n';\nimport { Main } from './Main';\nimport { CurrencyPowerBalanceConfig } from './types';\nimport { translations } from '../translations';\n\nconst CurrencyPowerBalance = ({\n graphqlUrl, theme, locale, timeUnit, currencies, isParamError,\n}: CurrencyPowerBalanceConfig) => {\n const client = new ApolloClient({\n uri: graphqlUrl,\n cache: new InMemoryCache(),\n });\n\n return (\n <ThemeProvider theme={theme}>\n <LocaleProvider locale={getLocale(locale)} translations={translations}>\n <ApolloProvider client={client}>\n {isParamError ? (\n <div className=\"lw-flex lw-h-[425px] lw-w-full lw-items-center lw-border lw-border-solid lw-border-border-primary\">\n <ChartError />\n </div>\n ) : <Main timeUnit={timeUnit} currencies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A,CAAAc,aAAA,CAAClB,KAAA,CAAA0B,IAAI;IAAChB,QAAQ,EAAEA,QAAS;IAACC,UAAU,EAAEA;EAAW,CAAE,CACzC,CACF,CACH,CAAC;AAEpB,CAAC;AAACgB,OAAA,CAAAtB,oBAAA,GAAAA,oBAAA","ignoreList":[]}
|
|
@@ -6,14 +6,53 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
exports.Main = void 0;
|
|
7
7
|
var _react = _interopRequireWildcard(require("react"));
|
|
8
8
|
var _labsWidgetCommon = require("@oanda/labs-widget-common");
|
|
9
|
-
var
|
|
9
|
+
var _monoI18n = require("@oanda/mono-i18n");
|
|
10
|
+
var _graphql = require("../gql/types/graphql");
|
|
11
|
+
var _TimeUnitSwitch = require("./components/TimeUnitSwitch");
|
|
12
|
+
var _config = require("./config");
|
|
13
|
+
var _ChartWithData = require("./ChartWithData");
|
|
10
14
|
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
|
|
11
15
|
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
|
12
|
-
const Main =
|
|
16
|
+
const Main = _ref => {
|
|
17
|
+
let {
|
|
18
|
+
timeUnit,
|
|
19
|
+
currencies
|
|
20
|
+
} = _ref;
|
|
13
21
|
const {
|
|
14
22
|
size
|
|
15
23
|
} = (0, _react.useContext)(_labsWidgetCommon.ThemeContext);
|
|
16
|
-
|
|
24
|
+
const {
|
|
25
|
+
lang
|
|
26
|
+
} = (0, _monoI18n.useLocale)();
|
|
27
|
+
const [selectedTimeUnit, setSelectedTimeUnit] = (0, _react.useState)(timeUnit || _graphql.CurrencyPowerBalanceTimeUnit.CurrentDay);
|
|
28
|
+
return _react.default.createElement(_react.default.Fragment, null, size && _react.default.createElement("div", {
|
|
29
|
+
"data-testid": "currency-power-balance-wrapper",
|
|
30
|
+
className: "lw-flex lw-flex-col lw-text-sm lw-tracking-normal"
|
|
31
|
+
}, timeUnit && currencies ? _react.default.createElement(_react.default.Fragment, null, _config.timeUnitConfig.filter(_ref2 => {
|
|
32
|
+
let {
|
|
33
|
+
value
|
|
34
|
+
} = _ref2;
|
|
35
|
+
return value === selectedTimeUnit;
|
|
36
|
+
}).map(_ref3 => {
|
|
37
|
+
let {
|
|
38
|
+
tooltipLabel,
|
|
39
|
+
label
|
|
40
|
+
} = _ref3;
|
|
41
|
+
return _react.default.createElement("div", {
|
|
42
|
+
"data-testid": "time-unit-label",
|
|
43
|
+
key: label,
|
|
44
|
+
className: "lw-mb-6 lw-flex lw-justify-center lw-font-sans lw-text-lg lw-font-bold"
|
|
45
|
+
}, tooltipLabel ? _react.default.createElement("span", null, "".concat(lang(tooltipLabel.translationKey, {
|
|
46
|
+
count: tooltipLabel.count
|
|
47
|
+
}))) : _react.default.createElement("span", null, "".concat(lang(label))));
|
|
48
|
+
})) : _react.default.createElement(_TimeUnitSwitch.TimeUnitSwitch, {
|
|
49
|
+
selected: selectedTimeUnit,
|
|
50
|
+
callback: setSelectedTimeUnit,
|
|
51
|
+
options: _config.timeUnitConfig
|
|
52
|
+
}), _react.default.createElement(_ChartWithData.ChartWithData, {
|
|
53
|
+
timeUnit: selectedTimeUnit,
|
|
54
|
+
currencies: timeUnit && currencies
|
|
55
|
+
})));
|
|
17
56
|
};
|
|
18
57
|
exports.Main = Main;
|
|
19
58
|
//# sourceMappingURL=Main.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Main.js","names":["_react","_interopRequireWildcard","require","_labsWidgetCommon","
|
|
1
|
+
{"version":3,"file":"Main.js","names":["_react","_interopRequireWildcard","require","_labsWidgetCommon","_monoI18n","_graphql","_TimeUnitSwitch","_config","_ChartWithData","_getRequireWildcardCache","e","WeakMap","r","t","__esModule","default","has","get","n","__proto__","a","Object","defineProperty","getOwnPropertyDescriptor","u","hasOwnProperty","call","i","set","Main","_ref","timeUnit","currencies","size","useContext","ThemeContext","lang","useLocale","selectedTimeUnit","setSelectedTimeUnit","useState","CurrencyPowerBalanceTimeUnit","CurrentDay","createElement","Fragment","className","timeUnitConfig","filter","_ref2","value","map","_ref3","tooltipLabel","label","key","concat","translationKey","count","TimeUnitSwitch","selected","callback","options","ChartWithData","exports"],"sources":["../../../src/CurrencyPowerBalanceWidget/Main.tsx"],"sourcesContent":["import React, { useContext, useState } from 'react';\nimport { ThemeContext } from '@oanda/labs-widget-common';\nimport { useLocale } from '@oanda/mono-i18n';\nimport { CurrencyPowerBalanceTimeUnit } from '../gql/types/graphql';\nimport { TimeUnitSwitch } from './components/TimeUnitSwitch';\nimport { timeUnitConfig } from './config';\nimport { ChartWithData } from './ChartWithData';\nimport { MainProps } from './types';\n\nconst Main = ({ timeUnit, currencies }: MainProps) => {\n const { size } = useContext(ThemeContext);\n const { lang } = useLocale();\n const [selectedTimeUnit, setSelectedTimeUnit] = useState(\n timeUnit || CurrencyPowerBalanceTimeUnit.CurrentDay,\n );\n return (\n <>\n {size && (\n <div\n data-testid=\"currency-power-balance-wrapper\"\n className=\"lw-flex lw-flex-col lw-text-sm lw-tracking-normal\"\n >\n {timeUnit && currencies ? (\n <>\n {timeUnitConfig\n .filter(({ value }) => value === selectedTimeUnit)\n .map(({ tooltipLabel, label }) => (\n <div data-testid=\"time-unit-label\" key={label} className=\"lw-mb-6 lw-flex lw-justify-center lw-font-sans lw-text-lg lw-font-bold\">\n {tooltipLabel ? <span>{`${lang(tooltipLabel!.translationKey, { count: tooltipLabel!.count })}`}</span> : <span>{`${lang(label)}`}</span>}\n </div>\n ))}\n </>\n ) : (\n <TimeUnitSwitch\n selected={selectedTimeUnit}\n callback={setSelectedTimeUnit}\n options={timeUnitConfig}\n />\n )}\n <ChartWithData\n timeUnit={selectedTimeUnit}\n currencies={timeUnit && currencies}\n />\n </div>\n )}\n </>\n );\n};\n\nexport { Main };\n"],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAAC,uBAAA,CAAAC,OAAA;AACA,IAAAC,iBAAA,GAAAD,OAAA;AACA,IAAAE,SAAA,GAAAF,OAAA;AACA,IAAAG,QAAA,GAAAH,OAAA;AACA,IAAAI,eAAA,GAAAJ,OAAA;AACA,IAAAK,OAAA,GAAAL,OAAA;AACA,IAAAM,cAAA,GAAAN,OAAA;AAAgD,SAAAO,yBAAAC,CAAA,6BAAAC,OAAA,mBAAAC,CAAA,OAAAD,OAAA,IAAAE,CAAA,OAAAF,OAAA,YAAAF,wBAAA,YAAAA,CAAAC,CAAA,WAAAA,CAAA,GAAAG,CAAA,GAAAD,CAAA,KAAAF,CAAA;AAAA,SAAAT,wBAAAS,CAAA,EAAAE,CAAA,SAAAA,CAAA,IAAAF,CAAA,IAAAA,CAAA,CAAAI,UAAA,SAAAJ,CAAA,eAAAA,CAAA,uBAAAA,CAAA,yBAAAA,CAAA,WAAAK,OAAA,EAAAL,CAAA,QAAAG,CAAA,GAAAJ,wBAAA,CAAAG,CAAA,OAAAC,CAAA,IAAAA,CAAA,CAAAG,GAAA,CAAAN,CAAA,UAAAG,CAAA,CAAAI,GAAA,CAAAP,CAAA,OAAAQ,CAAA,KAAAC,SAAA,UAAAC,CAAA,GAAAC,MAAA,CAAAC,cAAA,IAAAD,MAAA,CAAAE,wBAAA,WAAAC,CAAA,IAAAd,CAAA,oBAAAc,CAAA,OAAAC,cAAA,CAAAC,IAAA,CAAAhB,CAAA,EAAAc,CAAA,SAAAG,CAAA,GAAAP,CAAA,GAAAC,MAAA,CAAAE,wBAAA,CAAAb,CAAA,EAAAc,CAAA,UA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eAAY,iBAAiB;MAACW,GAAG,EAAED,KAAM;MAACR,SAAS,EAAC;IAAwE,GAC9HO,YAAY,GAAGpD,MAAA,CAAAe,OAAA,CAAA4B,aAAA,kBAAAY,MAAA,CAAUnB,IAAI,CAACgB,YAAY,CAAEI,cAAc,EAAE;MAAEC,KAAK,EAAEL,YAAY,CAAEK;IAAM,CAAC,CAAC,CAAS,CAAC,GAAGzD,MAAA,CAAAe,OAAA,CAAA4B,aAAA,kBAAAY,MAAA,CAAUnB,IAAI,CAACiB,KAAK,CAAC,CAAS,CACpI,CAAC;EAAA,CACP,CACH,CAAC,GAEHrD,MAAA,CAAAe,OAAA,CAAA4B,aAAA,CAACrC,eAAA,CAAAoD,cAAc;IACbC,QAAQ,EAAErB,gBAAiB;IAC3BsB,QAAQ,EAAErB,mBAAoB;IAC9BsB,OAAO,EAAEf;EAAe,CACzB,CACF,EACD9C,MAAA,CAAAe,OAAA,CAAA4B,aAAA,CAACnC,cAAA,CAAAsD,aAAa;IACZ/B,QAAQ,EAAEO,gBAAiB;IAC3BN,UAAU,EAAED,QAAQ,IAAIC;EAAW,CACpC,CACE,CAEP,CAAC;AAEP,CAAC;AAAC+B,OAAA,CAAAlC,IAAA,GAAAA,IAAA","ignoreList":[]}
|
|
@@ -22,7 +22,8 @@ echarts.registerTheme('light_theme', (0, _labsWidgetCommon.getChartTheme)(_labsW
|
|
|
22
22
|
const Chart = _ref => {
|
|
23
23
|
let {
|
|
24
24
|
values,
|
|
25
|
-
timeUnit
|
|
25
|
+
timeUnit,
|
|
26
|
+
currencies
|
|
26
27
|
} = _ref;
|
|
27
28
|
const {
|
|
28
29
|
isDark,
|
|
@@ -31,6 +32,12 @@ const Chart = _ref => {
|
|
|
31
32
|
const isDesktop = size === _labsWidgetCommon.Size.DESKTOP;
|
|
32
33
|
const isMobile = size === _labsWidgetCommon.Size.MOBILE;
|
|
33
34
|
const echartRef = (0, _react.useRef)(null);
|
|
35
|
+
const chartData = currencies ? values.filter(_ref2 => {
|
|
36
|
+
let {
|
|
37
|
+
currency
|
|
38
|
+
} = _ref2;
|
|
39
|
+
return currencies.includes(currency);
|
|
40
|
+
}) : values;
|
|
34
41
|
(0, _react.useEffect)(() => {
|
|
35
42
|
if (echartRef.current) {
|
|
36
43
|
const echartInstance = echartRef.current.getEchartsInstance();
|
|
@@ -45,7 +52,7 @@ const Chart = _ref => {
|
|
|
45
52
|
height: "".concat(_constants.CHART_HEIGHT, "px"),
|
|
46
53
|
width: '100%'
|
|
47
54
|
},
|
|
48
|
-
option: (0, _options.getOption)(
|
|
55
|
+
option: (0, _options.getOption)(chartData, timeUnit, isDark)
|
|
49
56
|
});
|
|
50
57
|
};
|
|
51
58
|
exports.Chart = Chart;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Chart.js","names":["_react","_interopRequireWildcard","require","_core","_interopRequireDefault","echarts","_charts","_renderers","_components","_labsWidgetCommon","_constants","_options","obj","__esModule","default","_getRequireWildcardCache","e","WeakMap","r","t","has","get","n","__proto__","a","Object","defineProperty","getOwnPropertyDescriptor","u","hasOwnProperty","call","i","set","use","GridSimpleComponent","GraphicComponent","TooltipComponent","LegendPlainComponent","LineChart","CanvasRenderer","registerTheme","getChartTheme","Theme","Dark","Light","Chart","_ref","values","timeUnit","isDark","size","useContext","ThemeContext","isDesktop","Size","DESKTOP","isMobile","MOBILE","echartRef","useRef","useEffect","current","echartInstance","getEchartsInstance","setOption","getResponsiveOption","createElement","ref","theme","style","height","concat","CHART_HEIGHT","width","option","getOption","exports"],"sources":["../../../../../src/CurrencyPowerBalanceWidget/components/Chart/Chart.tsx"],"sourcesContent":["import React, { useRef, useEffect, useContext } from 'react';\nimport ReactEChartsCore from 'echarts-for-react/lib/core';\nimport * as echarts from 'echarts/core';\nimport { LineChart } from 'echarts/charts';\nimport { CanvasRenderer } from 'echarts/renderers';\nimport {\n GridSimpleComponent, GraphicComponent, TooltipComponent, LegendPlainComponent,\n} from 'echarts/components';\nimport {\n Theme, ThemeContext, getChartTheme, Size,\n} from '@oanda/labs-widget-common';\nimport {\n CHART_HEIGHT,\n} from './options/constants';\nimport { getResponsiveOption, getOption } from './options';\nimport { ChartProps } from './types';\n\necharts.use([\n GridSimpleComponent,\n GraphicComponent,\n TooltipComponent,\n LegendPlainComponent,\n LineChart,\n CanvasRenderer,\n]);\n\necharts.registerTheme('dark_theme', getChartTheme(Theme.Dark));\necharts.registerTheme('light_theme', getChartTheme(Theme.Light));\n\nconst Chart = ({ values, timeUnit }: ChartProps) => {\n const { isDark, size } = useContext(ThemeContext);\n const isDesktop = size === Size.DESKTOP;\n const isMobile = size === Size.MOBILE;\n\n const echartRef = useRef(null);\n\n useEffect(() => {\n if (echartRef.current) {\n // @ts-ignore\n const echartInstance = echartRef.current.getEchartsInstance() as echarts.EChartsType;\n\n echartInstance.setOption(\n getResponsiveOption(isDesktop, isMobile, isDark),\n );\n }\n }, [echartRef, isDesktop, isMobile, isDark]);\n\n return (\n <ReactEChartsCore\n echarts={echarts}\n ref={echartRef}\n theme={isDark ? 'dark_theme' : 'light_theme'}\n style={{\n height: `${CHART_HEIGHT}px`,\n width: '100%',\n }}\n option={getOption(
|
|
1
|
+
{"version":3,"file":"Chart.js","names":["_react","_interopRequireWildcard","require","_core","_interopRequireDefault","echarts","_charts","_renderers","_components","_labsWidgetCommon","_constants","_options","obj","__esModule","default","_getRequireWildcardCache","e","WeakMap","r","t","has","get","n","__proto__","a","Object","defineProperty","getOwnPropertyDescriptor","u","hasOwnProperty","call","i","set","use","GridSimpleComponent","GraphicComponent","TooltipComponent","LegendPlainComponent","LineChart","CanvasRenderer","registerTheme","getChartTheme","Theme","Dark","Light","Chart","_ref","values","timeUnit","currencies","isDark","size","useContext","ThemeContext","isDesktop","Size","DESKTOP","isMobile","MOBILE","echartRef","useRef","chartData","filter","_ref2","currency","includes","useEffect","current","echartInstance","getEchartsInstance","setOption","getResponsiveOption","createElement","ref","theme","style","height","concat","CHART_HEIGHT","width","option","getOption","exports"],"sources":["../../../../../src/CurrencyPowerBalanceWidget/components/Chart/Chart.tsx"],"sourcesContent":["import React, { useRef, useEffect, useContext } from 'react';\nimport ReactEChartsCore from 'echarts-for-react/lib/core';\nimport * as echarts from 'echarts/core';\nimport { LineChart } from 'echarts/charts';\nimport { CanvasRenderer } from 'echarts/renderers';\nimport {\n GridSimpleComponent, GraphicComponent, TooltipComponent, LegendPlainComponent,\n} from 'echarts/components';\nimport {\n Theme, ThemeContext, getChartTheme, Size,\n} from '@oanda/labs-widget-common';\nimport {\n CHART_HEIGHT,\n} from './options/constants';\nimport { getResponsiveOption, getOption } from './options';\nimport { ChartProps } from './types';\n\necharts.use([\n GridSimpleComponent,\n GraphicComponent,\n TooltipComponent,\n LegendPlainComponent,\n LineChart,\n CanvasRenderer,\n]);\n\necharts.registerTheme('dark_theme', getChartTheme(Theme.Dark));\necharts.registerTheme('light_theme', getChartTheme(Theme.Light));\n\nconst Chart = ({ values, timeUnit, currencies }: ChartProps) => {\n const { isDark, size } = useContext(ThemeContext);\n const isDesktop = size === Size.DESKTOP;\n const isMobile = size === Size.MOBILE;\n\n const echartRef = useRef(null);\n\n const chartData = currencies\n ? values.filter(({ currency }) => currencies.includes(currency))\n : values;\n\n useEffect(() => {\n if (echartRef.current) {\n // @ts-ignore\n const echartInstance = echartRef.current.getEchartsInstance() as echarts.EChartsType;\n\n echartInstance.setOption(\n getResponsiveOption(isDesktop, isMobile, isDark),\n );\n }\n }, [echartRef, isDesktop, isMobile, isDark]);\n\n return (\n <ReactEChartsCore\n echarts={echarts}\n ref={echartRef}\n theme={isDark ? 'dark_theme' : 'light_theme'}\n style={{\n height: `${CHART_HEIGHT}px`,\n width: '100%',\n }}\n option={getOption(chartData, timeUnit, isDark)}\n />\n );\n};\n\nexport { Chart };\n"],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAAC,uBAAA,CAAAC,OAAA;AACA,IAAAC,KAAA,GAAAC,sBAAA,CAAAF,OAAA;AACA,IAAAG,OAAA,GAAAJ,uBAAA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