@orderly.network/ui-positions 2.11.1 → 2.11.2
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 +106 -75
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +107 -76
- package/dist/index.mjs.map +1 -1
- package/package.json +13 -13
package/dist/index.js
CHANGED
|
@@ -1593,16 +1593,19 @@ var RwaStatusTag = ({ symbol }) => {
|
|
|
1593
1593
|
return null;
|
|
1594
1594
|
}
|
|
1595
1595
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
1596
|
-
ui.
|
|
1596
|
+
ui.Tips,
|
|
1597
1597
|
{
|
|
1598
|
-
|
|
1599
|
-
|
|
1600
|
-
|
|
1601
|
-
|
|
1602
|
-
|
|
1603
|
-
|
|
1604
|
-
|
|
1605
|
-
|
|
1598
|
+
title: t("common.tips"),
|
|
1599
|
+
content: /* @__PURE__ */ jsxRuntime.jsx(ui.Text, { color: open ? "success" : "danger", children: open ? t("trading.rwa.marketHours") : t("trading.rwa.outsideMarketHours") }),
|
|
1600
|
+
trigger: /* @__PURE__ */ jsxRuntime.jsx(ui.Box, { p: 2, className: "oui-flex oui-cursor-pointer oui-items-center", children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
1601
|
+
ui.Box,
|
|
1602
|
+
{
|
|
1603
|
+
width: 4,
|
|
1604
|
+
height: 4,
|
|
1605
|
+
r: "full",
|
|
1606
|
+
className: ui.cn(open ? "oui-bg-success" : "oui-bg-danger")
|
|
1607
|
+
}
|
|
1608
|
+
) })
|
|
1606
1609
|
}
|
|
1607
1610
|
);
|
|
1608
1611
|
};
|
|
@@ -3469,11 +3472,11 @@ var useColumn = (config) => {
|
|
|
3469
3472
|
title: t("common.symbol"),
|
|
3470
3473
|
dataIndex: "symbol",
|
|
3471
3474
|
fixed: "left",
|
|
3472
|
-
width:
|
|
3475
|
+
width: 176,
|
|
3473
3476
|
onSort: (r1, r2) => {
|
|
3474
3477
|
return r1.symbol?.localeCompare(r2.symbol || "");
|
|
3475
3478
|
},
|
|
3476
|
-
render: (value, record) => /* @__PURE__ */ jsxRuntime.jsxs(ui.Flex, { gap: 2, children: [
|
|
3479
|
+
render: (value, record) => /* @__PURE__ */ jsxRuntime.jsxs(ui.Flex, { gap: 2, className: "oui-py-1", children: [
|
|
3477
3480
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
3478
3481
|
ui.Box,
|
|
3479
3482
|
{
|
|
@@ -3485,32 +3488,32 @@ var useColumn = (config) => {
|
|
|
3485
3488
|
)
|
|
3486
3489
|
}
|
|
3487
3490
|
),
|
|
3488
|
-
/* @__PURE__ */ jsxRuntime.jsxs(ui.Flex, { direction: "column", itemAlign: "start", children: [
|
|
3489
|
-
/* @__PURE__ */ jsxRuntime.
|
|
3490
|
-
ui.Text.formatted,
|
|
3491
|
-
{
|
|
3492
|
-
formatString: "base-type",
|
|
3493
|
-
className: "oui-cursor-pointer",
|
|
3494
|
-
onClick: (e) => {
|
|
3495
|
-
onSymbolChange?.({ symbol: value });
|
|
3496
|
-
e.stopPropagation();
|
|
3497
|
-
e.preventDefault();
|
|
3498
|
-
},
|
|
3499
|
-
children: `${value.split("_")[1]}-PERP`
|
|
3500
|
-
}
|
|
3501
|
-
),
|
|
3502
|
-
/* @__PURE__ */ jsxRuntime.jsxs(ui.Flex, { gap: 1, children: [
|
|
3491
|
+
/* @__PURE__ */ jsxRuntime.jsxs(ui.Flex, { direction: "column", itemAlign: "start", gap: 1, children: [
|
|
3492
|
+
/* @__PURE__ */ jsxRuntime.jsxs(ui.Flex, { gap: 1, itemAlign: "center", children: [
|
|
3503
3493
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
3504
|
-
|
|
3494
|
+
ui.Text.formatted,
|
|
3505
3495
|
{
|
|
3506
|
-
|
|
3507
|
-
|
|
3508
|
-
|
|
3509
|
-
|
|
3496
|
+
formatString: "base-type",
|
|
3497
|
+
className: "oui-cursor-pointer",
|
|
3498
|
+
onClick: (e) => {
|
|
3499
|
+
onSymbolChange?.({ symbol: value });
|
|
3500
|
+
e.stopPropagation();
|
|
3501
|
+
e.preventDefault();
|
|
3502
|
+
},
|
|
3503
|
+
children: `${value.split("_")[1]}-PERP`
|
|
3510
3504
|
}
|
|
3511
3505
|
),
|
|
3512
3506
|
/* @__PURE__ */ jsxRuntime.jsx(RwaStatusTag, { symbol: value })
|
|
3513
|
-
] })
|
|
3507
|
+
] }),
|
|
3508
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Flex, { gap: 1, wrap: "wrap", children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
3509
|
+
LeverageBadge,
|
|
3510
|
+
{
|
|
3511
|
+
symbol: value,
|
|
3512
|
+
leverage: record.leverage,
|
|
3513
|
+
modalId: uiLeverage.SymbolLeverageDialogId,
|
|
3514
|
+
marginMode: record.margin_mode
|
|
3515
|
+
}
|
|
3516
|
+
) })
|
|
3514
3517
|
] })
|
|
3515
3518
|
] })
|
|
3516
3519
|
},
|
|
@@ -3782,31 +3785,36 @@ var SymbolToken = (props) => {
|
|
|
3782
3785
|
const { item } = props;
|
|
3783
3786
|
const isBuy = item.position_qty > 0;
|
|
3784
3787
|
const { t } = i18n.useTranslation();
|
|
3785
|
-
return /* @__PURE__ */ jsxRuntime.
|
|
3786
|
-
ui.
|
|
3787
|
-
|
|
3788
|
-
|
|
3789
|
-
|
|
3790
|
-
|
|
3791
|
-
|
|
3792
|
-
|
|
3793
|
-
|
|
3794
|
-
|
|
3795
|
-
|
|
3796
|
-
|
|
3797
|
-
|
|
3798
|
-
|
|
3799
|
-
|
|
3800
|
-
|
|
3801
|
-
|
|
3802
|
-
|
|
3803
|
-
|
|
3804
|
-
|
|
3805
|
-
|
|
3806
|
-
|
|
3807
|
-
|
|
3808
|
-
|
|
3809
|
-
|
|
3788
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(ui.Flex, { direction: "column", itemAlign: "start", gap: 1, children: [
|
|
3789
|
+
/* @__PURE__ */ jsxRuntime.jsxs(ui.Flex, { gap: 1, itemAlign: "center", children: [
|
|
3790
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
3791
|
+
ui.Text.formatted,
|
|
3792
|
+
{
|
|
3793
|
+
rule: "symbol",
|
|
3794
|
+
formatString: "base-type",
|
|
3795
|
+
size: "2xs",
|
|
3796
|
+
showIcon: true,
|
|
3797
|
+
onClick: () => {
|
|
3798
|
+
props.onSymbolChange?.({ symbol: item.symbol });
|
|
3799
|
+
},
|
|
3800
|
+
children: item.symbol
|
|
3801
|
+
}
|
|
3802
|
+
),
|
|
3803
|
+
/* @__PURE__ */ jsxRuntime.jsx(RwaStatusTag, { symbol: item.symbol })
|
|
3804
|
+
] }),
|
|
3805
|
+
/* @__PURE__ */ jsxRuntime.jsxs(ui.Flex, { gap: 1, itemAlign: "center", wrap: "wrap", children: [
|
|
3806
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Badge, { color: isBuy ? "success" : "danger", size: "xs", children: isBuy ? t("common.long") : t("common.short") }),
|
|
3807
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
3808
|
+
LeverageBadge,
|
|
3809
|
+
{
|
|
3810
|
+
symbol: item.symbol,
|
|
3811
|
+
leverage: item.leverage,
|
|
3812
|
+
modalId: uiLeverage.SymbolLeverageSheetId,
|
|
3813
|
+
marginMode: item.margin_mode
|
|
3814
|
+
}
|
|
3815
|
+
)
|
|
3816
|
+
] })
|
|
3817
|
+
] });
|
|
3810
3818
|
};
|
|
3811
3819
|
var UnrealPnL = (props) => {
|
|
3812
3820
|
const { item } = props;
|
|
@@ -4445,7 +4453,7 @@ var usePositionHistoryColumn = (props) => {
|
|
|
4445
4453
|
title: t("common.symbol"),
|
|
4446
4454
|
dataIndex: "symbol",
|
|
4447
4455
|
fixed: "left",
|
|
4448
|
-
width:
|
|
4456
|
+
width: 210,
|
|
4449
4457
|
onSort: (r1, r2) => {
|
|
4450
4458
|
return r1.symbol?.localeCompare(r2.symbol || "");
|
|
4451
4459
|
},
|
|
@@ -4636,6 +4644,19 @@ var SymbolInfo2 = (props) => {
|
|
|
4636
4644
|
)
|
|
4637
4645
|
);
|
|
4638
4646
|
}
|
|
4647
|
+
if (record.margin_mode != null) {
|
|
4648
|
+
list.push(
|
|
4649
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
4650
|
+
ui.Badge,
|
|
4651
|
+
{
|
|
4652
|
+
color: "neutral",
|
|
4653
|
+
size: "xs",
|
|
4654
|
+
children: record.margin_mode === types.MarginMode.ISOLATED ? t("marginMode.isolated") : t("marginMode.cross")
|
|
4655
|
+
},
|
|
4656
|
+
`margin-mode-${record.margin_mode}`
|
|
4657
|
+
)
|
|
4658
|
+
);
|
|
4659
|
+
}
|
|
4639
4660
|
list.push(
|
|
4640
4661
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
4641
4662
|
LeverageBadge2,
|
|
@@ -4648,7 +4669,7 @@ var SymbolInfo2 = (props) => {
|
|
|
4648
4669
|
);
|
|
4649
4670
|
return list;
|
|
4650
4671
|
}, [record, t]);
|
|
4651
|
-
return /* @__PURE__ */ jsxRuntime.jsxs(ui.Flex, { gap: 2,
|
|
4672
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(ui.Flex, { gap: 2, className: "oui-py-1", children: [
|
|
4652
4673
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
4653
4674
|
ui.Box,
|
|
4654
4675
|
{
|
|
@@ -4660,7 +4681,7 @@ var SymbolInfo2 = (props) => {
|
|
|
4660
4681
|
)
|
|
4661
4682
|
}
|
|
4662
4683
|
),
|
|
4663
|
-
/* @__PURE__ */ jsxRuntime.jsxs(ui.Flex, { direction: "column", itemAlign: "start", children: [
|
|
4684
|
+
/* @__PURE__ */ jsxRuntime.jsxs(ui.Flex, { direction: "column", itemAlign: "start", gap: 1, children: [
|
|
4664
4685
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
4665
4686
|
ui.Text.formatted,
|
|
4666
4687
|
{
|
|
@@ -4674,7 +4695,7 @@ var SymbolInfo2 = (props) => {
|
|
|
4674
4695
|
children: `${record.symbol.split("_")[1]}-PERP`
|
|
4675
4696
|
}
|
|
4676
4697
|
),
|
|
4677
|
-
/* @__PURE__ */ jsxRuntime.jsx(ui.Flex, { gap: 1, children: tags })
|
|
4698
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Flex, { gap: 1, wrap: "wrap", children: tags })
|
|
4678
4699
|
] })
|
|
4679
4700
|
] });
|
|
4680
4701
|
};
|
|
@@ -4786,6 +4807,15 @@ var areDatesEqual = (date1, date2) => {
|
|
|
4786
4807
|
};
|
|
4787
4808
|
|
|
4788
4809
|
// src/components/positionHistory/positionHistory.script.tsx
|
|
4810
|
+
var normalizeMarginMode = (value) => {
|
|
4811
|
+
if (value === 1 || value === types.MarginMode.ISOLATED) {
|
|
4812
|
+
return types.MarginMode.ISOLATED;
|
|
4813
|
+
}
|
|
4814
|
+
if (value === 0 || value === types.MarginMode.CROSS) {
|
|
4815
|
+
return types.MarginMode.CROSS;
|
|
4816
|
+
}
|
|
4817
|
+
return void 0;
|
|
4818
|
+
};
|
|
4789
4819
|
var usePositionHistoryScript = (props) => {
|
|
4790
4820
|
const {
|
|
4791
4821
|
onSymbolChange,
|
|
@@ -4805,20 +4835,16 @@ var usePositionHistoryScript = (props) => {
|
|
|
4805
4835
|
symbol ? `/v1/position_history?symbol=${symbol}&limit=1000` : "/v1/position_history?limit=1000",
|
|
4806
4836
|
{
|
|
4807
4837
|
formatter(data2) {
|
|
4808
|
-
return (data2.rows ?? null)?.map(
|
|
4809
|
-
|
|
4810
|
-
|
|
4811
|
-
|
|
4812
|
-
|
|
4813
|
-
|
|
4814
|
-
|
|
4815
|
-
margin_mode: item.margin_mode === 1 || item.margin_mode === types.MarginMode.ISOLATED ? types.MarginMode.ISOLATED : types.MarginMode.CROSS,
|
|
4816
|
-
netPnL
|
|
4817
|
-
};
|
|
4818
|
-
}
|
|
4819
|
-
return item;
|
|
4838
|
+
return (data2.rows ?? null)?.map((item) => {
|
|
4839
|
+
const result = {
|
|
4840
|
+
...item,
|
|
4841
|
+
margin_mode: normalizeMarginMode(item.margin_mode)
|
|
4842
|
+
};
|
|
4843
|
+
if (item.realized_pnl != null && item.accumulated_funding_fee != null && item.trading_fee != null) {
|
|
4844
|
+
result.netPnL = item.realized_pnl - item.accumulated_funding_fee - item.trading_fee;
|
|
4820
4845
|
}
|
|
4821
|
-
|
|
4846
|
+
return result;
|
|
4847
|
+
});
|
|
4822
4848
|
},
|
|
4823
4849
|
revalidateOnFocus: true
|
|
4824
4850
|
}
|
|
@@ -5089,8 +5115,13 @@ var PositionHistoryType = (props) => {
|
|
|
5089
5115
|
)
|
|
5090
5116
|
);
|
|
5091
5117
|
}
|
|
5118
|
+
if (record.margin_mode != null) {
|
|
5119
|
+
list.push(
|
|
5120
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Badge, { color: "neutral", size: "xs", children: record.margin_mode === types.MarginMode.ISOLATED ? t("marginMode.isolated") : t("marginMode.cross") }, `margin-${record.margin_mode}`)
|
|
5121
|
+
);
|
|
5122
|
+
}
|
|
5092
5123
|
return list;
|
|
5093
|
-
}, [record]);
|
|
5124
|
+
}, [record, t]);
|
|
5094
5125
|
return /* @__PURE__ */ jsxRuntime.jsx(ui.Flex, { gap: 1, children: tags });
|
|
5095
5126
|
};
|
|
5096
5127
|
var ClosedQty = (props) => {
|