@oanda/labs-currency-cross-table 1.0.103 → 1.0.104
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 +674 -11362
- package/dist/module/CurrencyCrossTableWidget/CurrencyCrossTableWidget.js +22 -15
- package/dist/module/CurrencyCrossTableWidget/CurrencyCrossTableWidget.js.map +1 -1
- package/dist/module/CurrencyCrossTableWidget/Main.js +26 -19
- package/dist/module/CurrencyCrossTableWidget/Main.js.map +1 -1
- package/dist/module/CurrencyCrossTableWidget/ValidationWrapper.js +23 -16
- package/dist/module/CurrencyCrossTableWidget/ValidationWrapper.js.map +1 -1
- package/dist/module/CurrencyCrossTableWidget/components/Cell.js +15 -8
- package/dist/module/CurrencyCrossTableWidget/components/Cell.js.map +1 -1
- package/dist/module/CurrencyCrossTableWidget/components/CellWithData.js +23 -16
- package/dist/module/CurrencyCrossTableWidget/components/CellWithData.js.map +1 -1
- package/dist/module/CurrencyCrossTableWidget/components/TextCell.js +12 -5
- package/dist/module/CurrencyCrossTableWidget/components/TextCell.js.map +1 -1
- package/dist/module/CurrencyCrossTableWidget/components/index.js +27 -2
- package/dist/module/CurrencyCrossTableWidget/components/index.js.map +1 -1
- package/dist/module/CurrencyCrossTableWidget/components/types.js +5 -1
- package/dist/module/CurrencyCrossTableWidget/constant.js +10 -5
- package/dist/module/CurrencyCrossTableWidget/constant.js.map +1 -1
- package/dist/module/CurrencyCrossTableWidget/index.js +27 -2
- package/dist/module/CurrencyCrossTableWidget/index.js.map +1 -1
- package/dist/module/CurrencyCrossTableWidget/render.js +13 -10
- package/dist/module/CurrencyCrossTableWidget/render.js.map +1 -1
- package/dist/module/CurrencyCrossTableWidget/types.js +12 -1
- package/dist/module/CurrencyCrossTableWidget/types.js.map +1 -1
- package/dist/module/CurrencyCrossTableWidget/utils.js +13 -3
- package/dist/module/CurrencyCrossTableWidget/utils.js.map +1 -1
- package/dist/module/gql/types/fragment-masking.js +11 -3
- package/dist/module/gql/types/fragment-masking.js.map +1 -1
- package/dist/module/gql/types/gql.js +9 -2
- package/dist/module/gql/types/gql.js.map +1 -1
- package/dist/module/gql/types/graphql.js +21 -15
- package/dist/module/gql/types/graphql.js.map +1 -1
- package/dist/module/gql/types/index.js +27 -2
- package/dist/module/gql/types/index.js.map +1 -1
- package/dist/module/gql/validateInstruments.js +8 -2
- package/dist/module/gql/validateInstruments.js.map +1 -1
- package/dist/module/index.js +16 -1
- package/dist/module/index.js.map +1 -1
- package/dist/module/translations/index.js +21 -14
- package/dist/module/translations/index.js.map +1 -1
- package/dist/module/translations/translations.js +7 -1
- package/dist/module/translations/translations.js.map +1 -1
- package/dist/types/CurrencyCrossTableWidget/utils.d.ts +1 -1
- package/dist/types/gql/validateInstruments.d.ts +1 -1
- package/package.json +8 -4
- package/tsconfig.types.json +2 -4
|
@@ -1,9 +1,16 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.CurrencyCrossTableWidget = void 0;
|
|
7
|
+
var _client = require("@apollo/client");
|
|
8
|
+
var _labsWidgetCommon = require("@oanda/labs-widget-common");
|
|
9
|
+
var _react = _interopRequireDefault(require("react"));
|
|
10
|
+
var _graphql = require("../gql/types/graphql");
|
|
11
|
+
var _translations = require("../translations");
|
|
12
|
+
var _ValidationWrapper = require("./ValidationWrapper");
|
|
13
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
7
14
|
const CurrencyCrossTableWidget = _ref => {
|
|
8
15
|
let {
|
|
9
16
|
graphqlUrl,
|
|
@@ -17,13 +24,13 @@ const CurrencyCrossTableWidget = _ref => {
|
|
|
17
24
|
logoLink,
|
|
18
25
|
brandingSpace
|
|
19
26
|
} = _ref;
|
|
20
|
-
const client = new ApolloClient({
|
|
27
|
+
const client = new _client.ApolloClient({
|
|
21
28
|
uri: graphqlUrl,
|
|
22
|
-
cache: new InMemoryCache()
|
|
29
|
+
cache: new _client.InMemoryCache()
|
|
23
30
|
});
|
|
24
|
-
const divisionCode = division === Division.Opt ? Division.Ogm : division;
|
|
25
|
-
const dataSource = divisionCode === Division.Ogm ? 'MT5' : 'V20';
|
|
26
|
-
return
|
|
31
|
+
const divisionCode = division === _graphql.Division.Opt ? _graphql.Division.Ogm : division;
|
|
32
|
+
const dataSource = divisionCode === _graphql.Division.Ogm ? 'MT5' : 'V20';
|
|
33
|
+
return _react.default.createElement(_labsWidgetCommon.WidgetProvider, {
|
|
27
34
|
withSuspense: true,
|
|
28
35
|
client: client,
|
|
29
36
|
liveRates: {
|
|
@@ -38,16 +45,16 @@ const CurrencyCrossTableWidget = _ref => {
|
|
|
38
45
|
removePadding
|
|
39
46
|
},
|
|
40
47
|
theme: theme,
|
|
41
|
-
translations: translations
|
|
42
|
-
},
|
|
48
|
+
translations: _translations.translations
|
|
49
|
+
}, _react.default.createElement(_labsWidgetCommon.WidgetWrapper, {
|
|
43
50
|
brandingSpace: brandingSpace,
|
|
44
51
|
linkArea: "full",
|
|
45
52
|
logoLink: logoLink
|
|
46
|
-
},
|
|
53
|
+
}, _react.default.createElement(_ValidationWrapper.ValidationWrapper, {
|
|
47
54
|
currencies: currencies,
|
|
48
55
|
division: division,
|
|
49
56
|
isParamError: isParamError
|
|
50
57
|
})));
|
|
51
58
|
};
|
|
52
|
-
|
|
59
|
+
exports.CurrencyCrossTableWidget = CurrencyCrossTableWidget;
|
|
53
60
|
//# sourceMappingURL=CurrencyCrossTableWidget.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CurrencyCrossTableWidget.js","names":["
|
|
1
|
+
{"version":3,"file":"CurrencyCrossTableWidget.js","names":["_client","require","_labsWidgetCommon","_react","_interopRequireDefault","_graphql","_translations","_ValidationWrapper","e","__esModule","default","CurrencyCrossTableWidget","_ref","graphqlUrl","liveRatesUrl","currencies","division","locale","theme","isParamError","removePadding","logoLink","brandingSpace","client","ApolloClient","uri","cache","InMemoryCache","divisionCode","Division","Opt","Ogm","dataSource","createElement","WidgetProvider","withSuspense","liveRates","url","options","styling","translations","WidgetWrapper","linkArea","ValidationWrapper","exports"],"sources":["../../../src/CurrencyCrossTableWidget/CurrencyCrossTableWidget.tsx"],"sourcesContent":["import { ApolloClient, InMemoryCache } from '@apollo/client';\nimport { WidgetProvider, WidgetWrapper } from '@oanda/labs-widget-common';\nimport React from 'react';\n\nimport { Division } from '../gql/types/graphql';\nimport { translations } from '../translations';\nimport type { CurrencyCrossTableConfig } from './types';\nimport { ValidationWrapper } from './ValidationWrapper';\n\nconst CurrencyCrossTableWidget = ({\n graphqlUrl,\n liveRatesUrl,\n currencies,\n division,\n locale,\n theme,\n isParamError,\n removePadding,\n logoLink,\n brandingSpace,\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 <WidgetProvider\n withSuspense\n client={client}\n liveRates={{\n url: liveRatesUrl,\n options: { divisionCode, dataSource },\n }}\n locale={locale}\n styling={{\n removePadding,\n }}\n theme={theme}\n translations={translations}\n >\n <WidgetWrapper\n brandingSpace={brandingSpace}\n linkArea=\"full\"\n logoLink={logoLink}\n >\n <ValidationWrapper\n currencies={currencies}\n division={division}\n isParamError={isParamError}\n />\n </WidgetWrapper>\n </WidgetProvider>\n );\n};\n\nexport { CurrencyCrossTableWidget };\n"],"mappings":";;;;;;AAAA,IAAAA,OAAA,GAAAC,OAAA;AACA,IAAAC,iBAAA,GAAAD,OAAA;AACA,IAAAE,MAAA,GAAAC,sBAAA,CAAAH,OAAA;AAEA,IAAAI,QAAA,GAAAJ,OAAA;AACA,IAAAK,aAAA,GAAAL,OAA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AChB5B,UAAU,EAAEA,UAAW;IACvBC,QAAQ,EAAEA,QAAS;IACnBG,YAAY,EAAEA;EAAa,CAC5B,CACY,CACD,CAAC;AAErB,CAAC;AAACyB,OAAA,CAAAjC,wBAAA,GAAAA,wBAAA","ignoreList":[]}
|
|
@@ -1,55 +1,62 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.Main = void 0;
|
|
7
|
+
var _labsWidgetCommon = require("@oanda/labs-widget-common");
|
|
8
|
+
var _react = _interopRequireWildcard(require("react"));
|
|
9
|
+
var _components = require("./components");
|
|
10
|
+
var _utils = require("./utils");
|
|
11
|
+
function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function (e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != typeof e && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (const t in e) "default" !== t && {}.hasOwnProperty.call(e, t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, t)) && (i.get || i.set) ? o(f, t, i) : f[t] = e[t]); return f; })(e, t); }
|
|
5
12
|
const Main = _ref => {
|
|
6
13
|
let {
|
|
7
14
|
currencies,
|
|
8
15
|
validInstruments,
|
|
9
16
|
division
|
|
10
17
|
} = _ref;
|
|
11
|
-
const [selectedCurrency, setSelectedCurrency] = useState('');
|
|
12
|
-
const [selectedPair, setSelectedPair] = useState('');
|
|
18
|
+
const [selectedCurrency, setSelectedCurrency] = (0, _react.useState)('');
|
|
19
|
+
const [selectedPair, setSelectedPair] = (0, _react.useState)('');
|
|
13
20
|
const {
|
|
14
21
|
target,
|
|
15
22
|
setQuery
|
|
16
|
-
} = useLiveRatesQuery();
|
|
17
|
-
useEffect(() => {
|
|
23
|
+
} = (0, _labsWidgetCommon.useLiveRatesQuery)();
|
|
24
|
+
(0, _react.useEffect)(() => {
|
|
18
25
|
setQuery({
|
|
19
26
|
instruments: validInstruments
|
|
20
27
|
});
|
|
21
28
|
}, validInstruments);
|
|
22
|
-
return
|
|
29
|
+
return _react.default.createElement("div", {
|
|
23
30
|
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",
|
|
24
31
|
"data-testid": "currency-cross-table-wrapper"
|
|
25
|
-
},
|
|
32
|
+
}, _react.default.createElement("div", {
|
|
26
33
|
className: "lw-flex lw-w-max lw-min-w-full"
|
|
27
|
-
},
|
|
34
|
+
}, _react.default.createElement(_components.TextCell, {
|
|
28
35
|
sticky: true
|
|
29
|
-
}), currencies.map(pair =>
|
|
36
|
+
}), currencies.map(pair => _react.default.createElement(_components.TextCell, {
|
|
30
37
|
key: pair,
|
|
31
38
|
hovered: pair === selectedPair,
|
|
32
39
|
label: pair
|
|
33
|
-
}))), currencies.map((currency, index, arr) =>
|
|
40
|
+
}))), currencies.map((currency, index, arr) => _react.default.createElement("div", {
|
|
34
41
|
key: currency,
|
|
35
42
|
className: "lw-flex lw-w-max lw-min-w-full"
|
|
36
|
-
},
|
|
43
|
+
}, _react.default.createElement(_components.TextCell, {
|
|
37
44
|
sticky: true,
|
|
38
45
|
hovered: currency === selectedCurrency,
|
|
39
46
|
label: currency
|
|
40
|
-
}), arr.map(pair =>
|
|
47
|
+
}), arr.map(pair => _react.default.createElement(_react.Fragment, {
|
|
41
48
|
key: `${currency}_${pair}`
|
|
42
|
-
}, currency !== pair ?
|
|
49
|
+
}, currency !== pair ? _react.default.createElement(_components.CellWithData, {
|
|
43
50
|
currency: currency,
|
|
44
51
|
division: division,
|
|
45
|
-
isValid: validInstruments.includes(`${currency}${divisionMapper(division)}${pair}`),
|
|
52
|
+
isValid: validInstruments.includes(`${currency}${(0, _utils.divisionMapper)(division)}${pair}`),
|
|
46
53
|
pair: pair,
|
|
47
54
|
setSelectedCurrency: setSelectedCurrency,
|
|
48
55
|
setSelectedPair: setSelectedPair,
|
|
49
56
|
target: target
|
|
50
|
-
}) :
|
|
57
|
+
}) : _react.default.createElement(_components.TextCell, {
|
|
51
58
|
emptyIndicator: true
|
|
52
59
|
}))))));
|
|
53
60
|
};
|
|
54
|
-
|
|
61
|
+
exports.Main = Main;
|
|
55
62
|
//# sourceMappingURL=Main.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Main.js","names":["
|
|
1
|
+
{"version":3,"file":"Main.js","names":["_labsWidgetCommon","require","_react","_interopRequireWildcard","_components","_utils","e","t","WeakMap","r","n","__esModule","o","i","f","__proto__","default","has","get","set","hasOwnProperty","call","Object","defineProperty","getOwnPropertyDescriptor","Main","_ref","currencies","validInstruments","division","selectedCurrency","setSelectedCurrency","useState","selectedPair","setSelectedPair","target","setQuery","useLiveRatesQuery","useEffect","instruments","createElement","className","TextCell","sticky","map","pair","key","hovered","label","currency","index","arr","Fragment","CellWithData","isValid","includes","divisionMapper","emptyIndicator","exports"],"sources":["../../../src/CurrencyCrossTableWidget/Main.tsx"],"sourcesContent":["import { useLiveRatesQuery } from '@oanda/labs-widget-common';\nimport React, { Fragment, useEffect, useState } from 'react';\n\nimport { CellWithData, TextCell } from './components';\nimport type { MainProps } from './types';\nimport { divisionMapper } from './utils';\n\nconst Main = ({ currencies, validInstruments, division }: MainProps) => {\n const [selectedCurrency, setSelectedCurrency] = useState('');\n const [selectedPair, setSelectedPair] = useState('');\n const { target, setQuery } = useLiveRatesQuery();\n\n useEffect(() => {\n setQuery({ instruments: validInstruments });\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, validInstruments);\n\n return (\n <div\n 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 data-testid=\"currency-cross-table-wrapper\"\n >\n <div className=\"lw-flex lw-w-max lw-min-w-full\">\n <TextCell sticky />\n {currencies.map((pair) => (\n <TextCell key={pair} hovered={pair === selectedPair} label={pair} />\n ))}\n </div>\n {currencies.map((currency, index, arr) => (\n <div key={currency} className=\"lw-flex lw-w-max lw-min-w-full\">\n <TextCell\n sticky\n hovered={currency === selectedCurrency}\n label={currency}\n />\n {arr.map((pair) => (\n <Fragment key={`${currency}_${pair}`}>\n {currency !== pair ? (\n <CellWithData\n currency={currency}\n division={division}\n isValid={validInstruments.includes(\n `${currency}${divisionMapper(division)}${pair}`\n )}\n pair={pair}\n setSelectedCurrency={setSelectedCurrency}\n setSelectedPair={setSelectedPair}\n target={target}\n />\n ) : (\n <TextCell emptyIndicator />\n )}\n </Fragment>\n ))}\n </div>\n ))}\n </div>\n );\n};\n\nexport { Main };\n"],"mappings":";;;;;;AAAA,IAAAA,iBAAA,GAAAC,OAAA;AACA,IAAAC,MAAA,GAAAC,uBAAA,CAAAF,OAAA;AAEA,IAAAG,WAAA,GAAAH,OAAA;AAEA,IAAAI,MAAA,GAAAJ,OAAA;AAAyC,SAAAE,wBAAAG,CAAA,EAAAC,CAAA,6BAAAC,OAAA,MAAAC,CAAA,OAAAD,OAAA,IAAAE,CAAA,OAAAF,OAAA,YAAAL,uBAAA,YAAAA,CAAAG,CAAA,EAAAC,CAAA,SAAAA,CAAA,IAAAD,CAAA,IAAAA,CAAA,CAAAK,UAAA,SAAAL,CAAA,MAAAM,CAAA,EAAAC,CAAA,EAAAC,CAAA,KAAAC,SAAA,QAAAC,OAAA,EAAAV,CAAA,iBAAAA,CAAA,uBAAAA,CAAA,yBAAAA,CAAA,SAAAQ,CAAA,MAAAF,CAAA,GAAAL,CAAA,GAAAG,CAAA,GAAAD,CAAA,QAAAG,CAAA,CAAAK,GAAA,CAAAX,CAAA,UAAAM,CAAA,CAAAM,GAAA,CAAAZ,CAAA,GAAAM,CAAA,CAAAO,GAAA,CAAAb,CAAA,EAAAQ,CAAA,gBAAAP,CAAA,IAAAD,C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|
@@ -1,21 +1,28 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.ValidationWrapper = void 0;
|
|
7
|
+
var _client = require("@apollo/client");
|
|
8
|
+
var _labsWidgetCommon = require("@oanda/labs-widget-common");
|
|
9
|
+
var _classnames = _interopRequireDefault(require("classnames"));
|
|
10
|
+
var _react = _interopRequireDefault(require("react"));
|
|
11
|
+
var _validateInstruments = require("../gql/validateInstruments");
|
|
12
|
+
var _Main = require("./Main");
|
|
13
|
+
var _utils = require("./utils");
|
|
14
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
8
15
|
const ValidationWrapper = _ref => {
|
|
9
16
|
let {
|
|
10
17
|
currencies,
|
|
11
18
|
division,
|
|
12
19
|
isParamError
|
|
13
20
|
} = _ref;
|
|
14
|
-
const instruments = currenciesToInstruments(currencies, division);
|
|
21
|
+
const instruments = (0, _utils.currenciesToInstruments)(currencies, division);
|
|
15
22
|
const {
|
|
16
23
|
data,
|
|
17
24
|
error
|
|
18
|
-
} = useSuspenseQuery(validateInstruments, {
|
|
25
|
+
} = (0, _client.useSuspenseQuery)(_validateInstruments.validateInstruments, {
|
|
19
26
|
variables: {
|
|
20
27
|
instruments,
|
|
21
28
|
division
|
|
@@ -24,16 +31,16 @@ const ValidationWrapper = _ref => {
|
|
|
24
31
|
errorPolicy: 'all'
|
|
25
32
|
});
|
|
26
33
|
const validInstruments = data?.resolveInstrumentsByDivision?.map(instrument => instrument.name);
|
|
27
|
-
const showError = !validCurrencies(currencies) || isParamError || error || !validInstruments || validInstruments.length === 0;
|
|
28
|
-
return
|
|
34
|
+
const showError = !(0, _utils.validCurrencies)(currencies) || isParamError || error || !validInstruments || validInstruments.length === 0;
|
|
35
|
+
return _react.default.createElement(_react.default.Fragment, null, _react.default.createElement("div", {
|
|
29
36
|
className: "lw-flex lw-w-full lw-text-sm lw-tracking-normal lw-text-text-primary"
|
|
30
|
-
}, !showError &&
|
|
37
|
+
}, !showError && _react.default.createElement(_Main.Main, {
|
|
31
38
|
currencies: currencies,
|
|
32
39
|
division: division,
|
|
33
40
|
validInstruments: validInstruments
|
|
34
|
-
}), showError &&
|
|
35
|
-
className:
|
|
36
|
-
},
|
|
41
|
+
}), showError && _react.default.createElement("div", {
|
|
42
|
+
className: (0, _classnames.default)('lw-flex lw-h-[250px] lw-w-full lw-items-center lw-border lw-border-solid lw-border-border-primary')
|
|
43
|
+
}, _react.default.createElement(_labsWidgetCommon.ChartError, null))));
|
|
37
44
|
};
|
|
38
|
-
|
|
45
|
+
exports.ValidationWrapper = ValidationWrapper;
|
|
39
46
|
//# sourceMappingURL=ValidationWrapper.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ValidationWrapper.js","names":["
|
|
1
|
+
{"version":3,"file":"ValidationWrapper.js","names":["_client","require","_labsWidgetCommon","_classnames","_interopRequireDefault","_react","_validateInstruments","_Main","_utils","e","__esModule","default","ValidationWrapper","_ref","currencies","division","isParamError","instruments","currenciesToInstruments","data","error","useSuspenseQuery","validateInstruments","variables","fetchPolicy","errorPolicy","validInstruments","resolveInstrumentsByDivision","map","instrument","name","showError","validCurrencies","length","createElement","Fragment","className","Main","classnames","ChartError","exports"],"sources":["../../../src/CurrencyCrossTableWidget/ValidationWrapper.tsx"],"sourcesContent":["import { useSuspenseQuery } from '@apollo/client';\nimport { ChartError } from '@oanda/labs-widget-common';\nimport classnames from 'classnames';\nimport React from 'react';\n\nimport type {\n ValidateInstrumentsQuery,\n ValidateInstrumentsQueryVariables,\n} from '../gql/types/graphql';\nimport { validateInstruments } from '../gql/validateInstruments';\nimport { Main } from './Main';\nimport type { ValidationWrapperProps } from './types';\nimport { currenciesToInstruments, validCurrencies } from './utils';\n\nconst ValidationWrapper = ({\n currencies,\n division,\n isParamError,\n}: ValidationWrapperProps) => {\n const instruments = currenciesToInstruments(currencies, division);\n\n const { data, error } = useSuspenseQuery<\n ValidateInstrumentsQuery,\n ValidateInstrumentsQueryVariables\n >(validateInstruments, {\n variables: {\n instruments,\n division,\n },\n fetchPolicy: 'network-only',\n errorPolicy: 'all',\n });\n\n const validInstruments = data?.resolveInstrumentsByDivision?.map(\n (instrument) => instrument.name\n );\n const showError =\n !validCurrencies(currencies) ||\n isParamError ||\n error ||\n !validInstruments ||\n validInstruments.length === 0;\n\n return (\n <>\n <div className=\"lw-flex lw-w-full lw-text-sm lw-tracking-normal lw-text-text-primary\">\n {!showError && (\n <Main\n currencies={currencies}\n division={division}\n validInstruments={validInstruments}\n />\n )}\n {showError && (\n <div\n className={classnames(\n 'lw-flex lw-h-[250px] lw-w-full lw-items-center lw-border lw-border-solid lw-border-border-primary'\n )}\n >\n <ChartError />\n </div>\n )}\n </div>\n </>\n );\n};\n\nexport { ValidationWrapper };\n"],"mappings":";;;;;;AAAA,IAAAA,OAAA,GAAAC,OAAA;AACA,IAAAC,iBAAA,GAAAD,OAAA;AACA,IAAAE,WAAA,GAAAC,sBAAA,CAAAH,OAAA;AACA,IAAAI,MAAA,GAAAD,sBAAA,CAAAH,OAAA;AAMA,IAAAK,oBAAA,GAAAL,OAAA;AACA,IAAAM,KAAA,GAAAN,OAAA;AAEA,IAAAO,MAAA,GAAAP,OAAA;AAAmE,SAAAG,uBAAAK,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,CAAA;AAEnE,MAAMG,iBAAiB,GAAGC,IAAA,IAII;EAAA,IAJH;IACzBC,UAAU;IACVC,QAAQ;IACRC;EACsB,CAAC,GAAAH,IAAA;EACvB,MAAMI,WAAW,GAAG,IAAAC,8BAAuB,EAACJ,UAAU,EAAEC,QAAQ,CAAC;EAEjE,MAAM;IAAEI,IAAI;IAAEC;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
+
var _classnames = _interopRequireDefault(require("classnames"));
|
|
8
|
+
var _react = _interopRequireDefault(require("react"));
|
|
9
|
+
var _constant = require("../constant");
|
|
10
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
4
11
|
const Cell = _ref => {
|
|
5
12
|
let {
|
|
6
13
|
children,
|
|
@@ -10,15 +17,15 @@ const Cell = _ref => {
|
|
|
10
17
|
mouseEnterHandler,
|
|
11
18
|
mouseLeaveHandler
|
|
12
19
|
} = _ref;
|
|
13
|
-
return
|
|
14
|
-
className:
|
|
20
|
+
return _react.default.createElement("div", {
|
|
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]', {
|
|
15
22
|
'lw-bg-border-primary lw-font-semibold lw-shadow-innerBorderBgColor': hovered
|
|
16
23
|
}),
|
|
17
24
|
onMouseEnter: mouseEnterHandler,
|
|
18
25
|
onMouseLeave: mouseLeaveHandler
|
|
19
|
-
}, isLoading &&
|
|
26
|
+
}, isLoading && _react.default.createElement("div", {
|
|
20
27
|
className: "lw-px-3 lw-py-3.5"
|
|
21
|
-
}, CELL_LOADING_VALUE), !isLoading && !isError && children, !isLoading && isError &&
|
|
28
|
+
}, _constant.CELL_LOADING_VALUE), !isLoading && !isError && children, !isLoading && isError && _react.default.createElement("span", null, _constant.CELL_EMPTY_VALUE));
|
|
22
29
|
};
|
|
23
|
-
|
|
30
|
+
exports.Cell = Cell;
|
|
24
31
|
//# sourceMappingURL=Cell.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Cell.js","names":["
|
|
1
|
+
{"version":3,"file":"Cell.js","names":["_classnames","_interopRequireDefault","require","_react","_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 classnames from 'classnames';\nimport React from 'react';\n\nimport { CELL_EMPTY_VALUE, CELL_LOADING_VALUE } from '../constant';\nimport type { CellProps } from './types';\n\nconst Cell = ({\n children,\n isError,\n isLoading,\n hovered,\n mouseEnterHandler,\n mouseLeaveHandler,\n}: CellProps) => (\n <div\n className={classnames(\n '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 {\n 'lw-bg-border-primary lw-font-semibold lw-shadow-innerBorderBgColor':\n hovered,\n }\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 && <span>{CELL_EMPTY_VALUE}</span>}\n </div>\n);\n\nexport { Cell };\n"],"mappings":";;;;;;AAAA,IAAAA,WAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,MAAA,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;AAGnE,MAAMG,IAAI,GAAGC,IAAA;EAAA,IAAC;IACZC,QAAQ;IACRC,OAAO;IACPC,SAAS;IACTC,OAAO;IACPC,iBAAiB;IACjBC;EACS,CAAC,GAAAN,IAAA;EAAA,OACVN,MAAA,CAAAI,OAAA,CAAAS,aAAA;IACEC,SAAS,EAAE,IAAAC,mBAAU,EACnB,qKAAqK,EACrK;MACE,oEAAoE,EAClEL;IACJ,CACF,CAAE;IACFM,YAAY,EAAEL,iBAAkB;IAChCM,YAAY,EAAEL;EAAkB,GAE/BH,SAAS,IAAIT,MAAA,CAAAI,OAAA,CAAAS,aAAA;IAAKC,SAAS,EAAC;EAAmB,GAAEI,4BAAwB,CAAC,EAC1E,CAACT,SAAS,IAAI,CAACD,OAAO,IAAID,QAAQ,EAClC,CAACE,SAAS,IAAID,OAAO,IAAIR,MAAA,CAAAI,OAAA,CAAAS,aAAA,eAAOM,0BAAuB,CACrD,CAAC;AAAA,CACP;AAACC,OAAA,CAAAf,IAAA,GAAAA,IAAA","ignoreList":[]}
|
|
@@ -1,7 +1,14 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.CellWithData = void 0;
|
|
7
|
+
var _labsWidgetCommon = require("@oanda/labs-widget-common");
|
|
8
|
+
var _react = _interopRequireWildcard(require("react"));
|
|
9
|
+
var _utils = require("../utils");
|
|
10
|
+
var _Cell = require("./Cell");
|
|
11
|
+
function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function (e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != typeof e && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (const t in e) "default" !== t && {}.hasOwnProperty.call(e, t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, t)) && (i.get || i.set) ? o(f, t, i) : f[t] = e[t]); return f; })(e, t); }
|
|
5
12
|
const CellWithData = _ref => {
|
|
6
13
|
let {
|
|
7
14
|
currency,
|
|
@@ -12,15 +19,15 @@ const CellWithData = _ref => {
|
|
|
12
19
|
setSelectedCurrency,
|
|
13
20
|
setSelectedPair
|
|
14
21
|
} = _ref;
|
|
15
|
-
const instrument = `${currency}${divisionMapper(division)}${pair}`;
|
|
16
|
-
const instrumentForUpdates = isValid ? instrument : `${pair}${divisionMapper(division)}${currency}`;
|
|
22
|
+
const instrument = `${currency}${(0, _utils.divisionMapper)(division)}${pair}`;
|
|
23
|
+
const instrumentForUpdates = isValid ? instrument : `${pair}${(0, _utils.divisionMapper)(division)}${currency}`;
|
|
17
24
|
const {
|
|
18
25
|
update,
|
|
19
26
|
error: liveRatesError
|
|
20
|
-
} = useLiveRatesMessage(instrumentForUpdates, target);
|
|
21
|
-
const [hovered, setHovered] = useState(false);
|
|
22
|
-
const prevBuyPrice = useRef();
|
|
23
|
-
const [priceMovement, setPriceMovement] = useState();
|
|
27
|
+
} = (0, _labsWidgetCommon.useLiveRatesMessage)(instrumentForUpdates, target);
|
|
28
|
+
const [hovered, setHovered] = (0, _react.useState)(false);
|
|
29
|
+
const prevBuyPrice = (0, _react.useRef)();
|
|
30
|
+
const [priceMovement, setPriceMovement] = (0, _react.useState)();
|
|
24
31
|
const checkLoading = () => !liveRatesError && update?.ask === undefined;
|
|
25
32
|
const handleMouseEnter = () => {
|
|
26
33
|
setHovered(true);
|
|
@@ -32,13 +39,13 @@ const CellWithData = _ref => {
|
|
|
32
39
|
setSelectedCurrency('');
|
|
33
40
|
setSelectedPair('');
|
|
34
41
|
};
|
|
35
|
-
useEffect(() => {
|
|
42
|
+
(0, _react.useEffect)(() => {
|
|
36
43
|
if (!update) return;
|
|
37
44
|
const {
|
|
38
45
|
ask,
|
|
39
46
|
displayPrecision
|
|
40
47
|
} = update;
|
|
41
|
-
const movement = getPriceMovement({
|
|
48
|
+
const movement = (0, _utils.getPriceMovement)({
|
|
42
49
|
previous: prevBuyPrice.current,
|
|
43
50
|
update: ask,
|
|
44
51
|
displayPrecision: currency === 'JPY' && !isValid ? 6 : displayPrecision,
|
|
@@ -47,16 +54,16 @@ const CellWithData = _ref => {
|
|
|
47
54
|
prevBuyPrice.current = ask;
|
|
48
55
|
setPriceMovement(movement);
|
|
49
56
|
}, [isValid, update, currency]);
|
|
50
|
-
return
|
|
57
|
+
return _react.default.createElement(_Cell.Cell, {
|
|
51
58
|
hovered: hovered,
|
|
52
59
|
isError: !!liveRatesError,
|
|
53
60
|
isLoading: checkLoading(),
|
|
54
61
|
mouseEnterHandler: handleMouseEnter,
|
|
55
62
|
mouseLeaveHandler: handleMouseLeave
|
|
56
|
-
},
|
|
63
|
+
}, _react.default.createElement(_labsWidgetCommon.Price, {
|
|
57
64
|
movementIndicator: "background",
|
|
58
65
|
priceMovement: priceMovement
|
|
59
|
-
},
|
|
66
|
+
}, _react.default.createElement("span", null, (0, _utils.getBuyPrice)(update?.ask, !isValid).toFixed(currency === 'JPY' && !isValid ? 6 : update?.displayPrecision))));
|
|
60
67
|
};
|
|
61
|
-
|
|
68
|
+
exports.CellWithData = CellWithData;
|
|
62
69
|
//# sourceMappingURL=CellWithData.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CellWithData.js","names":["
|
|
1
|
+
{"version":3,"file":"CellWithData.js","names":["_labsWidgetCommon","require","_react","_interopRequireWildcard","_utils","_Cell","e","t","WeakMap","r","n","__esModule","o","i","f","__proto__","default","has","get","set","hasOwnProperty","call","Object","defineProperty","getOwnPropertyDescriptor","CellWithData","_ref","currency","pair","isValid","target","division","setSelectedCurrency","setSelectedPair","instrument","divisionMapper","instrumentForUpdates","update","error","liveRatesError","useLiveRatesMessage","hovered","setHovered","useState","prevBuyPrice","useRef","priceMovement","setPriceMovement","checkLoading","ask","undefined","handleMouseEnter","handleMouseLeave","useEffect","displayPrecision","movement","getPriceMovement","previous","current","isReversed","createElement","Cell","isError","isLoading","mouseEnterHandler","mouseLeaveHandler","Price","movementIndicator","getBuyPrice","toFixed","exports"],"sources":["../../../../src/CurrencyCrossTableWidget/components/CellWithData.tsx"],"sourcesContent":["import { Price, useLiveRatesMessage } from '@oanda/labs-widget-common';\nimport React, { useEffect, useRef, useState } from 'react';\n\nimport { divisionMapper, getBuyPrice, getPriceMovement } from '../utils';\nimport { Cell } from './Cell';\nimport type { CellWithDataProps } from './types';\n\nconst CellWithData = ({\n currency,\n pair,\n isValid,\n target,\n division,\n setSelectedCurrency,\n setSelectedPair,\n}: CellWithDataProps) => {\n const instrument = `${currency}${divisionMapper(division)}${pair}`;\n const instrumentForUpdates = isValid\n ? instrument\n : `${pair}${divisionMapper(division)}${currency}`;\n\n const { update, error: liveRatesError } = useLiveRatesMessage(\n instrumentForUpdates,\n target\n );\n\n const [hovered, setHovered] = useState(false);\n const prevBuyPrice = useRef<number>();\n const [priceMovement, setPriceMovement] = useState<number | undefined>();\n\n const checkLoading = () => !liveRatesError && update?.ask === 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 useEffect(() => {\n if (!update) return;\n\n const { ask, displayPrecision } = update;\n const movement = getPriceMovement({\n previous: prevBuyPrice.current,\n update: ask,\n displayPrecision: currency === 'JPY' && !isValid ? 6 : displayPrecision,\n isReversed: !isValid,\n });\n\n prevBuyPrice.current = ask;\n setPriceMovement(movement);\n }, [isValid, update, currency]);\n\n return (\n <Cell\n hovered={hovered}\n isError={!!liveRatesError}\n isLoading={checkLoading()}\n mouseEnterHandler={handleMouseEnter}\n mouseLeaveHandler={handleMouseLeave}\n >\n <Price movementIndicator=\"background\" priceMovement={priceMovement}>\n <span>\n {getBuyPrice(update?.ask, !isValid).toFixed(\n currency === 'JPY' && !isValid ? 6 : update?.displayPrecision\n )}\n </span>\n </Price>\n </Cell>\n );\n};\n\nexport { CellWithData };\n"],"mappings":";;;;;;AAAA,IAAAA,iBAAA,GAAAC,OAAA;AACA,IAAAC,MAAA,GAAAC,uBAAA,CAAAF,OAAA;AAEA,IAAAG,MAAA,GAAAH,OAAA;AACA,IAAAI,KAAA,GAAAJ,OAAA;AAA8B,SAAAE,wBAAAG,CAAA,EAAAC,CAAA,6BAAAC,OAAA,MAAAC,CAAA,OAAAD,OAAA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,OAAO,EAAEQ,MAAM,EAAEV,QAAQ,CAAC,CAAC;EAE/B,OACEzB,MAAA,CAAAc,OAAA,CAAA4C,aAAA,CAACvD,KAAA,CAAAwD,IAAI;IACHpB,OAAO,EAAEA,OAAQ;IACjBqB,OAAO,EAAE,CAAC,CAACvB,cAAe;IAC1BwB,SAAS,EAAEf,YAAY,CAAC,CAAE;IAC1BgB,iBAAiB,EAAEb,gBAAiB;IACpCc,iBAAiB,EAAEb;EAAiB,GAEpClD,MAAA,CAAAc,OAAA,CAAA4C,aAAA,CAAC5D,iBAAA,CAAAkE,KAAK;IAACC,iBAAiB,EAAC,YAAY;IAACrB,aAAa,EAAEA;EAAc,GACjE5C,MAAA,CAAAc,OAAA,CAAA4C,aAAA,eACG,IAAAQ,kBAAW,EAAC/B,MAAM,EAAEY,GAAG,EAAE,CAACpB,OAAO,CAAC,CAACwC,OAAO,CACzC1C,QAAQ,KAAK,KAAK,IAAI,CAACE,OAAO,GAAG,CAAC,GAAGQ,MAAM,EAAEiB,gBAC/C,CACI,CACD,CACH,CAAC;AAEX,CAAC;AAACgB,OAAA,CAAA7C,YAAA,GAAAA,YAAA","ignoreList":[]}
|
|
@@ -1,5 +1,12 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.TextCell = void 0;
|
|
7
|
+
var _classnames = _interopRequireDefault(require("classnames"));
|
|
8
|
+
var _react = _interopRequireDefault(require("react"));
|
|
9
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
3
10
|
const TextCell = _ref => {
|
|
4
11
|
let {
|
|
5
12
|
label,
|
|
@@ -7,8 +14,8 @@ const TextCell = _ref => {
|
|
|
7
14
|
hovered,
|
|
8
15
|
sticky
|
|
9
16
|
} = _ref;
|
|
10
|
-
return
|
|
11
|
-
className:
|
|
17
|
+
return _react.default.createElement("span", {
|
|
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]', {
|
|
12
19
|
'lw-bg-border-primary': emptyIndicator,
|
|
13
20
|
'lw-shadow-innerBorderBgColor': emptyIndicator && hovered,
|
|
14
21
|
'lw-bg-border-primary lw-font-semibold': hovered,
|
|
@@ -17,5 +24,5 @@ const TextCell = _ref => {
|
|
|
17
24
|
})
|
|
18
25
|
}, label);
|
|
19
26
|
};
|
|
20
|
-
|
|
27
|
+
exports.TextCell = TextCell;
|
|
21
28
|
//# sourceMappingURL=TextCell.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TextCell.js","names":["
|
|
1
|
+
{"version":3,"file":"TextCell.js","names":["_classnames","_interopRequireDefault","require","_react","e","__esModule","default","TextCell","_ref","label","emptyIndicator","hovered","sticky","createElement","className","classnames","exports"],"sources":["../../../../src/CurrencyCrossTableWidget/components/TextCell.tsx"],"sourcesContent":["import classnames from 'classnames';\nimport React from 'react';\n\nimport type { TextCellProps } from './types';\n\nconst TextCell = ({\n label,\n emptyIndicator,\n hovered,\n sticky,\n}: TextCellProps) => (\n <span\n className={classnames(\n '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 {\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 >\n {label}\n </span>\n);\n\nexport { TextCell };\n"],"mappings":";;;;;;AAAA,IAAAA,WAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,MAAA,GAAAF,sBAAA,CAAAC,OAAA;AAA0B,SAAAD,uBAAAG,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,CAAA;AAI1B,MAAMG,QAAQ,GAAGC,IAAA;EAAA,IAAC;IAChBC,KAAK;IACLC,cAAc;IACdC,OAAO;IACPC;EACa,CAAC,GAAAJ,IAAA;EAAA,OACdL,MAAA,CAAAG,OAAA,CAAAO,aAAA;IACEC,SAAS,EAAE,IAAAC,mBAAU,EACnB,oJAAoJ,EACpJ;MACE,sBAAsB,EAAEL,cAAc;MACtC,8BAA8B,EAAEA,cAAc,IAAIC,OAAO;MACzD,uCAAuC,EAAEA,OAAO;MAChD,6BAA6B,EAAEC,MAAM;MACrC,kBAAkB,EAAEA,MAAM,IAAI,CAACD;IACjC,CACF;EAAE,GAEDF,KACG,CAAC;AAAA,CACR;AAACO,OAAA,CAAAT,QAAA,GAAAA,QAAA","ignoreList":[]}
|
|
@@ -1,3 +1,28 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
var _CellWithData = require("./CellWithData");
|
|
7
|
+
Object.keys(_CellWithData).forEach(function (key) {
|
|
8
|
+
if (key === "default" || key === "__esModule") return;
|
|
9
|
+
if (key in exports && exports[key] === _CellWithData[key]) return;
|
|
10
|
+
Object.defineProperty(exports, key, {
|
|
11
|
+
enumerable: true,
|
|
12
|
+
get: function () {
|
|
13
|
+
return _CellWithData[key];
|
|
14
|
+
}
|
|
15
|
+
});
|
|
16
|
+
});
|
|
17
|
+
var _TextCell = require("./TextCell");
|
|
18
|
+
Object.keys(_TextCell).forEach(function (key) {
|
|
19
|
+
if (key === "default" || key === "__esModule") return;
|
|
20
|
+
if (key in exports && exports[key] === _TextCell[key]) return;
|
|
21
|
+
Object.defineProperty(exports, key, {
|
|
22
|
+
enumerable: true,
|
|
23
|
+
get: function () {
|
|
24
|
+
return _TextCell[key];
|
|
25
|
+
}
|
|
26
|
+
});
|
|
27
|
+
});
|
|
3
28
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":[],"sources":["../../../../src/CurrencyCrossTableWidget/components/index.ts"],"sourcesContent":["export * from './CellWithData';\nexport * from './TextCell';\n"],"mappings":"AAAA,
|
|
1
|
+
{"version":3,"file":"index.js","names":["_CellWithData","require","Object","keys","forEach","key","exports","defineProperty","enumerable","get","_TextCell"],"sources":["../../../../src/CurrencyCrossTableWidget/components/index.ts"],"sourcesContent":["export * from './CellWithData';\nexport * from './TextCell';\n"],"mappings":";;;;;AAAA,IAAAA,aAAA,GAAAC,OAAA;AAAAC,MAAA,CAAAC,IAAA,CAAAH,aAAA,EAAAI,OAAA,WAAAC,GAAA;EAAA,IAAAA,GAAA,kBAAAA,GAAA;EAAA,IAAAA,GAAA,IAAAC,OAAA,IAAAA,OAAA,CAAAD,GAAA,MAAAL,aAAA,CAAAK,GAAA;EAAAH,MAAA,CAAAK,cAAA,CAAAD,OAAA,EAAAD,GAAA;IAAAG,UAAA;IAAAC,GAAA,WAAAA,CAAA;MAAA,OAAAT,aAAA,CAAAK,GAAA;IAAA;EAAA;AAAA;AACA,IAAAK,SAAA,GAAAT,OAAA;AAAAC,MAAA,CAAAC,IAAA,CAAAO,SAAA,EAAAN,OAAA,WAAAC,GAAA;EAAA,IAAAA,GAAA,kBAAAA,GAAA;EAAA,IAAAA,GAAA,IAAAC,OAAA,IAAAA,OAAA,CAAAD,GAAA,MAAAK,SAAA,CAAAL,GAAA;EAAAH,MAAA,CAAAK,cAAA,CAAAD,OAAA,EAAAD,GAAA;IAAAG,UAAA;IAAAC,GAAA,WAAAA,CAAA;MAAA,OAAAC,SAAA,CAAAL,GAAA;IAAA;EAAA;AAAA","ignoreList":[]}
|
|
@@ -1,6 +1,11 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.MAJOR_CURRENCIES = exports.INSTRUMENT_TOOLTIP_ID = exports.CELL_LOADING_VALUE = exports.CELL_EMPTY_VALUE = void 0;
|
|
7
|
+
const MAJOR_CURRENCIES = exports.MAJOR_CURRENCIES = ['EUR', 'USD', 'JPY', 'GBP', 'CHF', 'AUD', 'CAD', 'NZD'];
|
|
8
|
+
const INSTRUMENT_TOOLTIP_ID = exports.INSTRUMENT_TOOLTIP_ID = 'instrument_tooltip_id';
|
|
9
|
+
const CELL_LOADING_VALUE = exports.CELL_LOADING_VALUE = '...';
|
|
10
|
+
const CELL_EMPTY_VALUE = exports.CELL_EMPTY_VALUE = '\u2014';
|
|
6
11
|
//# sourceMappingURL=constant.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"constant.js","names":["MAJOR_CURRENCIES","INSTRUMENT_TOOLTIP_ID","CELL_LOADING_VALUE","CELL_EMPTY_VALUE"],"sources":["../../../src/CurrencyCrossTableWidget/constant.ts"],"sourcesContent":["const MAJOR_CURRENCIES = [\n 'EUR',\n 'USD',\n 'JPY',\n 'GBP',\n 'CHF',\n 'AUD',\n 'CAD',\n 'NZD',\n];\n\nconst INSTRUMENT_TOOLTIP_ID = 'instrument_tooltip_id';\n\nconst CELL_LOADING_VALUE = '...';\n\nconst CELL_EMPTY_VALUE = '\\u2014';\n\nexport {\n CELL_EMPTY_VALUE,\n CELL_LOADING_VALUE,\n INSTRUMENT_TOOLTIP_ID,\n MAJOR_CURRENCIES,\n};\n"],"mappings":"AAAA,MAAMA,gBAAgB,GAAG,CACvB,KAAK,EACL,KAAK,EACL,KAAK,EACL,KAAK,EACL,KAAK,EACL,KAAK,EACL,KAAK,EACL,KAAK,CACN;AAED,
|
|
1
|
+
{"version":3,"file":"constant.js","names":["MAJOR_CURRENCIES","exports","INSTRUMENT_TOOLTIP_ID","CELL_LOADING_VALUE","CELL_EMPTY_VALUE"],"sources":["../../../src/CurrencyCrossTableWidget/constant.ts"],"sourcesContent":["const MAJOR_CURRENCIES = [\n 'EUR',\n 'USD',\n 'JPY',\n 'GBP',\n 'CHF',\n 'AUD',\n 'CAD',\n 'NZD',\n];\n\nconst INSTRUMENT_TOOLTIP_ID = 'instrument_tooltip_id';\n\nconst CELL_LOADING_VALUE = '...';\n\nconst CELL_EMPTY_VALUE = '\\u2014';\n\nexport {\n CELL_EMPTY_VALUE,\n CELL_LOADING_VALUE,\n INSTRUMENT_TOOLTIP_ID,\n MAJOR_CURRENCIES,\n};\n"],"mappings":";;;;;;AAAA,MAAMA,gBAAgB,GAAAC,OAAA,CAAAD,gBAAA,GAAG,CACvB,KAAK,EACL,KAAK,EACL,KAAK,EACL,KAAK,EACL,KAAK,EACL,KAAK,EACL,KAAK,EACL,KAAK,CACN;AAED,MAAME,qBAAqB,GAAAD,OAAA,CAAAC,qBAAA,GAAG,uBAAuB;AAErD,MAAMC,kBAAkB,GAAAF,OAAA,CAAAE,kBAAA,GAAG,KAAK;AAEhC,MAAMC,gBAAgB,GAAAH,OAAA,CAAAG,gBAAA,GAAG,QAAQ","ignoreList":[]}
|