@orderly.network/ui-positions 2.11.2 → 2.12.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.d.mts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.js +71 -43
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +72 -44
- package/dist/index.mjs.map +1 -1
- package/package.json +13 -13
package/dist/index.d.mts
CHANGED
|
@@ -104,7 +104,7 @@ declare const usePositionHistoryScript: (props: PositionHistoryProps$1) => {
|
|
|
104
104
|
value: any;
|
|
105
105
|
}) => void;
|
|
106
106
|
symbol: string | undefined;
|
|
107
|
-
filterDays: 1 |
|
|
107
|
+
filterDays: 1 | 30 | 7 | 90 | null;
|
|
108
108
|
updateFilterDays: (days: 1 | 7 | 30 | 90) => void;
|
|
109
109
|
pnlNotionalDecimalPrecision: number | undefined;
|
|
110
110
|
onSort: (options?: _orderly_network_ui.TableSort) => void;
|
|
@@ -147,7 +147,7 @@ declare const useLiquidationScript: (props: LiquidationProps) => {
|
|
|
147
147
|
from?: Date;
|
|
148
148
|
to?: Date;
|
|
149
149
|
};
|
|
150
|
-
filterDays: 1 |
|
|
150
|
+
filterDays: 1 | 30 | 7 | 90 | null;
|
|
151
151
|
updateFilterDays: (days: 1 | 7 | 30 | 90) => void;
|
|
152
152
|
filterItems: any[];
|
|
153
153
|
onFilter: (filter: {
|
package/dist/index.d.ts
CHANGED
|
@@ -104,7 +104,7 @@ declare const usePositionHistoryScript: (props: PositionHistoryProps$1) => {
|
|
|
104
104
|
value: any;
|
|
105
105
|
}) => void;
|
|
106
106
|
symbol: string | undefined;
|
|
107
|
-
filterDays: 1 |
|
|
107
|
+
filterDays: 1 | 30 | 7 | 90 | null;
|
|
108
108
|
updateFilterDays: (days: 1 | 7 | 30 | 90) => void;
|
|
109
109
|
pnlNotionalDecimalPrecision: number | undefined;
|
|
110
110
|
onSort: (options?: _orderly_network_ui.TableSort) => void;
|
|
@@ -147,7 +147,7 @@ declare const useLiquidationScript: (props: LiquidationProps) => {
|
|
|
147
147
|
from?: Date;
|
|
148
148
|
to?: Date;
|
|
149
149
|
};
|
|
150
|
-
filterDays: 1 |
|
|
150
|
+
filterDays: 1 | 30 | 7 | 90 | null;
|
|
151
151
|
updateFilterDays: (days: 1 | 7 | 30 | 90) => void;
|
|
152
152
|
filterItems: any[];
|
|
153
153
|
onFilter: (filter: {
|
package/dist/index.js
CHANGED
|
@@ -5,8 +5,8 @@ var React2 = require('react');
|
|
|
5
5
|
var i18n = require('@orderly.network/i18n');
|
|
6
6
|
var types = require('@orderly.network/types');
|
|
7
7
|
var utils = require('@orderly.network/utils');
|
|
8
|
-
var jsxRuntime = require('react/jsx-runtime');
|
|
9
8
|
var hooks = require('@orderly.network/hooks');
|
|
9
|
+
var jsxRuntime = require('react/jsx-runtime');
|
|
10
10
|
var reactApp = require('@orderly.network/react-app');
|
|
11
11
|
var perp = require('@orderly.network/perp');
|
|
12
12
|
var uiConnector = require('@orderly.network/ui-connector');
|
|
@@ -20,6 +20,11 @@ function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
|
|
|
20
20
|
var React2__default = /*#__PURE__*/_interopDefault(React2);
|
|
21
21
|
|
|
22
22
|
// src/index.ts
|
|
23
|
+
var SymbolBadge = ({ symbol }) => {
|
|
24
|
+
const { brokerId, brokerName, brokerNameRaw } = hooks.useBadgeBySymbol(symbol);
|
|
25
|
+
const badge = brokerName ?? brokerId ?? void 0;
|
|
26
|
+
return /* @__PURE__ */ jsxRuntime.jsx(ui.SymbolBadge, { badge, fullName: brokerNameRaw });
|
|
27
|
+
};
|
|
23
28
|
var ConfirmHeader = (props) => {
|
|
24
29
|
const { hideCloseIcon = false } = props;
|
|
25
30
|
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "oui-relative oui-w-full oui-border-b oui-border-line-4 oui-pb-3", children: [
|
|
@@ -176,9 +181,10 @@ var LimitConfirmDialog = (props) => {
|
|
|
176
181
|
ui.Text.formatted,
|
|
177
182
|
{
|
|
178
183
|
rule: "symbol",
|
|
179
|
-
formatString: "base
|
|
184
|
+
formatString: "base",
|
|
180
185
|
size: "base",
|
|
181
186
|
showIcon: true,
|
|
187
|
+
suffix: /* @__PURE__ */ jsxRuntime.jsx(SymbolBadge, { symbol: order.symbol }),
|
|
182
188
|
children: order.symbol
|
|
183
189
|
}
|
|
184
190
|
),
|
|
@@ -326,8 +332,10 @@ var FundingFeeHistoryUI = ({ total, symbol, start_t, end_t }) => {
|
|
|
326
332
|
ui.Text.formatted,
|
|
327
333
|
{
|
|
328
334
|
rule: "symbol",
|
|
335
|
+
formatString: "base",
|
|
329
336
|
className: "oui-font-semibold",
|
|
330
337
|
intensity: 98,
|
|
338
|
+
suffix: /* @__PURE__ */ jsxRuntime.jsx(SymbolBadge, { symbol }),
|
|
331
339
|
children: symbol
|
|
332
340
|
}
|
|
333
341
|
)
|
|
@@ -410,7 +418,7 @@ var HistoryDataListView = ({ isLoading, data, loadMore }) => {
|
|
|
410
418
|
dataIndex: "created_time",
|
|
411
419
|
width: 120,
|
|
412
420
|
render: (value) => {
|
|
413
|
-
return /* @__PURE__ */ jsxRuntime.jsx(ui.Text.formatted, { rule: "date", children: value });
|
|
421
|
+
return /* @__PURE__ */ jsxRuntime.jsx(ui.Text.formatted, { rule: "date", suffix: /* @__PURE__ */ jsxRuntime.jsx(SymbolBadge, { symbol: value }), children: value });
|
|
414
422
|
}
|
|
415
423
|
},
|
|
416
424
|
{
|
|
@@ -1122,9 +1130,10 @@ var ReversePosition = (props) => {
|
|
|
1122
1130
|
size: "base",
|
|
1123
1131
|
weight: "semibold",
|
|
1124
1132
|
rule: "symbol",
|
|
1125
|
-
formatString: "base
|
|
1133
|
+
formatString: "base",
|
|
1126
1134
|
intensity: 98,
|
|
1127
1135
|
showIcon: true,
|
|
1136
|
+
suffix: /* @__PURE__ */ jsxRuntime.jsx(SymbolBadge, { symbol }),
|
|
1128
1137
|
children: symbol
|
|
1129
1138
|
}
|
|
1130
1139
|
),
|
|
@@ -2115,10 +2124,11 @@ var SymbolInfo = ({ symbol }) => {
|
|
|
2115
2124
|
ui.Text.formatted,
|
|
2116
2125
|
{
|
|
2117
2126
|
rule: "symbol",
|
|
2118
|
-
formatString: "base
|
|
2127
|
+
formatString: "base",
|
|
2119
2128
|
size: "base",
|
|
2120
2129
|
weight: "semibold",
|
|
2121
2130
|
intensity: 98,
|
|
2131
|
+
suffix: /* @__PURE__ */ jsxRuntime.jsx(SymbolBadge, { symbol }),
|
|
2122
2132
|
children: symbol
|
|
2123
2133
|
}
|
|
2124
2134
|
)
|
|
@@ -2297,7 +2307,16 @@ var MobileClosePosition = (props) => {
|
|
|
2297
2307
|
const orderType = isMarketClose ? t("orderEntry.orderType.market") : t("orderEntry.orderType.limit");
|
|
2298
2308
|
const orderSide = isBuy ? /* @__PURE__ */ jsxRuntime.jsx(ui.Badge, { color: "success", size: "xs", children: t("common.buy") }) : /* @__PURE__ */ jsxRuntime.jsx(ui.Badge, { color: "danger", size: "xs", children: t("common.sell") });
|
|
2299
2309
|
const header = /* @__PURE__ */ jsxRuntime.jsxs(ui.Flex, { width: "100%", justify: "between", children: [
|
|
2300
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
2310
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
2311
|
+
ui.Text.formatted,
|
|
2312
|
+
{
|
|
2313
|
+
rule: "symbol",
|
|
2314
|
+
formatString: "base",
|
|
2315
|
+
showIcon: true,
|
|
2316
|
+
suffix: /* @__PURE__ */ jsxRuntime.jsx(SymbolBadge, { symbol: position.symbol }),
|
|
2317
|
+
children: position.symbol
|
|
2318
|
+
}
|
|
2319
|
+
),
|
|
2301
2320
|
/* @__PURE__ */ jsxRuntime.jsxs(ui.Flex, { gap: 1, children: [
|
|
2302
2321
|
/* @__PURE__ */ jsxRuntime.jsx(ui.Badge, { color: "neutral", size: "xs", children: orderType }),
|
|
2303
2322
|
orderSide
|
|
@@ -3032,6 +3051,25 @@ var PartialTPSL = (props) => {
|
|
|
3032
3051
|
] })
|
|
3033
3052
|
] });
|
|
3034
3053
|
};
|
|
3054
|
+
var PositionSymbolCell = (props) => {
|
|
3055
|
+
const { symbol, onSymbolChange, className, formatString, ...rest } = props;
|
|
3056
|
+
const { brokerId, brokerName, brokerNameRaw } = hooks.useBadgeBySymbol(symbol);
|
|
3057
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
3058
|
+
ui.Text.symbolBadge,
|
|
3059
|
+
{
|
|
3060
|
+
...rest,
|
|
3061
|
+
className: ui.cn(className, "oui-cursor-pointer"),
|
|
3062
|
+
badge: brokerName ?? brokerId ?? void 0,
|
|
3063
|
+
fullName: brokerNameRaw,
|
|
3064
|
+
onClick: (e) => {
|
|
3065
|
+
onSymbolChange?.({ symbol });
|
|
3066
|
+
e.stopPropagation();
|
|
3067
|
+
e.preventDefault();
|
|
3068
|
+
},
|
|
3069
|
+
children: symbol
|
|
3070
|
+
}
|
|
3071
|
+
);
|
|
3072
|
+
};
|
|
3035
3073
|
var ReversePositionButton = (props) => {
|
|
3036
3074
|
const { position } = props;
|
|
3037
3075
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
@@ -3075,6 +3113,7 @@ var useShareButtonScript = (props) => {
|
|
|
3075
3113
|
const { position, sharePnLConfig, iconSize } = props;
|
|
3076
3114
|
const { getFirstRefCode } = hooks.useReferralInfo();
|
|
3077
3115
|
const symbolsInfo = hooks.useSymbolsInfo();
|
|
3116
|
+
const { brokerNameRaw } = hooks.useBadgeBySymbol(position.symbol);
|
|
3078
3117
|
const refCode = React2.useMemo(() => {
|
|
3079
3118
|
return getFirstRefCode()?.code;
|
|
3080
3119
|
}, [getFirstRefCode]);
|
|
@@ -3153,7 +3192,8 @@ var useShareButtonScript = (props) => {
|
|
|
3153
3192
|
marginMode: position.margin_mode
|
|
3154
3193
|
},
|
|
3155
3194
|
refCode,
|
|
3156
|
-
...sharePnLConfig
|
|
3195
|
+
...sharePnLConfig,
|
|
3196
|
+
brokerName: sharePnLConfig?.brokerName ?? brokerNameRaw
|
|
3157
3197
|
}
|
|
3158
3198
|
});
|
|
3159
3199
|
};
|
|
@@ -3472,7 +3512,7 @@ var useColumn = (config) => {
|
|
|
3472
3512
|
title: t("common.symbol"),
|
|
3473
3513
|
dataIndex: "symbol",
|
|
3474
3514
|
fixed: "left",
|
|
3475
|
-
width:
|
|
3515
|
+
width: 200,
|
|
3476
3516
|
onSort: (r1, r2) => {
|
|
3477
3517
|
return r1.symbol?.localeCompare(r2.symbol || "");
|
|
3478
3518
|
},
|
|
@@ -3481,9 +3521,9 @@ var useColumn = (config) => {
|
|
|
3481
3521
|
ui.Box,
|
|
3482
3522
|
{
|
|
3483
3523
|
width: 4,
|
|
3484
|
-
height:
|
|
3524
|
+
height: 24,
|
|
3485
3525
|
className: ui.cn(
|
|
3486
|
-
"oui-h-[
|
|
3526
|
+
"oui-h-[42px] oui-rounded-[1px]",
|
|
3487
3527
|
record.position_qty > 0 ? "oui-bg-trade-profit" : "oui-bg-trade-loss"
|
|
3488
3528
|
)
|
|
3489
3529
|
}
|
|
@@ -3491,16 +3531,10 @@ var useColumn = (config) => {
|
|
|
3491
3531
|
/* @__PURE__ */ jsxRuntime.jsxs(ui.Flex, { direction: "column", itemAlign: "start", gap: 1, children: [
|
|
3492
3532
|
/* @__PURE__ */ jsxRuntime.jsxs(ui.Flex, { gap: 1, itemAlign: "center", children: [
|
|
3493
3533
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
3494
|
-
|
|
3534
|
+
PositionSymbolCell,
|
|
3495
3535
|
{
|
|
3496
|
-
|
|
3497
|
-
|
|
3498
|
-
onClick: (e) => {
|
|
3499
|
-
onSymbolChange?.({ symbol: value });
|
|
3500
|
-
e.stopPropagation();
|
|
3501
|
-
e.preventDefault();
|
|
3502
|
-
},
|
|
3503
|
-
children: `${value.split("_")[1]}-PERP`
|
|
3536
|
+
symbol: value,
|
|
3537
|
+
onSymbolChange
|
|
3504
3538
|
}
|
|
3505
3539
|
),
|
|
3506
3540
|
/* @__PURE__ */ jsxRuntime.jsx(RwaStatusTag, { symbol: value })
|
|
@@ -3791,12 +3825,13 @@ var SymbolToken = (props) => {
|
|
|
3791
3825
|
ui.Text.formatted,
|
|
3792
3826
|
{
|
|
3793
3827
|
rule: "symbol",
|
|
3794
|
-
formatString: "base
|
|
3828
|
+
formatString: "base",
|
|
3795
3829
|
size: "2xs",
|
|
3796
3830
|
showIcon: true,
|
|
3797
3831
|
onClick: () => {
|
|
3798
3832
|
props.onSymbolChange?.({ symbol: item.symbol });
|
|
3799
3833
|
},
|
|
3834
|
+
suffix: /* @__PURE__ */ jsxRuntime.jsx(SymbolBadge, { symbol: item.symbol }),
|
|
3800
3835
|
children: item.symbol
|
|
3801
3836
|
}
|
|
3802
3837
|
),
|
|
@@ -4453,7 +4488,7 @@ var usePositionHistoryColumn = (props) => {
|
|
|
4453
4488
|
title: t("common.symbol"),
|
|
4454
4489
|
dataIndex: "symbol",
|
|
4455
4490
|
fixed: "left",
|
|
4456
|
-
width:
|
|
4491
|
+
width: 250,
|
|
4457
4492
|
onSort: (r1, r2) => {
|
|
4458
4493
|
return r1.symbol?.localeCompare(r2.symbol || "");
|
|
4459
4494
|
},
|
|
@@ -4683,16 +4718,10 @@ var SymbolInfo2 = (props) => {
|
|
|
4683
4718
|
),
|
|
4684
4719
|
/* @__PURE__ */ jsxRuntime.jsxs(ui.Flex, { direction: "column", itemAlign: "start", gap: 1, children: [
|
|
4685
4720
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
4686
|
-
|
|
4721
|
+
PositionSymbolCell,
|
|
4687
4722
|
{
|
|
4688
|
-
|
|
4689
|
-
|
|
4690
|
-
onClick: (e) => {
|
|
4691
|
-
onSymbolChange?.({ symbol: record.symbol });
|
|
4692
|
-
e.stopPropagation();
|
|
4693
|
-
e.preventDefault();
|
|
4694
|
-
},
|
|
4695
|
-
children: `${record.symbol.split("_")[1]}-PERP`
|
|
4723
|
+
symbol: record.symbol,
|
|
4724
|
+
onSymbolChange
|
|
4696
4725
|
}
|
|
4697
4726
|
),
|
|
4698
4727
|
/* @__PURE__ */ jsxRuntime.jsx(ui.Flex, { gap: 1, wrap: "wrap", children: tags })
|
|
@@ -5026,9 +5055,10 @@ var SymbolToken2 = (props) => {
|
|
|
5026
5055
|
{
|
|
5027
5056
|
intensity: 80,
|
|
5028
5057
|
rule: "symbol",
|
|
5029
|
-
formatString: "base
|
|
5058
|
+
formatString: "base",
|
|
5030
5059
|
size: "sm",
|
|
5031
5060
|
prefix: /* @__PURE__ */ jsxRuntime.jsx(ui.Badge, { color: isBuy ? "success" : "danger", size: "xs", children: isBuy ? t("common.buy") : t("common.sell") }),
|
|
5061
|
+
suffix: /* @__PURE__ */ jsxRuntime.jsx(SymbolBadge, { symbol }),
|
|
5032
5062
|
onClick: () => {
|
|
5033
5063
|
props.onSymbolChange?.({ symbol });
|
|
5034
5064
|
},
|
|
@@ -5336,7 +5366,7 @@ var Header = (props) => {
|
|
|
5336
5366
|
]
|
|
5337
5367
|
}
|
|
5338
5368
|
),
|
|
5339
|
-
/* @__PURE__ */ jsxRuntime.jsxs(ui.Flex, { direction: "column", itemAlign: "end",
|
|
5369
|
+
/* @__PURE__ */ jsxRuntime.jsxs(ui.Flex, { direction: "column", itemAlign: "end", children: [
|
|
5340
5370
|
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "2xs", intensity: 36, children: t("positions.history.column.netPnl") }),
|
|
5341
5371
|
/* @__PURE__ */ jsxRuntime.jsxs(ui.Flex, { gapX: 1, children: [
|
|
5342
5372
|
/* @__PURE__ */ jsxRuntime.jsx("button", { onClick: showAlert, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Text.numeral, { size: "xs", coloring: true, children: props.item.netPnL ?? "--" }) }),
|
|
@@ -5574,16 +5604,8 @@ var useLiquidationColumn = (props) => {
|
|
|
5574
5604
|
{
|
|
5575
5605
|
title: t("common.symbol"),
|
|
5576
5606
|
dataIndex: "Symbol",
|
|
5577
|
-
|
|
5578
|
-
render: (_, record) => /* @__PURE__ */ jsxRuntime.jsx(ui.Flex, { direction: "column", itemAlign: "start", children: record.positions_by_perp?.map((item) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
5579
|
-
ui.Text.formatted,
|
|
5580
|
-
{
|
|
5581
|
-
rule: "symbol",
|
|
5582
|
-
formatString: "base-quote",
|
|
5583
|
-
children: item.symbol
|
|
5584
|
-
},
|
|
5585
|
-
item.symbol
|
|
5586
|
-
)) })
|
|
5607
|
+
width: 120,
|
|
5608
|
+
render: (_, record) => /* @__PURE__ */ jsxRuntime.jsx(ui.Flex, { direction: "column", itemAlign: "start", children: record.positions_by_perp?.map((item) => /* @__PURE__ */ jsxRuntime.jsx(PositionSymbolCell, { symbol: item.symbol }, item.symbol)) })
|
|
5587
5609
|
},
|
|
5588
5610
|
// Price (USDC)
|
|
5589
5611
|
{
|
|
@@ -5751,9 +5773,15 @@ var Header2 = (props) => {
|
|
|
5751
5773
|
ui.Text.formatted,
|
|
5752
5774
|
{
|
|
5753
5775
|
rule: "symbol",
|
|
5754
|
-
formatString: "base
|
|
5776
|
+
formatString: "base",
|
|
5755
5777
|
size: "xs",
|
|
5756
5778
|
intensity: 80,
|
|
5779
|
+
suffix: /* @__PURE__ */ jsxRuntime.jsx(
|
|
5780
|
+
SymbolBadge,
|
|
5781
|
+
{
|
|
5782
|
+
symbol: props.item.positions_by_perp?.[0]?.symbol || ""
|
|
5783
|
+
}
|
|
5784
|
+
),
|
|
5757
5785
|
children: props.item.positions_by_perp?.[0]?.symbol || ""
|
|
5758
5786
|
}
|
|
5759
5787
|
) }) }) }),
|