@oanda/labs-currency-power-balance-widget 1.0.191 → 1.0.192
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 +1463 -38111
- package/dist/module/CurrencyPowerBalanceWidget/ChartWithData.js +28 -21
- package/dist/module/CurrencyPowerBalanceWidget/ChartWithData.js.map +1 -1
- package/dist/module/CurrencyPowerBalanceWidget/CurrencyPowerBalance.js +19 -12
- package/dist/module/CurrencyPowerBalanceWidget/CurrencyPowerBalance.js.map +1 -1
- package/dist/module/CurrencyPowerBalanceWidget/Main.js +27 -20
- package/dist/module/CurrencyPowerBalanceWidget/Main.js.map +1 -1
- package/dist/module/CurrencyPowerBalanceWidget/components/Chart/Chart.js +28 -20
- package/dist/module/CurrencyPowerBalanceWidget/components/Chart/Chart.js.map +1 -1
- package/dist/module/CurrencyPowerBalanceWidget/components/Chart/index.js +16 -1
- package/dist/module/CurrencyPowerBalanceWidget/components/Chart/index.js.map +1 -1
- package/dist/module/CurrencyPowerBalanceWidget/components/Chart/options/constants.js +33 -28
- package/dist/module/CurrencyPowerBalanceWidget/components/Chart/options/constants.js.map +1 -1
- package/dist/module/CurrencyPowerBalanceWidget/components/Chart/options/formatters.js +21 -11
- package/dist/module/CurrencyPowerBalanceWidget/components/Chart/options/formatters.js.map +1 -1
- package/dist/module/CurrencyPowerBalanceWidget/components/Chart/options/getOption.js +33 -27
- package/dist/module/CurrencyPowerBalanceWidget/components/Chart/options/getOption.js.map +1 -1
- package/dist/module/CurrencyPowerBalanceWidget/components/Chart/options/index.js +16 -1
- package/dist/module/CurrencyPowerBalanceWidget/components/Chart/options/index.js.map +1 -1
- package/dist/module/CurrencyPowerBalanceWidget/components/Chart/options/types.js +5 -1
- package/dist/module/CurrencyPowerBalanceWidget/components/Chart/options/utils.js +9 -3
- package/dist/module/CurrencyPowerBalanceWidget/components/Chart/options/utils.js.map +1 -1
- package/dist/module/CurrencyPowerBalanceWidget/components/Chart/types.js +5 -1
- package/dist/module/CurrencyPowerBalanceWidget/config.js +16 -11
- package/dist/module/CurrencyPowerBalanceWidget/config.js.map +1 -1
- package/dist/module/CurrencyPowerBalanceWidget/constants.js +7 -1
- package/dist/module/CurrencyPowerBalanceWidget/constants.js.map +1 -1
- package/dist/module/CurrencyPowerBalanceWidget/index.js +16 -1
- package/dist/module/CurrencyPowerBalanceWidget/index.js.map +1 -1
- package/dist/module/CurrencyPowerBalanceWidget/render.js +13 -10
- package/dist/module/CurrencyPowerBalanceWidget/render.js.map +1 -1
- package/dist/module/CurrencyPowerBalanceWidget/types.js +5 -1
- package/dist/module/gql/getCurrencyPowerBalance.js +8 -2
- package/dist/module/gql/getCurrencyPowerBalance.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/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/gql/getCurrencyPowerBalance.d.ts +1 -1
- package/package.json +8 -4
- package/tsconfig.types.json +2 -4
|
@@ -1,10 +1,17 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.ChartWithData = void 0;
|
|
7
|
+
var _client = require("@apollo/client");
|
|
8
|
+
var _labsWidgetCommon = require("@oanda/labs-widget-common");
|
|
9
|
+
var _monoI18n = require("@oanda/mono-i18n");
|
|
10
|
+
var _react = _interopRequireDefault(require("react"));
|
|
11
|
+
var _getCurrencyPowerBalance = require("../gql/getCurrencyPowerBalance");
|
|
12
|
+
var _Chart = require("./components/Chart");
|
|
13
|
+
var _constants = require("./constants");
|
|
14
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
8
15
|
const ChartWithData = _ref => {
|
|
9
16
|
let {
|
|
10
17
|
timeUnit,
|
|
@@ -12,40 +19,40 @@ const ChartWithData = _ref => {
|
|
|
12
19
|
} = _ref;
|
|
13
20
|
const {
|
|
14
21
|
size
|
|
15
|
-
} = useLayoutProvider();
|
|
16
|
-
const isDesktop = size === Size.DESKTOP;
|
|
22
|
+
} = (0, _labsWidgetCommon.useLayoutProvider)();
|
|
23
|
+
const isDesktop = size === _labsWidgetCommon.Size.DESKTOP;
|
|
17
24
|
const {
|
|
18
25
|
lang
|
|
19
|
-
} = useLocale();
|
|
26
|
+
} = (0, _monoI18n.useLocale)();
|
|
20
27
|
const {
|
|
21
28
|
loading,
|
|
22
29
|
data,
|
|
23
30
|
error
|
|
24
|
-
} = useQuery(getCurrencyPowerBalance, {
|
|
31
|
+
} = (0, _client.useQuery)(_getCurrencyPowerBalance.getCurrencyPowerBalance, {
|
|
25
32
|
variables: {
|
|
26
33
|
timeUnit
|
|
27
34
|
},
|
|
28
35
|
fetchPolicy: 'cache-and-network'
|
|
29
36
|
});
|
|
30
37
|
const showError = data?.currencyPowerBalance?.length === 0 || error || currencies && (currencies.length === 0 || currencies.length === 1);
|
|
31
|
-
return
|
|
38
|
+
return _react.default.createElement(_react.default.Fragment, null, loading && _react.default.createElement("div", {
|
|
32
39
|
className: "lw-mb-[50px] lw-flex lw-h-[375px] lw-w-full lw-items-center lw-border lw-border-solid lw-border-border-primary"
|
|
33
|
-
},
|
|
34
|
-
size: SpinnerSize.lg
|
|
35
|
-
})), !loading && !showError &&
|
|
40
|
+
}, _react.default.createElement(_labsWidgetCommon.Spinner, {
|
|
41
|
+
size: _labsWidgetCommon.SpinnerSize.lg
|
|
42
|
+
})), !loading && !showError && _react.default.createElement(_Chart.Chart, {
|
|
36
43
|
currencies: currencies,
|
|
37
44
|
timeUnit: timeUnit,
|
|
38
45
|
values: data?.currencyPowerBalance
|
|
39
|
-
}), !loading && showError &&
|
|
46
|
+
}), !loading && showError && _react.default.createElement("div", {
|
|
40
47
|
className: "lw-flex lw-h-[375px] lw-w-full lw-items-center lw-border lw-border-solid lw-border-border-primary"
|
|
41
|
-
},
|
|
42
|
-
id: CURRENCY_POWER_BALANCE_TOOLTIP_ID
|
|
43
|
-
}),
|
|
48
|
+
}, _react.default.createElement(_labsWidgetCommon.ChartError, null)), isDesktop && _react.default.createElement(_labsWidgetCommon.Tooltip, {
|
|
49
|
+
id: _constants.CURRENCY_POWER_BALANCE_TOOLTIP_ID
|
|
50
|
+
}), _react.default.createElement("div", {
|
|
44
51
|
className: "lw-mt-2 lw-h-8"
|
|
45
|
-
}, !loading && !showError &&
|
|
52
|
+
}, !loading && !showError && _react.default.createElement(_labsWidgetCommon.LastUpdated, {
|
|
46
53
|
labelCallback: lang,
|
|
47
54
|
timestamp: data?.currencyPowerBalance[0]?.updatedAt
|
|
48
55
|
})));
|
|
49
56
|
};
|
|
50
|
-
|
|
57
|
+
exports.ChartWithData = ChartWithData;
|
|
51
58
|
//# sourceMappingURL=ChartWithData.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ChartWithData.js","names":["
|
|
1
|
+
{"version":3,"file":"ChartWithData.js","names":["_client","require","_labsWidgetCommon","_monoI18n","_react","_interopRequireDefault","_getCurrencyPowerBalance","_Chart","_constants","e","__esModule","default","ChartWithData","_ref","timeUnit","currencies","size","useLayoutProvider","isDesktop","Size","DESKTOP","lang","useLocale","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","LastUpdated","labelCallback","timestamp","updatedAt","exports"],"sources":["../../../src/CurrencyPowerBalanceWidget/ChartWithData.tsx"],"sourcesContent":["import { useQuery } from '@apollo/client';\nimport {\n ChartError,\n LastUpdated,\n Size,\n Spinner,\n SpinnerSize,\n Tooltip,\n useLayoutProvider,\n} from '@oanda/labs-widget-common';\nimport { useLocale } from '@oanda/mono-i18n';\nimport React from 'react';\n\nimport { getCurrencyPowerBalance } from '../gql/getCurrencyPowerBalance';\nimport type {\n GetCurrencyPowerBalanceQuery,\n GetCurrencyPowerBalanceQueryVariables,\n} from '../gql/types/graphql';\nimport { Chart } from './components/Chart';\nimport { CURRENCY_POWER_BALANCE_TOOLTIP_ID } from './constants';\nimport type { ChartWithDataProps } from './types';\n\nconst ChartWithData = ({ timeUnit, currencies }: ChartWithDataProps) => {\n const { size } = useLayoutProvider();\n const isDesktop = size === Size.DESKTOP;\n const { lang } = useLocale();\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 =\n data?.currencyPowerBalance?.length === 0 ||\n error ||\n (currencies && (currencies.length === 0 || currencies.length === 1));\n\n return (\n <>\n {loading && (\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\n currencies={currencies}\n timeUnit={timeUnit}\n values={data?.currencyPowerBalance!}\n />\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 <div className=\"lw-mt-2 lw-h-8\">\n {!loading && !showError && (\n <LastUpdated\n labelCallback={lang}\n timestamp={data?.currencyPowerBalance![0]?.updatedAt}\n />\n )}\n </div>\n </>\n );\n};\n\nexport { ChartWithData };\n"],"mappings":";;;;;;AAAA,IAAAA,OAAA,GAAAC,OAAA;AACA,IAAAC,iBAAA,GAAAD,OAAA;AASA,IAAAE,SAAA,GAAAF,OAAA;AACA,IAAAG,MAAA,GAAAC,sBAAA,CAAAJ,OAAA;AAEA,IAAAK,wBAAA,GAAAL,OAAA;AAKA,IAAAM,MAAA,GAAAN,OAAA;AACA,IAAAO,UAAA,GAAAP,OAAA;AAAgE,SAAAI,uBAAAI,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,CAAA;AAGhE,MAAMG,aAAa,GAAGC,IAAA,IAAkD;EAAA,IAAjD;IAAEC,QAAQ;IAAEC;EAA+B,CAAC,GAAAF,IAAA;EACjE,MAAM;IAAEG;EAAK,CAAC,GAAG,IAAAC,mCAAiB,EAAC,CAAC;EACpC,MAAMC,SAAS,GAAGF,IAAI,KAAKG,sBAAI,CAACC,OAAO;EACvC,MAAM;IAAEC;EAAK,CAAC,GAAG,IAAAC,mBAAS,EAAC,CAAC;EAC5B,MAAM;IAAEC,OAAO;IAAEC,IAAI;IAAEC;EAAM,CAAC,GAAG,IAAAC,gBAAQ,EAGvCC,gDAAuB,EAAE;IACzBC,SAAS,EAAE;MACTd;IACF,CAAC;IACDe,WAAW,EAAE;EACf,CAAC,CAAC;EAEF,MAAMC,SAAS,GACbN,IAAI,EAAEO,oBAAoB,EAAEC,MAAM,KAAK,CAAC,IACxCP,KAAK,IACJV,UAAU,KAAKA,UAAU,CAACiB,MAAM,KAAK,CAAC,IAAIjB,UAAU,CAACiB,MAAM,KAAK,CAAC,CAAE;EAEtE,OACE5B,MAAA,CAAAO,OAAA,CAAAsB,aAAA,CAAA7B,MAAA,CAAAO,OAAA,CAAAuB,QAAA,Q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.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.CurrencyPowerBalance = void 0;
|
|
7
|
+
var _client = require("@apollo/client");
|
|
8
|
+
var _labsWidgetCommon = require("@oanda/labs-widget-common");
|
|
9
|
+
var _react = _interopRequireDefault(require("react"));
|
|
10
|
+
var _translations = require("../translations");
|
|
11
|
+
var _Main = require("./Main");
|
|
12
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
6
13
|
const CurrencyPowerBalance = _ref => {
|
|
7
14
|
let {
|
|
8
15
|
graphqlUrl,
|
|
@@ -13,23 +20,23 @@ const CurrencyPowerBalance = _ref => {
|
|
|
13
20
|
isParamError,
|
|
14
21
|
logoLink
|
|
15
22
|
} = _ref;
|
|
16
|
-
const client = new ApolloClient({
|
|
23
|
+
const client = new _client.ApolloClient({
|
|
17
24
|
uri: graphqlUrl,
|
|
18
|
-
cache: new InMemoryCache()
|
|
25
|
+
cache: new _client.InMemoryCache()
|
|
19
26
|
});
|
|
20
|
-
return
|
|
27
|
+
return _react.default.createElement(_labsWidgetCommon.WidgetProvider, {
|
|
21
28
|
client: client,
|
|
22
29
|
locale: locale,
|
|
23
30
|
theme: theme,
|
|
24
|
-
translations: translations
|
|
25
|
-
},
|
|
31
|
+
translations: _translations.translations
|
|
32
|
+
}, _react.default.createElement(_labsWidgetCommon.WidgetWrapper, {
|
|
26
33
|
isParamError: isParamError,
|
|
27
34
|
linkArea: "logo",
|
|
28
35
|
logoLink: logoLink
|
|
29
|
-
},
|
|
36
|
+
}, _react.default.createElement(_Main.Main, {
|
|
30
37
|
currencies: currencies,
|
|
31
38
|
timeUnit: timeUnit
|
|
32
39
|
})));
|
|
33
40
|
};
|
|
34
|
-
|
|
41
|
+
exports.CurrencyPowerBalance = CurrencyPowerBalance;
|
|
35
42
|
//# sourceMappingURL=CurrencyPowerBalance.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CurrencyPowerBalance.js","names":["
|
|
1
|
+
{"version":3,"file":"CurrencyPowerBalance.js","names":["_client","require","_labsWidgetCommon","_react","_interopRequireDefault","_translations","_Main","e","__esModule","default","CurrencyPowerBalance","_ref","graphqlUrl","theme","locale","timeUnit","currencies","isParamError","logoLink","client","ApolloClient","uri","cache","InMemoryCache","createElement","WidgetProvider","translations","WidgetWrapper","linkArea","Main","exports"],"sources":["../../../src/CurrencyPowerBalanceWidget/CurrencyPowerBalance.tsx"],"sourcesContent":["import { ApolloClient, InMemoryCache } from '@apollo/client';\nimport { WidgetProvider, WidgetWrapper } from '@oanda/labs-widget-common';\nimport React from 'react';\n\nimport { translations } from '../translations';\nimport { Main } from './Main';\nimport type { CurrencyPowerBalanceConfig } from './types';\n\nconst CurrencyPowerBalance = ({\n graphqlUrl,\n theme,\n locale,\n timeUnit,\n currencies,\n isParamError,\n logoLink,\n}: CurrencyPowerBalanceConfig) => {\n const client = new ApolloClient({\n uri: graphqlUrl,\n cache: new InMemoryCache(),\n });\n\n return (\n <WidgetProvider\n client={client}\n locale={locale}\n theme={theme}\n translations={translations}\n >\n <WidgetWrapper\n isParamError={isParamError}\n linkArea=\"logo\"\n logoLink={logoLink}\n >\n <Main currencies={currencies} timeUnit={timeUnit} />\n </WidgetWrapper>\n </WidgetProvider>\n );\n};\n\nexport { CurrencyPowerBalance };\n"],"mappings":";;;;;;AAAA,IAAAA,OAAA,GAAAC,OAAA;AACA,IAAAC,iBAAA,GAAAD,OAAA;AACA,IAAAE,MAAA,GAAAC,sBAAA,CAAAH,OAAA;AAEA,IAAAI,aAAA,GAAAJ,OAAA;AACA,IAAAK,KAAA,GAAAL,OAAA;AAA8B,SAAAG,uBAAAG,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,CAAA;AAG9B,MAAMG,oBAAoB,GAAGC,IAAA,IAQK;EAAA,IARJ;IAC5BC,UAAU;IACVC,KAAK;IACLC,MAAM;IACNC,QAAQ;IACRC,UAAU;IACVC,YAAY;IACZC;EAC0B,CAAC,GAAAP,IAAA;EAC3B,MAAMQ,MAAM,GAAG,IAAIC,oBAAY,CAAC;IAC9BC,GAAG,EAAET,UAAU;IACfU,KAAK,EAAE,IAAIC,qBAAa,CAAC;EAC3B,CAAC,CAAC;EAEF,OACEpB,MAAA,CAAAM,OAAA,CAAAe,aAAA,CAACtB,iBAAA,CAAAuB,cAAc;IACbN,MAAM,EAAEA,MAAO;IACfL,MAAM,EAAEA,MAAO;IACfD,KAAK,EAAEA,KAAM;IACba,YAAY,EAAEA;EAAa,GAE3BvB,MAAA,CAAAM,OAAA,CAAAe,aAAA,CAACtB,iBAAA,CAAAyB,aAAa;IACZV,YAAY,EAAEA,YAAa;IAC3BW,QAAQ,EAAC,MAAM;IACfV,QAAQ,EAAEA;EAAS,GAEnBf,MAAA,CAAAM,OAAA,CAAAe,aAAA,CAAClB,KAAA,CAAAuB,IAAI;IAACb,UAAU,EAAEA,UAAW;IAACD,QAAQ,EAAEA;EAAS,CAAE,CACtC,CACD,CAAC;AAErB,CAAC;AAACe,OAAA,CAAApB,oBAAA,GAAAA,oBAAA","ignoreList":[]}
|
|
@@ -1,10 +1,17 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
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 _monoI18n = require("@oanda/mono-i18n");
|
|
9
|
+
var _react = _interopRequireWildcard(require("react"));
|
|
10
|
+
var _graphql = require("../gql/types/graphql");
|
|
11
|
+
var _ChartWithData = require("./ChartWithData");
|
|
12
|
+
var _config = require("./config");
|
|
13
|
+
var _constants = require("./constants");
|
|
14
|
+
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); }
|
|
8
15
|
const Main = _ref => {
|
|
9
16
|
let {
|
|
10
17
|
timeUnit,
|
|
@@ -12,15 +19,15 @@ const Main = _ref => {
|
|
|
12
19
|
} = _ref;
|
|
13
20
|
const {
|
|
14
21
|
size
|
|
15
|
-
} = useLayoutProvider();
|
|
22
|
+
} = (0, _labsWidgetCommon.useLayoutProvider)();
|
|
16
23
|
const {
|
|
17
24
|
lang
|
|
18
|
-
} = useLocale();
|
|
19
|
-
const [selectedTimeUnit, setSelectedTimeUnit] = useState(timeUnit || CurrencyPowerBalanceTimeUnit.CurrentDay);
|
|
20
|
-
return
|
|
25
|
+
} = (0, _monoI18n.useLocale)();
|
|
26
|
+
const [selectedTimeUnit, setSelectedTimeUnit] = (0, _react.useState)(timeUnit || _graphql.CurrencyPowerBalanceTimeUnit.CurrentDay);
|
|
27
|
+
return _react.default.createElement(_react.default.Fragment, null, size && _react.default.createElement("div", {
|
|
21
28
|
className: "lw-flex lw-flex-col lw-text-sm lw-tracking-normal",
|
|
22
29
|
"data-testid": "currency-power-balance-wrapper"
|
|
23
|
-
}, timeUnit && currencies ?
|
|
30
|
+
}, timeUnit && currencies ? _react.default.createElement(_react.default.Fragment, null, _config.timeUnitConfig.filter(_ref2 => {
|
|
24
31
|
let {
|
|
25
32
|
value
|
|
26
33
|
} = _ref2;
|
|
@@ -30,22 +37,22 @@ const Main = _ref => {
|
|
|
30
37
|
tooltipLabel,
|
|
31
38
|
label
|
|
32
39
|
} = _ref3;
|
|
33
|
-
return
|
|
40
|
+
return _react.default.createElement("div", {
|
|
34
41
|
key: label,
|
|
35
42
|
className: "lw-mb-6 lw-flex lw-justify-center lw-font-sans lw-text-lg lw-font-bold",
|
|
36
43
|
"data-testid": "time-unit-label"
|
|
37
|
-
}, tooltipLabel ?
|
|
44
|
+
}, tooltipLabel ? _react.default.createElement("span", null, `${lang(tooltipLabel.translationKey, {
|
|
38
45
|
count: tooltipLabel.count
|
|
39
|
-
})}`) :
|
|
40
|
-
})) :
|
|
46
|
+
})}`) : _react.default.createElement("span", null, `${lang(label)}`));
|
|
47
|
+
})) : _react.default.createElement(_labsWidgetCommon.TimeUnitSwitch, {
|
|
41
48
|
callback: setSelectedTimeUnit,
|
|
42
|
-
options: timeUnitConfig,
|
|
49
|
+
options: _config.timeUnitConfig,
|
|
43
50
|
selected: selectedTimeUnit,
|
|
44
|
-
tooltipId: CURRENCY_POWER_BALANCE_TOOLTIP_ID
|
|
45
|
-
}),
|
|
51
|
+
tooltipId: _constants.CURRENCY_POWER_BALANCE_TOOLTIP_ID
|
|
52
|
+
}), _react.default.createElement(_ChartWithData.ChartWithData, {
|
|
46
53
|
currencies: timeUnit && currencies,
|
|
47
54
|
timeUnit: selectedTimeUnit
|
|
48
55
|
})));
|
|
49
56
|
};
|
|
50
|
-
|
|
57
|
+
exports.Main = Main;
|
|
51
58
|
//# sourceMappingURL=Main.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Main.js","names":["
|
|
1
|
+
{"version":3,"file":"Main.js","names":["_labsWidgetCommon","require","_monoI18n","_react","_interopRequireWildcard","_graphql","_ChartWithData","_config","_constants","e","t","WeakMap","r","n","__esModule","o","i","f","__proto__","default","has","get","set","hasOwnProperty","call","Object","defineProperty","getOwnPropertyDescriptor","Main","_ref","timeUnit","currencies","size","useLayoutProvider","lang","useLocale","selectedTimeUnit","setSelectedTimeUnit","useState","CurrencyPowerBalanceTimeUnit","CurrentDay","createElement","Fragment","className","timeUnitConfig","filter","_ref2","value","map","_ref3","tooltipLabel","label","key","translationKey","count","TimeUnitSwitch","callback","options","selected","tooltipId","CURRENCY_POWER_BALANCE_TOOLTIP_ID","ChartWithData","exports"],"sources":["../../../src/CurrencyPowerBalanceWidget/Main.tsx"],"sourcesContent":["import { TimeUnitSwitch, useLayoutProvider } from '@oanda/labs-widget-common';\nimport { useLocale } from '@oanda/mono-i18n';\nimport React, { useState } from 'react';\n\nimport { CurrencyPowerBalanceTimeUnit } from '../gql/types/graphql';\nimport { ChartWithData } from './ChartWithData';\nimport { timeUnitConfig } from './config';\nimport { CURRENCY_POWER_BALANCE_TOOLTIP_ID } from './constants';\nimport type { MainProps } from './types';\n\nconst Main = ({ timeUnit, currencies }: MainProps) => {\n const { size } = useLayoutProvider();\n const { lang } = useLocale();\n const [selectedTimeUnit, setSelectedTimeUnit] = useState(\n timeUnit || CurrencyPowerBalanceTimeUnit.CurrentDay\n );\n return (\n <>\n {size && (\n <div\n className=\"lw-flex lw-flex-col lw-text-sm lw-tracking-normal\"\n data-testid=\"currency-power-balance-wrapper\"\n >\n {timeUnit && currencies ? (\n <>\n {timeUnitConfig\n .filter(({ value }) => value === selectedTimeUnit)\n .map(({ tooltipLabel, label }) => (\n <div\n key={label}\n className=\"lw-mb-6 lw-flex lw-justify-center lw-font-sans lw-text-lg lw-font-bold\"\n data-testid=\"time-unit-label\"\n >\n {tooltipLabel ? (\n <span>{`${lang(tooltipLabel!.translationKey, { count: tooltipLabel!.count })}`}</span>\n ) : (\n <span>{`${lang(label)}`}</span>\n )}\n </div>\n ))}\n </>\n ) : (\n <TimeUnitSwitch<CurrencyPowerBalanceTimeUnit>\n callback={setSelectedTimeUnit}\n options={timeUnitConfig}\n selected={selectedTimeUnit}\n tooltipId={CURRENCY_POWER_BALANCE_TOOLTIP_ID}\n />\n )}\n <ChartWithData\n currencies={timeUnit && currencies}\n timeUnit={selectedTimeUnit}\n />\n </div>\n )}\n </>\n );\n};\n\nexport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,CAE7B,CAAC;EAAA,CACP,CACH,CAAC,GAEHhD,MAAA,CAAAgB,OAAA,CAAAsB,aAAA,CAACzC,iBAAA,CAAAuD,cAAc;IACbC,QAAQ,EAAEnB,mBAAoB;IAC9BoB,OAAO,EAAEb,sBAAe;IACxBc,QAAQ,EAAEtB,gBAAiB;IAC3BuB,SAAS,EAAEC;EAAkC,CAC9C,CACF,EACDzD,MAAA,CAAAgB,OAAA,CAAAsB,aAAA,CAACnC,cAAA,CAAAuD,aAAa;IACZ9B,UAAU,EAAED,QAAQ,IAAIC,UAAW;IACnCD,QAAQ,EAAEM;EAAiB,CAC5B,CACE,CAEP,CAAC;AAEP,CAAC;AAAC0B,OAAA,CAAAlC,IAAA,GAAAA,IAAA","ignoreList":[]}
|
|
@@ -1,15 +1,23 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
echarts
|
|
12
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.Chart = void 0;
|
|
7
|
+
var _labsWidgetCommon = require("@oanda/labs-widget-common");
|
|
8
|
+
var _monoI18n = require("@oanda/mono-i18n");
|
|
9
|
+
var _charts = require("echarts/charts");
|
|
10
|
+
var _components = require("echarts/components");
|
|
11
|
+
var echarts = _interopRequireWildcard(require("echarts/core"));
|
|
12
|
+
var _renderers = require("echarts/renderers");
|
|
13
|
+
var _react = _interopRequireDefault(require("react"));
|
|
14
|
+
var _options = require("./options");
|
|
15
|
+
var _constants = require("./options/constants");
|
|
16
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
17
|
+
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); }
|
|
18
|
+
echarts.use([_components.GridSimpleComponent, _components.GraphicComponent, _components.TooltipComponent, _components.LegendPlainComponent, _charts.LineChart, _renderers.CanvasRenderer, _components.MarkLineComponent]);
|
|
19
|
+
echarts.registerTheme('dark_theme', (0, _labsWidgetCommon.getChartTheme)(_labsWidgetCommon.Theme.Dark));
|
|
20
|
+
echarts.registerTheme('light_theme', (0, _labsWidgetCommon.getChartTheme)(_labsWidgetCommon.Theme.Light));
|
|
13
21
|
const Chart = _ref => {
|
|
14
22
|
let {
|
|
15
23
|
values,
|
|
@@ -18,25 +26,25 @@ const Chart = _ref => {
|
|
|
18
26
|
} = _ref;
|
|
19
27
|
const {
|
|
20
28
|
lang
|
|
21
|
-
} = useLocale();
|
|
29
|
+
} = (0, _monoI18n.useLocale)();
|
|
22
30
|
const {
|
|
23
31
|
isDark,
|
|
24
32
|
size
|
|
25
|
-
} = useLayoutProvider();
|
|
26
|
-
const isDesktop = size === Size.DESKTOP;
|
|
27
|
-
const isMobile = size === Size.MOBILE;
|
|
33
|
+
} = (0, _labsWidgetCommon.useLayoutProvider)();
|
|
34
|
+
const isDesktop = size === _labsWidgetCommon.Size.DESKTOP;
|
|
35
|
+
const isMobile = size === _labsWidgetCommon.Size.MOBILE;
|
|
28
36
|
const chartData = currencies ? values.filter(_ref2 => {
|
|
29
37
|
let {
|
|
30
38
|
currency
|
|
31
39
|
} = _ref2;
|
|
32
40
|
return currencies.includes(currency);
|
|
33
41
|
}) : values;
|
|
34
|
-
return
|
|
35
|
-
chartHeight: CHART_HEIGHT,
|
|
42
|
+
return _react.default.createElement(_labsWidgetCommon.BaseChart, {
|
|
43
|
+
chartHeight: _constants.CHART_HEIGHT,
|
|
36
44
|
echarts: echarts,
|
|
37
45
|
isDark: isDark,
|
|
38
|
-
option: getOption(chartData, timeUnit, isDark, isDesktop, isMobile, lang)
|
|
46
|
+
option: (0, _options.getOption)(chartData, timeUnit, isDark, isDesktop, isMobile, lang)
|
|
39
47
|
});
|
|
40
48
|
};
|
|
41
|
-
|
|
49
|
+
exports.Chart = Chart;
|
|
42
50
|
//# sourceMappingURL=Chart.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Chart.js","names":["
|
|
1
|
+
{"version":3,"file":"Chart.js","names":["_labsWidgetCommon","require","_monoI18n","_charts","_components","echarts","_interopRequireWildcard","_renderers","_react","_interopRequireDefault","_options","_constants","e","__esModule","default","t","WeakMap","r","n","o","i","f","__proto__","has","get","set","hasOwnProperty","call","Object","defineProperty","getOwnPropertyDescriptor","use","GridSimpleComponent","GraphicComponent","TooltipComponent","LegendPlainComponent","LineChart","CanvasRenderer","MarkLineComponent","registerTheme","getChartTheme","Theme","Dark","Light","Chart","_ref","values","timeUnit","currencies","lang","useLocale","isDark","size","useLayoutProvider","isDesktop","Size","DESKTOP","isMobile","MOBILE","chartData","filter","_ref2","currency","includes","createElement","BaseChart","chartHeight","CHART_HEIGHT","option","getOption","exports"],"sources":["../../../../../src/CurrencyPowerBalanceWidget/components/Chart/Chart.tsx"],"sourcesContent":["import {\n BaseChart,\n getChartTheme,\n Size,\n Theme,\n useLayoutProvider,\n} from '@oanda/labs-widget-common';\nimport { useLocale } from '@oanda/mono-i18n';\nimport { LineChart } from 'echarts/charts';\nimport {\n GraphicComponent,\n GridSimpleComponent,\n LegendPlainComponent,\n MarkLineComponent,\n TooltipComponent,\n} from 'echarts/components';\nimport * as echarts from 'echarts/core';\nimport { CanvasRenderer } from 'echarts/renderers';\nimport React from 'react';\n\nimport { getOption } from './options';\nimport { CHART_HEIGHT } from './options/constants';\nimport type { ChartProps } from './types';\n\necharts.use([\n GridSimpleComponent,\n GraphicComponent,\n TooltipComponent,\n LegendPlainComponent,\n LineChart,\n CanvasRenderer,\n MarkLineComponent,\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 { lang } = useLocale();\n const { isDark, size } = useLayoutProvider();\n const isDesktop = size === Size.DESKTOP;\n const isMobile = size === Size.MOBILE;\n\n const chartData = currencies\n ? values.filter(({ currency }) => currencies.includes(currency))\n : values;\n\n return (\n <BaseChart\n chartHeight={CHART_HEIGHT}\n echarts={echarts}\n isDark={isDark}\n option={getOption(chartData, timeUnit, isDark, isDesktop, isMobile, lang)}\n />\n );\n};\n\nexport { Chart };\n"],"mappings":";;;;;;AAAA,IAAAA,iBAAA,GAAAC,OAAA;AAOA,IAAAC,SAAA,GAAAD,OAAA;AACA,IAAAE,OAAA,GAAAF,OAAA;AACA,IAAAG,WAAA,GAAAH,OAAA;AAOA,IAAAI,OAAA,GAAAC,uBAAA,CAAAL,OAAA;AACA,IAAAM,UAAA,GAAAN,OAAA;AACA,IAAAO,MAAA,GAAAC,sBAAA,CAAAR,OAAA;AAEA,IAAAS,QAAA,GAAAT,OAAA;AACA,IAAAU,UAAA,GAAAV,OAAA;AAAmD,SAAAQ,uBAAAG,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,CAAA;AAAA,SAAAN,wBAAAM,CAAA,EAAAG,CAAA,6BAAAC,OAAA,MAAAC,CAAA,OAAAD,OAAA,IAAAE,CAAA,OAAAF,OAAA,YAAAV,uBAAA,YAAAA,CAAAM,CAAA,EAAAG,CAAA,SAAAA,CAAA,IAAAH,CAAA,IAAAA,CAAA,CAAAC,UAAA,SAAAD,CAAA,MAAAO,CAAA,EAAAC,CAAA,EAAAC,CAAA,KAAAC,SAAA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C;EAAK,CAAC,GAAG,IAAAC,mCAAiB,EAAC,CAAC;EAC5C,MAAMC,SAAS,GAAGF,IAAI,KAAKG,sBAAI,CAACC,OAAO;EACvC,MAAMC,QAAQ,GAAGL,IAAI,KAAKG,sBAAI,CAACG,MAAM;EAErC,MAAMC,SAAS,GAAGX,UAAU,GACxBF,MAAM,CAACc,MAAM,CAACC,KAAA;IAAA,IAAC;MAAEC;IAAS,CAAC,GAAAD,KAAA;IAAA,OAAKb,UAAU,CAACe,QAAQ,CAACD,QAAQ,CAAC;EAAA,EAAC,GAC9DhB,MAAM;EAEV,OACEtC,MAAA,CAAAM,OAAA,CAAAkD,aAAA,CAAChE,iBAAA,CAAAiE,SAAS;IACRC,WAAW,EAAEC,uBAAa;IAC1B9D,OAAO,EAAEA,OAAQ;IACjB8C,MAAM,EAAEA,MAAO;IACfiB,MAAM,EAAE,IAAAC,kBAAS,EAACV,SAAS,EAAEZ,QAAQ,EAAEI,MAAM,EAAEG,SAAS,EAAEG,QAAQ,EAAER,IAAI;EAAE,CAC3E,CAAC;AAEN,CAAC;AAACqB,OAAA,CAAA1B,KAAA,GAAAA,KAAA","ignoreList":[]}
|
|
@@ -1,2 +1,17 @@
|
|
|
1
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
var _Chart = require("./Chart");
|
|
7
|
+
Object.keys(_Chart).forEach(function (key) {
|
|
8
|
+
if (key === "default" || key === "__esModule") return;
|
|
9
|
+
if (key in exports && exports[key] === _Chart[key]) return;
|
|
10
|
+
Object.defineProperty(exports, key, {
|
|
11
|
+
enumerable: true,
|
|
12
|
+
get: function () {
|
|
13
|
+
return _Chart[key];
|
|
14
|
+
}
|
|
15
|
+
});
|
|
16
|
+
});
|
|
2
17
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":[],"sources":["../../../../../src/CurrencyPowerBalanceWidget/components/Chart/index.ts"],"sourcesContent":["export * from './Chart';\n"],"mappings":"AAAA,
|
|
1
|
+
{"version":3,"file":"index.js","names":["_Chart","require","Object","keys","forEach","key","exports","defineProperty","enumerable","get"],"sources":["../../../../../src/CurrencyPowerBalanceWidget/components/Chart/index.ts"],"sourcesContent":["export * from './Chart';\n"],"mappings":";;;;;AAAA,IAAAA,MAAA,GAAAC,OAAA;AAAAC,MAAA,CAAAC,IAAA,CAAAH,MAAA,EAAAI,OAAA,WAAAC,GAAA;EAAA,IAAAA,GAAA,kBAAAA,GAAA;EAAA,IAAAA,GAAA,IAAAC,OAAA,IAAAA,OAAA,CAAAD,GAAA,MAAAL,MAAA,CAAAK,GAAA;EAAAH,MAAA,CAAAK,cAAA,CAAAD,OAAA,EAAAD,GAAA;IAAAG,UAAA;IAAAC,GAAA,WAAAA,CAAA;MAAA,OAAAT,MAAA,CAAAK,GAAA;IAAA;EAAA;AAAA","ignoreList":[]}
|
|
@@ -1,31 +1,36 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
const
|
|
10
|
-
const
|
|
11
|
-
const
|
|
12
|
-
const
|
|
13
|
-
const
|
|
14
|
-
const
|
|
15
|
-
const
|
|
16
|
-
const
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.Y_LABEL_SIZE_MOBILE = exports.Y_LABEL_SIZE = exports.X_LABEL_SIZE_MOBILE = exports.X_LABEL_SIZE = exports.WEEKEND_DURATION = exports.VERTICAL_LINE_COUNT = exports.TOOLTIP_LINE_COLOR_CONFIG = exports.LEGEND_HEIGHT_MOBILE = exports.LEGEND_HEIGHT = exports.CURRENCIES_ORDER = exports.COLOR_CONFIG = exports.CHART_WIDTH = exports.CHART_HEIGHT = exports.CANDLE_NUMBER_HOUR = exports.CANDLE_MINUTE = void 0;
|
|
7
|
+
var _labsWidgetCommon = require("@oanda/labs-widget-common");
|
|
8
|
+
var _graphql = require("../../../../gql/types/graphql");
|
|
9
|
+
const WEEKEND_DURATION = exports.WEEKEND_DURATION = 172800000;
|
|
10
|
+
const X_LABEL_SIZE = exports.X_LABEL_SIZE = 90;
|
|
11
|
+
const X_LABEL_SIZE_MOBILE = exports.X_LABEL_SIZE_MOBILE = 110;
|
|
12
|
+
const Y_LABEL_SIZE_MOBILE = exports.Y_LABEL_SIZE_MOBILE = 35;
|
|
13
|
+
const Y_LABEL_SIZE = exports.Y_LABEL_SIZE = 45;
|
|
14
|
+
const CHART_WIDTH = exports.CHART_WIDTH = 9999;
|
|
15
|
+
const CHART_HEIGHT = exports.CHART_HEIGHT = 425;
|
|
16
|
+
const LEGEND_HEIGHT = exports.LEGEND_HEIGHT = 50;
|
|
17
|
+
const LEGEND_HEIGHT_MOBILE = exports.LEGEND_HEIGHT_MOBILE = 70;
|
|
18
|
+
const VERTICAL_LINE_COUNT = exports.VERTICAL_LINE_COUNT = 10;
|
|
19
|
+
const CANDLE_NUMBER_HOUR = exports.CANDLE_NUMBER_HOUR = 12;
|
|
20
|
+
const CANDLE_MINUTE = exports.CANDLE_MINUTE = 5;
|
|
21
|
+
const CURRENCIES_ORDER = exports.CURRENCIES_ORDER = [_graphql.CurrencyName.Usd, _graphql.CurrencyName.Eur, _graphql.CurrencyName.Gbp, _graphql.CurrencyName.Cad, _graphql.CurrencyName.Aud, _graphql.CurrencyName.Chf, _graphql.CurrencyName.Jpy, _graphql.CurrencyName.Nzd];
|
|
22
|
+
const COLOR_CONFIG = exports.COLOR_CONFIG = {
|
|
23
|
+
USD: _labsWidgetCommon.colorPalette.greenLight,
|
|
24
|
+
EUR: _labsWidgetCommon.colorPalette.turquoiseLight,
|
|
25
|
+
GBP: _labsWidgetCommon.colorPalette.violetLight,
|
|
26
|
+
JPY: _labsWidgetCommon.colorPalette.raspberryLight,
|
|
27
|
+
CHF: _labsWidgetCommon.colorPalette.bottleGreenLight75,
|
|
28
|
+
AUD: _labsWidgetCommon.colorPalette.orange,
|
|
29
|
+
CAD: _labsWidgetCommon.colorPalette.midnight75Lighter,
|
|
30
|
+
NZD: _labsWidgetCommon.colorPalette.gold
|
|
25
31
|
};
|
|
26
|
-
const TOOLTIP_LINE_COLOR_CONFIG = {
|
|
27
|
-
DARK: colorPalette.orange,
|
|
28
|
-
LIGHT: colorPalette.bottleGreenDark
|
|
32
|
+
const TOOLTIP_LINE_COLOR_CONFIG = exports.TOOLTIP_LINE_COLOR_CONFIG = {
|
|
33
|
+
DARK: _labsWidgetCommon.colorPalette.orange,
|
|
34
|
+
LIGHT: _labsWidgetCommon.colorPalette.bottleGreenDark
|
|
29
35
|
};
|
|
30
|
-
export { CANDLE_MINUTE, CANDLE_NUMBER_HOUR, CHART_HEIGHT, CHART_WIDTH, COLOR_CONFIG, CURRENCIES_ORDER, LEGEND_HEIGHT, LEGEND_HEIGHT_MOBILE, TOOLTIP_LINE_COLOR_CONFIG, VERTICAL_LINE_COUNT, WEEKEND_DURATION, X_LABEL_SIZE, X_LABEL_SIZE_MOBILE, Y_LABEL_SIZE, Y_LABEL_SIZE_MOBILE };
|
|
31
36
|
//# sourceMappingURL=constants.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"constants.js","names":["
|
|
1
|
+
{"version":3,"file":"constants.js","names":["_labsWidgetCommon","require","_graphql","WEEKEND_DURATION","exports","X_LABEL_SIZE","X_LABEL_SIZE_MOBILE","Y_LABEL_SIZE_MOBILE","Y_LABEL_SIZE","CHART_WIDTH","CHART_HEIGHT","LEGEND_HEIGHT","LEGEND_HEIGHT_MOBILE","VERTICAL_LINE_COUNT","CANDLE_NUMBER_HOUR","CANDLE_MINUTE","CURRENCIES_ORDER","CurrencyName","Usd","Eur","Gbp","Cad","Aud","Chf","Jpy","Nzd","COLOR_CONFIG","USD","colorPalette","greenLight","EUR","turquoiseLight","GBP","violetLight","JPY","raspberryLight","CHF","bottleGreenLight75","AUD","orange","CAD","midnight75Lighter","NZD","gold","TOOLTIP_LINE_COLOR_CONFIG","DARK","LIGHT","bottleGreenDark"],"sources":["../../../../../../src/CurrencyPowerBalanceWidget/components/Chart/options/constants.ts"],"sourcesContent":["import { colorPalette } from '@oanda/labs-widget-common';\n\nimport { CurrencyName } from '../../../../gql/types/graphql';\n\nconst WEEKEND_DURATION = 172800000;\n\nconst X_LABEL_SIZE = 90;\nconst X_LABEL_SIZE_MOBILE = 110;\nconst Y_LABEL_SIZE_MOBILE = 35;\nconst Y_LABEL_SIZE = 45;\nconst CHART_WIDTH = 9999;\nconst CHART_HEIGHT = 425;\nconst LEGEND_HEIGHT = 50;\nconst LEGEND_HEIGHT_MOBILE = 70;\nconst VERTICAL_LINE_COUNT = 10;\nconst CANDLE_NUMBER_HOUR = 12;\nconst CANDLE_MINUTE = 5;\n\nconst CURRENCIES_ORDER: CurrencyName[] = [\n CurrencyName.Usd,\n CurrencyName.Eur,\n CurrencyName.Gbp,\n CurrencyName.Cad,\n CurrencyName.Aud,\n CurrencyName.Chf,\n CurrencyName.Jpy,\n CurrencyName.Nzd,\n];\n\nconst COLOR_CONFIG = {\n USD: colorPalette.greenLight,\n EUR: colorPalette.turquoiseLight,\n GBP: colorPalette.violetLight,\n JPY: colorPalette.raspberryLight,\n CHF: colorPalette.bottleGreenLight75,\n AUD: colorPalette.orange,\n CAD: colorPalette.midnight75Lighter,\n NZD: colorPalette.gold,\n};\n\nconst TOOLTIP_LINE_COLOR_CONFIG = {\n DARK: colorPalette.orange,\n LIGHT: colorPalette.bottleGreenDark,\n};\n\nexport {\n CANDLE_MINUTE,\n CANDLE_NUMBER_HOUR,\n CHART_HEIGHT,\n CHART_WIDTH,\n COLOR_CONF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CAACM,GAAG,EAChBN,qBAAY,CAACO,GAAG,EAChBP,qBAAY,CAACQ,GAAG,CACjB;AAED,MAAMC,YAAY,GAAAtB,OAAA,CAAAsB,YAAA,GAAG;EACnBC,GAAG,EAAEC,8BAAY,CAACC,UAAU;EAC5BC,GAAG,EAAEF,8BAAY,CAACG,cAAc;EAChCC,GAAG,EAAEJ,8BAAY,CAACK,WAAW;EAC7BC,GAAG,EAAEN,8BAAY,CAACO,cAAc;EAChCC,GAAG,EAAER,8BAAY,CAACS,kBAAkB;EACpCC,GAAG,EAAEV,8BAAY,CAACW,MAAM;EACxBC,GAAG,EAAEZ,8BAAY,CAACa,iBAAiB;EACnCC,GAAG,EAAEd,8BAAY,CAACe;AACpB,CAAC;AAED,MAAMC,yBAAyB,GAAAxC,OAAA,CAAAwC,yBAAA,GAAG;EAChCC,IAAI,EAAEjB,8BAAY,CAACW,MAAM;EACzBO,KAAK,EAAElB,8BAAY,CAACmB;AACtB,CAAC","ignoreList":[]}
|
|
@@ -1,18 +1,27 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.xAxisLabelFormatter = exports.tooltipFormatter = exports.isMonthWeek = exports.intervalFormatter = exports.formatLegendData = void 0;
|
|
7
|
+
var _labsWidgetCommon = require("@oanda/labs-widget-common");
|
|
8
|
+
var _graphql = require("../../../../gql/types/graphql");
|
|
9
|
+
var _constants = require("./constants");
|
|
10
|
+
const isMonthWeek = timeUnit => timeUnit === _graphql.CurrencyPowerBalanceTimeUnit.M3 || timeUnit === _graphql.CurrencyPowerBalanceTimeUnit.M1 || timeUnit === _graphql.CurrencyPowerBalanceTimeUnit.W1;
|
|
11
|
+
exports.isMonthWeek = isMonthWeek;
|
|
5
12
|
const xAxisLabelFormatter = (label, timeUnit) => {
|
|
6
13
|
const {
|
|
7
14
|
date,
|
|
8
15
|
time
|
|
9
|
-
} = getChartDateAndTime(label);
|
|
16
|
+
} = (0, _labsWidgetCommon.getChartDateAndTime)(label);
|
|
10
17
|
const isDateFormat = isMonthWeek(timeUnit) || time === '00:00';
|
|
11
|
-
return isDateFormat ? chartDateFormat(date) : time;
|
|
18
|
+
return isDateFormat ? (0, _labsWidgetCommon.chartDateFormat)(date) : time;
|
|
12
19
|
};
|
|
13
|
-
|
|
20
|
+
exports.xAxisLabelFormatter = xAxisLabelFormatter;
|
|
21
|
+
const intervalFormatter = dataLength => Math.round(dataLength / _constants.VERTICAL_LINE_COUNT);
|
|
22
|
+
exports.intervalFormatter = intervalFormatter;
|
|
14
23
|
const tooltipFormatter = values => {
|
|
15
|
-
const date = chartDateTimeFormat(getChartDateAndTime(values[0].value[0]));
|
|
24
|
+
const date = (0, _labsWidgetCommon.chartDateTimeFormat)((0, _labsWidgetCommon.getChartDateAndTime)(values[0].value[0]));
|
|
16
25
|
const row = values.sort((_ref, _ref2) => {
|
|
17
26
|
let {
|
|
18
27
|
value: valueA
|
|
@@ -40,6 +49,7 @@ const tooltipFormatter = values => {
|
|
|
40
49
|
${row.join('\n')}
|
|
41
50
|
</div>`;
|
|
42
51
|
};
|
|
52
|
+
exports.tooltipFormatter = tooltipFormatter;
|
|
43
53
|
const formatLegendData = values => {
|
|
44
54
|
const dataCurrencies = values.map(_ref4 => {
|
|
45
55
|
let {
|
|
@@ -47,13 +57,13 @@ const formatLegendData = values => {
|
|
|
47
57
|
} = _ref4;
|
|
48
58
|
return currency;
|
|
49
59
|
});
|
|
50
|
-
const list = dataCurrencies.length === CURRENCIES_ORDER.length ? CURRENCIES_ORDER : CURRENCIES_ORDER.filter(currency => dataCurrencies.includes(currency));
|
|
60
|
+
const list = dataCurrencies.length === _constants.CURRENCIES_ORDER.length ? _constants.CURRENCIES_ORDER : _constants.CURRENCIES_ORDER.filter(currency => dataCurrencies.includes(currency));
|
|
51
61
|
return list.map(currency => ({
|
|
52
62
|
name: currency,
|
|
53
63
|
itemStyle: {
|
|
54
|
-
color: COLOR_CONFIG[currency]
|
|
64
|
+
color: _constants.COLOR_CONFIG[currency]
|
|
55
65
|
}
|
|
56
66
|
}));
|
|
57
67
|
};
|
|
58
|
-
|
|
68
|
+
exports.formatLegendData = formatLegendData;
|
|
59
69
|
//# sourceMappingURL=formatters.js.map
|