@orderly.network/ui-positions 3.0.4-alpha.4 → 3.1.0-alpha.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +31 -23
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +31 -23
- package/dist/index.mjs.map +1 -1
- package/package.json +13 -13
package/dist/index.js
CHANGED
|
@@ -33,7 +33,7 @@ var ConfirmHeader = (props) => {
|
|
|
33
33
|
"button",
|
|
34
34
|
{
|
|
35
35
|
onClick: props.onClose,
|
|
36
|
-
className: "oui-absolute oui-
|
|
36
|
+
className: "oui-absolute oui-end-0 oui-top-0 oui-p-2 oui-text-base-contrast-54 hover:oui-text-base-contrast-80",
|
|
37
37
|
children: /* @__PURE__ */ jsxRuntime.jsx(ui.CloseIcon, { size: 18, color: "white" })
|
|
38
38
|
}
|
|
39
39
|
)
|
|
@@ -804,6 +804,7 @@ var useCombinePositionsScript = (props) => {
|
|
|
804
804
|
const { pagination, setPage } = ui.usePagination({ pageSize: 50 });
|
|
805
805
|
const symbolsInfo = hooks.useSymbolsInfo();
|
|
806
806
|
const { state } = hooks.useAccount();
|
|
807
|
+
const { t } = i18n.useTranslation();
|
|
807
808
|
const [mainAccountPositions, , { isLoading }] = hooks.usePositionStream(symbol, {
|
|
808
809
|
calcMode,
|
|
809
810
|
includedPendingOrder
|
|
@@ -859,9 +860,10 @@ var useCombinePositionsScript = (props) => {
|
|
|
859
860
|
const groupDataSource = React2.useMemo(() => {
|
|
860
861
|
return groupDataByAccount(filtered, {
|
|
861
862
|
mainAccountId: state.mainAccountId,
|
|
863
|
+
mainAccountLabel: t("common.mainAccount"),
|
|
862
864
|
subAccounts: state.subAccounts
|
|
863
865
|
});
|
|
864
|
-
}, [filtered, state.mainAccountId, state.subAccounts]);
|
|
866
|
+
}, [filtered, state.mainAccountId, state.subAccounts, t]);
|
|
865
867
|
const loading = isLoading || isPositionLoading || isAccountInfoLoading;
|
|
866
868
|
React2.useEffect(() => {
|
|
867
869
|
setPage(1);
|
|
@@ -882,7 +884,7 @@ var useCombinePositionsScript = (props) => {
|
|
|
882
884
|
};
|
|
883
885
|
};
|
|
884
886
|
var groupDataByAccount = (data, options) => {
|
|
885
|
-
const { mainAccountId = "", subAccounts = [] } = options;
|
|
887
|
+
const { mainAccountId = "", mainAccountLabel, subAccounts = [] } = options;
|
|
886
888
|
const map = /* @__PURE__ */ new Map();
|
|
887
889
|
for (const item of data) {
|
|
888
890
|
const accountId = item.account_id || mainAccountId;
|
|
@@ -892,7 +894,7 @@ var groupDataByAccount = (data, options) => {
|
|
|
892
894
|
} else {
|
|
893
895
|
map.set(accountId, {
|
|
894
896
|
account_id: accountId,
|
|
895
|
-
description: accountId === mainAccountId ?
|
|
897
|
+
description: accountId === mainAccountId ? mainAccountLabel : findSubAccount?.description || ui.formatAddress(findSubAccount?.id || ""),
|
|
896
898
|
children: [item]
|
|
897
899
|
});
|
|
898
900
|
}
|
|
@@ -1476,7 +1478,7 @@ var ReversePositionWidget = (props) => {
|
|
|
1476
1478
|
open: visible,
|
|
1477
1479
|
onOpenChange,
|
|
1478
1480
|
size: "sm",
|
|
1479
|
-
title:
|
|
1481
|
+
title: t("positions.reverse.title"),
|
|
1480
1482
|
classNames: {
|
|
1481
1483
|
content: "oui-border oui-border-line-6"
|
|
1482
1484
|
},
|
|
@@ -2073,8 +2075,8 @@ var Quantity = ({
|
|
|
2073
2075
|
input: "oui-text-sm oui-font-semibold oui-text-base-contrast-98",
|
|
2074
2076
|
// override default additional padding so value can sit closer to suffix
|
|
2075
2077
|
additional: "oui-px-0",
|
|
2076
|
-
prefix: "oui-
|
|
2077
|
-
suffix: "oui-
|
|
2078
|
+
prefix: "oui-ps-3 oui-pe-2 oui-text-sm oui-text-base-contrast-54",
|
|
2079
|
+
suffix: "oui-ps-2 oui-pe-3 oui-text-sm oui-text-base-contrast-54"
|
|
2078
2080
|
}
|
|
2079
2081
|
}
|
|
2080
2082
|
),
|
|
@@ -3247,14 +3249,14 @@ var TriggerPriceItem = (props) => {
|
|
|
3247
3249
|
).toNumber();
|
|
3248
3250
|
const type = orderType === types.AlgoOrderType.TAKE_PROFIT ? "TP" : "SL";
|
|
3249
3251
|
return /* @__PURE__ */ jsxRuntime.jsxs(ui.Flex, { children: [
|
|
3250
|
-
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { intensity: 54, className: "oui-
|
|
3252
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { intensity: 54, className: "oui-me-1", children: `${type} PnL:` }),
|
|
3251
3253
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
3252
3254
|
ui.Text.formatted,
|
|
3253
3255
|
{
|
|
3254
3256
|
rule: "price",
|
|
3255
3257
|
className: pnl === 0 ? "oui-text-base-contrast-36" : pnl > 0 ? "oui-text-trade-profit oui-gap-0" : "oui-text-trade-loss oui-gap-0",
|
|
3256
3258
|
prefix: /* @__PURE__ */ jsxRuntime.jsx(ui.Text, { children: pnl === 0 ? "" : pnl > 0 ? "+" : "-" }),
|
|
3257
|
-
suffix: /* @__PURE__ */ jsxRuntime.jsx(ui.Text, { intensity: 36, className: "oui-
|
|
3259
|
+
suffix: /* @__PURE__ */ jsxRuntime.jsx(ui.Text, { intensity: 36, className: "oui-ms-1", children: "USDC" }),
|
|
3258
3260
|
children: `${Math.abs(pnl)}`
|
|
3259
3261
|
}
|
|
3260
3262
|
)
|
|
@@ -3511,7 +3513,7 @@ var useColumn = (config) => {
|
|
|
3511
3513
|
{
|
|
3512
3514
|
title: t("common.symbol"),
|
|
3513
3515
|
dataIndex: "symbol",
|
|
3514
|
-
fixed: "
|
|
3516
|
+
fixed: "start",
|
|
3515
3517
|
width: 200,
|
|
3516
3518
|
onSort: (r1, r2) => {
|
|
3517
3519
|
return r1.symbol?.localeCompare(r2.symbol || "");
|
|
@@ -3559,7 +3561,7 @@ var useColumn = (config) => {
|
|
|
3559
3561
|
return a.position_qty - b.position_qty;
|
|
3560
3562
|
},
|
|
3561
3563
|
width: 120,
|
|
3562
|
-
className: "oui-
|
|
3564
|
+
className: "oui-ps-6",
|
|
3563
3565
|
// rule: "price",
|
|
3564
3566
|
// numeralProps: {
|
|
3565
3567
|
// coloring: true,
|
|
@@ -3786,14 +3788,14 @@ var useColumn = (config) => {
|
|
|
3786
3788
|
// title: t("common.qty"),
|
|
3787
3789
|
// dataIndex: "close_qty",
|
|
3788
3790
|
// width: 100,
|
|
3789
|
-
// fixed: "
|
|
3791
|
+
// fixed: "end",
|
|
3790
3792
|
// render: renderQuantityInput,
|
|
3791
3793
|
// },
|
|
3792
3794
|
// {
|
|
3793
3795
|
// title: t("common.price"),
|
|
3794
3796
|
// dataIndex: "close_price",
|
|
3795
3797
|
// width: 100,
|
|
3796
|
-
// fixed: "
|
|
3798
|
+
// fixed: "end",
|
|
3797
3799
|
// render: renderPriceInput,
|
|
3798
3800
|
// // render: (value: string) => <PriceInput />,
|
|
3799
3801
|
// },
|
|
@@ -3802,7 +3804,7 @@ var useColumn = (config) => {
|
|
|
3802
3804
|
dataIndex: "close_position",
|
|
3803
3805
|
align: "right",
|
|
3804
3806
|
width: positionReverse ? 100 : 70,
|
|
3805
|
-
fixed: "
|
|
3807
|
+
fixed: "end",
|
|
3806
3808
|
render(_, record) {
|
|
3807
3809
|
return /* @__PURE__ */ jsxRuntime.jsxs(ui.Flex, { gapX: 2, justify: "end", children: [
|
|
3808
3810
|
/* @__PURE__ */ jsxRuntime.jsx(ClosePositionWidget, {}),
|
|
@@ -3811,7 +3813,13 @@ var useColumn = (config) => {
|
|
|
3811
3813
|
}
|
|
3812
3814
|
}
|
|
3813
3815
|
],
|
|
3814
|
-
[
|
|
3816
|
+
[
|
|
3817
|
+
onSymbolChange,
|
|
3818
|
+
pnlNotionalDecimalPrecision,
|
|
3819
|
+
sharePnLConfig,
|
|
3820
|
+
t,
|
|
3821
|
+
positionReverse
|
|
3822
|
+
]
|
|
3815
3823
|
);
|
|
3816
3824
|
return column;
|
|
3817
3825
|
};
|
|
@@ -3854,9 +3862,9 @@ var SymbolToken = (props) => {
|
|
|
3854
3862
|
var UnrealPnL = (props) => {
|
|
3855
3863
|
const { item } = props;
|
|
3856
3864
|
const { t } = i18n.useTranslation();
|
|
3857
|
-
const unrealPnlLabel = /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "oui-text-
|
|
3865
|
+
const unrealPnlLabel = /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "oui-text-end", children: [
|
|
3858
3866
|
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { intensity: 36, className: "oui-underline oui-decoration-dotted", children: t("common.unrealizedPnl") }),
|
|
3859
|
-
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { intensity: 20, className: "oui-
|
|
3867
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { intensity: 20, className: "oui-ms-0.5", children: "(USDC)" })
|
|
3860
3868
|
] });
|
|
3861
3869
|
return /* @__PURE__ */ jsxRuntime.jsxs(ui.Flex, { gap: 3, children: [
|
|
3862
3870
|
/* @__PURE__ */ jsxRuntime.jsxs(ui.Flex, { direction: "column", className: "oui-text-2xs", itemAlign: "end", children: [
|
|
@@ -3883,7 +3891,7 @@ var UnrealPnL = (props) => {
|
|
|
3883
3891
|
prefix: "(",
|
|
3884
3892
|
suffix: ")",
|
|
3885
3893
|
className: ui.cn(
|
|
3886
|
-
"oui-
|
|
3894
|
+
"oui-ms-1",
|
|
3887
3895
|
item.unrealized_pnl_ROI > 0 ? "oui-text-success-darken" : "oui-text-danger-darken"
|
|
3888
3896
|
),
|
|
3889
3897
|
children: item.unrealized_pnl_ROI
|
|
@@ -4290,7 +4298,7 @@ var PositionsRowProvider = (props) => {
|
|
|
4290
4298
|
}
|
|
4291
4299
|
return false;
|
|
4292
4300
|
});
|
|
4293
|
-
}, [submit]);
|
|
4301
|
+
}, [mutatePositions, quantity, submit, symbol, symbolInfo, t]);
|
|
4294
4302
|
const memoizedValue = React2.useMemo(() => {
|
|
4295
4303
|
return {
|
|
4296
4304
|
quantity,
|
|
@@ -4487,7 +4495,7 @@ var usePositionHistoryColumn = (props) => {
|
|
|
4487
4495
|
{
|
|
4488
4496
|
title: t("common.symbol"),
|
|
4489
4497
|
dataIndex: "symbol",
|
|
4490
|
-
fixed: "
|
|
4498
|
+
fixed: "start",
|
|
4491
4499
|
width: 250,
|
|
4492
4500
|
onSort: (r1, r2) => {
|
|
4493
4501
|
return r1.symbol?.localeCompare(r2.symbol || "");
|
|
@@ -4603,7 +4611,7 @@ var usePositionHistoryColumn = (props) => {
|
|
|
4603
4611
|
render: (_, record) => /* @__PURE__ */ jsxRuntime.jsx(ui.Text.formatted, { rule: "date", formatString: "yyyy-MM-dd HH:mm:ss", children: record.last_update_time })
|
|
4604
4612
|
}
|
|
4605
4613
|
],
|
|
4606
|
-
[pnlNotionalDecimalPrecision, t]
|
|
4614
|
+
[onSymbolChange, pnlNotionalDecimalPrecision, props.sharePnLConfig, t]
|
|
4607
4615
|
);
|
|
4608
4616
|
return column;
|
|
4609
4617
|
};
|
|
@@ -5035,7 +5043,7 @@ var useFilter = () => {
|
|
|
5035
5043
|
return [sideFilter, statusFilter];
|
|
5036
5044
|
}
|
|
5037
5045
|
return [sideFilter, statusFilter, dateRangeFilter];
|
|
5038
|
-
}, [side, status,
|
|
5046
|
+
}, [dateRange, isMobile, side, status, t]);
|
|
5039
5047
|
return {
|
|
5040
5048
|
filterItems,
|
|
5041
5049
|
onFilter,
|
|
@@ -5967,7 +5975,7 @@ var Liquidation = (props) => {
|
|
|
5967
5975
|
] });
|
|
5968
5976
|
};
|
|
5969
5977
|
var TooltipHeaderCell = (props) => {
|
|
5970
|
-
return /* @__PURE__ */ jsxRuntime.jsx("th", { className: "oui-h-10 oui-border-b oui-border-line oui-text-
|
|
5978
|
+
return /* @__PURE__ */ jsxRuntime.jsx("th", { className: "oui-h-10 oui-border-b oui-border-line oui-text-start oui-text-base-contrast-36", children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
5971
5979
|
ui.Tooltip,
|
|
5972
5980
|
{
|
|
5973
5981
|
content: props.tooltip,
|