@oanda/labs-currency-cross-table 1.0.6 → 1.0.8
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 +68 -0
- package/codegen.ts +15 -0
- package/dist/main/CurrencyCrossTableWidget/CurrencyCrossTableWidget.js +12 -4
- package/dist/main/CurrencyCrossTableWidget/CurrencyCrossTableWidget.js.map +1 -1
- package/dist/main/CurrencyCrossTableWidget/Main.js +19 -17
- package/dist/main/CurrencyCrossTableWidget/Main.js.map +1 -1
- package/dist/main/CurrencyCrossTableWidget/ValidationWrapper.js +2 -1
- package/dist/main/CurrencyCrossTableWidget/ValidationWrapper.js.map +1 -1
- package/dist/main/CurrencyCrossTableWidget/components/Cell.js +2 -4
- package/dist/main/CurrencyCrossTableWidget/components/Cell.js.map +1 -1
- package/dist/main/CurrencyCrossTableWidget/components/CellValidationWrapper.js +49 -0
- package/dist/main/CurrencyCrossTableWidget/components/CellValidationWrapper.js.map +1 -0
- package/dist/main/CurrencyCrossTableWidget/components/CellWithData.js +19 -13
- package/dist/main/CurrencyCrossTableWidget/components/CellWithData.js.map +1 -1
- package/dist/main/CurrencyCrossTableWidget/components/TextCell.js +7 -5
- package/dist/main/CurrencyCrossTableWidget/components/TextCell.js.map +1 -1
- package/dist/main/CurrencyCrossTableWidget/components/types.js.map +1 -1
- package/dist/main/CurrencyCrossTableWidget/render.js +7 -2
- package/dist/main/CurrencyCrossTableWidget/render.js.map +1 -1
- package/dist/main/CurrencyCrossTableWidget/types.js +0 -13
- package/dist/main/CurrencyCrossTableWidget/types.js.map +1 -1
- package/dist/main/CurrencyCrossTableWidget/utils.js +13 -30
- package/dist/main/CurrencyCrossTableWidget/utils.js.map +1 -1
- package/dist/main/gql/types/fragment-masking.js +23 -0
- package/dist/main/gql/types/fragment-masking.js.map +1 -0
- package/dist/main/gql/types/gql.js +16 -0
- package/dist/main/gql/types/gql.js.map +1 -0
- package/dist/main/gql/types/graphql.js +223 -0
- package/dist/main/gql/types/graphql.js.map +1 -0
- package/dist/main/gql/types/index.js +28 -0
- package/dist/main/gql/types/index.js.map +1 -0
- package/dist/main/gql/validateInstruments.js +16 -0
- package/dist/main/gql/validateInstruments.js.map +1 -0
- package/dist/module/CurrencyCrossTableWidget/CurrencyCrossTableWidget.js +10 -2
- package/dist/module/CurrencyCrossTableWidget/CurrencyCrossTableWidget.js.map +1 -1
- package/dist/module/CurrencyCrossTableWidget/Main.js +21 -19
- package/dist/module/CurrencyCrossTableWidget/Main.js.map +1 -1
- package/dist/module/CurrencyCrossTableWidget/ValidationWrapper.js +2 -1
- package/dist/module/CurrencyCrossTableWidget/ValidationWrapper.js.map +1 -1
- package/dist/module/CurrencyCrossTableWidget/components/Cell.js +2 -4
- package/dist/module/CurrencyCrossTableWidget/components/Cell.js.map +1 -1
- package/dist/module/CurrencyCrossTableWidget/components/CellValidationWrapper.js +42 -0
- package/dist/module/CurrencyCrossTableWidget/components/CellValidationWrapper.js.map +1 -0
- package/dist/module/CurrencyCrossTableWidget/components/CellWithData.js +20 -14
- package/dist/module/CurrencyCrossTableWidget/components/CellWithData.js.map +1 -1
- package/dist/module/CurrencyCrossTableWidget/components/TextCell.js +7 -5
- package/dist/module/CurrencyCrossTableWidget/components/TextCell.js.map +1 -1
- package/dist/module/CurrencyCrossTableWidget/components/types.js.map +1 -1
- package/dist/module/CurrencyCrossTableWidget/render.js +6 -1
- package/dist/module/CurrencyCrossTableWidget/render.js.map +1 -1
- package/dist/module/CurrencyCrossTableWidget/types.js +0 -12
- package/dist/module/CurrencyCrossTableWidget/types.js.map +1 -1
- package/dist/module/CurrencyCrossTableWidget/utils.js +10 -29
- package/dist/module/CurrencyCrossTableWidget/utils.js.map +1 -1
- package/dist/module/gql/types/fragment-masking.js +15 -0
- package/dist/module/gql/types/fragment-masking.js.map +1 -0
- package/dist/module/gql/types/gql.js +8 -0
- package/dist/module/gql/types/gql.js.map +1 -0
- package/dist/module/gql/types/graphql.js +217 -0
- package/dist/module/gql/types/graphql.js.map +1 -0
- package/dist/module/gql/types/index.js +3 -0
- package/dist/module/gql/types/index.js.map +1 -0
- package/dist/module/gql/validateInstruments.js +10 -0
- package/dist/module/gql/validateInstruments.js.map +1 -0
- package/dist/types/CurrencyCrossTableWidget/CurrencyCrossTableWidget.d.ts +1 -1
- package/dist/types/CurrencyCrossTableWidget/Main.d.ts +1 -1
- package/dist/types/CurrencyCrossTableWidget/components/Cell.d.ts +1 -1
- package/dist/types/CurrencyCrossTableWidget/components/CellValidationWrapper.d.ts +4 -0
- package/dist/types/CurrencyCrossTableWidget/components/CellWithData.d.ts +1 -1
- package/dist/types/CurrencyCrossTableWidget/components/TextCell.d.ts +1 -1
- package/dist/types/CurrencyCrossTableWidget/components/types.d.ts +15 -4
- package/dist/types/CurrencyCrossTableWidget/types.d.ts +3 -11
- package/dist/types/CurrencyCrossTableWidget/utils.d.ts +5 -6
- package/dist/types/gql/types/fragment-masking.d.ts +15 -0
- package/dist/types/gql/types/gql.d.ts +37 -0
- package/dist/types/gql/types/graphql.d.ts +384 -0
- package/dist/types/gql/types/index.d.ts +2 -0
- package/dist/types/gql/validateInstruments.d.ts +1 -0
- package/package.json +12 -4
- package/src/CurrencyCrossTableWidget/CurrencyCrossTableWidget.tsx +16 -6
- package/src/CurrencyCrossTableWidget/Main.tsx +23 -19
- package/src/CurrencyCrossTableWidget/ValidationWrapper.tsx +1 -0
- package/src/CurrencyCrossTableWidget/components/Cell.tsx +2 -4
- package/src/CurrencyCrossTableWidget/components/CellValidationWrapper.tsx +49 -0
- package/src/CurrencyCrossTableWidget/components/CellWithData.tsx +30 -16
- package/src/CurrencyCrossTableWidget/components/TextCell.tsx +6 -4
- package/src/CurrencyCrossTableWidget/components/types.ts +15 -4
- package/src/CurrencyCrossTableWidget/render.tsx +6 -2
- package/src/CurrencyCrossTableWidget/types.tsx +3 -12
- package/src/CurrencyCrossTableWidget/utils.ts +17 -37
- package/src/gql/types/fragment-masking.ts +66 -0
- package/src/gql/types/gql.ts +42 -0
- package/src/gql/types/graphql.ts +423 -0
- package/src/gql/types/index.ts +2 -0
- package/src/gql/validateInstruments.ts +10 -0
- package/test/Main.test.tsx +12 -6
- package/test/mocks.ts +225 -0
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,74 @@
|
|
|
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.8 (2024-09-04)
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
## 1.0.156 (2024-09-02)
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
## 1.0.155 (2024-08-29)
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
## 1.0.154 (2024-08-29)
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
## 1.0.153 (2024-08-23)
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
## 1.0.152 (2024-08-23)
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
## 1.0.151 (2024-08-20)
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
## 1.0.150 (2024-08-19)
|
|
35
|
+
|
|
36
|
+
**Note:** Version bump only for package @oanda/labs-currency-cross-table
|
|
37
|
+
|
|
38
|
+
|
|
39
|
+
|
|
40
|
+
|
|
41
|
+
|
|
42
|
+
## 1.0.7 (2024-09-02)
|
|
43
|
+
|
|
44
|
+
|
|
45
|
+
|
|
46
|
+
## 1.0.155 (2024-08-29)
|
|
47
|
+
|
|
48
|
+
|
|
49
|
+
|
|
50
|
+
## 1.0.154 (2024-08-29)
|
|
51
|
+
|
|
52
|
+
|
|
53
|
+
|
|
54
|
+
## 1.0.153 (2024-08-23)
|
|
55
|
+
|
|
56
|
+
|
|
57
|
+
|
|
58
|
+
## 1.0.152 (2024-08-23)
|
|
59
|
+
|
|
60
|
+
|
|
61
|
+
|
|
62
|
+
## 1.0.151 (2024-08-20)
|
|
63
|
+
|
|
64
|
+
|
|
65
|
+
|
|
66
|
+
## 1.0.150 (2024-08-19)
|
|
67
|
+
|
|
68
|
+
**Note:** Version bump only for package @oanda/labs-currency-cross-table
|
|
69
|
+
|
|
70
|
+
|
|
71
|
+
|
|
72
|
+
|
|
73
|
+
|
|
6
74
|
## 1.0.6 (2024-08-29)
|
|
7
75
|
|
|
8
76
|
|
package/codegen.ts
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { CodegenConfig } from '@graphql-codegen/cli';
|
|
2
|
+
|
|
3
|
+
const config: CodegenConfig = {
|
|
4
|
+
overwrite: true,
|
|
5
|
+
schema: 'https://labs-api.uat.oanda.com/graphql',
|
|
6
|
+
documents: 'src/**/*.ts',
|
|
7
|
+
generates: {
|
|
8
|
+
'src/gql/types/': {
|
|
9
|
+
preset: 'client',
|
|
10
|
+
plugins: [],
|
|
11
|
+
},
|
|
12
|
+
},
|
|
13
|
+
};
|
|
14
|
+
|
|
15
|
+
export default config;
|
|
@@ -5,14 +5,16 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.CurrencyCrossTableWidget = void 0;
|
|
7
7
|
var _react = _interopRequireDefault(require("react"));
|
|
8
|
+
var _client = require("@apollo/client");
|
|
8
9
|
var _monoI18n = require("@oanda/mono-i18n");
|
|
9
10
|
var _labsWidgetCommon = require("@oanda/labs-widget-common");
|
|
10
11
|
var _translations = require("../translations");
|
|
11
|
-
var _types = require("./types");
|
|
12
12
|
var _ValidationWrapper = require("./ValidationWrapper");
|
|
13
|
+
var _graphql = require("../gql/types/graphql");
|
|
13
14
|
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
14
15
|
const CurrencyCrossTableWidget = _ref => {
|
|
15
16
|
let {
|
|
17
|
+
graphqlUrl,
|
|
16
18
|
liveRatesUrl,
|
|
17
19
|
currencies,
|
|
18
20
|
division,
|
|
@@ -21,8 +23,12 @@ const CurrencyCrossTableWidget = _ref => {
|
|
|
21
23
|
isParamError,
|
|
22
24
|
removePadding
|
|
23
25
|
} = _ref;
|
|
24
|
-
const
|
|
25
|
-
|
|
26
|
+
const client = new _client.ApolloClient({
|
|
27
|
+
uri: graphqlUrl,
|
|
28
|
+
cache: new _client.InMemoryCache()
|
|
29
|
+
});
|
|
30
|
+
const divisionCode = division === _graphql.Division.Opt ? _graphql.Division.Ogm : division;
|
|
31
|
+
const dataSource = divisionCode === _graphql.Division.Ogm ? 'MT5' : 'V20';
|
|
26
32
|
return _react.default.createElement(_labsWidgetCommon.ThemeProvider, {
|
|
27
33
|
removePadding: removePadding,
|
|
28
34
|
theme: theme
|
|
@@ -35,11 +41,13 @@ const CurrencyCrossTableWidget = _ref => {
|
|
|
35
41
|
divisionCode,
|
|
36
42
|
dataSource
|
|
37
43
|
}
|
|
44
|
+
}, _react.default.createElement(_client.ApolloProvider, {
|
|
45
|
+
client: client
|
|
38
46
|
}, _react.default.createElement(_ValidationWrapper.ValidationWrapper, {
|
|
39
47
|
currencies: currencies,
|
|
40
48
|
division: division,
|
|
41
49
|
isParamError: isParamError
|
|
42
|
-
}))));
|
|
50
|
+
})))));
|
|
43
51
|
};
|
|
44
52
|
exports.CurrencyCrossTableWidget = CurrencyCrossTableWidget;
|
|
45
53
|
//# sourceMappingURL=CurrencyCrossTableWidget.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CurrencyCrossTableWidget.js","names":["_react","_interopRequireDefault","require","_monoI18n","_labsWidgetCommon","_translations","
|
|
1
|
+
{"version":3,"file":"CurrencyCrossTableWidget.js","names":["_react","_interopRequireDefault","require","_client","_monoI18n","_labsWidgetCommon","_translations","_ValidationWrapper","_graphql","e","__esModule","default","CurrencyCrossTableWidget","_ref","graphqlUrl","liveRatesUrl","currencies","division","locale","theme","isParamError","removePadding","client","ApolloClient","uri","cache","InMemoryCache","divisionCode","Division","Opt","Ogm","dataSource","createElement","ThemeProvider","LocaleProvider","getLocale","translations","LiveRatesProvider","url","options","ApolloProvider","ValidationWrapper","exports"],"sources":["../../../src/CurrencyCrossTableWidget/CurrencyCrossTableWidget.tsx"],"sourcesContent":["import React from 'react';\nimport { ApolloClient, InMemoryCache, ApolloProvider } from '@apollo/client';\nimport { LocaleProvider } from '@oanda/mono-i18n';\nimport {\n LiveRatesProvider, ThemeProvider, getLocale,\n} from '@oanda/labs-widget-common';\nimport { translations } from '../translations';\nimport { CurrencyCrossTableConfig } from './types';\nimport { ValidationWrapper } from './ValidationWrapper';\nimport { Division } from '../gql/types/graphql';\n\nconst CurrencyCrossTableWidget = ({\n graphqlUrl,\n liveRatesUrl,\n currencies,\n division,\n locale,\n theme,\n isParamError,\n removePadding,\n}: CurrencyCrossTableConfig) => {\n const client = new ApolloClient({\n uri: graphqlUrl,\n cache: new InMemoryCache(),\n });\n\n const divisionCode = division === Division.Opt ? Division.Ogm : division;\n const dataSource = divisionCode === Division.Ogm ? 'MT5' : 'V20';\n\n return (\n <ThemeProvider removePadding={removePadding} theme={theme}>\n <LocaleProvider locale={getLocale(locale)} translations={translations}>\n <LiveRatesProvider\n url={liveRatesUrl}\n options={{ divisionCode, dataSource }}\n >\n <ApolloProvider client={client}>\n <ValidationWrapper\n currencies={currencies}\n division={division}\n isParamError={isParamError}\n />\n </ApolloProvider>\n </LiveRatesProvider>\n </LocaleProvider>\n </ThemeProvider>\n );\n};\n\nexport { CurrencyCrossTableWidget };\n"],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,OAAA,GAAAD,OAAA;AACA,IAAAE,SAAA,GAAAF,OAAA;AACA,IAAAG,iBAAA,GAAAH,OAAA;AAGA,IAAAI,aAAA,GAAAJ,OAAA;AAEA,IAAAK,kBAAA,GAAAL,OAAA;AACA,IAAAM,QAAA,GAAAN,OAAA;AAAgD,SAAAD,uBAAAQ,CAAA,WAAAA,CAAA,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AY,EAAEA;EAAa,CAC5B,CACa,CACC,CACL,CACH,CAAC;AAEpB,CAAC;AAACsB,OAAA,CAAA9B,wBAAA,GAAAA,wBAAA","ignoreList":[]}
|
|
@@ -7,12 +7,15 @@ exports.Main = void 0;
|
|
|
7
7
|
var _react = _interopRequireWildcard(require("react"));
|
|
8
8
|
var _labsWidgetCommon = require("@oanda/labs-widget-common");
|
|
9
9
|
var _components = require("./components");
|
|
10
|
+
var _CellValidationWrapper = require("./components/CellValidationWrapper");
|
|
11
|
+
var _utils = require("./utils");
|
|
10
12
|
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
13
|
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
14
|
const Main = _ref => {
|
|
13
15
|
let {
|
|
14
16
|
instruments,
|
|
15
|
-
currencies
|
|
17
|
+
currencies,
|
|
18
|
+
division
|
|
16
19
|
} = _ref;
|
|
17
20
|
const [selectedCurrency, setSelectedCurrency] = (0, _react.useState)('');
|
|
18
21
|
const [selectedPair, setSelectedPair] = (0, _react.useState)('');
|
|
@@ -30,34 +33,33 @@ const Main = _ref => {
|
|
|
30
33
|
}, instruments);
|
|
31
34
|
return _react.default.createElement("div", {
|
|
32
35
|
"data-testid": "currency-cross-table-wrapper",
|
|
33
|
-
className: "lw-w-full"
|
|
36
|
+
className: "lw-w-full lw-overflow-x-auto lw-overflow-y-hidden lw-border lw-border-b-0 lw-border-solid lw-border-border-primary"
|
|
34
37
|
}, _react.default.createElement("div", {
|
|
35
|
-
className: "lw-flex lw-
|
|
36
|
-
}, _react.default.createElement(_components.TextCell,
|
|
38
|
+
className: "lw-flex lw-w-max lw-min-w-full"
|
|
39
|
+
}, _react.default.createElement(_components.TextCell, {
|
|
40
|
+
sticky: true
|
|
41
|
+
}), currencies.map(pair => _react.default.createElement(_components.TextCell, {
|
|
37
42
|
key: pair,
|
|
38
43
|
label: pair,
|
|
39
44
|
hovered: pair === selectedPair
|
|
40
45
|
}))), currencies.map((currency, index, arr) => _react.default.createElement("div", {
|
|
41
46
|
key: currency,
|
|
42
|
-
className: "lw-flex lw-
|
|
47
|
+
className: "lw-flex lw-w-max lw-min-w-full"
|
|
43
48
|
}, _react.default.createElement(_components.TextCell, {
|
|
44
49
|
label: currency,
|
|
45
|
-
|
|
46
|
-
|
|
50
|
+
hovered: currency === selectedCurrency,
|
|
51
|
+
sticky: true
|
|
47
52
|
}), arr.map(pair => _react.default.createElement(_react.Fragment, {
|
|
48
53
|
key: `${currency}_${pair}`
|
|
49
|
-
}, currency !== pair ? _react.default.createElement(
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
displayName: `${currency}/${pair}`
|
|
54
|
-
},
|
|
54
|
+
}, currency !== pair ? _react.default.createElement(_react.Suspense, null, _react.default.createElement(_CellValidationWrapper.CellValidationWrapper, {
|
|
55
|
+
currency: currency,
|
|
56
|
+
pair: pair,
|
|
57
|
+
instrument: `${currency}${(0, _utils.divisionMapper)(division)}${pair}`,
|
|
55
58
|
target: target,
|
|
56
|
-
additionalBorderBottom: index === arr.length - 1,
|
|
57
59
|
setSelectedCurrency: setSelectedCurrency,
|
|
58
|
-
setSelectedPair: setSelectedPair
|
|
59
|
-
|
|
60
|
-
|
|
60
|
+
setSelectedPair: setSelectedPair,
|
|
61
|
+
division: division
|
|
62
|
+
})) : _react.default.createElement(_components.TextCell, {
|
|
61
63
|
emptyIndicator: true
|
|
62
64
|
}))))));
|
|
63
65
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Main.js","names":["_react","_interopRequireWildcard","require","_labsWidgetCommon","_components","_getRequireWildcardCache","e","WeakMap","r","t","__esModule","default","has","get","n","__proto__","a","Object","defineProperty","getOwnPropertyDescriptor","u","hasOwnProperty","call","i","set","Main","_ref","instruments","currencies","selectedCurrency","setSelectedCurrency","useState","selectedPair","setSelectedPair","hasInstruments","length","target","setQuery","useLiveRatesQuery","useEffect","createElement","className","TextCell","map","pair","key","label","hovered","currency","index","arr","
|
|
1
|
+
{"version":3,"file":"Main.js","names":["_react","_interopRequireWildcard","require","_labsWidgetCommon","_components","_CellValidationWrapper","_utils","_getRequireWildcardCache","e","WeakMap","r","t","__esModule","default","has","get","n","__proto__","a","Object","defineProperty","getOwnPropertyDescriptor","u","hasOwnProperty","call","i","set","Main","_ref","instruments","currencies","division","selectedCurrency","setSelectedCurrency","useState","selectedPair","setSelectedPair","hasInstruments","length","target","setQuery","useLiveRatesQuery","useEffect","createElement","className","TextCell","sticky","map","pair","key","label","hovered","currency","index","arr","Fragment","Suspense","CellValidationWrapper","instrument","divisionMapper","emptyIndicator","exports"],"sources":["../../../src/CurrencyCrossTableWidget/Main.tsx"],"sourcesContent":["import React, {\n Fragment, Suspense, useEffect, useState,\n} from 'react';\nimport { useLiveRatesQuery } from '@oanda/labs-widget-common';\nimport { MainProps } from './types';\nimport { TextCell } from './components';\nimport { CellValidationWrapper } from './components/CellValidationWrapper';\nimport { divisionMapper } from './utils';\n\nconst Main = ({\n instruments,\n currencies,\n division,\n}: MainProps) => {\n const [selectedCurrency, setSelectedCurrency] = useState('');\n const [selectedPair, setSelectedPair] = useState('');\n\n const hasInstruments = instruments.length > 0;\n\n const { target, setQuery } = useLiveRatesQuery();\n\n useEffect(() => {\n if (hasInstruments) {\n setQuery({ instruments });\n }\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, instruments);\n\n return (\n <div data-testid=\"currency-cross-table-wrapper\" className=\"lw-w-full lw-overflow-x-auto lw-overflow-y-hidden lw-border lw-border-b-0 lw-border-solid lw-border-border-primary\">\n <div className=\"lw-flex lw-w-max lw-min-w-full\">\n <TextCell sticky />\n {currencies.map(((pair) => (\n <TextCell\n key={pair}\n label={pair}\n hovered={pair === selectedPair}\n />\n )))}\n </div>\n {currencies.map(((currency, index, arr) => (\n <div\n key={currency}\n className=\"lw-flex lw-w-max lw-min-w-full\"\n >\n <TextCell\n label={currency}\n hovered={currency === selectedCurrency}\n sticky\n />\n {arr.map((pair) => (\n <Fragment key={`${currency}_${pair}`}>\n {currency !== pair ? (\n <Suspense>\n <CellValidationWrapper\n currency={currency}\n pair={pair}\n instrument={`${currency}${divisionMapper(division)}${pair}`}\n target={target}\n setSelectedCurrency={setSelectedCurrency}\n setSelectedPair={setSelectedPair}\n division={division}\n />\n </Suspense>\n ) : (\n <TextCell\n emptyIndicator\n />\n )}\n </Fragment>\n ))}\n </div>\n )))}\n </div>\n );\n};\n\nexport { Main };\n"],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAAC,uBAAA,CAAAC,OAAA;AAGA,IAAAC,iBAAA,GAAAD,OAAA;AAEA,IAAAE,WAAA,GAAAF,OAAA;AACA,IAAAG,sBAAA,GAAAH,OAAA;AACA,IAAAI,MAAA,GAAAJ,OAAA;AAAyC,SAAAK,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,SAAAP,wBAAAO,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,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AQ,GAAG,IAAAO,qBAAc,EAAC5B,QAAQ,CAAC,GAAGiB,IAAI,EAAG;IAC5DT,MAAM,EAAEA,MAAO;IACfN,mBAAmB,EAAEA,mBAAoB;IACzCG,eAAe,EAAEA,eAAgB;IACjCL,QAAQ,EAAEA;EAAS,CACpB,CACO,CAAC,GAEX/B,MAAA,CAAAa,OAAA,CAAA8B,aAAA,CAACvC,WAAA,CAAAyC,QAAQ;IACPe,cAAc;EAAA,CACf,CAEK,CACX,CACE,CACL,CACC,CAAC;AAEV,CAAC;AAACC,OAAA,CAAAlC,IAAA,GAAAA,IAAA","ignoreList":[]}
|
|
@@ -21,7 +21,8 @@ const ValidationWrapper = _ref => {
|
|
|
21
21
|
className: "lw-flex lw-w-full lw-text-sm lw-tracking-normal lw-text-text-primary"
|
|
22
22
|
}, !showError && _react.default.createElement(_Main.Main, {
|
|
23
23
|
instruments: (0, _utils.currenciesToInstruments)(currencies, division),
|
|
24
|
-
currencies: currencies
|
|
24
|
+
currencies: currencies,
|
|
25
|
+
division: division
|
|
25
26
|
}), showError && _react.default.createElement("div", {
|
|
26
27
|
className: (0, _classnames.default)('lw-flex lw-h-[250px] lw-w-full lw-items-center lw-border lw-border-solid lw-border-border-primary')
|
|
27
28
|
}, _react.default.createElement(_labsWidgetCommon.ChartError, null))));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ValidationWrapper.js","names":["_react","_interopRequireDefault","require","_classnames","_labsWidgetCommon","_utils","_Main","e","__esModule","default","ValidationWrapper","_ref","currencies","division","isParamError","showError","validCurrencies","createElement","Fragment","className","Main","instruments","currenciesToInstruments","classnames","ChartError","exports"],"sources":["../../../src/CurrencyCrossTableWidget/ValidationWrapper.tsx"],"sourcesContent":["import React from 'react';\nimport classnames from 'classnames';\nimport { ChartError } from '@oanda/labs-widget-common';\nimport { currenciesToInstruments, validCurrencies } from './utils';\nimport { ValidationWrapperProps } from './types';\nimport { Main } from './Main';\n\nconst ValidationWrapper = ({\n currencies,\n division,\n isParamError,\n}: ValidationWrapperProps) => {\n const showError = !validCurrencies(currencies) || isParamError;\n\n return (\n <>\n <div\n className=\"lw-flex lw-w-full lw-text-sm lw-tracking-normal lw-text-text-primary\"\n >\n {!showError && (\n <Main\n instruments={currenciesToInstruments(currencies, division)}\n currencies={currencies}\n />\n )}\n {showError && (\n <div className={classnames('lw-flex lw-h-[250px] lw-w-full lw-items-center lw-border lw-border-solid lw-border-border-primary')}>\n <ChartError />\n </div>\n )}\n </div>\n </>\n );\n};\n\nexport { ValidationWrapper };\n"],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,WAAA,GAAAF,sBAAA,CAAAC,OAAA;AACA,IAAAE,iBAAA,GAAAF,OAAA;AACA,IAAAG,MAAA,GAAAH,OAAA;AAEA,IAAAI,KAAA,GAAAJ,OAAA;AAA8B,SAAAD,uBAAAM,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,CAAA;AAE9B,MAAMG,iBAAiB,GAAGC,IAAA,IAII;EAAA,IAJH;IACzBC,UAAU;IACVC,QAAQ;IACRC;EACsB,CAAC,GAAAH,IAAA;EACvB,MAAMI,SAAS,GAAG,CAAC,IAAAC,sBAAe,EAACJ,UAAU,CAAC,IAAIE,YAAY;EAE9D,OACEd,MAAA,CAAAS,OAAA,CAAAQ,aAAA,CAAAjB,MAAA,CAAAS,OAAA,CAAAS,QAAA,QACElB,MAAA,CAAAS,OAAA,CAAAQ,aAAA;IACEE,SAAS,EAAC;EAAsE,GAE/E,CAACJ,SAAS,IACTf,MAAA,CAAAS,OAAA,CAAAQ,aAAA,CAACX,KAAA,CAAAc,IAAI;IACHC,WAAW,EAAE,IAAAC,8BAAuB,EAACV,UAAU,EAAEC,QAAQ,CAAE;IAC3DD,UAAU,EAAEA;
|
|
1
|
+
{"version":3,"file":"ValidationWrapper.js","names":["_react","_interopRequireDefault","require","_classnames","_labsWidgetCommon","_utils","_Main","e","__esModule","default","ValidationWrapper","_ref","currencies","division","isParamError","showError","validCurrencies","createElement","Fragment","className","Main","instruments","currenciesToInstruments","classnames","ChartError","exports"],"sources":["../../../src/CurrencyCrossTableWidget/ValidationWrapper.tsx"],"sourcesContent":["import React from 'react';\nimport classnames from 'classnames';\nimport { ChartError } from '@oanda/labs-widget-common';\nimport { currenciesToInstruments, validCurrencies } from './utils';\nimport { ValidationWrapperProps } from './types';\nimport { Main } from './Main';\n\nconst ValidationWrapper = ({\n currencies,\n division,\n isParamError,\n}: ValidationWrapperProps) => {\n const showError = !validCurrencies(currencies) || isParamError;\n\n return (\n <>\n <div\n className=\"lw-flex lw-w-full lw-text-sm lw-tracking-normal lw-text-text-primary\"\n >\n {!showError && (\n <Main\n instruments={currenciesToInstruments(currencies, division)}\n currencies={currencies}\n division={division}\n />\n )}\n {showError && (\n <div className={classnames('lw-flex lw-h-[250px] lw-w-full lw-items-center lw-border lw-border-solid lw-border-border-primary')}>\n <ChartError />\n </div>\n )}\n </div>\n </>\n );\n};\n\nexport { ValidationWrapper };\n"],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,WAAA,GAAAF,sBAAA,CAAAC,OAAA;AACA,IAAAE,iBAAA,GAAAF,OAAA;AACA,IAAAG,MAAA,GAAAH,OAAA;AAEA,IAAAI,KAAA,GAAAJ,OAAA;AAA8B,SAAAD,uBAAAM,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,CAAA;AAE9B,MAAMG,iBAAiB,GAAGC,IAAA,IAII;EAAA,IAJH;IACzBC,UAAU;IACVC,QAAQ;IACRC;EACsB,CAAC,GAAAH,IAAA;EACvB,MAAMI,SAAS,GAAG,CAAC,IAAAC,sBAAe,EAACJ,UAAU,CAAC,IAAIE,YAAY;EAE9D,OACEd,MAAA,CAAAS,OAAA,CAAAQ,aAAA,CAAAjB,MAAA,CAAAS,OAAA,CAAAS,QAAA,QACElB,MAAA,CAAAS,OAAA,CAAAQ,aAAA;IACEE,SAAS,EAAC;EAAsE,GAE/E,CAACJ,SAAS,IACTf,MAAA,CAAAS,OAAA,CAAAQ,aAAA,CAACX,KAAA,CAAAc,IAAI;IACHC,WAAW,EAAE,IAAAC,8BAAuB,EAACV,UAAU,EAAEC,QAAQ,CAAE;IAC3DD,UAAU,EAAEA,UAAW;IACvBC,QAAQ,EAAEA;EAAS,CACpB,CACF,EACAE,SAAS,IACRf,MAAA,CAAAS,OAAA,CAAAQ,aAAA;IAAKE,SAAS,EAAE,IAAAI,mBAAU,EAAC,mGAAmG;EAAE,GAC9HvB,MAAA,CAAAS,OAAA,CAAAQ,aAAA,CAACb,iBAAA,CAAAoB,UAAU,MAAE,CACV,CAEJ,CACL,CAAC;AAEP,CAAC;AAACC,OAAA,CAAAf,iBAAA,GAAAA,iBAAA","ignoreList":[]}
|
|
@@ -13,15 +13,13 @@ const Cell = _ref => {
|
|
|
13
13
|
children,
|
|
14
14
|
isError,
|
|
15
15
|
isLoading,
|
|
16
|
-
additionalBorderBottom,
|
|
17
16
|
hovered,
|
|
18
17
|
mouseEnterHandler,
|
|
19
18
|
mouseLeaveHandler
|
|
20
19
|
} = _ref;
|
|
21
20
|
return _react.default.createElement("div", {
|
|
22
|
-
className: (0, _classnames.default)('lw-flex lw-h-[
|
|
23
|
-
'lw-border-
|
|
24
|
-
'lw-font-semibold': hovered
|
|
21
|
+
className: (0, _classnames.default)('lw-flex lw-h-11 lw-min-w-[70px] lw-flex-1 lw-items-center lw-justify-center lw-border-b lw-border-r lw-border-solid lw-border-border-primary last:lw-border-r-[0px]', {
|
|
22
|
+
'lw-bg-border-primary lw-font-semibold lw-shadow-innerBorderBgColor': hovered
|
|
25
23
|
}),
|
|
26
24
|
onMouseEnter: mouseEnterHandler,
|
|
27
25
|
onMouseLeave: mouseLeaveHandler
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Cell.js","names":["_react","_interopRequireDefault","require","_classnames","_constant","e","__esModule","default","Cell","_ref","children","isError","isLoading","
|
|
1
|
+
{"version":3,"file":"Cell.js","names":["_react","_interopRequireDefault","require","_classnames","_constant","e","__esModule","default","Cell","_ref","children","isError","isLoading","hovered","mouseEnterHandler","mouseLeaveHandler","createElement","className","classnames","onMouseEnter","onMouseLeave","CELL_LOADING_VALUE","CELL_EMPTY_VALUE","exports"],"sources":["../../../../src/CurrencyCrossTableWidget/components/Cell.tsx"],"sourcesContent":["import React from 'react';\nimport classnames from 'classnames';\nimport { CellProps } from './types';\nimport { CELL_EMPTY_VALUE, CELL_LOADING_VALUE } from '../constant';\n\nconst Cell = ({\n children,\n isError,\n isLoading,\n hovered,\n mouseEnterHandler,\n mouseLeaveHandler,\n}: CellProps) => (\n <div\n className={classnames('lw-flex lw-h-11 lw-min-w-[70px] lw-flex-1 lw-items-center lw-justify-center lw-border-b lw-border-r lw-border-solid lw-border-border-primary last:lw-border-r-[0px]', {\n 'lw-bg-border-primary lw-font-semibold lw-shadow-innerBorderBgColor': hovered,\n })}\n onMouseEnter={mouseEnterHandler}\n onMouseLeave={mouseLeaveHandler}\n >\n {isLoading && <div className=\"lw-px-3 lw-py-3.5\">{CELL_LOADING_VALUE}</div>}\n {!isLoading && !isError && children}\n {!isLoading && isError && (\n <span>{CELL_EMPTY_VALUE}</span>\n )}\n </div>\n);\n\nexport { Cell };\n"],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,WAAA,GAAAF,sBAAA,CAAAC,OAAA;AAEA,IAAAE,SAAA,GAAAF,OAAA;AAAmE,SAAAD,uBAAAI,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,CAAA;AAEnE,MAAMG,IAAI,GAAGC,IAAA;EAAA,IAAC;IACZC,QAAQ;IACRC,OAAO;IACPC,SAAS;IACTC,OAAO;IACPC,iBAAiB;IACjBC;EACS,CAAC,GAAAN,IAAA;EAAA,OACVT,MAAA,CAAAO,OAAA,CAAAS,aAAA;IACEC,SAAS,EAAE,IAAAC,mBAAU,EAAC,qKAAqK,EAAE;MAC3L,oEAAoE,EAAEL;IACxE,CAAC,CAAE;IACHM,YAAY,EAAEL,iBAAkB;IAChCM,YAAY,EAAEL;EAAkB,GAE/BH,SAAS,IAAIZ,MAAA,CAAAO,OAAA,CAAAS,aAAA;IAAKC,SAAS,EAAC;EAAmB,GAAEI,4BAAwB,CAAC,EAC1E,CAACT,SAAS,IAAI,CAACD,OAAO,IAAID,QAAQ,EAClC,CAACE,SAAS,IAAID,OAAO,IACpBX,MAAA,CAAAO,OAAA,CAAAS,aAAA,eAAOM,0BAAuB,CAE7B,CAAC;AAAA,CACP;AAACC,OAAA,CAAAf,IAAA,GAAAA,IAAA","ignoreList":[]}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.CellValidationWrapper = void 0;
|
|
7
|
+
var _react = _interopRequireDefault(require("react"));
|
|
8
|
+
var _client = require("@apollo/client");
|
|
9
|
+
var _validateInstruments = require("../../gql/validateInstruments");
|
|
10
|
+
var _CellWithData = require("./CellWithData");
|
|
11
|
+
var _utils = require("../utils");
|
|
12
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
13
|
+
const CellValidationWrapper = _ref => {
|
|
14
|
+
let {
|
|
15
|
+
currency,
|
|
16
|
+
pair,
|
|
17
|
+
instrument,
|
|
18
|
+
target,
|
|
19
|
+
setSelectedCurrency,
|
|
20
|
+
setSelectedPair,
|
|
21
|
+
division
|
|
22
|
+
} = _ref;
|
|
23
|
+
const {
|
|
24
|
+
error
|
|
25
|
+
} = (0, _client.useSuspenseQuery)(_validateInstruments.validateInstruments, {
|
|
26
|
+
variables: {
|
|
27
|
+
instruments: [instrument],
|
|
28
|
+
division
|
|
29
|
+
},
|
|
30
|
+
fetchPolicy: 'network-only',
|
|
31
|
+
errorPolicy: 'all'
|
|
32
|
+
});
|
|
33
|
+
const instrumentForCalculations = error ? `${pair}${(0, _utils.divisionMapper)(division)}${currency}` : '';
|
|
34
|
+
return _react.default.createElement(_CellWithData.CellWithData, {
|
|
35
|
+
currency: currency,
|
|
36
|
+
pair: pair,
|
|
37
|
+
record: {
|
|
38
|
+
instrument,
|
|
39
|
+
displayName: `${currency}${(0, _utils.divisionMapper)(division)}${pair}`
|
|
40
|
+
},
|
|
41
|
+
instrumentForCalculations: instrumentForCalculations,
|
|
42
|
+
target: target,
|
|
43
|
+
setSelectedCurrency: setSelectedCurrency,
|
|
44
|
+
setSelectedPair: setSelectedPair,
|
|
45
|
+
division: division
|
|
46
|
+
});
|
|
47
|
+
};
|
|
48
|
+
exports.CellValidationWrapper = CellValidationWrapper;
|
|
49
|
+
//# sourceMappingURL=CellValidationWrapper.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"CellValidationWrapper.js","names":["_react","_interopRequireDefault","require","_client","_validateInstruments","_CellWithData","_utils","e","__esModule","default","CellValidationWrapper","_ref","currency","pair","instrument","target","setSelectedCurrency","setSelectedPair","division","error","useSuspenseQuery","validateInstruments","variables","instruments","fetchPolicy","errorPolicy","instrumentForCalculations","divisionMapper","createElement","CellWithData","record","displayName","exports"],"sources":["../../../../src/CurrencyCrossTableWidget/components/CellValidationWrapper.tsx"],"sourcesContent":["import React from 'react';\nimport { useSuspenseQuery } from '@apollo/client';\nimport { CellValidationWrapperProps } from './types';\nimport { ValidateInstrumentsQuery, ValidateInstrumentsQueryVariables } from '../../gql/types/graphql';\nimport { validateInstruments } from '../../gql/validateInstruments';\nimport { CellWithData } from './CellWithData';\nimport { divisionMapper } from '../utils';\n\nconst CellValidationWrapper = ({\n currency,\n pair,\n instrument,\n target,\n setSelectedCurrency,\n setSelectedPair,\n division,\n}: CellValidationWrapperProps) => {\n const { error } = useSuspenseQuery<\n ValidateInstrumentsQuery,\n ValidateInstrumentsQueryVariables\n >(validateInstruments, {\n variables: {\n instruments: [instrument],\n division,\n },\n fetchPolicy: 'network-only',\n errorPolicy: 'all',\n });\n\n const instrumentForCalculations = error ? `${pair}${divisionMapper(division)}${currency}` : '';\n\n return (\n <CellWithData\n currency={currency}\n pair={pair}\n record={{\n instrument,\n displayName: `${currency}${divisionMapper(division)}${pair}`,\n }}\n instrumentForCalculations={instrumentForCalculations}\n target={target}\n setSelectedCurrency={setSelectedCurrency}\n setSelectedPair={setSelectedPair}\n division={division}\n />\n );\n};\n\nexport { CellValidationWrapper };\n"],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,OAAA,GAAAD,OAAA;AAGA,IAAAE,oBAAA,GAAAF,OAAA;AACA,IAAAG,aAAA,GAAAH,OAAA;AACA,IAAAI,MAAA,GAAAJ,OAAA;AAA0C,SAAAD,uBAAAM,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,CAAA;AAE1C,MAAMG,qBAAqB,GAAGC,IAAA,IAQI;EAAA,IARH;IAC7BC,QAAQ;IACRC,IAAI;IACJC,UAAU;IACVC,MAAM;IACNC,mBAAmB;IACnBC,eAAe;IACfC;EAC0B,CAAC,GAAAP,IAAA;EAC3B,MAAM;IAAEQ;EAAM,CAAC,GAAG,IAAAC,wBAAgB,EAGhCC,wCAAmB,EAAE;IACrBC,SAAS,EAAE;MACTC,WAAW,EAAE,CAACT,UAAU,CAAC;MACzBI;IACF,CAAC;IACDM,WAAW,EAAE,cAAc;IAC3BC,WAAW,EAAE;EACf,CAAC,CAAC;EAEF,MAAMC,yBAAyB,GAAGP,KAAK,GAAG,GAAGN,IAAI,GAAG,IAAAc,qBAAc,EAACT,QAAQ,CAAC,GAAGN,QAAQ,EAAE,GAAG,EAAE;EAE9F,OACEZ,MAAA,CAAAS,OAAA,CAAAmB,aAAA,CAACvB,aAAA,CAAAwB,YAAY;IACXjB,QAAQ,EAAEA,QAAS;IACnBC,IAAI,EAAEA,IAAK;IACXiB,MAAM,EAAE;MACNhB,UAAU;MACViB,WAAW,EAAE,GAAGnB,QAAQ,GAAG,IAAAe,qBAAc,EAACT,QAAQ,CAAC,GAAGL,IAAI;IAC5D,CAAE;IACFa,yBAAyB,EAAEA,yBAA0B;IACrDX,MAAM,EAAEA,MAAO;IACfC,mBAAmB,EAAEA,mBAAoB;IACzCC,eAAe,EAAEA,eAAgB;IACjCC,QAAQ,EAAEA;EAAS,CACpB,CAAC;AAEN,CAAC;AAACc,OAAA,CAAAtB,qBAAA,GAAAA,qBAAA","ignoreList":[]}
|
|
@@ -6,29 +6,36 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
exports.CellWithData = void 0;
|
|
7
7
|
var _react = _interopRequireWildcard(require("react"));
|
|
8
8
|
var _labsWidgetCommon = require("@oanda/labs-widget-common");
|
|
9
|
-
var _utils = require("../utils");
|
|
10
9
|
var _Cell = require("./Cell");
|
|
10
|
+
var _utils = require("../utils");
|
|
11
11
|
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); }
|
|
12
12
|
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; }
|
|
13
13
|
const CellWithData = _ref => {
|
|
14
14
|
let {
|
|
15
|
-
|
|
15
|
+
currency,
|
|
16
|
+
pair,
|
|
16
17
|
record,
|
|
18
|
+
instrumentForCalculations,
|
|
17
19
|
target,
|
|
18
|
-
additionalBorderBottom,
|
|
19
20
|
setSelectedCurrency,
|
|
20
21
|
setSelectedPair
|
|
21
22
|
} = _ref;
|
|
22
23
|
const [hovered, setHovered] = (0, _react.useState)(false);
|
|
24
|
+
const instrumentForUpdates = instrumentForCalculations || record.instrument;
|
|
23
25
|
const {
|
|
24
|
-
|
|
25
|
-
error
|
|
26
|
-
} = (0,
|
|
27
|
-
const
|
|
26
|
+
update,
|
|
27
|
+
error: liveRatesError
|
|
28
|
+
} = (0, _labsWidgetCommon.useLiveRatesMessage)(instrumentForUpdates, target);
|
|
29
|
+
const updatedRecord = {
|
|
30
|
+
displayName: record.displayName,
|
|
31
|
+
instrument: record.instrument,
|
|
32
|
+
buy: update?.ask,
|
|
33
|
+
buyPriceMovement: update?.askPriceMovement,
|
|
34
|
+
displayPrecision: update?.displayPrecision
|
|
35
|
+
};
|
|
36
|
+
const checkLoading = id => !liveRatesError && updatedRecord?.[id] === undefined;
|
|
28
37
|
const handleMouseEnter = () => {
|
|
29
38
|
setHovered(true);
|
|
30
|
-
const currency = record.instrument.substring(0, 3);
|
|
31
|
-
const pair = record.instrument.substring(record.instrument.length - 3);
|
|
32
39
|
setSelectedCurrency(currency);
|
|
33
40
|
setSelectedPair(pair);
|
|
34
41
|
};
|
|
@@ -39,15 +46,14 @@ const CellWithData = _ref => {
|
|
|
39
46
|
};
|
|
40
47
|
return _react.default.createElement(_Cell.Cell, {
|
|
41
48
|
isLoading: checkLoading('buy'),
|
|
42
|
-
isError: !!
|
|
43
|
-
additionalBorderBottom: additionalBorderBottom,
|
|
49
|
+
isError: !!liveRatesError,
|
|
44
50
|
hovered: hovered,
|
|
45
51
|
mouseEnterHandler: handleMouseEnter,
|
|
46
52
|
mouseLeaveHandler: handleMouseLeave
|
|
47
53
|
}, _react.default.createElement(_labsWidgetCommon.Price, {
|
|
48
|
-
priceMovement: updatedRecord.buyPriceMovement,
|
|
54
|
+
priceMovement: (0, _utils.getPriceMovement)(updatedRecord.buyPriceMovement, !!instrumentForCalculations),
|
|
49
55
|
movementIndicator: "background"
|
|
50
|
-
}, _react.default.createElement("span", null, updatedRecord.buy
|
|
56
|
+
}, _react.default.createElement("span", null, (0, _utils.getBuyPrice)(updatedRecord.buy, !!instrumentForCalculations).toFixed(updatedRecord.displayPrecision))));
|
|
51
57
|
};
|
|
52
58
|
exports.CellWithData = CellWithData;
|
|
53
59
|
//# sourceMappingURL=CellWithData.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CellWithData.js","names":["_react","_interopRequireWildcard","require","_labsWidgetCommon","
|
|
1
|
+
{"version":3,"file":"CellWithData.js","names":["_react","_interopRequireWildcard","require","_labsWidgetCommon","_Cell","_utils","_getRequireWildcardCache","e","WeakMap","r","t","__esModule","default","has","get","n","__proto__","a","Object","defineProperty","getOwnPropertyDescriptor","u","hasOwnProperty","call","i","set","CellWithData","_ref","currency","pair","record","instrumentForCalculations","target","setSelectedCurrency","setSelectedPair","hovered","setHovered","useState","instrumentForUpdates","instrument","update","error","liveRatesError","useLiveRatesMessage","updatedRecord","displayName","buy","ask","buyPriceMovement","askPriceMovement","displayPrecision","checkLoading","id","undefined","handleMouseEnter","handleMouseLeave","createElement","Cell","isLoading","isError","mouseEnterHandler","mouseLeaveHandler","Price","priceMovement","getPriceMovement","movementIndicator","getBuyPrice","toFixed","exports"],"sources":["../../../../src/CurrencyCrossTableWidget/components/CellWithData.tsx"],"sourcesContent":["import React, { useState } from 'react';\nimport { Price, useLiveRatesMessage } from '@oanda/labs-widget-common';\nimport { Cell } from './Cell';\nimport { CellWithDataProps } from './types';\nimport { getBuyPrice, getPriceMovement } from '../utils';\n\nconst CellWithData = ({\n currency,\n pair,\n record,\n instrumentForCalculations,\n target,\n setSelectedCurrency,\n setSelectedPair,\n}: CellWithDataProps) => {\n const [hovered, setHovered] = useState(false);\n\n const instrumentForUpdates = instrumentForCalculations || record.instrument;\n\n const { update, error: liveRatesError } = useLiveRatesMessage(\n instrumentForUpdates,\n target,\n );\n\n const updatedRecord: Record<string, any> = {\n displayName: record.displayName,\n instrument: record.instrument,\n buy: update?.ask,\n buyPriceMovement: update?.askPriceMovement,\n displayPrecision: update?.displayPrecision,\n };\n\n const checkLoading = (id: string) => (!liveRatesError && updatedRecord?.[id] === undefined);\n\n const handleMouseEnter = () => {\n setHovered(true);\n setSelectedCurrency(currency);\n setSelectedPair(pair);\n };\n\n const handleMouseLeave = () => {\n setHovered(false);\n setSelectedCurrency('');\n setSelectedPair('');\n };\n\n return (\n <Cell\n isLoading={checkLoading('buy')}\n isError={!!liveRatesError}\n hovered={hovered}\n mouseEnterHandler={handleMouseEnter}\n mouseLeaveHandler={handleMouseLeave}\n >\n <Price priceMovement={getPriceMovement(updatedRecord.buyPriceMovement, !!instrumentForCalculations)} movementIndicator=\"background\">\n <span>\n {getBuyPrice(\n updatedRecord.buy,\n !!instrumentForCalculations,\n ).toFixed(updatedRecord.displayPrecision)}\n </span>\n </Price>\n </Cell>\n );\n};\n\nexport { CellWithData };\n"],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAAC,uBAAA,CAAAC,OAAA;AACA,IAAAC,iBAAA,GAAAD,OAAA;AACA,IAAAE,KAAA,GAAAF,OAAA;AAEA,IAAAG,MAAA,GAAAH,OAAA;AAAyD,SAAAI,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,SAAAN,wBAAAM,CAAA,EAAAE,CAAA,SAAAA,CAAA,IAAAF,CAAA,IAAAA,CAAA,CAAAI,UAAA,SAAAJ,CAAA,eAAAA,CAAA,uBAAAA,CAAA,yBAAAA,CAAA,WA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AAAA,YAAA","ignoreList":[]}
|
|
@@ -11,14 +11,16 @@ const TextCell = _ref => {
|
|
|
11
11
|
let {
|
|
12
12
|
label,
|
|
13
13
|
emptyIndicator,
|
|
14
|
-
|
|
15
|
-
|
|
14
|
+
hovered,
|
|
15
|
+
sticky
|
|
16
16
|
} = _ref;
|
|
17
17
|
return _react.default.createElement("span", {
|
|
18
|
-
className: (0, _classnames.default)('lw-flex-1 lw-border-r lw-border-solid lw-border-border-primary lw-py-3.5 lw-text-center', {
|
|
19
|
-
'lw-border-b': additionalBorderBottom,
|
|
18
|
+
className: (0, _classnames.default)('lw-h-11 lw-min-w-[70px] lw-flex-1 lw-border-b lw-border-r lw-border-solid lw-border-border-primary lw-py-3.5 lw-text-center last:lw-border-r-[0px]', {
|
|
20
19
|
'lw-bg-border-primary': emptyIndicator,
|
|
21
|
-
'lw-
|
|
20
|
+
'lw-shadow-innerBorderBgColor': emptyIndicator && hovered,
|
|
21
|
+
'lw-bg-border-primary lw-font-semibold': hovered,
|
|
22
|
+
'lw-sticky lw-left-0 lw-z-10': sticky,
|
|
23
|
+
'lw-bg-bg-primary': sticky && !hovered
|
|
22
24
|
})
|
|
23
25
|
}, label);
|
|
24
26
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TextCell.js","names":["_react","_interopRequireDefault","require","_classnames","e","__esModule","default","TextCell","_ref","label","emptyIndicator","
|
|
1
|
+
{"version":3,"file":"TextCell.js","names":["_react","_interopRequireDefault","require","_classnames","e","__esModule","default","TextCell","_ref","label","emptyIndicator","hovered","sticky","createElement","className","classnames","exports"],"sources":["../../../../src/CurrencyCrossTableWidget/components/TextCell.tsx"],"sourcesContent":["import React from 'react';\nimport classnames from 'classnames';\nimport { TextCellProps } from './types';\n\nconst TextCell = ({\n label,\n emptyIndicator,\n hovered,\n sticky,\n}: TextCellProps) => (\n <span className={classnames('lw-h-11 lw-min-w-[70px] lw-flex-1 lw-border-b lw-border-r lw-border-solid lw-border-border-primary lw-py-3.5 lw-text-center last:lw-border-r-[0px]', {\n 'lw-bg-border-primary': emptyIndicator,\n 'lw-shadow-innerBorderBgColor': emptyIndicator && hovered,\n 'lw-bg-border-primary lw-font-semibold': hovered,\n 'lw-sticky lw-left-0 lw-z-10': sticky,\n 'lw-bg-bg-primary': sticky && !hovered,\n })}\n >\n {label}\n </span>\n);\n\nexport { TextCell };\n"],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,WAAA,GAAAF,sBAAA,CAAAC,OAAA;AAAoC,SAAAD,uBAAAG,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,CAAA;AAGpC,MAAMG,QAAQ,GAAGC,IAAA;EAAA,IAAC;IAChBC,KAAK;IACLC,cAAc;IACdC,OAAO;IACPC;EACa,CAAC,GAAAJ,IAAA;EAAA,OACdR,MAAA,CAAAM,OAAA,CAAAO,aAAA;IAAMC,SAAS,EAAE,IAAAC,mBAAU,EAAC,oJAAoJ,EAAE;MAChL,sBAAsB,EAAEL,cAAc;MACtC,8BAA8B,EAAEA,cAAc,IAAIC,OAAO;MACzD,uCAAuC,EAAEA,OAAO;MAChD,6BAA6B,EAAEC,MAAM;MACrC,kBAAkB,EAAEA,MAAM,IAAI,CAACD;IACjC,CAAC;EAAE,GAEAF,KACG,CAAC;AAAA,CACR;AAACO,OAAA,CAAAT,QAAA,GAAAA,QAAA","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","names":[],"sources":["../../../../src/CurrencyCrossTableWidget/components/types.ts"],"sourcesContent":["import { DataRecord, LoaderSize } from '@oanda/labs-widget-common';\n\nexport interface CellWithDataProps {\n
|
|
1
|
+
{"version":3,"file":"types.js","names":[],"sources":["../../../../src/CurrencyCrossTableWidget/components/types.ts"],"sourcesContent":["import { DataRecord, LoaderSize } from '@oanda/labs-widget-common';\nimport { Division } from '../../gql/types/graphql';\n\nexport interface CellValidationWrapperProps {\n currency: string;\n pair: string;\n instrument: string;\n target: EventTarget | null;\n division: Division;\n setSelectedCurrency: React.Dispatch<React.SetStateAction<string>>;\n setSelectedPair: React.Dispatch<React.SetStateAction<string>>;\n}\nexport interface CellWithDataProps {\n currency: string;\n pair: string;\n instrumentForCalculations: string;\n record: DataRecord;\n target: EventTarget | null;\n division: Division;\n setSelectedCurrency: React.Dispatch<React.SetStateAction<string>>;\n setSelectedPair: React.Dispatch<React.SetStateAction<string>>;\n}\n\nexport interface CellProps {\n children: React.ReactNode;\n isLoading?: boolean;\n isError?: boolean;\n loaderSize?: LoaderSize;\n hovered: boolean;\n mouseEnterHandler: () => void;\n mouseLeaveHandler: () => void;\n}\n\nexport interface TextCellProps {\n label?: string;\n emptyIndicator?: boolean;\n hovered?: boolean;\n sticky?: boolean;\n}\n"],"mappings":"","ignoreList":[]}
|
|
@@ -4,9 +4,10 @@ var _react = _interopRequireDefault(require("react"));
|
|
|
4
4
|
var _client = require("react-dom/client");
|
|
5
5
|
var _labsWidgetCommon = require("@oanda/labs-widget-common");
|
|
6
6
|
var _CurrencyCrossTableWidget = require("./CurrencyCrossTableWidget");
|
|
7
|
-
var
|
|
7
|
+
var _graphql = require("../gql/types/graphql");
|
|
8
8
|
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
9
9
|
const {
|
|
10
|
+
graphqlUrl,
|
|
10
11
|
liveRatesUrl
|
|
11
12
|
} = window.widgetsConfig || {};
|
|
12
13
|
const currencyCrossTableElements = document.querySelectorAll('div[data-currency-cross-table-params]');
|
|
@@ -23,20 +24,24 @@ currencyCrossTableElements.forEach(element => {
|
|
|
23
24
|
division,
|
|
24
25
|
locale,
|
|
25
26
|
currencies,
|
|
27
|
+
graphqlUrl,
|
|
26
28
|
liveRatesUrl
|
|
27
29
|
}, [{
|
|
28
30
|
name: 'locale',
|
|
29
31
|
valueCheck: value => (0, _labsWidgetCommon.validateLocale)(value)
|
|
30
32
|
}, {
|
|
31
33
|
name: 'division',
|
|
32
|
-
valueCheck: value => Object.values(
|
|
34
|
+
valueCheck: value => Object.values(_graphql.Division).includes(value)
|
|
33
35
|
}, {
|
|
34
36
|
name: 'currencies',
|
|
35
37
|
valueCheck: value => value.length > 0 && value.length <= 8
|
|
38
|
+
}, {
|
|
39
|
+
name: 'graphqlUrl'
|
|
36
40
|
}, {
|
|
37
41
|
name: 'liveRatesUrl'
|
|
38
42
|
}]);
|
|
39
43
|
root.render(_react.default.createElement(_CurrencyCrossTableWidget.CurrencyCrossTableWidget, {
|
|
44
|
+
graphqlUrl: graphqlUrl,
|
|
40
45
|
liveRatesUrl: liveRatesUrl,
|
|
41
46
|
division: division,
|
|
42
47
|
currencies: currencies,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"render.js","names":["_react","_interopRequireDefault","require","_client","_labsWidgetCommon","_CurrencyCrossTableWidget","
|
|
1
|
+
{"version":3,"file":"render.js","names":["_react","_interopRequireDefault","require","_client","_labsWidgetCommon","_CurrencyCrossTableWidget","_graphql","e","__esModule","default","graphqlUrl","liveRatesUrl","window","widgetsConfig","currencyCrossTableElements","document","querySelectorAll","forEach","element","root","createRoot","params","getAttribute","mode","currencies","division","locale","JSON","parse","isParamError","validateToolParams","name","valueCheck","value","validateLocale","Object","values","Division","includes","length","render","createElement","CurrencyCrossTableWidget","theme"],"sources":["../../../src/CurrencyCrossTableWidget/render.tsx"],"sourcesContent":["import React from 'react';\nimport { createRoot } from 'react-dom/client';\nimport { Theme, validateLocale, validateToolParams } from '@oanda/labs-widget-common';\nimport { CurrencyCrossTableWidget } from './CurrencyCrossTableWidget';\nimport { Division } from '../gql/types/graphql';\n\nconst {\n graphqlUrl,\n liveRatesUrl,\n} = window.widgetsConfig || {};\n\nconst currencyCrossTableElements = document.querySelectorAll('div[data-currency-cross-table-params]');\n\ncurrencyCrossTableElements.forEach((element) => {\n const root = createRoot(element);\n const params = element.getAttribute('data-currency-cross-table-params');\n const mode = element.getAttribute('data-mode');\n const {\n currencies, division, locale,\n } = JSON.parse(params as string);\n\n const isParamError = validateToolParams({\n division, locale, currencies, graphqlUrl, liveRatesUrl,\n }, [{\n name: 'locale',\n valueCheck: (value) => validateLocale(value),\n }, {\n name: 'division',\n valueCheck: (value) => Object.values(Division).includes(value),\n }, {\n name: 'currencies',\n valueCheck: (value) => (value as string[]).length > 0 && (value as string[]).length <= 8,\n }, {\n name: 'graphqlUrl',\n }, {\n name: 'liveRatesUrl',\n }]);\n\n root.render(\n <CurrencyCrossTableWidget\n graphqlUrl={graphqlUrl}\n liveRatesUrl={liveRatesUrl}\n division={division}\n currencies={currencies}\n locale={locale}\n theme={mode as Theme}\n isParamError={isParamError}\n />,\n );\n});\n"],"mappings":";;AAAA,IAAAA,MAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,OAAA,GAAAD,OAAA;AACA,IAAAE,iBAAA,GAAAF,OAAA;AACA,IAAAG,yBAAA,GAAAH,OAAA;AACA,IAAAI,QAAA,GAAAJ,OAAA;AAAgD,SAAAD,uBAAAM,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,CAAA;AAEhD,MAAM;EACJG,UAAU;EACVC;AACF,CAAC,GAAGC,MAAM,CAACC,aAAa,IAAI,CAAC,CAAC;AAE9B,MAAMC,0BAA0B,GAAGC,QAAQ,CAACC,gBAAgB,CAAC,uCAAuC,CAAC;AAErGF,0BAA0B,CAACG,OAAO,CAAEC,OAAO,IAAK;EAC9C,MAAMC,IAAI,GAAG,IAAAC,kBAAU,EAACF,OAAO,CAAC;EAChC,MAAMG,MAAM,GAAGH,OAAO,CAACI,YAAY,CAAC,kCAAkC,CAAC;EACvE,MAAMC,IAAI,GAAGL,OAAO,CAACI,YAAY,CAAC,WAAW,CAAC;EAC9C,MAAM;IACJE,UAAU;IAAEC,QAAQ;IAAEC;EACxB,CAAC,GAAGC,IAAI,CAACC,KA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